aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Graphics.Vulkan/BufferUsageBitmap.cs
diff options
context:
space:
mode:
authorTSR Berry <20988865+TSRBerry@users.noreply.github.com>2023-04-08 01:22:00 +0200
committerMary <thog@protonmail.com>2023-04-27 23:51:14 +0200
commitcee712105850ac3385cd0091a923438167433f9f (patch)
tree4a5274b21d8b7f938c0d0ce18736d3f2993b11b1 /Ryujinx.Graphics.Vulkan/BufferUsageBitmap.cs
parentcd124bda587ef09668a971fa1cac1c3f0cfc9f21 (diff)
Move solution and projects to src
Diffstat (limited to 'Ryujinx.Graphics.Vulkan/BufferUsageBitmap.cs')
-rw-r--r--Ryujinx.Graphics.Vulkan/BufferUsageBitmap.cs77
1 files changed, 0 insertions, 77 deletions
diff --git a/Ryujinx.Graphics.Vulkan/BufferUsageBitmap.cs b/Ryujinx.Graphics.Vulkan/BufferUsageBitmap.cs
deleted file mode 100644
index 920501d3..00000000
--- a/Ryujinx.Graphics.Vulkan/BufferUsageBitmap.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-namespace Ryujinx.Graphics.Vulkan
-{
- internal class BufferUsageBitmap
- {
- private BitMap _bitmap;
- private int _size;
- private int _granularity;
- private int _bits;
-
- private int _intsPerCb;
- private int _bitsPerCb;
-
- public BufferUsageBitmap(int size, int granularity)
- {
- _size = size;
- _granularity = granularity;
- _bits = (size + (granularity - 1)) / granularity;
-
- _intsPerCb = (_bits + (BitMap.IntSize - 1)) / BitMap.IntSize;
- _bitsPerCb = _intsPerCb * BitMap.IntSize;
-
- _bitmap = new BitMap(_bitsPerCb * CommandBufferPool.MaxCommandBuffers);
- }
-
- 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)
- {
- size = _size - offset;
- }
-
- int cbBase = cbIndex * _bitsPerCb;
- int start = cbBase + offset / _granularity;
- int end = cbBase + (offset + size - 1) / _granularity;
-
- _bitmap.SetRange(start, end);
- }
-
- 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;
-
- return _bitmap.IsSet(start, end);
- }
-
- public bool OverlapsWith(int offset, int size)
- {
- for (int i = 0; i < CommandBufferPool.MaxCommandBuffers; i++)
- {
- if (OverlapsWith(i, offset, size))
- {
- return true;
- }
- }
-
- return false;
- }
-
- public void Clear(int cbIndex)
- {
- _bitmap.ClearInt(cbIndex * _intsPerCb, (cbIndex + 1) * _intsPerCb - 1);
- }
- }
-}