Debian Codegraph @

thirdparty/spirv-reflect/patches/0002-zero-size-for-sc-sized-arrays.patch

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