Use ResScaleUnsupported flag for texture arrays (#6626)

This commit is contained in:
gdkchan 2024-04-09 14:24:46 -03:00 committed by GitHub
parent 80201466ae
commit 338ff79e1e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -224,7 +224,8 @@ namespace Ryujinx.Graphics.Gpu.Image
/// Synchronizes memory for all textures in the array. /// Synchronizes memory for all textures in the array.
/// </summary> /// </summary>
/// <param name="isStore">Indicates if the texture may be modified by the access</param> /// <param name="isStore">Indicates if the texture may be modified by the access</param>
public void SynchronizeMemory(bool isStore) /// <param name="blacklistScale">Indicates if the texture should be blacklisted for scaling</param>
public void SynchronizeMemory(bool isStore, bool blacklistScale)
{ {
foreach (Texture texture in Textures.Keys) foreach (Texture texture in Textures.Keys)
{ {
@ -234,6 +235,13 @@ namespace Ryujinx.Graphics.Gpu.Image
{ {
texture.SignalModified(); 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 poolsModified = entry.PoolsModified();
bool isStore = bindingInfo.Flags.HasFlag(TextureUsageFlags.ImageStore); bool isStore = bindingInfo.Flags.HasFlag(TextureUsageFlags.ImageStore);
bool resScaleUnsupported = bindingInfo.Flags.HasFlag(TextureUsageFlags.ResScaleUnsupported);
ReadOnlySpan<int> cachedTextureBuffer; ReadOnlySpan<int> cachedTextureBuffer;
ReadOnlySpan<int> cachedSamplerBuffer; ReadOnlySpan<int> cachedSamplerBuffer;
@ -475,7 +484,7 @@ namespace Ryujinx.Graphics.Gpu.Image
{ {
if (entry.MatchesSequenceNumber(_context.SequenceNumber)) if (entry.MatchesSequenceNumber(_context.SequenceNumber))
{ {
entry.SynchronizeMemory(isStore); entry.SynchronizeMemory(isStore, resScaleUnsupported);
if (isImage) if (isImage)
{ {
@ -504,7 +513,7 @@ namespace Ryujinx.Graphics.Gpu.Image
if (entry.MatchesBufferData(cachedTextureBuffer, cachedSamplerBuffer, separateSamplerBuffer, samplerWordOffset)) if (entry.MatchesBufferData(cachedTextureBuffer, cachedSamplerBuffer, separateSamplerBuffer, samplerWordOffset))
{ {
entry.SynchronizeMemory(isStore); entry.SynchronizeMemory(isStore, resScaleUnsupported);
if (isImage) if (isImage)
{ {
@ -569,6 +578,13 @@ namespace Ryujinx.Graphics.Gpu.Image
{ {
texture.SignalModified(); texture.SignalModified();
} }
if (resScaleUnsupported && texture.ScaleMode != TextureScaleMode.Blacklisted)
{
// Scaling textures used on arrays is currently not supported.
texture.BlacklistScale();
}
} }
Sampler sampler = samplerPool?.Get(samplerId); Sampler sampler = samplerPool?.Get(samplerId);