summaryrefslogtreecommitdiffstats
path: root/drivers/vulkan/rendering_device_vulkan.cpp
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2022-07-09 12:57:53 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2022-07-18 14:46:28 +0200
commit309f7965c75a7459a211b61820c291012f91c05e (patch)
tree8f8fc2f8e14c995035b33556cee74b070a42613c /drivers/vulkan/rendering_device_vulkan.cpp
parent77a525168d91411dca63bbe02fc55124a6def935 (diff)
downloadredot-engine-309f7965c75a7459a211b61820c291012f91c05e.tar.gz
Enhance determination of uniform writability in Vulkan RD
- Check block decoration in addition to type decoration to be sure to find `readonly` decorators - Verify uniforms have same writability across all shader stages in Vulkan RD
Diffstat (limited to 'drivers/vulkan/rendering_device_vulkan.cpp')
-rw-r--r--drivers/vulkan/rendering_device_vulkan.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/vulkan/rendering_device_vulkan.cpp b/drivers/vulkan/rendering_device_vulkan.cpp
index d95d93fd42..54f80cfc76 100644
--- a/drivers/vulkan/rendering_device_vulkan.cpp
+++ b/drivers/vulkan/rendering_device_vulkan.cpp
@@ -4731,7 +4731,7 @@ Vector<uint8_t> RenderingDeviceVulkan::shader_compile_binary_from_spirv(const Ve
}
if (may_be_writable) {
- info.writable = !(bool)(binding.type_description->decoration_flags & SPV_REFLECT_DECORATION_NON_WRITABLE);
+ info.writable = !(binding.type_description->decoration_flags & SPV_REFLECT_DECORATION_NON_WRITABLE) && !(binding.block.decoration_flags & SPV_REFLECT_DECORATION_NON_WRITABLE);
} else {
info.writable = false;
}
@@ -4758,6 +4758,10 @@ Vector<uint8_t> RenderingDeviceVulkan::shader_compile_binary_from_spirv(const Ve
ERR_FAIL_COND_V_MSG(uniform_info[set][k].length != info.length, Vector<uint8_t>(),
"On shader stage '" + String(shader_stage_names[stage]) + "', uniform '" + binding.name + "' trying to re-use location for set=" + itos(set) + ", binding=" + itos(info.binding) + " with different uniform size.");
+ //also, verify that it has the same writability
+ ERR_FAIL_COND_V_MSG(uniform_info[set][k].writable != info.writable, Vector<uint8_t>(),
+ "On shader stage '" + String(shader_stage_names[stage]) + "', uniform '" + binding.name + "' trying to re-use location for set=" + itos(set) + ", binding=" + itos(info.binding) + " with different writability.");
+
//just append stage mask and return
uniform_info.write[set].write[k].stages |= 1 << stage;
exists = true;