diff options
Diffstat (limited to 'Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs')
| -rw-r--r-- | Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs b/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs index cc57102c..1cf43e5d 100644 --- a/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs +++ b/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs @@ -59,7 +59,8 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations 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; config.SetUsedStorageBuffer(storageIndex, isWrite); @@ -78,12 +79,18 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations node.List.AddBefore(node, andOp); Operand byteOffset = Local(); - Operand wordOffset = Local(); + Operation subOp = new Operation(Instruction.Subtract, byteOffset, addrLow, baseAddrTrunc); - Operation subOp = new Operation(Instruction.Subtract, byteOffset, addrLow, baseAddrTrunc); + node.List.AddBefore(node, subOp); + + if (isStg16Or8) + { + return byteOffset; + } + + Operand wordOffset = Local(); Operation shrOp = new Operation(Instruction.ShiftRightU32, wordOffset, byteOffset, Const(2)); - node.List.AddBefore(node, subOp); node.List.AddBefore(node, shrOp); return wordOffset; @@ -113,7 +120,14 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations } 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++) |
