From 338ff79e1e962250110047be781e069b4dccba01 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Tue, 9 Apr 2024 14:24:46 -0300 Subject: [PATCH] Use ResScaleUnsupported flag for texture arrays (#6626) --- .../Image/TextureBindingsArrayCache.cs | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/Ryujinx.Graphics.Gpu/Image/TextureBindingsArrayCache.cs b/src/Ryujinx.Graphics.Gpu/Image/TextureBindingsArrayCache.cs index 70ea1f6b91..4645317c4f 100644 --- a/src/Ryujinx.Graphics.Gpu/Image/TextureBindingsArrayCache.cs +++ b/src/Ryujinx.Graphics.Gpu/Image/TextureBindingsArrayCache.cs @@ -224,7 +224,8 @@ namespace Ryujinx.Graphics.Gpu.Image /// Synchronizes memory for all textures in the array. /// /// Indicates if the texture may be modified by the access - public void SynchronizeMemory(bool isStore) + /// Indicates if the texture should be blacklisted for scaling + public void SynchronizeMemory(bool isStore, bool blacklistScale) { foreach (Texture texture in Textures.Keys) { @@ -234,6 +235,13 @@ namespace Ryujinx.Graphics.Gpu.Image { texture.SignalModified(); } + + if (blacklistScale && texture.ScaleMode != TextureScaleMode.Blacklisted) + { + // Scaling textures used on arrays is currently not supported. + + texture.BlacklistScale(); + } } } @@ -467,6 +475,7 @@ namespace Ryujinx.Graphics.Gpu.Image bool poolsModified = entry.PoolsModified(); bool isStore = bindingInfo.Flags.HasFlag(TextureUsageFlags.ImageStore); + bool resScaleUnsupported = bindingInfo.Flags.HasFlag(TextureUsageFlags.ResScaleUnsupported); ReadOnlySpan cachedTextureBuffer; ReadOnlySpan cachedSamplerBuffer; @@ -475,7 +484,7 @@ namespace Ryujinx.Graphics.Gpu.Image { if (entry.MatchesSequenceNumber(_context.SequenceNumber)) { - entry.SynchronizeMemory(isStore); + entry.SynchronizeMemory(isStore, resScaleUnsupported); if (isImage) { @@ -504,7 +513,7 @@ namespace Ryujinx.Graphics.Gpu.Image if (entry.MatchesBufferData(cachedTextureBuffer, cachedSamplerBuffer, separateSamplerBuffer, samplerWordOffset)) { - entry.SynchronizeMemory(isStore); + entry.SynchronizeMemory(isStore, resScaleUnsupported); if (isImage) { @@ -569,6 +578,13 @@ namespace Ryujinx.Graphics.Gpu.Image { texture.SignalModified(); } + + if (resScaleUnsupported && texture.ScaleMode != TextureScaleMode.Blacklisted) + { + // Scaling textures used on arrays is currently not supported. + + texture.BlacklistScale(); + } } Sampler sampler = samplerPool?.Get(samplerId);