From bec99d00b14c8519c5290c13066478c0b43ba224 Mon Sep 17 00:00:00 2001 From: Gabriel A Date: Sun, 17 Mar 2024 20:57:14 -0300 Subject: [PATCH] Handle array textures with different types on the same buffer --- src/Ryujinx.Graphics.Shader/Translation/ResourceManager.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Ryujinx.Graphics.Shader/Translation/ResourceManager.cs b/src/Ryujinx.Graphics.Shader/Translation/ResourceManager.cs index 56a630cd8..b831c012e 100644 --- a/src/Ryujinx.Graphics.Shader/Translation/ResourceManager.cs +++ b/src/Ryujinx.Graphics.Shader/Translation/ResourceManager.cs @@ -29,7 +29,7 @@ namespace Ryujinx.Graphics.Shader.Translation private readonly HashSet _usedConstantBufferBindings; - private readonly record struct TextureInfo(int CbufSlot, int Handle, int ArrayLength, TextureFormat Format); + private readonly record struct TextureInfo(int CbufSlot, int Handle, int ArrayLength, SamplerType Type, TextureFormat Format); private struct TextureMeta { @@ -287,7 +287,10 @@ namespace Ryujinx.Graphics.Shader.Translation usageFlags |= TextureUsageFlags.ImageCoherent; } - var info = new TextureInfo(cbufSlot, handle, arrayLength, format); + // For array textures, we also want to use type as key, + // since we may have texture handles stores in the same buffer, but for textures with different types. + var keyType = arrayLength > 1 ? type : SamplerType.None; + var info = new TextureInfo(cbufSlot, handle, arrayLength, keyType, format); var meta = new TextureMeta() { AccurateType = accurateType,