Simplify logic for bindless texture handling (#1667)

* Simplify logic for bindless texture handling

* Nits
This commit is contained in:
gdkchan 2020-11-09 19:35:04 -03:00 committed by GitHub
parent eda6b78894
commit 934a78005e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 131 additions and 191 deletions

View file

@ -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)
if ((texOp.Type & SamplerType.Indexed) != 0)
{
AstOperand operand = texOp.GetSource(0) as AstOperand;
suffix = $"_{texOp.Type.ToGlslSamplerType()}_cb{operand.CbufSlot}_{operand.CbufOffset}";
}
else
{
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)
{