mirror of
https://github.com/godotengine/godot.git
synced 2025-12-08 06:09:55 +00:00
Report shader arrays sized after spec constants as zero-sized
This effectively disables validation of the size of the data provided.
This commit is contained in:
parent
88d9325065
commit
90679f1dcf
4 changed files with 26 additions and 1 deletions
18
thirdparty/spirv-reflect/patches/2-zero-size-for-sc-sized-arrays.patch
vendored
Normal file
18
thirdparty/spirv-reflect/patches/2-zero-size-for-sc-sized-arrays.patch
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
diff --git a/thirdparty/spirv-reflect/spirv_reflect.c b/thirdparty/spirv-reflect/spirv_reflect.c
|
||||
index c96dd85439..2ca9c8580d 100644
|
||||
--- a/thirdparty/spirv-reflect/spirv_reflect.c
|
||||
+++ b/thirdparty/spirv-reflect/spirv_reflect.c
|
||||
@@ -2692,6 +2692,13 @@ 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) {
|
||||
+// -- GODOT begin --
|
||||
+ 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;
|
||||
+ }
|
||||
+// -- GODOT end --
|
||||
element_count *= p_member_var->array.dims[i];
|
||||
}
|
||||
p_member_var->size = element_count * p_member_var->array.stride;
|
||||
Loading…
Add table
Add a link
Reference in a new issue