Fixing retrospective code for specialisation constants #58628
Merged
+8
−5
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.
This was a weird on but it caused the vulkan mobile renderer to fail rendering lights for ages.
When parsing the compiled shader to obtain the default values for our specialization constants, when assigning a bool it failed if the previous values was a floating point value. It may also fail with ints but I didn't test all edge cases.
My theory here is that because any non-zero value is true, setting the bool was getting confused. The fix was really simple, just reset it's current value before the boolean is assigned.
I also added
SpvReflectSpecializationConstant *spc = spec_constants[j];
because it made debugging easier though debugging this is a pain because this code is threaded.The real fix is just the onliner
sconst.int_value = 0.0; // clear previous value JIC
before the case statement :)