472226422e
The first time a shader is compiled Godot performs the following: ```cpp for (uint32_t i = 0; i < SHADER_STAGE_MAX; i++) { if (spirv_data.push_constant_stages_mask.has_flag((ShaderStage)(1 << i))) { binary_data.push_constant_vk_stages_mask |= shader_stage_masks[i]; } } ``` 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: 1. Performance (unnecessary flushing & over-excessive barriers) 2. Overwriting push descriptors already set (this would be serious, doesn't seem to be an issue) 3. Driver implementations going crazy when they see bits set they don't expect (unknown if this is an issue) 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 they 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. |
||
---|---|---|
.. | ||
rendering_device_vulkan.cpp | ||
rendering_device_vulkan.h | ||
SCsub | ||
vulkan_context.cpp | ||
vulkan_context.h | ||
vulkan_hooks.h |