-
Notifications
You must be signed in to change notification settings - Fork 242
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
Implement specialization constant support in numthreads / local_size #5963
base: master
Are you sure you want to change the base?
Implement specialization constant support in numthreads / local_size #5963
Conversation
cde9d98
to
1862056
Compare
1862056
to
1c7b6cc
Compare
I've now tested this in a real Vulkan program in a couple of different contexts, and this feature seems to now work correctly. |
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.
Can you add a test for this feature?
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 good to me. I wish there is a cleaner way to add this feature, but what is implemented in this PR is probably the easiest path forward. If I understand the code correctly, this implementation won't allow something like [numthreads(specConst+1, 1, 2)]
, right?
It currently doesn't allow doing math on the specialization constant, because I'm fairly sure that that can't be expressed in SPIR-V. I'll fix that compiler warning later today, I've been developing on Linux only so I guess MSVC errors are to be expected. |
Adds support for using SPIR-V specialization constants in
numthreads
:Also adds support in GLSL mode:
Similar to the
local_size_x_id
feature from GLSL, this allows users to generate shader permutations with different work group shapes / thread counts after the shader has already been compiled to SPIR-V.Currently, this works with the SPIR-V (using
LocalSizeId
execution mode) and GLSL (usinglocal_size_{x,y,z}_id
) targets. I'm not sure if there even is anything that could be done for the other targets, other than to just present diagnostics about this feature not being supported there.