From b37f1598ad88f1d926c26f59f2c9b18a43142005 Mon Sep 17 00:00:00 2001 From: Jan Sikorski Date: Thu, 11 Jul 2024 11:21:04 +0200 Subject: [PATCH 1/2] MSL: Recompile when an aliased descriptor's name is changed. --- spirv_msl.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spirv_msl.cpp b/spirv_msl.cpp index 251f6883..a2cea633 100644 --- a/spirv_msl.cpp +++ b/spirv_msl.cpp @@ -18167,6 +18167,9 @@ void CompilerMSL::emit_argument_buffer_aliased_descriptor(const SPIRVariable &al } else { + if (ir.meta[aliased_var.self].decoration.qualified_alias != name) + force_recompile(); + // This will get wrapped in a separate temporary when a spvDescriptorArray wrapper is emitted. set_qualified_name(aliased_var.self, name); } From ae75fccf719c6a7b8416dd54209d03bcae5b90e8 Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Mon, 15 Jul 2024 12:50:14 +0200 Subject: [PATCH 2/2] Add more detailed comment explaining the force recompile hack. --- spirv_msl.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spirv_msl.cpp b/spirv_msl.cpp index a2cea633..43ea5613 100644 --- a/spirv_msl.cpp +++ b/spirv_msl.cpp @@ -18167,6 +18167,10 @@ void CompilerMSL::emit_argument_buffer_aliased_descriptor(const SPIRVariable &al } else { + // This alias may have already been used to emit an entry point declaration. If there is a mismatch, we need a recompile. + // Moving this code to be run earlier will also conflict, + // because we need the qualified alias for the base resource, + // so forcing recompile until things sync up is the least invasive method for now. if (ir.meta[aliased_var.self].decoration.qualified_alias != name) force_recompile();