aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/Instructions
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2020-10-12 21:40:50 -0300
committerGitHub <noreply@github.com>2020-10-12 21:40:50 -0300
commitb066cfc1a3e31bf7197ddbd0f4d774b886cd9d65 (patch)
tree95a1d0bb640948c184857fd1bccb56cad90839fb /Ryujinx.Graphics.Shader/Instructions
parent14fd9aa640936d2455c9f0929fc904a5bdb2fada (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/Instructions')
-rw-r--r--Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs16
1 files changed, 13 insertions, 3 deletions
diff --git a/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs b/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs
index 24ba9a06..2a2c8927 100644
--- a/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs
+++ b/Ryujinx.Graphics.Shader/Instructions/InstEmitMemory.cs
@@ -112,7 +112,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
res = context.FPMultiply(res, Attribute(AttributeConsts.PositionW));
}
}
-
+
if (op.Mode == InterpolationMode.Default)
{
Operand srcB = GetSrcB(context);
@@ -152,7 +152,17 @@ namespace Ryujinx.Graphics.Shader.Instructions
int count = op.Size == IntegerSize.B64 ? 2 : 1;
- Operand addr = context.IAdd(GetSrcA(context), Const(op.Offset));
+ Operand slot = Const(op.Slot);
+ Operand srcA = GetSrcA(context);
+
+ if (op.IndexMode == CbIndexMode.Is ||
+ op.IndexMode == CbIndexMode.Isl)
+ {
+ slot = context.IAdd(slot, context.BitfieldExtractU32(srcA, Const(16), Const(16)));
+ srcA = context.BitwiseAnd(srcA, Const(0xffff));
+ }
+
+ Operand addr = context.IAdd(srcA, Const(op.Offset));
Operand wordOffset = context.ShiftRightU32(addr, Const(2));
@@ -169,7 +179,7 @@ namespace Ryujinx.Graphics.Shader.Instructions
Operand offset = context.IAdd(wordOffset, Const(index));
- Operand value = context.LoadConstant(Const(op.Slot), offset);
+ Operand value = context.LoadConstant(slot, offset);
if (isSmallInt)
{