From 99e6f3a2eff8b1f3459a32fc2542776c0249c9b7 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Wed, 30 Oct 2024 19:20:22 +0100 Subject: [PATCH] MSL: Fix crash when per-primitive variables are not used. --- spirv_msl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spirv_msl.cpp b/spirv_msl.cpp index 650fd7ad0..cf5265ac8 100644 --- a/spirv_msl.cpp +++ b/spirv_msl.cpp @@ -19232,7 +19232,6 @@ void CompilerMSL::emit_mesh_outputs() if (mesh_out_per_primitive != 0 || builtin_mesh_primitive_indices_id != 0) { - auto &type_prim = get(mesh_out_per_primitive); if (num_invocations < mode.output_primitives) { statement("for (uint spvPI = gl_LocalInvocationIndex; spvPI < spvMeshSizes.y; spvPI += spvThreadCount)"); @@ -19268,6 +19267,7 @@ void CompilerMSL::emit_mesh_outputs() if (mesh_out_per_primitive != 0) { + auto &type_prim = get(mesh_out_per_primitive); statement("spvPerPrimitive spvP = {};"); for (uint32_t index = 0; index < uint32_t(type_prim.member_types.size()); ++index) {