Details
-
Enhancement
-
Resolution: Fixed
-
P5
-
fx2.1
-
Mac OS X
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..."
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
- relates to
-
JDK-8112859 Mac: Scene with perspectiveCamera rendered inverted in the Y axis and with some incorrect dirty region computation
-
- Closed
-