JDK-8101036 : Optimize matrix loading in ES2 pipeline
  • Type: Enhancement
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: fx2.1
  • Priority: P5
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2011-12-23
  • Updated: 2015-06-16
  • Resolved: 2013-04-10
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.
JDK 8
8Fixed
Related Reports
Relates :  
Description
In the course of reviewing the fix for RT-13234 we discovered a couple optimizations that we didn't do at that time, but which should be done at some point.

First, the flipped view matrix could be computed once (whenever the projection is computed) and stored in the ES2Context rather than computed each time the matrix is set. This would save one matrix multiplication.

Second, there is code that basically looks like this:

        if (xform == null) {
            xform = BaseTransform.IDENTITY_TRANSFORM;
        }

        if (currentTarget instanceof ES2RTTexture) {
            scratchTx.set(flipTx);
        } else {
            scratchTx.setIdentity();
        }
        loadMatrix(scratchTx.mul(projViewTx).mul(xform));

which could be simplified, especially if we optimize mul to check for identity. As Jim noted:

"I like the idea of optimizing mul() since that would handle the case of the caller passing in an IDENTITY.  At one point, when I added the BaseTransform stuff and created a lightweight (singular if you do it right) IDENTITY matrix I was planning on going through the code base and outlawing null transforms, but never got there.  If we do that, then we'd want the identity optimization in mul() since we'd no longer have a null to test..."

Comments
Part 2 of 2: Changeset: cf974325affb Author: Chien Yang <chien.yang@orcale.com> Date: Wed Apr 10 14:50:06 2013 -0700 URL: http://jfxsrc.us.oracle.com/javafx/8.0/scrum/graphics/rt/rev/cf974325affb
10-04-2013

First part of this optimization is done in the 3d sandbox. The only work left is identity optimization in mul().
29-03-2013

Not an important tweak for 2.2 deferring to Lombard.
16-05-2012