google / google/shaderc

Auto specialization constant IDs

Open
#1,335 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.2k
Forks
445
Avg merge
11h 6m
Merged PRs (30d)
6

Description

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_id`s 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_id`s, 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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.