diff options
Diffstat (limited to 'Ryujinx.Graphics.Shader/Translation/Rewriter.cs')
| -rw-r--r-- | Ryujinx.Graphics.Shader/Translation/Rewriter.cs | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/Ryujinx.Graphics.Shader/Translation/Rewriter.cs b/Ryujinx.Graphics.Shader/Translation/Rewriter.cs index 47428520..02a0feda 100644 --- a/Ryujinx.Graphics.Shader/Translation/Rewriter.cs +++ b/Ryujinx.Graphics.Shader/Translation/Rewriter.cs @@ -49,7 +49,8 @@ namespace Ryujinx.Graphics.Shader.Translation Operation operation = (Operation)node.Value; bool isAtomic = operation.Inst.IsAtomic(); - bool isWrite = isAtomic || operation.Inst == Instruction.StoreGlobal; + bool isStg16Or8 = operation.Inst == Instruction.StoreGlobal16 || operation.Inst == Instruction.StoreGlobal8; + bool isWrite = isAtomic || operation.Inst == Instruction.StoreGlobal || isStg16Or8; Operation storageOp; @@ -95,14 +96,21 @@ namespace Ryujinx.Graphics.Shader.Translation Operand alignMask = Const(-config.GpuAccessor.QueryHostStorageBufferOffsetAlignment()); - Operand baseAddrTrunc = PrependOperation(Instruction.BitwiseAnd, sbBaseAddrLow, alignMask); - Operand byteOffset = PrependOperation(Instruction.Subtract, addrLow, baseAddrTrunc); - Operand wordOffset = PrependOperation(Instruction.ShiftRightU32, byteOffset, Const(2)); + Operand baseAddrTrunc = PrependOperation(Instruction.BitwiseAnd, sbBaseAddrLow, alignMask); + Operand byteOffset = PrependOperation(Instruction.Subtract, addrLow, baseAddrTrunc); Operand[] sources = new Operand[operation.SourcesCount]; sources[0] = sbSlot; - sources[1] = wordOffset; + + if (isStg16Or8) + { + sources[1] = byteOffset; + } + else + { + sources[1] = PrependOperation(Instruction.ShiftRightU32, byteOffset, Const(2)); + } for (int index = 2; index < operation.SourcesCount; index++) { @@ -121,7 +129,14 @@ namespace Ryujinx.Graphics.Shader.Translation } else { - storageOp = new Operation(Instruction.StoreStorage, null, sources); + Instruction storeInst = operation.Inst switch + { + Instruction.StoreGlobal16 => Instruction.StoreStorage16, + Instruction.StoreGlobal8 => Instruction.StoreStorage8, + _ => Instruction.StoreStorage + }; + + storageOp = new Operation(storeInst, null, sources); } for (int index = 0; index < operation.SourcesCount; index++) |
