-
Notifications
You must be signed in to change notification settings - Fork 259
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: Ability to access default values for parameters in a constant buffer (ubo) #125
Comments
Yes, glslang currently emits:
This is because the shader does not really initialize these values; the driver does. It is information that does not belong in the shader other than as syntactic sugar for a driver operation. At some point, the initializers need to become side-band data, and that has not been done yet for the glslang path. Do you know for other tool chains if it always stays in the shader, or when it becomes part of some other payload? |
I just realized this is the SPIRV-Header project, not glslang. Can you submit this against the tool you are having trouble with? |
I was redirected here by @HansKristian-Work from https://github.com/KhronosGroup/SPIRV-Cross as I was told this is the place for SPIR-V spec related issues. |
Ah, you are asking that SPIR-V start carrying this information, and that client APIs properly handle it. |
That's how I understood it, SPIR-V cannot represent this meta-data so I redirected the issue here. Perhaps adding support for OpDecorateMemberID with a constant would help here. |
I can see it for non-buffer uniforms, and SPIR-V does say already that is up to the client, and it can be handled naturally just as an initializer. That also makes sense for a structure. But a SPIR-V buffer (Vulkan SSBO or UBO) seems odd to do this for. And, Vulkan only allows buffers. What is the full specification of what should happen? That the driver strip this from the SPIR-V and partially overwrite application buffers with it? When? |
Right, it does get annoying since drivers would have to understand that SPIR-V, and that's another extension which seems rather overkill. Unfortunately this kind of falls between debug info and decorations in scope I think, and there is no standard way for shaders to add external meta-data which drivers know how to ignore, and for tools not to strip away. |
Please check this post:
KhronosGroup/SPIRV-Cross#1094
I use Microsoft directx shader compiler to generate spirv code from hlsl and process it using spirv-cross library.
Inside hlsl code I define a constant buffer:
I would like to be able to access the default values for 'param'
This can be done in d3d reflection api (when compiling to dxil byte code instead of spirv), but I haven't seen an option to do it in spirv.
Thank you very much
The text was updated successfully, but these errors were encountered: