VulkanSemaphorePair.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using Silk.NET.Vulkan;
  3. namespace Ryujinx.Ava.Ui.Vulkan
  4. {
  5. internal class VulkanSemaphorePair : IDisposable
  6. {
  7. private readonly VulkanDevice _device;
  8. public unsafe VulkanSemaphorePair(VulkanDevice device)
  9. {
  10. _device = device;
  11. var semaphoreCreateInfo = new SemaphoreCreateInfo { SType = StructureType.SemaphoreCreateInfo };
  12. _device.Api.CreateSemaphore(_device.InternalHandle, semaphoreCreateInfo, null, out var semaphore).ThrowOnError();
  13. ImageAvailableSemaphore = semaphore;
  14. _device.Api.CreateSemaphore(_device.InternalHandle, semaphoreCreateInfo, null, out semaphore).ThrowOnError();
  15. RenderFinishedSemaphore = semaphore;
  16. }
  17. internal Semaphore ImageAvailableSemaphore { get; }
  18. internal Semaphore RenderFinishedSemaphore { get; }
  19. public unsafe void Dispose()
  20. {
  21. _device.Api.DestroySemaphore(_device.InternalHandle, ImageAvailableSemaphore, null);
  22. _device.Api.DestroySemaphore(_device.InternalHandle, RenderFinishedSemaphore, null);
  23. }
  24. }
  25. }