diff options
Diffstat (limited to 'src/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs')
-rw-r--r-- | src/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs b/src/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs index 774d3e36..7758b4c6 100644 --- a/src/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs +++ b/src/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs @@ -347,21 +347,23 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations return wordOffset; } - Operand[] sources = new Operand[operation.SourcesCount]; + Operand cbufOffset = GetCbufOffset(); + Operand vecIndex = Local(); + Operand elemIndex = Local(); - int cbSlot = UbeFirstCbuf + storageIndex; + node.List.AddBefore(node, new Operation(Instruction.ShiftRightU32, 0, vecIndex, cbufOffset, Const(2))); + node.List.AddBefore(node, new Operation(Instruction.BitwiseAnd, 0, elemIndex, cbufOffset, Const(3))); - sources[0] = Const(cbSlot); - sources[1] = GetCbufOffset(); + Operand[] sources = new Operand[4]; - config.SetUsedConstantBuffer(cbSlot); + int cbSlot = UbeFirstCbuf + storageIndex; - for (int index = 2; index < operation.SourcesCount; index++) - { - sources[index] = operation.GetSource(index); - } + sources[0] = Const(config.ResourceManager.GetConstantBufferBinding(cbSlot)); + sources[1] = Const(0); + sources[2] = vecIndex; + sources[3] = elemIndex; - Operation ldcOp = new Operation(Instruction.LoadConstant, operation.Dest, sources); + Operation ldcOp = new Operation(Instruction.Load, StorageKind.ConstantBuffer, operation.Dest, sources); for (int index = 0; index < operation.SourcesCount; index++) { |