From 40a4456a54fd72d7340696f682e98aa204cee3bb Mon Sep 17 00:00:00 2001 From: Mark Satterthwaite Date: Wed, 14 Aug 2019 10:54:18 -0400 Subject: [PATCH] Fix conversion of the SampleMask intrinsic from SPIRV, where it is an array to Metal where it isn't. --- spirv_msl.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/spirv_msl.cpp b/spirv_msl.cpp index 694c792d..9ab847c2 100644 --- a/spirv_msl.cpp +++ b/spirv_msl.cpp @@ -5161,6 +5161,19 @@ void CompilerMSL::emit_instruction(const Instruction &instruction) switch (opcode) { + /* UE Change Begin: Sample mask input for Metal is not an array */ + case OpLoad: + { + uint32_t id = ops[1]; + uint32_t ptr = ops[2]; + if (ir.meta[ptr].decoration.builtin_type == BuiltInSampleMask) + { + ir.meta[id].decoration.builtin_type = BuiltInSampleMask; + } + CompilerGLSL::emit_instruction(instruction); + break; + } + /* UE Change End: Sample mask input for Metal is not an array */ // Comparisons case OpIEqual: @@ -11844,7 +11857,9 @@ std::string CompilerMSL::access_chain_internal(uint32_t base, const uint32_t *in if (!pending_array_enclose) expr += "]"; } - else + /* UE Change Begin: Sample mask input for Metal is not an array */ + else if (ir.meta[base].decoration.builtin_type != BuiltInSampleMask) + /* UE Change End: Sample mask input for Metal is not an array */ { append_index(index); }