Vulkan: Fix buffer texture storage not being updated on buffer handle reuse (#3731)

This commit is contained in:
gdkchan 2022-10-03 19:45:33 -03:00 committed by GitHub
parent 7539e26144
commit 5437d6cb13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -38,6 +38,8 @@ namespace Ryujinx.Graphics.Vulkan
private readonly IdList<BufferHolder> _buffers; private readonly IdList<BufferHolder> _buffers;
public int BufferCount { get; private set; }
public StagingBuffer StagingBuffer { get; } public StagingBuffer StagingBuffer { get; }
public BufferManager(VulkanRenderer gd, PhysicalDevice physicalDevice, Device device) public BufferManager(VulkanRenderer gd, PhysicalDevice physicalDevice, Device device)
@ -56,6 +58,8 @@ namespace Ryujinx.Graphics.Vulkan
return BufferHandle.Null; return BufferHandle.Null;
} }
BufferCount++;
ulong handle64 = (uint)_buffers.Add(holder); ulong handle64 = (uint)_buffers.Add(holder);
return Unsafe.As<ulong, BufferHandle>(ref handle64); return Unsafe.As<ulong, BufferHandle>(ref handle64);

View file

@ -16,6 +16,8 @@ namespace Ryujinx.Graphics.Vulkan
private Auto<DisposableBufferView> _bufferView; private Auto<DisposableBufferView> _bufferView;
private Dictionary<GAL.Format, Auto<DisposableBufferView>> _selfManagedViews; private Dictionary<GAL.Format, Auto<DisposableBufferView>> _selfManagedViews;
private int _bufferCount;
public int Width { get; } public int Width { get; }
public int Height { get; } public int Height { get; }
@ -107,7 +109,8 @@ namespace Ryujinx.Graphics.Vulkan
{ {
if (_bufferHandle == buffer.Handle && if (_bufferHandle == buffer.Handle &&
_offset == buffer.Offset && _offset == buffer.Offset &&
_size == buffer.Size) _size == buffer.Size &&
_bufferCount == _gd.BufferManager.BufferCount)
{ {
return; return;
} }
@ -115,6 +118,7 @@ namespace Ryujinx.Graphics.Vulkan
_bufferHandle = buffer.Handle; _bufferHandle = buffer.Handle;
_offset = buffer.Offset; _offset = buffer.Offset;
_size = buffer.Size; _size = buffer.Size;
_bufferCount = _gd.BufferManager.BufferCount;
ReleaseImpl(); ReleaseImpl();
} }