New pooled memory types (#6821)
* feat: add new types MemoryOwner and SpanOwner * use SpanOwner instead of new array allocation * change for loop condition to `fences.Length` instead of `count` to elide Span boundary checks on `fences`
This commit is contained in:
parent
888402ecaf
commit
1ecc8fbc3b
3 changed files with 258 additions and 2 deletions
|
@ -1,3 +1,4 @@
|
|||
using Ryujinx.Common.Memory;
|
||||
using Silk.NET.Vulkan;
|
||||
using System;
|
||||
|
||||
|
@ -165,14 +166,15 @@ namespace Ryujinx.Graphics.Vulkan
|
|||
/// <returns>True if all fences were signaled before the timeout expired, false otherwise</returns>
|
||||
private bool WaitForFencesImpl(Vk api, Device device, int offset, int size, bool hasTimeout, ulong timeout)
|
||||
{
|
||||
Span<FenceHolder> fenceHolders = new FenceHolder[CommandBufferPool.MaxCommandBuffers];
|
||||
using SpanOwner<FenceHolder> fenceHoldersOwner = SpanOwner<FenceHolder>.Rent(CommandBufferPool.MaxCommandBuffers);
|
||||
Span<FenceHolder> fenceHolders = fenceHoldersOwner.Span;
|
||||
|
||||
int count = size != 0 ? GetOverlappingFences(fenceHolders, offset, size) : GetFences(fenceHolders);
|
||||
Span<Fence> fences = stackalloc Fence[count];
|
||||
|
||||
int fenceCount = 0;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
for (int i = 0; i < fences.Length; i++)
|
||||
{
|
||||
if (fenceHolders[i].TryGet(out Fence fence))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue