United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6690659 Simple primitives (rectangle and lines) are slow when rendered with a transform
JDK-6690659 : Simple primitives (rectangle and lines) are slow when rendered with a transform

Details
Type:
Bug
Submit Date:
2008-04-18
Status:
Closed
Updated Date:
2010-04-02
Project Name:
JDK
Resolved Date:
2008-04-27
Component:
client-libs
OS:
generic
Sub-Component:
2d
CPU:
generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
6
Fixed Versions:
6u10 (b23)

Related Reports
Backport:
Relates:
Relates:
Relates:

Sub Tasks

Description
A short test case is attached which shows that simple transformed rectangle
fills and AA rectangles are up to 20 or more times slower than simple
untransformed rectangle fills, even on the latest hardware.  With the power
of the hardware GPUs in todays machines, there should be little, if any,
difference in the rendering speed of these primitives.

Indeed, experiments show that we can achieve near-parity for transformed and
AA rectangles and wide lines using simple variations of the D3D and OGL
FillRect primitive and a small Pixel Shader program that runs on most
graphics cards that have been common for the past 3 or 4 years.

                                    

Comments
EVALUATION

With a simple shader program and some new internal pipeline pathways the
performance of the following primitives can improve by a factor of around
10x depending on the hardware:

fillRect()                AA and transformed
fill(Rectangle2D) non-AA, AA, and transformed
drawRect()                AA and transformed
draw(Rectangle2D) non-AA, AA, and transformed
drawLine()                AA and transformed
draw(Line2D)      non-AA, AA, and transformed

Running tests on a 512MB nVidia 8600GT M:

With these changes the attached test case improves by a factor of about
9x to 20x for the 3 cases where AA or transforms are involved.

A very dramatic improvement can be seen in the Scenario demo DynamicDemo
which improves by the following amounts:

                      orig6u10         newshader

AA stroke/fill          6984ms           656ms   (10.6x)
AA stroke               4468ms           531ms   ( 8.4x)
AA fill                 2922ms           437ms   ( 6.7x)

non-AA stroke/fill      1656ms           656ms   ( 2.5x)
non-AA stroke            797ms           531ms   ( 1.5x)
non-AA fill             1141ms           422ms   ( 2.7x)
                                     
2008-04-18



Hardware and Software, Engineered to Work Together