JDK-6531647 : OGL: accelerate antialiased rendering for all AlphaComposite modes
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 5.0
  • Priority: P4
  • Status: Open
  • Resolution: Unresolved
  • OS: solaris_9
  • CPU: generic
  • Submitted: 2007-03-06
  • Updated: 2013-08-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0-poolUnresolved
Related Reports
Relates :  
Description
Today the OGL pipeline only "accelerates" antialiased rendering (via the OGLMaskFill
primitive) in the following cases:
  - AlphaComposite.SrcOver
  - AlphaComposite.Src, extra alpha == 1.0, source paint is opaque

The reason we can't support any arbitrary AlphaComposite mode is because of the
way the MaskFill operation is defined:
    dst = ((src <MODE> dst) * maskA) + (dst * (1 - maskA))

This can be simplified as follows for the above modes, which can then be easily
accelerated via OpenGL using its built-in blending functions:
    dst = (src * maskA) <SrcOver> dst

Implementing most of the other AlphaComposite rules would require performing the
compositing step in a shader, which can be tricky given that the framebuffer contents
are not accessible from a fragment shader.  This bug report proposes to make changes
to OGLMaskFill and OGLPaints so that it becomes possible to accelerate these other
AlphaComposite modes when fragment shaders are available in hardware.  This
approach should be much faster than the software-based loops that we fall back on
today in these cases, because it won't be necessary to suffer the cost of reading
back from VRAM into system memory to perform the compositing operation.  In addition,
these changes will pave the way for accelerating the extended compositing modes
that are proposed in 5094232.

Comments
EVALUATION Here are some preliminary results on an Nvidia Quadro FX 1100, Solaris 10: Options common across all tests: testname=graphics.render.tests.shape.fillCubic graphics.opts.xormode=false graphics.opts.renderhint=Default graphics.opts.extraalpha=false graphics.render.opts.alphacolor=false global.dest=VolatileImg graphics.opts.sizes=250 graphics.opts.clip=false graphics.opts.anim=2 graphics.opts.alpharule=SrcAtop,graphics.render.opts.antialias=false,graphics.render.opts.paint=gradient2: 1100.old: 300766.85695 (var=10.66%) (100.0%) 1100.new: 298545.28571 (var=0.75%) (99.26%) graphics.opts.alpharule=SrcAtop,graphics.render.opts.antialias=false,graphics.render.opts.paint=radial3: 1100.old: 21654.07635 (var=0.03%) (100.0%) 1100.new: 21661.29919 (var=0.03%) (100.03%) graphics.opts.alpharule=SrcAtop,graphics.render.opts.antialias=false,graphics.render.opts.paint=single: 1100.old: 372773.04715 (var=0.98%) (100.0%) 1100.new: 372629.36198 (var=0.47%) (99.96%) graphics.opts.alpharule=SrcAtop,graphics.render.opts.antialias=true,graphics.render.opts.paint=gradient2: 1100.old: 697.0569663 (var=0.17%) (100.0%) 1100.new: 11774.60753 (var=0.4%) (1689.19%) graphics.opts.alpharule=SrcAtop,graphics.render.opts.antialias=true,graphics.render.opts.paint=radial3: 1100.old: 600.9538461 (var=0.44%) (100.0%) 1100.new: 9941.513684 (var=0.5%) (1654.29%) graphics.opts.alpharule=SrcAtop,graphics.render.opts.antialias=true,graphics.render.opts.paint=single: 1100.old: 701.3525991 (var=1.85%) (100.0%) 1100.new: 14568.63994 (var=0.55%) (2077.22%) graphics.opts.alpharule=SrcOver,graphics.render.opts.antialias=false,graphics.render.opts.paint=gradient2: 1100.old: 299639.26258 (var=0.8%) (100.0%) 1100.new: 298351.90947 (var=0.67%) (99.57%) graphics.opts.alpharule=SrcOver,graphics.render.opts.antialias=false,graphics.render.opts.paint=radial3: 1100.old: 21654.78452 (var=0.0%) (100.0%) 1100.new: 21654.78452 (var=3.17%) (100.0%) graphics.opts.alpharule=SrcOver,graphics.render.opts.antialias=false,graphics.render.opts.paint=single: 1100.old: 371642.69090 (var=4.02%) (100.0%) 1100.new: 374840.04719 (var=3.6%) (100.86%) graphics.opts.alpharule=SrcOver,graphics.render.opts.antialias=true,graphics.render.opts.paint=gradient2: 1100.old: 16357.54375 (var=0.14%) (100.0%) 1100.new: 16480.93529 (var=0.03%) (100.75%) graphics.opts.alpharule=SrcOver,graphics.render.opts.antialias=true,graphics.render.opts.paint=radial3: 1100.old: 12316.90647 (var=0.14%) (100.0%) 1100.new: 12299.01802 (var=0.44%) (99.85%) graphics.opts.alpharule=SrcOver,graphics.render.opts.antialias=true,graphics.render.opts.paint=single: 1100.old: 23127.22672 (var=0.97%) (100.0%) 1100.new: 23204.01414 (var=0.87%) (100.33%) Summary: 1100.old: Number of tests: 12 Overall average: 120160.97990377284 Best spread: 0.0% variance Worst spread: 10.66% variance (Basis for results comparison) 1100.new: Number of tests: 12 Overall average: 122995.95139373116 Best spread: 0.03% variance Worst spread: 3.6% variance Comparison to basis: Best result: 2077.22% of basis Worst result: 99.26% of basis Number of wins: 3 Number of ties: 9 Number of losses: 0 As you can see, no change in performance for operations that were already accelerated, and a 16x to 20x improvement for non-SrcOver antialiased operations. Comparing to the software loops (X11 pipeline enabled), it appears that we still have some work to do for AA performance (but a bug has recently been filed for that issue, see 6529101): Options common across all tests: testname=graphics.render.tests.shape.fillCubic graphics.opts.xormode=false graphics.opts.renderhint=Default graphics.opts.extraalpha=false graphics.render.opts.alphacolor=false global.dest=VolatileImg graphics.opts.sizes=250 graphics.opts.clip=false graphics.opts.anim=2 graphics.opts.alpharule=SrcAtop,graphics.render.opts.antialias=false,graphics.render.opts.paint=gradient2: 1100.x11: 7747.997644 (var=0.07%) (100.0%) 1100.old: 300766.85695 (var=10.66%) (3881.87%) 1100.new: 298545.28571 (var=0.75%) (3853.19%) graphics.opts.alpharule=SrcAtop,graphics.render.opts.antialias=false,graphics.render.opts.paint=radial3: 1100.x11: 3929.818273 (var=0.34%) (100.0%) 1100.old: 21654.07635 (var=0.03%) (551.02%) 1100.new: 21661.29919 (var=0.03%) (551.2%) graphics.opts.alpharule=SrcAtop,graphics.render.opts.antialias=false,graphics.render.opts.paint=single: 1100.x11: 8515.886255 (var=0.81%) (100.0%) 1100.old: 372773.04715 (var=0.98%) (4377.38%) 1100.new: 372629.36198 (var=0.47%) (4375.7%) graphics.opts.alpharule=SrcAtop,graphics.render.opts.antialias=true,graphics.render.opts.paint=gradient2: 1100.x11: 15937.13917 (var=0.27%) (100.0%) 1100.old: 697.0569663 (var=0.17%) (4.37%) 1100.new: 11774.60753 (var=0.4%) (73.88%) graphics.opts.alpharule=SrcAtop,graphics.render.opts.antialias=true,graphics.render.opts.paint=radial3: 1100.x11: 3548.736074 (var=0.07%) (100.0%) 1100.old: 600.9538461 (var=0.44%) (16.93%) 1100.new: 9941.513684 (var=0.5%) (280.14%) graphics.opts.alpharule=SrcAtop,graphics.render.opts.antialias=true,graphics.render.opts.paint=single: 1100.x11: 22568.86582 (var=0.07%) (100.0%) 1100.old: 701.3525991 (var=1.85%) (3.11%) 1100.new: 14568.63994 (var=0.55%) (64.55%) graphics.opts.alpharule=SrcOver,graphics.render.opts.antialias=false,graphics.render.opts.paint=gradient2: 1100.x11: 5737.476861 (var=2.68%) (100.0%) 1100.old: 299639.26258 (var=0.8%) (5222.49%) 1100.new: 298351.90947 (var=0.67%) (5200.05%) graphics.opts.alpharule=SrcOver,graphics.render.opts.antialias=false,graphics.render.opts.paint=radial3: 1100.x11: 4271.989063 (var=29.16%) (100.0%) 1100.old: 21654.78452 (var=0.0%) (506.9%) 1100.new: 21654.78452 (var=3.17%) (506.9%) graphics.opts.alpharule=SrcOver,graphics.render.opts.antialias=false,graphics.render.opts.paint=single: 1100.x11: 441439.77005 (var=2.15%) (100.0%) 1100.old: 371642.69090 (var=4.02%) (84.19%) 1100.new: 374840.04719 (var=3.6%) (84.91%) graphics.opts.alpharule=SrcOver,graphics.render.opts.antialias=true,graphics.render.opts.paint=gradient2: 1100.x11: 17496.38276 (var=0.55%) (100.0%) 1100.old: 16357.54375 (var=0.14%) (93.49%) 1100.new: 16480.93529 (var=0.03%) (94.2%) graphics.opts.alpharule=SrcOver,graphics.render.opts.antialias=true,graphics.render.opts.paint=radial3: 1100.x11: 3621.170480 (var=0.7%) (100.0%) 1100.old: 12316.90647 (var=0.14%) (340.14%) 1100.new: 12299.01802 (var=0.44%) (339.64%) graphics.opts.alpharule=SrcOver,graphics.render.opts.antialias=true,graphics.render.opts.paint=single: 1100.x11: 26587.40460 (var=0.34%) (100.0%) 1100.old: 23127.22672 (var=0.97%) (86.99%) 1100.new: 23204.01414 (var=0.87%) (87.27%) Summary: 1100.x11: Number of tests: 12 Overall average: 46783.55308965824 Best spread: 0.07% variance Worst spread: 29.16% variance (Basis for results comparison) 1100.old: Number of tests: 12 Overall average: 120160.97990377284 Best spread: 0.0% variance Worst spread: 10.66% variance Comparison to basis: Best result: 5222.49% of basis Worst result: 3.11% of basis Number of wins: 6 Number of ties: 0 Number of losses: 6 1100.new: Number of tests: 12 Overall average: 122995.95139373116 Best spread: 0.03% variance Worst spread: 3.6% variance Comparison to basis: Best result: 5200.05% of basis Worst result: 64.55% of basis Number of wins: 7 Number of ties: 0 Number of losses: 5
2007-03-07

EVALUATION This will require a fair amount of changes to OGLMaskFill and related code, but it should be well worth it from the performance standpoint.
2007-03-06