shader-slang / slang

Making it easier to work with shaders
MIT License
1.78k stars 159 forks source link

Shader constants not working? #3581

Open fknfilewalker opened 4 months ago

fknfilewalker commented 4 months ago

I want to use a shader with a shader constant like this

layout(constant_id = 0) const int MULTIPLIER = 0;

but the code generated by slang always wants to use a uniform descriptor at Set 0 Binding 1. Is this not implemented or is this a bug? I am using vulkan.

edit: Not talking about the slang feature #3565 but the functionality used in vulkan, slang just needs to generate spirv that allows this

csyonghe commented 4 months ago

Specialization constants are not supported in Slang mostly because we aren't seeing a clear benefit of it and none of our existing users have requested it.

fknfilewalker commented 4 months ago

Is this something you would merge? If so, could you point me to the important locations in the code, then I could take a look at it.

csyonghe commented 4 months ago

Yes, we welcome contributions.

You can take a look at how push constants are handled and add another case for specialization constants. It will be nontrivial amount of work considering it affects parameter layout and reflection.

swoods-nv commented 4 months ago

Marking this as Q3 milestone because we don't plan to take near term action, but it needs a milestone to be considered triaged.

swoods-nv commented 2 weeks ago

Removing milestone, because it's not being worked within the team (and is still considered triaged because it has a label)