From a4fc9f8050405c8589793d93caa8f259d1618708 Mon Sep 17 00:00:00 2001
From: gdkchan <gab.dark.100@gmail.com>
Date: Mon, 3 Oct 2022 20:08:38 -0300
Subject: [PATCH] Support use of buffer ranges with size 0 (#3736)

---
 Ryujinx.Graphics.Vulkan/BufferUsageBitmap.cs | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/Ryujinx.Graphics.Vulkan/BufferUsageBitmap.cs b/Ryujinx.Graphics.Vulkan/BufferUsageBitmap.cs
index 3242b9fc..920501d3 100644
--- a/Ryujinx.Graphics.Vulkan/BufferUsageBitmap.cs
+++ b/Ryujinx.Graphics.Vulkan/BufferUsageBitmap.cs
@@ -24,6 +24,11 @@
 
         public void Add(int cbIndex, int offset, int size)
         {
+            if (size == 0)
+            {
+                return;
+            }
+
             // Some usages can be out of bounds (vertex buffer on amd), so bound if necessary.
             if (offset + size > _size)
             {
@@ -39,6 +44,11 @@
 
         public bool OverlapsWith(int cbIndex, int offset, int size)
         {
+            if (size == 0)
+            {
+                return false;
+            }
+
             int cbBase = cbIndex * _bitsPerCb;
             int start = cbBase + offset / _granularity;
             int end = cbBase + (offset + size - 1) / _granularity;