Fix uninitialized variable ending up sent to Vulkan #80034
Merged
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.
The first time a shader is compiled Godot performs the following:
However
binary_data.push_constant_vk_stages_mask
is never initialized to 0 and thus contains garbage data or'ed with the good data.This value is used by push constants (and many other things) thus it can be a big deal.
Fortunately because the relevant flags are always guaranteed to be set (but not guaranteed to be unset), the damage is restricted to:
This uninitialized value is later saved into the binary cache.
Valgrind is able to detect this bug on the first run, but not on the subsequent ones because the data comes from a file.
cache_file_version has been bumped to force rebuild of all cached shaders. Because the ones generated so far are compromised.
Can this fix TDRs? (aka DEVICE_LOST)
Possibly.
Should this be backported to older versions?
Probably, I didn't check