Skip to content
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

WebGLUniformsGroups: Fix and improve UBOs array caching system #27374

Merged
merged 2 commits into from
Dec 14, 2023

Conversation

RenaudRohlinger
Copy link
Collaborator

While testing array of UBOs I realized that the caching system was only taking in consideration the first entry of an array of uniform.

I refactored the caching system with using a uniformIndex_uniformIndexInArray key system to fix this.

Also the caching system was handling basic arrays which is something that WebGLUniformsGroups doesn't support yet. Not sure if Uniforms in threejs supports basic arrays OOTB (for example Uniform( [0,1,2] ) instead of Uniform( new THREE.Vector3(0,1,2) ) )?
Currently it adds unnecessary complexity to the caching system and anyway support is not there so I removed it.

Copy link

📦 Bundle size

Full ESM build, minified and gzipped.

Filesize dev Filesize PR Diff
668.9 kB (166.1 kB) 668.6 kB (166 kB) -258 B

🌳 Bundle size after tree-shaking

Minimal build including a renderer, camera, empty scene, and dependencies.

Filesize dev Filesize PR Diff
449.7 kB (109 kB) 449.5 kB (108.9 kB) -258 B

@Mugen87 Mugen87 added this to the r160 milestone Dec 14, 2023
@Mugen87 Mugen87 merged commit 37cb4ae into mrdoob:dev Dec 14, 2023
12 checks passed
@Mugen87
Copy link
Collaborator

Mugen87 commented Dec 14, 2023

Not sure if Uniforms in threejs supports basic arrays OOTB (for example Uniform( [0,1,2] )

Yes, this is supported. https://jsfiddle.net/c8oydmk9/

AdaRoseCannon pushed a commit to AdaRoseCannon/three.js that referenced this pull request Jan 15, 2024
…b#27374)

* fix and improve UBOs array caching system

* simplify cache check
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.

2 participants