-
Notifications
You must be signed in to change notification settings - Fork 213
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
[SpecializationConstant] should not cause allocation of descriptor set binding. #5595
Comments
The In Slang, the native way to use push constants is to define them as entrypoint uniform parameters. For example:
will result in SPIRV that puts both See playground demo here. |
Thanks that works for me. Also I am unsure if the Thanks a lot for the quick reply. Lastly, would you mind giving your opinion if this is a good approach to handle scenario where both bindless and bindful path need to be supported by a shader or is there a better way to do it with slang. Thanks in advance. |
I think it is a bug for the ParameterBlock to be assigned set 1. This is likely due to the existence of:
Slang might be thinking these are normal uniforms and need a uniform buffer binding in set 0, so any future parmaeter blocks got assigned set 1. Removing these the Slang currently does not have a first-class way of doing bindless, so I think your solution should work fine. |
Thanks, if you are okay, I keep this issue open to track the bug related to set assignment, or I could open a new issue, as you want. |
We can keep this issue as is, I updated the title to reflect the issue. |
Thanks for the patch, however, I am still having issues with a generated shader after applying your patch. The SPIR-V output still contains DescriptorSet index as 1 as the only descriptor set. I will share with you the shader I am using and the SPIR-V generated. Shader / EDIT: Note that I tested without the Specialization constants, and set number and bindings are correct when I dont use them. |
The playground hasn’t been updated to use top of tree slang. I updated it just now and it is now using set 0 with your shader code. |
My apologies. Indeed, I pulled the latest changes again and clean rebuild everything. Seems to be working after that. |
In-fact the issue I was having is not due to SpecializationConstants. I still end up having a descriptor set at index 1. Updated shader The shader I have should not produce a new DescriptorSet. I was actually having the issue in the GraphicsPipeline creation which was reporting I have no layout in my descriptorSetLayout for DescriptorSet 1, and it had me confused why was there a set at 1 to begin with, because indeed the reflection interface was also not reporting it. EDIT: The issue is probably because the texture is not in use in vertex shader, so when I link the two shaders, it computes set numbers separately for the ubo block and for the texture. Is there a way to force not to remove unused parameters or force all parameter group elements to be in a single set? |
I think this is due to a bug when compiling both entry points into the same spirv module. What happens if you compile just the fragment shader EntryPoint?
|
It feels like the entry point parameters some how got duplicated when there are two entry points. |
In-fact if I just compile using shader playground for example, by removing either of the entry points, everything is good. |
|
You may be thinking of |
Hi,
First off, thanks for providing a shader playground.
I was hoping that this could be supported, where all push constants are grouped together into a single constant block
Instead it generates glsl with two push constant blocks. I believe at-least it should throw an error. Shader link
Thanks in advance.
The text was updated successfully, but these errors were encountered: