aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Shader/Translation/Rewriter.cs
diff options
context:
space:
mode:
authorgdkchan <gab.dark.100@gmail.com>2021-05-19 18:15:26 -0300
committerGitHub <noreply@github.com>2021-05-19 23:15:26 +0200
commit49745cfa37b247c3e49bfae126bafbe41e166bc6 (patch)
tree1a37f2f2c23791244b22529f6e228f008f984409 /Ryujinx.Graphics.Shader/Translation/Rewriter.cs
parentb5c72b44dee2fd977d7cca5aa3c29ef1e2286aa7 (diff)
Move shader resource descriptor creation out of the backend (#2290)
* Move shader resource descriptor creation out of the backend * Remove now unused code, and other nits * Shader cache version bump * Nits * Set format for bindless image load/store * Fix buffer write flag
Diffstat (limited to 'Ryujinx.Graphics.Shader/Translation/Rewriter.cs')
-rw-r--r--Ryujinx.Graphics.Shader/Translation/Rewriter.cs17
1 files changed, 13 insertions, 4 deletions
diff --git a/Ryujinx.Graphics.Shader/Translation/Rewriter.cs b/Ryujinx.Graphics.Shader/Translation/Rewriter.cs
index 5427c013..07eeae48 100644
--- a/Ryujinx.Graphics.Shader/Translation/Rewriter.cs
+++ b/Ryujinx.Graphics.Shader/Translation/Rewriter.cs
@@ -48,6 +48,9 @@ namespace Ryujinx.Graphics.Shader.Translation
{
Operation operation = (Operation)node.Value;
+ bool isAtomic = operation.Inst.IsAtomic();
+ bool isWrite = isAtomic || operation.Inst == Instruction.StoreGlobal;
+
Operation storageOp;
Operand PrependOperation(Instruction inst, params Operand[] sources)
@@ -67,11 +70,13 @@ namespace Ryujinx.Graphics.Shader.Translation
for (int slot = 0; slot < StorageMaxCount; slot++)
{
+ config.SetUsedStorageBuffer(slot, isWrite);
+
int cbOffset = GetStorageCbOffset(config.Stage, slot);
- Operand baseAddrLow = Cbuf(0, cbOffset);
- Operand baseAddrHigh = Cbuf(0, cbOffset + 1);
- Operand size = Cbuf(0, cbOffset + 2);
+ Operand baseAddrLow = config.CreateCbuf(0, cbOffset);
+ Operand baseAddrHigh = config.CreateCbuf(0, cbOffset + 1);
+ Operand size = config.CreateCbuf(0, cbOffset + 2);
Operand offset = PrependOperation(Instruction.Subtract, addrLow, baseAddrLow);
Operand borrow = PrependOperation(Instruction.CompareLessU32, addrLow, baseAddrLow);
@@ -104,7 +109,7 @@ namespace Ryujinx.Graphics.Shader.Translation
sources[index] = operation.GetSource(index);
}
- if (operation.Inst.IsAtomic())
+ if (isAtomic)
{
Instruction inst = (operation.Inst & ~Instruction.MrMask) | Instruction.MrStorage;
@@ -303,6 +308,7 @@ namespace Ryujinx.Graphics.Shader.Translation
node.List.AddBefore(node, new TextureOperation(
Instruction.TextureSize,
texOp.Type,
+ texOp.Format,
texOp.Flags,
texOp.Handle,
index,
@@ -350,6 +356,7 @@ namespace Ryujinx.Graphics.Shader.Translation
node.List.AddBefore(node, new TextureOperation(
Instruction.Lod,
texOp.Type,
+ texOp.Format,
texOp.Flags,
texOp.Handle,
1,
@@ -374,6 +381,7 @@ namespace Ryujinx.Graphics.Shader.Translation
node.List.AddBefore(node, new TextureOperation(
Instruction.TextureSize,
texOp.Type,
+ texOp.Format,
texOp.Flags,
texOp.Handle,
index,
@@ -409,6 +417,7 @@ namespace Ryujinx.Graphics.Shader.Translation
TextureOperation newTexOp = new TextureOperation(
Instruction.TextureSample,
texOp.Type,
+ texOp.Format,
texOp.Flags & ~(TextureFlags.Offset | TextureFlags.Offsets),
texOp.Handle,
componentIndex,