Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8101036

Optimize matrix loading in ES2 pipeline

    Details

      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..."

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ckyang Chien Yang (Inactive)
                Reporter:
                kcr Kevin Rushforth
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported: