From 550fd4a7338eded794bf961ef6fd0c38643471c8 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Mon, 14 Aug 2023 13:57:39 -0300 Subject: Simplify resolution scale updates (#5541) --- .../Memory/SupportBufferUpdater.cs | 33 ++++++++++------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs') diff --git a/src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs b/src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs index b236476e..409c7a78 100644 --- a/src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs +++ b/src/Ryujinx.Graphics.Gpu/Memory/SupportBufferUpdater.cs @@ -136,33 +136,30 @@ namespace Ryujinx.Graphics.Gpu.Memory /// /// Updates the render scales for shader input textures or images. /// - /// Scale values - /// Total number of scales across all stages - /// Total number of scales on the fragment shader stage - public void UpdateRenderScale(ReadOnlySpan scales, int totalCount, int fragmentCount) + /// Index of the scale + /// Scale value + public void UpdateRenderScale(int index, float scale) { - bool changed = false; - - for (int index = 0; index < totalCount; index++) + if (_data.RenderScale[1 + index].X != scale) { - if (_data.RenderScale[1 + index].X != scales[index]) - { - _data.RenderScale[1 + index].X = scales[index]; - changed = true; - } + _data.RenderScale[1 + index].X = scale; + DirtyRenderScale(1 + index, 1); } + } + /// + /// Updates the render scales for shader input textures or images. + /// + /// Total number of scales across all stages + /// Total number of scales on the fragment shader stage + public void UpdateRenderScaleFragmentCount(int totalCount, int fragmentCount) + { // Only update fragment count if there are scales after it for the vertex stage. if (fragmentCount != totalCount && fragmentCount != _data.FragmentRenderScaleCount.X) { _data.FragmentRenderScaleCount.X = fragmentCount; DirtyFragmentRenderScaleCount(); } - - if (changed) - { - DirtyRenderScale(0, 1 + totalCount); - } } /// @@ -172,7 +169,7 @@ namespace Ryujinx.Graphics.Gpu.Memory /// True if the format is BGRA< false otherwise public void SetRenderTargetIsBgra(int index, bool isBgra) { - bool isBgraChanged = (_data.FragmentIsBgra[index].X != 0) != isBgra; + bool isBgraChanged = _data.FragmentIsBgra[index].X != 0 != isBgra; if (isBgraChanged) { -- cgit v1.2.3