Ver a proveniência

* implemented frame buffer

master
Bergmann89 há 10 anos
ascendente
cometimento
05317c61ac
7 ficheiros alterados com 360 adições e 58 eliminações
  1. +16
    -4
      projects/triangle/triangle.lpi
  2. +2
    -1
      projects/triangle/triangle.lpr
  3. +116
    -51
      projects/triangle/triangle.lps
  4. +10
    -1
      projects/utils/VulkanUtils.pas
  5. +84
    -0
      projects/utils/uvkuFrameBuffer.pas
  6. +131
    -0
      projects/utils/uvkuFrameBufferFactory.pas
  7. +1
    -1
      projects/utils/uvkuTypes.pas

+ 16
- 4
projects/triangle/triangle.lpi Ver ficheiro

@@ -33,7 +33,7 @@
<PackageName Value="LCL"/>
</Item1>
</RequiredPackages>
<Units Count="32">
<Units Count="35">
<Unit0>
<Filename Value="triangle.lpr"/>
<IsPartOfProject Value="True"/>
@@ -154,17 +154,29 @@
<IsPartOfProject Value="True"/>
</Unit28>
<Unit29>
<Filename Value="..\utils\uvkuRenderPass.pas"/>
<Filename Value="..\utils\uvkuUtils.pas"/>
<IsPartOfProject Value="True"/>
</Unit29>
<Unit30>
<Filename Value="..\utils\uvkuRenderPassFactory.pas"/>
<Filename Value="..\utils\uvkuRenderPass.pas"/>
<IsPartOfProject Value="True"/>
</Unit30>
<Unit31>
<Filename Value="..\utils\uvkuFactoryBase.pas"/>
<Filename Value="..\utils\uvkuRenderPassFactory.pas"/>
<IsPartOfProject Value="True"/>
</Unit31>
<Unit32>
<Filename Value="..\utils\uvkuFactoryBase.pas"/>
<IsPartOfProject Value="True"/>
</Unit32>
<Unit33>
<Filename Value="..\utils\uvkuFrameBuffer.pas"/>
<IsPartOfProject Value="True"/>
</Unit33>
<Unit34>
<Filename Value="..\utils\uvkuFrameBufferFactory.pas"/>
<IsPartOfProject Value="True"/>
</Unit34>
</Units>
</ProjectOptions>
<CompilerOptions>


+ 2
- 1
projects/triangle/triangle.lpr Ver ficheiro

@@ -7,7 +7,8 @@ uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces, Dialogs, Forms, uMainForm, Vulkan, uvkuRenderPass, uvkuRenderPassFactory, uvkuFactoryBase;
Interfaces, Dialogs, Forms, uMainForm, Vulkan, uvkuRenderPass, uvkuRenderPassFactory, uvkuFactoryBase,
uvkuFrameBuffer, uvkuFrameBufferFactory, uvkuUtils;

{$R *.res}



+ 116
- 51
projects/triangle/triangle.lps Ver ficheiro

@@ -4,13 +4,13 @@
<PathDelim Value="\"/>
<Version Value="9"/>
<BuildModes Active="Default"/>
<Units Count="51">
<Units Count="53">
<Unit0>
<Filename Value="triangle.lpr"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<CursorPos X="48" Y="10"/>
<UsageCount Value="67"/>
<UsageCount Value="68"/>
</Unit0>
<Unit1>
<Filename Value="uMainForm.pas"/>
@@ -21,21 +21,21 @@
<EditorIndex Value="-1"/>
<TopLine Value="53"/>
<CursorPos X="150" Y="70"/>
<UsageCount Value="67"/>
<UsageCount Value="68"/>
</Unit1>
<Unit2>
<Filename Value="..\Vulkan.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="2"/>
<TopLine Value="2819"/>
<CursorPos X="23" Y="2825"/>
<EditorIndex Value="6"/>
<TopLine Value="2765"/>
<CursorPos X="72" Y="2784"/>
<ExtraEditorCount Value="1"/>
<ExtraEditor1>
<EditorIndex Value="-1"/>
<TopLine Value="2785"/>
<CursorPos X="3" Y="2800"/>
</ExtraEditor1>
<UsageCount Value="67"/>
<UsageCount Value="68"/>
<Loaded Value="True"/>
</Unit2>
<Unit3>
@@ -43,7 +43,7 @@
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<CursorPos X="30" Y="9"/>
<UsageCount Value="65"/>
<UsageCount Value="66"/>
</Unit3>
<Unit4>
<Filename Value="..\utils\uvkuInstanceFactory.pas"/>
@@ -51,7 +51,7 @@
<EditorIndex Value="-1"/>
<TopLine Value="19"/>
<CursorPos X="3" Y="161"/>
<UsageCount Value="59"/>
<UsageCount Value="60"/>
</Unit4>
<Unit5>
<Filename Value="..\utils\uvkuPhysicalDevice.pas"/>
@@ -59,7 +59,7 @@
<EditorIndex Value="-1"/>
<TopLine Value="245"/>
<CursorPos X="38" Y="252"/>
<UsageCount Value="59"/>
<UsageCount Value="60"/>
</Unit5>
<Unit6>
<Filename Value="..\utils\uvkuAllocationHandler.pas"/>
@@ -67,7 +67,7 @@
<EditorIndex Value="-1"/>
<TopLine Value="91"/>
<CursorPos X="39" Y="99"/>
<UsageCount Value="49"/>
<UsageCount Value="50"/>
</Unit6>
<Unit7>
<Filename Value="..\utils\uvkuDevice.pas"/>
@@ -75,15 +75,15 @@
<EditorIndex Value="-1"/>
<TopLine Value="51"/>
<CursorPos X="63" Y="66"/>
<UsageCount Value="53"/>
<UsageCount Value="54"/>
</Unit7>
<Unit8>
<Filename Value="..\utils\uvkuDeviceFactory.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="4"/>
<EditorIndex Value="8"/>
<TopLine Value="118"/>
<CursorPos X="39" Y="123"/>
<UsageCount Value="51"/>
<UsageCount Value="52"/>
<Loaded Value="True"/>
</Unit8>
<Unit9>
@@ -92,7 +92,7 @@
<EditorIndex Value="-1"/>
<TopLine Value="41"/>
<CursorPos X="94" Y="56"/>
<UsageCount Value="46"/>
<UsageCount Value="47"/>
</Unit9>
<Unit10>
<Filename Value="..\utils\uvkuSurfaceFactory.pas"/>
@@ -100,7 +100,7 @@
<EditorIndex Value="-1"/>
<TopLine Value="34"/>
<CursorPos X="43" Y="47"/>
<UsageCount Value="45"/>
<UsageCount Value="46"/>
</Unit10>
<Unit11>
<Filename Value="..\utils\uvkuSwapChainFactory.pas"/>
@@ -108,7 +108,7 @@
<EditorIndex Value="-1"/>
<TopLine Value="51"/>
<CursorPos X="14" Y="64"/>
<UsageCount Value="36"/>
<UsageCount Value="37"/>
</Unit11>
<Unit12>
<Filename Value="..\utils\uvkuSwapChain.pas"/>
@@ -116,7 +116,7 @@
<EditorIndex Value="-1"/>
<TopLine Value="62"/>
<CursorPos X="35" Y="78"/>
<UsageCount Value="35"/>
<UsageCount Value="36"/>
</Unit12>
<Unit13>
<Filename Value="..\utils\uvkuImageView.pas"/>
@@ -124,7 +124,7 @@
<EditorIndex Value="-1"/>
<TopLine Value="29"/>
<CursorPos X="64" Y="47"/>
<UsageCount Value="32"/>
<UsageCount Value="33"/>
</Unit13>
<Unit14>
<Filename Value="..\utils\uvkuImageViewFactory.pas"/>
@@ -132,7 +132,7 @@
<EditorIndex Value="-1"/>
<TopLine Value="60"/>
<CursorPos X="55" Y="79"/>
<UsageCount Value="32"/>
<UsageCount Value="33"/>
</Unit14>
<Unit15>
<Filename Value="..\utils\uvkuImage.pas"/>
@@ -140,7 +140,7 @@
<EditorIndex Value="-1"/>
<TopLine Value="36"/>
<CursorPos X="102" Y="51"/>
<UsageCount Value="31"/>
<UsageCount Value="32"/>
</Unit15>
<Unit16>
<Filename Value="..\utils\uvkuBase.pas"/>
@@ -148,7 +148,7 @@
<EditorIndex Value="-1"/>
<TopLine Value="26"/>
<CursorPos X="5" Y="39"/>
<UsageCount Value="30"/>
<UsageCount Value="31"/>
</Unit16>
<Unit17>
<Filename Value="..\utils\uvkuDeviceMemory.pas"/>
@@ -156,7 +156,7 @@
<EditorIndex Value="-1"/>
<TopLine Value="33"/>
<CursorPos X="79" Y="44"/>
<UsageCount Value="28"/>
<UsageCount Value="29"/>
</Unit17>
<Unit18>
<Filename Value="..\utils\uvkuBuffer.pas"/>
@@ -164,7 +164,7 @@
<EditorIndex Value="-1"/>
<TopLine Value="10"/>
<CursorPos X="3" Y="13"/>
<UsageCount Value="27"/>
<UsageCount Value="28"/>
</Unit18>
<Unit19>
<Filename Value="..\utils\uvkuImageFactory.pas"/>
@@ -172,15 +172,15 @@
<EditorIndex Value="-1"/>
<TopLine Value="113"/>
<CursorPos X="51" Y="132"/>
<UsageCount Value="27"/>
<UsageCount Value="28"/>
</Unit19>
<Unit20>
<Filename Value="..\utils\uvkuTypes.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="3"/>
<TopLine Value="13"/>
<CursorPos X="28" Y="26"/>
<UsageCount Value="27"/>
<EditorIndex Value="7"/>
<TopLine Value="18"/>
<CursorPos X="12" Y="44"/>
<UsageCount Value="28"/>
<Loaded Value="True"/>
</Unit20>
<Unit21>
@@ -189,7 +189,7 @@
<EditorIndex Value="-1"/>
<TopLine Value="92"/>
<CursorPos X="52" Y="111"/>
<UsageCount Value="26"/>
<UsageCount Value="27"/>
</Unit21>
<Unit22>
<Filename Value="..\utils\uvkuBufferView.pas"/>
@@ -197,7 +197,7 @@
<EditorIndex Value="-1"/>
<TopLine Value="52"/>
<CursorPos X="56" Y="76"/>
<UsageCount Value="26"/>
<UsageCount Value="27"/>
</Unit22>
<Unit23>
<Filename Value="..\utils\uvkuBufferViewFactory.pas"/>
@@ -205,7 +205,7 @@
<EditorIndex Value="-1"/>
<TopLine Value="59"/>
<CursorPos X="56" Y="78"/>
<UsageCount Value="25"/>
<UsageCount Value="26"/>
</Unit23>
<Unit24>
<Filename Value="..\utils\uvkuCommandPool.pas"/>
@@ -213,7 +213,7 @@
<EditorIndex Value="-1"/>
<TopLine Value="57"/>
<CursorPos X="62" Y="68"/>
<UsageCount Value="25"/>
<UsageCount Value="26"/>
</Unit24>
<Unit25>
<Filename Value="..\utils\uvkuCommandPoolFactory.pas"/>
@@ -221,14 +221,14 @@
<EditorIndex Value="-1"/>
<TopLine Value="45"/>
<CursorPos X="57" Y="64"/>
<UsageCount Value="24"/>
<UsageCount Value="25"/>
</Unit25>
<Unit26>
<Filename Value="..\utils\uvkuCommandBuffer.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<CursorPos X="39" Y="13"/>
<UsageCount Value="24"/>
<UsageCount Value="25"/>
</Unit26>
<Unit27>
<Filename Value="..\utils\uvkuQueue.pas"/>
@@ -236,14 +236,17 @@
<EditorIndex Value="-1"/>
<TopLine Value="7"/>
<CursorPos X="22" Y="23"/>
<UsageCount Value="24"/>
<UsageCount Value="25"/>
</Unit27>
<Unit28>
<Filename Value="..\utils\VulkanUtils.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<CursorPos X="29" Y="10"/>
<UsageCount Value="23"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="2"/>
<TopLine Value="64"/>
<CursorPos X="80" Y="94"/>
<UsageCount Value="24"/>
<Loaded Value="True"/>
</Unit28>
<Unit29>
<Filename Value="..\utils\uvkuPhysicalDeviceFactory.pas"/>
@@ -254,10 +257,11 @@
</Unit29>
<Unit30>
<Filename Value="..\utils\uvkuUtils.pas"/>
<EditorIndex Value="-1"/>
<TopLine Value="41"/>
<CursorPos X="45" Y="61"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="4"/>
<TopLine Value="9"/>
<UsageCount Value="42"/>
<Loaded Value="True"/>
</Unit30>
<Unit31>
<Filename Value="..\..\data\Vulkan.tpl"/>
@@ -384,19 +388,18 @@
<Unit48>
<Filename Value="..\utils\uvkuRenderPass.pas"/>
<IsPartOfProject Value="True"/>
<IsVisibleTab Value="True"/>
<EditorIndex Value="1"/>
<TopLine Value="12"/>
<CursorPos X="58" Y="31"/>
<UsageCount Value="21"/>
<TopLine Value="8"/>
<CursorPos X="150" Y="12"/>
<UsageCount Value="22"/>
<Loaded Value="True"/>
</Unit48>
<Unit49>
<Filename Value="..\utils\uvkuRenderPassFactory.pas"/>
<IsPartOfProject Value="True"/>
<TopLine Value="170"/>
<CursorPos X="70" Y="188"/>
<UsageCount Value="21"/>
<TopLine Value="122"/>
<CursorPos Y="139"/>
<UsageCount Value="22"/>
<Loaded Value="True"/>
</Unit49>
<Unit50>
@@ -404,10 +407,28 @@
<IsPartOfProject Value="True"/>
<EditorIndex Value="-1"/>
<TopLine Value="7"/>
<UsageCount Value="21"/>
<UsageCount Value="22"/>
</Unit50>
<Unit51>
<Filename Value="..\utils\uvkuFrameBuffer.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="3"/>
<TopLine Value="33"/>
<CursorPos Y="12"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
</Unit51>
<Unit52>
<Filename Value="..\utils\uvkuFrameBufferFactory.pas"/>
<IsPartOfProject Value="True"/>
<EditorIndex Value="5"/>
<TopLine Value="96"/>
<CursorPos Y="118"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
</Unit52>
</Units>
<JumpHistory Count="15" HistoryIndex="14">
<JumpHistory Count="26" HistoryIndex="25">
<Position1>
<Filename Value="..\utils\uvkuRenderPassFactory.pas"/>
<Caret Line="40" TopLine="13"/>
@@ -468,6 +489,50 @@
<Filename Value="..\utils\uvkuRenderPassFactory.pas"/>
<Caret Line="188" Column="70" TopLine="170"/>
</Position15>
<Position16>
<Filename Value="..\utils\uvkuFrameBuffer.pas"/>
<Caret Line="30" Column="14" TopLine="8"/>
</Position16>
<Position17>
<Filename Value="..\utils\uvkuFrameBufferFactory.pas"/>
<Caret Line="30" Column="34"/>
</Position17>
<Position18>
<Filename Value="..\utils\uvkuFrameBufferFactory.pas"/>
<Caret Line="16" Column="40" TopLine="8"/>
</Position18>
<Position19>
<Filename Value="..\utils\uvkuFrameBufferFactory.pas"/>
<Caret Line="60" Column="14" TopLine="31"/>
</Position19>
<Position20>
<Filename Value="..\utils\uvkuFrameBufferFactory.pas"/>
<Caret Line="57" Column="3" TopLine="34"/>
</Position20>
<Position21>
<Filename Value="..\utils\uvkuFrameBufferFactory.pas"/>
<Caret Line="66" Column="29" TopLine="44"/>
</Position21>
<Position22>
<Filename Value="..\utils\uvkuFrameBufferFactory.pas"/>
<Caret Line="41" Column="100" TopLine="14"/>
</Position22>
<Position23>
<Filename Value="..\utils\uvkuFrameBufferFactory.pas"/>
<Caret Line="121" Column="60" TopLine="46"/>
</Position23>
<Position24>
<Filename Value="..\utils\uvkuFrameBufferFactory.pas"/>
<Caret Line="54" Column="13" TopLine="39"/>
</Position24>
<Position25>
<Filename Value="..\utils\uvkuFrameBuffer.pas"/>
<Caret Line="12" TopLine="33"/>
</Position25>
<Position26>
<Filename Value="..\utils\VulkanUtils.pas"/>
<Caret Line="18" Column="12"/>
</Position26>
</JumpHistory>
</ProjectSession>
<Debugging>


+ 10
- 1
projects/utils/VulkanUtils.pas Ver ficheiro

@@ -14,7 +14,8 @@ uses
uvkuImage, uvkuImageFactory, uvkuImageView, uvkuImageViewFactory,
uvkuBuffer, uvkuBufferFactory, uvkuBufferView, uvkuBufferViewFactory,
uvkuCommandPool, uvkuCommandPoolFactory, uvkuCommandBuffer,
uvkuRenderPass, uvkuRenderPassFactory;
uvkuRenderPass, uvkuRenderPassFactory, uvkuFrameBuffer, uvkuFrameBufferFactory,
uvkuUtils;

type
{ Types }
@@ -86,6 +87,14 @@ type
TvkuRenderPass = uvkuRenderPass.TvkuRenderPass;
TvkuRenderPassEx = uvkuRenderPassFactory.TvkuRenderPassEx;
TvkuRenderPassFactory = uvkuRenderPassFactory.TvkuRenderPassFactory;
TvkuFrameBuffer = uvkuFrameBuffer.TvkuFrameBuffer;
TvkuFrameBufferEx = uvkuFrameBufferFactory.TvkuFrameBufferEx;
TvkuFrameBufferFactory = uvkuFrameBufferFactory.TvkuFrameBufferFactory;

{ Utils }
TvkuException = uvkuUtils.TvkuException;
TvkuErrorException = uvkuUtils.TvkuErrorException;
TvkuInvalidFuncPtrException = uvkuUtils.TvkuInvalidFuncPtrException;

implementation



+ 84
- 0
projects/utils/uvkuFrameBuffer.pas Ver ficheiro

@@ -0,0 +1,84 @@
unit uvkuFrameBuffer;

{$mode objfpc}{$H+}

interface

uses
Classes, SysUtils,
Vulkan, uvkuBase;

type
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TvkuFrameBuffer = class(TvkuAllocHandle)
private
fHandle: VkFramebuffer;
fDeviceCommands: TVkDeviceCommands;

procedure CreateHandle(const aCreateInfo: TVkFramebufferCreateInfo);
public
property Handle: VkFramebuffer read fHandle;
property DeviceCommands: TVkDeviceCommands read fDeviceCommands;

constructor Create(
const aCreateInfo: TVkFramebufferCreateInfo;
const aDeviceCommands: TVkDeviceCommands;
const aAllocCallbacks: PVkAllocationCallbacks = nil);
constructor Create(
const aHandle: VkFramebuffer;
const aOwnsHandle: Boolean;
const aDeviceCommands: TVkDeviceCommands;
const aAllocCallbacks: PVkAllocationCallbacks = nil);
destructor Destroy; override;
end;

implementation

uses
uvkuUtils;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//TvkuFrameBuffer////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TvkuFrameBuffer.CreateHandle(const aCreateInfo: TVkFramebufferCreateInfo);
var err: TVkResult;
begin
if not Assigned(fDeviceCommands.vkCreateFramebuffer) then
raise TvkuInvalidFuncPtrException.Create('vkCreateFramebuffer');
err := fDeviceCommands.vkCreateFramebuffer(fDeviceCommands.Device, @aCreateInfo, AllocCallbacks, @fHandle);
if (err < VK_SUCCESS) then
raise TvkuErrorException.Create('unable to create frame buffer', err);
end;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
constructor TvkuFrameBuffer.Create(const aCreateInfo: TVkFramebufferCreateInfo;
const aDeviceCommands: TVkDeviceCommands; const aAllocCallbacks: PVkAllocationCallbacks);
begin
inherited Create;
fDeviceCommands := aDeviceCommands;
SetAllocCallbacks(aAllocCallbacks);
CreateHandle(aCreateInfo);
end;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
constructor TvkuFrameBuffer.Create(const aHandle: VkFramebuffer; const aOwnsHandle: Boolean;
const aDeviceCommands: TVkDeviceCommands; const aAllocCallbacks: PVkAllocationCallbacks);
begin
inherited Create;
fHandle := aHandle;
fDeviceCommands := aDeviceCommands;
OwnsHandle := aOwnsHandle;
SetAllocCallbacks(aAllocCallbacks);
end;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
destructor TvkuFrameBuffer.Destroy;
begin
if OwnsHandle and (fHandle <> VK_INVALID_NDP_HANDLE) then
fDeviceCommands.vkDestroyFramebuffer(fDeviceCommands.Device, fHandle, AllocCallbacks);
fHandle := VK_INVALID_NDP_HANDLE;
inherited Destroy;
end;

