aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions
diff options
context:
space:
mode:
authorgdk <gab.dark.100@gmail.com>2019-11-24 14:20:48 -0300
committerThog <thog@protonmail.com>2020-01-09 02:13:00 +0100
commit1df78e7ad65459d990fa2dcf391da1296dfd886c (patch)
treeddf9b70f649fa284c6a69ba1cba56f4fb8931ad9 /Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions
parent16d88c21fc98cd7302811e142a39d590370e182e (diff)
Simplify shader uniform buffer access codegen
Diffstat (limited to 'Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions')
-rw-r--r--Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs9
1 files changed, 7 insertions, 2 deletions
diff --git a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs
index c535d8fc..2d070e08 100644
--- a/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs
+++ b/Ryujinx.Graphics.Shader/CodeGen/Glsl/Instructions/InstGenMemory.cs
@@ -116,7 +116,12 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
offsetExpr = Enclose(offsetExpr, src2, Instruction.ShiftRightS32, isLhs: true);
- return OperandManager.GetConstantBufferName(src1, offsetExpr, context.Config.Stage);
+ // TODO: For now this is assumed to be constant
+ // (we only use constant slots right now), but we should also
+ // support non-constant values, necessary for full LDC implementation.
+ int slot = ((AstOperand)src1).Value;
+
+ return OperandManager.GetUniformBufferAccessor(slot, offsetExpr, context.Config.Stage);
}
public static string LoadGlobal(CodeGenContext context, AstOperation operation)
@@ -503,7 +508,7 @@ namespace Ryujinx.Graphics.Shader.CodeGen.Glsl.Instructions
// restrictions.
int ubOffset = GlobalToStorage.GetStorageCbOffset(stage, slot);
- string ubName = OperandManager.GetConstantBufferName(0, ubOffset, stage);
+ string ubName = OperandManager.GetUniformBufferAccessor(0, ubOffset, stage);
offsetExpr = $"{offsetExpr} - int((floatBitsToUint({ubName}) & {mask}) >> 2)";