Extend shader compiler define syntax to allow name=value instead of just valueless defines #1539
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Using shader specialization constants to size global arrays doesn't work on the Mac.
We have a need in our vertex shader to size both a vertex attribute array and an array of gl_clipDistance by a defined value at shader compile time. We were using shader specialization constants to achieve this and on Linux and Windows with NVidia and AMD we seemed to have success even though the "Arrays inside a block" discussion in section "4.4.x Specialization-Constant Qualifier" of ARB_gl_spirv.txt made it sound like using specialization constants to size these array members in the shader is not supported. When we tried out the same code on the Mac we had very unreliable results and were not able to get clipping to work correctly if the vertex array or the gl_ClipDistance array was sized by a specialization constant.
Currently, valueless shader compiler defines are added to a
std::set<std::string>container via the shader module's hints. This PR extents the syntax to allowname=valuewithout changing the client API thereby providing an option for defines with simple values for use the in the shader code.Fixes # (issue)
#1534
Type of change
Core VSG change
Please delete options that are not relevant.
How Has This Been Tested?
I extended the vsgclip example in the vsgExamples repository. See vsgExamples pull request 364.
Checklist: