diff options
author | riperiperi <rhy3756547@hotmail.com> | 2021-08-27 21:08:30 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-27 17:08:30 -0300 |
commit | 76e8f9ac87c0164f4f09600dcf8b6a5b4d062bf5 (patch) | |
tree | a680a9d71272a0b8c03e8789acbb06068ec64cef | |
parent | ee1038e54255797a94b89091f4d59b77daad1a7b (diff) |
Only reupload the texture scale array if it changes. (#2595)
* Only reupload the texture scale array if it changes.
Before, this would be called all the time if any shader needed a scale value. The cost of doing this has increased with threaded-gal, as the scale array is copied to a span pool, and it's was called on pretty much every draw sometimes.
This improves GPU performance in games, scaled or not. Most affected game seems to be Xenoblade Chronicles: Definitive Edition.
* Just use = instead of |=
-rw-r--r-- | Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs b/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs index ffe2d33a..6c48fc0e 100644 --- a/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs +++ b/Ryujinx.Graphics.Gpu/Image/TextureBindingsManager.cs @@ -177,8 +177,6 @@ namespace Ryujinx.Graphics.Gpu.Image if ((binding.Flags & TextureUsageFlags.NeedsScaleValue) != 0 && texture != null) { - _scaleChanged |= true; - switch (stage) { case ShaderStage.Fragment: @@ -218,7 +216,13 @@ namespace Ryujinx.Graphics.Gpu.Image } } - _scales[index] = result; + if (result != _scales[index]) + { + _scaleChanged = true; + + _scales[index] = result; + } + return changed; } @@ -232,6 +236,8 @@ namespace Ryujinx.Graphics.Gpu.Image if (_scaleChanged) { _context.Renderer.Pipeline.UpdateRenderScale(stage, _scales, _textureBindings[stageIndex]?.Length ?? 0, _imageBindings[stageIndex]?.Length ?? 0); + + _scaleChanged = false; } } |