0
0
Fork 0

Fix texture flush from CPU WaitSync regression on OpenGL (#4289)

This commit is contained in:
gdkchan 2023-01-14 11:23:57 -03:00 committed by GitHub
parent cd3a15aea5
commit 93df366b2c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 21 deletions

View file

@ -1431,10 +1431,21 @@ namespace Ryujinx.Graphics.Gpu.Image
return; return;
} }
handle.Sync(_context); bool isGpuThread = _context.IsGpuThread();
if (isGpuThread)
{
// No need to wait if we're on the GPU thread, we can just clear the modified flag immediately.
handle.Modified = false;
}
_context.Renderer.BackgroundContextAction(() => _context.Renderer.BackgroundContextAction(() =>
{ {
if (!isGpuThread)
{
handle.Sync(_context);
}
Storage.SignalModifiedDirty(); Storage.SignalModifiedDirty();
lock (handle.Overlaps) lock (handle.Overlaps)

View file

@ -231,10 +231,6 @@ namespace Ryujinx.Graphics.Gpu.Image
/// </summary> /// </summary>
/// <param name="context">The GPU context used to wait for sync</param> /// <param name="context">The GPU context used to wait for sync</param>
public void Sync(GpuContext context) public void Sync(GpuContext context)
{
bool needsSync = !context.IsGpuThread();
if (needsSync)
{ {
ulong registeredSync = _registeredSync; ulong registeredSync = _registeredSync;
long diff = (long)(context.SyncNumber - registeredSync); long diff = (long)(context.SyncNumber - registeredSync);
@ -254,11 +250,6 @@ namespace Ryujinx.Graphics.Gpu.Image
// If the difference is <= 0, no data is not ready yet. Flush any data we can without waiting or removing modified flag. // If the difference is <= 0, no data is not ready yet. Flush any data we can without waiting or removing modified flag.
} }
else
{
Modified = false;
}
}
/// <summary> /// <summary>
/// Clears the action registered variable, indicating that the tracking action should be /// Clears the action registered variable, indicating that the tracking action should be