25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
2.0 KiB

  1. unit uvkuCommandBuffer;
  2. {$mode objfpc}{$H+}
  3. interface
  4. uses
  5. Classes, SysUtils,
  6. Vulkan, uvkuBase;
  7. type
  8. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  9. TvkuCommandBuffer = class(TvkuHandle)
  10. private
  11. fHandle: VkCommandBuffer;
  12. fCommandPool: VkCommandPool;
  13. fDeviceCommands: TVkDeviceCommands;
  14. public
  15. property Handle: VkCommandBuffer read fHandle;
  16. property CommandPool: VkCommandPool read fCommandPool;
  17. property DeviceCommands: TVkDeviceCommands read fDeviceCommands;
  18. constructor Create(
  19. const aHandle: VkCommandBuffer;
  20. const aOwnsHandle: Boolean;
  21. const aCommandPool: VkCommandPool;
  22. const aDeviceCommands: TVkDeviceCommands);
  23. destructor Destroy; override;
  24. end;
  25. implementation
  26. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  27. //TvkuCommandBuffer//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  28. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  29. constructor TvkuCommandBuffer.Create(const aHandle: VkCommandBuffer; const aOwnsHandle: Boolean;
  30. const aCommandPool: VkCommandPool; const aDeviceCommands: TVkDeviceCommands);
  31. begin
  32. inherited Create;
  33. fHandle := aHandle;
  34. fCommandPool := aCommandPool;
  35. fDeviceCommands := aDeviceCommands;
  36. OwnsHandle := aOwnsHandle;
  37. end;
  38. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  39. destructor TvkuCommandBuffer.Destroy;
  40. begin
  41. if OwnsHandle and (fHandle <> VK_INVALID_HANDLE) then
  42. fDeviceCommands.vkFreeCommandBuffers(fDeviceCommands.Device, fCommandPool, 1, @fHandle);
  43. fHandle := VK_INVALID_HANDLE;
  44. inherited Destroy;
  45. end;
  46. end.