From 29f62622604dcf5d9f6c643f8b7dc4201b6446ce Mon Sep 17 00:00:00 2001 From: Isaac Marovitz Date: Mon, 12 Aug 2024 14:09:40 +0100 Subject: [PATCH] Fix array size query --- .../CodeGen/Msl/Instructions/InstGenMemory.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/InstGenMemory.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/InstGenMemory.cs index 005f5eafc..6ccacc1c4 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/InstGenMemory.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Msl/Instructions/InstGenMemory.cs @@ -605,6 +605,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions { context.Properties.Textures.TryGetValue(texOp.GetTextureSetAndBinding(), out TextureDefinition definition); bool hasLod = !definition.Type.HasFlag(SamplerType.Multisample) && (definition.Type & SamplerType.Mask) != SamplerType.TextureBuffer; + bool isArray = definition.Type.HasFlag(SamplerType.Array); texCallBuilder.Append("get_"); if (texOp.Index == 0) @@ -617,12 +618,19 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Msl.Instructions } else { - texCallBuilder.Append("depth"); + if (isArray) + { + texCallBuilder.Append("array_size"); + } + else + { + texCallBuilder.Append("depth"); + } } texCallBuilder.Append('('); - if (hasLod) + if (hasLod && !isArray) { IAstNode lod = operation.GetSource(0); string lodExpr = GetSourceExpr(context, lod, GetSrcVarType(operation.Inst, 0));