CommandBufferScoped.cs
1 using Silk.NET.Vulkan; 2 using System; 3 4 namespace Ryujinx.Graphics.Vulkan 5 { 6 readonly struct CommandBufferScoped : IDisposable 7 { 8 private readonly CommandBufferPool _pool; 9 public CommandBuffer CommandBuffer { get; } 10 public int CommandBufferIndex { get; } 11 12 public CommandBufferScoped(CommandBufferPool pool, CommandBuffer commandBuffer, int commandBufferIndex) 13 { 14 _pool = pool; 15 CommandBuffer = commandBuffer; 16 CommandBufferIndex = commandBufferIndex; 17 } 18 19 public void AddDependant(IAuto dependant) 20 { 21 _pool.AddDependant(CommandBufferIndex, dependant); 22 } 23 24 public void AddWaitable(MultiFenceHolder waitable) 25 { 26 _pool.AddWaitable(CommandBufferIndex, waitable); 27 } 28 29 public FenceHolder GetFence() 30 { 31 return _pool.GetFence(CommandBufferIndex); 32 } 33 34 public void Dispose() 35 { 36 _pool?.Return(this); 37 } 38 } 39 }