-
Notifications
You must be signed in to change notification settings - Fork 949
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
Increase GL MAX_PUSH_CONSTANTS from 16 to 64 #3374
Conversation
59d71b4
to
47ef07c
Compare
Codecov Report
@@ Coverage Diff @@
## master #3374 +/- ##
==========================================
- Coverage 64.70% 64.63% -0.07%
==========================================
Files 66 86 +20
Lines 37336 42722 +5386
==========================================
+ Hits 24159 27615 +3456
- Misses 13177 15107 +1930
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
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.
LGTM, 256 is the standard push constant limit anyway
You have a test failing - but also we might have issues with the number of uniforms - we probably should at least be consulting the limits set by GL |
Darn, I couldn't test that here trivially. It looks like the test was set up assuming a size of 16 though, if I'm reading this right. Will need to find a way to adjust that. |
Actually, am I right in reading that this test wouldn't run if the push constants limit was less than 128? If so, this test was implicitly skipped until now and has never run for GLES. I can still find a way to make it work though! wgpu/wgpu/tests/shader/struct_layout.rs Lines 221 to 224 in f0f700c
|
Heh, you are. If you can make it work great! Otherwise you can mark it as a failure and file a followup issue. |
Looked into this a bit, I'll mark it as failing and open an issue. In short: It definitely didn't work before this PR, but it was ignored until now. I'm not sure how this is supposed to work though, how do other backends handle |
The shader is just the view into the push constants - you're allowed to push up more and only view part of it. |
Checklist
cargo clippy
.RUSTFLAGS=--cfg=web_sys_unstable_apis cargo clippy --target wasm32-unknown-unknown
if applicable.Connections
None.
Description
I've found that using the emulated push constants is significantly faster than buffer juggling on our own on the webgl backend. However, it's limited to 16*4 bytes right now, which is too small for our needs.
I can't find any rationale behind it behind just 16*4, it's possible it was a naga limitation but it doesn't seem to be the case anymore? The docs for
Limits::max_push_constant_size
suggest it should be 256 on GLES so this increases it to that, which can hold a couple of matrices nicely.If I'm wrong and there's a limitation I missed somewhere and this doesn't actually work somehow, then okay, nevermind! But I've tested this out on Ruffle and it seems to work perfect and performant for us.
Testing
Manually tested and it works fine, not sure it deserves its own unit test.