-
-
Notifications
You must be signed in to change notification settings - Fork 717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WebGL matrix performance fix #5072
base: main
Are you sure you want to change the base?
Conversation
It would be nice to also have some hard perf numbers for this from a benchmark. I will see if there is a benchmark that can catch this and try to post some numbers tomorrow. |
Nice work and quick fix! |
@@ -1197,7 +1197,7 @@ export class GlobeTransform implements ITransform { | |||
const fallbackMatrixScaled = createMat4f64(); | |||
mat4.scale(fallbackMatrixScaled, projectionData.fallbackMatrix, [EXTENT, EXTENT, 1]); | |||
|
|||
projectionData.fallbackMatrix = fallbackMatrixScaled; | |||
projectionData.fallbackMatrix = new Float32Array(fallbackMatrixScaled); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to create a 64f matrix and then save it as 32? It's it easier to create a 32 from the start or does it help precision and worth the conversion?
@@ -416,7 +416,7 @@ export class MercatorTransform implements ITransform { | |||
const tileMatrix = calculateTileMatrix(tileID, this.worldSize); | |||
mat4.multiply(tileMatrix, aligned ? this._alignedProjMatrix : this._viewProjMatrix, tileMatrix); | |||
|
|||
cache[posMatrixKey] = tileMatrix; | |||
cache[posMatrixKey] = new Float32Array(tileMatrix); // Must be 32 bit floats, otherwise WebGL calls in Chrome get very slow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question as above.
Added a small question around object creation... |
Fixes #5070 by passing float32 matrices to WebGL instead of float64. Note that the performance degradation only seemed to affect Chrome, not Firefox. Updates relevant unit & render tests.