From 1c7a90ef359d9974e5bd257c4d8e9bf526a6966c Mon Sep 17 00:00:00 2001 From: gdkchan Date: Mon, 3 Jul 2023 14:29:27 -0300 Subject: Stop identifying shader textures with handle and cbuf, use binding instead (#5266) * Stop identifying shader textures with handle and cbuf, use binding instead * Remove now unused code * Consider image operations as having accurate type information too I don't know why that was not the case before * Fix missing unscale on InsertCoordNormalization, stop calling SetUsageFlagsForTextureQuery when not needed * Shader cache version bump * Change get texture methods to return descriptors created from ResourceManager state This is required to ensure that reserved textures and images will not be bound as a guest texture/image * Fix BindlessElimination.SetHandle inserting coords at the wrong place --- .../CodeGen/Glsl/OperandManager.cs | 58 +--------------------- 1 file changed, 1 insertion(+), 57 deletions(-) (limited to 'src/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs') diff --git a/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs b/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs index 0ca3b55f..17ffad9a 100644 --- a/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs +++ b/src/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs @@ -11,9 +11,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl { class OperandManager { - private static readonly string[] _stagePrefixes = new string[] { "cp", "vp", "tcp", "tep", "gp", "fp" }; - - private readonly Dictionary _locals; + private Dictionary _locals; public OperandManager() { @@ -41,60 +39,6 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl }; } - public static string GetSamplerName(ShaderStage stage, AstTextureOperation texOp, string indexExpr) - { - return GetSamplerName(stage, texOp.CbufSlot, texOp.Handle, texOp.Type.HasFlag(SamplerType.Indexed), indexExpr); - } - - public static string GetSamplerName(ShaderStage stage, int cbufSlot, int handle, bool indexed, string indexExpr) - { - string suffix = cbufSlot < 0 ? $"_tcb_{handle:X}" : $"_cb{cbufSlot}_{handle:X}"; - - if (indexed) - { - suffix += $"a[{indexExpr}]"; - } - - return GetShaderStagePrefix(stage) + "_" + DefaultNames.SamplerNamePrefix + suffix; - } - - public static string GetImageName(ShaderStage stage, AstTextureOperation texOp, string indexExpr) - { - return GetImageName(stage, texOp.CbufSlot, texOp.Handle, texOp.Format, texOp.Type.HasFlag(SamplerType.Indexed), indexExpr); - } - - public static string GetImageName( - ShaderStage stage, - int cbufSlot, - int handle, - TextureFormat format, - bool indexed, - string indexExpr) - { - string suffix = cbufSlot < 0 - ? $"_tcb_{handle:X}_{format.ToGlslFormat()}" - : $"_cb{cbufSlot}_{handle:X}_{format.ToGlslFormat()}"; - - if (indexed) - { - suffix += $"a[{indexExpr}]"; - } - - return GetShaderStagePrefix(stage) + "_" + DefaultNames.ImageNamePrefix + suffix; - } - - public static string GetShaderStagePrefix(ShaderStage stage) - { - int index = (int)stage; - - if ((uint)index >= _stagePrefixes.Length) - { - return "invalid"; - } - - return _stagePrefixes[index]; - } - public static string GetArgumentName(int argIndex) { return $"{DefaultNames.ArgumentNamePrefix}{argIndex}"; -- cgit v1.2.3