end.


+ 131
- 0
projects/utils/uvkuFrameBufferFactory.pas Ver ficheiro

@@ -0,0 +1,131 @@
unit uvkuFrameBufferFactory;

{$mode objfpc}{$H+}

interface

uses
Classes, SysUtils,
Vulkan, uvkuFrameBuffer, uvkuFactoryBase, uvkuAllocationHandler, uvkuTypes;

type
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TvkuFrameBufferEx = class(TvkuFrameBuffer)
private
fAllocHandler: TvkuAllocationHandler;
fOwnsHandler: Boolean;
public
destructor Destroy; override;
end;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
TvkuFrameBufferFactory = class(TvkuDeviceObjFactory)
private
fFlags: VkFramebufferCreateFlags;
fWidth: VkUint32;
fHeight: VkUint32;
fLayers: VkUint32;
fAttachments: TvkuImageViewArr;
function GetAttachment(const aIndex: Integer): VkImageView;
function GetAttachmentCount: Integer;
procedure SetAttachment(const aIndex: Integer; aValue: VkImageView);
procedure SetAttachmentCount(aValue: Integer);
public
property Flags: VkFramebufferCreateFlags read fFlags write fFlags;
property Width: VkUint32 read fWidth write fWidth;
property Height: VkUint32 read fHeight write fHeight;
property Layers: VkUint32 read fLayers write fLayers;

property Attachments: TvkuImageViewArr read fAttachments write fAttachments;
property AttachmentCount: Integer read GetAttachmentCount write SetAttachmentCount;
property Attachment[const aIndex: Integer]: VkImageView read GetAttachment write SetAttachment;

function CreateFrameBuffer(
const aRenderPass: VkRenderPass): TvkuFrameBufferEx;
function CreateFrameBuffer(
const aRenderPass: VkRenderPass;
const aAllocHandler: TvkuAllocationHandler;
const aOwnsHandler: Boolean): TvkuFrameBufferEx;
end;

implementation

uses
uvkuUtils;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//TvkuFrameBufferEx//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
destructor TvkuFrameBufferEx.Destroy;
begin
inherited Destroy;
if fOwnsHandler then
FreeAndNil(fAllocHandler);
end;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//TvkuFrameBufferFactory/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function TvkuFrameBufferFactory.GetAttachment(const aIndex: Integer): VkImageView;
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 TvkuFrameBufferFactory.GetAttachmentCount: Integer;
begin
result := Length(fAttachments);
end;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
procedure TvkuFrameBufferFactory.SetAttachment(const aIndex: Integer; aValue: VkImageView);
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 TvkuFrameBufferFactory.SetAttachmentCount(aValue: Integer);
begin
SetLength(fAttachments, aValue);
end;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function TvkuFrameBufferFactory.CreateFrameBuffer(const aRenderPass: VkRenderPass): TvkuFrameBufferEx;
begin
result := CreateFrameBuffer(aRenderPass, nil, false);
end;

/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function TvkuFrameBufferFactory.CreateFrameBuffer(const aRenderPass: VkRenderPass;
const aAllocHandler: TvkuAllocationHandler; const aOwnsHandler: Boolean): TvkuFrameBufferEx;
var
CreateInfo: TVkFramebufferCreateInfo;
begin
FillByte(CreateInfo, SizeOf(CreateInfo), 0);
CreateInfo.sType := VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
CreateInfo.pNext := nil;
CreateInfo.flags := fFlags;
CreateInfo.renderPass := aRenderPass;
CreateInfo.attachmentCount := Length(fAttachments);
CreateInfo.pAttachments := @fAttachments[0];
CreateInfo.width := fWidth;
CreateInfo.height := fHeight;
CreateInfo.layers := fLayers;
if Assigned(aAllocHandler)
then result := TvkuFrameBufferEx.Create(CreateInfo, DeviceCommands, aAllocHandler.GetAllocationCallbacksPtr)
else result := TvkuFrameBufferEx.Create(CreateInfo, DeviceCommands);
try
TvkuFrameBufferEx(result).fAllocHandler := aAllocHandler;
TvkuFrameBufferEx(result).fOwnsHandler := aOwnsHandler;
except
FreeAndNil(result);
raise;
end;
end;

end.


+ 1
- 1
projects/utils/uvkuTypes.pas Ver ficheiro

@@ -25,6 +25,7 @@ type
TvkuAttachmentDescriptionArr = array of TVkAttachmentDescription;
TvkuSubpassDescriptionArr = array of TVkSubpassDescription;
TvkuSubpassDependencyArr = array of TVkSubpassDependency;
TvkuImageViewArr = array of VkImageView;

TvkuApplicationInfo = packed record
AppName: String;
@@ -41,7 +42,6 @@ type
end;
TvkuQueueCreateInfoArr = array of TvkuQueueCreateInfo;


implementation

end.


Carregando…
Cancelar
Guardar