diff options
| author | gdkchan <gab.dark.100@gmail.com> | 2020-10-12 21:40:50 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-12 21:40:50 -0300 |
| commit | b066cfc1a3e31bf7197ddbd0f4d774b886cd9d65 (patch) | |
| tree | 95a1d0bb640948c184857fd1bccb56cad90839fb /Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions | |
| parent | 14fd9aa640936d2455c9f0929fc904a5bdb2fada (diff) | |
Add support for shader constant buffer slot indexing (#1608)
* Add support for shader constant buffer slot indexing
* Fix typo
Diffstat (limited to 'Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions')
| -rw-r--r-- | Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGen.cs | 2 | ||||
| -rw-r--r-- | Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGen.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGen.cs index 551fb229..f1c741e6 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGen.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGen.cs @@ -19,7 +19,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions } else if (node is AstOperand operand) { - return context.OperandManager.GetExpression(operand, context.Config); + return context.OperandManager.GetExpression(operand, context.Config, context.CbIndexable); } throw new ArgumentException($"Invalid node type \"{node?.GetType().Name ?? "null"}\"."); diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs index 8866cd25..cb339f05 100644 --- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs +++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs @@ -125,7 +125,16 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions offsetExpr = Enclose(offsetExpr, src2, Instruction.ShiftRightS32, isLhs: true); - return OperandManager.GetConstantBufferName(src1, offsetExpr, context.Config.Stage); + if (src1 is AstOperand oper && oper.Type == OperandType.Constant) + { + return OperandManager.GetConstantBufferName(oper.Value, offsetExpr, context.Config.Stage, context.CbIndexable); + } + else + { + string slotExpr = GetSoureExpr(context, src1, GetSrcVarType(operation.Inst, 0)); + + return OperandManager.GetConstantBufferName(slotExpr, offsetExpr, context.Config.Stage); + } } public static string LoadLocal(CodeGenContext context, AstOperation operation) |
