aboutsummaryrefslogtreecommitdiff
path: root/src/Ryujinx.Graphics.Shader/Translation/Rewriter.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2023-05-05 11:20:20 -0300
committerGitHub <noreply@github.com>2023-05-05 14:20:20 +0000
commitaa021085cfab10ab63a7e6c2f9c9e29b4111525c (patch)
treebbf192b3c321110fa6abd6f8bcd7c429119daa93 /src/Ryujinx.Graphics.Shader/Translation/Rewriter.cs
parent1f5d8818609a82df893167a8ec5bd6ccda406c61 (diff)
Allow any shader SSBO constant buffer slot and offset (#2237)
* Allow any shader SSBO constant buffer slot and offset * Fix slot value passed to SetUsedStorageBuffer on fallback case * Shader cache version * Ensure that the storage buffer source constant buffer offset is word aligned * Fix FirstBinding on GetUniformBufferDescriptors
Diffstat (limited to 'src/Ryujinx.Graphics.Shader/Translation/Rewriter.cs')
-rw-r--r--src/Ryujinx.Graphics.Shader/Translation/Rewriter.cs11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Ryujinx.Graphics.Shader/Translation/Rewriter.cs b/src/Ryujinx.Graphics.Shader/Translation/Rewriter.cs
index 91e7ace1..8167efc1 100644
--- a/src/Ryujinx.Graphics.Shader/Translation/Rewriter.cs
+++ b/src/Ryujinx.Graphics.Shader/Translation/Rewriter.cs
@@ -110,9 +110,9 @@ namespace Ryujinx.Graphics.Shader.Translation
Operand BindingRangeCheck(int cbOffset, out Operand baseAddrLow)
{
- baseAddrLow = Cbuf(0, cbOffset);
- Operand baseAddrHigh = Cbuf(0, cbOffset + 1);
- Operand size = Cbuf(0, cbOffset + 2);
+ baseAddrLow = Cbuf(DriverReservedCb, cbOffset);
+ Operand baseAddrHigh = Cbuf(DriverReservedCb, cbOffset + 1);
+ Operand size = Cbuf(DriverReservedCb, cbOffset + 2);
Operand offset = PrependOperation(Instruction.Subtract, addrLow, baseAddrLow);
Operand borrow = PrependOperation(Instruction.CompareLessU32, addrLow, baseAddrLow);
@@ -134,9 +134,10 @@ namespace Ryujinx.Graphics.Shader.Translation
sbUseMask &= ~(1 << slot);
- config.SetUsedStorageBuffer(slot, isWrite);
-
int cbOffset = GetStorageCbOffset(config.Stage, slot);
+ slot = config.GetSbSlot(DriverReservedCb, (ushort)cbOffset);
+
+ config.SetUsedStorageBuffer(slot, isWrite);
Operand inRange = BindingRangeCheck(cbOffset, out Operand baseAddrLow);