shaderc icon indicating copy to clipboard operation
shaderc copied to clipboard

Auto specialization constant IDs

Open NikolayKanchevski opened this issue 1 year ago • 2 comments

Heya, I recently found the functions SetAutoBindUniforms() and SetBindingBase() and I must admit they have been very useful to me. However, I also need such functionality for dealing with specialization constants and there is not one implemented, which is why I decided to write this small issue.

What I propose is adding three more methods - SetAutoMapConstants(bool) (which will search for the following syntax: layout() const Type varName = someValue; and will automatically set the constant_id property for each field), SetConstantsBase(uint) (this one will set the starting constant_id, so, supposing we use SetConstantsBase(10), constant_ids will start from 10 and grow as more fields are present) and SetPreserveConstants(bool) (does the same thing as SetPreserveBindings() - will either remove all specified constant_ids, or not).

It is really just extending the logic of shaderc::CompileOptions to not only work with locations and bindings, but also provide support for specialization constants.

NikolayKanchevski avatar Jun 17 '23 22:06 NikolayKanchevski

This first has to start as a feature in Glslang. Then we can pipe it through to Shaderc.

dneto0 avatar Jun 23 '23 21:06 dneto0

Oh, really? I did not know. Where should I then forward my message?

NikolayKanchevski avatar Jun 23 '23 22:06 NikolayKanchevski