Update bindless textures on data modification

This commit is contained in:
Gabriel A 2023-11-14 00:09:51 -03:00
parent dd0faf70a7
commit 360630ad6b
2 changed files with 18 additions and 4 deletions

View file

@ -621,6 +621,10 @@ namespace Ryujinx.Graphics.Gpu.Image
public void SignalGroupDirty()
{
_dirty = true;
// If this used as a bindless texture, we must force it to be updated on next use,
// since the CPU modified the data.
ForceTexturePoolUpdate();
}
/// <summary>
@ -1470,12 +1474,15 @@ namespace Ryujinx.Graphics.Gpu.Image
/// Forces the entries on all texture pool where this texture is present to be updated.
/// </summary>
private void ForceTexturePoolUpdate()
{
lock (_poolOwners)
{
foreach (TexturePoolOwner poolOwner in _poolOwners)
{
poolOwner.Pool.ForceModifiedEntry(poolOwner.ID);
}
}
}
/// <summary>
/// Determine if any of this texture's data overlaps with another.
@ -1538,6 +1545,11 @@ namespace Ryujinx.Graphics.Gpu.Image
_poolOwners.Add(new TexturePoolOwner { Pool = pool, ID = id, GpuAddress = gpuVa });
}
if (_dirty)
{
pool.ForceModifiedEntry(id);
}
_referenceCount++;
if (ShortCacheEntry != null)

View file

@ -254,8 +254,6 @@ namespace Ryujinx.Graphics.Gpu.Image
return;
}
Items[textureId]?.SynchronizeMemory();
bool textureModified = ModifiedEntries.Clear(textureId);
if (samplerPool != null)
@ -304,6 +302,10 @@ namespace Ryujinx.Graphics.Gpu.Image
/// <param name="id">ID of the texture</param>
private void UpdateBindlessInternal(IRenderer renderer, int id)
{
// If the texture already exists, check if it has not been modified since the last use.
// If it was, update the data.
Items[id]?.SynchronizeMemory();
Texture texture = Items[id] ?? GetValidated(id);
if (texture != null)