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

WebGLUniforms: Cache texture unit values when setting texture array uniforms. #24637

Merged
merged 1 commit into from
Sep 13, 2022

Conversation

snagy
Copy link
Contributor

@snagy snagy commented Sep 13, 2022

Description

I noticed a bunch of redundant uniform1iv calls in a scene that used cascaded shadow maps (which use a texture array). Turns out, the setValueT*Array calls don't cache off the texture units before setting them; by using the array cache checking stuff like most of the other array uniforms, I was able to shave a bunch of useless uniform1iv calls from my scene and increase perf.

I duplicated this change across the other texture array setters, because I don't think that array ever gets too large and it seems like it probably does more good than harm, but I didn't actually test anything but setValueT1Array.

This contribution is funded by Meta

@Mugen87 Mugen87 changed the title Cache texture unit values when setting texture array uniforms WebGLUniforms: Cache texture unit values when setting texture array uniforms. Sep 13, 2022
@Mugen87 Mugen87 added this to the r145 milestone Sep 13, 2022
@Mugen87 Mugen87 merged commit 18f9047 into mrdoob:dev Sep 13, 2022
@Mugen87
Copy link
Collaborator

Mugen87 commented Sep 13, 2022

FYI: Not all uniform arrays are cached because of #16355.

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