-
Notifications
You must be signed in to change notification settings - Fork 221
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
Constant not supported in GLSL shader binding style declaration #5690
Comments
This appears to be a missing feature support for GLSL. |
Thanks @jkwak-work, would you be able to point me at few places if I want to contribute to add this feature ? |
I think this can be a bit involving. The following code needs to be changed from:
to:
And the logic that tries to read the value should be deferred until we can get the value assigned to variables. |
In HLSL, const int x; in global scope means declaring a uniform parameter, i.e. equivalent to uniform int x; the right syntax to define global compile time constant is to write: static const int x=0; |
We should modify Then during |
I really want this to be supported as well and I am working on a patch. I need clarification regarding non-uniform-block uniform variables. Vulkan SPIR-V does not allow these, but slang compiles them with a warning. I noticed that global non-block uniforms are grouped into a single block, and any layout binding qualifiers are ignored. Can you confirm if this is the intended behavior? Additionally, I would like this behavior to support other layout attributes, such as the input attachment index. Are there any objections to this? Thanks |
Sure, no objections to add constant folding for any glsl flavored layout modifiers. Just need to change the type of The checking logic should follow the similar path as |
Hi team,
I am trying to compile some of our GLSL shaders using
slangc
and I am running into issues because we are using constant in shader bindings declaration.Currently we are using google/shaderc to compile our shader and we do not run into this compiler issue.
See below for a minimal repro case.
If you can point me to how to port it as a Slang test I would gladly contribute it if that helps.
Given the following
constant-in-layout.slang
filecompiling the above file using the following command line
slangc.exe -target spirv -stage fragment -entry main constant-in-layout.slang
Will produce the following errors
The text was updated successfully, but these errors were encountered: