-
Notifications
You must be signed in to change notification settings - Fork 194
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
glsl-out: Add support for push constant emulation #1672
Conversation
bfc4cec
to
0c2f100
Compare
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.
Looks great!
Can we have a small glsl test for this (or add it to an existing one)?
@kvark I've added a test, it's basically a stripped down version of |
@@ -439,6 +439,7 @@ fn convert_wgsl() { | |||
Targets::SPIRV | Targets::METAL | Targets::HLSL | Targets::WGSL | Targets::GLSL, | |||
), | |||
("extra", Targets::SPIRV | Targets::METAL | Targets::WGSL), | |||
("push-constants", Targets::GLSL), |
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.
Since extra
enables push constants, could we just enable it instead of the new test?
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.
I wrote about it in my comment, extra.wgsl
uses f64
s which gles doesn't support
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.
oh sorry, didn't see this
This PR allows for the glsl backend to output push constants as uniform buffers to allow for push constant emulation.
It only allows for one push constant per entry point, which is fine in my opinion since even vulkan glsl only allows one
push_constant
decoration per shader.It also changes the
ReflectionInfo
to return a name of the uniform buffer used for the emulation if it was used andOptions
to take the binding to use for the buffer if explicit bindings are supported.This interface is deeply tied with the changes for push constant emulation on wgpu, so it might be useful to also see it JCapucho/wgpu@ee3887e
Note: I don't have much experience with openGL so the code might not be the best.