Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing retrospective code for specialisation constants #58628

Conversation

BastiaanOlij
Copy link
Contributor

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 :)

@BastiaanOlij BastiaanOlij requested a review from a team as a code owner February 28, 2022 13:18
@BastiaanOlij BastiaanOlij self-assigned this Feb 28, 2022
@BastiaanOlij BastiaanOlij added this to the 4.0 milestone Feb 28, 2022
@Calinou Calinou added the bug label Feb 28, 2022
@akien-mga akien-mga merged commit 039ffda into godotengine:master Feb 28, 2022
@akien-mga
Copy link
Member

Thanks!

@BastiaanOlij BastiaanOlij deleted the fix_parsing_specialisation_constants branch March 1, 2022 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants