From 5437d6cb13a1487e4ab7cfd64c8b66ed7f9e8c81 Mon Sep 17 00:00:00 2001 From: gdkchan Date: Mon, 3 Oct 2022 19:45:33 -0300 Subject: [PATCH] Vulkan: Fix buffer texture storage not being updated on buffer handle reuse (#3731) --- Ryujinx.Graphics.Vulkan/BufferManager.cs | 4 ++++ Ryujinx.Graphics.Vulkan/TextureBuffer.cs | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Ryujinx.Graphics.Vulkan/BufferManager.cs b/Ryujinx.Graphics.Vulkan/BufferManager.cs index 65883fd0d5..e4820a3030 100644 --- a/Ryujinx.Graphics.Vulkan/BufferManager.cs +++ b/Ryujinx.Graphics.Vulkan/BufferManager.cs @@ -38,6 +38,8 @@ namespace Ryujinx.Graphics.Vulkan private readonly IdList _buffers; + public int BufferCount { get; private set; } + public StagingBuffer StagingBuffer { get; } public BufferManager(VulkanRenderer gd, PhysicalDevice physicalDevice, Device device) @@ -56,6 +58,8 @@ namespace Ryujinx.Graphics.Vulkan return BufferHandle.Null; } + BufferCount++; + ulong handle64 = (uint)_buffers.Add(holder); return Unsafe.As(ref handle64); diff --git a/Ryujinx.Graphics.Vulkan/TextureBuffer.cs b/Ryujinx.Graphics.Vulkan/TextureBuffer.cs index 3e90a96f5d..fca0598fe0 100644 --- a/Ryujinx.Graphics.Vulkan/TextureBuffer.cs +++ b/Ryujinx.Graphics.Vulkan/TextureBuffer.cs @@ -16,6 +16,8 @@ namespace Ryujinx.Graphics.Vulkan private Auto _bufferView; private Dictionary> _selfManagedViews; + private int _bufferCount; + public int Width { get; } public int Height { get; } @@ -107,7 +109,8 @@ namespace Ryujinx.Graphics.Vulkan { if (_bufferHandle == buffer.Handle && _offset == buffer.Offset && - _size == buffer.Size) + _size == buffer.Size && + _bufferCount == _gd.BufferManager.BufferCount) { return; } @@ -115,6 +118,7 @@ namespace Ryujinx.Graphics.Vulkan _bufferHandle = buffer.Handle; _offset = buffer.Offset; _size = buffer.Size; + _bufferCount = _gd.BufferManager.BufferCount; ReleaseImpl(); }