Skip to content

Extract U32 texture data upload logic and restore pixelStorei parameters#367

Open
mrxz wants to merge 1 commit into
sparkjsdev:mainfrom
mrxz:fix-render-state
Open

Extract U32 texture data upload logic and restore pixelStorei parameters#367
mrxz wants to merge 1 commit into
sparkjsdev:mainfrom
mrxz:fix-render-state

Conversation

@mrxz

@mrxz mrxz commented Jun 8, 2026

Copy link
Copy Markdown
Collaborator

Both SplatPager and SparkRenderer manually uploaded texture data using the WebGLRenderingContext directly. This stems from a limitation in Three.js preventing 2D regions from easily being updated, see mrdoob/three.js#32254. This PR extracts the logic into a utility function to avoid duplication.

Additionally the pixelStorei parameters set as part of this procedure weren't restored to the values they were before the upload. This becomes a problem with Three.js >= r184 as it now caches the parameter values in its WebGLState, see #366. This PR ensures they are now properly restored. Once Spark requires Three.js 184 or later it can switch to renderer.state.pixelStorei instead.

Fixes #366

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SparkRenderer leaks WebGL UNPACK_FLIP_Y pixel-store state into the host Three.js renderer → flipped texture re-uploads

1 participant