Simplify logic for bindless texture handling (#1667)
* Simplify logic for bindless texture handling * Nits
This commit is contained in:
parent
eda6b78894
commit
934a78005e
16 changed files with 131 additions and 191 deletions
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue