diff --git a/projects/triangle/triangle.lpi b/projects/triangle/triangle.lpi
index 2c203dd..e9167b6 100644
--- a/projects/triangle/triangle.lpi
+++ b/projects/triangle/triangle.lpi
@@ -33,7 +33,7 @@
-
+
@@ -153,6 +153,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/projects/triangle/triangle.lpr b/projects/triangle/triangle.lpr
index 32c0b5a..6fd4e85 100644
--- a/projects/triangle/triangle.lpr
+++ b/projects/triangle/triangle.lpr
@@ -7,7 +7,7 @@ uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
- Interfaces, Dialogs, Forms, uMainForm, Vulkan;
+ Interfaces, Dialogs, Forms, uMainForm, Vulkan, uvkuRenderPass, uvkuRenderPassFactory, uvkuFactoryBase;
{$R *.res}
diff --git a/projects/triangle/triangle.lps b/projects/triangle/triangle.lps
index b2018b3..9d7d521 100644
--- a/projects/triangle/triangle.lps
+++ b/projects/triangle/triangle.lps
@@ -4,13 +4,13 @@
-
+
-
+
@@ -18,24 +18,24 @@
-
-
-
-
+
+
+
+
-
-
-
+
+
+
-
-
+
+
-
+
@@ -43,24 +43,23 @@
-
+
-
-
-
+
+
+
-
+
-
-
+
@@ -68,449 +67,407 @@
-
+
-
+
-
-
+
-
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
-
+
-
-
-
+
+
+
-
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
+
-
-
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
+
+
+
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/projects/utils/VulkanUtils.pas b/projects/utils/VulkanUtils.pas
index adb7ab8..121c44e 100644
--- a/projects/utils/VulkanUtils.pas
+++ b/projects/utils/VulkanUtils.pas
@@ -13,7 +13,8 @@ uses
uvkuSwapChain, uvkuSwapChainFactory,
uvkuImage, uvkuImageFactory, uvkuImageView, uvkuImageViewFactory,
uvkuBuffer, uvkuBufferFactory, uvkuBufferView, uvkuBufferViewFactory,
- uvkuCommandPool, uvkuCommandPoolFactory, uvkuCommandBuffer;
+ uvkuCommandPool, uvkuCommandPoolFactory, uvkuCommandBuffer,
+ uvkuRenderPass, uvkuRenderPassFactory;
type
{ Types }
@@ -81,6 +82,11 @@ type
TvkuCommandPoolFactory = uvkuCommandPoolFactory.TvkuCommandPoolFactory;
TvkuCommandBuffer = uvkuCommandBuffer.TvkuCommandBuffer;
+ { RenderPass }
+ TvkuRenderPass = uvkuRenderPass.TvkuRenderPass;
+ TvkuRenderPassEx = uvkuRenderPassFactory.TvkuRenderPassEx;
+ TvkuRenderPassFactory = uvkuRenderPassFactory.TvkuRenderPassFactory;
+
implementation
end.
diff --git a/projects/utils/uvkuBufferFactory.pas b/projects/utils/uvkuBufferFactory.pas
index 1e93f21..62dee0b 100644
--- a/projects/utils/uvkuBufferFactory.pas
+++ b/projects/utils/uvkuBufferFactory.pas
@@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils,
- Vulkan, uvkuBuffer, uvkuDevice, uvkuAllocationHandler, uvkuTypes;
+ Vulkan, uvkuBuffer, uvkuDevice, uvkuAllocationHandler, uvkuTypes, uvkuFactoryBase;
type
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -19,9 +19,8 @@ type
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- TvkuBufferFactory = class(TObject)
+ TvkuBufferFactory = class(TvkuDeviceObjFactory)
private
- fDeviceCommands: TVkDeviceCommands;
fFlags: VkBufferCreateFlags;
fSize: VkDeviceSize;
fUsage: VkBufferUsageFlags;
@@ -32,7 +31,6 @@ type
function GetQueueFamilyIndexCount: Integer;
procedure SetQueueFamilyIndex(const aIndex: Integer; aValue: VkUint32);
public
- property DeviceCommands: TVkDeviceCommands read fDeviceCommands;
property Flags: VkBufferCreateFlags read fFlags write fFlags;
property Size: VkDeviceSize read fSize write fSize;
property Usage: VkBufferUsageFlags read fUsage write fUsage;
@@ -46,9 +44,6 @@ type
function CreateBuffer(
const aAllocHandler: TvkuAllocationHandler;
const aOwnsHandler: Boolean): TvkuBufferEx;
-
- constructor Create(const aDevice: TvkuDevice);
- constructor Create(const aDeviceCommands: TVkDeviceCommands);
end;
implementation
@@ -61,9 +56,9 @@ uses
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
destructor TvkuBufferEx.Destroy;
begin
+ inherited Destroy;
if fOwnsHandle then
FreeAndNil(fAllocHandler);
- inherited Destroy;
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -112,8 +107,8 @@ begin
CreateInfo.pQueueFamilyIndices := @fQueueFamilyIndices[0];
if Assigned(aAllocHandler)
- then result := TvkuBufferEx.Create(CreateInfo, fDeviceCommands, aAllocHandler.GetAllocationCallbacksPtr)
- else result := TvkuBufferEx.Create(CreateInfo, fDeviceCommands);
+ then result := TvkuBufferEx.Create(CreateInfo, DeviceCommands, aAllocHandler.GetAllocationCallbacksPtr)
+ else result := TvkuBufferEx.Create(CreateInfo, DeviceCommands);
try
TvkuBufferEx(result).fAllocHandler := aAllocHandler;
TvkuBufferEx(result).fOwnsHandle := aOwnsHandler;
@@ -123,18 +118,5 @@ begin
end;
end;
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-constructor TvkuBufferFactory.Create(const aDevice: TvkuDevice);
-begin
- Create(aDevice.DeviceCommands);
-end;
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-constructor TvkuBufferFactory.Create(const aDeviceCommands: TVkDeviceCommands);
-begin
- inherited Create;
- fDeviceCommands := aDeviceCommands;
-end;
-
end.
diff --git a/projects/utils/uvkuBufferViewFactory.pas b/projects/utils/uvkuBufferViewFactory.pas
index 44ca264..57b2a14 100644
--- a/projects/utils/uvkuBufferViewFactory.pas
+++ b/projects/utils/uvkuBufferViewFactory.pas
@@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils,
- Vulkan, uvkuBufferView, uvkuAllocationHandler, uvkuDevice;
+ Vulkan, uvkuBufferView, uvkuAllocationHandler, uvkuDevice, uvkuFactoryBase;
type
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -19,18 +19,14 @@ type
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- TvkuBufferViewFactory = class(TObject)
+ TvkuBufferViewFactory = class(TvkuDeviceObjFactory)
private
- fDeviceCommands: TVkDeviceCommands;
-
fFlags: VkBufferViewCreateFlags;
fBuffer: VkBuffer;
fFormat: TVkFormat;
fOffset: VkDeviceSize;
fRange: VkDeviceSize;
public
- property DeviceCommands: TVkDeviceCommands read fDeviceCommands;
-
property Flags: VkBufferViewCreateFlags read fFlags write fFlags;
property Buffer: VkBuffer read fBuffer write fBuffer;
property Format: TVkFormat read fFormat write fFormat;
@@ -41,9 +37,6 @@ type
function CreateBufferView(
const aAllocHandler: TvkuAllocationHandler;
const aOwnsHandler: Boolean): TvkuBufferViewEx;
-
- constructor Create(const aDevice: TvkuDevice);
- constructor Create(const aDeviceCommands: TVkDeviceCommands);
end;
implementation
@@ -54,6 +47,8 @@ implementation
destructor TvkuBufferViewEx.Destroy;
begin
inherited Destroy;
+ if fOwnsHandler then
+ FreeAndNil(fAllocHandler);
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -79,8 +74,8 @@ begin
CreateInfo.range := fRange;
if Assigned(aAllocHandler)
- then result := TvkuBufferViewEx.Create(CreateInfo, fDeviceCommands, aAllocHandler.GetAllocationCallbacksPtr)
- else result := TvkuBufferViewEx.Create(CreateInfo, fDeviceCommands);
+ then result := TvkuBufferViewEx.Create(CreateInfo, DeviceCommands, aAllocHandler.GetAllocationCallbacksPtr)
+ else result := TvkuBufferViewEx.Create(CreateInfo, DeviceCommands);
try
TvkuBufferViewEx(result).fAllocHandler := aAllocHandler;
TvkuBufferViewEx(result).fOwnsHandler := aOwnsHandler;
@@ -90,18 +85,5 @@ begin
end;
end;
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-constructor TvkuBufferViewFactory.Create(const aDevice: TvkuDevice);
-begin
- Create(aDevice.DeviceCommands);
-end;
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-constructor TvkuBufferViewFactory.Create(const aDeviceCommands: TVkDeviceCommands);
-begin
- inherited Create;
- fDeviceCommands := aDeviceCommands;
-end;
-
end.
diff --git a/projects/utils/uvkuCommandPoolFactory.pas b/projects/utils/uvkuCommandPoolFactory.pas
index c6a144b..d4c6fd8 100644
--- a/projects/utils/uvkuCommandPoolFactory.pas
+++ b/projects/utils/uvkuCommandPoolFactory.pas
@@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils,
- Vulkan, uvkuCommandPool, uvkuDevice, uvkuAllocationHandler;
+ Vulkan, uvkuCommandPool, uvkuDevice, uvkuAllocationHandler, uvkuFactoryBase;
type
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -19,9 +19,8 @@ type
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- TvkuCommandPoolFactory = class(TObject)
+ TvkuCommandPoolFactory = class(TvkuDeviceObjFactory)
private
- fDeviceCommands: TVkDeviceCommands;
fFlags: VkCommandPoolCreateFlags;
fQueueFamilyIndex: VkUint32;
public
@@ -29,9 +28,6 @@ type
function CreateCommandPool(
const aAllocHandler: TvkuAllocationHandler;
const aOwnsHandler: Boolean): TvkuCommandPoolEx;
-
- constructor Create(const aDevice: TvkuDevice);
- constructor Create(const aDeviceCommands: TVkDeviceCommands);
end;
implementation
@@ -41,9 +37,9 @@ implementation
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
destructor TvkuCommandPoolEx.Destroy;
begin
+ inherited Destroy;
if fOwnsHandler then
FreeAndNil(fAllocHandler);
- inherited Destroy;
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -64,8 +60,8 @@ begin
CreateInfo.flags := fFlags;
CreateInfo.queueFamilyIndex := fQueueFamilyIndex;
if Assigned(aAllocHandler)
- then result := TvkuCommandPoolEx.Create(CreateInfo, fDeviceCommands, aAllocHandler.GetAllocationCallbacksPtr)
- else result := TvkuCommandPoolEx.Create(CreateInfo, fDeviceCommands);
+ then result := TvkuCommandPoolEx.Create(CreateInfo, DeviceCommands, aAllocHandler.GetAllocationCallbacksPtr)
+ else result := TvkuCommandPoolEx.Create(CreateInfo, DeviceCommands);
try
TvkuCommandPoolEx(result).fAllocHandler := aAllocHandler;
TvkuCommandPoolEx(result).fOwnsHandler := aOwnsHandler;
@@ -75,18 +71,5 @@ begin
end;
end;
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-constructor TvkuCommandPoolFactory.Create(const aDevice: TvkuDevice);
-begin
- Create(aDevice.DeviceCommands);
-end;
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-constructor TvkuCommandPoolFactory.Create(const aDeviceCommands: TVkDeviceCommands);
-begin
- inherited Create;
- fDeviceCommands := aDeviceCommands;
-end;
-
end.
diff --git a/projects/utils/uvkuDeviceFactory.pas b/projects/utils/uvkuDeviceFactory.pas
index e1451de..77b19db 100644
--- a/projects/utils/uvkuDeviceFactory.pas
+++ b/projects/utils/uvkuDeviceFactory.pas
@@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils,
- Vulkan, uvkuInstance, uvkuDevice, uvkuAllocationHandler, uvkuTypes;
+ Vulkan, uvkuInstance, uvkuDevice, uvkuAllocationHandler, uvkuTypes, uvkuFactoryBase;
type
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -19,9 +19,8 @@ type
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- TvkuDeviceFactory = class(TObject)
+ TvkuDeviceFactory = class(TvkuInstanceObjFactory)
private
- fInstanceCommands: TVkInstanceCommands;
fFeatures: TVkPhysicalDeviceFeatures;
fFlags: VkDeviceCreateFlags;
fLayers: TStringList;
@@ -55,9 +54,8 @@ type
const aAllocHandler: TvkuAllocationHandler;
const aOwnsHandler: Boolean): TvkuDeviceEx;
- constructor Create(const aInstance: TvkuInstance);
- constructor Create(const aInstanceCommands: TVkInstanceCommands);
- destructor Destroy; override;
+ procedure AfterConstruction; override;
+ procedure BeforeDestruction; override;
end;
implementation
@@ -184,8 +182,8 @@ begin
CreateInfo.pEnabledFeatures := @fFeatures;
if Assigned(aAllocHandler)
- then result := TvkuDeviceEx.Create(aPhysicalDevice, CreateInfo, fInstanceCommands, aAllocHandler.GetAllocationCallbacksPtr)
- else result := TvkuDeviceEx.Create(aPhysicalDevice, CreateInfo, fInstanceCommands);
+ then result := TvkuDeviceEx.Create(aPhysicalDevice, CreateInfo, InstanceCommands, aAllocHandler.GetAllocationCallbacksPtr)
+ else result := TvkuDeviceEx.Create(aPhysicalDevice, CreateInfo, InstanceCommands);
try
TvkuDeviceEx(result).fAllocHandler := aAllocHandler;
TvkuDeviceEx(result).fOwnsHandler := aOwnsHandler;
@@ -196,27 +194,20 @@ begin
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-constructor TvkuDeviceFactory.Create(const aInstance: TvkuInstance);
-begin
- Create(aInstance.InstanceCommands);
-end;
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-constructor TvkuDeviceFactory.Create(const aInstanceCommands: TVkInstanceCommands);
+procedure TvkuDeviceFactory.AfterConstruction;
begin
- inherited Create;
+ inherited AfterConstruction;
FillByte(fFeatures, SizeOf(fFeatures), 0);
- fInstanceCommands := aInstanceCommands;
fLayers := TStringList.Create;
fExtensions := TStringList.Create;
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-destructor TvkuDeviceFactory.Destroy;
+procedure TvkuDeviceFactory.BeforeDestruction;
begin
FreeAndNil(fLayers);
FreeAndNil(fExtensions);
- inherited Destroy;
+ inherited BeforeDestruction;
end;
end.
diff --git a/projects/utils/uvkuFactoryBase.pas b/projects/utils/uvkuFactoryBase.pas
new file mode 100644
index 0000000..e7163d3
--- /dev/null
+++ b/projects/utils/uvkuFactoryBase.pas
@@ -0,0 +1,71 @@
+unit uvkuFactoryBase;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ Classes, SysUtils,
+ Vulkan, uvkuInstance, uvkuDevice;
+
+type
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ TvkuFactory = class(TObject)
+ end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ TvkuInstanceObjFactory = class(TvkuFactory)
+ private
+ fInstanceCommands: TVkInstanceCommands;
+ public
+ property InstanceCommands: TVkInstanceCommands read fInstanceCommands;
+
+ constructor Create(const aInstance: TvkuInstance);
+ constructor Create(const aInstanceCommands: TVkInstanceCommands);
+ end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ TvkuDeviceObjFactory = class(TvkuFactory)
+ private
+ fDeviceCommands: TVkDeviceCommands;
+ public
+ property DeviceCommands: TVkDeviceCommands read fDeviceCommands;
+
+ constructor Create(const aDevice: TvkuDevice);
+ constructor Create(const aDeviceCommands: TVkDeviceCommands);
+ end;
+
+implementation
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//TvkuInstanceObjFactory/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+constructor TvkuInstanceObjFactory.Create(const aInstance: TvkuInstance);
+begin
+ Create(aInstance.InstanceCommands);
+end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+constructor TvkuInstanceObjFactory.Create(const aInstanceCommands: TVkInstanceCommands);
+begin
+ inherited Create;
+ fInstanceCommands := aInstanceCommands;
+end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//TvkuDeviceObjFactory///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+constructor TvkuDeviceObjFactory.Create(const aDevice: TvkuDevice);
+begin
+ Create(aDevice.DeviceCommands);
+end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+constructor TvkuDeviceObjFactory.Create(const aDeviceCommands: TVkDeviceCommands);
+begin
+ inherited Create;
+ fDeviceCommands := aDeviceCommands;
+end;
+
+end.
+
diff --git a/projects/utils/uvkuImageFactory.pas b/projects/utils/uvkuImageFactory.pas
index 2c03673..7d0f4ac 100644
--- a/projects/utils/uvkuImageFactory.pas
+++ b/projects/utils/uvkuImageFactory.pas
@@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils,
- Vulkan, uvkuImage, uvkuDevice, uvkuAllocationHandler, uvkuTypes;
+ Vulkan, uvkuImage, uvkuDevice, uvkuAllocationHandler, uvkuTypes, uvkuFactoryBase;
type
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -19,9 +19,8 @@ type
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- TvkuImageFactory = class(TObject)
+ TvkuImageFactory = class(TvkuDeviceObjFactory)
private
- fDeviceCommands: TVkDeviceCommands;
fFlags: VkImageCreateFlags;
fImageType: TVkImageType;
fFormat: TVkFormat;
@@ -39,7 +38,6 @@ type
function GetQueueFamilyIndexCount: Integer;
procedure SetQueueFamilyIndex(const aIndex: Integer; aValue: VkUint32);
public
- property DeviceCommands: TVkDeviceCommands read fDeviceCommands;
property Flags: VkImageCreateFlags read fFlags write fFlags;
property ImageType: TVkImageType read fImageType write fImageType;
property Format: TVkFormat read fFormat write fFormat;
@@ -60,9 +58,6 @@ type
function CreateImage(
const aAllocHandler: TvkuAllocationHandler;
const aOwnsHandler: Boolean): TvkuImageEx;
-
- constructor Create(const aDevice: TvkuDevice);
- constructor Create(const aDeviceCommands: TVkDeviceCommands);
end;
implementation
@@ -75,9 +70,9 @@ uses
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
destructor TvkuImageEx.Destroy;
begin
+ inherited Destroy;
if fOwnsHandle then
FreeAndNil(fAllocHandler);
- inherited Destroy;
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -133,8 +128,8 @@ begin
CreateInfo.initialLayout := fInitialLayout;
if Assigned(aAllocHandler)
- then result := TvkuImageEx.Create(CreateInfo, fDeviceCommands, aAllocHandler.GetAllocationCallbacksPtr)
- else result := TvkuImageEx.Create(CreateInfo, fDeviceCommands);
+ then result := TvkuImageEx.Create(CreateInfo, DeviceCommands, aAllocHandler.GetAllocationCallbacksPtr)
+ else result := TvkuImageEx.Create(CreateInfo, DeviceCommands);
try
TvkuImageEx(result).fAllocHandler := aAllocHandler;
TvkuImageEx(result).fOwnsHandle := aOwnsHandler;
@@ -144,18 +139,5 @@ begin
end;
end;
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-constructor TvkuImageFactory.Create(const aDevice: TvkuDevice);
-begin
- Create(aDevice.DeviceCommands);
-end;
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-constructor TvkuImageFactory.Create(const aDeviceCommands: TVkDeviceCommands);
-begin
- inherited Create;
- fDeviceCommands := aDeviceCommands;
-end;
-
end.
diff --git a/projects/utils/uvkuImageViewFactory.pas b/projects/utils/uvkuImageViewFactory.pas
index e59b285..6733a18 100644
--- a/projects/utils/uvkuImageViewFactory.pas
+++ b/projects/utils/uvkuImageViewFactory.pas
@@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils,
- Vulkan, uvkuAllocationHandler, uvkuImageView, uvkuDevice;
+ Vulkan, uvkuAllocationHandler, uvkuImageView, uvkuDevice, uvkuFactoryBase;
type
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -19,10 +19,8 @@ type
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- TvkuImageViewFactory = class(TObject)
+ TvkuImageViewFactory = class(TvkuDeviceObjFactory)
private
- fDeviceCommands: TVkDeviceCommands;
-
fFlags: VkImageViewCreateFlags;
fImage: VkImage;
fViewType: TVkImageViewType;
@@ -30,8 +28,6 @@ type
fComponents: TVkComponentMapping;
fSubresourceRange: TVkImageSubresourceRange;
public
- property DeviceCommands: TVkDeviceCommands read fDeviceCommands;
-
property Flags: VkImageViewCreateFlags read fFlags write fFlags;
property Image: VkImage read fImage write fImage;
property ViewType: TVkImageViewType read fViewType write fViewType;
@@ -43,9 +39,6 @@ type
function CreateImageView(
const aAllocHandler: TvkuAllocationHandler;
const aOwnsHandler: Boolean): TvkuImageViewEx;
-
- constructor Create(const aDevice: TvkuDevice);
- constructor Create(const aDeviceCommands: TVkDeviceCommands);
end;
implementation
@@ -82,8 +75,8 @@ begin
CreateInfo.components := fComponents;
CreateInfo.subresourceRange := fSubresourceRange;
if Assigned(aAllocHandler)
- then result := TvkuImageViewEx.Create(CreateInfo, fDeviceCommands, aAllocHandler.GetAllocationCallbacksPtr)
- else result := TvkuImageViewEx.Create(CreateInfo, fDeviceCommands);
+ then result := TvkuImageViewEx.Create(CreateInfo, DeviceCommands, aAllocHandler.GetAllocationCallbacksPtr)
+ else result := TvkuImageViewEx.Create(CreateInfo, DeviceCommands);
try
TvkuImageViewEx(result).fAllocHandler := aAllocHandler;
TvkuImageViewEx(result).fOwnsHandler := aOwnsHandler;
@@ -93,18 +86,5 @@ begin
end;
end;
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-constructor TvkuImageViewFactory.Create(const aDevice: TvkuDevice);
-begin
- Create(aDevice.DeviceCommands);
-end;
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-constructor TvkuImageViewFactory.Create(const aDeviceCommands: TVkDeviceCommands);
-begin
- inherited Create;
- fDeviceCommands := aDeviceCommands;
-end;
-
end.
diff --git a/projects/utils/uvkuInstanceFactory.pas b/projects/utils/uvkuInstanceFactory.pas
index a8e94f5..a4dcf15 100644
--- a/projects/utils/uvkuInstanceFactory.pas
+++ b/projects/utils/uvkuInstanceFactory.pas
@@ -7,7 +7,7 @@ interface
uses
Classes, SysUtils,
- Vulkan, uvkuInstance, uvkuAllocationHandler, uvkuTypes;
+ Vulkan, uvkuInstance, uvkuAllocationHandler, uvkuTypes, uvkuFactoryBase;
type
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -20,7 +20,7 @@ type
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- TvkuInstanceFactory = class(TObject)
+ TvkuInstanceFactory = class(TvkuFactory)
private
fFlags: VkInstanceCreateFlags;
fApplicationInfo: TvkuApplicationInfo;
diff --git a/projects/utils/uvkuRenderPass.pas b/projects/utils/uvkuRenderPass.pas
new file mode 100644
index 0000000..861f15e
--- /dev/null
+++ b/projects/utils/uvkuRenderPass.pas
@@ -0,0 +1,84 @@
+unit uvkuRenderPass;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ Classes, SysUtils,
+ Vulkan, uvkuBase;
+
+type
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ TvkuRenderPass = class(TvkuAllocHandle)
+ private
+ fHandle: VkRenderPass;
+ fDeviceCommands: TVkDeviceCommands;
+
+ procedure CreateHandle(const aCreateInfo: TVkRenderPassCreateInfo);
+ public
+ property Handle: VkRenderPass read fHandle;
+ property DeviceCommands: TVkDeviceCommands read fDeviceCommands;
+
+ constructor Create(
+ const aCreateInfo: TVkRenderPassCreateInfo;
+ const aDeviceCommands: TVkDeviceCommands;
+ const aAllocCallbacks: PVkAllocationCallbacks = nil);
+ constructor Create(
+ const aHandle: VkRenderPass;
+ const aOwnsHandle: Boolean;
+ const aDeviceCommands: TVkDeviceCommands;
+ const aAllocCallbacks: PVkAllocationCallbacks = nil);
+ destructor Destroy; override;
+ end;
+
+implementation
+
+uses
+ uvkuUtils;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//TvkuRenderPass/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+procedure TvkuRenderPass.CreateHandle(const aCreateInfo: TVkRenderPassCreateInfo);
+var err: TVkResult;
+begin
+ if not Assigned(fDeviceCommands.vkCreateRenderPass) then
+ raise TvkuInvalidFuncPtrException.Create('vkCreateRenderPass');
+ err := fDeviceCommands.vkCreateRenderPass(fDeviceCommands.Device, @aCreateInfo, AllocCallbacks, @fHandle);
+ if (err < VK_SUCCESS) then
+ raise TvkuErrorException.Create('unable to create render pass', err);
+end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+constructor TvkuRenderPass.Create(const aCreateInfo: TVkRenderPassCreateInfo; const aDeviceCommands: TVkDeviceCommands;
+ const aAllocCallbacks: PVkAllocationCallbacks);
+begin
+ inherited Create;
+ fDeviceCommands := aDeviceCommands;
+ SetAllocCallbacks(aAllocCallbacks);
+ CreateHandle(aCreateInfo);
+end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+constructor TvkuRenderPass.Create(const aHandle: VkRenderPass; const aOwnsHandle: Boolean;
+ const aDeviceCommands: TVkDeviceCommands; const aAllocCallbacks: PVkAllocationCallbacks);
+begin
+ inherited Create;
+ fHandle := aHandle;
+ fDeviceCommands := aDeviceCommands;
+ OwnsHandle := aOwnsHandle;
+ SetAllocCallbacks(aAllocCallbacks);
+end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+destructor TvkuRenderPass.Destroy;
+begin
+ if OwnsHandle and (fHandle <> VK_INVALID_NDP_HANDLE) then
+ fDeviceCommands.vkDestroyRenderPass(fDeviceCommands.Device, fHandle, AllocCallbacks);
+ fHandle := VK_INVALID_NDP_HANDLE;
+ inherited Destroy;
+end;
+
+end.
+
diff --git a/projects/utils/uvkuRenderPassFactory.pas b/projects/utils/uvkuRenderPassFactory.pas
new file mode 100644
index 0000000..adc790b
--- /dev/null
+++ b/projects/utils/uvkuRenderPassFactory.pas
@@ -0,0 +1,200 @@
+unit uvkuRenderPassFactory;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ Classes, SysUtils,
+ Vulkan, uvkuFactoryBase, uvkuRenderPass, uvkuAllocationHandler, uvkuTypes;
+
+type
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ TvkuRenderPassEx = class(TvkuRenderPass)
+ private
+ fAllocHandler: TvkuAllocationHandler;
+ fOwnsHandler: Boolean;
+ public
+ destructor Destroy; override;
+ end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+ TvkuRenderPassFactory = class(TvkuDeviceObjFactory)
+ private
+ fFlags: VkRenderPassCreateFlags;
+ fAttachments: TvkuAttachmentDescriptionArr;
+ fSubpasses: TvkuSubpassDescriptionArr;
+ fDependencies: TvkuSubpassDependencyArr;
+
+ function GetAttachment(const aIndex: Integer): TVkAttachmentDescription;
+ function GetAttachmentCount: Integer;
+ function GetDependency(const aIndex: Integer): TVkSubpassDependency;
+ function GetDependencyCount: Integer;
+ function GetSubpass(const aIndex: Integer): TVkSubpassDescription;
+ function GetSubpassCount: Integer;
+
+ procedure SetAttachment(const aIndex: Integer; aValue: TVkAttachmentDescription);
+ procedure SetAttachmentCount(aValue: Integer);
+ procedure SetDependency(const aIndex: Integer; aValue: TVkSubpassDependency);
+ procedure SetDependencyCount(aValue: Integer);
+ procedure SetSubpass(const aIndex: Integer; aValue: TVkSubpassDescription);
+ procedure SetSubpassCount(aValue: Integer);
+ public
+ property Flags: VkRenderPassCreateFlags read fFlags write fFlags;
+
+ property Attachments: TvkuAttachmentDescriptionArr read fAttachments write fAttachments;
+ property AttachmentCount: Integer read GetAttachmentCount write SetAttachmentCount;
+ property Attachment[const aIndex: Integer]: TVkAttachmentDescription read GetAttachment write SetAttachment;
+
+ property Subpasses: TvkuSubpassDescriptionArr read fSubpasses write fSubpasses;
+ property SubpassCount: Integer read GetSubpassCount write SetSubpassCount;
+ property Subpass[const aIndex: Integer]: TVkSubpassDescription read GetSubpass write SetSubpass;
+
+ property Dependencies: TvkuSubpassDependencyArr read fDependencies write fDependencies;
+ property DependencyCount: Integer read GetDependencyCount write SetDependencyCount;
+ property Dependency[const aIndex: Integer]: TVkSubpassDependency read GetDependency write SetDependency;
+
+ function CreateRenderPass: TvkuRenderPassEx;
+ function CreateRenderPass(
+ const aAllocHandler: TvkuAllocationHandler;
+ const aOwnsHandler: Boolean): TvkuRenderPassEx;
+ end;
+
+implementation
+
+uses
+ uvkuUtils;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//TvkuRenderPassEx///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+destructor TvkuRenderPassEx.Destroy;
+begin
+ inherited Destroy;
+ if fOwnsHandler then
+ FreeAndNil(fAllocHandler);
+end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+//TvkuRenderPassFactory//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+function TvkuRenderPassFactory.GetAttachment(const aIndex: Integer): TVkAttachmentDescription;
+begin
+ if (aIndex < low(fAttachments)) or (aIndex > high(fAttachments)) then
+ raise TvkuException.CreateFmt('index (%d) out of range (%d : %d)', [aIndex, Low(fAttachments), High(fAttachments)]);
+ result := fAttachments[aIndex];
+end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+function TvkuRenderPassFactory.GetAttachmentCount: Integer;
+begin
+ result := Length(fAttachments);
+end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+function TvkuRenderPassFactory.GetDependency(const aIndex: Integer): TVkSubpassDependency;
+begin
+ if (aIndex < low(fDependencies)) or (aIndex > high(fDependencies)) then
+ raise TvkuException.CreateFmt('index (%d) out of range (%d : %d)', [aIndex, Low(fDependencies), High(fDependencies)]);
+ result := fDependencies[aIndex];
+end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+function TvkuRenderPassFactory.GetDependencyCount: Integer;
+begin
+ result := Length(fDependencies);
+end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+function TvkuRenderPassFactory.GetSubpass(const aIndex: Integer): TVkSubpassDescription;
+begin
+ if (aIndex < low(fSubpasses)) or (aIndex > high(fSubpasses)) then
+ raise TvkuException.CreateFmt('index (%d) out of range (%d : %d)', [aIndex, Low(fSubpasses), High(fSubpasses)]);
+ result := fSubpasses[aIndex];
+end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+function TvkuRenderPassFactory.GetSubpassCount: Integer;
+begin
+ result := Length(fSubpasses);
+end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+procedure TvkuRenderPassFactory.SetAttachment(const aIndex: Integer; aValue: TVkAttachmentDescription);
+begin
+ if (aIndex < low(fAttachments)) or (aIndex > high(fAttachments)) then
+ raise TvkuException.CreateFmt('index (%d) out of range (%d : %d)', [aIndex, Low(fAttachments), High(fAttachments)]);
+ fAttachments[aIndex] := aValue;
+end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+procedure TvkuRenderPassFactory.SetAttachmentCount(aValue: Integer);
+begin
+ SetLength(fAttachments, aValue);
+end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+procedure TvkuRenderPassFactory.SetDependency(const aIndex: Integer; aValue: TVkSubpassDependency);
+begin
+ if (aIndex < low(fDependencies)) or (aIndex > high(fDependencies)) then
+ raise TvkuException.CreateFmt('index (%d) out of range (%d : %d)', [aIndex, Low(fDependencies), High(fDependencies)]);
+ fDependencies[aIndex] := aValue;
+end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+procedure TvkuRenderPassFactory.SetDependencyCount(aValue: Integer);
+begin
+ SetLength(fDependencies, aValue);
+end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+procedure TvkuRenderPassFactory.SetSubpass(const aIndex: Integer; aValue: TVkSubpassDescription);
+begin
+ if (aIndex < low(fSubpasses)) or (aIndex > high(fSubpasses)) then
+ raise TvkuException.CreateFmt('index (%d) out of range (%d : %d)', [aIndex, Low(fSubpasses), High(fSubpasses)]);
+ fSubpasses[aIndex] := aValue;
+end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+procedure TvkuRenderPassFactory.SetSubpassCount(aValue: Integer);
+begin
+ SetLength(fSubpasses, aValue);
+end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+function TvkuRenderPassFactory.CreateRenderPass: TvkuRenderPassEx;
+begin
+ result := CreateRenderPass(nil, false);
+end;
+
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+function TvkuRenderPassFactory.CreateRenderPass(const aAllocHandler: TvkuAllocationHandler;
+ const aOwnsHandler: Boolean): TvkuRenderPassEx;
+var
+ CreateInfo: TVkRenderPassCreateInfo;
+begin
+ FillByte(CreateInfo, SizeOf(CreateInfo), 0);
+ CreateInfo.sType := VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
+ CreateInfo.pNext := nil;
+ CreateInfo.flags := fFlags;
+ CreateInfo.attachmentCount := Length(fAttachments);
+ CreateInfo.pAttachments := @fAttachments[0];
+ CreateInfo.subpassCount := Length(fSubpasses);
+ CreateInfo.pSubpasses := @fSubpasses[0];
+ CreateInfo.dependencyCount := Length(fDependencies);
+ CreateInfo.pDependencies := @fDependencies[0];
+ if Assigned(aAllocHandler)
+ then result := TvkuRenderPassEx.Create(CreateInfo, DeviceCommands, aAllocHandler.GetAllocationCallbacksPtr)
+ else result := TvkuRenderPassEx.Create(CreateInfo, DeviceCommands);
+ try
+ TvkuRenderPassEx(result).fAllocHandler := aAllocHandler;
+ TvkuRenderPassEx(result).fOwnsHandler := aOwnsHandler;
+ except
+ FreeAndNil(result);
+ raise;
+ end;
+end;
+
+
+end.
+
diff --git a/projects/utils/uvkuSurfaceFactory.pas b/projects/utils/uvkuSurfaceFactory.pas
index e92b19d..bc12e41 100644
--- a/projects/utils/uvkuSurfaceFactory.pas
+++ b/projects/utils/uvkuSurfaceFactory.pas
@@ -7,7 +7,7 @@ interface
uses
Classes, SysUtils, Controls,
- Vulkan, uvkuInstance, uvkuSurface, uvkuAllocationHandler;
+ Vulkan, uvkuInstance, uvkuSurface, uvkuAllocationHandler, uvkuFactoryBase;
type
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -20,7 +20,7 @@ type
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- TvkuSurfaceFactory = class(TObject)
+ TvkuSurfaceFactory = class(TvkuInstanceObjFactory)
{$IF DEFINED(VK_USE_PLATFORM_WIN32_KHR)}
private
fHInstance: Vulkan.HINSTANCE;
@@ -34,7 +34,6 @@ type
private
fFlags: VkFlags;
fWinControl: TWinControl;
- fInstanceCommands: TVkInstanceCommands;
procedure SetWinControl(aValue: TWinControl);
public
property WinControl: TWinControl read fWinControl write SetWinControl;
@@ -45,8 +44,7 @@ type
const aAllocHandler: TvkuAllocationHandler;
const aOwnsHandler: Boolean): TvkuSurfaceEx;
- constructor Create(const aInstance: TvkuInstance);
- constructor Create(const aInstanceCommands: TVkInstanceCommands);
+ procedure AfterConstruction; override;
end;
implementation
@@ -194,8 +192,8 @@ begin
CreateInfo.hwnd := fHwnd;
{$ENDIF}
if Assigned(aAllocHandler)
- then srf := TvkuSurfaceEx.Create(CreateInfo, fInstanceCommands, aAllocHandler.GetAllocationCallbacksPtr)
- else srf := TvkuSurfaceEx.Create(CreateInfo, fInstanceCommands);
+ then srf := TvkuSurfaceEx.Create(CreateInfo, InstanceCommands, aAllocHandler.GetAllocationCallbacksPtr)
+ else srf := TvkuSurfaceEx.Create(CreateInfo, InstanceCommands);
try
srf.fAllocHandler := aAllocHandler;
srf.fOwnsHandler := aOwnsHandler;
@@ -206,15 +204,9 @@ begin
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-constructor TvkuSurfaceFactory.Create(const aInstance: TvkuInstance);
+procedure TvkuSurfaceFactory.AfterConstruction;
begin
- Create(aInstance.InstanceCommands);
-end;
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-constructor TvkuSurfaceFactory.Create(const aInstanceCommands: TVkInstanceCommands);
-begin
- inherited Create;
+ inherited AfterConstruction;
{$IF DEFINED(VK_USE_PLATFORM_XLIB_KHR)}
{$ERROR 'TODO: implement'}
{$ELSEIF DEFINED(VK_USE_PLATFORM_XCB_KHR)}
@@ -228,8 +220,7 @@ begin
{$ELSEIF DEFINED(VK_USE_PLATFORM_WIN32_KHR)}
fHInstance := Vulkan.HINSTANCE(GetModuleHandle(nil));
{$ENDIF}
- fInstanceCommands := aInstanceCommands;
- fFlags := 0;
+ fFlags := 0;
end;
end.
diff --git a/projects/utils/uvkuSwapChainFactory.pas b/projects/utils/uvkuSwapChainFactory.pas
index 03d1bb2..f34e94e 100644
--- a/projects/utils/uvkuSwapChainFactory.pas
+++ b/projects/utils/uvkuSwapChainFactory.pas
@@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils,
- Vulkan, uvkuSwapChain, uvkuTypes, uvkuAllocationHandler, uvkuDevice;
+ Vulkan, uvkuSwapChain, uvkuTypes, uvkuAllocationHandler, uvkuDevice, uvkuFactoryBase;
type
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -19,10 +19,8 @@ type
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- TvkuSwapChainFactory = class(TObject)
+ TvkuSwapChainFactory = class(TvkuDeviceObjFactory)
private
- fDeviceCommands: TVkDeviceCommands;
-
fFlags: VkSwapchainCreateFlagsKHR;
fSurface: VkSurfaceKHR;
fMinImageCount: VkUint32;
@@ -43,8 +41,6 @@ type
function GetQueueFamilyIndex(const aIndex: Integer): VkUint32;
procedure SetQueueFamilyIndex(const aIndex: Integer; aValue: VkUint32);
public
- property DeviceCommands: TVkDeviceCommands read fDeviceCommands;
-
property Flags: VkSwapchainCreateFlagsKHR read fFlags write fFlags;
property Surface: VkSurfaceKHR read fSurface write fSurface;
property MinImageCount: VkUint32 read fMinImageCount write fMinImageCount;
@@ -69,8 +65,7 @@ type
const aAllocHandler: TvkuAllocationHandler;
const aOwnsHandler: Boolean): TvkuSwapChain;
- constructor Create(const aDevice: TvkuDevice);
- constructor Create(const aDeviceCommands: TVkDeviceCommands);
+ procedure AfterConstruction; override;
end;
implementation
@@ -146,8 +141,8 @@ begin
else CreateInfo.clipped := VK_FALSE;
if Assigned(aAllocHandler)
- then result := TvkuSwapChainEx.Create(CreateInfo, fDeviceCommands, aAllocHandler.GetAllocationCallbacksPtr)
- else result := TvkuSwapChainEx.Create(CreateInfo, fDeviceCommands);
+ then result := TvkuSwapChainEx.Create(CreateInfo, DeviceCommands, aAllocHandler.GetAllocationCallbacksPtr)
+ else result := TvkuSwapChainEx.Create(CreateInfo, DeviceCommands);
try
TvkuSwapChainEx(result).fAllocHandler := aAllocHandler;
TvkuSwapChainEx(result).fOwnsHandler := aOwnsHandler;
@@ -158,17 +153,10 @@ begin
end;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-constructor TvkuSwapChainFactory.Create(const aDevice: TvkuDevice);
-begin
- Create(aDevice.DeviceCommands);
-end;
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-constructor TvkuSwapChainFactory.Create(const aDeviceCommands: TVkDeviceCommands);
+procedure TvkuSwapChainFactory.AfterConstruction;
begin
- inherited Create;
- fDeviceCommands := aDeviceCommands;
- fPresentMode := VK_PRESENT_MODE_FIFO_KHR;
+ inherited AfterConstruction;
+ fPresentMode := VK_PRESENT_MODE_FIFO_KHR;
end;
end.
diff --git a/projects/utils/uvkuTypes.pas b/projects/utils/uvkuTypes.pas
index af9e9da..12c8e98 100644
--- a/projects/utils/uvkuTypes.pas
+++ b/projects/utils/uvkuTypes.pas
@@ -22,6 +22,9 @@ type
TvkuDisplayArr = array of VkDisplayKHR;
TvkuDisplayModePropertiesArr = array of TVkDisplayModePropertiesKHR;
TvkuCommandBufferArr = array of VkCommandBuffer;
+ TvkuAttachmentDescriptionArr = array of TVkAttachmentDescription;
+ TvkuSubpassDescriptionArr = array of TVkSubpassDescription;
+ TvkuSubpassDependencyArr = array of TVkSubpassDependency;
TvkuApplicationInfo = packed record
AppName: String;