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

Feature request: public reflection interface to obtain GLSL uniform constant initializer values #2055

Closed
slime73 opened this issue Jan 10, 2020 · 2 comments

Comments

@slime73
Copy link
Contributor

slime73 commented Jan 10, 2020

Desktop GLSL allows initializing unbuffered uniform variables to a constant value directly in shader code.

As far as I can tell (and please let me know if I'm wrong), glslang's reflection interface doesn't expose those values anywhere, but it does internally detect them because it correctly errors when a uniform is initialized to a non-constant value on desktop GLSL and when a uniform is initialized to a constant value in GLSL ES.

I'd really like a way to obtain their values (and whether they've been explicitly initialized), through glslang's APIs. I have an existing tool with desktop GLSL shaders written for it by a large number of people, and I want to use glslang's SPIRV output capabilities combined with SPIRV-Cross to translate those shaders to other graphics APIs, but not every shader will be able to be fully ported without having a way to identify those values, and I wouldn't be able to tell users when their shader wouldn't work either, unless I restrict myself to GLSL ES.

@slime73
Copy link
Contributor Author

slime73 commented Jan 10, 2020

I now see that #1588 exists - if after applying that change I can parse the constant values from spirv generated with glslang, I think that will be sufficient for my purposes.

@slime73
Copy link
Contributor Author

slime73 commented Jun 9, 2020

The above PR was merged. Thanks!

@slime73 slime73 closed this as completed Jun 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants