GPU: Discard data when getting texture before full clear (#5719)

* GPU: Discard data when getting texture before full clear

* Fix rules and order of clear checks

* Fix formatting
This commit is contained in:
riperiperi
2023-09-25 22:07:03 +01:00
committed by GitHub
parent 8026e1c804
commit f6c3f1cdfd
10 changed files with 205 additions and 11 deletions

View File

@ -278,6 +278,24 @@ namespace Ryujinx.Graphics.Gpu.Image
return dirty;
}
/// <summary>
/// Discards all data for a given texture.
/// This clears all dirty flags, modified flags, and pending copies from other textures.
/// </summary>
/// <param name="texture">The texture being discarded</param>
public void DiscardData(Texture texture)
{
EvaluateRelevantHandles(texture, (baseHandle, regionCount, split) =>
{
for (int i = 0; i < regionCount; i++)
{
TextureGroupHandle group = _handles[baseHandle + i];
group.DiscardData();
}
});
}
/// <summary>
/// Synchronize memory for a given texture.
/// If overlapping tracking handles are dirty, fully or partially synchronize the texture data.