From 934a78005e75653529c320cf90e78fe6536447c2 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Mon, 9 Nov 2020 19:35:04 -0300 Subject: Simplify logic for bindless texture handling (#1667) * Simplify logic for bindless texture handling * Nits --- .../CodeGen/Glsl/OperandManager.cs | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs') diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs index 8e878b0d..5c5d4403 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs @@ -241,22 +241,11 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl public static string GetSamplerName(ShaderStage stage, AstTextureOperation texOp, string indexExpr) { - string suffix; + string suffix = texOp.CbufSlot < 0 ? $"_tcb_{texOp.Handle:X}" : $"_cb{texOp.CbufSlot}_{texOp.Handle:X}"; - if ((texOp.Flags & TextureFlags.Bindless) != 0) - { - AstOperand operand = texOp.GetSource(0) as AstOperand; - - suffix = $"_{texOp.Type.ToGlslSamplerType()}_cb{operand.CbufSlot}_{operand.CbufOffset}"; - } - else + if ((texOp.Type & SamplerType.Indexed) != 0) { - suffix = texOp.Handle.ToString("X"); - - if ((texOp.Type & SamplerType.Indexed) != 0) - { - suffix += $"a[{indexExpr}]"; - } + suffix += $"a[{indexExpr}]"; } return GetShaderStagePrefix(stage) + "_" + DefaultNames.SamplerNamePrefix + suffix; @@ -264,7 +253,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl public static string GetImageName(ShaderStage stage, AstTextureOperation texOp, string indexExpr) { - string suffix = texOp.Handle.ToString("X") + "_" + texOp.Format.ToGlslFormat(); + string suffix = texOp.CbufSlot < 0 ? $"_tcb_{texOp.Handle:X}_{texOp.Format.ToGlslFormat()}" : $"_cb{texOp.CbufSlot}_{texOp.Handle:X}_{texOp.Format.ToGlslFormat()}"; if ((texOp.Type & SamplerType.Indexed) != 0) { -- cgit v1.2.3