diff options
| author | gdk <gab.dark.100@gmail.com> | 2019-11-02 23:07:21 -0300 |
|---|---|---|
| committer | Thog <thog@protonmail.com> | 2020-01-09 02:13:00 +0100 |
| commit | 3ab5c23f492183ae6f5cf8f62c4239bf181d2630 (patch) | |
| tree | 288daa576efbbe3220d835834acd562dff7d6cbd /Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs | |
| parent | 63345a3098e05e0d0692bc46852dfbfccfdcfae2 (diff) | |
Add partial support for array of samplers, and add pass to identify them from bindless texture accesses
Diffstat (limited to 'Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs')
| -rw-r--r-- | Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs index fe307396..36f76ec5 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs @@ -223,7 +223,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl return ubName + "_" + DefaultNames.UniformNameSuffix; } - public static string GetSamplerName(ShaderStage stage, AstTextureOperation texOp) + public static string GetSamplerName(ShaderStage stage, AstTextureOperation texOp, string indexExpr) { string suffix; @@ -235,16 +235,26 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl } else { - suffix = (texOp.Handle - 8).ToString(); + suffix = texOp.Handle.ToString(); + + if ((texOp.Type & SamplerType.Indexed) != 0) + { + suffix += $"a[{indexExpr}]"; + } } return GetShaderStagePrefix(stage) + "_" + DefaultNames.SamplerNamePrefix + suffix; } - public static string GetImageName(ShaderStage stage, AstTextureOperation texOp) + public static string GetImageName(ShaderStage stage, AstTextureOperation texOp, string indexExpr) { string suffix = texOp.Handle.ToString(); + if ((texOp.Type & SamplerType.Indexed) != 0) + { + suffix += $"a[{indexExpr}]"; + } + return GetShaderStagePrefix(stage) + "_" + DefaultNames.ImageNamePrefix + suffix; } |
