Force copy when auto-deleting a texture with dependencies (#2687)
When a texture is deleted by falling to the bottom of the AutoDeleteCache, its data is flushed to preserve any GPU writes that occurred. This ensures that the data appears in any textures recreated in the future, but didn't account for a texture that already existed with a copy dependency. This change forces copy dependencies to complete if a texture falls out from from the AutoDeleteCache. (not removed via overlap, as that would be wasted effort) Fixes broken lighting caused by pausing in SMO's Metro Kingdom. May fix some other issues.
This commit is contained in:
@ -140,6 +140,22 @@ namespace Ryujinx.Graphics.Gpu.Image
|
||||
_bindCount = Math.Max(0, _bindCount + (bound ? 1 : -1));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Synchronize dependent textures, if any of them have deferred a copy from this texture.
|
||||
/// </summary>
|
||||
public void SynchronizeDependents()
|
||||
{
|
||||
foreach (TextureDependency dependency in Dependencies)
|
||||
{
|
||||
TextureGroupHandle otherHandle = dependency.Other.Handle;
|
||||
|
||||
if (otherHandle.DeferredCopy == this)
|
||||
{
|
||||
otherHandle._group.Storage.SynchronizeMemory();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Signal that a copy dependent texture has been modified, and must have its data copied to this one.
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user