virtualx-engine/thirdparty/spirv-reflect/patches/zero-calloc.patch
Rémi Verschelde 0181d005c9
vulkan: Update all components to Vulkan SDK 1.3.231.1
Updates to volk, vulkan headers, `vk_enum_string_helper.h`, glslang,
spirv-reflect.

No update to VMA which still has 3.0.1 as it's last tagged release.
2022-11-03 12:20:46 +01:00

28 lines
1.3 KiB
Diff

diff --git a/thirdparty/spirv-reflect/spirv_reflect.c b/thirdparty/spirv-reflect/spirv_reflect.c
index c5ed7ab07d..f2be1f8cae 100644
--- a/thirdparty/spirv-reflect/spirv_reflect.c
+++ b/thirdparty/spirv-reflect/spirv_reflect.c
@@ -3368,12 +3368,18 @@ static SpvReflectResult ParseExecutionModes(
}
for (size_t entry_point_idx = 0; entry_point_idx < p_module->entry_point_count; ++entry_point_idx) {
SpvReflectEntryPoint* p_entry_point = &p_module->entry_points[entry_point_idx];
- p_entry_point->execution_modes =
- (SpvExecutionMode*)calloc(p_entry_point->execution_mode_count, sizeof(*p_entry_point->execution_modes));
- if (IsNull(p_entry_point->execution_modes)) {
- SafeFree(indices);
- return SPV_REFLECT_RESULT_ERROR_ALLOC_FAILED;
+// -- GODOT begin --
+ if (p_entry_point->execution_mode_count > 0) {
+// -- GODOT end --
+ p_entry_point->execution_modes =
+ (SpvExecutionMode*)calloc(p_entry_point->execution_mode_count, sizeof(*p_entry_point->execution_modes));
+ if (IsNull(p_entry_point->execution_modes)) {
+ SafeFree(indices);
+ return SPV_REFLECT_RESULT_ERROR_ALLOC_FAILED;
+ }
+// -- GODOT begin --
}
+// -- GODOT end --
}
for (size_t node_idx = 0; node_idx < p_parser->node_count; ++node_idx) {