CommandBufferScoped.cs 1019 B

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