aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2020-11-09 19:35:04 -0300
committerGitHub <noreply@github.com>2020-11-09 19:35:04 -0300
commit934a78005e75653529c320cf90e78fe6536447c2 (patch)
treea0601ef1abfbace3c35c10fb048d2e33447054c2 /Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs
parenteda6b78894eef3d9dc1e8ea6984e2f5bd319d68e (diff)
Simplify logic for bindless texture handling (#1667)
* Simplify logic for bindless texture handling * Nits
Diffstat (limited to 'Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs')
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/OperandManager.cs19
1 files changed, 4 insertions, 15 deletions
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)
{