PreloadCbs + FlushCommandsIfWeightExceeding

This commit is contained in:
Isaac Marovitz
2024-06-21 00:54:04 +01:00
committed by Evan Husted
parent 197184657f
commit d0e4adac36
2 changed files with 53 additions and 0 deletions

View File

@@ -190,6 +190,18 @@ namespace Ryujinx.Graphics.Metal
}
}
if (cbs != null &&
_pipeline.RenderPassActive &&
!(_buffer.HasCommandBufferDependency(cbs.Value) &&
_waitable.IsBufferRangeInUse(cbs.Value.CommandBufferIndex, offset, dataSize)))
{
// If the buffer hasn't been used on the command buffer yet, try to preload the data.
// This avoids ending and beginning render passes on each buffer data upload.
cbs = _pipeline.PreloadCbs;
endRenderPass = null;
}
if (allowCbsWait)
{
_renderer.BufferManager.StagingBuffer.PushData(_renderer.CommandBufferPool, cbs, endRenderPass, this, offset, data);
@@ -331,6 +343,8 @@ namespace Ryujinx.Graphics.Metal
public void Dispose()
{
_pipeline.FlushCommandsIfWeightExceeding(_buffer, (ulong)Size);
_buffer.Dispose();
_cachedConvertedBuffers.Dispose();