mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-06-02 02:19:14 +00:00
Memory changes 3 (ryubing/ryujinx!202)
See merge request ryubing/ryujinx!202
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using Ryujinx.Common.Memory;
|
||||
using Silk.NET.Vulkan;
|
||||
using System;
|
||||
using System.Buffers;
|
||||
|
||||
namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
@@ -11,7 +12,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
private const int BufferUsageTrackingGranularity = 4096;
|
||||
|
||||
private readonly FenceHolder[] _fences;
|
||||
public FenceHolder[] Fences { get; }
|
||||
private readonly BufferUsageBitmap _bufferUsageBitmap;
|
||||
|
||||
/// <summary>
|
||||
@@ -19,7 +20,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
/// </summary>
|
||||
public MultiFenceHolder()
|
||||
{
|
||||
_fences = new FenceHolder[CommandBufferPool.MaxCommandBuffers];
|
||||
Fences = ArrayPool<FenceHolder>.Shared.Rent(CommandBufferPool.MaxCommandBuffers);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -28,7 +29,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
/// <param name="size">Size of the buffer</param>
|
||||
public MultiFenceHolder(int size)
|
||||
{
|
||||
_fences = new FenceHolder[CommandBufferPool.MaxCommandBuffers];
|
||||
Fences = ArrayPool<FenceHolder>.Shared.Rent(CommandBufferPool.MaxCommandBuffers);
|
||||
_bufferUsageBitmap = new BufferUsageBitmap(size, BufferUsageTrackingGranularity);
|
||||
}
|
||||
|
||||
@@ -90,7 +91,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
/// <returns>True if the command buffer's previous fence value was null</returns>
|
||||
public bool AddFence(int cbIndex, FenceHolder fence)
|
||||
{
|
||||
ref FenceHolder fenceRef = ref _fences[cbIndex];
|
||||
ref FenceHolder fenceRef = ref Fences[cbIndex];
|
||||
|
||||
if (fenceRef == null)
|
||||
{
|
||||
@@ -107,7 +108,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
/// <param name="cbIndex">Command buffer index of the command buffer that owns the fence</param>
|
||||
public void RemoveFence(int cbIndex)
|
||||
{
|
||||
_fences[cbIndex] = null;
|
||||
Fences[cbIndex] = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -117,7 +118,7 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
/// <returns>True if referenced, false otherwise</returns>
|
||||
public bool HasFence(int cbIndex)
|
||||
{
|
||||
return _fences[cbIndex] != null;
|
||||
return Fences[cbIndex] != null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -227,9 +228,9 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
for (int i = 0; i < _fences.Length; i++)
|
||||
for (int i = 0; i < Fences.Length; i++)
|
||||
{
|
||||
FenceHolder fence = _fences[i];
|
||||
FenceHolder fence = Fences[i];
|
||||
|
||||
if (fence != null)
|
||||
{
|
||||
@@ -251,9 +252,9 @@ namespace Ryujinx.Graphics.Vulkan
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
for (int i = 0; i < _fences.Length; i++)
|
||||
for (int i = 0; i < Fences.Length; i++)
|
||||
{
|
||||
FenceHolder fence = _fences[i];
|
||||
FenceHolder fence = Fences[i];
|
||||
|
||||
if (fence != null && _bufferUsageBitmap.OverlapsWith(i, offset, size))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user