aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Vulkan/BufferState.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Graphics.Vulkan/BufferState.cs')
-rw-r--r--Ryujinx.Graphics.Vulkan/BufferState.cs15
1 files changed, 13 insertions, 2 deletions
diff --git a/Ryujinx.Graphics.Vulkan/BufferState.cs b/Ryujinx.Graphics.Vulkan/BufferState.cs
index f3a58469..6829f833 100644
--- a/Ryujinx.Graphics.Vulkan/BufferState.cs
+++ b/Ryujinx.Graphics.Vulkan/BufferState.cs
@@ -2,14 +2,14 @@
namespace Ryujinx.Graphics.Vulkan
{
- readonly struct BufferState : IDisposable
+ struct BufferState : IDisposable
{
public static BufferState Null => new BufferState(null, 0, 0);
private readonly int _offset;
private readonly int _size;
- private readonly Auto<DisposableBuffer> _buffer;
+ private Auto<DisposableBuffer> _buffer;
public BufferState(Auto<DisposableBuffer> buffer, int offset, int size)
{
@@ -29,6 +29,17 @@ namespace Ryujinx.Graphics.Vulkan
}
}
+ public void Swap(Auto<DisposableBuffer> from, Auto<DisposableBuffer> to)
+ {
+ if (_buffer == from)
+ {
+ _buffer.DecrementReferenceCount();
+ to.IncrementReferenceCount();
+
+ _buffer = to;
+ }
+ }
+
public void Dispose()
{
_buffer?.DecrementReferenceCount();