From b34de74f81ef73a78d43d169b9f1ce7f175035b5 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Sat, 23 Jul 2022 11:15:58 -0300 Subject: Avoid adding shader buffer descriptors for constant buffers that are not used (#3478) * Avoid adding shader buffer descriptors for constant buffers that are not used * Shader cache version --- .../Translation/Optimizations/GlobalToStorage.cs | 4 ++-- Ryujinx.Graphics.Shader/Translation/Rewriter.cs | 6 +++--- Ryujinx.Graphics.Shader/Translation/ShaderConfig.cs | 6 ------ 3 files changed, 5 insertions(+), 11 deletions(-) (limited to 'Ryujinx.Graphics.Shader/Translation') diff --git a/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs b/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs index 1cf43e5d..d2200d0b 100644 --- a/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs +++ b/Ryujinx.Graphics.Shader/Translation/Optimizations/GlobalToStorage.cs @@ -68,7 +68,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations { Operand addrLow = operation.GetSource(0); - Operand baseAddrLow = config.CreateCbuf(0, GetStorageCbOffset(config.Stage, storageIndex)); + Operand baseAddrLow = Cbuf(0, GetStorageCbOffset(config.Stage, storageIndex)); Operand baseAddrTrunc = Local(); @@ -152,7 +152,7 @@ namespace Ryujinx.Graphics.Shader.Translation.Optimizations { Operand addrLow = operation.GetSource(0); - Operand baseAddrLow = config.CreateCbuf(0, UbeBaseOffset + storageIndex * StorageDescSize); + Operand baseAddrLow = Cbuf(0, UbeBaseOffset + storageIndex * StorageDescSize); Operand baseAddrTrunc = Local(); diff --git a/Ryujinx.Graphics.Shader/Translation/Rewriter.cs b/Ryujinx.Graphics.Shader/Translation/Rewriter.cs index e9b073ab..d59da019 100644 --- a/Ryujinx.Graphics.Shader/Translation/Rewriter.cs +++ b/Ryujinx.Graphics.Shader/Translation/Rewriter.cs @@ -75,9 +75,9 @@ namespace Ryujinx.Graphics.Shader.Translation int cbOffset = GetStorageCbOffset(config.Stage, slot); - Operand baseAddrLow = config.CreateCbuf(0, cbOffset); - Operand baseAddrHigh = config.CreateCbuf(0, cbOffset + 1); - Operand size = config.CreateCbuf(0, cbOffset + 2); + Operand baseAddrLow = Cbuf(0, cbOffset); + Operand baseAddrHigh = Cbuf(0, cbOffset + 1); + Operand size = Cbuf(0, cbOffset + 2); Operand offset = PrependOperation(Instruction.Subtract, addrLow, baseAddrLow); Operand borrow = PrependOperation(Instruction.CompareLessU32, addrLow, baseAddrLow); diff --git a/Ryujinx.Graphics.Shader/Translation/ShaderConfig.cs b/Ryujinx.Graphics.Shader/Translation/ShaderConfig.cs index 27d72cd5..bac83861 100644 --- a/Ryujinx.Graphics.Shader/Translation/ShaderConfig.cs +++ b/Ryujinx.Graphics.Shader/Translation/ShaderConfig.cs @@ -360,12 +360,6 @@ namespace Ryujinx.Graphics.Shader.Translation UsedFeatures |= flags; } - public Operand CreateCbuf(int slot, int offset) - { - SetUsedConstantBuffer(slot); - return OperandHelper.Cbuf(slot, offset); - } - public void SetUsedConstantBuffer(int slot) { _usedConstantBuffers |= 1 << slot; -- cgit v1.2.3