godot-module-template/engine/thirdparty/spirv-reflect/patches/0002-zero-size-for-sc-sized-arrays.patch

17 lines
991 B
Diff

diff --git a/thirdparty/spirv-reflect/spirv_reflect.c b/thirdparty/spirv-reflect/spirv_reflect.c
index ba64a3f54d..599667be26 100644
--- a/thirdparty/spirv-reflect/spirv_reflect.c
+++ b/thirdparty/spirv-reflect/spirv_reflect.c
@@ -2688,6 +2688,11 @@ static SpvReflectResult ParseDescriptorBlockVariableSizes(SpvReflectPrvParser* p
// ...then array
uint32_t element_count = (p_member_var->array.dims_count > 0 ? 1 : 0);
for (uint32_t i = 0; i < p_member_var->array.dims_count; ++i) {
+ if (p_member_var->array.spec_constant_op_ids[i] != (uint32_t)INVALID_VALUE) {
+ // Force size to be reported as 0 to effectively disable buffer size validation, since
+ // the value is unreliable anyway as only valid for the default values of the SCs involved.
+ element_count = 0;
+ }
element_count *= p_member_var->array.dims[i];
}
p_member_var->size = element_count * p_member_var->array.stride;