Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

85 linhas
3.3 KiB

  1. unit uvkuPipelineLayout;
  2. {$mode objfpc}{$H+}
  3. interface
  4. uses
  5. Classes, SysUtils,
  6. Vulkan, uvkuBase;
  7. type
  8. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  9. TvkuPipelineLayout = class(TvkuAllocHandle)
  10. private
  11. fHandle: VkPipelineLayout;
  12. fDeviceCommands: TVkDeviceCommands;
  13. procedure CreateHandle(const aCreateInfo: TVkPipelineLayoutCreateInfo);
  14. public
  15. property Handle: VkPipelineLayout read fHandle;
  16. property DeviceCommands: TVkDeviceCommands read fDeviceCommands;
  17. constructor Create(
  18. const aCreateInfo: TVkPipelineLayoutCreateInfo;
  19. const aDeviceCommands: TVkDeviceCommands;
  20. const aAllocCallbacks: PVkAllocationCallbacks = nil);
  21. constructor Create(
  22. const aHandle: VkPipelineLayout;
  23. const aOwnsHandle: Boolean;
  24. const aDeviceCommands: TVkDeviceCommands;
  25. const aAllocCallbacks: PVkAllocationCallbacks = nil);
  26. destructor Destroy; override;
  27. end;
  28. implementation
  29. uses
  30. uvkuUtils;
  31. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  32. //TvkuPipelineLayout/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  33. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  34. procedure TvkuPipelineLayout.CreateHandle(const aCreateInfo: TVkPipelineLayoutCreateInfo);
  35. var err: TVkResult;
  36. begin
  37. if not Assigned(fDeviceCommands.vkCreatePipelineLayout) then
  38. raise TvkuInvalidFuncPtrException.Create('vkCreatePipelineLayout');
  39. err := fDeviceCommands.vkCreatePipelineLayout(fDeviceCommands.Device, @aCreateInfo, AllocCallbacks, @fHandle);
  40. if (err < VK_SUCCESS) then
  41. raise TvkuErrorException.Create('unable to create pipeline layout', err);
  42. end;
  43. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  44. constructor TvkuPipelineLayout.Create(const aCreateInfo: TVkPipelineLayoutCreateInfo;
  45. const aDeviceCommands: TVkDeviceCommands; const aAllocCallbacks: PVkAllocationCallbacks);
  46. begin
  47. inherited Create;
  48. fDeviceCommands := aDeviceCommands;
  49. SetAllocCallbacks(aAllocCallbacks);
  50. CreateHandle(aCreateInfo);
  51. end;
  52. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  53. constructor TvkuPipelineLayout.Create(const aHandle: VkPipelineLayout; const aOwnsHandle: Boolean;
  54. const aDeviceCommands: TVkDeviceCommands; const aAllocCallbacks: PVkAllocationCallbacks);
  55. begin
  56. inherited Create;
  57. fHandle := aHandle;
  58. fDeviceCommands := aDeviceCommands;
  59. OwnsHandle := aOwnsHandle;
  60. SetAllocCallbacks(aAllocCallbacks);
  61. end;
  62. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  63. destructor TvkuPipelineLayout.Destroy;
  64. begin
  65. if OwnsHandle and (fHandle <> VK_INVALID_NDP_HANDLE) then
  66. fDeviceCommands.vkDestroyPipelineLayout(fDeviceCommands.Device, fHandle, AllocCallbacks);
  67. fHandle := VK_INVALID_NDP_HANDLE;
  68. inherited Destroy;
  69. end;
  70. end.