From 9e8a8aa19fa009dfe6350b1dc22e07b0f825484a Mon Sep 17 00:00:00 2001 From: Bergmann89 Date: Wed, 9 Mar 2016 19:27:11 +0100 Subject: [PATCH] * refactored generator * added extensions to vulkan.pas * added some comments to vulkan.pas --- data/Vulkan.inc | 29 + data/vulkan.tpl | 126 +- projects/Vulkan.inc | 29 + projects/Vulkan.pas | 5985 ++++++++++++++++-------- projects/generator/HeaderGenerator.pas | 1805 ++++--- projects/generator/generator.lpi | 3 +- projects/generator/generator.lpr | 7 +- projects/generator/generator.lps | 241 +- projects/generator/uutlGenerics.pas | 1997 ++++++++ projects/triangle/triangle.lps | 264 +- projects/utils/uvkuInstance.pas | 1 + 11 files changed, 7407 insertions(+), 3080 deletions(-) create mode 100644 data/Vulkan.inc create mode 100644 projects/Vulkan.inc create mode 100644 projects/generator/uutlGenerics.pas diff --git a/data/Vulkan.inc b/data/Vulkan.inc new file mode 100644 index 0000000..b0fad31 --- /dev/null +++ b/data/Vulkan.inc @@ -0,0 +1,29 @@ +{$IFDEF FPC} + {$MODE Delphi} + {$IFNDEF WINDOWS} + {$LINKLIB c} + {$ENDIF} + {$MINENUMSIZE 4} +{$ENDIF} + +{$IFDEF Win32} + {$DEFINE VK_WIN} + {$DEFINE VK_WIN32} + {$DEFINE VK_USE_PLATFORM_WIN32_KHR} +{$ENDIF} + +{$IFDEF Win64} + {$DEFINE VK_WIN} + {$DEFINE VK_WIN64} + {$DEFINE VK_USE_PLATFORM_WIN32_KHR} +{$ENDIF} + +{$IFDEF linux} + {$DEFINE VK_LINUX} + {$DEFINE VK_CDECL} +{$ENDIF} + +{$IFDEF DARWIN} + {$DEFINE VK_MAC} + {$DEFINE VK_CDECL} +{$ENDIF} diff --git a/data/vulkan.tpl b/data/vulkan.tpl index 0edbd78..57cde60 100644 --- a/data/vulkan.tpl +++ b/data/vulkan.tpl @@ -1,47 +1,90 @@ +{ ============================================================================ + This file is autogenerated from vk.xml + You may retrieve the latest version of this file at the Delphi OpenGL + Community home page, located at http://www.delphigl.com/ + + The contents of this file are used with permission, subject to + the Mozilla Public License Version 1.1 (the "License"); you may + not use this file except in compliance with the License. You may + obtain a copy of the License at + http://www.mozilla.org/MPL/MPL-1.1.html + + Software distributed under the License is distributed on an + "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + implied. See the License for the specific language governing + rights and limitations under the License. + +Original vk.xml comment: +============================================================================== +{%COMMENT%} +============================================================================ } + unit Vulkan; -{$IFDEF FPC} - {$MODE Delphi} - {$IFNDEF WINDOWS} - {$LINKLIB c} - {$ENDIF} - {$MINENUMSIZE 4} -{$ENDIF} - -{$IFDEF Win32} - {$DEFINE VK_WIN} -{$ENDIF} - -{$IFDEF Win64} - {$DEFINE VK_WIN} -{$ENDIF} - -{$IFDEF linux} - {$DEFINE VK_LINUX} - {$DEFINE VK_CDECL} -{$ENDIF} - -{$IFDEF DARWIN} - {$DEFINE VK_MAC} - {$DEFINE VK_CDECL} -{$ENDIF} +{$I Vulkan.inc} interface +type + HINSTANCE = THandle; + HWND = THandle; + + VkHandle = Pointer; + VkUint8 = Byte; + VkUint16 = Word; + VkUint32 = Cardinal; + VkUint64 = QWord; + VkInt16 = SmallInt; + VkInt32 = Integer; + VkInt64 = Int64; + VkFloat = Single; + VkDouble = Double; + VkChar = AnsiChar; + VkSize = SizeUInt; + + PVkVoid = Pointer; + PVkHandle = ^VkHandle; + PVkUint8 = ^VkUint8; + PVkUint16 = ^VkUint16; + PVkUint32 = ^VkUint32; + PVkUint64 = ^VkUint64; + PVkInt16 = ^VkInt16; + PVkInt32 = ^VkInt32; + PVkInt64 = ^VkInt64; + PVkFloat = ^VkFloat; + PVkDouble = ^VkDouble; + PVkChar = ^VkChar; + PVkSize = ^VkSize; + + PPVkVoid = ^PVkVoid; + PPVkHandle = ^PVkHandle; + PPVkUint8 = ^PVkUint8; + PPVkUint16 = ^PVkUint16; + PPVkUint32 = ^PVkUint32; + PPVkUint64 = ^PVkUint64; + PPVkInt16 = ^PVkInt16; + PPVkInt32 = ^PVkInt32; + PPVkInt64 = ^PVkInt64; + PPVkFloat = ^PVkFloat; + PPVkDouble = ^PVkDouble; + PPVkChar = ^PVkChar; + PPVkSize = ^PVkSize; + {%INTERFACE%} const - VULKAN_LIBNAME = 'vulkan-1.dll'; + VULKAN_LIBNAME = 'vulkan-1.dll'; type VkVersion = VkInt32; -function vkMakeVersion(const aMajor, aMinor, aPatch: Integer): VkVersion; -function vkGetVersionMajor(const aVersion: VkVersion): Integer; -function vkGetVersionMinor(const aVersion: VkVersion): Integer; -function vkgetVersionPatch(const aVersion: VkVersion): Integer; +function vkMakeVersion(const aMajor, aMinor, aPatch: Integer): VkVersion; inline; +function vkGetVersionMajor(const aVersion: VkVersion): Integer; inline; +function vkGetVersionMinor(const aVersion: VkVersion): Integer; inline; +function vkGetVersionPatch(const aVersion: VkVersion): Integer; inline; function InitializeVulkan(const aLibName: String = VULKAN_LIBNAME): Boolean; +procedure LoadVulkanCommands(const aInstance: VkInstance); procedure FinalizeVulkan; implementation @@ -72,10 +115,17 @@ begin {$ENDIF} end; -function vkGetProcAddress(const aProcName: String; aLibHandle: TvkLibHandle = InvalidLibHandle): Pointer; +function vkGetProcAddress(const aProcName: String; aInstance: VkInstance = nil; aLibHandle: TvkLibHandle = InvalidLibHandle): TvkVoidFunction; begin + result := nil; if (aLibHandle = InvalidLibHandle) then aLibHandle := vkLibHandle; + if Assigned(vkGetInstanceProcAddr) then begin + result := vkGetInstanceProcAddr(aInstance, PVkChar(aProcName)); + if Assigned(result) then + exit; + end; + {$IF DEFINED(VK_WIN)} result := GetProcAddress(aLibHandle, AnsiString(aProcName)); {$ELSE} @@ -83,6 +133,11 @@ begin {$ENDIF} end; +procedure vkLoadAddresses(const aInstance: VkInstance = nil); +begin + {%IMPLEMENTATION%} +end; + procedure vkFreeLibrary(var aLibHandle: TvkLibHandle); begin if (aLibHandle <> InvalidLibHandle) then begin @@ -120,10 +175,15 @@ begin result := (vkLibHandle <> InvalidLibHandle); if not result then exit; - - {%IMPLEMENTATION%} + vkGetInstanceProcAddr := TvkGetInstanceProcAddr(vkGetProcAddress('vkGetInstanceProcAddr')); + vkLoadAddresses(nil); end; +procedure LoadVulkanCommands(const aInstance: VkInstance); +begin + vkLoadAddresses(aInstance); +end; + procedure FinalizeVulkan; begin vkFreeLibrary(vkLibHandle); diff --git a/projects/Vulkan.inc b/projects/Vulkan.inc new file mode 100644 index 0000000..b0fad31 --- /dev/null +++ b/projects/Vulkan.inc @@ -0,0 +1,29 @@ +{$IFDEF FPC} + {$MODE Delphi} + {$IFNDEF WINDOWS} + {$LINKLIB c} + {$ENDIF} + {$MINENUMSIZE 4} +{$ENDIF} + +{$IFDEF Win32} + {$DEFINE VK_WIN} + {$DEFINE VK_WIN32} + {$DEFINE VK_USE_PLATFORM_WIN32_KHR} +{$ENDIF} + +{$IFDEF Win64} + {$DEFINE VK_WIN} + {$DEFINE VK_WIN64} + {$DEFINE VK_USE_PLATFORM_WIN32_KHR} +{$ENDIF} + +{$IFDEF linux} + {$DEFINE VK_LINUX} + {$DEFINE VK_CDECL} +{$ENDIF} + +{$IFDEF DARWIN} + {$DEFINE VK_MAC} + {$DEFINE VK_CDECL} +{$ENDIF} diff --git a/projects/Vulkan.pas b/projects/Vulkan.pas index c0fa545..d7ada4a 100644 --- a/projects/Vulkan.pas +++ b/projects/Vulkan.pas @@ -1,4 +1,21 @@ { ============================================================================ + This file is autogenerated from vk.xml + You may retrieve the latest version of this file at the Delphi OpenGL + Community home page, located at http://www.delphigl.com/ + + The contents of this file are used with permission, subject to + the Mozilla Public License Version 1.1 (the "License"); you may + not use this file except in compliance with the License. You may + obtain a copy of the License at + http://www.mozilla.org/MPL/MPL-1.1.html + + Software distributed under the License is distributed on an + "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + implied. See the License for the specific language governing + rights and limitations under the License. + +Original vk.xml comment: +============================================================================== Copyright (c) 2015-2016 The Khronos Group Inc. Permission is hereby granted, free of charge, to any person obtaining a @@ -29,69 +46,66 @@ language incorporated into the Specification and reference pages, and other material which is registered by Khronos, such as tags used by extension and layer authors. The only authoritative version of vk.xml is the one maintained in the master branch of the Khronos Vulkan Github project. - -============================================================================== - -This file is autogenerated from vk.xml - -You may retrieve the latest version of this file at the Delphi OpenGL -Community home page, located at http://www.delphigl.com/ - -The contents of this file are used with permission, subject to -the Mozilla Public License Version 1.1 (the "License"); you may -not use this file except in compliance with the License. You may -obtain a copy of the License at -http://www.mozilla.org/MPL/MPL-1.1.html - -Software distributed under the License is distributed on an -"AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -implied. See the License for the specific language governing -rights and limitations under the License. - ============================================================================ } + unit Vulkan; -{$IFDEF FPC} - {$MODE Delphi} - {$IFNDEF WINDOWS} - {$LINKLIB c} - {$ENDIF} - {$MINENUMSIZE 4} -{$ENDIF} - -{$IFDEF Win32} - {$DEFINE VK_WIN} -{$ENDIF} - -{$IFDEF Win64} - {$DEFINE VK_WIN} -{$ENDIF} - -{$IFDEF linux} - {$DEFINE VK_LINUX} - {$DEFINE VK_CDECL} -{$ENDIF} - -{$IFDEF DARWIN} - {$DEFINE VK_MAC} - {$DEFINE VK_CDECL} -{$ENDIF} +{$I Vulkan.inc} interface -{********************************* VK_VERSION_1_0 *********************************} -const { constants } +type + HINSTANCE = THandle; + HWND = THandle; + + VkHandle = Pointer; + VkUint8 = Byte; + VkUint16 = Word; + VkUint32 = Cardinal; + VkUint64 = QWord; + VkInt16 = SmallInt; + VkInt32 = Integer; + VkInt64 = Int64; + VkFloat = Single; + VkDouble = Double; + VkChar = AnsiChar; + VkSize = SizeUInt; + + PVkVoid = Pointer; + PVkHandle = ^VkHandle; + PVkUint8 = ^VkUint8; + PVkUint16 = ^VkUint16; + PVkUint32 = ^VkUint32; + PVkUint64 = ^VkUint64; + PVkInt16 = ^VkInt16; + PVkInt32 = ^VkInt32; + PVkInt64 = ^VkInt64; + PVkFloat = ^VkFloat; + PVkDouble = ^VkDouble; + PVkChar = ^VkChar; + PVkSize = ^VkSize; + + PPVkVoid = ^PVkVoid; + PPVkHandle = ^PVkHandle; + PPVkUint8 = ^PVkUint8; + PPVkUint16 = ^PVkUint16; + PPVkUint32 = ^PVkUint32; + PPVkUint64 = ^PVkUint64; + PPVkInt16 = ^PVkInt16; + PPVkInt32 = ^PVkInt32; + PPVkInt64 = ^PVkInt64; + PPVkFloat = ^PVkFloat; + PPVkDouble = ^PVkDouble; + PPVkChar = ^PVkChar; + PPVkSize = ^PVkSize; + +const VK_API_VERSION = 4194307; VK_API_VERSION_MAJOR = 1; VK_API_VERSION_MINOR = 0; VK_API_VERSION_BUGFIX = 3; - VK_MAX_PHYSICAL_DEVICE_NAME_SIZE = 256; - VK_UUID_SIZE = 16; - VK_MAX_EXTENSION_NAME_SIZE = 256; - VK_MAX_DESCRIPTION_SIZE = 256; - VK_MAX_MEMORY_TYPES = 32; - VK_MAX_MEMORY_HEAPS = 16; +{ ========================================== VK_VERSION_1_0 ========================================== } VK_LOD_CLAMP_NONE = 1000; VK_REMAINING_MIP_LEVELS = $FFFFFFFF; VK_REMAINING_ARRAY_LAYERS = $FFFFFFFF; @@ -101,433 +115,637 @@ const { constants } VK_FALSE = 0; VK_QUEUE_FAMILY_IGNORED = $FFFFFFFF; VK_SUBPASS_EXTERNAL = $FFFFFFFF; + VK_MAX_PHYSICAL_DEVICE_NAME_SIZE = 256; + VK_UUID_SIZE = 16; + VK_MAX_MEMORY_TYPES = 32; + VK_MAX_MEMORY_HEAPS = 16; + VK_MAX_EXTENSION_NAME_SIZE = 256; + VK_MAX_DESCRIPTION_SIZE = 256; -type { types } - PVkVoid = Pointer; - VkChar = AnsiChar; - VkDouble = Double; - VkFloat = Single; - VkHandle = Pointer; - VkInt16 = SmallInt; - VkInt32 = Integer; - VkInt64 = Int64; - VkSize = SizeUInt; - VkUint16 = Word; - VkUint32 = Cardinal; - VkUint64 = QWord; - VkUint8 = Byte; - VkBool32 = VkUint32; +{ ========================================== VK_KHR_surface ========================================== } + VK_KHR_SURFACE_SPEC_VERSION = 25; + VK_KHR_SURFACE_EXTENSION_NAME = 'VK_KHR_surface'; + +{ ========================================= VK_KHR_swapchain ========================================= } + VK_KHR_SWAPCHAIN_SPEC_VERSION = 67; + VK_KHR_SWAPCHAIN_EXTENSION_NAME = 'VK_KHR_swapchain'; + +{ ========================================== VK_KHR_display ========================================== } + VK_KHR_DISPLAY_SPEC_VERSION = 21; + VK_KHR_DISPLAY_EXTENSION_NAME = 'VK_KHR_display'; + +{ ===================================== VK_KHR_display_swapchain ===================================== } + VK_KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION = 9; + VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME = 'VK_KHR_display_swapchain'; + +{ ======================================= VK_KHR_xlib_surface ======================================== } +{$IFDEF VK_USE_PLATFORM_XLIB_KHR} + VK_KHR_XLIB_SURFACE_SPEC_VERSION = 6; + VK_KHR_XLIB_SURFACE_EXTENSION_NAME = 'VK_KHR_xlib_surface'; +{$ENDIF} + +{ ======================================== VK_KHR_xcb_surface ======================================== } +{$IFDEF VK_USE_PLATFORM_XCB_KHR} + VK_KHR_XCB_SURFACE_SPEC_VERSION = 6; + VK_KHR_XCB_SURFACE_EXTENSION_NAME = 'VK_KHR_xcb_surface'; +{$ENDIF} + +{ ====================================== VK_KHR_wayland_surface ====================================== } +{$IFDEF VK_USE_PLATFORM_WAYLAND_KHR} + VK_KHR_WAYLAND_SURFACE_SPEC_VERSION = 5; + VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME = 'VK_KHR_wayland_surface'; +{$ENDIF} + +{ ======================================== VK_KHR_mir_surface ======================================== } +{$IFDEF VK_USE_PLATFORM_MIR_KHR} + VK_KHR_MIR_SURFACE_SPEC_VERSION = 4; + VK_KHR_MIR_SURFACE_EXTENSION_NAME = 'VK_KHR_mir_surface'; +{$ENDIF} + +{ ====================================== VK_KHR_android_surface ====================================== } +{$IFDEF VK_USE_PLATFORM_ANDROID_KHR} + VK_KHR_ANDROID_SURFACE_SPEC_VERSION = 6; + VK_KHR_ANDROID_SURFACE_EXTENSION_NAME = 'VK_KHR_android_surface'; +{$ENDIF} + +{ ======================================= VK_KHR_win32_surface ======================================= } +{$IFDEF VK_USE_PLATFORM_WIN32_KHR} + VK_KHR_WIN32_SURFACE_SPEC_VERSION = 5; + VK_KHR_WIN32_SURFACE_EXTENSION_NAME = 'VK_KHR_win32_surface'; +{$ENDIF} + +{ ======================================= VK_EXT_debug_report ======================================== } + VK_EXT_DEBUG_REPORT_SPEC_VERSION = 1; + VK_EXT_DEBUG_REPORT_EXTENSION_NAME = 'VK_EXT_debug_report'; + +type { simple types } + +{ ========================================== VK_VERSION_1_0 ========================================== } VkFlags = VkUint32; - VkSampleMask = VkUint32; - VkDeviceSize = VkUint64; - VkAccessFlags = VkFlags; - VkAttachmentDescriptionFlags = VkFlags; - VkBufferCreateFlags = VkFlags; - VkBufferUsageFlags = VkFlags; - VkBufferViewCreateFlags = VkFlags; - VkColorComponentFlags = VkFlags; - VkCommandBufferResetFlags = VkFlags; - VkCommandBufferUsageFlags = VkFlags; - VkCommandPoolCreateFlags = VkFlags; - VkCommandPoolResetFlags = VkFlags; - VkCullModeFlags = VkFlags; - VkDependencyFlags = VkFlags; - VkDescriptorPoolCreateFlags = VkFlags; - VkDescriptorPoolResetFlags = VkFlags; - VkDescriptorSetLayoutCreateFlags = VkFlags; - VkDeviceCreateFlags = VkFlags; - VkDeviceQueueCreateFlags = VkFlags; - VkEventCreateFlags = VkFlags; - VkFenceCreateFlags = VkFlags; - VkFormatFeatureFlags = VkFlags; - VkFramebufferCreateFlags = VkFlags; - VkImageAspectFlags = VkFlags; - VkImageCreateFlags = VkFlags; - VkImageUsageFlags = VkFlags; - VkImageViewCreateFlags = VkFlags; + PVkFlags = ^VkFlags; + PPVkFlags = ^PVkFlags; + VkInstanceCreateFlags = VkFlags; - VkMemoryHeapFlags = VkFlags; - VkMemoryMapFlags = VkFlags; - VkMemoryPropertyFlags = VkFlags; - VkPipelineCacheCreateFlags = VkFlags; - VkPipelineColorBlendStateCreateFlags = VkFlags; - VkPipelineCreateFlags = VkFlags; - VkPipelineDepthStencilStateCreateFlags = VkFlags; - VkPipelineDynamicStateCreateFlags = VkFlags; - VkPipelineInputAssemblyStateCreateFlags = VkFlags; - VkPipelineLayoutCreateFlags = VkFlags; - VkPipelineMultisampleStateCreateFlags = VkFlags; - VkPipelineRasterizationStateCreateFlags = VkFlags; - VkPipelineShaderStageCreateFlags = VkFlags; - VkPipelineStageFlags = VkFlags; - VkPipelineTessellationStateCreateFlags = VkFlags; - VkPipelineVertexInputStateCreateFlags = VkFlags; - VkPipelineViewportStateCreateFlags = VkFlags; - VkQueryControlFlags = VkFlags; - VkQueryPipelineStatisticFlags = VkFlags; - VkQueryPoolCreateFlags = VkFlags; - VkQueryResultFlags = VkFlags; - VkQueueFlags = VkFlags; - VkRenderPassCreateFlags = VkFlags; - VkSampleCountFlags = VkFlags; - VkSamplerCreateFlags = VkFlags; - VkSemaphoreCreateFlags = VkFlags; - VkShaderModuleCreateFlags = VkFlags; - VkShaderStageFlags = VkFlags; - VkSparseImageFormatFlags = VkFlags; - VkSparseMemoryBindFlags = VkFlags; - VkStencilFaceFlags = VkFlags; - VkSubpassDescriptionFlags = VkFlags; + PVkInstanceCreateFlags = ^VkInstanceCreateFlags; + PPVkInstanceCreateFlags = ^PVkInstanceCreateFlags; + + VkInstance = VkHandle; + PVkInstance = ^VkInstance; + PPVkInstance = ^PVkInstance; -type { type pointers } - PPVkVoid = ^PVkVoid; - PPPVkVoid = ^PPVkVoid; - PVkChar = ^VkChar; - PPVkChar = ^PVkChar; - PVkDouble = ^VkDouble; - PPVkDouble = ^PVkDouble; - PVkFloat = ^VkFloat; - PPVkFloat = ^PVkFloat; - PVkHandle = ^VkHandle; - PPVkHandle = ^PVkHandle; - PVkInt16 = ^VkInt16; - PPVkInt16 = ^PVkInt16; - PVkInt32 = ^VkInt32; - PPVkInt32 = ^PVkInt32; - PVkInt64 = ^VkInt64; - PPVkInt64 = ^PVkInt64; - PVkSize = ^VkSize; - PPVkSize = ^PVkSize; - PVkUint16 = ^VkUint16; - PPVkUint16 = ^PVkUint16; - PVkUint32 = ^VkUint32; - PPVkUint32 = ^PVkUint32; - PVkUint64 = ^VkUint64; - PPVkUint64 = ^PVkUint64; - PVkUint8 = ^VkUint8; - PPVkUint8 = ^PVkUint8; + VkPhysicalDevice = VkHandle; + PVkPhysicalDevice = ^VkPhysicalDevice; + PPVkPhysicalDevice = ^PVkPhysicalDevice; + + VkBool32 = VkUint32; PVkBool32 = ^VkBool32; PPVkBool32 = ^PVkBool32; - PVkFlags = ^VkFlags; - PPVkFlags = ^PVkFlags; - PVkSampleMask = ^VkSampleMask; - PPVkSampleMask = ^PVkSampleMask; - PVkDeviceSize = ^VkDeviceSize; - PPVkDeviceSize = ^PVkDeviceSize; - PVkAccessFlags = ^VkAccessFlags; - PPVkAccessFlags = ^PVkAccessFlags; - PVkAttachmentDescriptionFlags = ^VkAttachmentDescriptionFlags; - PPVkAttachmentDescriptionFlags = ^PVkAttachmentDescriptionFlags; - PVkBufferCreateFlags = ^VkBufferCreateFlags; - PPVkBufferCreateFlags = ^PVkBufferCreateFlags; - PVkBufferUsageFlags = ^VkBufferUsageFlags; - PPVkBufferUsageFlags = ^PVkBufferUsageFlags; - PVkBufferViewCreateFlags = ^VkBufferViewCreateFlags; - PPVkBufferViewCreateFlags = ^PVkBufferViewCreateFlags; - PVkColorComponentFlags = ^VkColorComponentFlags; - PPVkColorComponentFlags = ^PVkColorComponentFlags; - PVkCommandBufferResetFlags = ^VkCommandBufferResetFlags; - PPVkCommandBufferResetFlags = ^PVkCommandBufferResetFlags; - PVkCommandBufferUsageFlags = ^VkCommandBufferUsageFlags; - PPVkCommandBufferUsageFlags = ^PVkCommandBufferUsageFlags; - PVkCommandPoolCreateFlags = ^VkCommandPoolCreateFlags; - PPVkCommandPoolCreateFlags = ^PVkCommandPoolCreateFlags; - PVkCommandPoolResetFlags = ^VkCommandPoolResetFlags; - PPVkCommandPoolResetFlags = ^PVkCommandPoolResetFlags; - PVkCullModeFlags = ^VkCullModeFlags; - PPVkCullModeFlags = ^PVkCullModeFlags; - PVkDependencyFlags = ^VkDependencyFlags; - PPVkDependencyFlags = ^PVkDependencyFlags; - PVkDescriptorPoolCreateFlags = ^VkDescriptorPoolCreateFlags; - PPVkDescriptorPoolCreateFlags = ^PVkDescriptorPoolCreateFlags; - PVkDescriptorPoolResetFlags = ^VkDescriptorPoolResetFlags; - PPVkDescriptorPoolResetFlags = ^PVkDescriptorPoolResetFlags; - PVkDescriptorSetLayoutCreateFlags = ^VkDescriptorSetLayoutCreateFlags; - PPVkDescriptorSetLayoutCreateFlags = ^PVkDescriptorSetLayoutCreateFlags; - PVkDeviceCreateFlags = ^VkDeviceCreateFlags; - PPVkDeviceCreateFlags = ^PVkDeviceCreateFlags; - PVkDeviceQueueCreateFlags = ^VkDeviceQueueCreateFlags; - PPVkDeviceQueueCreateFlags = ^PVkDeviceQueueCreateFlags; - PVkEventCreateFlags = ^VkEventCreateFlags; - PPVkEventCreateFlags = ^PVkEventCreateFlags; - PVkFenceCreateFlags = ^VkFenceCreateFlags; - PPVkFenceCreateFlags = ^PVkFenceCreateFlags; + + VkFormatFeatureFlags = VkFlags; PVkFormatFeatureFlags = ^VkFormatFeatureFlags; PPVkFormatFeatureFlags = ^PVkFormatFeatureFlags; - PVkFramebufferCreateFlags = ^VkFramebufferCreateFlags; - PPVkFramebufferCreateFlags = ^PVkFramebufferCreateFlags; - PVkImageAspectFlags = ^VkImageAspectFlags; - PPVkImageAspectFlags = ^PVkImageAspectFlags; - PVkImageCreateFlags = ^VkImageCreateFlags; - PPVkImageCreateFlags = ^PVkImageCreateFlags; + + VkImageUsageFlags = VkFlags; PVkImageUsageFlags = ^VkImageUsageFlags; PPVkImageUsageFlags = ^PVkImageUsageFlags; - PVkImageViewCreateFlags = ^VkImageViewCreateFlags; - PPVkImageViewCreateFlags = ^PVkImageViewCreateFlags; - PVkInstanceCreateFlags = ^VkInstanceCreateFlags; - PPVkInstanceCreateFlags = ^PVkInstanceCreateFlags; - PVkMemoryHeapFlags = ^VkMemoryHeapFlags; - PPVkMemoryHeapFlags = ^PVkMemoryHeapFlags; - PVkMemoryMapFlags = ^VkMemoryMapFlags; - PPVkMemoryMapFlags = ^PVkMemoryMapFlags; + + VkImageCreateFlags = VkFlags; + PVkImageCreateFlags = ^VkImageCreateFlags; + PPVkImageCreateFlags = ^PVkImageCreateFlags; + + VkSampleCountFlags = VkFlags; + PVkSampleCountFlags = ^VkSampleCountFlags; + PPVkSampleCountFlags = ^PVkSampleCountFlags; + + VkDeviceSize = VkUint64; + PVkDeviceSize = ^VkDeviceSize; + PPVkDeviceSize = ^PVkDeviceSize; + + VkQueueFlags = VkFlags; + PVkQueueFlags = ^VkQueueFlags; + PPVkQueueFlags = ^PVkQueueFlags; + + VkMemoryPropertyFlags = VkFlags; PVkMemoryPropertyFlags = ^VkMemoryPropertyFlags; PPVkMemoryPropertyFlags = ^PVkMemoryPropertyFlags; - PVkPipelineCacheCreateFlags = ^VkPipelineCacheCreateFlags; - PPVkPipelineCacheCreateFlags = ^PVkPipelineCacheCreateFlags; - PVkPipelineColorBlendStateCreateFlags = ^VkPipelineColorBlendStateCreateFlags; - PPVkPipelineColorBlendStateCreateFlags = ^PVkPipelineColorBlendStateCreateFlags; - PVkPipelineCreateFlags = ^VkPipelineCreateFlags; - PPVkPipelineCreateFlags = ^PVkPipelineCreateFlags; - PVkPipelineDepthStencilStateCreateFlags = ^VkPipelineDepthStencilStateCreateFlags; - PPVkPipelineDepthStencilStateCreateFlags = ^PVkPipelineDepthStencilStateCreateFlags; - PVkPipelineDynamicStateCreateFlags = ^VkPipelineDynamicStateCreateFlags; - PPVkPipelineDynamicStateCreateFlags = ^PVkPipelineDynamicStateCreateFlags; - PVkPipelineInputAssemblyStateCreateFlags = ^VkPipelineInputAssemblyStateCreateFlags; - PPVkPipelineInputAssemblyStateCreateFlags = ^PVkPipelineInputAssemblyStateCreateFlags; - PVkPipelineLayoutCreateFlags = ^VkPipelineLayoutCreateFlags; - PPVkPipelineLayoutCreateFlags = ^PVkPipelineLayoutCreateFlags; - PVkPipelineMultisampleStateCreateFlags = ^VkPipelineMultisampleStateCreateFlags; - PPVkPipelineMultisampleStateCreateFlags = ^PVkPipelineMultisampleStateCreateFlags; - PVkPipelineRasterizationStateCreateFlags = ^VkPipelineRasterizationStateCreateFlags; - PPVkPipelineRasterizationStateCreateFlags = ^PVkPipelineRasterizationStateCreateFlags; - PVkPipelineShaderStageCreateFlags = ^VkPipelineShaderStageCreateFlags; - PPVkPipelineShaderStageCreateFlags = ^PVkPipelineShaderStageCreateFlags; + + VkMemoryHeapFlags = VkFlags; + PVkMemoryHeapFlags = ^VkMemoryHeapFlags; + PPVkMemoryHeapFlags = ^PVkMemoryHeapFlags; + + VkDevice = VkHandle; + PVkDevice = ^VkDevice; + PPVkDevice = ^PVkDevice; + + VkDeviceCreateFlags = VkFlags; + PVkDeviceCreateFlags = ^VkDeviceCreateFlags; + PPVkDeviceCreateFlags = ^PVkDeviceCreateFlags; + + VkDeviceQueueCreateFlags = VkFlags; + PVkDeviceQueueCreateFlags = ^VkDeviceQueueCreateFlags; + PPVkDeviceQueueCreateFlags = ^PVkDeviceQueueCreateFlags; + + VkQueue = VkHandle; + PVkQueue = ^VkQueue; + PPVkQueue = ^PVkQueue; + + VkSemaphore = VkHandle; + PVkSemaphore = ^VkSemaphore; + PPVkSemaphore = ^PVkSemaphore; + + VkPipelineStageFlags = VkFlags; PVkPipelineStageFlags = ^VkPipelineStageFlags; PPVkPipelineStageFlags = ^PVkPipelineStageFlags; - PVkPipelineTessellationStateCreateFlags = ^VkPipelineTessellationStateCreateFlags; - PPVkPipelineTessellationStateCreateFlags = ^PVkPipelineTessellationStateCreateFlags; - PVkPipelineVertexInputStateCreateFlags = ^VkPipelineVertexInputStateCreateFlags; - PPVkPipelineVertexInputStateCreateFlags = ^PVkPipelineVertexInputStateCreateFlags; - PVkPipelineViewportStateCreateFlags = ^VkPipelineViewportStateCreateFlags; - PPVkPipelineViewportStateCreateFlags = ^PVkPipelineViewportStateCreateFlags; - PVkQueryControlFlags = ^VkQueryControlFlags; - PPVkQueryControlFlags = ^PVkQueryControlFlags; - PVkQueryPipelineStatisticFlags = ^VkQueryPipelineStatisticFlags; - PPVkQueryPipelineStatisticFlags = ^PVkQueryPipelineStatisticFlags; - PVkQueryPoolCreateFlags = ^VkQueryPoolCreateFlags; - PPVkQueryPoolCreateFlags = ^PVkQueryPoolCreateFlags; - PVkQueryResultFlags = ^VkQueryResultFlags; - PPVkQueryResultFlags = ^PVkQueryResultFlags; - PVkQueueFlags = ^VkQueueFlags; - PPVkQueueFlags = ^PVkQueueFlags; - PVkRenderPassCreateFlags = ^VkRenderPassCreateFlags; - PPVkRenderPassCreateFlags = ^PVkRenderPassCreateFlags; - PVkSampleCountFlags = ^VkSampleCountFlags; - PPVkSampleCountFlags = ^PVkSampleCountFlags; - PVkSamplerCreateFlags = ^VkSamplerCreateFlags; - PPVkSamplerCreateFlags = ^PVkSamplerCreateFlags; - PVkSemaphoreCreateFlags = ^VkSemaphoreCreateFlags; - PPVkSemaphoreCreateFlags = ^PVkSemaphoreCreateFlags; - PVkShaderModuleCreateFlags = ^VkShaderModuleCreateFlags; - PPVkShaderModuleCreateFlags = ^PVkShaderModuleCreateFlags; - PVkShaderStageFlags = ^VkShaderStageFlags; - PPVkShaderStageFlags = ^PVkShaderStageFlags; + + VkCommandBuffer = VkHandle; + PVkCommandBuffer = ^VkCommandBuffer; + PPVkCommandBuffer = ^PVkCommandBuffer; + + VkFence = VkHandle; + PVkFence = ^VkFence; + PPVkFence = ^PVkFence; + + VkDeviceMemory = VkHandle; + PVkDeviceMemory = ^VkDeviceMemory; + PPVkDeviceMemory = ^PVkDeviceMemory; + + VkMemoryMapFlags = VkFlags; + PVkMemoryMapFlags = ^VkMemoryMapFlags; + PPVkMemoryMapFlags = ^PVkMemoryMapFlags; + + VkBuffer = VkHandle; + PVkBuffer = ^VkBuffer; + PPVkBuffer = ^PVkBuffer; + + VkImage = VkHandle; + PVkImage = ^VkImage; + PPVkImage = ^PVkImage; + + VkImageAspectFlags = VkFlags; + PVkImageAspectFlags = ^VkImageAspectFlags; + PPVkImageAspectFlags = ^PVkImageAspectFlags; + + VkSparseImageFormatFlags = VkFlags; PVkSparseImageFormatFlags = ^VkSparseImageFormatFlags; PPVkSparseImageFormatFlags = ^PVkSparseImageFormatFlags; + + VkSparseMemoryBindFlags = VkFlags; PVkSparseMemoryBindFlags = ^VkSparseMemoryBindFlags; PPVkSparseMemoryBindFlags = ^PVkSparseMemoryBindFlags; - PVkStencilFaceFlags = ^VkStencilFaceFlags; - PPVkStencilFaceFlags = ^PVkStencilFaceFlags; - PVkSubpassDescriptionFlags = ^VkSubpassDescriptionFlags; - PPVkSubpassDescriptionFlags = ^PVkSubpassDescriptionFlags; -type { handles } - VkBuffer = VkHandle; - VkBufferView = VkHandle; - VkCommandBuffer = VkHandle; - VkCommandPool = VkHandle; - VkDescriptorPool = VkHandle; - VkDescriptorSet = VkHandle; - VkDescriptorSetLayout = VkHandle; - VkDevice = VkHandle; - VkDeviceMemory = VkHandle; + VkFenceCreateFlags = VkFlags; + PVkFenceCreateFlags = ^VkFenceCreateFlags; + PPVkFenceCreateFlags = ^PVkFenceCreateFlags; + + VkSemaphoreCreateFlags = VkFlags; + PVkSemaphoreCreateFlags = ^VkSemaphoreCreateFlags; + PPVkSemaphoreCreateFlags = ^PVkSemaphoreCreateFlags; + + VkEventCreateFlags = VkFlags; + PVkEventCreateFlags = ^VkEventCreateFlags; + PPVkEventCreateFlags = ^PVkEventCreateFlags; + VkEvent = VkHandle; - VkFence = VkHandle; - VkFramebuffer = VkHandle; - VkImage = VkHandle; - VkImageView = VkHandle; - VkInstance = VkHandle; - VkPhysicalDevice = VkHandle; - VkPipeline = VkHandle; - VkPipelineCache = VkHandle; - VkPipelineLayout = VkHandle; + PVkEvent = ^VkEvent; + PPVkEvent = ^PVkEvent; + + VkQueryPoolCreateFlags = VkFlags; + PVkQueryPoolCreateFlags = ^VkQueryPoolCreateFlags; + PPVkQueryPoolCreateFlags = ^PVkQueryPoolCreateFlags; + + VkQueryPipelineStatisticFlags = VkFlags; + PVkQueryPipelineStatisticFlags = ^VkQueryPipelineStatisticFlags; + PPVkQueryPipelineStatisticFlags = ^PVkQueryPipelineStatisticFlags; + VkQueryPool = VkHandle; - VkQueue = VkHandle; - VkRenderPass = VkHandle; - VkSampler = VkHandle; - VkSemaphore = VkHandle; - VkShaderModule = VkHandle; + PVkQueryPool = ^VkQueryPool; + PPVkQueryPool = ^PVkQueryPool; -type { handle pointers } - PVkBuffer = ^VkBuffer; - PPVkBuffer = ^PVkBuffer; + VkQueryResultFlags = VkFlags; + PVkQueryResultFlags = ^VkQueryResultFlags; + PPVkQueryResultFlags = ^PVkQueryResultFlags; + + VkBufferCreateFlags = VkFlags; + PVkBufferCreateFlags = ^VkBufferCreateFlags; + PPVkBufferCreateFlags = ^PVkBufferCreateFlags; + + VkBufferUsageFlags = VkFlags; + PVkBufferUsageFlags = ^VkBufferUsageFlags; + PPVkBufferUsageFlags = ^PVkBufferUsageFlags; + + VkBufferViewCreateFlags = VkFlags; + PVkBufferViewCreateFlags = ^VkBufferViewCreateFlags; + PPVkBufferViewCreateFlags = ^PVkBufferViewCreateFlags; + + VkBufferView = VkHandle; PVkBufferView = ^VkBufferView; PPVkBufferView = ^PVkBufferView; - PVkCommandBuffer = ^VkCommandBuffer; - PPVkCommandBuffer = ^PVkCommandBuffer; - PVkCommandPool = ^VkCommandPool; - PPVkCommandPool = ^PVkCommandPool; - PVkDescriptorPool = ^VkDescriptorPool; - PPVkDescriptorPool = ^PVkDescriptorPool; - PVkDescriptorSet = ^VkDescriptorSet; - PPVkDescriptorSet = ^PVkDescriptorSet; - PVkDescriptorSetLayout = ^VkDescriptorSetLayout; - PPVkDescriptorSetLayout = ^PVkDescriptorSetLayout; - PVkDevice = ^VkDevice; - PPVkDevice = ^PVkDevice; - PVkDeviceMemory = ^VkDeviceMemory; - PPVkDeviceMemory = ^PVkDeviceMemory; - PVkEvent = ^VkEvent; - PPVkEvent = ^PVkEvent; - PVkFence = ^VkFence; - PPVkFence = ^PVkFence; - PVkFramebuffer = ^VkFramebuffer; - PPVkFramebuffer = ^PVkFramebuffer; - PVkImage = ^VkImage; - PPVkImage = ^PVkImage; + + VkImageViewCreateFlags = VkFlags; + PVkImageViewCreateFlags = ^VkImageViewCreateFlags; + PPVkImageViewCreateFlags = ^PVkImageViewCreateFlags; + + VkImageView = VkHandle; PVkImageView = ^VkImageView; PPVkImageView = ^PVkImageView; - PVkInstance = ^VkInstance; - PPVkInstance = ^PVkInstance; - PVkPhysicalDevice = ^VkPhysicalDevice; - PPVkPhysicalDevice = ^PVkPhysicalDevice; - PVkPipeline = ^VkPipeline; - PPVkPipeline = ^PVkPipeline; - PVkPipelineCache = ^VkPipelineCache; - PPVkPipelineCache = ^PVkPipelineCache; - PVkPipelineLayout = ^VkPipelineLayout; - PPVkPipelineLayout = ^PVkPipelineLayout; - PVkQueryPool = ^VkQueryPool; - PPVkQueryPool = ^PVkQueryPool; - PVkQueue = ^VkQueue; - PPVkQueue = ^PVkQueue; - PVkRenderPass = ^VkRenderPass; - PPVkRenderPass = ^PVkRenderPass; - PVkSampler = ^VkSampler; - PPVkSampler = ^PVkSampler; - PVkSemaphore = ^VkSemaphore; - PPVkSemaphore = ^PVkSemaphore; + + VkShaderModuleCreateFlags = VkFlags; + PVkShaderModuleCreateFlags = ^VkShaderModuleCreateFlags; + PPVkShaderModuleCreateFlags = ^PVkShaderModuleCreateFlags; + + VkShaderModule = VkHandle; PVkShaderModule = ^VkShaderModule; PPVkShaderModule = ^PVkShaderModule; -type { enums } - TVkAttachmentLoadOp = ( - VK_ATTACHMENT_LOAD_OP_LOAD = 0, - VK_ATTACHMENT_LOAD_OP_CLEAR = 1, - VK_ATTACHMENT_LOAD_OP_DONT_CARE = 2 - ); - PVkAttachmentLoadOp = ^TVkAttachmentLoadOp; + VkPipelineCacheCreateFlags = VkFlags; + PVkPipelineCacheCreateFlags = ^VkPipelineCacheCreateFlags; + PPVkPipelineCacheCreateFlags = ^PVkPipelineCacheCreateFlags; - TVkAttachmentStoreOp = ( - VK_ATTACHMENT_STORE_OP_STORE = 0, - VK_ATTACHMENT_STORE_OP_DONT_CARE = 1 - ); - PVkAttachmentStoreOp = ^TVkAttachmentStoreOp; + VkPipelineCache = VkHandle; + PVkPipelineCache = ^VkPipelineCache; + PPVkPipelineCache = ^PVkPipelineCache; - TVkBlendFactor = ( - VK_BLEND_FACTOR_ZERO = 0, - VK_BLEND_FACTOR_ONE = 1, - VK_BLEND_FACTOR_SRC_COLOR = 2, - VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR = 3, - VK_BLEND_FACTOR_DST_COLOR = 4, - VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR = 5, - VK_BLEND_FACTOR_SRC_ALPHA = 6, - VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA = 7, - VK_BLEND_FACTOR_DST_ALPHA = 8, - VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA = 9, - VK_BLEND_FACTOR_CONSTANT_COLOR = 10, - VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR = 11, - VK_BLEND_FACTOR_CONSTANT_ALPHA = 12, - VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA = 13, - VK_BLEND_FACTOR_SRC_ALPHA_SATURATE = 14, - VK_BLEND_FACTOR_SRC1_COLOR = 15, - VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR = 16, - VK_BLEND_FACTOR_SRC1_ALPHA = 17, - VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA = 18 - ); - PVkBlendFactor = ^TVkBlendFactor; + VkPipelineCreateFlags = VkFlags; + PVkPipelineCreateFlags = ^VkPipelineCreateFlags; + PPVkPipelineCreateFlags = ^PVkPipelineCreateFlags; - TVkBlendOp = ( - VK_BLEND_OP_ADD = 0, - VK_BLEND_OP_SUBTRACT = 1, - VK_BLEND_OP_REVERSE_SUBTRACT = 2, - VK_BLEND_OP_MIN = 3, - VK_BLEND_OP_MAX = 4 - ); - PVkBlendOp = ^TVkBlendOp; + VkPipelineShaderStageCreateFlags = VkFlags; + PVkPipelineShaderStageCreateFlags = ^VkPipelineShaderStageCreateFlags; + PPVkPipelineShaderStageCreateFlags = ^PVkPipelineShaderStageCreateFlags; - TVkBorderColor = ( - VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0, - VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = 1, - VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 2, - VK_BORDER_COLOR_INT_OPAQUE_BLACK = 3, - VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 4, - VK_BORDER_COLOR_INT_OPAQUE_WHITE = 5 - ); - PVkBorderColor = ^TVkBorderColor; + VkPipelineVertexInputStateCreateFlags = VkFlags; + PVkPipelineVertexInputStateCreateFlags = ^VkPipelineVertexInputStateCreateFlags; + PPVkPipelineVertexInputStateCreateFlags = ^PVkPipelineVertexInputStateCreateFlags; - TVkCommandBufferLevel = ( - VK_COMMAND_BUFFER_LEVEL_PRIMARY = 0, - VK_COMMAND_BUFFER_LEVEL_SECONDARY = 1 - ); - PVkCommandBufferLevel = ^TVkCommandBufferLevel; + VkPipelineInputAssemblyStateCreateFlags = VkFlags; + PVkPipelineInputAssemblyStateCreateFlags = ^VkPipelineInputAssemblyStateCreateFlags; + PPVkPipelineInputAssemblyStateCreateFlags = ^PVkPipelineInputAssemblyStateCreateFlags; - TVkCompareOp = ( - VK_COMPARE_OP_NEVER = 0, - VK_COMPARE_OP_LESS = 1, - VK_COMPARE_OP_EQUAL = 2, - VK_COMPARE_OP_LESS_OR_EQUAL = 3, - VK_COMPARE_OP_GREATER = 4, - VK_COMPARE_OP_NOT_EQUAL = 5, - VK_COMPARE_OP_GREATER_OR_EQUAL = 6, - VK_COMPARE_OP_ALWAYS = 7 - ); - PVkCompareOp = ^TVkCompareOp; + VkPipelineTessellationStateCreateFlags = VkFlags; + PVkPipelineTessellationStateCreateFlags = ^VkPipelineTessellationStateCreateFlags; + PPVkPipelineTessellationStateCreateFlags = ^PVkPipelineTessellationStateCreateFlags; - TVkComponentSwizzle = ( - VK_COMPONENT_SWIZZLE_IDENTITY = 0, - VK_COMPONENT_SWIZZLE_ZERO = 1, - VK_COMPONENT_SWIZZLE_ONE = 2, - VK_COMPONENT_SWIZZLE_R = 3, - VK_COMPONENT_SWIZZLE_G = 4, - VK_COMPONENT_SWIZZLE_B = 5, - VK_COMPONENT_SWIZZLE_A = 6 + VkPipelineViewportStateCreateFlags = VkFlags; + PVkPipelineViewportStateCreateFlags = ^VkPipelineViewportStateCreateFlags; + PPVkPipelineViewportStateCreateFlags = ^PVkPipelineViewportStateCreateFlags; + + VkPipelineRasterizationStateCreateFlags = VkFlags; + PVkPipelineRasterizationStateCreateFlags = ^VkPipelineRasterizationStateCreateFlags; + PPVkPipelineRasterizationStateCreateFlags = ^PVkPipelineRasterizationStateCreateFlags; + + VkCullModeFlags = VkFlags; + PVkCullModeFlags = ^VkCullModeFlags; + PPVkCullModeFlags = ^PVkCullModeFlags; + + VkPipelineMultisampleStateCreateFlags = VkFlags; + PVkPipelineMultisampleStateCreateFlags = ^VkPipelineMultisampleStateCreateFlags; + PPVkPipelineMultisampleStateCreateFlags = ^PVkPipelineMultisampleStateCreateFlags; + + VkSampleMask = VkUint32; + PVkSampleMask = ^VkSampleMask; + PPVkSampleMask = ^PVkSampleMask; + + VkPipelineDepthStencilStateCreateFlags = VkFlags; + PVkPipelineDepthStencilStateCreateFlags = ^VkPipelineDepthStencilStateCreateFlags; + PPVkPipelineDepthStencilStateCreateFlags = ^PVkPipelineDepthStencilStateCreateFlags; + + VkPipelineColorBlendStateCreateFlags = VkFlags; + PVkPipelineColorBlendStateCreateFlags = ^VkPipelineColorBlendStateCreateFlags; + PPVkPipelineColorBlendStateCreateFlags = ^PVkPipelineColorBlendStateCreateFlags; + + VkColorComponentFlags = VkFlags; + PVkColorComponentFlags = ^VkColorComponentFlags; + PPVkColorComponentFlags = ^PVkColorComponentFlags; + + VkPipelineDynamicStateCreateFlags = VkFlags; + PVkPipelineDynamicStateCreateFlags = ^VkPipelineDynamicStateCreateFlags; + PPVkPipelineDynamicStateCreateFlags = ^PVkPipelineDynamicStateCreateFlags; + + VkPipelineLayout = VkHandle; + PVkPipelineLayout = ^VkPipelineLayout; + PPVkPipelineLayout = ^PVkPipelineLayout; + + VkRenderPass = VkHandle; + PVkRenderPass = ^VkRenderPass; + PPVkRenderPass = ^PVkRenderPass; + + VkPipeline = VkHandle; + PVkPipeline = ^VkPipeline; + PPVkPipeline = ^PVkPipeline; + + VkPipelineLayoutCreateFlags = VkFlags; + PVkPipelineLayoutCreateFlags = ^VkPipelineLayoutCreateFlags; + PPVkPipelineLayoutCreateFlags = ^PVkPipelineLayoutCreateFlags; + + VkDescriptorSetLayout = VkHandle; + PVkDescriptorSetLayout = ^VkDescriptorSetLayout; + PPVkDescriptorSetLayout = ^PVkDescriptorSetLayout; + + VkShaderStageFlags = VkFlags; + PVkShaderStageFlags = ^VkShaderStageFlags; + PPVkShaderStageFlags = ^PVkShaderStageFlags; + + VkSamplerCreateFlags = VkFlags; + PVkSamplerCreateFlags = ^VkSamplerCreateFlags; + PPVkSamplerCreateFlags = ^PVkSamplerCreateFlags; + + VkSampler = VkHandle; + PVkSampler = ^VkSampler; + PPVkSampler = ^PVkSampler; + + VkDescriptorSetLayoutCreateFlags = VkFlags; + PVkDescriptorSetLayoutCreateFlags = ^VkDescriptorSetLayoutCreateFlags; + PPVkDescriptorSetLayoutCreateFlags = ^PVkDescriptorSetLayoutCreateFlags; + + VkDescriptorPoolCreateFlags = VkFlags; + PVkDescriptorPoolCreateFlags = ^VkDescriptorPoolCreateFlags; + PPVkDescriptorPoolCreateFlags = ^PVkDescriptorPoolCreateFlags; + + VkDescriptorPool = VkHandle; + PVkDescriptorPool = ^VkDescriptorPool; + PPVkDescriptorPool = ^PVkDescriptorPool; + + VkDescriptorPoolResetFlags = VkFlags; + PVkDescriptorPoolResetFlags = ^VkDescriptorPoolResetFlags; + PPVkDescriptorPoolResetFlags = ^PVkDescriptorPoolResetFlags; + + VkDescriptorSet = VkHandle; + PVkDescriptorSet = ^VkDescriptorSet; + PPVkDescriptorSet = ^PVkDescriptorSet; + + VkFramebufferCreateFlags = VkFlags; + PVkFramebufferCreateFlags = ^VkFramebufferCreateFlags; + PPVkFramebufferCreateFlags = ^PVkFramebufferCreateFlags; + + VkFramebuffer = VkHandle; + PVkFramebuffer = ^VkFramebuffer; + PPVkFramebuffer = ^PVkFramebuffer; + + VkRenderPassCreateFlags = VkFlags; + PVkRenderPassCreateFlags = ^VkRenderPassCreateFlags; + PPVkRenderPassCreateFlags = ^PVkRenderPassCreateFlags; + + VkAttachmentDescriptionFlags = VkFlags; + PVkAttachmentDescriptionFlags = ^VkAttachmentDescriptionFlags; + PPVkAttachmentDescriptionFlags = ^PVkAttachmentDescriptionFlags; + + VkSubpassDescriptionFlags = VkFlags; + PVkSubpassDescriptionFlags = ^VkSubpassDescriptionFlags; + PPVkSubpassDescriptionFlags = ^PVkSubpassDescriptionFlags; + + VkAccessFlags = VkFlags; + PVkAccessFlags = ^VkAccessFlags; + PPVkAccessFlags = ^PVkAccessFlags; + + VkDependencyFlags = VkFlags; + PVkDependencyFlags = ^VkDependencyFlags; + PPVkDependencyFlags = ^PVkDependencyFlags; + + VkCommandPoolCreateFlags = VkFlags; + PVkCommandPoolCreateFlags = ^VkCommandPoolCreateFlags; + PPVkCommandPoolCreateFlags = ^PVkCommandPoolCreateFlags; + + VkCommandPool = VkHandle; + PVkCommandPool = ^VkCommandPool; + PPVkCommandPool = ^PVkCommandPool; + + VkCommandPoolResetFlags = VkFlags; + PVkCommandPoolResetFlags = ^VkCommandPoolResetFlags; + PPVkCommandPoolResetFlags = ^PVkCommandPoolResetFlags; + + VkCommandBufferUsageFlags = VkFlags; + PVkCommandBufferUsageFlags = ^VkCommandBufferUsageFlags; + PPVkCommandBufferUsageFlags = ^PVkCommandBufferUsageFlags; + + VkQueryControlFlags = VkFlags; + PVkQueryControlFlags = ^VkQueryControlFlags; + PPVkQueryControlFlags = ^PVkQueryControlFlags; + + VkCommandBufferResetFlags = VkFlags; + PVkCommandBufferResetFlags = ^VkCommandBufferResetFlags; + PPVkCommandBufferResetFlags = ^PVkCommandBufferResetFlags; + + VkStencilFaceFlags = VkFlags; + PVkStencilFaceFlags = ^VkStencilFaceFlags; + PPVkStencilFaceFlags = ^PVkStencilFaceFlags; + +{ ========================================== VK_KHR_surface ========================================== } + VkSurfaceKHR = VkHandle; + PVkSurfaceKHR = ^VkSurfaceKHR; + PPVkSurfaceKHR = ^PVkSurfaceKHR; + + VkSurfaceTransformFlagsKHR = VkFlags; + PVkSurfaceTransformFlagsKHR = ^VkSurfaceTransformFlagsKHR; + PPVkSurfaceTransformFlagsKHR = ^PVkSurfaceTransformFlagsKHR; + + VkCompositeAlphaFlagsKHR = VkFlags; + PVkCompositeAlphaFlagsKHR = ^VkCompositeAlphaFlagsKHR; + PPVkCompositeAlphaFlagsKHR = ^PVkCompositeAlphaFlagsKHR; + +{ ========================================= VK_KHR_swapchain ========================================= } + VkSwapchainCreateFlagsKHR = VkFlags; + PVkSwapchainCreateFlagsKHR = ^VkSwapchainCreateFlagsKHR; + PPVkSwapchainCreateFlagsKHR = ^PVkSwapchainCreateFlagsKHR; + + VkSwapchainKHR = VkHandle; + PVkSwapchainKHR = ^VkSwapchainKHR; + PPVkSwapchainKHR = ^PVkSwapchainKHR; + +{ ========================================== VK_KHR_display ========================================== } + VkDisplayKHR = VkHandle; + PVkDisplayKHR = ^VkDisplayKHR; + PPVkDisplayKHR = ^PVkDisplayKHR; + + VkDisplayModeKHR = VkHandle; + PVkDisplayModeKHR = ^VkDisplayModeKHR; + PPVkDisplayModeKHR = ^PVkDisplayModeKHR; + + VkDisplayModeCreateFlagsKHR = VkFlags; + PVkDisplayModeCreateFlagsKHR = ^VkDisplayModeCreateFlagsKHR; + PPVkDisplayModeCreateFlagsKHR = ^PVkDisplayModeCreateFlagsKHR; + + VkDisplayPlaneAlphaFlagsKHR = VkFlags; + PVkDisplayPlaneAlphaFlagsKHR = ^VkDisplayPlaneAlphaFlagsKHR; + PPVkDisplayPlaneAlphaFlagsKHR = ^PVkDisplayPlaneAlphaFlagsKHR; + + VkDisplaySurfaceCreateFlagsKHR = VkFlags; + PVkDisplaySurfaceCreateFlagsKHR = ^VkDisplaySurfaceCreateFlagsKHR; + PPVkDisplaySurfaceCreateFlagsKHR = ^PVkDisplaySurfaceCreateFlagsKHR; + +{ ======================================= VK_KHR_xlib_surface ======================================== } +{$IFDEF VK_USE_PLATFORM_XLIB_KHR} + VkXlibSurfaceCreateFlagsKHR = VkFlags; + PVkXlibSurfaceCreateFlagsKHR = ^VkXlibSurfaceCreateFlagsKHR; + PPVkXlibSurfaceCreateFlagsKHR = ^PVkXlibSurfaceCreateFlagsKHR; +{$ENDIF} + +{ ======================================== VK_KHR_xcb_surface ======================================== } +{$IFDEF VK_USE_PLATFORM_XCB_KHR} + VkXcbSurfaceCreateFlagsKHR = VkFlags; + PVkXcbSurfaceCreateFlagsKHR = ^VkXcbSurfaceCreateFlagsKHR; + PPVkXcbSurfaceCreateFlagsKHR = ^PVkXcbSurfaceCreateFlagsKHR; +{$ENDIF} + +{ ====================================== VK_KHR_wayland_surface ====================================== } +{$IFDEF VK_USE_PLATFORM_WAYLAND_KHR} + VkWaylandSurfaceCreateFlagsKHR = VkFlags; + PVkWaylandSurfaceCreateFlagsKHR = ^VkWaylandSurfaceCreateFlagsKHR; + PPVkWaylandSurfaceCreateFlagsKHR = ^PVkWaylandSurfaceCreateFlagsKHR; +{$ENDIF} + +{ ======================================== VK_KHR_mir_surface ======================================== } +{$IFDEF VK_USE_PLATFORM_MIR_KHR} + VkMirSurfaceCreateFlagsKHR = VkFlags; + PVkMirSurfaceCreateFlagsKHR = ^VkMirSurfaceCreateFlagsKHR; + PPVkMirSurfaceCreateFlagsKHR = ^PVkMirSurfaceCreateFlagsKHR; +{$ENDIF} + +{ ====================================== VK_KHR_android_surface ====================================== } +{$IFDEF VK_USE_PLATFORM_ANDROID_KHR} + VkAndroidSurfaceCreateFlagsKHR = VkFlags; + PVkAndroidSurfaceCreateFlagsKHR = ^VkAndroidSurfaceCreateFlagsKHR; + PPVkAndroidSurfaceCreateFlagsKHR = ^PVkAndroidSurfaceCreateFlagsKHR; +{$ENDIF} + +{ ======================================= VK_KHR_win32_surface ======================================= } +{$IFDEF VK_USE_PLATFORM_WIN32_KHR} + VkWin32SurfaceCreateFlagsKHR = VkFlags; + PVkWin32SurfaceCreateFlagsKHR = ^VkWin32SurfaceCreateFlagsKHR; + PPVkWin32SurfaceCreateFlagsKHR = ^PVkWin32SurfaceCreateFlagsKHR; +{$ENDIF} + +{ ======================================= VK_EXT_debug_report ======================================== } + VkDebugReportFlagsEXT = VkFlags; + PVkDebugReportFlagsEXT = ^VkDebugReportFlagsEXT; + PPVkDebugReportFlagsEXT = ^PVkDebugReportFlagsEXT; + + VkDebugReportCallbackEXT = VkHandle; + PVkDebugReportCallbackEXT = ^VkDebugReportCallbackEXT; + PPVkDebugReportCallbackEXT = ^PVkDebugReportCallbackEXT; + +type { enumerations } + +{ ========================================== VK_VERSION_1_0 ========================================== } + TVkPipelineCacheHeaderVersion = ( + VK_PIPELINE_CACHE_HEADER_VERSION_ONE = 1, + VK_PIPELINE_CACHE_HEADER_VERSION_MAX_ENUM = $7FFFFFFF ); - PVkComponentSwizzle = ^TVkComponentSwizzle; + PVkPipelineCacheHeaderVersion = ^TVkPipelineCacheHeaderVersion; + PPVkPipelineCacheHeaderVersion = ^PVkPipelineCacheHeaderVersion; - TVkDescriptorType = ( - VK_DESCRIPTOR_TYPE_SAMPLER = 0, - VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 1, - VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 2, - VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = 3, - VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 4, - VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 5, - VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 6, - VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 7, - VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 8, - VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 9, - VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 10 + TVkResult = ( + VK_SUCCESS = 0, + VK_NOT_READY = 1, + VK_TIMEOUT = 2, + VK_EVENT_SET = 3, + VK_EVENT_RESET = 4, + VK_INCOMPLETE = 5, + VK_ERROR_OUT_OF_HOST_MEMORY = -1, + VK_ERROR_OUT_OF_DEVICE_MEMORY = -2, + VK_ERROR_INITIALIZATION_FAILED = -3, + VK_ERROR_DEVICE_LOST = -4, + VK_ERROR_MEMORY_MAP_FAILED = -5, + VK_ERROR_LAYER_NOT_PRESENT = -6, + VK_ERROR_EXTENSION_NOT_PRESENT = -7, + VK_ERROR_FEATURE_NOT_PRESENT = -8, + VK_ERROR_INCOMPATIBLE_DRIVER = -9, + VK_ERROR_TOO_MANY_OBJECTS = -10, + VK_ERROR_FORMAT_NOT_SUPPORTED = -11, + VK_ERROR_SURFACE_LOST_KHR = -1000000000, + VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001, + VK_SUBOPTIMAL_KHR = 1000001003, + VK_ERROR_OUT_OF_DATE_KHR = -1000001004, + VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001, + VK_ERROR_VALIDATION_FAILED_EXT = -1000011001, + VK_RESULT_MAX_ENUM = $7FFFFFFF ); - PVkDescriptorType = ^TVkDescriptorType; + PVkResult = ^TVkResult; + PPVkResult = ^PVkResult; - TVkDynamicState = ( - VK_DYNAMIC_STATE_VIEWPORT = 0, - VK_DYNAMIC_STATE_SCISSOR = 1, - VK_DYNAMIC_STATE_LINE_WIDTH = 2, - VK_DYNAMIC_STATE_DEPTH_BIAS = 3, - VK_DYNAMIC_STATE_BLEND_CONSTANTS = 4, - VK_DYNAMIC_STATE_DEPTH_BOUNDS = 5, - VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 6, - VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 7, - VK_DYNAMIC_STATE_STENCIL_REFERENCE = 8 + TVkStructureType = ( + VK_STRUCTURE_TYPE_APPLICATION_INFO = 0, + VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 1, + VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 2, + VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 3, + VK_STRUCTURE_TYPE_SUBMIT_INFO = 4, + VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO = 5, + VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 6, + VK_STRUCTURE_TYPE_BIND_SPARSE_INFO = 7, + VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 8, + VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 9, + VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 10, + VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 11, + VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 12, + VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 13, + VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 14, + VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 15, + VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 16, + VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 17, + VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 18, + VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 19, + VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 20, + VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 21, + VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 22, + VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO = 23, + VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 24, + VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 25, + VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 26, + VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 27, + VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 28, + VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 29, + VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 30, + VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 31, + VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 32, + VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 33, + VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO = 34, + VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 35, + VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 36, + VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 37, + VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 38, + VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO = 39, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO = 40, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO = 41, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO = 42, + VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 43, + VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 44, + VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 45, + VK_STRUCTURE_TYPE_MEMORY_BARRIER = 46, + VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO = 47, + VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO = 48, + VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR = 1000001000, + VK_STRUCTURE_TYPE_PRESENT_INFO_KHR = 1000001001, + VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR = 1000002000, + VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR = 1000002001, + VK_STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR = 1000003000, + VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000, + VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000, + VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000, + VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR = 1000007000, + VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR = 1000008000, + VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000, + VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT = 1000011000, + VK_STRUCTURE_TYPE_MAX_ENUM = $7FFFFFFF ); - PVkDynamicState = ^TVkDynamicState; + PVkStructureType = ^TVkStructureType; + PPVkStructureType = ^PVkStructureType; - TVkFilter = ( - VK_FILTER_NEAREST = 0, - VK_FILTER_LINEAR = 1 + TVkSystemAllocationScope = ( + VK_SYSTEM_ALLOCATION_SCOPE_COMMAND = 0, + VK_SYSTEM_ALLOCATION_SCOPE_OBJECT = 1, + VK_SYSTEM_ALLOCATION_SCOPE_CACHE = 2, + VK_SYSTEM_ALLOCATION_SCOPE_DEVICE = 3, + VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE = 4, + VK_SYSTEM_ALLOCATION_SCOPE_MAX_ENUM = $7FFFFFFF ); - PVkFilter = ^TVkFilter; + PVkSystemAllocationScope = ^TVkSystemAllocationScope; + PPVkSystemAllocationScope = ^PVkSystemAllocationScope; + + TVkInternalAllocationType = ( + VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE = 0, + VK_INTERNAL_ALLOCATION_TYPE_MAX_ENUM = $7FFFFFFF + ); + PVkInternalAllocationType = ^TVkInternalAllocationType; + PPVkInternalAllocationType = ^PVkInternalAllocationType; TVkFormat = ( VK_FORMAT_UNDEFINED = 0, @@ -714,15 +932,68 @@ type { enums } VK_FORMAT_ASTC_12x10_UNORM_BLOCK = 181, VK_FORMAT_ASTC_12x10_SRGB_BLOCK = 182, VK_FORMAT_ASTC_12x12_UNORM_BLOCK = 183, - VK_FORMAT_ASTC_12x12_SRGB_BLOCK = 184 + VK_FORMAT_ASTC_12x12_SRGB_BLOCK = 184, + VK_FORMAT_MAX_ENUM = $7FFFFFFF ); PVkFormat = ^TVkFormat; + PPVkFormat = ^PVkFormat; - TVkFrontFace = ( - VK_FRONT_FACE_COUNTER_CLOCKWISE = 0, - VK_FRONT_FACE_CLOCKWISE = 1 + TVkImageType = ( + VK_IMAGE_TYPE_1D = 0, + VK_IMAGE_TYPE_2D = 1, + VK_IMAGE_TYPE_3D = 2, + VK_IMAGE_TYPE_MAX_ENUM = $7FFFFFFF ); - PVkFrontFace = ^TVkFrontFace; + PVkImageType = ^TVkImageType; + PPVkImageType = ^PVkImageType; + + TVkImageTiling = ( + VK_IMAGE_TILING_OPTIMAL = 0, + VK_IMAGE_TILING_LINEAR = 1, + VK_IMAGE_TILING_MAX_ENUM = $7FFFFFFF + ); + PVkImageTiling = ^TVkImageTiling; + PPVkImageTiling = ^PVkImageTiling; + + TVkPhysicalDeviceType = ( + VK_PHYSICAL_DEVICE_TYPE_OTHER = 0, + VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 1, + VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 2, + VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 3, + VK_PHYSICAL_DEVICE_TYPE_CPU = 4, + VK_PHYSICAL_DEVICE_TYPE_MAX_ENUM = $7FFFFFFF + ); + PVkPhysicalDeviceType = ^TVkPhysicalDeviceType; + PPVkPhysicalDeviceType = ^PVkPhysicalDeviceType; + + TVkSampleCountFlagBits = ( + VK_SAMPLE_COUNT_1_BIT = (1 shl 0), + VK_SAMPLE_COUNT_2_BIT = (1 shl 1), + VK_SAMPLE_COUNT_4_BIT = (1 shl 2), + VK_SAMPLE_COUNT_8_BIT = (1 shl 3), + VK_SAMPLE_COUNT_16_BIT = (1 shl 4), + VK_SAMPLE_COUNT_32_BIT = (1 shl 5), + VK_SAMPLE_COUNT_64_BIT = (1 shl 6) + ); + PVkSampleCountFlagBits = ^TVkSampleCountFlagBits; + PPVkSampleCountFlagBits = ^PVkSampleCountFlagBits; + + TVkQueryType = ( + VK_QUERY_TYPE_OCCLUSION = 0, + VK_QUERY_TYPE_PIPELINE_STATISTICS = 1, + VK_QUERY_TYPE_TIMESTAMP = 2, + VK_QUERY_TYPE_MAX_ENUM = $7FFFFFFF + ); + PVkQueryType = ^TVkQueryType; + PPVkQueryType = ^PVkQueryType; + + TVkSharingMode = ( + VK_SHARING_MODE_EXCLUSIVE = 0, + VK_SHARING_MODE_CONCURRENT = 1, + VK_SHARING_MODE_MAX_ENUM = $7FFFFFFF + ); + PVkSharingMode = ^TVkSharingMode; + PPVkSharingMode = ^PVkSharingMode; TVkImageLayout = ( VK_IMAGE_LAYOUT_UNDEFINED = 0, @@ -733,84 +1004,291 @@ type { enums } VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL = 5, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL = 6, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL = 7, - VK_IMAGE_LAYOUT_PREINITIALIZED = 8 + VK_IMAGE_LAYOUT_PREINITIALIZED = 8, + VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 1000001002, + VK_IMAGE_LAYOUT_MAX_ENUM = $7FFFFFFF + ); + PVkImageLayout = ^TVkImageLayout; + PPVkImageLayout = ^PVkImageLayout; + + TVkImageViewType = ( + VK_IMAGE_VIEW_TYPE_1D = 0, + VK_IMAGE_VIEW_TYPE_2D = 1, + VK_IMAGE_VIEW_TYPE_3D = 2, + VK_IMAGE_VIEW_TYPE_CUBE = 3, + VK_IMAGE_VIEW_TYPE_1D_ARRAY = 4, + VK_IMAGE_VIEW_TYPE_2D_ARRAY = 5, + VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 6, + VK_IMAGE_VIEW_TYPE_MAX_ENUM = $7FFFFFFF + ); + PVkImageViewType = ^TVkImageViewType; + PPVkImageViewType = ^PVkImageViewType; + + TVkComponentSwizzle = ( + VK_COMPONENT_SWIZZLE_IDENTITY = 0, + VK_COMPONENT_SWIZZLE_ZERO = 1, + VK_COMPONENT_SWIZZLE_ONE = 2, + VK_COMPONENT_SWIZZLE_R = 3, + VK_COMPONENT_SWIZZLE_G = 4, + VK_COMPONENT_SWIZZLE_B = 5, + VK_COMPONENT_SWIZZLE_A = 6, + VK_COMPONENT_SWIZZLE_MAX_ENUM = $7FFFFFFF + ); + PVkComponentSwizzle = ^TVkComponentSwizzle; + PPVkComponentSwizzle = ^PVkComponentSwizzle; + + TVkShaderStageFlagBits = ( + VK_SHADER_STAGE_VERTEX_BIT = (1 shl 0), + VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = (1 shl 1), + VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = (1 shl 2), + VK_SHADER_STAGE_GEOMETRY_BIT = (1 shl 3), + VK_SHADER_STAGE_FRAGMENT_BIT = (1 shl 4), + VK_SHADER_STAGE_COMPUTE_BIT = (1 shl 5), + VK_SHADER_STAGE_ALL_GRAPHICS = $1F, + VK_SHADER_STAGE_ALL = $7FFFFFFF + ); + PVkShaderStageFlagBits = ^TVkShaderStageFlagBits; + PPVkShaderStageFlagBits = ^PVkShaderStageFlagBits; + + TVkVertexInputRate = ( + VK_VERTEX_INPUT_RATE_VERTEX = 0, + VK_VERTEX_INPUT_RATE_INSTANCE = 1, + VK_VERTEX_INPUT_RATE_MAX_ENUM = $7FFFFFFF + ); + PVkVertexInputRate = ^TVkVertexInputRate; + PPVkVertexInputRate = ^PVkVertexInputRate; + + TVkPrimitiveTopology = ( + VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0, + VK_PRIMITIVE_TOPOLOGY_LINE_LIST = 1, + VK_PRIMITIVE_TOPOLOGY_LINE_STRIP = 2, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST = 3, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = 4, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN = 5, + VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY = 6, + VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY = 7, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY = 8, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY = 9, + VK_PRIMITIVE_TOPOLOGY_PATCH_LIST = 10, + VK_PRIMITIVE_TOPOLOGY_MAX_ENUM = $7FFFFFFF + ); + PVkPrimitiveTopology = ^TVkPrimitiveTopology; + PPVkPrimitiveTopology = ^PVkPrimitiveTopology; + + TVkPolygonMode = ( + VK_POLYGON_MODE_FILL = 0, + VK_POLYGON_MODE_LINE = 1, + VK_POLYGON_MODE_POINT = 2, + VK_POLYGON_MODE_MAX_ENUM = $7FFFFFFF + ); + PVkPolygonMode = ^TVkPolygonMode; + PPVkPolygonMode = ^PVkPolygonMode; + + TVkFrontFace = ( + VK_FRONT_FACE_COUNTER_CLOCKWISE = 0, + VK_FRONT_FACE_CLOCKWISE = 1, + VK_FRONT_FACE_MAX_ENUM = $7FFFFFFF + ); + PVkFrontFace = ^TVkFrontFace; + PPVkFrontFace = ^PVkFrontFace; + + TVkCompareOp = ( + VK_COMPARE_OP_NEVER = 0, + VK_COMPARE_OP_LESS = 1, + VK_COMPARE_OP_EQUAL = 2, + VK_COMPARE_OP_LESS_OR_EQUAL = 3, + VK_COMPARE_OP_GREATER = 4, + VK_COMPARE_OP_NOT_EQUAL = 5, + VK_COMPARE_OP_GREATER_OR_EQUAL = 6, + VK_COMPARE_OP_ALWAYS = 7, + VK_COMPARE_OP_MAX_ENUM = $7FFFFFFF + ); + PVkCompareOp = ^TVkCompareOp; + PPVkCompareOp = ^PVkCompareOp; + + TVkStencilOp = ( + VK_STENCIL_OP_KEEP = 0, + VK_STENCIL_OP_ZERO = 1, + VK_STENCIL_OP_REPLACE = 2, + VK_STENCIL_OP_INCREMENT_AND_CLAMP = 3, + VK_STENCIL_OP_DECREMENT_AND_CLAMP = 4, + VK_STENCIL_OP_INVERT = 5, + VK_STENCIL_OP_INCREMENT_AND_WRAP = 6, + VK_STENCIL_OP_DECREMENT_AND_WRAP = 7, + VK_STENCIL_OP_MAX_ENUM = $7FFFFFFF + ); + PVkStencilOp = ^TVkStencilOp; + PPVkStencilOp = ^PVkStencilOp; + + TVkLogicOp = ( + VK_LOGIC_OP_CLEAR = 0, + VK_LOGIC_OP_AND = 1, + VK_LOGIC_OP_AND_REVERSE = 2, + VK_LOGIC_OP_COPY = 3, + VK_LOGIC_OP_AND_INVERTED = 4, + VK_LOGIC_OP_NO_OP = 5, + VK_LOGIC_OP_XOR = 6, + VK_LOGIC_OP_OR = 7, + VK_LOGIC_OP_NOR = 8, + VK_LOGIC_OP_EQUIVALENT = 9, + VK_LOGIC_OP_INVERT = 10, + VK_LOGIC_OP_OR_REVERSE = 11, + VK_LOGIC_OP_COPY_INVERTED = 12, + VK_LOGIC_OP_OR_INVERTED = 13, + VK_LOGIC_OP_NAND = 14, + VK_LOGIC_OP_SET = 15, + VK_LOGIC_OP_MAX_ENUM = $7FFFFFFF + ); + PVkLogicOp = ^TVkLogicOp; + PPVkLogicOp = ^PVkLogicOp; + + TVkBlendFactor = ( + VK_BLEND_FACTOR_ZERO = 0, + VK_BLEND_FACTOR_ONE = 1, + VK_BLEND_FACTOR_SRC_COLOR = 2, + VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR = 3, + VK_BLEND_FACTOR_DST_COLOR = 4, + VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR = 5, + VK_BLEND_FACTOR_SRC_ALPHA = 6, + VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA = 7, + VK_BLEND_FACTOR_DST_ALPHA = 8, + VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA = 9, + VK_BLEND_FACTOR_CONSTANT_COLOR = 10, + VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR = 11, + VK_BLEND_FACTOR_CONSTANT_ALPHA = 12, + VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA = 13, + VK_BLEND_FACTOR_SRC_ALPHA_SATURATE = 14, + VK_BLEND_FACTOR_SRC1_COLOR = 15, + VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR = 16, + VK_BLEND_FACTOR_SRC1_ALPHA = 17, + VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA = 18, + VK_BLEND_FACTOR_MAX_ENUM = $7FFFFFFF + ); + PVkBlendFactor = ^TVkBlendFactor; + PPVkBlendFactor = ^PVkBlendFactor; + + TVkBlendOp = ( + VK_BLEND_OP_ADD = 0, + VK_BLEND_OP_SUBTRACT = 1, + VK_BLEND_OP_REVERSE_SUBTRACT = 2, + VK_BLEND_OP_MIN = 3, + VK_BLEND_OP_MAX = 4, + VK_BLEND_OP_MAX_ENUM = $7FFFFFFF + ); + PVkBlendOp = ^TVkBlendOp; + PPVkBlendOp = ^PVkBlendOp; + + TVkDynamicState = ( + VK_DYNAMIC_STATE_VIEWPORT = 0, + VK_DYNAMIC_STATE_SCISSOR = 1, + VK_DYNAMIC_STATE_LINE_WIDTH = 2, + VK_DYNAMIC_STATE_DEPTH_BIAS = 3, + VK_DYNAMIC_STATE_BLEND_CONSTANTS = 4, + VK_DYNAMIC_STATE_DEPTH_BOUNDS = 5, + VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 6, + VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 7, + VK_DYNAMIC_STATE_STENCIL_REFERENCE = 8, + VK_DYNAMIC_STATE_MAX_ENUM = $7FFFFFFF ); - PVkImageLayout = ^TVkImageLayout; + PVkDynamicState = ^TVkDynamicState; + PPVkDynamicState = ^PVkDynamicState; - TVkImageTiling = ( - VK_IMAGE_TILING_OPTIMAL = 0, - VK_IMAGE_TILING_LINEAR = 1 + TVkFilter = ( + VK_FILTER_NEAREST = 0, + VK_FILTER_LINEAR = 1, + VK_FILTER_MAX_ENUM = $7FFFFFFF ); - PVkImageTiling = ^TVkImageTiling; + PVkFilter = ^TVkFilter; + PPVkFilter = ^PVkFilter; - TVkImageType = ( - VK_IMAGE_TYPE_1D = 0, - VK_IMAGE_TYPE_2D = 1, - VK_IMAGE_TYPE_3D = 2 + TVkSamplerMipmapMode = ( + VK_SAMPLER_MIPMAP_MODE_NEAREST = 0, + VK_SAMPLER_MIPMAP_MODE_LINEAR = 1, + VK_SAMPLER_MIPMAP_MODE_MAX_ENUM = $7FFFFFFF ); - PVkImageType = ^TVkImageType; + PVkSamplerMipmapMode = ^TVkSamplerMipmapMode; + PPVkSamplerMipmapMode = ^PVkSamplerMipmapMode; - TVkImageViewType = ( - VK_IMAGE_VIEW_TYPE_1D = 0, - VK_IMAGE_VIEW_TYPE_2D = 1, - VK_IMAGE_VIEW_TYPE_3D = 2, - VK_IMAGE_VIEW_TYPE_CUBE = 3, - VK_IMAGE_VIEW_TYPE_1D_ARRAY = 4, - VK_IMAGE_VIEW_TYPE_2D_ARRAY = 5, - VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 6 + TVkSamplerAddressMode = ( + VK_SAMPLER_ADDRESS_MODE_REPEAT = 0, + VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT = 1, + VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = 2, + VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3, + VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 4, + VK_SAMPLER_ADDRESS_MODE_MAX_ENUM = $7FFFFFFF ); - PVkImageViewType = ^TVkImageViewType; + PVkSamplerAddressMode = ^TVkSamplerAddressMode; + PPVkSamplerAddressMode = ^PVkSamplerAddressMode; - TVkIndexType = ( - VK_INDEX_TYPE_UINT16 = 0, - VK_INDEX_TYPE_UINT32 = 1 + TVkBorderColor = ( + VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0, + VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = 1, + VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 2, + VK_BORDER_COLOR_INT_OPAQUE_BLACK = 3, + VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 4, + VK_BORDER_COLOR_INT_OPAQUE_WHITE = 5, + VK_BORDER_COLOR_MAX_ENUM = $7FFFFFFF ); - PVkIndexType = ^TVkIndexType; + PVkBorderColor = ^TVkBorderColor; + PPVkBorderColor = ^PVkBorderColor; - TVkInternalAllocationType = ( - VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE = 0 + TVkDescriptorType = ( + VK_DESCRIPTOR_TYPE_SAMPLER = 0, + VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 1, + VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 2, + VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = 3, + VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 4, + VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 5, + VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 6, + VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 7, + VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 8, + VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 9, + VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 10, + VK_DESCRIPTOR_TYPE_MAX_ENUM = $7FFFFFFF ); - PVkInternalAllocationType = ^TVkInternalAllocationType; + PVkDescriptorType = ^TVkDescriptorType; + PPVkDescriptorType = ^PVkDescriptorType; - TVkLogicOp = ( - VK_LOGIC_OP_CLEAR = 0, - VK_LOGIC_OP_AND = 1, - VK_LOGIC_OP_AND_REVERSE = 2, - VK_LOGIC_OP_COPY = 3, - VK_LOGIC_OP_AND_INVERTED = 4, - VK_LOGIC_OP_NO_OP = 5, - VK_LOGIC_OP_XOR = 6, - VK_LOGIC_OP_OR = 7, - VK_LOGIC_OP_NOR = 8, - VK_LOGIC_OP_EQUIVALENT = 9, - VK_LOGIC_OP_INVERT = 10, - VK_LOGIC_OP_OR_REVERSE = 11, - VK_LOGIC_OP_COPY_INVERTED = 12, - VK_LOGIC_OP_OR_INVERTED = 13, - VK_LOGIC_OP_NAND = 14, - VK_LOGIC_OP_SET = 15 + TVkAttachmentLoadOp = ( + VK_ATTACHMENT_LOAD_OP_LOAD = 0, + VK_ATTACHMENT_LOAD_OP_CLEAR = 1, + VK_ATTACHMENT_LOAD_OP_DONT_CARE = 2, + VK_ATTACHMENT_LOAD_OP_MAX_ENUM = $7FFFFFFF ); - PVkLogicOp = ^TVkLogicOp; + PVkAttachmentLoadOp = ^TVkAttachmentLoadOp; + PPVkAttachmentLoadOp = ^PVkAttachmentLoadOp; - TVkPhysicalDeviceType = ( - VK_PHYSICAL_DEVICE_TYPE_OTHER = 0, - VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 1, - VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 2, - VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 3, - VK_PHYSICAL_DEVICE_TYPE_CPU = 4 + TVkAttachmentStoreOp = ( + VK_ATTACHMENT_STORE_OP_STORE = 0, + VK_ATTACHMENT_STORE_OP_DONT_CARE = 1, + VK_ATTACHMENT_STORE_OP_MAX_ENUM = $7FFFFFFF ); - PVkPhysicalDeviceType = ^TVkPhysicalDeviceType; + PVkAttachmentStoreOp = ^TVkAttachmentStoreOp; + PPVkAttachmentStoreOp = ^PVkAttachmentStoreOp; TVkPipelineBindPoint = ( VK_PIPELINE_BIND_POINT_GRAPHICS = 0, - VK_PIPELINE_BIND_POINT_COMPUTE = 1 + VK_PIPELINE_BIND_POINT_COMPUTE = 1, + VK_PIPELINE_BIND_POINT_MAX_ENUM = $7FFFFFFF ); PVkPipelineBindPoint = ^TVkPipelineBindPoint; + PPVkPipelineBindPoint = ^PVkPipelineBindPoint; - TVkPipelineCacheHeaderVersion = ( - VK_PIPELINE_CACHE_HEADER_VERSION_ONE = 1 + TVkCommandBufferLevel = ( + VK_COMMAND_BUFFER_LEVEL_PRIMARY = 0, + VK_COMMAND_BUFFER_LEVEL_SECONDARY = 1, + VK_COMMAND_BUFFER_LEVEL_MAX_ENUM = $7FFFFFFF ); - PVkPipelineCacheHeaderVersion = ^TVkPipelineCacheHeaderVersion; + PVkCommandBufferLevel = ^TVkCommandBufferLevel; + PPVkCommandBufferLevel = ^PVkCommandBufferLevel; + + TVkIndexType = ( + VK_INDEX_TYPE_UINT16 = 0, + VK_INDEX_TYPE_UINT32 = 1, + VK_INDEX_TYPE_MAX_ENUM = $7FFFFFFF + ); + PVkIndexType = ^TVkIndexType; + PPVkIndexType = ^PVkIndexType; TVkPipelineStageFlagBits = ( VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = (1 shl 0), @@ -832,264 +1310,479 @@ type { enums } VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = (1 shl 16) ); PVkPipelineStageFlagBits = ^TVkPipelineStageFlagBits; + PPVkPipelineStageFlagBits = ^PVkPipelineStageFlagBits; - TVkPolygonMode = ( - VK_POLYGON_MODE_FILL = 0, - VK_POLYGON_MODE_LINE = 1, - VK_POLYGON_MODE_POINT = 2 - ); - PVkPolygonMode = ^TVkPolygonMode; - - TVkPrimitiveTopology = ( - VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0, - VK_PRIMITIVE_TOPOLOGY_LINE_LIST = 1, - VK_PRIMITIVE_TOPOLOGY_LINE_STRIP = 2, - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST = 3, - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = 4, - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN = 5, - VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY = 6, - VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY = 7, - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY = 8, - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY = 9, - VK_PRIMITIVE_TOPOLOGY_PATCH_LIST = 10 - ); - PVkPrimitiveTopology = ^TVkPrimitiveTopology; - - TVkQueryType = ( - VK_QUERY_TYPE_OCCLUSION = 0, - VK_QUERY_TYPE_PIPELINE_STATISTICS = 1, - VK_QUERY_TYPE_TIMESTAMP = 2 - ); - PVkQueryType = ^TVkQueryType; - - TVkResult = ( - VK_SUCCESS = 0, - VK_NOT_READY = 1, - VK_TIMEOUT = 2, - VK_EVENT_SET = 3, - VK_EVENT_RESET = 4, - VK_INCOMPLETE = 5, - VK_ERROR_OUT_OF_HOST_MEMORY = -1, - VK_ERROR_OUT_OF_DEVICE_MEMORY = -2, - VK_ERROR_INITIALIZATION_FAILED = -3, - VK_ERROR_DEVICE_LOST = -4, - VK_ERROR_MEMORY_MAP_FAILED = -5, - VK_ERROR_LAYER_NOT_PRESENT = -6, - VK_ERROR_EXTENSION_NOT_PRESENT = -7, - VK_ERROR_FEATURE_NOT_PRESENT = -8, - VK_ERROR_INCOMPATIBLE_DRIVER = -9, - VK_ERROR_TOO_MANY_OBJECTS = -10, - VK_ERROR_FORMAT_NOT_SUPPORTED = -11 - ); - PVkResult = ^TVkResult; - - TVkSampleCountFlagBits = ( - VK_SAMPLE_COUNT_1_BIT = (1 shl 0), - VK_SAMPLE_COUNT_2_BIT = (1 shl 1), - VK_SAMPLE_COUNT_4_BIT = (1 shl 2), - VK_SAMPLE_COUNT_8_BIT = (1 shl 3), - VK_SAMPLE_COUNT_16_BIT = (1 shl 4), - VK_SAMPLE_COUNT_32_BIT = (1 shl 5), - VK_SAMPLE_COUNT_64_BIT = (1 shl 6) - ); - PVkSampleCountFlagBits = ^TVkSampleCountFlagBits; - - TVkSamplerAddressMode = ( - VK_SAMPLER_ADDRESS_MODE_REPEAT = 0, - VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT = 1, - VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = 2, - VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3, - VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 4 - ); - PVkSamplerAddressMode = ^TVkSamplerAddressMode; - - TVkSamplerMipmapMode = ( - VK_SAMPLER_MIPMAP_MODE_NEAREST = 0, - VK_SAMPLER_MIPMAP_MODE_LINEAR = 1 + TVkSubpassContents = ( + VK_SUBPASS_CONTENTS_INLINE = 0, + VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 1, + VK_SUBPASS_CONTENTS_MAX_ENUM = $7FFFFFFF ); - PVkSamplerMipmapMode = ^TVkSamplerMipmapMode; - - TVkShaderStageFlagBits = ( - VK_SHADER_STAGE_VERTEX_BIT = (1 shl 0), - VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = (1 shl 1), - VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = (1 shl 2), - VK_SHADER_STAGE_GEOMETRY_BIT = (1 shl 3), - VK_SHADER_STAGE_FRAGMENT_BIT = (1 shl 4), - VK_SHADER_STAGE_COMPUTE_BIT = (1 shl 5), - VK_SHADER_STAGE_ALL_GRAPHICS = $1F, - VK_SHADER_STAGE_ALL = $7FFFFFFF + PVkSubpassContents = ^TVkSubpassContents; + PPVkSubpassContents = ^PVkSubpassContents; + +{ ========================================== VK_KHR_surface ========================================== } + TVkSurfaceTransformFlagBitsKHR = ( + VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR = (1 shl 0), + VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR = (1 shl 1), + VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR = (1 shl 2), + VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR = (1 shl 3), + VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR = (1 shl 4), + VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR = (1 shl 5), + VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR = (1 shl 6), + VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR = (1 shl 7), + VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = (1 shl 8) ); - PVkShaderStageFlagBits = ^TVkShaderStageFlagBits; + PVkSurfaceTransformFlagBitsKHR = ^TVkSurfaceTransformFlagBitsKHR; + PPVkSurfaceTransformFlagBitsKHR = ^PVkSurfaceTransformFlagBitsKHR; - TVkSharingMode = ( - VK_SHARING_MODE_EXCLUSIVE = 0, - VK_SHARING_MODE_CONCURRENT = 1 + TVkColorSpaceKHR = ( + VK_COLORSPACE_SRGB_NONLINEAR_KHR = 0, + VK_COLORSPACE_MAX_ENUM = $7FFFFFFF ); - PVkSharingMode = ^TVkSharingMode; - - TVkStencilOp = ( - VK_STENCIL_OP_KEEP = 0, - VK_STENCIL_OP_ZERO = 1, - VK_STENCIL_OP_REPLACE = 2, - VK_STENCIL_OP_INCREMENT_AND_CLAMP = 3, - VK_STENCIL_OP_DECREMENT_AND_CLAMP = 4, - VK_STENCIL_OP_INVERT = 5, - VK_STENCIL_OP_INCREMENT_AND_WRAP = 6, - VK_STENCIL_OP_DECREMENT_AND_WRAP = 7 + PVkColorSpaceKHR = ^TVkColorSpaceKHR; + PPVkColorSpaceKHR = ^PVkColorSpaceKHR; + + TVkPresentModeKHR = ( + VK_PRESENT_MODE_IMMEDIATE_KHR = 0, + VK_PRESENT_MODE_MAILBOX_KHR = 1, + VK_PRESENT_MODE_FIFO_KHR = 2, + VK_PRESENT_MODE_FIFO_RELAXED_KHR = 3, + VK_PRESENT_MODE_MAX_ENUM = $7FFFFFFF ); - PVkStencilOp = ^TVkStencilOp; - - TVkStructureType = ( - VK_STRUCTURE_TYPE_APPLICATION_INFO = 0, - VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 1, - VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 2, - VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 3, - VK_STRUCTURE_TYPE_SUBMIT_INFO = 4, - VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO = 5, - VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 6, - VK_STRUCTURE_TYPE_BIND_SPARSE_INFO = 7, - VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 8, - VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 9, - VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 10, - VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 11, - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 12, - VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 13, - VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 14, - VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 15, - VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 16, - VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 17, - VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 18, - VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 19, - VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 20, - VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 21, - VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 22, - VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO = 23, - VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 24, - VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 25, - VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 26, - VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 27, - VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 28, - VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 29, - VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 30, - VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 31, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 32, - VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 33, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO = 34, - VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 35, - VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 36, - VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 37, - VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 38, - VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO = 39, - VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO = 40, - VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO = 41, - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO = 42, - VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 43, - VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 44, - VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 45, - VK_STRUCTURE_TYPE_MEMORY_BARRIER = 46, - VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO = 47, - VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO = 48 + PVkPresentModeKHR = ^TVkPresentModeKHR; + PPVkPresentModeKHR = ^PVkPresentModeKHR; + +{ ========================================= VK_KHR_swapchain ========================================= } + TVkCompositeAlphaFlagBitsKHR = ( + VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = (1 shl 0), + VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = (1 shl 1), + VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = (1 shl 2), + VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = (1 shl 3) ); - PVkStructureType = ^TVkStructureType; - - TVkSubpassContents = ( - VK_SUBPASS_CONTENTS_INLINE = 0, - VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 1 + PVkCompositeAlphaFlagBitsKHR = ^TVkCompositeAlphaFlagBitsKHR; + PPVkCompositeAlphaFlagBitsKHR = ^PVkCompositeAlphaFlagBitsKHR; + +{ ========================================== VK_KHR_display ========================================== } + TVkDisplayPlaneAlphaFlagBitsKHR = ( + VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR = (1 shl 0), + VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = (1 shl 1), + VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = (1 shl 2), + VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = (1 shl 3) ); - PVkSubpassContents = ^TVkSubpassContents; - - TVkSystemAllocationScope = ( - VK_SYSTEM_ALLOCATION_SCOPE_COMMAND = 0, - VK_SYSTEM_ALLOCATION_SCOPE_OBJECT = 1, - VK_SYSTEM_ALLOCATION_SCOPE_CACHE = 2, - VK_SYSTEM_ALLOCATION_SCOPE_DEVICE = 3, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE = 4 + PVkDisplayPlaneAlphaFlagBitsKHR = ^TVkDisplayPlaneAlphaFlagBitsKHR; + PPVkDisplayPlaneAlphaFlagBitsKHR = ^PVkDisplayPlaneAlphaFlagBitsKHR; + +{ ======================================= VK_EXT_debug_report ======================================== } + TVkDebugReportObjectTypeEXT = ( + VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT = 0, + VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT = 1, + VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT = 2, + VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT = 3, + VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT = 4, + VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT = 5, + VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT = 6, + VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT = 7, + VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT = 8, + VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT = 9, + VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT = 10, + VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT = 11, + VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT = 12, + VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT = 13, + VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT = 14, + VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT = 15, + VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT = 16, + VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT = 17, + VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT = 18, + VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT = 19, + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT = 20, + VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT = 21, + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT = 22, + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT = 23, + VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT = 24, + VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT = 25, + VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT = 26, + VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT = 27, + VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT = 28 ); - PVkSystemAllocationScope = ^TVkSystemAllocationScope; + PVkDebugReportObjectTypeEXT = ^TVkDebugReportObjectTypeEXT; + PPVkDebugReportObjectTypeEXT = ^PVkDebugReportObjectTypeEXT; - TVkVertexInputRate = ( - VK_VERTEX_INPUT_RATE_VERTEX = 0, - VK_VERTEX_INPUT_RATE_INSTANCE = 1 + TVkDebugReportErrorEXT = ( + VK_DEBUG_REPORT_ERROR_NONE_EXT = 0, + VK_DEBUG_REPORT_ERROR_CALLBACK_REF_EXT = 1 ); - PVkVertexInputRate = ^TVkVertexInputRate; + PVkDebugReportErrorEXT = ^TVkDebugReportErrorEXT; + PPVkDebugReportErrorEXT = ^PVkDebugReportErrorEXT; + +type { function pointers } + +{ ========================================== VK_VERSION_1_0 ========================================== } + TvkAllocationFunction = function ( + pUserData: PVkVoid; + size: VkSize; + alignment: VkSize; + allocationScope: TVkSystemAllocationScope + ): PVkVoid; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkReallocationFunction = function ( + pUserData: PVkVoid; + pOriginal: PVkVoid; + size: VkSize; + alignment: VkSize; + allocationScope: TVkSystemAllocationScope + ): PVkVoid; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkFreeFunction = procedure( + pUserData: PVkVoid; + pMemory: PVkVoid + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkInternalAllocationNotification = procedure( + pUserData: PVkVoid; + size: VkSize; + allocationType: TVkInternalAllocationType; + allocationScope: TVkSystemAllocationScope + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkInternalFreeNotification = procedure( + pUserData: PVkVoid; + size: VkSize; + allocationType: TVkInternalAllocationType; + allocationScope: TVkSystemAllocationScope + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkVoidFunction = procedure( + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + +{ ======================================= VK_EXT_debug_report ======================================== } + TvkDebugReportCallbackEXT = function ( + flags: VkDebugReportFlagsEXT; + objectType: TVkDebugReportObjectTypeEXT; + uObject: VkUint64; + location: VkSize; + messageCode: VkInt32; + pLayerPrefix: PVkChar; + pMessage: PVkChar; + pUserData: PVkVoid + ): VkBool32; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + +type { structures } + +{ ========================================== VK_VERSION_1_0 ========================================== } + TVkApplicationInfo = record + sType: TVkStructureType; + pNext: PVkVoid; + pApplicationName: PVkChar; + applicationVersion: VkUint32; + pEngineName: PVkChar; + engineVersion: VkUint32; + apiVersion: VkUint32; + end; + PVkApplicationInfo = ^TVkApplicationInfo; + PPVkApplicationInfo = ^PVkApplicationInfo; -type { funcptrs } - TvkVoidFunction = procedure(); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkFreeFunction = procedure(pUserData: PVkVoid; pMemory: PVkVoid); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkAllocationFunction = function (pUserData: PVkVoid; size: VkSize; alignment: VkSize; allocationScope: TVkSystemAllocationScope): PVkVoid; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkInternalAllocationNotification = procedure(pUserData: PVkVoid; size: VkSize; allocationType: TVkInternalAllocationType; allocationScope: TVkSystemAllocationScope); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkInternalFreeNotification = procedure(pUserData: PVkVoid; size: VkSize; allocationType: TVkInternalAllocationType; allocationScope: TVkSystemAllocationScope); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkReallocationFunction = function (pUserData: PVkVoid; pOriginal: PVkVoid; size: VkSize; alignment: VkSize; allocationScope: TVkSystemAllocationScope): PVkVoid; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + TVkInstanceCreateInfo = record + sType: TVkStructureType; + pNext: PVkVoid; + flags: VkInstanceCreateFlags; + pApplicationInfo: PVkApplicationInfo; + enabledLayerCount: VkUint32; + ppEnabledLayerNames: PPVkChar; + enabledExtensionCount: VkUint32; + ppEnabledExtensionNames: PPVkChar; + end; + PVkInstanceCreateInfo = ^TVkInstanceCreateInfo; + PPVkInstanceCreateInfo = ^PVkInstanceCreateInfo; -type { structs } - TVkViewport = record - x: VkFloat; - y: VkFloat; - width: VkFloat; - height: VkFloat; - minDepth: VkFloat; - maxDepth: VkFloat; + TVkAllocationCallbacks = record + pUserData: PVkVoid; + pfnAllocation: TvkAllocationFunction; + pfnReallocation: TvkReallocationFunction; + pfnFree: TvkFreeFunction; + pfnInternalAllocation: TvkInternalAllocationNotification; + pfnInternalFree: TvkInternalFreeNotification; end; - PVkViewport = ^TVkViewport; - PPVkViewport = ^PVkViewport; + PVkAllocationCallbacks = ^TVkAllocationCallbacks; + PPVkAllocationCallbacks = ^PVkAllocationCallbacks; - TVkOffset2D = record - x: VkInt32; - y: VkInt32; + TVkPhysicalDeviceFeatures = record + robustBufferAccess: VkBool32; + fullDrawIndexUint32: VkBool32; + imageCubeArray: VkBool32; + independentBlend: VkBool32; + geometryShader: VkBool32; + tessellationShader: VkBool32; + sampleRateShading: VkBool32; + dualSrcBlend: VkBool32; + logicOp: VkBool32; + multiDrawIndirect: VkBool32; + drawIndirectFirstInstance: VkBool32; + depthClamp: VkBool32; + depthBiasClamp: VkBool32; + fillModeNonSolid: VkBool32; + depthBounds: VkBool32; + wideLines: VkBool32; + largePoints: VkBool32; + alphaToOne: VkBool32; + multiViewport: VkBool32; + samplerAnisotropy: VkBool32; + textureCompressionETC2: VkBool32; + textureCompressionASTC_LDR: VkBool32; + textureCompressionBC: VkBool32; + occlusionQueryPrecise: VkBool32; + pipelineStatisticsQuery: VkBool32; + vertexPipelineStoresAndAtomics: VkBool32; + fragmentStoresAndAtomics: VkBool32; + shaderTessellationAndGeometryPointSize: VkBool32; + shaderImageGatherExtended: VkBool32; + shaderStorageImageExtendedFormats: VkBool32; + shaderStorageImageMultisample: VkBool32; + shaderStorageImageReadWithoutFormat: VkBool32; + shaderStorageImageWriteWithoutFormat: VkBool32; + shaderUniformBufferArrayDynamicIndexing: VkBool32; + shaderSampledImageArrayDynamicIndexing: VkBool32; + shaderStorageBufferArrayDynamicIndexing: VkBool32; + shaderStorageImageArrayDynamicIndexing: VkBool32; + shaderClipDistance: VkBool32; + shaderCullDistance: VkBool32; + shaderFloat64: VkBool32; + shaderInt64: VkBool32; + shaderInt16: VkBool32; + shaderResourceResidency: VkBool32; + shaderResourceMinLod: VkBool32; + sparseBinding: VkBool32; + sparseResidencyBuffer: VkBool32; + sparseResidencyImage2D: VkBool32; + sparseResidencyImage3D: VkBool32; + sparseResidency2Samples: VkBool32; + sparseResidency4Samples: VkBool32; + sparseResidency8Samples: VkBool32; + sparseResidency16Samples: VkBool32; + sparseResidencyAliased: VkBool32; + variableMultisampleRate: VkBool32; + inheritedQueries: VkBool32; + end; + PVkPhysicalDeviceFeatures = ^TVkPhysicalDeviceFeatures; + PPVkPhysicalDeviceFeatures = ^PVkPhysicalDeviceFeatures; + + TVkFormatProperties = record + linearTilingFeatures: VkFormatFeatureFlags; + optimalTilingFeatures: VkFormatFeatureFlags; + bufferFeatures: VkFormatFeatureFlags; + end; + PVkFormatProperties = ^TVkFormatProperties; + PPVkFormatProperties = ^PVkFormatProperties; + + TVkExtent3D = record + width: VkUint32; + height: VkUint32; + depth: VkUint32; + end; + PVkExtent3D = ^TVkExtent3D; + PPVkExtent3D = ^PVkExtent3D; + + TVkImageFormatProperties = record + maxExtent: TVkExtent3D; + maxMipLevels: VkUint32; + maxArrayLayers: VkUint32; + sampleCounts: VkSampleCountFlags; + maxResourceSize: VkDeviceSize; + end; + PVkImageFormatProperties = ^TVkImageFormatProperties; + PPVkImageFormatProperties = ^PVkImageFormatProperties; + + TVkPhysicalDeviceLimits = record + maxImageDimension1D: VkUint32; + maxImageDimension2D: VkUint32; + maxImageDimension3D: VkUint32; + maxImageDimensionCube: VkUint32; + maxImageArrayLayers: VkUint32; + maxTexelBufferElements: VkUint32; + maxUniformBufferRange: VkUint32; + maxStorageBufferRange: VkUint32; + maxPushConstantsSize: VkUint32; + maxMemoryAllocationCount: VkUint32; + maxSamplerAllocationCount: VkUint32; + bufferImageGranularity: VkDeviceSize; + sparseAddressSpaceSize: VkDeviceSize; + maxBoundDescriptorSets: VkUint32; + maxPerStageDescriptorSamplers: VkUint32; + maxPerStageDescriptorUniformBuffers: VkUint32; + maxPerStageDescriptorStorageBuffers: VkUint32; + maxPerStageDescriptorSampledImages: VkUint32; + maxPerStageDescriptorStorageImages: VkUint32; + maxPerStageDescriptorInputAttachments: VkUint32; + maxPerStageResources: VkUint32; + maxDescriptorSetSamplers: VkUint32; + maxDescriptorSetUniformBuffers: VkUint32; + maxDescriptorSetUniformBuffersDynamic: VkUint32; + maxDescriptorSetStorageBuffers: VkUint32; + maxDescriptorSetStorageBuffersDynamic: VkUint32; + maxDescriptorSetSampledImages: VkUint32; + maxDescriptorSetStorageImages: VkUint32; + maxDescriptorSetInputAttachments: VkUint32; + maxVertexInputAttributes: VkUint32; + maxVertexInputBindings: VkUint32; + maxVertexInputAttributeOffset: VkUint32; + maxVertexInputBindingStride: VkUint32; + maxVertexOutputComponents: VkUint32; + maxTessellationGenerationLevel: VkUint32; + maxTessellationPatchSize: VkUint32; + maxTessellationControlPerVertexInputComponents: VkUint32; + maxTessellationControlPerVertexOutputComponents: VkUint32; + maxTessellationControlPerPatchOutputComponents: VkUint32; + maxTessellationControlTotalOutputComponents: VkUint32; + maxTessellationEvaluationInputComponents: VkUint32; + maxTessellationEvaluationOutputComponents: VkUint32; + maxGeometryShaderInvocations: VkUint32; + maxGeometryInputComponents: VkUint32; + maxGeometryOutputComponents: VkUint32; + maxGeometryOutputVertices: VkUint32; + maxGeometryTotalOutputComponents: VkUint32; + maxFragmentInputComponents: VkUint32; + maxFragmentOutputAttachments: VkUint32; + maxFragmentDualSrcAttachments: VkUint32; + maxFragmentCombinedOutputResources: VkUint32; + maxComputeSharedMemorySize: VkUint32; + maxComputeWorkGroupCount: array[0..3] of VkUint32; + maxComputeWorkGroupInvocations: VkUint32; + maxComputeWorkGroupSize: array[0..3] of VkUint32; + subPixelPrecisionBits: VkUint32; + subTexelPrecisionBits: VkUint32; + mipmapPrecisionBits: VkUint32; + maxDrawIndexedIndexValue: VkUint32; + maxDrawIndirectCount: VkUint32; + maxSamplerLodBias: VkFloat; + maxSamplerAnisotropy: VkFloat; + maxViewports: VkUint32; + maxViewportDimensions: array[0..2] of VkUint32; + viewportBoundsRange: array[0..2] of VkFloat; + viewportSubPixelBits: VkUint32; + minMemoryMapAlignment: VkSize; + minTexelBufferOffsetAlignment: VkDeviceSize; + minUniformBufferOffsetAlignment: VkDeviceSize; + minStorageBufferOffsetAlignment: VkDeviceSize; + minTexelOffset: VkInt32; + maxTexelOffset: VkUint32; + minTexelGatherOffset: VkInt32; + maxTexelGatherOffset: VkUint32; + minInterpolationOffset: VkFloat; + maxInterpolationOffset: VkFloat; + subPixelInterpolationOffsetBits: VkUint32; + maxFramebufferWidth: VkUint32; + maxFramebufferHeight: VkUint32; + maxFramebufferLayers: VkUint32; + framebufferColorSampleCounts: VkSampleCountFlags; + framebufferDepthSampleCounts: VkSampleCountFlags; + framebufferStencilSampleCounts: VkSampleCountFlags; + framebufferNoAttachmentsSampleCounts: VkSampleCountFlags; + maxColorAttachments: VkUint32; + sampledImageColorSampleCounts: VkSampleCountFlags; + sampledImageIntegerSampleCounts: VkSampleCountFlags; + sampledImageDepthSampleCounts: VkSampleCountFlags; + sampledImageStencilSampleCounts: VkSampleCountFlags; + storageImageSampleCounts: VkSampleCountFlags; + maxSampleMaskWords: VkUint32; + timestampComputeAndGraphics: VkBool32; + timestampPeriod: VkFloat; + maxClipDistances: VkUint32; + maxCullDistances: VkUint32; + maxCombinedClipAndCullDistances: VkUint32; + discreteQueuePriorities: VkUint32; + pointSizeRange: array[0..2] of VkFloat; + lineWidthRange: array[0..2] of VkFloat; + pointSizeGranularity: VkFloat; + lineWidthGranularity: VkFloat; + strictLines: VkBool32; + standardSampleLocations: VkBool32; + optimalBufferCopyOffsetAlignment: VkDeviceSize; + optimalBufferCopyRowPitchAlignment: VkDeviceSize; + nonCoherentAtomSize: VkDeviceSize; + end; + PVkPhysicalDeviceLimits = ^TVkPhysicalDeviceLimits; + PPVkPhysicalDeviceLimits = ^PVkPhysicalDeviceLimits; + + TVkPhysicalDeviceSparseProperties = record + residencyStandard2DBlockShape: VkBool32; + residencyStandard2DMultisampleBlockShape: VkBool32; + residencyStandard3DBlockShape: VkBool32; + residencyAlignedMipSize: VkBool32; + residencyNonResidentStrict: VkBool32; + end; + PVkPhysicalDeviceSparseProperties = ^TVkPhysicalDeviceSparseProperties; + PPVkPhysicalDeviceSparseProperties = ^PVkPhysicalDeviceSparseProperties; + + TVkPhysicalDeviceProperties = record + apiVersion: VkUint32; + driverVersion: VkUint32; + vendorID: VkUint32; + deviceID: VkUint32; + deviceType: TVkPhysicalDeviceType; + deviceName: array[0..VK_MAX_PHYSICAL_DEVICE_NAME_SIZE-1] of VkChar; + pipelineCacheUUID: array[0..VK_UUID_SIZE-1] of VkUint8; + limits: TVkPhysicalDeviceLimits; + sparseProperties: TVkPhysicalDeviceSparseProperties; end; - PVkOffset2D = ^TVkOffset2D; - PPVkOffset2D = ^PVkOffset2D; + PVkPhysicalDeviceProperties = ^TVkPhysicalDeviceProperties; + PPVkPhysicalDeviceProperties = ^PVkPhysicalDeviceProperties; - TVkOffset3D = record - x: VkInt32; - y: VkInt32; - z: VkInt32; + TVkQueueFamilyProperties = record + queueFlags: VkQueueFlags; + queueCount: VkUint32; + timestampValidBits: VkUint32; + minImageTransferGranularity: TVkExtent3D; end; - PVkOffset3D = ^TVkOffset3D; - PPVkOffset3D = ^PVkOffset3D; + PVkQueueFamilyProperties = ^TVkQueueFamilyProperties; + PPVkQueueFamilyProperties = ^PVkQueueFamilyProperties; - TVkClearColorValue = record - case Integer of - 000: (float32: array[0..4] of VkFloat); - 001: (int32: array[0..4] of VkInt32); - 002: (uint32: array[0..4] of VkUint32); + TVkMemoryType = record + propertyFlags: VkMemoryPropertyFlags; + heapIndex: VkUint32; end; - PVkClearColorValue = ^TVkClearColorValue; - PPVkClearColorValue = ^PVkClearColorValue; + PVkMemoryType = ^TVkMemoryType; + PPVkMemoryType = ^PVkMemoryType; - TVkClearDepthStencilValue = record - depth: VkFloat; - stencil: VkUint32; + TVkMemoryHeap = record + size: VkDeviceSize; + flags: VkMemoryHeapFlags; end; - PVkClearDepthStencilValue = ^TVkClearDepthStencilValue; - PPVkClearDepthStencilValue = ^PVkClearDepthStencilValue; + PVkMemoryHeap = ^TVkMemoryHeap; + PPVkMemoryHeap = ^PVkMemoryHeap; - TVkDispatchIndirectCommand = record - x: VkUint32; - y: VkUint32; - z: VkUint32; + TVkPhysicalDeviceMemoryProperties = record + memoryTypeCount: VkUint32; + memoryTypes: array[0..VK_MAX_MEMORY_TYPES-1] of TVkMemoryType; + memoryHeapCount: VkUint32; + memoryHeaps: array[0..VK_MAX_MEMORY_HEAPS-1] of TVkMemoryHeap; end; - PVkDispatchIndirectCommand = ^TVkDispatchIndirectCommand; - PPVkDispatchIndirectCommand = ^PVkDispatchIndirectCommand; + PVkPhysicalDeviceMemoryProperties = ^TVkPhysicalDeviceMemoryProperties; + PPVkPhysicalDeviceMemoryProperties = ^PVkPhysicalDeviceMemoryProperties; - TVkDrawIndexedIndirectCommand = record - indexCount: VkUint32; - instanceCount: VkUint32; - firstIndex: VkUint32; - vertexOffset: VkInt32; - firstInstance: VkUint32; + TVkDeviceQueueCreateInfo = record + sType: TVkStructureType; + pNext: PVkVoid; + flags: VkDeviceQueueCreateFlags; + queueFamilyIndex: VkUint32; + queueCount: VkUint32; + pQueuePriorities: PVkFloat; end; - PVkDrawIndexedIndirectCommand = ^TVkDrawIndexedIndirectCommand; - PPVkDrawIndexedIndirectCommand = ^PVkDrawIndexedIndirectCommand; + PVkDeviceQueueCreateInfo = ^TVkDeviceQueueCreateInfo; + PPVkDeviceQueueCreateInfo = ^PVkDeviceQueueCreateInfo; - TVkDrawIndirectCommand = record - vertexCount: VkUint32; - instanceCount: VkUint32; - firstVertex: VkUint32; - firstInstance: VkUint32; + TVkDeviceCreateInfo = record + sType: TVkStructureType; + pNext: PVkVoid; + flags: VkDeviceCreateFlags; + queueCreateInfoCount: VkUint32; + pQueueCreateInfos: PVkDeviceQueueCreateInfo; + enabledLayerCount: VkUint32; + ppEnabledLayerNames: PPVkChar; + enabledExtensionCount: VkUint32; + ppEnabledExtensionNames: PPVkChar; + pEnabledFeatures: PVkPhysicalDeviceFeatures; end; - PVkDrawIndirectCommand = ^TVkDrawIndirectCommand; - PPVkDrawIndirectCommand = ^PVkDrawIndirectCommand; + PVkDeviceCreateInfo = ^TVkDeviceCreateInfo; + PPVkDeviceCreateInfo = ^PVkDeviceCreateInfo; TVkExtensionProperties = record extensionName: array[0..VK_MAX_EXTENSION_NAME_SIZE-1] of VkChar; @@ -1098,21 +1791,6 @@ type { structs } PVkExtensionProperties = ^TVkExtensionProperties; PPVkExtensionProperties = ^PVkExtensionProperties; - TVkExtent2D = record - width: VkUint32; - height: VkUint32; - end; - PVkExtent2D = ^TVkExtent2D; - PPVkExtent2D = ^PVkExtent2D; - - TVkExtent3D = record - width: VkUint32; - height: VkUint32; - depth: VkUint32; - end; - PVkExtent3D = ^TVkExtent3D; - PPVkExtent3D = ^PVkExtent3D; - TVkLayerProperties = record layerName: array[0..VK_MAX_EXTENSION_NAME_SIZE-1] of VkChar; specVersion: VkUint32; @@ -1122,91 +1800,38 @@ type { structs } PVkLayerProperties = ^TVkLayerProperties; PPVkLayerProperties = ^PVkLayerProperties; - TVkSpecializationMapEntry = record - constantID: VkUint32; - offset: VkUint32; - size: VkSize; - end; - PVkSpecializationMapEntry = ^TVkSpecializationMapEntry; - PPVkSpecializationMapEntry = ^PVkSpecializationMapEntry; - - TVkPhysicalDeviceFeatures = record - robustBufferAccess: VkBool32; - fullDrawIndexUint32: VkBool32; - imageCubeArray: VkBool32; - independentBlend: VkBool32; - geometryShader: VkBool32; - tessellationShader: VkBool32; - sampleRateShading: VkBool32; - dualSrcBlend: VkBool32; - logicOp: VkBool32; - multiDrawIndirect: VkBool32; - drawIndirectFirstInstance: VkBool32; - depthClamp: VkBool32; - depthBiasClamp: VkBool32; - fillModeNonSolid: VkBool32; - depthBounds: VkBool32; - wideLines: VkBool32; - largePoints: VkBool32; - alphaToOne: VkBool32; - multiViewport: VkBool32; - samplerAnisotropy: VkBool32; - textureCompressionETC2: VkBool32; - textureCompressionASTC_LDR: VkBool32; - textureCompressionBC: VkBool32; - occlusionQueryPrecise: VkBool32; - pipelineStatisticsQuery: VkBool32; - vertexPipelineStoresAndAtomics: VkBool32; - fragmentStoresAndAtomics: VkBool32; - shaderTessellationAndGeometryPointSize: VkBool32; - shaderImageGatherExtended: VkBool32; - shaderStorageImageExtendedFormats: VkBool32; - shaderStorageImageMultisample: VkBool32; - shaderStorageImageReadWithoutFormat: VkBool32; - shaderStorageImageWriteWithoutFormat: VkBool32; - shaderUniformBufferArrayDynamicIndexing: VkBool32; - shaderSampledImageArrayDynamicIndexing: VkBool32; - shaderStorageBufferArrayDynamicIndexing: VkBool32; - shaderStorageImageArrayDynamicIndexing: VkBool32; - shaderClipDistance: VkBool32; - shaderCullDistance: VkBool32; - shaderFloat64: VkBool32; - shaderInt64: VkBool32; - shaderInt16: VkBool32; - shaderResourceResidency: VkBool32; - shaderResourceMinLod: VkBool32; - sparseBinding: VkBool32; - sparseResidencyBuffer: VkBool32; - sparseResidencyImage2D: VkBool32; - sparseResidencyImage3D: VkBool32; - sparseResidency2Samples: VkBool32; - sparseResidency4Samples: VkBool32; - sparseResidency8Samples: VkBool32; - sparseResidency16Samples: VkBool32; - sparseResidencyAliased: VkBool32; - variableMultisampleRate: VkBool32; - inheritedQueries: VkBool32; + TVkSubmitInfo = record + sType: TVkStructureType; + pNext: PVkVoid; + waitSemaphoreCount: VkUint32; + pWaitSemaphores: PVkSemaphore; + pWaitDstStageMask: PVkPipelineStageFlags; + commandBufferCount: VkUint32; + pCommandBuffers: PVkCommandBuffer; + signalSemaphoreCount: VkUint32; + pSignalSemaphores: PVkSemaphore; end; - PVkPhysicalDeviceFeatures = ^TVkPhysicalDeviceFeatures; - PPVkPhysicalDeviceFeatures = ^PVkPhysicalDeviceFeatures; + PVkSubmitInfo = ^TVkSubmitInfo; + PPVkSubmitInfo = ^PVkSubmitInfo; - TVkPhysicalDeviceSparseProperties = record - residencyStandard2DBlockShape: VkBool32; - residencyStandard2DMultisampleBlockShape: VkBool32; - residencyStandard3DBlockShape: VkBool32; - residencyAlignedMipSize: VkBool32; - residencyNonResidentStrict: VkBool32; + TVkMemoryAllocateInfo = record + sType: TVkStructureType; + pNext: PVkVoid; + allocationSize: VkDeviceSize; + memoryTypeIndex: VkUint32; end; - PVkPhysicalDeviceSparseProperties = ^TVkPhysicalDeviceSparseProperties; - PPVkPhysicalDeviceSparseProperties = ^PVkPhysicalDeviceSparseProperties; + PVkMemoryAllocateInfo = ^TVkMemoryAllocateInfo; + PPVkMemoryAllocateInfo = ^PVkMemoryAllocateInfo; - TVkBufferCopy = record - srcOffset: VkDeviceSize; - dstOffset: VkDeviceSize; + TVkMappedMemoryRange = record + sType: TVkStructureType; + pNext: PVkVoid; + memory: VkDeviceMemory; + offset: VkDeviceSize; size: VkDeviceSize; end; - PVkBufferCopy = ^TVkBufferCopy; - PPVkBufferCopy = ^PVkBufferCopy; + PVkMappedMemoryRange = ^TVkMappedMemoryRange; + PPVkMappedMemoryRange = ^PVkMappedMemoryRange; TVkMemoryRequirements = record size: VkDeviceSize; @@ -1216,23 +1841,49 @@ type { structs } PVkMemoryRequirements = ^TVkMemoryRequirements; PPVkMemoryRequirements = ^PVkMemoryRequirements; - TVkSubresourceLayout = record - offset: VkDeviceSize; + TVkSparseImageFormatProperties = record + aspectMask: VkImageAspectFlags; + imageGranularity: TVkExtent3D; + flags: VkSparseImageFormatFlags; + end; + PVkSparseImageFormatProperties = ^TVkSparseImageFormatProperties; + PPVkSparseImageFormatProperties = ^PVkSparseImageFormatProperties; + + TVkSparseImageMemoryRequirements = record + formatProperties: TVkSparseImageFormatProperties; + imageMipTailFirstLod: VkUint32; + imageMipTailSize: VkDeviceSize; + imageMipTailOffset: VkDeviceSize; + imageMipTailStride: VkDeviceSize; + end; + PVkSparseImageMemoryRequirements = ^TVkSparseImageMemoryRequirements; + PPVkSparseImageMemoryRequirements = ^PVkSparseImageMemoryRequirements; + + TVkSparseMemoryBind = record + resourceOffset: VkDeviceSize; size: VkDeviceSize; - rowPitch: VkDeviceSize; - arrayPitch: VkDeviceSize; - depthPitch: VkDeviceSize; + memory: VkDeviceMemory; + memoryOffset: VkDeviceSize; + flags: VkSparseMemoryBindFlags; end; - PVkSubresourceLayout = ^TVkSubresourceLayout; - PPVkSubresourceLayout = ^PVkSubresourceLayout; + PVkSparseMemoryBind = ^TVkSparseMemoryBind; + PPVkSparseMemoryBind = ^PVkSparseMemoryBind; + + TVkSparseBufferMemoryBindInfo = record + buffer: VkBuffer; + bindCount: VkUint32; + pBinds: PVkSparseMemoryBind; + end; + PVkSparseBufferMemoryBindInfo = ^TVkSparseBufferMemoryBindInfo; + PPVkSparseBufferMemoryBindInfo = ^PVkSparseBufferMemoryBindInfo; - TVkFormatProperties = record - linearTilingFeatures: VkFormatFeatureFlags; - optimalTilingFeatures: VkFormatFeatureFlags; - bufferFeatures: VkFormatFeatureFlags; + TVkSparseImageOpaqueMemoryBindInfo = record + image: VkImage; + bindCount: VkUint32; + pBinds: PVkSparseMemoryBind; end; - PVkFormatProperties = ^TVkFormatProperties; - PPVkFormatProperties = ^PVkFormatProperties; + PVkSparseImageOpaqueMemoryBindInfo = ^TVkSparseImageOpaqueMemoryBindInfo; + PPVkSparseImageOpaqueMemoryBindInfo = ^PVkSparseImageOpaqueMemoryBindInfo; TVkImageSubresource = record aspectMask: VkImageAspectFlags; @@ -1242,221 +1893,139 @@ type { structs } PVkImageSubresource = ^TVkImageSubresource; PPVkImageSubresource = ^PVkImageSubresource; - TVkImageSubresourceLayers = record - aspectMask: VkImageAspectFlags; - mipLevel: VkUint32; - baseArrayLayer: VkUint32; - layerCount: VkUint32; - end; - PVkImageSubresourceLayers = ^TVkImageSubresourceLayers; - PPVkImageSubresourceLayers = ^PVkImageSubresourceLayers; - - TVkImageSubresourceRange = record - aspectMask: VkImageAspectFlags; - baseMipLevel: VkUint32; - levelCount: VkUint32; - baseArrayLayer: VkUint32; - layerCount: VkUint32; + TVkOffset3D = record + x: VkInt32; + y: VkInt32; + z: VkInt32; end; - PVkImageSubresourceRange = ^TVkImageSubresourceRange; - PPVkImageSubresourceRange = ^PVkImageSubresourceRange; + PVkOffset3D = ^TVkOffset3D; + PPVkOffset3D = ^PVkOffset3D; - TVkMemoryHeap = record - size: VkDeviceSize; - flags: VkMemoryHeapFlags; + TVkSparseImageMemoryBind = record + subresource: TVkImageSubresource; + offset: TVkOffset3D; + extent: TVkExtent3D; + memory: VkDeviceMemory; + memoryOffset: VkDeviceSize; + flags: VkSparseMemoryBindFlags; end; - PVkMemoryHeap = ^TVkMemoryHeap; - PPVkMemoryHeap = ^PVkMemoryHeap; + PVkSparseImageMemoryBind = ^TVkSparseImageMemoryBind; + PPVkSparseImageMemoryBind = ^PVkSparseImageMemoryBind; - TVkMemoryType = record - propertyFlags: VkMemoryPropertyFlags; - heapIndex: VkUint32; + TVkSparseImageMemoryBindInfo = record + image: VkImage; + bindCount: VkUint32; + pBinds: PVkSparseImageMemoryBind; end; - PVkMemoryType = ^TVkMemoryType; - PPVkMemoryType = ^PVkMemoryType; + PVkSparseImageMemoryBindInfo = ^TVkSparseImageMemoryBindInfo; + PPVkSparseImageMemoryBindInfo = ^PVkSparseImageMemoryBindInfo; - TVkSubpassDependency = record - srcSubpass: VkUint32; - dstSubpass: VkUint32; - srcStageMask: VkPipelineStageFlags; - dstStageMask: VkPipelineStageFlags; - srcAccessMask: VkAccessFlags; - dstAccessMask: VkAccessFlags; - dependencyFlags: VkDependencyFlags; + TVkBindSparseInfo = record + sType: TVkStructureType; + pNext: PVkVoid; + waitSemaphoreCount: VkUint32; + pWaitSemaphores: PVkSemaphore; + bufferBindCount: VkUint32; + pBufferBinds: PVkSparseBufferMemoryBindInfo; + imageOpaqueBindCount: VkUint32; + pImageOpaqueBinds: PVkSparseImageOpaqueMemoryBindInfo; + imageBindCount: VkUint32; + pImageBinds: PVkSparseImageMemoryBindInfo; + signalSemaphoreCount: VkUint32; + pSignalSemaphores: PVkSemaphore; end; - PVkSubpassDependency = ^TVkSubpassDependency; - PPVkSubpassDependency = ^PVkSubpassDependency; + PVkBindSparseInfo = ^TVkBindSparseInfo; + PPVkBindSparseInfo = ^PVkBindSparseInfo; - TVkPhysicalDeviceLimits = record - maxImageDimension1D: VkUint32; - maxImageDimension2D: VkUint32; - maxImageDimension3D: VkUint32; - maxImageDimensionCube: VkUint32; - maxImageArrayLayers: VkUint32; - maxTexelBufferElements: VkUint32; - maxUniformBufferRange: VkUint32; - maxStorageBufferRange: VkUint32; - maxPushConstantsSize: VkUint32; - maxMemoryAllocationCount: VkUint32; - maxSamplerAllocationCount: VkUint32; - bufferImageGranularity: VkDeviceSize; - sparseAddressSpaceSize: VkDeviceSize; - maxBoundDescriptorSets: VkUint32; - maxPerStageDescriptorSamplers: VkUint32; - maxPerStageDescriptorUniformBuffers: VkUint32; - maxPerStageDescriptorStorageBuffers: VkUint32; - maxPerStageDescriptorSampledImages: VkUint32; - maxPerStageDescriptorStorageImages: VkUint32; - maxPerStageDescriptorInputAttachments: VkUint32; - maxPerStageResources: VkUint32; - maxDescriptorSetSamplers: VkUint32; - maxDescriptorSetUniformBuffers: VkUint32; - maxDescriptorSetUniformBuffersDynamic: VkUint32; - maxDescriptorSetStorageBuffers: VkUint32; - maxDescriptorSetStorageBuffersDynamic: VkUint32; - maxDescriptorSetSampledImages: VkUint32; - maxDescriptorSetStorageImages: VkUint32; - maxDescriptorSetInputAttachments: VkUint32; - maxVertexInputAttributes: VkUint32; - maxVertexInputBindings: VkUint32; - maxVertexInputAttributeOffset: VkUint32; - maxVertexInputBindingStride: VkUint32; - maxVertexOutputComponents: VkUint32; - maxTessellationGenerationLevel: VkUint32; - maxTessellationPatchSize: VkUint32; - maxTessellationControlPerVertexInputComponents: VkUint32; - maxTessellationControlPerVertexOutputComponents: VkUint32; - maxTessellationControlPerPatchOutputComponents: VkUint32; - maxTessellationControlTotalOutputComponents: VkUint32; - maxTessellationEvaluationInputComponents: VkUint32; - maxTessellationEvaluationOutputComponents: VkUint32; - maxGeometryShaderInvocations: VkUint32; - maxGeometryInputComponents: VkUint32; - maxGeometryOutputComponents: VkUint32; - maxGeometryOutputVertices: VkUint32; - maxGeometryTotalOutputComponents: VkUint32; - maxFragmentInputComponents: VkUint32; - maxFragmentOutputAttachments: VkUint32; - maxFragmentDualSrcAttachments: VkUint32; - maxFragmentCombinedOutputResources: VkUint32; - maxComputeSharedMemorySize: VkUint32; - maxComputeWorkGroupCount: array[0..3] of VkUint32; - maxComputeWorkGroupInvocations: VkUint32; - maxComputeWorkGroupSize: array[0..3] of VkUint32; - subPixelPrecisionBits: VkUint32; - subTexelPrecisionBits: VkUint32; - mipmapPrecisionBits: VkUint32; - maxDrawIndexedIndexValue: VkUint32; - maxDrawIndirectCount: VkUint32; - maxSamplerLodBias: VkFloat; - maxSamplerAnisotropy: VkFloat; - maxViewports: VkUint32; - maxViewportDimensions: array[0..2] of VkUint32; - viewportBoundsRange: array[0..2] of VkFloat; - viewportSubPixelBits: VkUint32; - minMemoryMapAlignment: VkSize; - minTexelBufferOffsetAlignment: VkDeviceSize; - minUniformBufferOffsetAlignment: VkDeviceSize; - minStorageBufferOffsetAlignment: VkDeviceSize; - minTexelOffset: VkInt32; - maxTexelOffset: VkUint32; - minTexelGatherOffset: VkInt32; - maxTexelGatherOffset: VkUint32; - minInterpolationOffset: VkFloat; - maxInterpolationOffset: VkFloat; - subPixelInterpolationOffsetBits: VkUint32; - maxFramebufferWidth: VkUint32; - maxFramebufferHeight: VkUint32; - maxFramebufferLayers: VkUint32; - framebufferColorSampleCounts: VkSampleCountFlags; - framebufferDepthSampleCounts: VkSampleCountFlags; - framebufferStencilSampleCounts: VkSampleCountFlags; - framebufferNoAttachmentsSampleCounts: VkSampleCountFlags; - maxColorAttachments: VkUint32; - sampledImageColorSampleCounts: VkSampleCountFlags; - sampledImageIntegerSampleCounts: VkSampleCountFlags; - sampledImageDepthSampleCounts: VkSampleCountFlags; - sampledImageStencilSampleCounts: VkSampleCountFlags; - storageImageSampleCounts: VkSampleCountFlags; - maxSampleMaskWords: VkUint32; - timestampComputeAndGraphics: VkBool32; - timestampPeriod: VkFloat; - maxClipDistances: VkUint32; - maxCullDistances: VkUint32; - maxCombinedClipAndCullDistances: VkUint32; - discreteQueuePriorities: VkUint32; - pointSizeRange: array[0..2] of VkFloat; - lineWidthRange: array[0..2] of VkFloat; - pointSizeGranularity: VkFloat; - lineWidthGranularity: VkFloat; - strictLines: VkBool32; - standardSampleLocations: VkBool32; - optimalBufferCopyOffsetAlignment: VkDeviceSize; - optimalBufferCopyRowPitchAlignment: VkDeviceSize; - nonCoherentAtomSize: VkDeviceSize; + TVkFenceCreateInfo = record + sType: TVkStructureType; + pNext: PVkVoid; + flags: VkFenceCreateFlags; end; - PVkPhysicalDeviceLimits = ^TVkPhysicalDeviceLimits; - PPVkPhysicalDeviceLimits = ^PVkPhysicalDeviceLimits; + PVkFenceCreateInfo = ^TVkFenceCreateInfo; + PPVkFenceCreateInfo = ^PVkFenceCreateInfo; - TVkPushConstantRange = record - stageFlags: VkShaderStageFlags; - offset: VkUint32; - size: VkUint32; + TVkSemaphoreCreateInfo = record + sType: TVkStructureType; + pNext: PVkVoid; + flags: VkSemaphoreCreateFlags; end; - PVkPushConstantRange = ^TVkPushConstantRange; - PPVkPushConstantRange = ^PVkPushConstantRange; + PVkSemaphoreCreateInfo = ^TVkSemaphoreCreateInfo; + PPVkSemaphoreCreateInfo = ^PVkSemaphoreCreateInfo; - TVkRect2D = record - offset: TVkOffset2D; - extent: TVkExtent2D; + TVkEventCreateInfo = record + sType: TVkStructureType; + pNext: PVkVoid; + flags: VkEventCreateFlags; end; - PVkRect2D = ^TVkRect2D; - PPVkRect2D = ^PVkRect2D; + PVkEventCreateInfo = ^TVkEventCreateInfo; + PPVkEventCreateInfo = ^PVkEventCreateInfo; - TVkDescriptorBufferInfo = record - buffer: VkBuffer; - offset: VkDeviceSize; - range: VkDeviceSize; + TVkQueryPoolCreateInfo = record + sType: TVkStructureType; + pNext: PVkVoid; + flags: VkQueryPoolCreateFlags; + queryType: TVkQueryType; + queryCount: VkUint32; + pipelineStatistics: VkQueryPipelineStatisticFlags; end; - PVkDescriptorBufferInfo = ^TVkDescriptorBufferInfo; - PPVkDescriptorBufferInfo = ^PVkDescriptorBufferInfo; + PVkQueryPoolCreateInfo = ^TVkQueryPoolCreateInfo; + PPVkQueryPoolCreateInfo = ^PVkQueryPoolCreateInfo; - TVkQueueFamilyProperties = record - queueFlags: VkQueueFlags; - queueCount: VkUint32; - timestampValidBits: VkUint32; - minImageTransferGranularity: TVkExtent3D; + TVkBufferCreateInfo = record + sType: TVkStructureType; + pNext: PVkVoid; + flags: VkBufferCreateFlags; + size: VkDeviceSize; + usage: VkBufferUsageFlags; + sharingMode: TVkSharingMode; + queueFamilyIndexCount: VkUint32; + pQueueFamilyIndices: PVkUint32; end; - PVkQueueFamilyProperties = ^TVkQueueFamilyProperties; - PPVkQueueFamilyProperties = ^PVkQueueFamilyProperties; + PVkBufferCreateInfo = ^TVkBufferCreateInfo; + PPVkBufferCreateInfo = ^PVkBufferCreateInfo; - TVkImageFormatProperties = record - maxExtent: TVkExtent3D; - maxMipLevels: VkUint32; - maxArrayLayers: VkUint32; - sampleCounts: VkSampleCountFlags; - maxResourceSize: VkDeviceSize; + TVkBufferViewCreateInfo = record + sType: TVkStructureType; + pNext: PVkVoid; + flags: VkBufferViewCreateFlags; + buffer: VkBuffer; + format: TVkFormat; + offset: VkDeviceSize; + range: VkDeviceSize; end; - PVkImageFormatProperties = ^TVkImageFormatProperties; - PPVkImageFormatProperties = ^PVkImageFormatProperties; + PVkBufferViewCreateInfo = ^TVkBufferViewCreateInfo; + PPVkBufferViewCreateInfo = ^PVkBufferViewCreateInfo; - TVkSparseImageFormatProperties = record - aspectMask: VkImageAspectFlags; - imageGranularity: TVkExtent3D; - flags: VkSparseImageFormatFlags; + TVkImageCreateInfo = record + sType: TVkStructureType; + pNext: PVkVoid; + flags: VkImageCreateFlags; + imageType: TVkImageType; + format: TVkFormat; + extent: TVkExtent3D; + mipLevels: VkUint32; + arrayLayers: VkUint32; + samples: TVkSampleCountFlagBits; + tiling: TVkImageTiling; + usage: VkImageUsageFlags; + sharingMode: TVkSharingMode; + queueFamilyIndexCount: VkUint32; + pQueueFamilyIndices: PVkUint32; + initialLayout: TVkImageLayout; end; - PVkSparseImageFormatProperties = ^TVkSparseImageFormatProperties; - PPVkSparseImageFormatProperties = ^PVkSparseImageFormatProperties; + PVkImageCreateInfo = ^TVkImageCreateInfo; + PPVkImageCreateInfo = ^PVkImageCreateInfo; - TVkSparseMemoryBind = record - resourceOffset: VkDeviceSize; + TVkSubresourceLayout = record + offset: VkDeviceSize; size: VkDeviceSize; - memory: VkDeviceMemory; - memoryOffset: VkDeviceSize; - flags: VkSparseMemoryBindFlags; + rowPitch: VkDeviceSize; + arrayPitch: VkDeviceSize; + depthPitch: VkDeviceSize; end; - PVkSparseMemoryBind = ^TVkSparseMemoryBind; - PPVkSparseMemoryBind = ^PVkSparseMemoryBind; + PVkSubresourceLayout = ^TVkSubresourceLayout; + PPVkSubresourceLayout = ^PVkSubresourceLayout; TVkComponentMapping = record r: TVkComponentSwizzle; @@ -1467,40 +2036,77 @@ type { structs } PVkComponentMapping = ^TVkComponentMapping; PPVkComponentMapping = ^PVkComponentMapping; - TVkAttachmentReference = record - attachment: VkUint32; - layout: TVkImageLayout; + TVkImageSubresourceRange = record + aspectMask: VkImageAspectFlags; + baseMipLevel: VkUint32; + levelCount: VkUint32; + baseArrayLayer: VkUint32; + layerCount: VkUint32; end; - PVkAttachmentReference = ^TVkAttachmentReference; - PPVkAttachmentReference = ^PVkAttachmentReference; + PVkImageSubresourceRange = ^TVkImageSubresourceRange; + PPVkImageSubresourceRange = ^PVkImageSubresourceRange; - TVkDescriptorPoolSize = record - dType: TVkDescriptorType; - descriptorCount: VkUint32; + TVkImageViewCreateInfo = record + sType: TVkStructureType; + pNext: PVkVoid; + flags: VkImageViewCreateFlags; + image: VkImage; + viewType: TVkImageViewType; + format: TVkFormat; + components: TVkComponentMapping; + subresourceRange: TVkImageSubresourceRange; end; - PVkDescriptorPoolSize = ^TVkDescriptorPoolSize; - PPVkDescriptorPoolSize = ^PVkDescriptorPoolSize; + PVkImageViewCreateInfo = ^TVkImageViewCreateInfo; + PPVkImageViewCreateInfo = ^PVkImageViewCreateInfo; - TVkStencilOpState = record - failOp: TVkStencilOp; - passOp: TVkStencilOp; - depthFailOp: TVkStencilOp; - compareOp: TVkCompareOp; - compareMask: VkUint32; - writeMask: VkUint32; - reference: VkUint32; + TVkShaderModuleCreateInfo = record + sType: TVkStructureType; + pNext: PVkVoid; + flags: VkShaderModuleCreateFlags; + codeSize: VkSize; + pCode: PVkUint32; end; - PVkStencilOpState = ^TVkStencilOpState; - PPVkStencilOpState = ^PVkStencilOpState; + PVkShaderModuleCreateInfo = ^TVkShaderModuleCreateInfo; + PPVkShaderModuleCreateInfo = ^PVkShaderModuleCreateInfo; - TVkVertexInputAttributeDescription = record - location: VkUint32; - binding: VkUint32; - format: TVkFormat; + TVkPipelineCacheCreateInfo = record + sType: TVkStructureType; + pNext: PVkVoid; + flags: VkPipelineCacheCreateFlags; + initialDataSize: VkSize; + pInitialData: PVkVoid; + end; + PVkPipelineCacheCreateInfo = ^TVkPipelineCacheCreateInfo; + PPVkPipelineCacheCreateInfo = ^PVkPipelineCacheCreateInfo; + + TVkSpecializationMapEntry = record + constantID: VkUint32; offset: VkUint32; + size: VkSize; end; - PVkVertexInputAttributeDescription = ^TVkVertexInputAttributeDescription; - PPVkVertexInputAttributeDescription = ^PVkVertexInputAttributeDescription; + PVkSpecializationMapEntry = ^TVkSpecializationMapEntry; + PPVkSpecializationMapEntry = ^PVkSpecializationMapEntry; + + TVkSpecializationInfo = record + mapEntryCount: VkUint32; + pMapEntries: PVkSpecializationMapEntry; + dataSize: VkSize; + pData: PVkVoid; + end; + PVkSpecializationInfo = ^TVkSpecializationInfo; + PPVkSpecializationInfo = ^PVkSpecializationInfo; + + TVkPipelineShaderStageCreateInfo = record + sType: TVkStructureType; + pNext: PVkVoid; + flags: VkPipelineShaderStageCreateFlags; + stage: TVkShaderStageFlagBits; + module: VkShaderModule; + pName: PVkChar; + pSpecializationInfo: PVkSpecializationInfo; + end; + PVkPipelineShaderStageCreateInfo = ^TVkPipelineShaderStageCreateInfo; + PPVkPipelineShaderStageCreateInfo = ^PVkPipelineShaderStageCreateInfo; TVkVertexInputBindingDescription = record binding: VkUint32; @@ -1510,115 +2116,150 @@ type { structs } PVkVertexInputBindingDescription = ^TVkVertexInputBindingDescription; PPVkVertexInputBindingDescription = ^PVkVertexInputBindingDescription; - TVkApplicationInfo = record - sType: TVkStructureType; - pNext: PVkVoid; - pApplicationName: PVkChar; - applicationVersion: VkUint32; - pEngineName: PVkChar; - engineVersion: VkUint32; - apiVersion: VkUint32; + TVkVertexInputAttributeDescription = record + location: VkUint32; + binding: VkUint32; + format: TVkFormat; + offset: VkUint32; end; - PVkApplicationInfo = ^TVkApplicationInfo; - PPVkApplicationInfo = ^PVkApplicationInfo; + PVkVertexInputAttributeDescription = ^TVkVertexInputAttributeDescription; + PPVkVertexInputAttributeDescription = ^PVkVertexInputAttributeDescription; - TVkCommandBufferAllocateInfo = record + TVkPipelineVertexInputStateCreateInfo = record sType: TVkStructureType; pNext: PVkVoid; - commandPool: VkCommandPool; - level: TVkCommandBufferLevel; - commandBufferCount: VkUint32; + flags: VkPipelineVertexInputStateCreateFlags; + vertexBindingDescriptionCount: VkUint32; + pVertexBindingDescriptions: PVkVertexInputBindingDescription; + vertexAttributeDescriptionCount: VkUint32; + pVertexAttributeDescriptions: PVkVertexInputAttributeDescription; end; - PVkCommandBufferAllocateInfo = ^TVkCommandBufferAllocateInfo; - PPVkCommandBufferAllocateInfo = ^PVkCommandBufferAllocateInfo; + PVkPipelineVertexInputStateCreateInfo = ^TVkPipelineVertexInputStateCreateInfo; + PPVkPipelineVertexInputStateCreateInfo = ^PVkPipelineVertexInputStateCreateInfo; - TVkCopyDescriptorSet = record + TVkPipelineInputAssemblyStateCreateInfo = record sType: TVkStructureType; pNext: PVkVoid; - srcSet: VkDescriptorSet; - srcBinding: VkUint32; - srcArrayElement: VkUint32; - dstSet: VkDescriptorSet; - dstBinding: VkUint32; - dstArrayElement: VkUint32; - descriptorCount: VkUint32; + flags: VkPipelineInputAssemblyStateCreateFlags; + topology: TVkPrimitiveTopology; + primitiveRestartEnable: VkBool32; end; - PVkCopyDescriptorSet = ^TVkCopyDescriptorSet; - PPVkCopyDescriptorSet = ^PVkCopyDescriptorSet; + PVkPipelineInputAssemblyStateCreateInfo = ^TVkPipelineInputAssemblyStateCreateInfo; + PPVkPipelineInputAssemblyStateCreateInfo = ^PVkPipelineInputAssemblyStateCreateInfo; - TVkDescriptorSetAllocateInfo = record + TVkPipelineTessellationStateCreateInfo = record sType: TVkStructureType; pNext: PVkVoid; - descriptorPool: VkDescriptorPool; - descriptorSetCount: VkUint32; - pSetLayouts: PVkDescriptorSetLayout; + flags: VkPipelineTessellationStateCreateFlags; + patchControlPoints: VkUint32; end; - PVkDescriptorSetAllocateInfo = ^TVkDescriptorSetAllocateInfo; - PPVkDescriptorSetAllocateInfo = ^PVkDescriptorSetAllocateInfo; + PVkPipelineTessellationStateCreateInfo = ^TVkPipelineTessellationStateCreateInfo; + PPVkPipelineTessellationStateCreateInfo = ^PVkPipelineTessellationStateCreateInfo; - TVkDescriptorImageInfo = record - sampler: VkSampler; - imageView: VkImageView; - imageLayout: TVkImageLayout; + TVkViewport = record + x: VkFloat; + y: VkFloat; + width: VkFloat; + height: VkFloat; + minDepth: VkFloat; + maxDepth: VkFloat; end; - PVkDescriptorImageInfo = ^TVkDescriptorImageInfo; - PPVkDescriptorImageInfo = ^PVkDescriptorImageInfo; + PVkViewport = ^TVkViewport; + PPVkViewport = ^PVkViewport; - TVkClearValue = record - case Integer of - 000: (color: TVkClearColorValue); - 001: (depthStencil: TVkClearDepthStencilValue); + TVkOffset2D = record + x: VkInt32; + y: VkInt32; end; - PVkClearValue = ^TVkClearValue; - PPVkClearValue = ^PVkClearValue; + PVkOffset2D = ^TVkOffset2D; + PPVkOffset2D = ^PVkOffset2D; - TVkSpecializationInfo = record - mapEntryCount: VkUint32; - pMapEntries: PVkSpecializationMapEntry; - dataSize: VkSize; - pData: PVkVoid; + TVkExtent2D = record + width: VkUint32; + height: VkUint32; + end; + PVkExtent2D = ^TVkExtent2D; + PPVkExtent2D = ^PVkExtent2D; + + TVkRect2D = record + offset: TVkOffset2D; + extent: TVkExtent2D; + end; + PVkRect2D = ^TVkRect2D; + PPVkRect2D = ^PVkRect2D; + + TVkPipelineViewportStateCreateInfo = record + sType: TVkStructureType; + pNext: PVkVoid; + flags: VkPipelineViewportStateCreateFlags; + viewportCount: VkUint32; + pViewports: PVkViewport; + scissorCount: VkUint32; + pScissors: PVkRect2D; end; - PVkSpecializationInfo = ^TVkSpecializationInfo; - PPVkSpecializationInfo = ^PVkSpecializationInfo; + PVkPipelineViewportStateCreateInfo = ^TVkPipelineViewportStateCreateInfo; + PPVkPipelineViewportStateCreateInfo = ^PVkPipelineViewportStateCreateInfo; - TVkBufferMemoryBarrier = record + TVkPipelineRasterizationStateCreateInfo = record sType: TVkStructureType; pNext: PVkVoid; - srcAccessMask: VkAccessFlags; - dstAccessMask: VkAccessFlags; - srcQueueFamilyIndex: VkUint32; - dstQueueFamilyIndex: VkUint32; - buffer: VkBuffer; - offset: VkDeviceSize; - size: VkDeviceSize; + flags: VkPipelineRasterizationStateCreateFlags; + depthClampEnable: VkBool32; + rasterizerDiscardEnable: VkBool32; + polygonMode: TVkPolygonMode; + cullMode: VkCullModeFlags; + frontFace: TVkFrontFace; + depthBiasEnable: VkBool32; + depthBiasConstantFactor: VkFloat; + depthBiasClamp: VkFloat; + depthBiasSlopeFactor: VkFloat; + lineWidth: VkFloat; end; - PVkBufferMemoryBarrier = ^TVkBufferMemoryBarrier; - PPVkBufferMemoryBarrier = ^PVkBufferMemoryBarrier; + PVkPipelineRasterizationStateCreateInfo = ^TVkPipelineRasterizationStateCreateInfo; + PPVkPipelineRasterizationStateCreateInfo = ^PVkPipelineRasterizationStateCreateInfo; - TVkBufferCreateInfo = record + TVkPipelineMultisampleStateCreateInfo = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkBufferCreateFlags; - size: VkDeviceSize; - usage: VkBufferUsageFlags; - sharingMode: TVkSharingMode; - queueFamilyIndexCount: VkUint32; - pQueueFamilyIndices: PVkUint32; + flags: VkPipelineMultisampleStateCreateFlags; + rasterizationSamples: TVkSampleCountFlagBits; + sampleShadingEnable: VkBool32; + minSampleShading: VkFloat; + pSampleMask: PVkSampleMask; + alphaToCoverageEnable: VkBool32; + alphaToOneEnable: VkBool32; end; - PVkBufferCreateInfo = ^TVkBufferCreateInfo; - PPVkBufferCreateInfo = ^PVkBufferCreateInfo; + PVkPipelineMultisampleStateCreateInfo = ^TVkPipelineMultisampleStateCreateInfo; + PPVkPipelineMultisampleStateCreateInfo = ^PVkPipelineMultisampleStateCreateInfo; - TVkBufferViewCreateInfo = record + TVkStencilOpState = record + failOp: TVkStencilOp; + passOp: TVkStencilOp; + depthFailOp: TVkStencilOp; + compareOp: TVkCompareOp; + compareMask: VkUint32; + writeMask: VkUint32; + reference: VkUint32; + end; + PVkStencilOpState = ^TVkStencilOpState; + PPVkStencilOpState = ^PVkStencilOpState; + + TVkPipelineDepthStencilStateCreateInfo = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkBufferViewCreateFlags; - buffer: VkBuffer; - format: TVkFormat; - offset: VkDeviceSize; - range: VkDeviceSize; + flags: VkPipelineDepthStencilStateCreateFlags; + depthTestEnable: VkBool32; + depthWriteEnable: VkBool32; + depthCompareOp: TVkCompareOp; + depthBoundsTestEnable: VkBool32; + stencilTestEnable: VkBool32; + front: TVkStencilOpState; + back: TVkStencilOpState; + minDepthBounds: VkFloat; + maxDepthBounds: VkFloat; end; - PVkBufferViewCreateInfo = ^TVkBufferViewCreateInfo; - PPVkBufferViewCreateInfo = ^PVkBufferViewCreateInfo; + PVkPipelineDepthStencilStateCreateInfo = ^TVkPipelineDepthStencilStateCreateInfo; + PPVkPipelineDepthStencilStateCreateInfo = ^PVkPipelineDepthStencilStateCreateInfo; TVkPipelineColorBlendAttachmentState = record blendEnable: VkBool32; @@ -1633,225 +2274,117 @@ type { structs } PVkPipelineColorBlendAttachmentState = ^TVkPipelineColorBlendAttachmentState; PPVkPipelineColorBlendAttachmentState = ^PVkPipelineColorBlendAttachmentState; - TVkCommandPoolCreateInfo = record - sType: TVkStructureType; - pNext: PVkVoid; - flags: VkCommandPoolCreateFlags; - queueFamilyIndex: VkUint32; - end; - PVkCommandPoolCreateInfo = ^TVkCommandPoolCreateInfo; - PPVkCommandPoolCreateInfo = ^PVkCommandPoolCreateInfo; - - TVkDeviceQueueCreateInfo = record + TVkPipelineColorBlendStateCreateInfo = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkDeviceQueueCreateFlags; - queueFamilyIndex: VkUint32; - queueCount: VkUint32; - pQueuePriorities: PVkFloat; + flags: VkPipelineColorBlendStateCreateFlags; + logicOpEnable: VkBool32; + logicOp: TVkLogicOp; + attachmentCount: VkUint32; + pAttachments: PVkPipelineColorBlendAttachmentState; + blendConstants: array[0..4] of VkFloat; end; - PVkDeviceQueueCreateInfo = ^TVkDeviceQueueCreateInfo; - PPVkDeviceQueueCreateInfo = ^PVkDeviceQueueCreateInfo; + PVkPipelineColorBlendStateCreateInfo = ^TVkPipelineColorBlendStateCreateInfo; + PPVkPipelineColorBlendStateCreateInfo = ^PVkPipelineColorBlendStateCreateInfo; - TVkCommandBufferInheritanceInfo = record + TVkPipelineDynamicStateCreateInfo = record sType: TVkStructureType; pNext: PVkVoid; - renderPass: VkRenderPass; - subpass: VkUint32; - framebuffer: VkFramebuffer; - occlusionQueryEnable: VkBool32; - queryFlags: VkQueryControlFlags; - pipelineStatistics: VkQueryPipelineStatisticFlags; - end; - PVkCommandBufferInheritanceInfo = ^TVkCommandBufferInheritanceInfo; - PPVkCommandBufferInheritanceInfo = ^PVkCommandBufferInheritanceInfo; - - TVkDescriptorSetLayoutBinding = record - binding: VkUint32; - descriptorType: TVkDescriptorType; - descriptorCount: VkUint32; - stageFlags: VkShaderStageFlags; - pImmutableSamplers: PVkSampler; - end; - PVkDescriptorSetLayoutBinding = ^TVkDescriptorSetLayoutBinding; - PPVkDescriptorSetLayoutBinding = ^PVkDescriptorSetLayoutBinding; - - TVkSparseImageMemoryBind = record - subresource: TVkImageSubresource; - offset: TVkOffset3D; - extent: TVkExtent3D; - memory: VkDeviceMemory; - memoryOffset: VkDeviceSize; - flags: VkSparseMemoryBindFlags; - end; - PVkSparseImageMemoryBind = ^TVkSparseImageMemoryBind; - PPVkSparseImageMemoryBind = ^PVkSparseImageMemoryBind; - - TVkBufferImageCopy = record - bufferOffset: VkDeviceSize; - bufferRowLength: VkUint32; - bufferImageHeight: VkUint32; - imageSubresource: TVkImageSubresourceLayers; - imageOffset: TVkOffset3D; - imageExtent: TVkExtent3D; - end; - PVkBufferImageCopy = ^TVkBufferImageCopy; - PPVkBufferImageCopy = ^PVkBufferImageCopy; - - TVkImageBlit = record - srcSubresource: TVkImageSubresourceLayers; - srcOffsets: array[0..2] of TVkOffset3D; - dstSubresource: TVkImageSubresourceLayers; - dstOffsets: array[0..2] of TVkOffset3D; - end; - PVkImageBlit = ^TVkImageBlit; - PPVkImageBlit = ^PVkImageBlit; - - TVkImageCopy = record - srcSubresource: TVkImageSubresourceLayers; - srcOffset: TVkOffset3D; - dstSubresource: TVkImageSubresourceLayers; - dstOffset: TVkOffset3D; - extent: TVkExtent3D; - end; - PVkImageCopy = ^TVkImageCopy; - PPVkImageCopy = ^PVkImageCopy; - - TVkImageResolve = record - srcSubresource: TVkImageSubresourceLayers; - srcOffset: TVkOffset3D; - dstSubresource: TVkImageSubresourceLayers; - dstOffset: TVkOffset3D; - extent: TVkExtent3D; - end; - PVkImageResolve = ^TVkImageResolve; - PPVkImageResolve = ^PVkImageResolve; - - TVkPhysicalDeviceMemoryProperties = record - memoryTypeCount: VkUint32; - memoryTypes: array[0..VK_MAX_MEMORY_TYPES-1] of TVkMemoryType; - memoryHeapCount: VkUint32; - memoryHeaps: array[0..VK_MAX_MEMORY_HEAPS-1] of TVkMemoryHeap; - end; - PVkPhysicalDeviceMemoryProperties = ^TVkPhysicalDeviceMemoryProperties; - PPVkPhysicalDeviceMemoryProperties = ^PVkPhysicalDeviceMemoryProperties; - - TVkPhysicalDeviceProperties = record - apiVersion: VkUint32; - driverVersion: VkUint32; - vendorID: VkUint32; - deviceID: VkUint32; - deviceType: TVkPhysicalDeviceType; - deviceName: array[0..VK_MAX_PHYSICAL_DEVICE_NAME_SIZE-1] of VkChar; - pipelineCacheUUID: array[0..VK_UUID_SIZE-1] of VkUint8; - limits: TVkPhysicalDeviceLimits; - sparseProperties: TVkPhysicalDeviceSparseProperties; - end; - PVkPhysicalDeviceProperties = ^TVkPhysicalDeviceProperties; - PPVkPhysicalDeviceProperties = ^PVkPhysicalDeviceProperties; - - TVkClearRect = record - rect: TVkRect2D; - baseArrayLayer: VkUint32; - layerCount: VkUint32; - end; - PVkClearRect = ^TVkClearRect; - PPVkClearRect = ^PVkClearRect; - - TVkSparseImageMemoryRequirements = record - formatProperties: TVkSparseImageFormatProperties; - imageMipTailFirstLod: VkUint32; - imageMipTailSize: VkDeviceSize; - imageMipTailOffset: VkDeviceSize; - imageMipTailStride: VkDeviceSize; - end; - PVkSparseImageMemoryRequirements = ^TVkSparseImageMemoryRequirements; - PPVkSparseImageMemoryRequirements = ^PVkSparseImageMemoryRequirements; - - TVkSparseBufferMemoryBindInfo = record - buffer: VkBuffer; - bindCount: VkUint32; - pBinds: PVkSparseMemoryBind; - end; - PVkSparseBufferMemoryBindInfo = ^TVkSparseBufferMemoryBindInfo; - PPVkSparseBufferMemoryBindInfo = ^PVkSparseBufferMemoryBindInfo; - - TVkSparseImageOpaqueMemoryBindInfo = record - image: VkImage; - bindCount: VkUint32; - pBinds: PVkSparseMemoryBind; - end; - PVkSparseImageOpaqueMemoryBindInfo = ^TVkSparseImageOpaqueMemoryBindInfo; - PPVkSparseImageOpaqueMemoryBindInfo = ^PVkSparseImageOpaqueMemoryBindInfo; - - TVkSubpassDescription = record - flags: VkSubpassDescriptionFlags; - pipelineBindPoint: TVkPipelineBindPoint; - inputAttachmentCount: VkUint32; - pInputAttachments: PVkAttachmentReference; - colorAttachmentCount: VkUint32; - pColorAttachments: PVkAttachmentReference; - pResolveAttachments: PVkAttachmentReference; - pDepthStencilAttachment: PVkAttachmentReference; - preserveAttachmentCount: VkUint32; - pPreserveAttachments: PVkUint32; + flags: VkPipelineDynamicStateCreateFlags; + dynamicStateCount: VkUint32; + pDynamicStates: PVkDynamicState; end; - PVkSubpassDescription = ^TVkSubpassDescription; - PPVkSubpassDescription = ^PVkSubpassDescription; + PVkPipelineDynamicStateCreateInfo = ^TVkPipelineDynamicStateCreateInfo; + PPVkPipelineDynamicStateCreateInfo = ^PVkPipelineDynamicStateCreateInfo; - TVkDescriptorPoolCreateInfo = record + TVkGraphicsPipelineCreateInfo = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkDescriptorPoolCreateFlags; - maxSets: VkUint32; - poolSizeCount: VkUint32; - pPoolSizes: PVkDescriptorPoolSize; + flags: VkPipelineCreateFlags; + stageCount: VkUint32; + pStages: PVkPipelineShaderStageCreateInfo; + pVertexInputState: PVkPipelineVertexInputStateCreateInfo; + pInputAssemblyState: PVkPipelineInputAssemblyStateCreateInfo; + pTessellationState: PVkPipelineTessellationStateCreateInfo; + pViewportState: PVkPipelineViewportStateCreateInfo; + pRasterizationState: PVkPipelineRasterizationStateCreateInfo; + pMultisampleState: PVkPipelineMultisampleStateCreateInfo; + pDepthStencilState: PVkPipelineDepthStencilStateCreateInfo; + pColorBlendState: PVkPipelineColorBlendStateCreateInfo; + pDynamicState: PVkPipelineDynamicStateCreateInfo; + layout: VkPipelineLayout; + renderPass: VkRenderPass; + subpass: VkUint32; + basePipelineHandle: VkPipeline; + basePipelineIndex: VkInt32; end; - PVkDescriptorPoolCreateInfo = ^TVkDescriptorPoolCreateInfo; - PPVkDescriptorPoolCreateInfo = ^PVkDescriptorPoolCreateInfo; + PVkGraphicsPipelineCreateInfo = ^TVkGraphicsPipelineCreateInfo; + PPVkGraphicsPipelineCreateInfo = ^PVkGraphicsPipelineCreateInfo; - TVkAllocationCallbacks = record - pUserData: PVkVoid; - pfnAllocation: TvkAllocationFunction; - pfnReallocation: TvkReallocationFunction; - pfnFree: TvkFreeFunction; - pfnInternalAllocation: TvkInternalAllocationNotification; - pfnInternalFree: TvkInternalFreeNotification; + TVkComputePipelineCreateInfo = record + sType: TVkStructureType; + pNext: PVkVoid; + flags: VkPipelineCreateFlags; + stage: TVkPipelineShaderStageCreateInfo; + layout: VkPipelineLayout; + basePipelineHandle: VkPipeline; + basePipelineIndex: VkInt32; end; - PVkAllocationCallbacks = ^TVkAllocationCallbacks; - PPVkAllocationCallbacks = ^PVkAllocationCallbacks; + PVkComputePipelineCreateInfo = ^TVkComputePipelineCreateInfo; + PPVkComputePipelineCreateInfo = ^PVkComputePipelineCreateInfo; - TVkClearAttachment = record - aspectMask: VkImageAspectFlags; - colorAttachment: VkUint32; - clearValue: TVkClearValue; + TVkPushConstantRange = record + stageFlags: VkShaderStageFlags; + offset: VkUint32; + size: VkUint32; end; - PVkClearAttachment = ^TVkClearAttachment; - PPVkClearAttachment = ^PVkClearAttachment; + PVkPushConstantRange = ^TVkPushConstantRange; + PPVkPushConstantRange = ^PVkPushConstantRange; - TVkDeviceCreateInfo = record + TVkPipelineLayoutCreateInfo = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkDeviceCreateFlags; - queueCreateInfoCount: VkUint32; - pQueueCreateInfos: PVkDeviceQueueCreateInfo; - enabledLayerCount: VkUint32; - ppEnabledLayerNames: PPVkChar; - enabledExtensionCount: VkUint32; - ppEnabledExtensionNames: PPVkChar; - pEnabledFeatures: PVkPhysicalDeviceFeatures; + flags: VkPipelineLayoutCreateFlags; + setLayoutCount: VkUint32; + pSetLayouts: PVkDescriptorSetLayout; + pushConstantRangeCount: VkUint32; + pPushConstantRanges: PVkPushConstantRange; end; - PVkDeviceCreateInfo = ^TVkDeviceCreateInfo; - PPVkDeviceCreateInfo = ^PVkDeviceCreateInfo; + PVkPipelineLayoutCreateInfo = ^TVkPipelineLayoutCreateInfo; + PPVkPipelineLayoutCreateInfo = ^PVkPipelineLayoutCreateInfo; - TVkCommandBufferBeginInfo = record + TVkSamplerCreateInfo = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkCommandBufferUsageFlags; - pInheritanceInfo: PVkCommandBufferInheritanceInfo; + flags: VkSamplerCreateFlags; + magFilter: TVkFilter; + minFilter: TVkFilter; + mipmapMode: TVkSamplerMipmapMode; + addressModeU: TVkSamplerAddressMode; + addressModeV: TVkSamplerAddressMode; + addressModeW: TVkSamplerAddressMode; + mipLodBias: VkFloat; + anisotropyEnable: VkBool32; + maxAnisotropy: VkFloat; + compareEnable: VkBool32; + compareOp: TVkCompareOp; + minLod: VkFloat; + maxLod: VkFloat; + borderColor: TVkBorderColor; + unnormalizedCoordinates: VkBool32; end; - PVkCommandBufferBeginInfo = ^TVkCommandBufferBeginInfo; - PPVkCommandBufferBeginInfo = ^PVkCommandBufferBeginInfo; + PVkSamplerCreateInfo = ^TVkSamplerCreateInfo; + PPVkSamplerCreateInfo = ^PVkSamplerCreateInfo; + + TVkDescriptorSetLayoutBinding = record + binding: VkUint32; + descriptorType: TVkDescriptorType; + descriptorCount: VkUint32; + stageFlags: VkShaderStageFlags; + pImmutableSamplers: PVkSampler; + end; + PVkDescriptorSetLayoutBinding = ^TVkDescriptorSetLayoutBinding; + PPVkDescriptorSetLayoutBinding = ^PVkDescriptorSetLayoutBinding; TVkDescriptorSetLayoutCreateInfo = record sType: TVkStructureType; @@ -1863,58 +2396,92 @@ type { structs } PVkDescriptorSetLayoutCreateInfo = ^TVkDescriptorSetLayoutCreateInfo; PPVkDescriptorSetLayoutCreateInfo = ^PVkDescriptorSetLayoutCreateInfo; - TVkSparseImageMemoryBindInfo = record - image: VkImage; - bindCount: VkUint32; - pBinds: PVkSparseImageMemoryBind; + TVkDescriptorPoolSize = record + dType: TVkDescriptorType; + descriptorCount: VkUint32; end; - PVkSparseImageMemoryBindInfo = ^TVkSparseImageMemoryBindInfo; - PPVkSparseImageMemoryBindInfo = ^PVkSparseImageMemoryBindInfo; + PVkDescriptorPoolSize = ^TVkDescriptorPoolSize; + PPVkDescriptorPoolSize = ^PVkDescriptorPoolSize; - TVkBindSparseInfo = record + TVkDescriptorPoolCreateInfo = record sType: TVkStructureType; pNext: PVkVoid; - waitSemaphoreCount: VkUint32; - pWaitSemaphores: PVkSemaphore; - bufferBindCount: VkUint32; - pBufferBinds: PVkSparseBufferMemoryBindInfo; - imageOpaqueBindCount: VkUint32; - pImageOpaqueBinds: PVkSparseImageOpaqueMemoryBindInfo; - imageBindCount: VkUint32; - pImageBinds: PVkSparseImageMemoryBindInfo; - signalSemaphoreCount: VkUint32; - pSignalSemaphores: PVkSemaphore; + flags: VkDescriptorPoolCreateFlags; + maxSets: VkUint32; + poolSizeCount: VkUint32; + pPoolSizes: PVkDescriptorPoolSize; end; - PVkBindSparseInfo = ^TVkBindSparseInfo; - PPVkBindSparseInfo = ^PVkBindSparseInfo; + PVkDescriptorPoolCreateInfo = ^TVkDescriptorPoolCreateInfo; + PPVkDescriptorPoolCreateInfo = ^PVkDescriptorPoolCreateInfo; - TVkMappedMemoryRange = record + TVkDescriptorSetAllocateInfo = record sType: TVkStructureType; pNext: PVkVoid; - memory: VkDeviceMemory; + descriptorPool: VkDescriptorPool; + descriptorSetCount: VkUint32; + pSetLayouts: PVkDescriptorSetLayout; + end; + PVkDescriptorSetAllocateInfo = ^TVkDescriptorSetAllocateInfo; + PPVkDescriptorSetAllocateInfo = ^PVkDescriptorSetAllocateInfo; + + TVkDescriptorImageInfo = record + sampler: VkSampler; + imageView: VkImageView; + imageLayout: TVkImageLayout; + end; + PVkDescriptorImageInfo = ^TVkDescriptorImageInfo; + PPVkDescriptorImageInfo = ^PVkDescriptorImageInfo; + + TVkDescriptorBufferInfo = record + buffer: VkBuffer; offset: VkDeviceSize; - size: VkDeviceSize; + range: VkDeviceSize; end; - PVkMappedMemoryRange = ^TVkMappedMemoryRange; - PPVkMappedMemoryRange = ^PVkMappedMemoryRange; + PVkDescriptorBufferInfo = ^TVkDescriptorBufferInfo; + PPVkDescriptorBufferInfo = ^PVkDescriptorBufferInfo; - TVkMemoryAllocateInfo = record + TVkWriteDescriptorSet = record sType: TVkStructureType; pNext: PVkVoid; - allocationSize: VkDeviceSize; - memoryTypeIndex: VkUint32; + dstSet: VkDescriptorSet; + dstBinding: VkUint32; + dstArrayElement: VkUint32; + descriptorCount: VkUint32; + descriptorType: TVkDescriptorType; + pImageInfo: PVkDescriptorImageInfo; + pBufferInfo: PVkDescriptorBufferInfo; + pTexelBufferView: PVkBufferView; end; - PVkMemoryAllocateInfo = ^TVkMemoryAllocateInfo; - PPVkMemoryAllocateInfo = ^PVkMemoryAllocateInfo; + PVkWriteDescriptorSet = ^TVkWriteDescriptorSet; + PPVkWriteDescriptorSet = ^PVkWriteDescriptorSet; - TVkMemoryBarrier = record + TVkCopyDescriptorSet = record sType: TVkStructureType; pNext: PVkVoid; - srcAccessMask: VkAccessFlags; - dstAccessMask: VkAccessFlags; + srcSet: VkDescriptorSet; + srcBinding: VkUint32; + srcArrayElement: VkUint32; + dstSet: VkDescriptorSet; + dstBinding: VkUint32; + dstArrayElement: VkUint32; + descriptorCount: VkUint32; end; - PVkMemoryBarrier = ^TVkMemoryBarrier; - PPVkMemoryBarrier = ^PVkMemoryBarrier; + PVkCopyDescriptorSet = ^TVkCopyDescriptorSet; + PPVkCopyDescriptorSet = ^PVkCopyDescriptorSet; + + TVkFramebufferCreateInfo = record + sType: TVkStructureType; + pNext: PVkVoid; + flags: VkFramebufferCreateFlags; + renderPass: VkRenderPass; + attachmentCount: VkUint32; + pAttachments: PVkImageView; + width: VkUint32; + height: VkUint32; + layers: VkUint32; + end; + PVkFramebufferCreateInfo = ^TVkFramebufferCreateInfo; + PPVkFramebufferCreateInfo = ^PVkFramebufferCreateInfo; TVkAttachmentDescription = record flags: VkAttachmentDescriptionFlags; @@ -1927,195 +2494,217 @@ type { structs } initialLayout: TVkImageLayout; finalLayout: TVkImageLayout; end; - PVkAttachmentDescription = ^TVkAttachmentDescription; - PPVkAttachmentDescription = ^PVkAttachmentDescription; + PVkAttachmentDescription = ^TVkAttachmentDescription; + PPVkAttachmentDescription = ^PVkAttachmentDescription; + + TVkAttachmentReference = record + attachment: VkUint32; + layout: TVkImageLayout; + end; + PVkAttachmentReference = ^TVkAttachmentReference; + PPVkAttachmentReference = ^PVkAttachmentReference; + + TVkSubpassDescription = record + flags: VkSubpassDescriptionFlags; + pipelineBindPoint: TVkPipelineBindPoint; + inputAttachmentCount: VkUint32; + pInputAttachments: PVkAttachmentReference; + colorAttachmentCount: VkUint32; + pColorAttachments: PVkAttachmentReference; + pResolveAttachments: PVkAttachmentReference; + pDepthStencilAttachment: PVkAttachmentReference; + preserveAttachmentCount: VkUint32; + pPreserveAttachments: PVkUint32; + end; + PVkSubpassDescription = ^TVkSubpassDescription; + PPVkSubpassDescription = ^PVkSubpassDescription; + + TVkSubpassDependency = record + srcSubpass: VkUint32; + dstSubpass: VkUint32; + srcStageMask: VkPipelineStageFlags; + dstStageMask: VkPipelineStageFlags; + srcAccessMask: VkAccessFlags; + dstAccessMask: VkAccessFlags; + dependencyFlags: VkDependencyFlags; + end; + PVkSubpassDependency = ^TVkSubpassDependency; + PPVkSubpassDependency = ^PVkSubpassDependency; + + TVkRenderPassCreateInfo = record + sType: TVkStructureType; + pNext: PVkVoid; + flags: VkRenderPassCreateFlags; + attachmentCount: VkUint32; + pAttachments: PVkAttachmentDescription; + subpassCount: VkUint32; + pSubpasses: PVkSubpassDescription; + dependencyCount: VkUint32; + pDependencies: PVkSubpassDependency; + end; + PVkRenderPassCreateInfo = ^TVkRenderPassCreateInfo; + PPVkRenderPassCreateInfo = ^PVkRenderPassCreateInfo; - TVkEventCreateInfo = record + TVkCommandPoolCreateInfo = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkEventCreateFlags; + flags: VkCommandPoolCreateFlags; + queueFamilyIndex: VkUint32; end; - PVkEventCreateInfo = ^TVkEventCreateInfo; - PPVkEventCreateInfo = ^PVkEventCreateInfo; + PVkCommandPoolCreateInfo = ^TVkCommandPoolCreateInfo; + PPVkCommandPoolCreateInfo = ^PVkCommandPoolCreateInfo; - TVkFenceCreateInfo = record + TVkCommandBufferAllocateInfo = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkFenceCreateFlags; + commandPool: VkCommandPool; + level: TVkCommandBufferLevel; + commandBufferCount: VkUint32; end; - PVkFenceCreateInfo = ^TVkFenceCreateInfo; - PPVkFenceCreateInfo = ^PVkFenceCreateInfo; + PVkCommandBufferAllocateInfo = ^TVkCommandBufferAllocateInfo; + PPVkCommandBufferAllocateInfo = ^PVkCommandBufferAllocateInfo; - TVkFramebufferCreateInfo = record + TVkCommandBufferInheritanceInfo = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkFramebufferCreateFlags; renderPass: VkRenderPass; - attachmentCount: VkUint32; - pAttachments: PVkImageView; - width: VkUint32; - height: VkUint32; - layers: VkUint32; + subpass: VkUint32; + framebuffer: VkFramebuffer; + occlusionQueryEnable: VkBool32; + queryFlags: VkQueryControlFlags; + pipelineStatistics: VkQueryPipelineStatisticFlags; end; - PVkFramebufferCreateInfo = ^TVkFramebufferCreateInfo; - PPVkFramebufferCreateInfo = ^PVkFramebufferCreateInfo; + PVkCommandBufferInheritanceInfo = ^TVkCommandBufferInheritanceInfo; + PPVkCommandBufferInheritanceInfo = ^PVkCommandBufferInheritanceInfo; - TVkImageCreateInfo = record + TVkCommandBufferBeginInfo = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkImageCreateFlags; - imageType: TVkImageType; - format: TVkFormat; - extent: TVkExtent3D; - mipLevels: VkUint32; - arrayLayers: VkUint32; - samples: TVkSampleCountFlagBits; - tiling: TVkImageTiling; - usage: VkImageUsageFlags; - sharingMode: TVkSharingMode; - queueFamilyIndexCount: VkUint32; - pQueueFamilyIndices: PVkUint32; - initialLayout: TVkImageLayout; + flags: VkCommandBufferUsageFlags; + pInheritanceInfo: PVkCommandBufferInheritanceInfo; end; - PVkImageCreateInfo = ^TVkImageCreateInfo; - PPVkImageCreateInfo = ^PVkImageCreateInfo; + PVkCommandBufferBeginInfo = ^TVkCommandBufferBeginInfo; + PPVkCommandBufferBeginInfo = ^PVkCommandBufferBeginInfo; - TVkPipelineCacheCreateInfo = record - sType: TVkStructureType; - pNext: PVkVoid; - flags: VkPipelineCacheCreateFlags; - initialDataSize: VkSize; - pInitialData: PVkVoid; + TVkBufferCopy = record + srcOffset: VkDeviceSize; + dstOffset: VkDeviceSize; + size: VkDeviceSize; end; - PVkPipelineCacheCreateInfo = ^TVkPipelineCacheCreateInfo; - PPVkPipelineCacheCreateInfo = ^PVkPipelineCacheCreateInfo; + PVkBufferCopy = ^TVkBufferCopy; + PPVkBufferCopy = ^PVkBufferCopy; - TVkPipelineDynamicStateCreateInfo = record - sType: TVkStructureType; - pNext: PVkVoid; - flags: VkPipelineDynamicStateCreateFlags; - dynamicStateCount: VkUint32; - pDynamicStates: PVkDynamicState; + TVkImageSubresourceLayers = record + aspectMask: VkImageAspectFlags; + mipLevel: VkUint32; + baseArrayLayer: VkUint32; + layerCount: VkUint32; end; - PVkPipelineDynamicStateCreateInfo = ^TVkPipelineDynamicStateCreateInfo; - PPVkPipelineDynamicStateCreateInfo = ^PVkPipelineDynamicStateCreateInfo; + PVkImageSubresourceLayers = ^TVkImageSubresourceLayers; + PPVkImageSubresourceLayers = ^PVkImageSubresourceLayers; - TVkPipelineInputAssemblyStateCreateInfo = record - sType: TVkStructureType; - pNext: PVkVoid; - flags: VkPipelineInputAssemblyStateCreateFlags; - topology: TVkPrimitiveTopology; - primitiveRestartEnable: VkBool32; + TVkImageCopy = record + srcSubresource: TVkImageSubresourceLayers; + srcOffset: TVkOffset3D; + dstSubresource: TVkImageSubresourceLayers; + dstOffset: TVkOffset3D; + extent: TVkExtent3D; end; - PVkPipelineInputAssemblyStateCreateInfo = ^TVkPipelineInputAssemblyStateCreateInfo; - PPVkPipelineInputAssemblyStateCreateInfo = ^PVkPipelineInputAssemblyStateCreateInfo; + PVkImageCopy = ^TVkImageCopy; + PPVkImageCopy = ^PVkImageCopy; - TVkPipelineMultisampleStateCreateInfo = record - sType: TVkStructureType; - pNext: PVkVoid; - flags: VkPipelineMultisampleStateCreateFlags; - rasterizationSamples: TVkSampleCountFlagBits; - sampleShadingEnable: VkBool32; - minSampleShading: VkFloat; - pSampleMask: PVkSampleMask; - alphaToCoverageEnable: VkBool32; - alphaToOneEnable: VkBool32; + TVkImageBlit = record + srcSubresource: TVkImageSubresourceLayers; + srcOffsets: array[0..2] of TVkOffset3D; + dstSubresource: TVkImageSubresourceLayers; + dstOffsets: array[0..2] of TVkOffset3D; end; - PVkPipelineMultisampleStateCreateInfo = ^TVkPipelineMultisampleStateCreateInfo; - PPVkPipelineMultisampleStateCreateInfo = ^PVkPipelineMultisampleStateCreateInfo; + PVkImageBlit = ^TVkImageBlit; + PPVkImageBlit = ^PVkImageBlit; - TVkPipelineRasterizationStateCreateInfo = record - sType: TVkStructureType; - pNext: PVkVoid; - flags: VkPipelineRasterizationStateCreateFlags; - depthClampEnable: VkBool32; - rasterizerDiscardEnable: VkBool32; - polygonMode: TVkPolygonMode; - cullMode: VkCullModeFlags; - frontFace: TVkFrontFace; - depthBiasEnable: VkBool32; - depthBiasConstantFactor: VkFloat; - depthBiasClamp: VkFloat; - depthBiasSlopeFactor: VkFloat; - lineWidth: VkFloat; + TVkBufferImageCopy = record + bufferOffset: VkDeviceSize; + bufferRowLength: VkUint32; + bufferImageHeight: VkUint32; + imageSubresource: TVkImageSubresourceLayers; + imageOffset: TVkOffset3D; + imageExtent: TVkExtent3D; end; - PVkPipelineRasterizationStateCreateInfo = ^TVkPipelineRasterizationStateCreateInfo; - PPVkPipelineRasterizationStateCreateInfo = ^PVkPipelineRasterizationStateCreateInfo; + PVkBufferImageCopy = ^TVkBufferImageCopy; + PPVkBufferImageCopy = ^PVkBufferImageCopy; - TVkSubmitInfo = record - sType: TVkStructureType; - pNext: PVkVoid; - waitSemaphoreCount: VkUint32; - pWaitSemaphores: PVkSemaphore; - pWaitDstStageMask: PVkPipelineStageFlags; - commandBufferCount: VkUint32; - pCommandBuffers: PVkCommandBuffer; - signalSemaphoreCount: VkUint32; - pSignalSemaphores: PVkSemaphore; + TVkClearColorValue = record + case Integer of + 000: (float32: array[0..4] of VkFloat); + 001: (int32: array[0..4] of VkInt32); + 002: (uint32: array[0..4] of VkUint32); end; - PVkSubmitInfo = ^TVkSubmitInfo; - PPVkSubmitInfo = ^PVkSubmitInfo; + PVkClearColorValue = ^TVkClearColorValue; + PPVkClearColorValue = ^PVkClearColorValue; - TVkPipelineTessellationStateCreateInfo = record - sType: TVkStructureType; - pNext: PVkVoid; - flags: VkPipelineTessellationStateCreateFlags; - patchControlPoints: VkUint32; + TVkClearDepthStencilValue = record + depth: VkFloat; + stencil: VkUint32; end; - PVkPipelineTessellationStateCreateInfo = ^TVkPipelineTessellationStateCreateInfo; - PPVkPipelineTessellationStateCreateInfo = ^PVkPipelineTessellationStateCreateInfo; + PVkClearDepthStencilValue = ^TVkClearDepthStencilValue; + PPVkClearDepthStencilValue = ^PVkClearDepthStencilValue; - TVkQueryPoolCreateInfo = record - sType: TVkStructureType; - pNext: PVkVoid; - flags: VkQueryPoolCreateFlags; - queryType: TVkQueryType; - queryCount: VkUint32; - pipelineStatistics: VkQueryPipelineStatisticFlags; + TVkClearValue = record + case Integer of + 000: (color: TVkClearColorValue); + 001: (depthStencil: TVkClearDepthStencilValue); end; - PVkQueryPoolCreateInfo = ^TVkQueryPoolCreateInfo; - PPVkQueryPoolCreateInfo = ^PVkQueryPoolCreateInfo; + PVkClearValue = ^TVkClearValue; + PPVkClearValue = ^PVkClearValue; - TVkSamplerCreateInfo = record - sType: TVkStructureType; - pNext: PVkVoid; - flags: VkSamplerCreateFlags; - magFilter: TVkFilter; - minFilter: TVkFilter; - mipmapMode: TVkSamplerMipmapMode; - addressModeU: TVkSamplerAddressMode; - addressModeV: TVkSamplerAddressMode; - addressModeW: TVkSamplerAddressMode; - mipLodBias: VkFloat; - anisotropyEnable: VkBool32; - maxAnisotropy: VkFloat; - compareEnable: VkBool32; - compareOp: TVkCompareOp; - minLod: VkFloat; - maxLod: VkFloat; - borderColor: TVkBorderColor; - unnormalizedCoordinates: VkBool32; + TVkClearAttachment = record + aspectMask: VkImageAspectFlags; + colorAttachment: VkUint32; + clearValue: TVkClearValue; end; - PVkSamplerCreateInfo = ^TVkSamplerCreateInfo; - PPVkSamplerCreateInfo = ^PVkSamplerCreateInfo; + PVkClearAttachment = ^TVkClearAttachment; + PPVkClearAttachment = ^PVkClearAttachment; - TVkSemaphoreCreateInfo = record + TVkClearRect = record + rect: TVkRect2D; + baseArrayLayer: VkUint32; + layerCount: VkUint32; + end; + PVkClearRect = ^TVkClearRect; + PPVkClearRect = ^PVkClearRect; + + TVkImageResolve = record + srcSubresource: TVkImageSubresourceLayers; + srcOffset: TVkOffset3D; + dstSubresource: TVkImageSubresourceLayers; + dstOffset: TVkOffset3D; + extent: TVkExtent3D; + end; + PVkImageResolve = ^TVkImageResolve; + PPVkImageResolve = ^PVkImageResolve; + + TVkMemoryBarrier = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkSemaphoreCreateFlags; + srcAccessMask: VkAccessFlags; + dstAccessMask: VkAccessFlags; end; - PVkSemaphoreCreateInfo = ^TVkSemaphoreCreateInfo; - PPVkSemaphoreCreateInfo = ^PVkSemaphoreCreateInfo; + PVkMemoryBarrier = ^TVkMemoryBarrier; + PPVkMemoryBarrier = ^PVkMemoryBarrier; - TVkShaderModuleCreateInfo = record + TVkBufferMemoryBarrier = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkShaderModuleCreateFlags; - codeSize: VkSize; - pCode: PVkUint32; + srcAccessMask: VkAccessFlags; + dstAccessMask: VkAccessFlags; + srcQueueFamilyIndex: VkUint32; + dstQueueFamilyIndex: VkUint32; + buffer: VkBuffer; + offset: VkDeviceSize; + size: VkDeviceSize; end; - PVkShaderModuleCreateInfo = ^TVkShaderModuleCreateInfo; - PPVkShaderModuleCreateInfo = ^PVkShaderModuleCreateInfo; + PVkBufferMemoryBarrier = ^TVkBufferMemoryBarrier; + PPVkBufferMemoryBarrier = ^PVkBufferMemoryBarrier; TVkImageMemoryBarrier = record sType: TVkStructureType; @@ -2132,477 +2721,1676 @@ type { structs } PVkImageMemoryBarrier = ^TVkImageMemoryBarrier; PPVkImageMemoryBarrier = ^PVkImageMemoryBarrier; - TVkPipelineLayoutCreateInfo = record + TVkRenderPassBeginInfo = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkPipelineLayoutCreateFlags; - setLayoutCount: VkUint32; - pSetLayouts: PVkDescriptorSetLayout; - pushConstantRangeCount: VkUint32; - pPushConstantRanges: PVkPushConstantRange; + renderPass: VkRenderPass; + framebuffer: VkFramebuffer; + renderArea: TVkRect2D; + clearValueCount: VkUint32; + pClearValues: PVkClearValue; end; - PVkPipelineLayoutCreateInfo = ^TVkPipelineLayoutCreateInfo; - PPVkPipelineLayoutCreateInfo = ^PVkPipelineLayoutCreateInfo; + PVkRenderPassBeginInfo = ^TVkRenderPassBeginInfo; + PPVkRenderPassBeginInfo = ^PVkRenderPassBeginInfo; - TVkPipelineViewportStateCreateInfo = record + TVkDispatchIndirectCommand = record + x: VkUint32; + y: VkUint32; + z: VkUint32; + end; + PVkDispatchIndirectCommand = ^TVkDispatchIndirectCommand; + PPVkDispatchIndirectCommand = ^PVkDispatchIndirectCommand; + + TVkDrawIndexedIndirectCommand = record + indexCount: VkUint32; + instanceCount: VkUint32; + firstIndex: VkUint32; + vertexOffset: VkInt32; + firstInstance: VkUint32; + end; + PVkDrawIndexedIndirectCommand = ^TVkDrawIndexedIndirectCommand; + PPVkDrawIndexedIndirectCommand = ^PVkDrawIndexedIndirectCommand; + + TVkDrawIndirectCommand = record + vertexCount: VkUint32; + instanceCount: VkUint32; + firstVertex: VkUint32; + firstInstance: VkUint32; + end; + PVkDrawIndirectCommand = ^TVkDrawIndirectCommand; + PPVkDrawIndirectCommand = ^PVkDrawIndirectCommand; + +{ ========================================== VK_KHR_surface ========================================== } + TVkSurfaceCapabilitiesKHR = record + minImageCount: VkUint32; + maxImageCount: VkUint32; + currentExtent: TVkExtent2D; + minImageExtent: TVkExtent2D; + maxImageExtent: TVkExtent2D; + maxImageArrayLayers: VkUint32; + supportedTransforms: VkSurfaceTransformFlagsKHR; + currentTransform: TVkSurfaceTransformFlagBitsKHR; + supportedCompositeAlpha: VkCompositeAlphaFlagsKHR; + supportedUsageFlags: VkImageUsageFlags; + end; + PVkSurfaceCapabilitiesKHR = ^TVkSurfaceCapabilitiesKHR; + PPVkSurfaceCapabilitiesKHR = ^PVkSurfaceCapabilitiesKHR; + + TVkSurfaceFormatKHR = record + format: TVkFormat; + colorSpace: TVkColorSpaceKHR; + end; + PVkSurfaceFormatKHR = ^TVkSurfaceFormatKHR; + PPVkSurfaceFormatKHR = ^PVkSurfaceFormatKHR; + +{ ========================================= VK_KHR_swapchain ========================================= } + TVkSwapchainCreateInfoKHR = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkPipelineViewportStateCreateFlags; - viewportCount: VkUint32; - pViewports: PVkViewport; - scissorCount: VkUint32; - pScissors: PVkRect2D; + flags: VkSwapchainCreateFlagsKHR; + surface: VkSurfaceKHR; + minImageCount: VkUint32; + imageFormat: TVkFormat; + imageColorSpace: TVkColorSpaceKHR; + imageExtent: TVkExtent2D; + imageArrayLayers: VkUint32; + imageUsage: VkImageUsageFlags; + imageSharingMode: TVkSharingMode; + queueFamilyIndexCount: VkUint32; + pQueueFamilyIndices: PVkUint32; + preTransform: TVkSurfaceTransformFlagBitsKHR; + compositeAlpha: TVkCompositeAlphaFlagBitsKHR; + presentMode: TVkPresentModeKHR; + clipped: VkBool32; + oldSwapchain: VkSwapchainKHR; end; - PVkPipelineViewportStateCreateInfo = ^TVkPipelineViewportStateCreateInfo; - PPVkPipelineViewportStateCreateInfo = ^PVkPipelineViewportStateCreateInfo; + PVkSwapchainCreateInfoKHR = ^TVkSwapchainCreateInfoKHR; + PPVkSwapchainCreateInfoKHR = ^PVkSwapchainCreateInfoKHR; - TVkImageViewCreateInfo = record + TVkPresentInfoKHR = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkImageViewCreateFlags; - image: VkImage; - viewType: TVkImageViewType; - format: TVkFormat; - components: TVkComponentMapping; - subresourceRange: TVkImageSubresourceRange; + waitSemaphoreCount: VkUint32; + pWaitSemaphores: PVkSemaphore; + swapchainCount: VkUint32; + pSwapchains: PVkSwapchainKHR; + pImageIndices: PVkUint32; + pResults: PVkResult; end; - PVkImageViewCreateInfo = ^TVkImageViewCreateInfo; - PPVkImageViewCreateInfo = ^PVkImageViewCreateInfo; + PVkPresentInfoKHR = ^TVkPresentInfoKHR; + PPVkPresentInfoKHR = ^PVkPresentInfoKHR; + +{ ========================================== VK_KHR_display ========================================== } + TVkDisplayPropertiesKHR = record + display: VkDisplayKHR; + displayName: PVkChar; + physicalDimensions: TVkExtent2D; + physicalResolution: TVkExtent2D; + supportedTransforms: VkSurfaceTransformFlagsKHR; + planeReorderPossible: VkBool32; + persistentContent: VkBool32; + end; + PVkDisplayPropertiesKHR = ^TVkDisplayPropertiesKHR; + PPVkDisplayPropertiesKHR = ^PVkDisplayPropertiesKHR; - TVkPipelineDepthStencilStateCreateInfo = record + TVkDisplayModeParametersKHR = record + visibleRegion: TVkExtent2D; + refreshRate: VkUint32; + end; + PVkDisplayModeParametersKHR = ^TVkDisplayModeParametersKHR; + PPVkDisplayModeParametersKHR = ^PVkDisplayModeParametersKHR; + + TVkDisplayModePropertiesKHR = record + displayMode: VkDisplayModeKHR; + parameters: TVkDisplayModeParametersKHR; + end; + PVkDisplayModePropertiesKHR = ^TVkDisplayModePropertiesKHR; + PPVkDisplayModePropertiesKHR = ^PVkDisplayModePropertiesKHR; + + TVkDisplayModeCreateInfoKHR = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkPipelineDepthStencilStateCreateFlags; - depthTestEnable: VkBool32; - depthWriteEnable: VkBool32; - depthCompareOp: TVkCompareOp; - depthBoundsTestEnable: VkBool32; - stencilTestEnable: VkBool32; - front: TVkStencilOpState; - back: TVkStencilOpState; - minDepthBounds: VkFloat; - maxDepthBounds: VkFloat; + flags: VkDisplayModeCreateFlagsKHR; + parameters: TVkDisplayModeParametersKHR; end; - PVkPipelineDepthStencilStateCreateInfo = ^TVkPipelineDepthStencilStateCreateInfo; - PPVkPipelineDepthStencilStateCreateInfo = ^PVkPipelineDepthStencilStateCreateInfo; + PVkDisplayModeCreateInfoKHR = ^TVkDisplayModeCreateInfoKHR; + PPVkDisplayModeCreateInfoKHR = ^PVkDisplayModeCreateInfoKHR; + + TVkDisplayPlaneCapabilitiesKHR = record + supportedAlpha: VkDisplayPlaneAlphaFlagsKHR; + minSrcPosition: TVkOffset2D; + maxSrcPosition: TVkOffset2D; + minSrcExtent: TVkExtent2D; + maxSrcExtent: TVkExtent2D; + minDstPosition: TVkOffset2D; + maxDstPosition: TVkOffset2D; + minDstExtent: TVkExtent2D; + maxDstExtent: TVkExtent2D; + end; + PVkDisplayPlaneCapabilitiesKHR = ^TVkDisplayPlaneCapabilitiesKHR; + PPVkDisplayPlaneCapabilitiesKHR = ^PVkDisplayPlaneCapabilitiesKHR; - TVkPipelineVertexInputStateCreateInfo = record + TVkDisplayPlanePropertiesKHR = record + currentDisplay: VkDisplayKHR; + currentStackIndex: VkUint32; + end; + PVkDisplayPlanePropertiesKHR = ^TVkDisplayPlanePropertiesKHR; + PPVkDisplayPlanePropertiesKHR = ^PVkDisplayPlanePropertiesKHR; + + TVkDisplaySurfaceCreateInfoKHR = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkPipelineVertexInputStateCreateFlags; - vertexBindingDescriptionCount: VkUint32; - pVertexBindingDescriptions: PVkVertexInputBindingDescription; - vertexAttributeDescriptionCount: VkUint32; - pVertexAttributeDescriptions: PVkVertexInputAttributeDescription; + flags: VkDisplaySurfaceCreateFlagsKHR; + displayMode: VkDisplayModeKHR; + planeIndex: VkUint32; + planeStackIndex: VkUint32; + transform: TVkSurfaceTransformFlagBitsKHR; + globalAlpha: VkFloat; + alphaMode: TVkDisplayPlaneAlphaFlagBitsKHR; + imageExtent: TVkExtent2D; end; - PVkPipelineVertexInputStateCreateInfo = ^TVkPipelineVertexInputStateCreateInfo; - PPVkPipelineVertexInputStateCreateInfo = ^PVkPipelineVertexInputStateCreateInfo; + PVkDisplaySurfaceCreateInfoKHR = ^TVkDisplaySurfaceCreateInfoKHR; + PPVkDisplaySurfaceCreateInfoKHR = ^PVkDisplaySurfaceCreateInfoKHR; - TVkInstanceCreateInfo = record +{ ===================================== VK_KHR_display_swapchain ===================================== } + TVkDisplayPresentInfoKHR = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkInstanceCreateFlags; - pApplicationInfo: PVkApplicationInfo; - enabledLayerCount: VkUint32; - ppEnabledLayerNames: PPVkChar; - enabledExtensionCount: VkUint32; - ppEnabledExtensionNames: PPVkChar; + srcRect: TVkRect2D; + dstRect: TVkRect2D; + persistent: VkBool32; end; - PVkInstanceCreateInfo = ^TVkInstanceCreateInfo; - PPVkInstanceCreateInfo = ^PVkInstanceCreateInfo; + PVkDisplayPresentInfoKHR = ^TVkDisplayPresentInfoKHR; + PPVkDisplayPresentInfoKHR = ^PVkDisplayPresentInfoKHR; - TVkWriteDescriptorSet = record +{ ======================================= VK_KHR_xlib_surface ======================================== } +{$IFDEF VK_USE_PLATFORM_XLIB_KHR} + TVkXlibSurfaceCreateInfoKHR = record sType: TVkStructureType; pNext: PVkVoid; - dstSet: VkDescriptorSet; - dstBinding: VkUint32; - dstArrayElement: VkUint32; - descriptorCount: VkUint32; - descriptorType: TVkDescriptorType; - pImageInfo: PVkDescriptorImageInfo; - pBufferInfo: PVkDescriptorBufferInfo; - pTexelBufferView: PVkBufferView; + flags: VkXlibSurfaceCreateFlagsKHR; + dpy: Display; + window: Window; end; - PVkWriteDescriptorSet = ^TVkWriteDescriptorSet; - PPVkWriteDescriptorSet = ^PVkWriteDescriptorSet; + PVkXlibSurfaceCreateInfoKHR = ^TVkXlibSurfaceCreateInfoKHR; + PPVkXlibSurfaceCreateInfoKHR = ^PVkXlibSurfaceCreateInfoKHR; +{$ENDIF} - TVkRenderPassBeginInfo = record +{ ======================================== VK_KHR_xcb_surface ======================================== } +{$IFDEF VK_USE_PLATFORM_XCB_KHR} + TVkXcbSurfaceCreateInfoKHR = record sType: TVkStructureType; pNext: PVkVoid; - renderPass: VkRenderPass; - framebuffer: VkFramebuffer; - renderArea: TVkRect2D; - clearValueCount: VkUint32; - pClearValues: PVkClearValue; + flags: VkXcbSurfaceCreateFlagsKHR; + connection: xcb_connection_t; + window: xcb_window_t; end; - PVkRenderPassBeginInfo = ^TVkRenderPassBeginInfo; - PPVkRenderPassBeginInfo = ^PVkRenderPassBeginInfo; + PVkXcbSurfaceCreateInfoKHR = ^TVkXcbSurfaceCreateInfoKHR; + PPVkXcbSurfaceCreateInfoKHR = ^PVkXcbSurfaceCreateInfoKHR; +{$ENDIF} - TVkPipelineShaderStageCreateInfo = record +{ ====================================== VK_KHR_wayland_surface ====================================== } +{$IFDEF VK_USE_PLATFORM_WAYLAND_KHR} + TVkWaylandSurfaceCreateInfoKHR = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkPipelineShaderStageCreateFlags; - stage: TVkShaderStageFlagBits; - module: VkShaderModule; - pName: PVkChar; - pSpecializationInfo: PVkSpecializationInfo; + flags: VkWaylandSurfaceCreateFlagsKHR; + display: wl_display; + surface: wl_surface; end; - PVkPipelineShaderStageCreateInfo = ^TVkPipelineShaderStageCreateInfo; - PPVkPipelineShaderStageCreateInfo = ^PVkPipelineShaderStageCreateInfo; + PVkWaylandSurfaceCreateInfoKHR = ^TVkWaylandSurfaceCreateInfoKHR; + PPVkWaylandSurfaceCreateInfoKHR = ^PVkWaylandSurfaceCreateInfoKHR; +{$ENDIF} - TVkPipelineColorBlendStateCreateInfo = record +{ ======================================== VK_KHR_mir_surface ======================================== } +{$IFDEF VK_USE_PLATFORM_MIR_KHR} + TVkMirSurfaceCreateInfoKHR = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkPipelineColorBlendStateCreateFlags; - logicOpEnable: VkBool32; - logicOp: TVkLogicOp; - attachmentCount: VkUint32; - pAttachments: PVkPipelineColorBlendAttachmentState; - blendConstants: array[0..4] of VkFloat; + flags: VkMirSurfaceCreateFlagsKHR; + connection: MirConnection; + mirSurface: MirSurface; end; - PVkPipelineColorBlendStateCreateInfo = ^TVkPipelineColorBlendStateCreateInfo; - PPVkPipelineColorBlendStateCreateInfo = ^PVkPipelineColorBlendStateCreateInfo; + PVkMirSurfaceCreateInfoKHR = ^TVkMirSurfaceCreateInfoKHR; + PPVkMirSurfaceCreateInfoKHR = ^PVkMirSurfaceCreateInfoKHR; +{$ENDIF} - TVkRenderPassCreateInfo = record +{ ====================================== VK_KHR_android_surface ====================================== } +{$IFDEF VK_USE_PLATFORM_ANDROID_KHR} + TVkAndroidSurfaceCreateInfoKHR = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkRenderPassCreateFlags; - attachmentCount: VkUint32; - pAttachments: PVkAttachmentDescription; - subpassCount: VkUint32; - pSubpasses: PVkSubpassDescription; - dependencyCount: VkUint32; - pDependencies: PVkSubpassDependency; + flags: VkAndroidSurfaceCreateFlagsKHR; + window: ANativeWindow; end; - PVkRenderPassCreateInfo = ^TVkRenderPassCreateInfo; - PPVkRenderPassCreateInfo = ^PVkRenderPassCreateInfo; + PVkAndroidSurfaceCreateInfoKHR = ^TVkAndroidSurfaceCreateInfoKHR; + PPVkAndroidSurfaceCreateInfoKHR = ^PVkAndroidSurfaceCreateInfoKHR; +{$ENDIF} - TVkComputePipelineCreateInfo = record +{ ======================================= VK_KHR_win32_surface ======================================= } +{$IFDEF VK_USE_PLATFORM_WIN32_KHR} + TVkWin32SurfaceCreateInfoKHR = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkPipelineCreateFlags; - stage: TVkPipelineShaderStageCreateInfo; - layout: VkPipelineLayout; - basePipelineHandle: VkPipeline; - basePipelineIndex: VkInt32; + flags: VkWin32SurfaceCreateFlagsKHR; + hinstance: HINSTANCE; + hwnd: HWND; end; - PVkComputePipelineCreateInfo = ^TVkComputePipelineCreateInfo; - PPVkComputePipelineCreateInfo = ^PVkComputePipelineCreateInfo; + PVkWin32SurfaceCreateInfoKHR = ^TVkWin32SurfaceCreateInfoKHR; + PPVkWin32SurfaceCreateInfoKHR = ^PVkWin32SurfaceCreateInfoKHR; +{$ENDIF} - TVkGraphicsPipelineCreateInfo = record +{ ======================================= VK_EXT_debug_report ======================================== } + TVkDebugReportCallbackCreateInfoEXT = record sType: TVkStructureType; pNext: PVkVoid; - flags: VkPipelineCreateFlags; - stageCount: VkUint32; - pStages: PVkPipelineShaderStageCreateInfo; - pVertexInputState: PVkPipelineVertexInputStateCreateInfo; - pInputAssemblyState: PVkPipelineInputAssemblyStateCreateInfo; - pTessellationState: PVkPipelineTessellationStateCreateInfo; - pViewportState: PVkPipelineViewportStateCreateInfo; - pRasterizationState: PVkPipelineRasterizationStateCreateInfo; - pMultisampleState: PVkPipelineMultisampleStateCreateInfo; - pDepthStencilState: PVkPipelineDepthStencilStateCreateInfo; - pColorBlendState: PVkPipelineColorBlendStateCreateInfo; - pDynamicState: PVkPipelineDynamicStateCreateInfo; - layout: VkPipelineLayout; - renderPass: VkRenderPass; - subpass: VkUint32; - basePipelineHandle: VkPipeline; - basePipelineIndex: VkInt32; + flags: VkDebugReportFlagsEXT; + pfnCallback: TvkDebugReportCallbackEXT; + pUserData: PVkVoid; end; - PVkGraphicsPipelineCreateInfo = ^TVkGraphicsPipelineCreateInfo; - PPVkGraphicsPipelineCreateInfo = ^PVkGraphicsPipelineCreateInfo; + PVkDebugReportCallbackCreateInfoEXT = ^TVkDebugReportCallbackCreateInfoEXT; + PPVkDebugReportCallbackCreateInfoEXT = ^PVkDebugReportCallbackCreateInfoEXT; type { commands } - TvkCmdDispatch = procedure(commandBuffer: VkCommandBuffer; x: VkUint32; y: VkUint32; z: VkUint32); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdDraw = procedure(commandBuffer: VkCommandBuffer; vertexCount: VkUint32; instanceCount: VkUint32; firstVertex: VkUint32; firstInstance: VkUint32); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdDrawIndexed = procedure(commandBuffer: VkCommandBuffer; indexCount: VkUint32; instanceCount: VkUint32; firstIndex: VkUint32; vertexOffset: VkInt32; firstInstance: VkUint32); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdEndRenderPass = procedure(commandBuffer: VkCommandBuffer); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdExecuteCommands = procedure(commandBuffer: VkCommandBuffer; commandBufferCount: VkUint32; const pCommandBuffers: PVkCommandBuffer); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdSetBlendConstants = procedure(commandBuffer: VkCommandBuffer; const blendConstants: VkFloat); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdSetDepthBias = procedure(commandBuffer: VkCommandBuffer; depthBiasConstantFactor: VkFloat; depthBiasClamp: VkFloat; depthBiasSlopeFactor: VkFloat); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkDeviceWaitIdle = function (device: VkDevice): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkGetDeviceProcAddr = function (device: VkDevice; const pName: PVkChar): TvkVoidFunction; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkGetInstanceProcAddr = function (instance: VkInstance; const pName: PVkChar): TvkVoidFunction; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkEnumeratePhysicalDevices = function (instance: VkInstance; pPhysicalDeviceCount: PVkUint32; pPhysicalDevices: PVkPhysicalDevice): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkGetDeviceQueue = procedure(device: VkDevice; queueFamilyIndex: VkUint32; queueIndex: VkUint32; pQueue: PVkQueue); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkQueueWaitIdle = function (queue: VkQueue): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdSetDepthBounds = procedure(commandBuffer: VkCommandBuffer; minDepthBounds: VkFloat; maxDepthBounds: VkFloat); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdSetLineWidth = procedure(commandBuffer: VkCommandBuffer; lineWidth: VkFloat); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkEndCommandBuffer = function (commandBuffer: VkCommandBuffer): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkFreeCommandBuffers = procedure(device: VkDevice; commandPool: VkCommandPool; commandBufferCount: VkUint32; const pCommandBuffers: PVkCommandBuffer); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkFreeDescriptorSets = function (device: VkDevice; descriptorPool: VkDescriptorPool; descriptorSetCount: VkUint32; const pDescriptorSets: PVkDescriptorSet): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkUnmapMemory = procedure(device: VkDevice; memory: VkDeviceMemory); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkGetEventStatus = function (device: VkDevice; event: VkEvent): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkResetEvent = function (device: VkDevice; event: VkEvent): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkSetEvent = function (device: VkDevice; event: VkEvent): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkGetFenceStatus = function (device: VkDevice; fence: VkFence): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkResetFences = function (device: VkDevice; fenceCount: VkUint32; const pFences: PVkFence): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkGetPipelineCacheData = function (device: VkDevice; pipelineCache: VkPipelineCache; pDataSize: PVkSize; pData: PVkVoid): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkMergePipelineCaches = function (device: VkDevice; dstCache: VkPipelineCache; srcCacheCount: VkUint32; const pSrcCaches: PVkPipelineCache): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdEndQuery = procedure(commandBuffer: VkCommandBuffer; queryPool: VkQueryPool; query: VkUint32); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdResetQueryPool = procedure(commandBuffer: VkCommandBuffer; queryPool: VkQueryPool; firstQuery: VkUint32; queryCount: VkUint32); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkWaitForFences = function (device: VkDevice; fenceCount: VkUint32; const pFences: PVkFence; waitAll: VkBool32; timeout: VkUint64): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkGetRenderAreaGranularity = procedure(device: VkDevice; renderPass: VkRenderPass; pGranularity: PVkExtent2D); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkBindBufferMemory = function (device: VkDevice; buffer: VkBuffer; memory: VkDeviceMemory; memoryOffset: VkDeviceSize): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkBindImageMemory = function (device: VkDevice; image: VkImage; memory: VkDeviceMemory; memoryOffset: VkDeviceSize): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdBindVertexBuffers = procedure(commandBuffer: VkCommandBuffer; firstBinding: VkUint32; bindingCount: VkUint32; const pBuffers: PVkBuffer; const pOffsets: PVkDeviceSize); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdDispatchIndirect = procedure(commandBuffer: VkCommandBuffer; buffer: VkBuffer; offset: VkDeviceSize); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdDrawIndexedIndirect = procedure(commandBuffer: VkCommandBuffer; buffer: VkBuffer; offset: VkDeviceSize; drawCount: VkUint32; stride: VkUint32); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdDrawIndirect = procedure(commandBuffer: VkCommandBuffer; buffer: VkBuffer; offset: VkDeviceSize; drawCount: VkUint32; stride: VkUint32); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdFillBuffer = procedure(commandBuffer: VkCommandBuffer; dstBuffer: VkBuffer; dstOffset: VkDeviceSize; size: VkDeviceSize; data: VkUint32); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdUpdateBuffer = procedure(commandBuffer: VkCommandBuffer; dstBuffer: VkBuffer; dstOffset: VkDeviceSize; dataSize: VkDeviceSize; const pData: PVkUint32); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkGetDeviceMemoryCommitment = procedure(device: VkDevice; memory: VkDeviceMemory; pCommittedMemoryInBytes: PVkDeviceSize); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkResetCommandBuffer = function (commandBuffer: VkCommandBuffer; flags: VkCommandBufferResetFlags): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkResetCommandPool = function (device: VkDevice; commandPool: VkCommandPool; flags: VkCommandPoolResetFlags): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkResetDescriptorPool = function (device: VkDevice; descriptorPool: VkDescriptorPool; flags: VkDescriptorPoolResetFlags): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkMapMemory = function (device: VkDevice; memory: VkDeviceMemory; offset: VkDeviceSize; size: VkDeviceSize; flags: VkMemoryMapFlags; ppData: PPVkVoid): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdResetEvent = procedure(commandBuffer: VkCommandBuffer; event: VkEvent; stageMask: VkPipelineStageFlags); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdSetEvent = procedure(commandBuffer: VkCommandBuffer; event: VkEvent; stageMask: VkPipelineStageFlags); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdBeginQuery = procedure(commandBuffer: VkCommandBuffer; queryPool: VkQueryPool; query: VkUint32; flags: VkQueryControlFlags); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdCopyQueryPoolResults = procedure(commandBuffer: VkCommandBuffer; queryPool: VkQueryPool; firstQuery: VkUint32; queryCount: VkUint32; dstBuffer: VkBuffer; dstOffset: VkDeviceSize; stride: VkDeviceSize; flags: VkQueryResultFlags); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkGetQueryPoolResults = function (device: VkDevice; queryPool: VkQueryPool; firstQuery: VkUint32; queryCount: VkUint32; dataSize: VkSize; pData: PVkVoid; stride: VkDeviceSize; flags: VkQueryResultFlags): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdPushConstants = procedure(commandBuffer: VkCommandBuffer; layout: VkPipelineLayout; stageFlags: VkShaderStageFlags; offset: VkUint32; size: VkUint32; const pValues: PVkVoid); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdSetStencilCompareMask = procedure(commandBuffer: VkCommandBuffer; faceMask: VkStencilFaceFlags; compareMask: VkUint32); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdSetStencilReference = procedure(commandBuffer: VkCommandBuffer; faceMask: VkStencilFaceFlags; reference: VkUint32); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdSetStencilWriteMask = procedure(commandBuffer: VkCommandBuffer; faceMask: VkStencilFaceFlags; writeMask: VkUint32); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdBindPipeline = procedure(commandBuffer: VkCommandBuffer; pipelineBindPoint: TVkPipelineBindPoint; pipeline: VkPipeline); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdBindDescriptorSets = procedure(commandBuffer: VkCommandBuffer; pipelineBindPoint: TVkPipelineBindPoint; layout: VkPipelineLayout; firstSet: VkUint32; descriptorSetCount: VkUint32; const pDescriptorSets: PVkDescriptorSet; dynamicOffsetCount: VkUint32; const pDynamicOffsets: PVkUint32); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdSetViewport = procedure(commandBuffer: VkCommandBuffer; firstViewport: VkUint32; viewportCount: VkUint32; const pViewports: PVkViewport); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkEnumerateDeviceExtensionProperties = function (physicalDevice: VkPhysicalDevice; const pLayerName: PVkChar; pPropertyCount: PVkUint32; pProperties: PVkExtensionProperties): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkEnumerateInstanceExtensionProperties = function (const pLayerName: PVkChar; pPropertyCount: PVkUint32; pProperties: PVkExtensionProperties): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkEnumerateDeviceLayerProperties = function (physicalDevice: VkPhysicalDevice; pPropertyCount: PVkUint32; pProperties: PVkLayerProperties): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkEnumerateInstanceLayerProperties = function (pPropertyCount: PVkUint32; pProperties: PVkLayerProperties): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdBindIndexBuffer = procedure(commandBuffer: VkCommandBuffer; buffer: VkBuffer; offset: VkDeviceSize; indexType: TVkIndexType); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkGetPhysicalDeviceFeatures = procedure(physicalDevice: VkPhysicalDevice; pFeatures: PVkPhysicalDeviceFeatures); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdCopyBuffer = procedure(commandBuffer: VkCommandBuffer; srcBuffer: VkBuffer; dstBuffer: VkBuffer; regionCount: VkUint32; const pRegions: PVkBufferCopy); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkGetBufferMemoryRequirements = procedure(device: VkDevice; buffer: VkBuffer; pMemoryRequirements: PVkMemoryRequirements); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkGetImageMemoryRequirements = procedure(device: VkDevice; image: VkImage; pMemoryRequirements: PVkMemoryRequirements); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkGetPhysicalDeviceFormatProperties = procedure(physicalDevice: VkPhysicalDevice; format: TVkFormat; pFormatProperties: PVkFormatProperties); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkGetImageSubresourceLayout = procedure(device: VkDevice; image: VkImage; const pSubresource: PVkImageSubresource; pLayout: PVkSubresourceLayout); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdClearColorImage = procedure(commandBuffer: VkCommandBuffer; image: VkImage; imageLayout: TVkImageLayout; const pColor: PVkClearColorValue; rangeCount: VkUint32; const pRanges: PVkImageSubresourceRange); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdClearDepthStencilImage = procedure(commandBuffer: VkCommandBuffer; image: VkImage; imageLayout: TVkImageLayout; const pDepthStencil: PVkClearDepthStencilValue; rangeCount: VkUint32; const pRanges: PVkImageSubresourceRange); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdSetScissor = procedure(commandBuffer: VkCommandBuffer; firstScissor: VkUint32; scissorCount: VkUint32; const pScissors: PVkRect2D); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkGetPhysicalDeviceQueueFamilyProperties = procedure(physicalDevice: VkPhysicalDevice; pQueueFamilyPropertyCount: PVkUint32; pQueueFamilyProperties: PVkQueueFamilyProperties); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkGetPhysicalDeviceImageFormatProperties = function (physicalDevice: VkPhysicalDevice; format: TVkFormat; iType: TVkImageType; tiling: TVkImageTiling; usage: VkImageUsageFlags; flags: VkImageCreateFlags; pImageFormatProperties: PVkImageFormatProperties): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkAllocateCommandBuffers = function (device: VkDevice; const pAllocateInfo: PVkCommandBufferAllocateInfo; pCommandBuffers: PVkCommandBuffer): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkAllocateDescriptorSets = function (device: VkDevice; const pAllocateInfo: PVkDescriptorSetAllocateInfo; pDescriptorSets: PVkDescriptorSet): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdCopyBufferToImage = procedure(commandBuffer: VkCommandBuffer; srcBuffer: VkBuffer; dstImage: VkImage; dstImageLayout: TVkImageLayout; regionCount: VkUint32; const pRegions: PVkBufferImageCopy); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdCopyImageToBuffer = procedure(commandBuffer: VkCommandBuffer; srcImage: VkImage; srcImageLayout: TVkImageLayout; dstBuffer: VkBuffer; regionCount: VkUint32; const pRegions: PVkBufferImageCopy); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdBlitImage = procedure(commandBuffer: VkCommandBuffer; srcImage: VkImage; srcImageLayout: TVkImageLayout; dstImage: VkImage; dstImageLayout: TVkImageLayout; regionCount: VkUint32; const pRegions: PVkImageBlit; filter: TVkFilter); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdCopyImage = procedure(commandBuffer: VkCommandBuffer; srcImage: VkImage; srcImageLayout: TVkImageLayout; dstImage: VkImage; dstImageLayout: TVkImageLayout; regionCount: VkUint32; const pRegions: PVkImageCopy); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdResolveImage = procedure(commandBuffer: VkCommandBuffer; srcImage: VkImage; srcImageLayout: TVkImageLayout; dstImage: VkImage; dstImageLayout: TVkImageLayout; regionCount: VkUint32; const pRegions: PVkImageResolve); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkGetPhysicalDeviceMemoryProperties = procedure(physicalDevice: VkPhysicalDevice; pMemoryProperties: PVkPhysicalDeviceMemoryProperties); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkGetPhysicalDeviceProperties = procedure(physicalDevice: VkPhysicalDevice; pProperties: PVkPhysicalDeviceProperties); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkGetImageSparseMemoryRequirements = procedure(device: VkDevice; image: VkImage; pSparseMemoryRequirementCount: PVkUint32; pSparseMemoryRequirements: PVkSparseImageMemoryRequirements); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCreateBuffer = function (device: VkDevice; const pCreateInfo: PVkBufferCreateInfo; const pAllocator: PVkAllocationCallbacks; pBuffer: PVkBuffer): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCreateBufferView = function (device: VkDevice; const pCreateInfo: PVkBufferViewCreateInfo; const pAllocator: PVkAllocationCallbacks; pView: PVkBufferView): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCreateCommandPool = function (device: VkDevice; const pCreateInfo: PVkCommandPoolCreateInfo; const pAllocator: PVkAllocationCallbacks; pCommandPool: PVkCommandPool): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCreateDescriptorPool = function (device: VkDevice; const pCreateInfo: PVkDescriptorPoolCreateInfo; const pAllocator: PVkAllocationCallbacks; pDescriptorPool: PVkDescriptorPool): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkDestroyBuffer = procedure(device: VkDevice; buffer: VkBuffer; const pAllocator: PVkAllocationCallbacks); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkDestroyBufferView = procedure(device: VkDevice; bufferView: VkBufferView; const pAllocator: PVkAllocationCallbacks); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkDestroyCommandPool = procedure(device: VkDevice; commandPool: VkCommandPool; const pAllocator: PVkAllocationCallbacks); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkDestroyDescriptorPool = procedure(device: VkDevice; descriptorPool: VkDescriptorPool; const pAllocator: PVkAllocationCallbacks); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkDestroyDescriptorSetLayout = procedure(device: VkDevice; descriptorSetLayout: VkDescriptorSetLayout; const pAllocator: PVkAllocationCallbacks); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkDestroyDevice = procedure(device: VkDevice; const pAllocator: PVkAllocationCallbacks); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkDestroyEvent = procedure(device: VkDevice; event: VkEvent; const pAllocator: PVkAllocationCallbacks); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkDestroyFence = procedure(device: VkDevice; fence: VkFence; const pAllocator: PVkAllocationCallbacks); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkDestroyFramebuffer = procedure(device: VkDevice; framebuffer: VkFramebuffer; const pAllocator: PVkAllocationCallbacks); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkDestroyImage = procedure(device: VkDevice; image: VkImage; const pAllocator: PVkAllocationCallbacks); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkDestroyImageView = procedure(device: VkDevice; imageView: VkImageView; const pAllocator: PVkAllocationCallbacks); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkDestroyInstance = procedure(instance: VkInstance; const pAllocator: PVkAllocationCallbacks); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkDestroyPipeline = procedure(device: VkDevice; pipeline: VkPipeline; const pAllocator: PVkAllocationCallbacks); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkDestroyPipelineCache = procedure(device: VkDevice; pipelineCache: VkPipelineCache; const pAllocator: PVkAllocationCallbacks); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkDestroyPipelineLayout = procedure(device: VkDevice; pipelineLayout: VkPipelineLayout; const pAllocator: PVkAllocationCallbacks); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkDestroyQueryPool = procedure(device: VkDevice; queryPool: VkQueryPool; const pAllocator: PVkAllocationCallbacks); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkDestroyRenderPass = procedure(device: VkDevice; renderPass: VkRenderPass; const pAllocator: PVkAllocationCallbacks); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkDestroySampler = procedure(device: VkDevice; sampler: VkSampler; const pAllocator: PVkAllocationCallbacks); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkDestroySemaphore = procedure(device: VkDevice; semaphore: VkSemaphore; const pAllocator: PVkAllocationCallbacks); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkDestroyShaderModule = procedure(device: VkDevice; shaderModule: VkShaderModule; const pAllocator: PVkAllocationCallbacks); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkFreeMemory = procedure(device: VkDevice; memory: VkDeviceMemory; const pAllocator: PVkAllocationCallbacks); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdClearAttachments = procedure(commandBuffer: VkCommandBuffer; attachmentCount: VkUint32; const pAttachments: PVkClearAttachment; rectCount: VkUint32; const pRects: PVkClearRect); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCreateDevice = function (physicalDevice: VkPhysicalDevice; const pCreateInfo: PVkDeviceCreateInfo; const pAllocator: PVkAllocationCallbacks; pDevice: PVkDevice): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkBeginCommandBuffer = function (commandBuffer: VkCommandBuffer; const pBeginInfo: PVkCommandBufferBeginInfo): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCreateDescriptorSetLayout = function (device: VkDevice; const pCreateInfo: PVkDescriptorSetLayoutCreateInfo; const pAllocator: PVkAllocationCallbacks; pSetLayout: PVkDescriptorSetLayout): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkQueueBindSparse = function (queue: VkQueue; bindInfoCount: VkUint32; const pBindInfo: PVkBindSparseInfo; fence: VkFence): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdNextSubpass = procedure(commandBuffer: VkCommandBuffer; contents: TVkSubpassContents); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdWriteTimestamp = procedure(commandBuffer: VkCommandBuffer; pipelineStage: TVkPipelineStageFlagBits; queryPool: VkQueryPool; query: VkUint32); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkGetPhysicalDeviceSparseImageFormatProperties = procedure(physicalDevice: VkPhysicalDevice; format: TVkFormat; iType: TVkImageType; samples: TVkSampleCountFlagBits; usage: VkImageUsageFlags; tiling: TVkImageTiling; pPropertyCount: PVkUint32; pProperties: PVkSparseImageFormatProperties); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkFlushMappedMemoryRanges = function (device: VkDevice; memoryRangeCount: VkUint32; const pMemoryRanges: PVkMappedMemoryRange): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkInvalidateMappedMemoryRanges = function (device: VkDevice; memoryRangeCount: VkUint32; const pMemoryRanges: PVkMappedMemoryRange): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkAllocateMemory = function (device: VkDevice; const pAllocateInfo: PVkMemoryAllocateInfo; const pAllocator: PVkAllocationCallbacks; pMemory: PVkDeviceMemory): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCreateEvent = function (device: VkDevice; const pCreateInfo: PVkEventCreateInfo; const pAllocator: PVkAllocationCallbacks; pEvent: PVkEvent): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCreateFence = function (device: VkDevice; const pCreateInfo: PVkFenceCreateInfo; const pAllocator: PVkAllocationCallbacks; pFence: PVkFence): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCreateFramebuffer = function (device: VkDevice; const pCreateInfo: PVkFramebufferCreateInfo; const pAllocator: PVkAllocationCallbacks; pFramebuffer: PVkFramebuffer): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCreateImage = function (device: VkDevice; const pCreateInfo: PVkImageCreateInfo; const pAllocator: PVkAllocationCallbacks; pImage: PVkImage): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCreatePipelineCache = function (device: VkDevice; const pCreateInfo: PVkPipelineCacheCreateInfo; const pAllocator: PVkAllocationCallbacks; pPipelineCache: PVkPipelineCache): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkQueueSubmit = function (queue: VkQueue; submitCount: VkUint32; const pSubmits: PVkSubmitInfo; fence: VkFence): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCreateQueryPool = function (device: VkDevice; const pCreateInfo: PVkQueryPoolCreateInfo; const pAllocator: PVkAllocationCallbacks; pQueryPool: PVkQueryPool): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCreateSampler = function (device: VkDevice; const pCreateInfo: PVkSamplerCreateInfo; const pAllocator: PVkAllocationCallbacks; pSampler: PVkSampler): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCreateSemaphore = function (device: VkDevice; const pCreateInfo: PVkSemaphoreCreateInfo; const pAllocator: PVkAllocationCallbacks; pSemaphore: PVkSemaphore): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCreateShaderModule = function (device: VkDevice; const pCreateInfo: PVkShaderModuleCreateInfo; const pAllocator: PVkAllocationCallbacks; pShaderModule: PVkShaderModule): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdPipelineBarrier = procedure(commandBuffer: VkCommandBuffer; srcStageMask: VkPipelineStageFlags; dstStageMask: VkPipelineStageFlags; dependencyFlags: VkDependencyFlags; memoryBarrierCount: VkUint32; const pMemoryBarriers: PVkMemoryBarrier; bufferMemoryBarrierCount: VkUint32; const pBufferMemoryBarriers: PVkBufferMemoryBarrier; imageMemoryBarrierCount: VkUint32; const pImageMemoryBarriers: PVkImageMemoryBarrier); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdWaitEvents = procedure(commandBuffer: VkCommandBuffer; eventCount: VkUint32; const pEvents: PVkEvent; srcStageMask: VkPipelineStageFlags; dstStageMask: VkPipelineStageFlags; memoryBarrierCount: VkUint32; const pMemoryBarriers: PVkMemoryBarrier; bufferMemoryBarrierCount: VkUint32; const pBufferMemoryBarriers: PVkBufferMemoryBarrier; imageMemoryBarrierCount: VkUint32; const pImageMemoryBarriers: PVkImageMemoryBarrier); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCreatePipelineLayout = function (device: VkDevice; const pCreateInfo: PVkPipelineLayoutCreateInfo; const pAllocator: PVkAllocationCallbacks; pPipelineLayout: PVkPipelineLayout): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCmdBeginRenderPass = procedure(commandBuffer: VkCommandBuffer; const pRenderPassBegin: PVkRenderPassBeginInfo; contents: TVkSubpassContents); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCreateRenderPass = function (device: VkDevice; const pCreateInfo: PVkRenderPassCreateInfo; const pAllocator: PVkAllocationCallbacks; pRenderPass: PVkRenderPass): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCreateComputePipelines = function (device: VkDevice; pipelineCache: VkPipelineCache; createInfoCount: VkUint32; const pCreateInfos: PVkComputePipelineCreateInfo; const pAllocator: PVkAllocationCallbacks; pPipelines: PVkPipeline): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCreateGraphicsPipelines = function (device: VkDevice; pipelineCache: VkPipelineCache; createInfoCount: VkUint32; const pCreateInfos: PVkGraphicsPipelineCreateInfo; const pAllocator: PVkAllocationCallbacks; pPipelines: PVkPipeline): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCreateImageView = function (device: VkDevice; const pCreateInfo: PVkImageViewCreateInfo; const pAllocator: PVkAllocationCallbacks; pView: PVkImageView): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkCreateInstance = function (const pCreateInfo: PVkInstanceCreateInfo; const pAllocator: PVkAllocationCallbacks; pInstance: PVkInstance): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - TvkUpdateDescriptorSets = procedure(device: VkDevice; descriptorWriteCount: VkUint32; const pDescriptorWrites: PVkWriteDescriptorSet; descriptorCopyCount: VkUint32; const pDescriptorCopies: PVkCopyDescriptorSet); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; - -var { command variables } - vkCmdDispatch: TvkCmdDispatch = nil; - vkCmdDraw: TvkCmdDraw = nil; - vkCmdDrawIndexed: TvkCmdDrawIndexed = nil; - vkCmdEndRenderPass: TvkCmdEndRenderPass = nil; - vkCmdExecuteCommands: TvkCmdExecuteCommands = nil; - vkCmdSetBlendConstants: TvkCmdSetBlendConstants = nil; - vkCmdSetDepthBias: TvkCmdSetDepthBias = nil; - vkDeviceWaitIdle: TvkDeviceWaitIdle = nil; - vkGetDeviceProcAddr: TvkGetDeviceProcAddr = nil; - vkGetInstanceProcAddr: TvkGetInstanceProcAddr = nil; - vkEnumeratePhysicalDevices: TvkEnumeratePhysicalDevices = nil; - vkGetDeviceQueue: TvkGetDeviceQueue = nil; - vkQueueWaitIdle: TvkQueueWaitIdle = nil; - vkCmdSetDepthBounds: TvkCmdSetDepthBounds = nil; - vkCmdSetLineWidth: TvkCmdSetLineWidth = nil; - vkEndCommandBuffer: TvkEndCommandBuffer = nil; - vkFreeCommandBuffers: TvkFreeCommandBuffers = nil; - vkFreeDescriptorSets: TvkFreeDescriptorSets = nil; - vkUnmapMemory: TvkUnmapMemory = nil; - vkGetEventStatus: TvkGetEventStatus = nil; - vkResetEvent: TvkResetEvent = nil; - vkSetEvent: TvkSetEvent = nil; - vkGetFenceStatus: TvkGetFenceStatus = nil; - vkResetFences: TvkResetFences = nil; - vkGetPipelineCacheData: TvkGetPipelineCacheData = nil; - vkMergePipelineCaches: TvkMergePipelineCaches = nil; - vkCmdEndQuery: TvkCmdEndQuery = nil; - vkCmdResetQueryPool: TvkCmdResetQueryPool = nil; - vkWaitForFences: TvkWaitForFences = nil; - vkGetRenderAreaGranularity: TvkGetRenderAreaGranularity = nil; - vkBindBufferMemory: TvkBindBufferMemory = nil; - vkBindImageMemory: TvkBindImageMemory = nil; - vkCmdBindVertexBuffers: TvkCmdBindVertexBuffers = nil; - vkCmdDispatchIndirect: TvkCmdDispatchIndirect = nil; - vkCmdDrawIndexedIndirect: TvkCmdDrawIndexedIndirect = nil; - vkCmdDrawIndirect: TvkCmdDrawIndirect = nil; - vkCmdFillBuffer: TvkCmdFillBuffer = nil; - vkCmdUpdateBuffer: TvkCmdUpdateBuffer = nil; - vkGetDeviceMemoryCommitment: TvkGetDeviceMemoryCommitment = nil; - vkResetCommandBuffer: TvkResetCommandBuffer = nil; - vkResetCommandPool: TvkResetCommandPool = nil; - vkResetDescriptorPool: TvkResetDescriptorPool = nil; - vkMapMemory: TvkMapMemory = nil; - vkCmdResetEvent: TvkCmdResetEvent = nil; - vkCmdSetEvent: TvkCmdSetEvent = nil; - vkCmdBeginQuery: TvkCmdBeginQuery = nil; - vkCmdCopyQueryPoolResults: TvkCmdCopyQueryPoolResults = nil; - vkGetQueryPoolResults: TvkGetQueryPoolResults = nil; - vkCmdPushConstants: TvkCmdPushConstants = nil; - vkCmdSetStencilCompareMask: TvkCmdSetStencilCompareMask = nil; - vkCmdSetStencilReference: TvkCmdSetStencilReference = nil; - vkCmdSetStencilWriteMask: TvkCmdSetStencilWriteMask = nil; - vkCmdBindPipeline: TvkCmdBindPipeline = nil; - vkCmdBindDescriptorSets: TvkCmdBindDescriptorSets = nil; - vkCmdSetViewport: TvkCmdSetViewport = nil; - vkEnumerateDeviceExtensionProperties: TvkEnumerateDeviceExtensionProperties = nil; - vkEnumerateInstanceExtensionProperties: TvkEnumerateInstanceExtensionProperties = nil; - vkEnumerateDeviceLayerProperties: TvkEnumerateDeviceLayerProperties = nil; - vkEnumerateInstanceLayerProperties: TvkEnumerateInstanceLayerProperties = nil; - vkCmdBindIndexBuffer: TvkCmdBindIndexBuffer = nil; - vkGetPhysicalDeviceFeatures: TvkGetPhysicalDeviceFeatures = nil; - vkCmdCopyBuffer: TvkCmdCopyBuffer = nil; - vkGetBufferMemoryRequirements: TvkGetBufferMemoryRequirements = nil; - vkGetImageMemoryRequirements: TvkGetImageMemoryRequirements = nil; - vkGetPhysicalDeviceFormatProperties: TvkGetPhysicalDeviceFormatProperties = nil; - vkGetImageSubresourceLayout: TvkGetImageSubresourceLayout = nil; - vkCmdClearColorImage: TvkCmdClearColorImage = nil; - vkCmdClearDepthStencilImage: TvkCmdClearDepthStencilImage = nil; - vkCmdSetScissor: TvkCmdSetScissor = nil; - vkGetPhysicalDeviceQueueFamilyProperties: TvkGetPhysicalDeviceQueueFamilyProperties = nil; - vkGetPhysicalDeviceImageFormatProperties: TvkGetPhysicalDeviceImageFormatProperties = nil; - vkAllocateCommandBuffers: TvkAllocateCommandBuffers = nil; - vkAllocateDescriptorSets: TvkAllocateDescriptorSets = nil; - vkCmdCopyBufferToImage: TvkCmdCopyBufferToImage = nil; - vkCmdCopyImageToBuffer: TvkCmdCopyImageToBuffer = nil; - vkCmdBlitImage: TvkCmdBlitImage = nil; - vkCmdCopyImage: TvkCmdCopyImage = nil; - vkCmdResolveImage: TvkCmdResolveImage = nil; - vkGetPhysicalDeviceMemoryProperties: TvkGetPhysicalDeviceMemoryProperties = nil; - vkGetPhysicalDeviceProperties: TvkGetPhysicalDeviceProperties = nil; - vkGetImageSparseMemoryRequirements: TvkGetImageSparseMemoryRequirements = nil; - vkCreateBuffer: TvkCreateBuffer = nil; - vkCreateBufferView: TvkCreateBufferView = nil; - vkCreateCommandPool: TvkCreateCommandPool = nil; - vkCreateDescriptorPool: TvkCreateDescriptorPool = nil; - vkDestroyBuffer: TvkDestroyBuffer = nil; - vkDestroyBufferView: TvkDestroyBufferView = nil; - vkDestroyCommandPool: TvkDestroyCommandPool = nil; - vkDestroyDescriptorPool: TvkDestroyDescriptorPool = nil; - vkDestroyDescriptorSetLayout: TvkDestroyDescriptorSetLayout = nil; - vkDestroyDevice: TvkDestroyDevice = nil; - vkDestroyEvent: TvkDestroyEvent = nil; - vkDestroyFence: TvkDestroyFence = nil; - vkDestroyFramebuffer: TvkDestroyFramebuffer = nil; - vkDestroyImage: TvkDestroyImage = nil; - vkDestroyImageView: TvkDestroyImageView = nil; - vkDestroyInstance: TvkDestroyInstance = nil; - vkDestroyPipeline: TvkDestroyPipeline = nil; - vkDestroyPipelineCache: TvkDestroyPipelineCache = nil; - vkDestroyPipelineLayout: TvkDestroyPipelineLayout = nil; - vkDestroyQueryPool: TvkDestroyQueryPool = nil; - vkDestroyRenderPass: TvkDestroyRenderPass = nil; - vkDestroySampler: TvkDestroySampler = nil; - vkDestroySemaphore: TvkDestroySemaphore = nil; - vkDestroyShaderModule: TvkDestroyShaderModule = nil; - vkFreeMemory: TvkFreeMemory = nil; - vkCmdClearAttachments: TvkCmdClearAttachments = nil; - vkCreateDevice: TvkCreateDevice = nil; - vkBeginCommandBuffer: TvkBeginCommandBuffer = nil; - vkCreateDescriptorSetLayout: TvkCreateDescriptorSetLayout = nil; - vkQueueBindSparse: TvkQueueBindSparse = nil; - vkCmdNextSubpass: TvkCmdNextSubpass = nil; - vkCmdWriteTimestamp: TvkCmdWriteTimestamp = nil; - vkGetPhysicalDeviceSparseImageFormatProperties: TvkGetPhysicalDeviceSparseImageFormatProperties = nil; - vkFlushMappedMemoryRanges: TvkFlushMappedMemoryRanges = nil; - vkInvalidateMappedMemoryRanges: TvkInvalidateMappedMemoryRanges = nil; - vkAllocateMemory: TvkAllocateMemory = nil; - vkCreateEvent: TvkCreateEvent = nil; - vkCreateFence: TvkCreateFence = nil; - vkCreateFramebuffer: TvkCreateFramebuffer = nil; - vkCreateImage: TvkCreateImage = nil; - vkCreatePipelineCache: TvkCreatePipelineCache = nil; - vkQueueSubmit: TvkQueueSubmit = nil; - vkCreateQueryPool: TvkCreateQueryPool = nil; - vkCreateSampler: TvkCreateSampler = nil; - vkCreateSemaphore: TvkCreateSemaphore = nil; - vkCreateShaderModule: TvkCreateShaderModule = nil; - vkCmdPipelineBarrier: TvkCmdPipelineBarrier = nil; - vkCmdWaitEvents: TvkCmdWaitEvents = nil; - vkCreatePipelineLayout: TvkCreatePipelineLayout = nil; - vkCmdBeginRenderPass: TvkCmdBeginRenderPass = nil; - vkCreateRenderPass: TvkCreateRenderPass = nil; - vkCreateComputePipelines: TvkCreateComputePipelines = nil; - vkCreateGraphicsPipelines: TvkCreateGraphicsPipelines = nil; - vkCreateImageView: TvkCreateImageView = nil; - vkCreateInstance: TvkCreateInstance = nil; - vkUpdateDescriptorSets: TvkUpdateDescriptorSets = nil; + +{ ========================================== VK_VERSION_1_0 ========================================== } + TvkCreateInstance = function ( + const pCreateInfo: PVkInstanceCreateInfo; + const pAllocator: PVkAllocationCallbacks; + pInstance: PVkInstance + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDestroyInstance = procedure( + instance: VkInstance; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkEnumeratePhysicalDevices = function ( + instance: VkInstance; + pPhysicalDeviceCount: PVkUint32; + pPhysicalDevices: PVkPhysicalDevice + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetPhysicalDeviceFeatures = procedure( + physicalDevice: VkPhysicalDevice; + pFeatures: PVkPhysicalDeviceFeatures + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetPhysicalDeviceFormatProperties = procedure( + physicalDevice: VkPhysicalDevice; + format: TVkFormat; + pFormatProperties: PVkFormatProperties + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetPhysicalDeviceImageFormatProperties = function ( + physicalDevice: VkPhysicalDevice; + format: TVkFormat; + iType: TVkImageType; + tiling: TVkImageTiling; + usage: VkImageUsageFlags; + flags: VkImageCreateFlags; + pImageFormatProperties: PVkImageFormatProperties + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetPhysicalDeviceProperties = procedure( + physicalDevice: VkPhysicalDevice; + pProperties: PVkPhysicalDeviceProperties + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetPhysicalDeviceQueueFamilyProperties = procedure( + physicalDevice: VkPhysicalDevice; + pQueueFamilyPropertyCount: PVkUint32; + pQueueFamilyProperties: PVkQueueFamilyProperties + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetPhysicalDeviceMemoryProperties = procedure( + physicalDevice: VkPhysicalDevice; + pMemoryProperties: PVkPhysicalDeviceMemoryProperties + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetInstanceProcAddr = function ( + instance: VkInstance; + const pName: PVkChar + ): TvkVoidFunction; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetDeviceProcAddr = function ( + device: VkDevice; + const pName: PVkChar + ): TvkVoidFunction; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCreateDevice = function ( + physicalDevice: VkPhysicalDevice; + const pCreateInfo: PVkDeviceCreateInfo; + const pAllocator: PVkAllocationCallbacks; + pDevice: PVkDevice + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDestroyDevice = procedure( + device: VkDevice; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkEnumerateInstanceExtensionProperties = function ( + const pLayerName: PVkChar; + pPropertyCount: PVkUint32; + pProperties: PVkExtensionProperties + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkEnumerateDeviceExtensionProperties = function ( + physicalDevice: VkPhysicalDevice; + const pLayerName: PVkChar; + pPropertyCount: PVkUint32; + pProperties: PVkExtensionProperties + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkEnumerateInstanceLayerProperties = function ( + pPropertyCount: PVkUint32; + pProperties: PVkLayerProperties + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkEnumerateDeviceLayerProperties = function ( + physicalDevice: VkPhysicalDevice; + pPropertyCount: PVkUint32; + pProperties: PVkLayerProperties + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetDeviceQueue = procedure( + device: VkDevice; + queueFamilyIndex: VkUint32; + queueIndex: VkUint32; + pQueue: PVkQueue + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkQueueSubmit = function ( + queue: VkQueue; + submitCount: VkUint32; + const pSubmits: PVkSubmitInfo; + fence: VkFence + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkQueueWaitIdle = function ( + queue: VkQueue + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDeviceWaitIdle = function ( + device: VkDevice + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkAllocateMemory = function ( + device: VkDevice; + const pAllocateInfo: PVkMemoryAllocateInfo; + const pAllocator: PVkAllocationCallbacks; + pMemory: PVkDeviceMemory + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkFreeMemory = procedure( + device: VkDevice; + memory: VkDeviceMemory; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkMapMemory = function ( + device: VkDevice; + memory: VkDeviceMemory; + offset: VkDeviceSize; + size: VkDeviceSize; + flags: VkMemoryMapFlags; + ppData: PPVkVoid + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkUnmapMemory = procedure( + device: VkDevice; + memory: VkDeviceMemory + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkFlushMappedMemoryRanges = function ( + device: VkDevice; + memoryRangeCount: VkUint32; + const pMemoryRanges: PVkMappedMemoryRange + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkInvalidateMappedMemoryRanges = function ( + device: VkDevice; + memoryRangeCount: VkUint32; + const pMemoryRanges: PVkMappedMemoryRange + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetDeviceMemoryCommitment = procedure( + device: VkDevice; + memory: VkDeviceMemory; + pCommittedMemoryInBytes: PVkDeviceSize + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkBindBufferMemory = function ( + device: VkDevice; + buffer: VkBuffer; + memory: VkDeviceMemory; + memoryOffset: VkDeviceSize + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkBindImageMemory = function ( + device: VkDevice; + image: VkImage; + memory: VkDeviceMemory; + memoryOffset: VkDeviceSize + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetBufferMemoryRequirements = procedure( + device: VkDevice; + buffer: VkBuffer; + pMemoryRequirements: PVkMemoryRequirements + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetImageMemoryRequirements = procedure( + device: VkDevice; + image: VkImage; + pMemoryRequirements: PVkMemoryRequirements + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetImageSparseMemoryRequirements = procedure( + device: VkDevice; + image: VkImage; + pSparseMemoryRequirementCount:PVkUint32; + pSparseMemoryRequirements: PVkSparseImageMemoryRequirements + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetPhysicalDeviceSparseImageFormatProperties = procedure( + physicalDevice: VkPhysicalDevice; + format: TVkFormat; + iType: TVkImageType; + samples: TVkSampleCountFlagBits; + usage: VkImageUsageFlags; + tiling: TVkImageTiling; + pPropertyCount: PVkUint32; + pProperties: PVkSparseImageFormatProperties + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkQueueBindSparse = function ( + queue: VkQueue; + bindInfoCount: VkUint32; + const pBindInfo: PVkBindSparseInfo; + fence: VkFence + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCreateFence = function ( + device: VkDevice; + const pCreateInfo: PVkFenceCreateInfo; + const pAllocator: PVkAllocationCallbacks; + pFence: PVkFence + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDestroyFence = procedure( + device: VkDevice; + fence: VkFence; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkResetFences = function ( + device: VkDevice; + fenceCount: VkUint32; + const pFences: PVkFence + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetFenceStatus = function ( + device: VkDevice; + fence: VkFence + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkWaitForFences = function ( + device: VkDevice; + fenceCount: VkUint32; + const pFences: PVkFence; + waitAll: VkBool32; + timeout: VkUint64 + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCreateSemaphore = function ( + device: VkDevice; + const pCreateInfo: PVkSemaphoreCreateInfo; + const pAllocator: PVkAllocationCallbacks; + pSemaphore: PVkSemaphore + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDestroySemaphore = procedure( + device: VkDevice; + semaphore: VkSemaphore; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCreateEvent = function ( + device: VkDevice; + const pCreateInfo: PVkEventCreateInfo; + const pAllocator: PVkAllocationCallbacks; + pEvent: PVkEvent + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDestroyEvent = procedure( + device: VkDevice; + event: VkEvent; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetEventStatus = function ( + device: VkDevice; + event: VkEvent + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkSetEvent = function ( + device: VkDevice; + event: VkEvent + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkResetEvent = function ( + device: VkDevice; + event: VkEvent + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCreateQueryPool = function ( + device: VkDevice; + const pCreateInfo: PVkQueryPoolCreateInfo; + const pAllocator: PVkAllocationCallbacks; + pQueryPool: PVkQueryPool + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDestroyQueryPool = procedure( + device: VkDevice; + queryPool: VkQueryPool; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetQueryPoolResults = function ( + device: VkDevice; + queryPool: VkQueryPool; + firstQuery: VkUint32; + queryCount: VkUint32; + dataSize: VkSize; + pData: PVkVoid; + stride: VkDeviceSize; + flags: VkQueryResultFlags + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCreateBuffer = function ( + device: VkDevice; + const pCreateInfo: PVkBufferCreateInfo; + const pAllocator: PVkAllocationCallbacks; + pBuffer: PVkBuffer + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDestroyBuffer = procedure( + device: VkDevice; + buffer: VkBuffer; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCreateBufferView = function ( + device: VkDevice; + const pCreateInfo: PVkBufferViewCreateInfo; + const pAllocator: PVkAllocationCallbacks; + pView: PVkBufferView + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDestroyBufferView = procedure( + device: VkDevice; + bufferView: VkBufferView; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCreateImage = function ( + device: VkDevice; + const pCreateInfo: PVkImageCreateInfo; + const pAllocator: PVkAllocationCallbacks; + pImage: PVkImage + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDestroyImage = procedure( + device: VkDevice; + image: VkImage; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetImageSubresourceLayout = procedure( + device: VkDevice; + image: VkImage; + const pSubresource: PVkImageSubresource; + pLayout: PVkSubresourceLayout + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCreateImageView = function ( + device: VkDevice; + const pCreateInfo: PVkImageViewCreateInfo; + const pAllocator: PVkAllocationCallbacks; + pView: PVkImageView + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDestroyImageView = procedure( + device: VkDevice; + imageView: VkImageView; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCreateShaderModule = function ( + device: VkDevice; + const pCreateInfo: PVkShaderModuleCreateInfo; + const pAllocator: PVkAllocationCallbacks; + pShaderModule: PVkShaderModule + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDestroyShaderModule = procedure( + device: VkDevice; + shaderModule: VkShaderModule; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCreatePipelineCache = function ( + device: VkDevice; + const pCreateInfo: PVkPipelineCacheCreateInfo; + const pAllocator: PVkAllocationCallbacks; + pPipelineCache: PVkPipelineCache + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDestroyPipelineCache = procedure( + device: VkDevice; + pipelineCache: VkPipelineCache; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetPipelineCacheData = function ( + device: VkDevice; + pipelineCache: VkPipelineCache; + pDataSize: PVkSize; + pData: PVkVoid + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkMergePipelineCaches = function ( + device: VkDevice; + dstCache: VkPipelineCache; + srcCacheCount: VkUint32; + const pSrcCaches: PVkPipelineCache + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCreateGraphicsPipelines = function ( + device: VkDevice; + pipelineCache: VkPipelineCache; + createInfoCount: VkUint32; + const pCreateInfos: PVkGraphicsPipelineCreateInfo; + const pAllocator: PVkAllocationCallbacks; + pPipelines: PVkPipeline + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCreateComputePipelines = function ( + device: VkDevice; + pipelineCache: VkPipelineCache; + createInfoCount: VkUint32; + const pCreateInfos: PVkComputePipelineCreateInfo; + const pAllocator: PVkAllocationCallbacks; + pPipelines: PVkPipeline + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDestroyPipeline = procedure( + device: VkDevice; + pipeline: VkPipeline; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCreatePipelineLayout = function ( + device: VkDevice; + const pCreateInfo: PVkPipelineLayoutCreateInfo; + const pAllocator: PVkAllocationCallbacks; + pPipelineLayout: PVkPipelineLayout + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDestroyPipelineLayout = procedure( + device: VkDevice; + pipelineLayout: VkPipelineLayout; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCreateSampler = function ( + device: VkDevice; + const pCreateInfo: PVkSamplerCreateInfo; + const pAllocator: PVkAllocationCallbacks; + pSampler: PVkSampler + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDestroySampler = procedure( + device: VkDevice; + sampler: VkSampler; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCreateDescriptorSetLayout = function ( + device: VkDevice; + const pCreateInfo: PVkDescriptorSetLayoutCreateInfo; + const pAllocator: PVkAllocationCallbacks; + pSetLayout: PVkDescriptorSetLayout + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDestroyDescriptorSetLayout = procedure( + device: VkDevice; + descriptorSetLayout: VkDescriptorSetLayout; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCreateDescriptorPool = function ( + device: VkDevice; + const pCreateInfo: PVkDescriptorPoolCreateInfo; + const pAllocator: PVkAllocationCallbacks; + pDescriptorPool: PVkDescriptorPool + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDestroyDescriptorPool = procedure( + device: VkDevice; + descriptorPool: VkDescriptorPool; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkResetDescriptorPool = function ( + device: VkDevice; + descriptorPool: VkDescriptorPool; + flags: VkDescriptorPoolResetFlags + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkAllocateDescriptorSets = function ( + device: VkDevice; + const pAllocateInfo: PVkDescriptorSetAllocateInfo; + pDescriptorSets: PVkDescriptorSet + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkFreeDescriptorSets = function ( + device: VkDevice; + descriptorPool: VkDescriptorPool; + descriptorSetCount: VkUint32; + const pDescriptorSets: PVkDescriptorSet + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkUpdateDescriptorSets = procedure( + device: VkDevice; + descriptorWriteCount: VkUint32; + const pDescriptorWrites: PVkWriteDescriptorSet; + descriptorCopyCount: VkUint32; + const pDescriptorCopies: PVkCopyDescriptorSet + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCreateFramebuffer = function ( + device: VkDevice; + const pCreateInfo: PVkFramebufferCreateInfo; + const pAllocator: PVkAllocationCallbacks; + pFramebuffer: PVkFramebuffer + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDestroyFramebuffer = procedure( + device: VkDevice; + framebuffer: VkFramebuffer; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCreateRenderPass = function ( + device: VkDevice; + const pCreateInfo: PVkRenderPassCreateInfo; + const pAllocator: PVkAllocationCallbacks; + pRenderPass: PVkRenderPass + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDestroyRenderPass = procedure( + device: VkDevice; + renderPass: VkRenderPass; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetRenderAreaGranularity = procedure( + device: VkDevice; + renderPass: VkRenderPass; + pGranularity: PVkExtent2D + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCreateCommandPool = function ( + device: VkDevice; + const pCreateInfo: PVkCommandPoolCreateInfo; + const pAllocator: PVkAllocationCallbacks; + pCommandPool: PVkCommandPool + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDestroyCommandPool = procedure( + device: VkDevice; + commandPool: VkCommandPool; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkResetCommandPool = function ( + device: VkDevice; + commandPool: VkCommandPool; + flags: VkCommandPoolResetFlags + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkAllocateCommandBuffers = function ( + device: VkDevice; + const pAllocateInfo: PVkCommandBufferAllocateInfo; + pCommandBuffers: PVkCommandBuffer + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkFreeCommandBuffers = procedure( + device: VkDevice; + commandPool: VkCommandPool; + commandBufferCount: VkUint32; + const pCommandBuffers: PVkCommandBuffer + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkBeginCommandBuffer = function ( + commandBuffer: VkCommandBuffer; + const pBeginInfo: PVkCommandBufferBeginInfo + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkEndCommandBuffer = function ( + commandBuffer: VkCommandBuffer + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkResetCommandBuffer = function ( + commandBuffer: VkCommandBuffer; + flags: VkCommandBufferResetFlags + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdBindPipeline = procedure( + commandBuffer: VkCommandBuffer; + pipelineBindPoint: TVkPipelineBindPoint; + pipeline: VkPipeline + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdSetViewport = procedure( + commandBuffer: VkCommandBuffer; + firstViewport: VkUint32; + viewportCount: VkUint32; + const pViewports: PVkViewport + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdSetScissor = procedure( + commandBuffer: VkCommandBuffer; + firstScissor: VkUint32; + scissorCount: VkUint32; + const pScissors: PVkRect2D + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdSetLineWidth = procedure( + commandBuffer: VkCommandBuffer; + lineWidth: VkFloat + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdSetDepthBias = procedure( + commandBuffer: VkCommandBuffer; + depthBiasConstantFactor: VkFloat; + depthBiasClamp: VkFloat; + depthBiasSlopeFactor: VkFloat + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdSetBlendConstants = procedure( + commandBuffer: VkCommandBuffer; + const blendConstants: VkFloat + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdSetDepthBounds = procedure( + commandBuffer: VkCommandBuffer; + minDepthBounds: VkFloat; + maxDepthBounds: VkFloat + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdSetStencilCompareMask = procedure( + commandBuffer: VkCommandBuffer; + faceMask: VkStencilFaceFlags; + compareMask: VkUint32 + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdSetStencilWriteMask = procedure( + commandBuffer: VkCommandBuffer; + faceMask: VkStencilFaceFlags; + writeMask: VkUint32 + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdSetStencilReference = procedure( + commandBuffer: VkCommandBuffer; + faceMask: VkStencilFaceFlags; + reference: VkUint32 + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdBindDescriptorSets = procedure( + commandBuffer: VkCommandBuffer; + pipelineBindPoint: TVkPipelineBindPoint; + layout: VkPipelineLayout; + firstSet: VkUint32; + descriptorSetCount: VkUint32; + const pDescriptorSets: PVkDescriptorSet; + dynamicOffsetCount: VkUint32; + const pDynamicOffsets: PVkUint32 + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdBindIndexBuffer = procedure( + commandBuffer: VkCommandBuffer; + buffer: VkBuffer; + offset: VkDeviceSize; + indexType: TVkIndexType + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdBindVertexBuffers = procedure( + commandBuffer: VkCommandBuffer; + firstBinding: VkUint32; + bindingCount: VkUint32; + const pBuffers: PVkBuffer; + const pOffsets: PVkDeviceSize + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdDraw = procedure( + commandBuffer: VkCommandBuffer; + vertexCount: VkUint32; + instanceCount: VkUint32; + firstVertex: VkUint32; + firstInstance: VkUint32 + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdDrawIndexed = procedure( + commandBuffer: VkCommandBuffer; + indexCount: VkUint32; + instanceCount: VkUint32; + firstIndex: VkUint32; + vertexOffset: VkInt32; + firstInstance: VkUint32 + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdDrawIndirect = procedure( + commandBuffer: VkCommandBuffer; + buffer: VkBuffer; + offset: VkDeviceSize; + drawCount: VkUint32; + stride: VkUint32 + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdDrawIndexedIndirect = procedure( + commandBuffer: VkCommandBuffer; + buffer: VkBuffer; + offset: VkDeviceSize; + drawCount: VkUint32; + stride: VkUint32 + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdDispatch = procedure( + commandBuffer: VkCommandBuffer; + x: VkUint32; + y: VkUint32; + z: VkUint32 + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdDispatchIndirect = procedure( + commandBuffer: VkCommandBuffer; + buffer: VkBuffer; + offset: VkDeviceSize + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdCopyBuffer = procedure( + commandBuffer: VkCommandBuffer; + srcBuffer: VkBuffer; + dstBuffer: VkBuffer; + regionCount: VkUint32; + const pRegions: PVkBufferCopy + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdCopyImage = procedure( + commandBuffer: VkCommandBuffer; + srcImage: VkImage; + srcImageLayout: TVkImageLayout; + dstImage: VkImage; + dstImageLayout: TVkImageLayout; + regionCount: VkUint32; + const pRegions: PVkImageCopy + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdBlitImage = procedure( + commandBuffer: VkCommandBuffer; + srcImage: VkImage; + srcImageLayout: TVkImageLayout; + dstImage: VkImage; + dstImageLayout: TVkImageLayout; + regionCount: VkUint32; + const pRegions: PVkImageBlit; + filter: TVkFilter + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdCopyBufferToImage = procedure( + commandBuffer: VkCommandBuffer; + srcBuffer: VkBuffer; + dstImage: VkImage; + dstImageLayout: TVkImageLayout; + regionCount: VkUint32; + const pRegions: PVkBufferImageCopy + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdCopyImageToBuffer = procedure( + commandBuffer: VkCommandBuffer; + srcImage: VkImage; + srcImageLayout: TVkImageLayout; + dstBuffer: VkBuffer; + regionCount: VkUint32; + const pRegions: PVkBufferImageCopy + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdUpdateBuffer = procedure( + commandBuffer: VkCommandBuffer; + dstBuffer: VkBuffer; + dstOffset: VkDeviceSize; + dataSize: VkDeviceSize; + const pData: PVkUint32 + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdFillBuffer = procedure( + commandBuffer: VkCommandBuffer; + dstBuffer: VkBuffer; + dstOffset: VkDeviceSize; + size: VkDeviceSize; + data: VkUint32 + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdClearColorImage = procedure( + commandBuffer: VkCommandBuffer; + image: VkImage; + imageLayout: TVkImageLayout; + const pColor: PVkClearColorValue; + rangeCount: VkUint32; + const pRanges: PVkImageSubresourceRange + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdClearDepthStencilImage = procedure( + commandBuffer: VkCommandBuffer; + image: VkImage; + imageLayout: TVkImageLayout; + const pDepthStencil: PVkClearDepthStencilValue; + rangeCount: VkUint32; + const pRanges: PVkImageSubresourceRange + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdClearAttachments = procedure( + commandBuffer: VkCommandBuffer; + attachmentCount: VkUint32; + const pAttachments: PVkClearAttachment; + rectCount: VkUint32; + const pRects: PVkClearRect + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdResolveImage = procedure( + commandBuffer: VkCommandBuffer; + srcImage: VkImage; + srcImageLayout: TVkImageLayout; + dstImage: VkImage; + dstImageLayout: TVkImageLayout; + regionCount: VkUint32; + const pRegions: PVkImageResolve + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdSetEvent = procedure( + commandBuffer: VkCommandBuffer; + event: VkEvent; + stageMask: VkPipelineStageFlags + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdResetEvent = procedure( + commandBuffer: VkCommandBuffer; + event: VkEvent; + stageMask: VkPipelineStageFlags + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdWaitEvents = procedure( + commandBuffer: VkCommandBuffer; + eventCount: VkUint32; + const pEvents: PVkEvent; + srcStageMask: VkPipelineStageFlags; + dstStageMask: VkPipelineStageFlags; + memoryBarrierCount: VkUint32; + const pMemoryBarriers: PVkMemoryBarrier; + bufferMemoryBarrierCount: VkUint32; + const pBufferMemoryBarriers: PVkBufferMemoryBarrier; + imageMemoryBarrierCount: VkUint32; + const pImageMemoryBarriers: PVkImageMemoryBarrier + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdPipelineBarrier = procedure( + commandBuffer: VkCommandBuffer; + srcStageMask: VkPipelineStageFlags; + dstStageMask: VkPipelineStageFlags; + dependencyFlags: VkDependencyFlags; + memoryBarrierCount: VkUint32; + const pMemoryBarriers: PVkMemoryBarrier; + bufferMemoryBarrierCount: VkUint32; + const pBufferMemoryBarriers: PVkBufferMemoryBarrier; + imageMemoryBarrierCount: VkUint32; + const pImageMemoryBarriers: PVkImageMemoryBarrier + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdBeginQuery = procedure( + commandBuffer: VkCommandBuffer; + queryPool: VkQueryPool; + query: VkUint32; + flags: VkQueryControlFlags + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdEndQuery = procedure( + commandBuffer: VkCommandBuffer; + queryPool: VkQueryPool; + query: VkUint32 + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdResetQueryPool = procedure( + commandBuffer: VkCommandBuffer; + queryPool: VkQueryPool; + firstQuery: VkUint32; + queryCount: VkUint32 + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdWriteTimestamp = procedure( + commandBuffer: VkCommandBuffer; + pipelineStage: TVkPipelineStageFlagBits; + queryPool: VkQueryPool; + query: VkUint32 + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdCopyQueryPoolResults = procedure( + commandBuffer: VkCommandBuffer; + queryPool: VkQueryPool; + firstQuery: VkUint32; + queryCount: VkUint32; + dstBuffer: VkBuffer; + dstOffset: VkDeviceSize; + stride: VkDeviceSize; + flags: VkQueryResultFlags + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdPushConstants = procedure( + commandBuffer: VkCommandBuffer; + layout: VkPipelineLayout; + stageFlags: VkShaderStageFlags; + offset: VkUint32; + size: VkUint32; + const pValues: PVkVoid + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdBeginRenderPass = procedure( + commandBuffer: VkCommandBuffer; + const pRenderPassBegin: PVkRenderPassBeginInfo; + contents: TVkSubpassContents + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdNextSubpass = procedure( + commandBuffer: VkCommandBuffer; + contents: TVkSubpassContents + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdEndRenderPass = procedure( + commandBuffer: VkCommandBuffer + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCmdExecuteCommands = procedure( + commandBuffer: VkCommandBuffer; + commandBufferCount: VkUint32; + const pCommandBuffers: PVkCommandBuffer + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + +{ ========================================== VK_KHR_surface ========================================== } + TvkDestroySurfaceKHR = procedure( + instance: VkInstance; + surface: VkSurfaceKHR; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetPhysicalDeviceSurfaceSupportKHR = function ( + physicalDevice: VkPhysicalDevice; + queueFamilyIndex: VkUint32; + surface: VkSurfaceKHR; + pSupported: PVkBool32 + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetPhysicalDeviceSurfaceCapabilitiesKHR = function ( + physicalDevice: VkPhysicalDevice; + surface: VkSurfaceKHR; + pSurfaceCapabilities: PVkSurfaceCapabilitiesKHR + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetPhysicalDeviceSurfaceFormatsKHR = function ( + physicalDevice: VkPhysicalDevice; + surface: VkSurfaceKHR; + pSurfaceFormatCount: PVkUint32; + pSurfaceFormats: PVkSurfaceFormatKHR + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetPhysicalDeviceSurfacePresentModesKHR = function ( + physicalDevice: VkPhysicalDevice; + surface: VkSurfaceKHR; + pPresentModeCount: PVkUint32; + pPresentModes: PVkPresentModeKHR + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + +{ ========================================= VK_KHR_swapchain ========================================= } + TvkCreateSwapchainKHR = function ( + device: VkDevice; + const pCreateInfo: PVkSwapchainCreateInfoKHR; + const pAllocator: PVkAllocationCallbacks; + pSwapchain: PVkSwapchainKHR + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDestroySwapchainKHR = procedure( + device: VkDevice; + swapchain: VkSwapchainKHR; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetSwapchainImagesKHR = function ( + device: VkDevice; + swapchain: VkSwapchainKHR; + pSwapchainImageCount: PVkUint32; + pSwapchainImages: PVkImage + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkAcquireNextImageKHR = function ( + device: VkDevice; + swapchain: VkSwapchainKHR; + timeout: VkUint64; + semaphore: VkSemaphore; + fence: VkFence; + pImageIndex: PVkUint32 + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkQueuePresentKHR = function ( + queue: VkQueue; + const pPresentInfo: PVkPresentInfoKHR + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + +{ ========================================== VK_KHR_display ========================================== } + TvkGetPhysicalDeviceDisplayPropertiesKHR = function ( + physicalDevice: VkPhysicalDevice; + pPropertyCount: PVkUint32; + pProperties: PVkDisplayPropertiesKHR + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetPhysicalDeviceDisplayPlanePropertiesKHR = function ( + physicalDevice: VkPhysicalDevice; + pPropertyCount: PVkUint32; + pProperties: PVkDisplayPlanePropertiesKHR + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetDisplayPlaneSupportedDisplaysKHR = function ( + physicalDevice: VkPhysicalDevice; + planeIndex: VkUint32; + pDisplayCount: PVkUint32; + pDisplays: PVkDisplayKHR + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetDisplayModePropertiesKHR = function ( + physicalDevice: VkPhysicalDevice; + display: VkDisplayKHR; + pPropertyCount: PVkUint32; + pProperties: PVkDisplayModePropertiesKHR + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCreateDisplayModeKHR = function ( + physicalDevice: VkPhysicalDevice; + display: VkDisplayKHR; + const pCreateInfo: PVkDisplayModeCreateInfoKHR; + const pAllocator: PVkAllocationCallbacks; + pMode: PVkDisplayModeKHR + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetDisplayPlaneCapabilitiesKHR = function ( + physicalDevice: VkPhysicalDevice; + mode: VkDisplayModeKHR; + planeIndex: VkUint32; + pCapabilities: PVkDisplayPlaneCapabilitiesKHR + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkCreateDisplayPlaneSurfaceKHR = function ( + instance: VkInstance; + const pCreateInfo: PVkDisplaySurfaceCreateInfoKHR; + const pAllocator: PVkAllocationCallbacks; + pSurface: PVkSurfaceKHR + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + +{ ===================================== VK_KHR_display_swapchain ===================================== } + TvkCreateSharedSwapchainsKHR = function ( + device: VkDevice; + swapchainCount: VkUint32; + const pCreateInfos: PVkSwapchainCreateInfoKHR; + const pAllocator: PVkAllocationCallbacks; + pSwapchains: PVkSwapchainKHR + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + +{ ======================================= VK_KHR_xlib_surface ======================================== } +{$IFDEF VK_USE_PLATFORM_XLIB_KHR} + TvkCreateXlibSurfaceKHR = function ( + instance: VkInstance; + const pCreateInfo: PVkXlibSurfaceCreateInfoKHR; + const pAllocator: PVkAllocationCallbacks; + pSurface: PVkSurfaceKHR + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetPhysicalDeviceXlibPresentationSupportKHR = function ( + physicalDevice: VkPhysicalDevice; + queueFamilyIndex: VkUint32; + dpy: Display; + visualID: VisualID + ): VkBool32; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; +{$ENDIF} + +{ ======================================== VK_KHR_xcb_surface ======================================== } +{$IFDEF VK_USE_PLATFORM_XCB_KHR} + TvkCreateXcbSurfaceKHR = function ( + instance: VkInstance; + const pCreateInfo: PVkXcbSurfaceCreateInfoKHR; + const pAllocator: PVkAllocationCallbacks; + pSurface: PVkSurfaceKHR + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetPhysicalDeviceXcbPresentationSupportKHR = function ( + physicalDevice: VkPhysicalDevice; + queueFamilyIndex: VkUint32; + connection: xcb_connection_t; + visual_id: xcb_visualid_t + ): VkBool32; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; +{$ENDIF} + +{ ====================================== VK_KHR_wayland_surface ====================================== } +{$IFDEF VK_USE_PLATFORM_WAYLAND_KHR} + TvkCreateWaylandSurfaceKHR = function ( + instance: VkInstance; + const pCreateInfo: PVkWaylandSurfaceCreateInfoKHR; + const pAllocator: PVkAllocationCallbacks; + pSurface: PVkSurfaceKHR + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetPhysicalDeviceWaylandPresentationSupportKHR = function ( + physicalDevice: VkPhysicalDevice; + queueFamilyIndex: VkUint32; + display: wl_display + ): VkBool32; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; +{$ENDIF} + +{ ======================================== VK_KHR_mir_surface ======================================== } +{$IFDEF VK_USE_PLATFORM_MIR_KHR} + TvkCreateMirSurfaceKHR = function ( + instance: VkInstance; + const pCreateInfo: PVkMirSurfaceCreateInfoKHR; + const pAllocator: PVkAllocationCallbacks; + pSurface: PVkSurfaceKHR + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetPhysicalDeviceMirPresentationSupportKHR = function ( + physicalDevice: VkPhysicalDevice; + queueFamilyIndex: VkUint32; + connection: MirConnection + ): VkBool32; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; +{$ENDIF} + +{ ====================================== VK_KHR_android_surface ====================================== } +{$IFDEF VK_USE_PLATFORM_ANDROID_KHR} + TvkCreateAndroidSurfaceKHR = function ( + instance: VkInstance; + const pCreateInfo: PVkAndroidSurfaceCreateInfoKHR; + const pAllocator: PVkAllocationCallbacks; + pSurface: PVkSurfaceKHR + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; +{$ENDIF} + +{ ======================================= VK_KHR_win32_surface ======================================= } +{$IFDEF VK_USE_PLATFORM_WIN32_KHR} + TvkCreateWin32SurfaceKHR = function ( + instance: VkInstance; + const pCreateInfo: PVkWin32SurfaceCreateInfoKHR; + const pAllocator: PVkAllocationCallbacks; + pSurface: PVkSurfaceKHR + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkGetPhysicalDeviceWin32PresentationSupportKHR = function ( + physicalDevice: VkPhysicalDevice; + queueFamilyIndex: VkUint32 + ): VkBool32; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; +{$ENDIF} + +{ ======================================= VK_EXT_debug_report ======================================== } + TvkCreateDebugReportCallbackEXT = function ( + instance: VkInstance; + const pCreateInfo: PVkDebugReportCallbackCreateInfoEXT; + const pAllocator: PVkAllocationCallbacks; + pCallback: PVkDebugReportCallbackEXT + ): TVkResult; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDestroyDebugReportCallbackEXT = procedure( + instance: VkInstance; + callback: VkDebugReportCallbackEXT; + const pAllocator: PVkAllocationCallbacks + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + + TvkDebugReportMessageEXT = procedure( + instance: VkInstance; + flags: VkDebugReportFlagsEXT; + objectType: TVkDebugReportObjectTypeEXT; + uObject: VkUint64; + location: VkSize; + messageCode: VkInt32; + const pLayerPrefix: PVkChar; + const pMessage: PVkChar + ); {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF}; + +var + +{ ========================================== VK_VERSION_1_0 ========================================== } + vkCreateInstance: TvkCreateInstance; + vkDestroyInstance: TvkDestroyInstance; + vkEnumeratePhysicalDevices: TvkEnumeratePhysicalDevices; + vkGetPhysicalDeviceFeatures: TvkGetPhysicalDeviceFeatures; + vkGetPhysicalDeviceFormatProperties: TvkGetPhysicalDeviceFormatProperties; + vkGetPhysicalDeviceImageFormatProperties: TvkGetPhysicalDeviceImageFormatProperties; + vkGetPhysicalDeviceProperties: TvkGetPhysicalDeviceProperties; + vkGetPhysicalDeviceQueueFamilyProperties: TvkGetPhysicalDeviceQueueFamilyProperties; + vkGetPhysicalDeviceMemoryProperties: TvkGetPhysicalDeviceMemoryProperties; + vkGetInstanceProcAddr: TvkGetInstanceProcAddr; + vkGetDeviceProcAddr: TvkGetDeviceProcAddr; + vkCreateDevice: TvkCreateDevice; + vkDestroyDevice: TvkDestroyDevice; + vkEnumerateInstanceExtensionProperties: TvkEnumerateInstanceExtensionProperties; + vkEnumerateDeviceExtensionProperties: TvkEnumerateDeviceExtensionProperties; + vkEnumerateInstanceLayerProperties: TvkEnumerateInstanceLayerProperties; + vkEnumerateDeviceLayerProperties: TvkEnumerateDeviceLayerProperties; + vkGetDeviceQueue: TvkGetDeviceQueue; + vkQueueSubmit: TvkQueueSubmit; + vkQueueWaitIdle: TvkQueueWaitIdle; + vkDeviceWaitIdle: TvkDeviceWaitIdle; + vkAllocateMemory: TvkAllocateMemory; + vkFreeMemory: TvkFreeMemory; + vkMapMemory: TvkMapMemory; + vkUnmapMemory: TvkUnmapMemory; + vkFlushMappedMemoryRanges: TvkFlushMappedMemoryRanges; + vkInvalidateMappedMemoryRanges: TvkInvalidateMappedMemoryRanges; + vkGetDeviceMemoryCommitment: TvkGetDeviceMemoryCommitment; + vkBindBufferMemory: TvkBindBufferMemory; + vkBindImageMemory: TvkBindImageMemory; + vkGetBufferMemoryRequirements: TvkGetBufferMemoryRequirements; + vkGetImageMemoryRequirements: TvkGetImageMemoryRequirements; + vkGetImageSparseMemoryRequirements: TvkGetImageSparseMemoryRequirements; + vkGetPhysicalDeviceSparseImageFormatProperties: TvkGetPhysicalDeviceSparseImageFormatProperties; + vkQueueBindSparse: TvkQueueBindSparse; + vkCreateFence: TvkCreateFence; + vkDestroyFence: TvkDestroyFence; + vkResetFences: TvkResetFences; + vkGetFenceStatus: TvkGetFenceStatus; + vkWaitForFences: TvkWaitForFences; + vkCreateSemaphore: TvkCreateSemaphore; + vkDestroySemaphore: TvkDestroySemaphore; + vkCreateEvent: TvkCreateEvent; + vkDestroyEvent: TvkDestroyEvent; + vkGetEventStatus: TvkGetEventStatus; + vkSetEvent: TvkSetEvent; + vkResetEvent: TvkResetEvent; + vkCreateQueryPool: TvkCreateQueryPool; + vkDestroyQueryPool: TvkDestroyQueryPool; + vkGetQueryPoolResults: TvkGetQueryPoolResults; + vkCreateBuffer: TvkCreateBuffer; + vkDestroyBuffer: TvkDestroyBuffer; + vkCreateBufferView: TvkCreateBufferView; + vkDestroyBufferView: TvkDestroyBufferView; + vkCreateImage: TvkCreateImage; + vkDestroyImage: TvkDestroyImage; + vkGetImageSubresourceLayout: TvkGetImageSubresourceLayout; + vkCreateImageView: TvkCreateImageView; + vkDestroyImageView: TvkDestroyImageView; + vkCreateShaderModule: TvkCreateShaderModule; + vkDestroyShaderModule: TvkDestroyShaderModule; + vkCreatePipelineCache: TvkCreatePipelineCache; + vkDestroyPipelineCache: TvkDestroyPipelineCache; + vkGetPipelineCacheData: TvkGetPipelineCacheData; + vkMergePipelineCaches: TvkMergePipelineCaches; + vkCreateGraphicsPipelines: TvkCreateGraphicsPipelines; + vkCreateComputePipelines: TvkCreateComputePipelines; + vkDestroyPipeline: TvkDestroyPipeline; + vkCreatePipelineLayout: TvkCreatePipelineLayout; + vkDestroyPipelineLayout: TvkDestroyPipelineLayout; + vkCreateSampler: TvkCreateSampler; + vkDestroySampler: TvkDestroySampler; + vkCreateDescriptorSetLayout: TvkCreateDescriptorSetLayout; + vkDestroyDescriptorSetLayout: TvkDestroyDescriptorSetLayout; + vkCreateDescriptorPool: TvkCreateDescriptorPool; + vkDestroyDescriptorPool: TvkDestroyDescriptorPool; + vkResetDescriptorPool: TvkResetDescriptorPool; + vkAllocateDescriptorSets: TvkAllocateDescriptorSets; + vkFreeDescriptorSets: TvkFreeDescriptorSets; + vkUpdateDescriptorSets: TvkUpdateDescriptorSets; + vkCreateFramebuffer: TvkCreateFramebuffer; + vkDestroyFramebuffer: TvkDestroyFramebuffer; + vkCreateRenderPass: TvkCreateRenderPass; + vkDestroyRenderPass: TvkDestroyRenderPass; + vkGetRenderAreaGranularity: TvkGetRenderAreaGranularity; + vkCreateCommandPool: TvkCreateCommandPool; + vkDestroyCommandPool: TvkDestroyCommandPool; + vkResetCommandPool: TvkResetCommandPool; + vkAllocateCommandBuffers: TvkAllocateCommandBuffers; + vkFreeCommandBuffers: TvkFreeCommandBuffers; + vkBeginCommandBuffer: TvkBeginCommandBuffer; + vkEndCommandBuffer: TvkEndCommandBuffer; + vkResetCommandBuffer: TvkResetCommandBuffer; + vkCmdBindPipeline: TvkCmdBindPipeline; + vkCmdSetViewport: TvkCmdSetViewport; + vkCmdSetScissor: TvkCmdSetScissor; + vkCmdSetLineWidth: TvkCmdSetLineWidth; + vkCmdSetDepthBias: TvkCmdSetDepthBias; + vkCmdSetBlendConstants: TvkCmdSetBlendConstants; + vkCmdSetDepthBounds: TvkCmdSetDepthBounds; + vkCmdSetStencilCompareMask: TvkCmdSetStencilCompareMask; + vkCmdSetStencilWriteMask: TvkCmdSetStencilWriteMask; + vkCmdSetStencilReference: TvkCmdSetStencilReference; + vkCmdBindDescriptorSets: TvkCmdBindDescriptorSets; + vkCmdBindIndexBuffer: TvkCmdBindIndexBuffer; + vkCmdBindVertexBuffers: TvkCmdBindVertexBuffers; + vkCmdDraw: TvkCmdDraw; + vkCmdDrawIndexed: TvkCmdDrawIndexed; + vkCmdDrawIndirect: TvkCmdDrawIndirect; + vkCmdDrawIndexedIndirect: TvkCmdDrawIndexedIndirect; + vkCmdDispatch: TvkCmdDispatch; + vkCmdDispatchIndirect: TvkCmdDispatchIndirect; + vkCmdCopyBuffer: TvkCmdCopyBuffer; + vkCmdCopyImage: TvkCmdCopyImage; + vkCmdBlitImage: TvkCmdBlitImage; + vkCmdCopyBufferToImage: TvkCmdCopyBufferToImage; + vkCmdCopyImageToBuffer: TvkCmdCopyImageToBuffer; + vkCmdUpdateBuffer: TvkCmdUpdateBuffer; + vkCmdFillBuffer: TvkCmdFillBuffer; + vkCmdClearColorImage: TvkCmdClearColorImage; + vkCmdClearDepthStencilImage: TvkCmdClearDepthStencilImage; + vkCmdClearAttachments: TvkCmdClearAttachments; + vkCmdResolveImage: TvkCmdResolveImage; + vkCmdSetEvent: TvkCmdSetEvent; + vkCmdResetEvent: TvkCmdResetEvent; + vkCmdWaitEvents: TvkCmdWaitEvents; + vkCmdPipelineBarrier: TvkCmdPipelineBarrier; + vkCmdBeginQuery: TvkCmdBeginQuery; + vkCmdEndQuery: TvkCmdEndQuery; + vkCmdResetQueryPool: TvkCmdResetQueryPool; + vkCmdWriteTimestamp: TvkCmdWriteTimestamp; + vkCmdCopyQueryPoolResults: TvkCmdCopyQueryPoolResults; + vkCmdPushConstants: TvkCmdPushConstants; + vkCmdBeginRenderPass: TvkCmdBeginRenderPass; + vkCmdNextSubpass: TvkCmdNextSubpass; + vkCmdEndRenderPass: TvkCmdEndRenderPass; + vkCmdExecuteCommands: TvkCmdExecuteCommands; + +{ ========================================== VK_KHR_surface ========================================== } + vkDestroySurfaceKHR: TvkDestroySurfaceKHR; + vkGetPhysicalDeviceSurfaceSupportKHR: TvkGetPhysicalDeviceSurfaceSupportKHR; + vkGetPhysicalDeviceSurfaceCapabilitiesKHR: TvkGetPhysicalDeviceSurfaceCapabilitiesKHR; + vkGetPhysicalDeviceSurfaceFormatsKHR: TvkGetPhysicalDeviceSurfaceFormatsKHR; + vkGetPhysicalDeviceSurfacePresentModesKHR: TvkGetPhysicalDeviceSurfacePresentModesKHR; + +{ ========================================= VK_KHR_swapchain ========================================= } + vkCreateSwapchainKHR: TvkCreateSwapchainKHR; + vkDestroySwapchainKHR: TvkDestroySwapchainKHR; + vkGetSwapchainImagesKHR: TvkGetSwapchainImagesKHR; + vkAcquireNextImageKHR: TvkAcquireNextImageKHR; + vkQueuePresentKHR: TvkQueuePresentKHR; + +{ ========================================== VK_KHR_display ========================================== } + vkGetPhysicalDeviceDisplayPropertiesKHR: TvkGetPhysicalDeviceDisplayPropertiesKHR; + vkGetPhysicalDeviceDisplayPlanePropertiesKHR: TvkGetPhysicalDeviceDisplayPlanePropertiesKHR; + vkGetDisplayPlaneSupportedDisplaysKHR: TvkGetDisplayPlaneSupportedDisplaysKHR; + vkGetDisplayModePropertiesKHR: TvkGetDisplayModePropertiesKHR; + vkCreateDisplayModeKHR: TvkCreateDisplayModeKHR; + vkGetDisplayPlaneCapabilitiesKHR: TvkGetDisplayPlaneCapabilitiesKHR; + vkCreateDisplayPlaneSurfaceKHR: TvkCreateDisplayPlaneSurfaceKHR; + +{ ===================================== VK_KHR_display_swapchain ===================================== } + vkCreateSharedSwapchainsKHR: TvkCreateSharedSwapchainsKHR; + +{ ======================================= VK_KHR_xlib_surface ======================================== } +{$IFDEF VK_USE_PLATFORM_XLIB_KHR} + vkCreateXlibSurfaceKHR: TvkCreateXlibSurfaceKHR; + vkGetPhysicalDeviceXlibPresentationSupportKHR: TvkGetPhysicalDeviceXlibPresentationSupportKHR; +{$ENDIF} + +{ ======================================== VK_KHR_xcb_surface ======================================== } +{$IFDEF VK_USE_PLATFORM_XCB_KHR} + vkCreateXcbSurfaceKHR: TvkCreateXcbSurfaceKHR; + vkGetPhysicalDeviceXcbPresentationSupportKHR: TvkGetPhysicalDeviceXcbPresentationSupportKHR; +{$ENDIF} + +{ ====================================== VK_KHR_wayland_surface ====================================== } +{$IFDEF VK_USE_PLATFORM_WAYLAND_KHR} + vkCreateWaylandSurfaceKHR: TvkCreateWaylandSurfaceKHR; + vkGetPhysicalDeviceWaylandPresentationSupportKHR: TvkGetPhysicalDeviceWaylandPresentationSupportKHR; +{$ENDIF} + +{ ======================================== VK_KHR_mir_surface ======================================== } +{$IFDEF VK_USE_PLATFORM_MIR_KHR} + vkCreateMirSurfaceKHR: TvkCreateMirSurfaceKHR; + vkGetPhysicalDeviceMirPresentationSupportKHR: TvkGetPhysicalDeviceMirPresentationSupportKHR; +{$ENDIF} + +{ ====================================== VK_KHR_android_surface ====================================== } +{$IFDEF VK_USE_PLATFORM_ANDROID_KHR} + vkCreateAndroidSurfaceKHR: TvkCreateAndroidSurfaceKHR; +{$ENDIF} + +{ ======================================= VK_KHR_win32_surface ======================================= } +{$IFDEF VK_USE_PLATFORM_WIN32_KHR} + vkCreateWin32SurfaceKHR: TvkCreateWin32SurfaceKHR; + vkGetPhysicalDeviceWin32PresentationSupportKHR: TvkGetPhysicalDeviceWin32PresentationSupportKHR; +{$ENDIF} + +{ ======================================= VK_EXT_debug_report ======================================== } + vkCreateDebugReportCallbackEXT: TvkCreateDebugReportCallbackEXT; + vkDestroyDebugReportCallbackEXT: TvkDestroyDebugReportCallbackEXT; + vkDebugReportMessageEXT: TvkDebugReportMessageEXT; const - VULKAN_LIBNAME = 'vulkan-1.dll'; + VULKAN_LIBNAME = 'vulkan-1.dll'; type VkVersion = VkInt32; -function vkMakeVersion(const aMajor, aMinor, aPatch: Integer): VkVersion; -function vkGetVersionMajor(const aVersion: VkVersion): Integer; -function vkGetVersionMinor(const aVersion: VkVersion): Integer; -function vkgetVersionPatch(const aVersion: VkVersion): Integer; +function vkMakeVersion(const aMajor, aMinor, aPatch: Integer): VkVersion; inline; +function vkGetVersionMajor(const aVersion: VkVersion): Integer; inline; +function vkGetVersionMinor(const aVersion: VkVersion): Integer; inline; +function vkGetVersionPatch(const aVersion: VkVersion): Integer; inline; function InitializeVulkan(const aLibName: String = VULKAN_LIBNAME): Boolean; +procedure LoadVulkanCommands(const aInstance: VkInstance); procedure FinalizeVulkan; implementation @@ -2633,10 +4421,17 @@ begin {$ENDIF} end; -function vkGetProcAddress(const aProcName: String; aLibHandle: TvkLibHandle = InvalidLibHandle): Pointer; +function vkGetProcAddress(const aProcName: String; aInstance: VkInstance = nil; aLibHandle: TvkLibHandle = InvalidLibHandle): TvkVoidFunction; begin + result := nil; if (aLibHandle = InvalidLibHandle) then aLibHandle := vkLibHandle; + if Assigned(vkGetInstanceProcAddr) then begin + result := vkGetInstanceProcAddr(aInstance, PVkChar(aProcName)); + if Assigned(result) then + exit; + end; + {$IF DEFINED(VK_WIN)} result := GetProcAddress(aLibHandle, AnsiString(aProcName)); {$ELSE} @@ -2644,6 +4439,216 @@ begin {$ENDIF} end; +procedure vkLoadAddresses(const aInstance: VkInstance = nil); +begin + +{ ========================================== VK_VERSION_1_0 ========================================== } + vkCreateInstance := TvkCreateInstance (vkGetProcAddress('vkCreateInstance', aInstance)); + vkDestroyInstance := TvkDestroyInstance (vkGetProcAddress('vkDestroyInstance', aInstance)); + vkEnumeratePhysicalDevices := TvkEnumeratePhysicalDevices (vkGetProcAddress('vkEnumeratePhysicalDevices', aInstance)); + vkGetPhysicalDeviceFeatures := TvkGetPhysicalDeviceFeatures (vkGetProcAddress('vkGetPhysicalDeviceFeatures', aInstance)); + vkGetPhysicalDeviceFormatProperties := TvkGetPhysicalDeviceFormatProperties (vkGetProcAddress('vkGetPhysicalDeviceFormatProperties', aInstance)); + vkGetPhysicalDeviceImageFormatProperties := TvkGetPhysicalDeviceImageFormatProperties (vkGetProcAddress('vkGetPhysicalDeviceImageFormatProperties', aInstance)); + vkGetPhysicalDeviceProperties := TvkGetPhysicalDeviceProperties (vkGetProcAddress('vkGetPhysicalDeviceProperties', aInstance)); + vkGetPhysicalDeviceQueueFamilyProperties := TvkGetPhysicalDeviceQueueFamilyProperties (vkGetProcAddress('vkGetPhysicalDeviceQueueFamilyProperties', aInstance)); + vkGetPhysicalDeviceMemoryProperties := TvkGetPhysicalDeviceMemoryProperties (vkGetProcAddress('vkGetPhysicalDeviceMemoryProperties', aInstance)); + vkGetInstanceProcAddr := TvkGetInstanceProcAddr (vkGetProcAddress('vkGetInstanceProcAddr', aInstance)); + vkGetDeviceProcAddr := TvkGetDeviceProcAddr (vkGetProcAddress('vkGetDeviceProcAddr', aInstance)); + vkCreateDevice := TvkCreateDevice (vkGetProcAddress('vkCreateDevice', aInstance)); + vkDestroyDevice := TvkDestroyDevice (vkGetProcAddress('vkDestroyDevice', aInstance)); + vkEnumerateInstanceExtensionProperties := TvkEnumerateInstanceExtensionProperties (vkGetProcAddress('vkEnumerateInstanceExtensionProperties', aInstance)); + vkEnumerateDeviceExtensionProperties := TvkEnumerateDeviceExtensionProperties (vkGetProcAddress('vkEnumerateDeviceExtensionProperties', aInstance)); + vkEnumerateInstanceLayerProperties := TvkEnumerateInstanceLayerProperties (vkGetProcAddress('vkEnumerateInstanceLayerProperties', aInstance)); + vkEnumerateDeviceLayerProperties := TvkEnumerateDeviceLayerProperties (vkGetProcAddress('vkEnumerateDeviceLayerProperties', aInstance)); + vkGetDeviceQueue := TvkGetDeviceQueue (vkGetProcAddress('vkGetDeviceQueue', aInstance)); + vkQueueSubmit := TvkQueueSubmit (vkGetProcAddress('vkQueueSubmit', aInstance)); + vkQueueWaitIdle := TvkQueueWaitIdle (vkGetProcAddress('vkQueueWaitIdle', aInstance)); + vkDeviceWaitIdle := TvkDeviceWaitIdle (vkGetProcAddress('vkDeviceWaitIdle', aInstance)); + vkAllocateMemory := TvkAllocateMemory (vkGetProcAddress('vkAllocateMemory', aInstance)); + vkFreeMemory := TvkFreeMemory (vkGetProcAddress('vkFreeMemory', aInstance)); + vkMapMemory := TvkMapMemory (vkGetProcAddress('vkMapMemory', aInstance)); + vkUnmapMemory := TvkUnmapMemory (vkGetProcAddress('vkUnmapMemory', aInstance)); + vkFlushMappedMemoryRanges := TvkFlushMappedMemoryRanges (vkGetProcAddress('vkFlushMappedMemoryRanges', aInstance)); + vkInvalidateMappedMemoryRanges := TvkInvalidateMappedMemoryRanges (vkGetProcAddress('vkInvalidateMappedMemoryRanges', aInstance)); + vkGetDeviceMemoryCommitment := TvkGetDeviceMemoryCommitment (vkGetProcAddress('vkGetDeviceMemoryCommitment', aInstance)); + vkBindBufferMemory := TvkBindBufferMemory (vkGetProcAddress('vkBindBufferMemory', aInstance)); + vkBindImageMemory := TvkBindImageMemory (vkGetProcAddress('vkBindImageMemory', aInstance)); + vkGetBufferMemoryRequirements := TvkGetBufferMemoryRequirements (vkGetProcAddress('vkGetBufferMemoryRequirements', aInstance)); + vkGetImageMemoryRequirements := TvkGetImageMemoryRequirements (vkGetProcAddress('vkGetImageMemoryRequirements', aInstance)); + vkGetImageSparseMemoryRequirements := TvkGetImageSparseMemoryRequirements (vkGetProcAddress('vkGetImageSparseMemoryRequirements', aInstance)); + vkGetPhysicalDeviceSparseImageFormatProperties := TvkGetPhysicalDeviceSparseImageFormatProperties (vkGetProcAddress('vkGetPhysicalDeviceSparseImageFormatProperties', aInstance)); + vkQueueBindSparse := TvkQueueBindSparse (vkGetProcAddress('vkQueueBindSparse', aInstance)); + vkCreateFence := TvkCreateFence (vkGetProcAddress('vkCreateFence', aInstance)); + vkDestroyFence := TvkDestroyFence (vkGetProcAddress('vkDestroyFence', aInstance)); + vkResetFences := TvkResetFences (vkGetProcAddress('vkResetFences', aInstance)); + vkGetFenceStatus := TvkGetFenceStatus (vkGetProcAddress('vkGetFenceStatus', aInstance)); + vkWaitForFences := TvkWaitForFences (vkGetProcAddress('vkWaitForFences', aInstance)); + vkCreateSemaphore := TvkCreateSemaphore (vkGetProcAddress('vkCreateSemaphore', aInstance)); + vkDestroySemaphore := TvkDestroySemaphore (vkGetProcAddress('vkDestroySemaphore', aInstance)); + vkCreateEvent := TvkCreateEvent (vkGetProcAddress('vkCreateEvent', aInstance)); + vkDestroyEvent := TvkDestroyEvent (vkGetProcAddress('vkDestroyEvent', aInstance)); + vkGetEventStatus := TvkGetEventStatus (vkGetProcAddress('vkGetEventStatus', aInstance)); + vkSetEvent := TvkSetEvent (vkGetProcAddress('vkSetEvent', aInstance)); + vkResetEvent := TvkResetEvent (vkGetProcAddress('vkResetEvent', aInstance)); + vkCreateQueryPool := TvkCreateQueryPool (vkGetProcAddress('vkCreateQueryPool', aInstance)); + vkDestroyQueryPool := TvkDestroyQueryPool (vkGetProcAddress('vkDestroyQueryPool', aInstance)); + vkGetQueryPoolResults := TvkGetQueryPoolResults (vkGetProcAddress('vkGetQueryPoolResults', aInstance)); + vkCreateBuffer := TvkCreateBuffer (vkGetProcAddress('vkCreateBuffer', aInstance)); + vkDestroyBuffer := TvkDestroyBuffer (vkGetProcAddress('vkDestroyBuffer', aInstance)); + vkCreateBufferView := TvkCreateBufferView (vkGetProcAddress('vkCreateBufferView', aInstance)); + vkDestroyBufferView := TvkDestroyBufferView (vkGetProcAddress('vkDestroyBufferView', aInstance)); + vkCreateImage := TvkCreateImage (vkGetProcAddress('vkCreateImage', aInstance)); + vkDestroyImage := TvkDestroyImage (vkGetProcAddress('vkDestroyImage', aInstance)); + vkGetImageSubresourceLayout := TvkGetImageSubresourceLayout (vkGetProcAddress('vkGetImageSubresourceLayout', aInstance)); + vkCreateImageView := TvkCreateImageView (vkGetProcAddress('vkCreateImageView', aInstance)); + vkDestroyImageView := TvkDestroyImageView (vkGetProcAddress('vkDestroyImageView', aInstance)); + vkCreateShaderModule := TvkCreateShaderModule (vkGetProcAddress('vkCreateShaderModule', aInstance)); + vkDestroyShaderModule := TvkDestroyShaderModule (vkGetProcAddress('vkDestroyShaderModule', aInstance)); + vkCreatePipelineCache := TvkCreatePipelineCache (vkGetProcAddress('vkCreatePipelineCache', aInstance)); + vkDestroyPipelineCache := TvkDestroyPipelineCache (vkGetProcAddress('vkDestroyPipelineCache', aInstance)); + vkGetPipelineCacheData := TvkGetPipelineCacheData (vkGetProcAddress('vkGetPipelineCacheData', aInstance)); + vkMergePipelineCaches := TvkMergePipelineCaches (vkGetProcAddress('vkMergePipelineCaches', aInstance)); + vkCreateGraphicsPipelines := TvkCreateGraphicsPipelines (vkGetProcAddress('vkCreateGraphicsPipelines', aInstance)); + vkCreateComputePipelines := TvkCreateComputePipelines (vkGetProcAddress('vkCreateComputePipelines', aInstance)); + vkDestroyPipeline := TvkDestroyPipeline (vkGetProcAddress('vkDestroyPipeline', aInstance)); + vkCreatePipelineLayout := TvkCreatePipelineLayout (vkGetProcAddress('vkCreatePipelineLayout', aInstance)); + vkDestroyPipelineLayout := TvkDestroyPipelineLayout (vkGetProcAddress('vkDestroyPipelineLayout', aInstance)); + vkCreateSampler := TvkCreateSampler (vkGetProcAddress('vkCreateSampler', aInstance)); + vkDestroySampler := TvkDestroySampler (vkGetProcAddress('vkDestroySampler', aInstance)); + vkCreateDescriptorSetLayout := TvkCreateDescriptorSetLayout (vkGetProcAddress('vkCreateDescriptorSetLayout', aInstance)); + vkDestroyDescriptorSetLayout := TvkDestroyDescriptorSetLayout (vkGetProcAddress('vkDestroyDescriptorSetLayout', aInstance)); + vkCreateDescriptorPool := TvkCreateDescriptorPool (vkGetProcAddress('vkCreateDescriptorPool', aInstance)); + vkDestroyDescriptorPool := TvkDestroyDescriptorPool (vkGetProcAddress('vkDestroyDescriptorPool', aInstance)); + vkResetDescriptorPool := TvkResetDescriptorPool (vkGetProcAddress('vkResetDescriptorPool', aInstance)); + vkAllocateDescriptorSets := TvkAllocateDescriptorSets (vkGetProcAddress('vkAllocateDescriptorSets', aInstance)); + vkFreeDescriptorSets := TvkFreeDescriptorSets (vkGetProcAddress('vkFreeDescriptorSets', aInstance)); + vkUpdateDescriptorSets := TvkUpdateDescriptorSets (vkGetProcAddress('vkUpdateDescriptorSets', aInstance)); + vkCreateFramebuffer := TvkCreateFramebuffer (vkGetProcAddress('vkCreateFramebuffer', aInstance)); + vkDestroyFramebuffer := TvkDestroyFramebuffer (vkGetProcAddress('vkDestroyFramebuffer', aInstance)); + vkCreateRenderPass := TvkCreateRenderPass (vkGetProcAddress('vkCreateRenderPass', aInstance)); + vkDestroyRenderPass := TvkDestroyRenderPass (vkGetProcAddress('vkDestroyRenderPass', aInstance)); + vkGetRenderAreaGranularity := TvkGetRenderAreaGranularity (vkGetProcAddress('vkGetRenderAreaGranularity', aInstance)); + vkCreateCommandPool := TvkCreateCommandPool (vkGetProcAddress('vkCreateCommandPool', aInstance)); + vkDestroyCommandPool := TvkDestroyCommandPool (vkGetProcAddress('vkDestroyCommandPool', aInstance)); + vkResetCommandPool := TvkResetCommandPool (vkGetProcAddress('vkResetCommandPool', aInstance)); + vkAllocateCommandBuffers := TvkAllocateCommandBuffers (vkGetProcAddress('vkAllocateCommandBuffers', aInstance)); + vkFreeCommandBuffers := TvkFreeCommandBuffers (vkGetProcAddress('vkFreeCommandBuffers', aInstance)); + vkBeginCommandBuffer := TvkBeginCommandBuffer (vkGetProcAddress('vkBeginCommandBuffer', aInstance)); + vkEndCommandBuffer := TvkEndCommandBuffer (vkGetProcAddress('vkEndCommandBuffer', aInstance)); + vkResetCommandBuffer := TvkResetCommandBuffer (vkGetProcAddress('vkResetCommandBuffer', aInstance)); + vkCmdBindPipeline := TvkCmdBindPipeline (vkGetProcAddress('vkCmdBindPipeline', aInstance)); + vkCmdSetViewport := TvkCmdSetViewport (vkGetProcAddress('vkCmdSetViewport', aInstance)); + vkCmdSetScissor := TvkCmdSetScissor (vkGetProcAddress('vkCmdSetScissor', aInstance)); + vkCmdSetLineWidth := TvkCmdSetLineWidth (vkGetProcAddress('vkCmdSetLineWidth', aInstance)); + vkCmdSetDepthBias := TvkCmdSetDepthBias (vkGetProcAddress('vkCmdSetDepthBias', aInstance)); + vkCmdSetBlendConstants := TvkCmdSetBlendConstants (vkGetProcAddress('vkCmdSetBlendConstants', aInstance)); + vkCmdSetDepthBounds := TvkCmdSetDepthBounds (vkGetProcAddress('vkCmdSetDepthBounds', aInstance)); + vkCmdSetStencilCompareMask := TvkCmdSetStencilCompareMask (vkGetProcAddress('vkCmdSetStencilCompareMask', aInstance)); + vkCmdSetStencilWriteMask := TvkCmdSetStencilWriteMask (vkGetProcAddress('vkCmdSetStencilWriteMask', aInstance)); + vkCmdSetStencilReference := TvkCmdSetStencilReference (vkGetProcAddress('vkCmdSetStencilReference', aInstance)); + vkCmdBindDescriptorSets := TvkCmdBindDescriptorSets (vkGetProcAddress('vkCmdBindDescriptorSets', aInstance)); + vkCmdBindIndexBuffer := TvkCmdBindIndexBuffer (vkGetProcAddress('vkCmdBindIndexBuffer', aInstance)); + vkCmdBindVertexBuffers := TvkCmdBindVertexBuffers (vkGetProcAddress('vkCmdBindVertexBuffers', aInstance)); + vkCmdDraw := TvkCmdDraw (vkGetProcAddress('vkCmdDraw', aInstance)); + vkCmdDrawIndexed := TvkCmdDrawIndexed (vkGetProcAddress('vkCmdDrawIndexed', aInstance)); + vkCmdDrawIndirect := TvkCmdDrawIndirect (vkGetProcAddress('vkCmdDrawIndirect', aInstance)); + vkCmdDrawIndexedIndirect := TvkCmdDrawIndexedIndirect (vkGetProcAddress('vkCmdDrawIndexedIndirect', aInstance)); + vkCmdDispatch := TvkCmdDispatch (vkGetProcAddress('vkCmdDispatch', aInstance)); + vkCmdDispatchIndirect := TvkCmdDispatchIndirect (vkGetProcAddress('vkCmdDispatchIndirect', aInstance)); + vkCmdCopyBuffer := TvkCmdCopyBuffer (vkGetProcAddress('vkCmdCopyBuffer', aInstance)); + vkCmdCopyImage := TvkCmdCopyImage (vkGetProcAddress('vkCmdCopyImage', aInstance)); + vkCmdBlitImage := TvkCmdBlitImage (vkGetProcAddress('vkCmdBlitImage', aInstance)); + vkCmdCopyBufferToImage := TvkCmdCopyBufferToImage (vkGetProcAddress('vkCmdCopyBufferToImage', aInstance)); + vkCmdCopyImageToBuffer := TvkCmdCopyImageToBuffer (vkGetProcAddress('vkCmdCopyImageToBuffer', aInstance)); + vkCmdUpdateBuffer := TvkCmdUpdateBuffer (vkGetProcAddress('vkCmdUpdateBuffer', aInstance)); + vkCmdFillBuffer := TvkCmdFillBuffer (vkGetProcAddress('vkCmdFillBuffer', aInstance)); + vkCmdClearColorImage := TvkCmdClearColorImage (vkGetProcAddress('vkCmdClearColorImage', aInstance)); + vkCmdClearDepthStencilImage := TvkCmdClearDepthStencilImage (vkGetProcAddress('vkCmdClearDepthStencilImage', aInstance)); + vkCmdClearAttachments := TvkCmdClearAttachments (vkGetProcAddress('vkCmdClearAttachments', aInstance)); + vkCmdResolveImage := TvkCmdResolveImage (vkGetProcAddress('vkCmdResolveImage', aInstance)); + vkCmdSetEvent := TvkCmdSetEvent (vkGetProcAddress('vkCmdSetEvent', aInstance)); + vkCmdResetEvent := TvkCmdResetEvent (vkGetProcAddress('vkCmdResetEvent', aInstance)); + vkCmdWaitEvents := TvkCmdWaitEvents (vkGetProcAddress('vkCmdWaitEvents', aInstance)); + vkCmdPipelineBarrier := TvkCmdPipelineBarrier (vkGetProcAddress('vkCmdPipelineBarrier', aInstance)); + vkCmdBeginQuery := TvkCmdBeginQuery (vkGetProcAddress('vkCmdBeginQuery', aInstance)); + vkCmdEndQuery := TvkCmdEndQuery (vkGetProcAddress('vkCmdEndQuery', aInstance)); + vkCmdResetQueryPool := TvkCmdResetQueryPool (vkGetProcAddress('vkCmdResetQueryPool', aInstance)); + vkCmdWriteTimestamp := TvkCmdWriteTimestamp (vkGetProcAddress('vkCmdWriteTimestamp', aInstance)); + vkCmdCopyQueryPoolResults := TvkCmdCopyQueryPoolResults (vkGetProcAddress('vkCmdCopyQueryPoolResults', aInstance)); + vkCmdPushConstants := TvkCmdPushConstants (vkGetProcAddress('vkCmdPushConstants', aInstance)); + vkCmdBeginRenderPass := TvkCmdBeginRenderPass (vkGetProcAddress('vkCmdBeginRenderPass', aInstance)); + vkCmdNextSubpass := TvkCmdNextSubpass (vkGetProcAddress('vkCmdNextSubpass', aInstance)); + vkCmdEndRenderPass := TvkCmdEndRenderPass (vkGetProcAddress('vkCmdEndRenderPass', aInstance)); + vkCmdExecuteCommands := TvkCmdExecuteCommands (vkGetProcAddress('vkCmdExecuteCommands', aInstance)); + +{ ========================================== VK_KHR_surface ========================================== } + vkDestroySurfaceKHR := TvkDestroySurfaceKHR (vkGetProcAddress('vkDestroySurfaceKHR', aInstance)); + vkGetPhysicalDeviceSurfaceSupportKHR := TvkGetPhysicalDeviceSurfaceSupportKHR (vkGetProcAddress('vkGetPhysicalDeviceSurfaceSupportKHR', aInstance)); + vkGetPhysicalDeviceSurfaceCapabilitiesKHR := TvkGetPhysicalDeviceSurfaceCapabilitiesKHR (vkGetProcAddress('vkGetPhysicalDeviceSurfaceCapabilitiesKHR', aInstance)); + vkGetPhysicalDeviceSurfaceFormatsKHR := TvkGetPhysicalDeviceSurfaceFormatsKHR (vkGetProcAddress('vkGetPhysicalDeviceSurfaceFormatsKHR', aInstance)); + vkGetPhysicalDeviceSurfacePresentModesKHR := TvkGetPhysicalDeviceSurfacePresentModesKHR (vkGetProcAddress('vkGetPhysicalDeviceSurfacePresentModesKHR', aInstance)); + +{ ========================================= VK_KHR_swapchain ========================================= } + vkCreateSwapchainKHR := TvkCreateSwapchainKHR (vkGetProcAddress('vkCreateSwapchainKHR', aInstance)); + vkDestroySwapchainKHR := TvkDestroySwapchainKHR (vkGetProcAddress('vkDestroySwapchainKHR', aInstance)); + vkGetSwapchainImagesKHR := TvkGetSwapchainImagesKHR (vkGetProcAddress('vkGetSwapchainImagesKHR', aInstance)); + vkAcquireNextImageKHR := TvkAcquireNextImageKHR (vkGetProcAddress('vkAcquireNextImageKHR', aInstance)); + vkQueuePresentKHR := TvkQueuePresentKHR (vkGetProcAddress('vkQueuePresentKHR', aInstance)); + +{ ========================================== VK_KHR_display ========================================== } + vkGetPhysicalDeviceDisplayPropertiesKHR := TvkGetPhysicalDeviceDisplayPropertiesKHR (vkGetProcAddress('vkGetPhysicalDeviceDisplayPropertiesKHR', aInstance)); + vkGetPhysicalDeviceDisplayPlanePropertiesKHR := TvkGetPhysicalDeviceDisplayPlanePropertiesKHR (vkGetProcAddress('vkGetPhysicalDeviceDisplayPlanePropertiesKHR', aInstance)); + vkGetDisplayPlaneSupportedDisplaysKHR := TvkGetDisplayPlaneSupportedDisplaysKHR (vkGetProcAddress('vkGetDisplayPlaneSupportedDisplaysKHR', aInstance)); + vkGetDisplayModePropertiesKHR := TvkGetDisplayModePropertiesKHR (vkGetProcAddress('vkGetDisplayModePropertiesKHR', aInstance)); + vkCreateDisplayModeKHR := TvkCreateDisplayModeKHR (vkGetProcAddress('vkCreateDisplayModeKHR', aInstance)); + vkGetDisplayPlaneCapabilitiesKHR := TvkGetDisplayPlaneCapabilitiesKHR (vkGetProcAddress('vkGetDisplayPlaneCapabilitiesKHR', aInstance)); + vkCreateDisplayPlaneSurfaceKHR := TvkCreateDisplayPlaneSurfaceKHR (vkGetProcAddress('vkCreateDisplayPlaneSurfaceKHR', aInstance)); + +{ ===================================== VK_KHR_display_swapchain ===================================== } + vkCreateSharedSwapchainsKHR := TvkCreateSharedSwapchainsKHR (vkGetProcAddress('vkCreateSharedSwapchainsKHR', aInstance)); + +{ ======================================= VK_KHR_xlib_surface ======================================== } +{$IFDEF VK_USE_PLATFORM_XLIB_KHR} + vkCreateXlibSurfaceKHR := TvkCreateXlibSurfaceKHR (vkGetProcAddress('vkCreateXlibSurfaceKHR', aInstance)); + vkGetPhysicalDeviceXlibPresentationSupportKHR := TvkGetPhysicalDeviceXlibPresentationSupportKHR (vkGetProcAddress('vkGetPhysicalDeviceXlibPresentationSupportKHR', aInstance)); +{$ENDIF} + +{ ======================================== VK_KHR_xcb_surface ======================================== } +{$IFDEF VK_USE_PLATFORM_XCB_KHR} + vkCreateXcbSurfaceKHR := TvkCreateXcbSurfaceKHR (vkGetProcAddress('vkCreateXcbSurfaceKHR', aInstance)); + vkGetPhysicalDeviceXcbPresentationSupportKHR := TvkGetPhysicalDeviceXcbPresentationSupportKHR (vkGetProcAddress('vkGetPhysicalDeviceXcbPresentationSupportKHR', aInstance)); +{$ENDIF} + +{ ====================================== VK_KHR_wayland_surface ====================================== } +{$IFDEF VK_USE_PLATFORM_WAYLAND_KHR} + vkCreateWaylandSurfaceKHR := TvkCreateWaylandSurfaceKHR (vkGetProcAddress('vkCreateWaylandSurfaceKHR', aInstance)); + vkGetPhysicalDeviceWaylandPresentationSupportKHR := TvkGetPhysicalDeviceWaylandPresentationSupportKHR (vkGetProcAddress('vkGetPhysicalDeviceWaylandPresentationSupportKHR',aInstance)); +{$ENDIF} + +{ ======================================== VK_KHR_mir_surface ======================================== } +{$IFDEF VK_USE_PLATFORM_MIR_KHR} + vkCreateMirSurfaceKHR := TvkCreateMirSurfaceKHR (vkGetProcAddress('vkCreateMirSurfaceKHR', aInstance)); + vkGetPhysicalDeviceMirPresentationSupportKHR := TvkGetPhysicalDeviceMirPresentationSupportKHR (vkGetProcAddress('vkGetPhysicalDeviceMirPresentationSupportKHR', aInstance)); +{$ENDIF} + +{ ====================================== VK_KHR_android_surface ====================================== } +{$IFDEF VK_USE_PLATFORM_ANDROID_KHR} + vkCreateAndroidSurfaceKHR := TvkCreateAndroidSurfaceKHR (vkGetProcAddress('vkCreateAndroidSurfaceKHR', aInstance)); +{$ENDIF} + +{ ======================================= VK_KHR_win32_surface ======================================= } +{$IFDEF VK_USE_PLATFORM_WIN32_KHR} + vkCreateWin32SurfaceKHR := TvkCreateWin32SurfaceKHR (vkGetProcAddress('vkCreateWin32SurfaceKHR', aInstance)); + vkGetPhysicalDeviceWin32PresentationSupportKHR := TvkGetPhysicalDeviceWin32PresentationSupportKHR (vkGetProcAddress('vkGetPhysicalDeviceWin32PresentationSupportKHR', aInstance)); +{$ENDIF} + +{ ======================================= VK_EXT_debug_report ======================================== } + vkCreateDebugReportCallbackEXT := TvkCreateDebugReportCallbackEXT (vkGetProcAddress('vkCreateDebugReportCallbackEXT', aInstance)); + vkDestroyDebugReportCallbackEXT := TvkDestroyDebugReportCallbackEXT (vkGetProcAddress('vkDestroyDebugReportCallbackEXT', aInstance)); + vkDebugReportMessageEXT := TvkDebugReportMessageEXT (vkGetProcAddress('vkDebugReportMessageEXT', aInstance)); + +end; + procedure vkFreeLibrary(var aLibHandle: TvkLibHandle); begin if (aLibHandle <> InvalidLibHandle) then begin @@ -2681,149 +4686,15 @@ begin result := (vkLibHandle <> InvalidLibHandle); if not result then exit; - -{********************************* VK_VERSION_1_0 *********************************} - - vkCmdDispatch := vkGetProcAddress('vkCmdDispatch'); - vkCmdDraw := vkGetProcAddress('vkCmdDraw'); - vkCmdDrawIndexed := vkGetProcAddress('vkCmdDrawIndexed'); - vkCmdEndRenderPass := vkGetProcAddress('vkCmdEndRenderPass'); - vkCmdExecuteCommands := vkGetProcAddress('vkCmdExecuteCommands'); - vkCmdSetBlendConstants := vkGetProcAddress('vkCmdSetBlendConstants'); - vkCmdSetDepthBias := vkGetProcAddress('vkCmdSetDepthBias'); - vkDeviceWaitIdle := vkGetProcAddress('vkDeviceWaitIdle'); - vkGetDeviceProcAddr := vkGetProcAddress('vkGetDeviceProcAddr'); - vkGetInstanceProcAddr := vkGetProcAddress('vkGetInstanceProcAddr'); - vkEnumeratePhysicalDevices := vkGetProcAddress('vkEnumeratePhysicalDevices'); - vkGetDeviceQueue := vkGetProcAddress('vkGetDeviceQueue'); - vkQueueWaitIdle := vkGetProcAddress('vkQueueWaitIdle'); - vkCmdSetDepthBounds := vkGetProcAddress('vkCmdSetDepthBounds'); - vkCmdSetLineWidth := vkGetProcAddress('vkCmdSetLineWidth'); - vkEndCommandBuffer := vkGetProcAddress('vkEndCommandBuffer'); - vkFreeCommandBuffers := vkGetProcAddress('vkFreeCommandBuffers'); - vkFreeDescriptorSets := vkGetProcAddress('vkFreeDescriptorSets'); - vkUnmapMemory := vkGetProcAddress('vkUnmapMemory'); - vkGetEventStatus := vkGetProcAddress('vkGetEventStatus'); - vkResetEvent := vkGetProcAddress('vkResetEvent'); - vkSetEvent := vkGetProcAddress('vkSetEvent'); - vkGetFenceStatus := vkGetProcAddress('vkGetFenceStatus'); - vkResetFences := vkGetProcAddress('vkResetFences'); - vkGetPipelineCacheData := vkGetProcAddress('vkGetPipelineCacheData'); - vkMergePipelineCaches := vkGetProcAddress('vkMergePipelineCaches'); - vkCmdEndQuery := vkGetProcAddress('vkCmdEndQuery'); - vkCmdResetQueryPool := vkGetProcAddress('vkCmdResetQueryPool'); - vkWaitForFences := vkGetProcAddress('vkWaitForFences'); - vkGetRenderAreaGranularity := vkGetProcAddress('vkGetRenderAreaGranularity'); - vkBindBufferMemory := vkGetProcAddress('vkBindBufferMemory'); - vkBindImageMemory := vkGetProcAddress('vkBindImageMemory'); - vkCmdBindVertexBuffers := vkGetProcAddress('vkCmdBindVertexBuffers'); - vkCmdDispatchIndirect := vkGetProcAddress('vkCmdDispatchIndirect'); - vkCmdDrawIndexedIndirect := vkGetProcAddress('vkCmdDrawIndexedIndirect'); - vkCmdDrawIndirect := vkGetProcAddress('vkCmdDrawIndirect'); - vkCmdFillBuffer := vkGetProcAddress('vkCmdFillBuffer'); - vkCmdUpdateBuffer := vkGetProcAddress('vkCmdUpdateBuffer'); - vkGetDeviceMemoryCommitment := vkGetProcAddress('vkGetDeviceMemoryCommitment'); - vkResetCommandBuffer := vkGetProcAddress('vkResetCommandBuffer'); - vkResetCommandPool := vkGetProcAddress('vkResetCommandPool'); - vkResetDescriptorPool := vkGetProcAddress('vkResetDescriptorPool'); - vkMapMemory := vkGetProcAddress('vkMapMemory'); - vkCmdResetEvent := vkGetProcAddress('vkCmdResetEvent'); - vkCmdSetEvent := vkGetProcAddress('vkCmdSetEvent'); - vkCmdBeginQuery := vkGetProcAddress('vkCmdBeginQuery'); - vkCmdCopyQueryPoolResults := vkGetProcAddress('vkCmdCopyQueryPoolResults'); - vkGetQueryPoolResults := vkGetProcAddress('vkGetQueryPoolResults'); - vkCmdPushConstants := vkGetProcAddress('vkCmdPushConstants'); - vkCmdSetStencilCompareMask := vkGetProcAddress('vkCmdSetStencilCompareMask'); - vkCmdSetStencilReference := vkGetProcAddress('vkCmdSetStencilReference'); - vkCmdSetStencilWriteMask := vkGetProcAddress('vkCmdSetStencilWriteMask'); - vkCmdBindPipeline := vkGetProcAddress('vkCmdBindPipeline'); - vkCmdBindDescriptorSets := vkGetProcAddress('vkCmdBindDescriptorSets'); - vkCmdSetViewport := vkGetProcAddress('vkCmdSetViewport'); - vkEnumerateDeviceExtensionProperties := vkGetProcAddress('vkEnumerateDeviceExtensionProperties'); - vkEnumerateInstanceExtensionProperties := vkGetProcAddress('vkEnumerateInstanceExtensionProperties'); - vkEnumerateDeviceLayerProperties := vkGetProcAddress('vkEnumerateDeviceLayerProperties'); - vkEnumerateInstanceLayerProperties := vkGetProcAddress('vkEnumerateInstanceLayerProperties'); - vkCmdBindIndexBuffer := vkGetProcAddress('vkCmdBindIndexBuffer'); - vkGetPhysicalDeviceFeatures := vkGetProcAddress('vkGetPhysicalDeviceFeatures'); - vkCmdCopyBuffer := vkGetProcAddress('vkCmdCopyBuffer'); - vkGetBufferMemoryRequirements := vkGetProcAddress('vkGetBufferMemoryRequirements'); - vkGetImageMemoryRequirements := vkGetProcAddress('vkGetImageMemoryRequirements'); - vkGetPhysicalDeviceFormatProperties := vkGetProcAddress('vkGetPhysicalDeviceFormatProperties'); - vkGetImageSubresourceLayout := vkGetProcAddress('vkGetImageSubresourceLayout'); - vkCmdClearColorImage := vkGetProcAddress('vkCmdClearColorImage'); - vkCmdClearDepthStencilImage := vkGetProcAddress('vkCmdClearDepthStencilImage'); - vkCmdSetScissor := vkGetProcAddress('vkCmdSetScissor'); - vkGetPhysicalDeviceQueueFamilyProperties := vkGetProcAddress('vkGetPhysicalDeviceQueueFamilyProperties'); - vkGetPhysicalDeviceImageFormatProperties := vkGetProcAddress('vkGetPhysicalDeviceImageFormatProperties'); - vkAllocateCommandBuffers := vkGetProcAddress('vkAllocateCommandBuffers'); - vkAllocateDescriptorSets := vkGetProcAddress('vkAllocateDescriptorSets'); - vkCmdCopyBufferToImage := vkGetProcAddress('vkCmdCopyBufferToImage'); - vkCmdCopyImageToBuffer := vkGetProcAddress('vkCmdCopyImageToBuffer'); - vkCmdBlitImage := vkGetProcAddress('vkCmdBlitImage'); - vkCmdCopyImage := vkGetProcAddress('vkCmdCopyImage'); - vkCmdResolveImage := vkGetProcAddress('vkCmdResolveImage'); - vkGetPhysicalDeviceMemoryProperties := vkGetProcAddress('vkGetPhysicalDeviceMemoryProperties'); - vkGetPhysicalDeviceProperties := vkGetProcAddress('vkGetPhysicalDeviceProperties'); - vkGetImageSparseMemoryRequirements := vkGetProcAddress('vkGetImageSparseMemoryRequirements'); - vkCreateBuffer := vkGetProcAddress('vkCreateBuffer'); - vkCreateBufferView := vkGetProcAddress('vkCreateBufferView'); - vkCreateCommandPool := vkGetProcAddress('vkCreateCommandPool'); - vkCreateDescriptorPool := vkGetProcAddress('vkCreateDescriptorPool'); - vkDestroyBuffer := vkGetProcAddress('vkDestroyBuffer'); - vkDestroyBufferView := vkGetProcAddress('vkDestroyBufferView'); - vkDestroyCommandPool := vkGetProcAddress('vkDestroyCommandPool'); - vkDestroyDescriptorPool := vkGetProcAddress('vkDestroyDescriptorPool'); - vkDestroyDescriptorSetLayout := vkGetProcAddress('vkDestroyDescriptorSetLayout'); - vkDestroyDevice := vkGetProcAddress('vkDestroyDevice'); - vkDestroyEvent := vkGetProcAddress('vkDestroyEvent'); - vkDestroyFence := vkGetProcAddress('vkDestroyFence'); - vkDestroyFramebuffer := vkGetProcAddress('vkDestroyFramebuffer'); - vkDestroyImage := vkGetProcAddress('vkDestroyImage'); - vkDestroyImageView := vkGetProcAddress('vkDestroyImageView'); - vkDestroyInstance := vkGetProcAddress('vkDestroyInstance'); - vkDestroyPipeline := vkGetProcAddress('vkDestroyPipeline'); - vkDestroyPipelineCache := vkGetProcAddress('vkDestroyPipelineCache'); - vkDestroyPipelineLayout := vkGetProcAddress('vkDestroyPipelineLayout'); - vkDestroyQueryPool := vkGetProcAddress('vkDestroyQueryPool'); - vkDestroyRenderPass := vkGetProcAddress('vkDestroyRenderPass'); - vkDestroySampler := vkGetProcAddress('vkDestroySampler'); - vkDestroySemaphore := vkGetProcAddress('vkDestroySemaphore'); - vkDestroyShaderModule := vkGetProcAddress('vkDestroyShaderModule'); - vkFreeMemory := vkGetProcAddress('vkFreeMemory'); - vkCmdClearAttachments := vkGetProcAddress('vkCmdClearAttachments'); - vkCreateDevice := vkGetProcAddress('vkCreateDevice'); - vkBeginCommandBuffer := vkGetProcAddress('vkBeginCommandBuffer'); - vkCreateDescriptorSetLayout := vkGetProcAddress('vkCreateDescriptorSetLayout'); - vkQueueBindSparse := vkGetProcAddress('vkQueueBindSparse'); - vkCmdNextSubpass := vkGetProcAddress('vkCmdNextSubpass'); - vkCmdWriteTimestamp := vkGetProcAddress('vkCmdWriteTimestamp'); - vkGetPhysicalDeviceSparseImageFormatProperties := vkGetProcAddress('vkGetPhysicalDeviceSparseImageFormatProperties'); - vkFlushMappedMemoryRanges := vkGetProcAddress('vkFlushMappedMemoryRanges'); - vkInvalidateMappedMemoryRanges := vkGetProcAddress('vkInvalidateMappedMemoryRanges'); - vkAllocateMemory := vkGetProcAddress('vkAllocateMemory'); - vkCreateEvent := vkGetProcAddress('vkCreateEvent'); - vkCreateFence := vkGetProcAddress('vkCreateFence'); - vkCreateFramebuffer := vkGetProcAddress('vkCreateFramebuffer'); - vkCreateImage := vkGetProcAddress('vkCreateImage'); - vkCreatePipelineCache := vkGetProcAddress('vkCreatePipelineCache'); - vkQueueSubmit := vkGetProcAddress('vkQueueSubmit'); - vkCreateQueryPool := vkGetProcAddress('vkCreateQueryPool'); - vkCreateSampler := vkGetProcAddress('vkCreateSampler'); - vkCreateSemaphore := vkGetProcAddress('vkCreateSemaphore'); - vkCreateShaderModule := vkGetProcAddress('vkCreateShaderModule'); - vkCmdPipelineBarrier := vkGetProcAddress('vkCmdPipelineBarrier'); - vkCmdWaitEvents := vkGetProcAddress('vkCmdWaitEvents'); - vkCreatePipelineLayout := vkGetProcAddress('vkCreatePipelineLayout'); - vkCmdBeginRenderPass := vkGetProcAddress('vkCmdBeginRenderPass'); - vkCreateRenderPass := vkGetProcAddress('vkCreateRenderPass'); - vkCreateComputePipelines := vkGetProcAddress('vkCreateComputePipelines'); - vkCreateGraphicsPipelines := vkGetProcAddress('vkCreateGraphicsPipelines'); - vkCreateImageView := vkGetProcAddress('vkCreateImageView'); - vkCreateInstance := vkGetProcAddress('vkCreateInstance'); - vkUpdateDescriptorSets := vkGetProcAddress('vkUpdateDescriptorSets'); - + vkGetInstanceProcAddr := TvkGetInstanceProcAddr(vkGetProcAddress('vkGetInstanceProcAddr')); + vkLoadAddresses(nil); end; +procedure LoadVulkanCommands(const aInstance: VkInstance); +begin + vkLoadAddresses(aInstance); +end; + procedure FinalizeVulkan; begin vkFreeLibrary(vkLibHandle); diff --git a/projects/generator/HeaderGenerator.pas b/projects/generator/HeaderGenerator.pas index b8d1765..1c0056d 100644 --- a/projects/generator/HeaderGenerator.pas +++ b/projects/generator/HeaderGenerator.pas @@ -5,12 +5,48 @@ unit HeaderGenerator; interface uses - Classes, SysUtils, DOM, fgl, variants; + Classes, SysUtils, DOM, uutlGenerics, variants; type //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// THeaderGenerator = class(TObject) private type + TStringTree = class(TObject) + public type + TItemList = specialize TutlList; + TItemMap = specialize TutlMap; + private + fLinesBefore: TStringList; + fLinesAfter: TStringList; + fItemList: TItemList; + fItemMap: TItemMap; + + function GetItem(const aName: String): TStringTree; + function GetItemCount: Integer; + function GetItemsByIndex(const aIndex: Integer): TStringTree; + function GetLinesAfter: TStrings; + function GetLinesBefore: TStrings; + function GetText: String; + public + property Text: String read GetText; + property LinesBefore: TStrings read GetLinesBefore; + property LinesAfter: TStrings read GetLinesAfter; + property ItemCount: Integer read GetItemCount; + + property Items [const aName: String]: TStringTree read GetItem; + property ItemsByIndex[const aIndex: Integer]: TStringTree read GetItemsByIndex; + + function IndexOf(const aItem: TStringTree): Integer; + function GetOrCreateItem(const aName: String): TStringTree; + function CreateItemAt(const aName: String; const aIndex: Integer): TStringTree; + function DestroyItem(const aName: String): Boolean; + procedure Clear; + + constructor Create; + destructor Destroy; override; + end; + + //////////////////////////////////////////////////////////////////////////////////////////// TvkObjectType = ( otUnknown, otType, @@ -23,12 +59,13 @@ type TvkObjectTypes = set of TvkObjectType; TvkObject = class; - TvkObjectList = class(specialize TFPGObjectList) + TvkObjectList = class(specialize TutlList) public function IndexOfObj(const aName: DOMstring; const aTypes: TvkObjectTypes): Integer; function FindObj(const aName: DOMstring; const aTypes: TvkObjectTypes; out aObject): Boolean; - procedure MarkObj(const aName: DOMstring; const aTypes: TvkObjectTypes; const aMark: Integer); function GetPascalName(const aName: DOMString; const aPointer: Integer; const aArrSize: WideString = ''): WideString; + function GenerateCode(const aName: String; const aCode: TStringTree): Boolean; + procedure AddObject(const aObj: TvkObject); end; //////////////////////////////////////////////////////////////////////////////////////////// @@ -37,77 +74,56 @@ type fType: TvkObjectType; fName: DOMString; fComment: DOMString; - fMark: Integer; - fConstGenerated: Boolean; - fTypeGenerated: Boolean; - fPtrGenerated: Boolean; - fVarGenerated: Boolean; - fImplGenerated: Boolean; fList: TvkObjectList; - private - procedure SetMark(aValue: Integer); protected function GetDependencyOrder: Integer; virtual; - procedure DoMark(const aMark: Integer); virtual; procedure GenPascalName(var aName: WideString; const aPointer: Integer; const aArrSize: WideString); virtual; - public - property VkType: TvkObjectType read fType; - property Name: DOMString read fName write fName; - property Comment: DOMString read fComment write fComment; - property Mark: Integer read fMark write SetMark; - property ConstGenerated: Boolean read fConstGenerated; - property TypeGenerated: Boolean read fTypeGenerated; - property PtrGenerated: Boolean read fPtrGenerated; - property VarGenerated: Boolean read fVarGenerated; - property ImplGenerated: Boolean read fImplGenerated; - property DependencyOrder: Integer read GetDependencyOrder; - property List: TvkObjectList read fList write fList; - - procedure AddCommentFromXml(xml: TDOMNode); - function GetPascalName(const aPointer: Integer; const aArrSize: WideString): WideString; - function GenerateConst(const aCode: TStrings): Boolean; virtual; - function GenerateType(const aCode: TStrings): Boolean; virtual; - function GeneratePtr(const aCode: TStrings): Boolean; virtual; - function GenerateVar(const aCode: TStrings): Boolean; virtual; - function GenerateImpl(const aCode: TStrings): Boolean; virtual; + {%H-}constructor Create(const aType: TvkObjectType); + public + property VkType: TvkObjectType read fType; + property Name: DOMString read fName write fName; + property Comment: DOMString read fComment write fComment; + property List: TvkObjectList read fList write fList; - constructor Create(const aType: TvkObjectType); + function GetPascalName(const aPointer: Integer; const aArrSize: WideString): WideString; + procedure ReadXml(const xml: TDOMNode); virtual; + procedure GenerateCode(const aCode: TStringTree); virtual; public - class function CreateFromXml(const xml: TDOMNode): THeaderGenerator.TvkObject; + class procedure CreateFromXml(const xml: TDOMNode; const aList: TvkObjectList); end; //////////////////////////////////////////////////////////////////////////////////////////// - TvkTypeSimple = class(TvkObject) + TvkTypeBase = class(TvkObject) private fParent: DOMString; fAlias: DOMString; protected function GetDependencyOrder: Integer; override; - procedure DoMark(const aMark: Integer); override; procedure GenPascalName(var aName: WideString; const aPointer: Integer; const aArrSize: WideString); override; public property Parent: DOMString read fParent write fParent; property Alias: DOMString read fAlias write fAlias; - function GenerateType(const aCode: TStrings): Boolean; override; - function GeneratePtr(const aCode: TStrings): Boolean; override; - public - class function CreateFromXml(const xml: TDOMNode): THeaderGenerator.TvkTypeSimple; + procedure GenerateCode(const aCode: TStringTree); override; end; //////////////////////////////////////////////////////////////////////////////////////////// - TvkTypeHandle = class(TvkTypeSimple) - private - fNonDispatchable: Boolean; + TvkType = class(TvkTypeBase) public - property NonDispatchable: Boolean read fNonDispatchable write fNonDispatchable; + procedure ReadXml(const xml: TDOMNode); override; + constructor Create; + end; + + //////////////////////////////////////////////////////////////////////////////////////////// + TvkHandle = class(TvkTypeBase) public - class function CreateFromXml(const xml: TDOMNode): THeaderGenerator.TvkTypeHandle; + procedure ReadXml(const xml: TDOMNode); override; + constructor Create; end; //////////////////////////////////////////////////////////////////////////////////////////// - TvkTypeFunction = class(TvkObject) + TvkFunctionBase = class(TvkObject) private type TArgument = class(TObject) Typ: DOMString; @@ -115,44 +131,42 @@ type IsPointer: Integer; IsConst: Boolean; end; - TArgumentList = specialize TFPGObjectList; + TArgumentList = specialize TutlList; private fReturnValue: TArgument; fArguments: TArgumentList; protected function GetDependencyOrder: Integer; override; - procedure DoMark(const aMark: Integer); override; procedure GenPascalName(var aName: WideString; const aPointer: Integer; const aArrSize: WideString); override; - procedure GenerateFunctionPtr(const aCode: TStrings); + procedure GenerateFunctionPtr(const aCode, aSub: TStringTree); + + {%H-}constructor Create(const aType: TvkObjectType); public property ReturnValue: TArgument read fReturnValue; property Arguments: TArgumentList read fArguments; - constructor Create(const aType: TvkObjectType); destructor Destroy; override; end; //////////////////////////////////////////////////////////////////////////////////////////// - TvkTypeFunctionPtr = class(TvkTypeFunction) + TvkFunctionPtr = class(TvkFunctionBase) public - function GenerateType(const aCode: TStrings): Boolean; override; - public - class function CreateFromXml(const xml: TDOMNode): THeaderGenerator.TvkTypeFunctionPtr; + procedure ReadXml(const xml: TDOMNode); override; + procedure GenerateCode(const aCode: TStringTree); override; + constructor Create; end; //////////////////////////////////////////////////////////////////////////////////////////// - TvkCommand = class(TvkTypeFunction) - public - function GenerateType(const aCode: TStrings): Boolean; override; - function GenerateVar(const aCode: TStrings): Boolean; override; - function GenerateImpl(const aCode: TStrings): Boolean; override; + TvkCommand = class(TvkFunctionBase) public - class function CreateFromXml(const xml: TDOMNode): THeaderGenerator.TvkCommand; + procedure ReadXml(const xml: TDOMNode); override; + procedure GenerateCode(const aCode: TStringTree); override; + constructor Create; end; //////////////////////////////////////////////////////////////////////////////////////////// - TvkTypeStruct = class(TvkObject) + TvkStruct = class(TvkObject) private type TMember = class(TObject) Typ: DOMString; @@ -161,66 +175,71 @@ type IsPointer: Integer; IsConst: Boolean; end; - TMemberList = specialize TFPGObjectList; + TMemberList = specialize TutlList; private fIsUnion: Boolean; fMember: TMemberList; protected function GetDependencyOrder: Integer; override; - procedure DoMark(const aMark: Integer); override; procedure GenPascalName(var aName: WideString; const aPointer: Integer; const aArrSize: WideString); override; public property Member: TMemberList read fMember; property IsUnion: Boolean read fIsUnion write fIsUnion; - function GenerateType(const aCode: TStrings): Boolean; override; + procedure ReadXml(const xml: TDOMNode); override; + procedure GenerateCode(const aCode: TStringTree); override; - constructor Create(const aType: TvkObjectType); + constructor Create; destructor Destroy; override; - public - class function CreateFromXml(const xml: TDOMNode): THeaderGenerator.TvkTypeStruct; end; //////////////////////////////////////////////////////////////////////////////////////////// - TvkTypeEnum = class(TvkObject) + TvkEnum = class(TvkObject) private type TValue = class(TObject) Name: DOMString; Value: Variant; IsBit: Boolean; end; - TValueList = specialize TFPGObjectList; + TValueList = specialize TutlList; private + fExpands: DOMString; fValues: TValueList; protected procedure GenPascalName(var aName: WideString; const aPointer: Integer; const aArrSize: WideString); override; public + property Expands: DOMString read fExpands write fExpands; property Values: TValueList read fValues; + procedure ReadXml(const xml: TDOMNode); override; + procedure GenerateCode(const aCode: TStringTree); override; - function GenerateConst(const aCode: TStrings): Boolean; override; - function GenerateType(const aCode: TStrings): Boolean; override; - - constructor Create(const aType: TvkObjectType); + constructor Create; destructor Destroy; override; - public - class function CreateFromXml(const xml: TDOMNode): THeaderGenerator.TvkTypeEnum; + end; + + //////////////////////////////////////////////////////////////////////////////////////////// + TvkConst = class(TvkObject) + private + fValue: Variant; + public + property Value: Variant read fValue write fValue; + procedure GenerateCode(const aCode: TStringTree); override; + constructor Create; end; private const VK_OBJECT_TYPES: TvkObjectTypes = [ otType, otHandle, otFuncPtr, otStruct, otEnum ]; + VK_OBJECT_ALL: TvkObjectTypes = [ low(TvkObjectType) .. high(TvkObjectType) ]; private fDocument: TXMLDocument; fObjects: TvkObjectList; - fOutputFile: String; - fTemplateFile: String; + fComment: WideString; public - property OutputFile: String read fOutputFile write fOutputFile; - property TemplateFile: String read fTemplateFile write fTemplateFile; - procedure ReadFile(const aFilename: String); procedure ReadFile(const aStream: TStream); + procedure GenerateCode(const aName: WideString; const aTemplate: String; const aOutput: String); procedure Clear; @@ -241,25 +260,18 @@ type end; const - COMMENT_HEAD = '{ ============================================================================' + sLineBreak; - COMMENT_BREAK = sLineBreak + sLineBreak + '==============================================================================' + sLineBreak + sLineBreak; - COMMENT_TAIL = sLineBreak + '============================================================================ }'; - COMMENT_CONTENT = - 'This file is autogenerated from vk.xml' + sLineBreak + - '' + sLineBreak + - 'You may retrieve the latest version of this file at the Delphi OpenGL' + sLineBreak + - 'Community home page, located at http://www.delphigl.com/' + sLineBreak + - '' + sLineBreak + - 'The contents of this file are used with permission, subject to' + sLineBreak + - 'the Mozilla Public License Version 1.1 (the "License"); you may' + sLineBreak + - 'not use this file except in compliance with the License. You may' + sLineBreak + - 'obtain a copy of the License at' + sLineBreak + - 'http://www.mozilla.org/MPL/MPL-1.1.html' + sLineBreak + - '' + sLineBreak + - 'Software distributed under the License is distributed on an' + sLineBreak + - '"AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or' + sLineBreak + - 'implied. See the License for the specific language governing' + sLineBreak + - 'rights and limitations under the License.' + sLineBreak; + KEYWORD_INTF = 'INTERFACE'; + KEYWORD_CONST = 'CONST'; + KEYWORD_TYPES = 'TYPES'; + KEYWORD_ENUM = 'ENUM'; + KEYWORD_ENUM_VALUES = 'ENUM_VALUES'; + KEYWORD_STRUCT = 'STRUCT'; + KEYWORD_FUNCPTR = 'FUNCPTR'; + KEYWORD_COMMAND = 'COMMAND'; + KEYWORD_IMPL = 'IMPLEMENTATION'; + KEYWORD_COMMENT = 'COMMENT'; + KEYWORD_VAR = 'VAR'; + KEYWORD_CODE = 'CODE'; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function PointerCount(const aStr: AnsiString): Integer; @@ -274,36 +286,68 @@ begin end; end; +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function StrToValue(s: String): Variant; +var + f: TFormatSettings; + rx: TRegExpr; +begin + f.DecimalSeparator := '.'; + rx := TRegExpr.Create; + try + result := Unassigned; + + rx.Expression := '^-?([0-9]+)$'; + if rx.Exec(s) then + result := StrToInt(rx.Match[0]); + + rx.Expression := '^0x([0-9A-Fa-f]+)$'; + if rx.Exec(s) then + result := '$' + rx.Match[1]; + + rx.Expression := '^([0-9\.]+)(f|d)?$'; + if rx.Exec(s) then begin + result := StrToFloat(rx.Match[1], f); + if (rx.Match[2] = 'd') then + result := Double(result); + end; + + rx.Expression := '^\(~0U([L]*)\)$'; + if rx.Exec(s) then begin + if (rx.Match[2] = '') + then result := '$' + IntToHex(High(UInt32), 2 * sizeof(UInt32)) + else result := '$' + IntToHex(High(UInt64), 2 * sizeof(UInt64)); + end; + finally + FreeAndNil(rx); + end; +end; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function PrepareName(const aName, aType: WideString): WideString; -var rx: TRegExpr; +var + rx: TRegExpr; + s: WideString; begin result := aName; - if (result = 'type') then begin + s := ''; + if (result = 'type') then + s := 'Type' + else if (result = 'object') then + s := 'Object'; + + if (s <> '') then begin rx := TRegExpr.Create('^(T|P)?(Vk)?(.)'); try if rx.Exec(String(aType)) - then result := WideString(LowerCase(rx.Match[3]) + 'Type') - else result := 'mType'; + then result := WideString(LowerCase(rx.Match[3]) + s) + else result := 'm' + s; finally FreeAndNil(rx); end; end; end; -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -function CompareVkObjDependency(const aItem1, aItem2: THeaderGenerator.TvkObject): Integer; -var - w1, w2: WideString; -begin - result := (aItem1.DependencyOrder - aItem2.DependencyOrder); - if (result = 0) then begin - w1 := aItem1.Name; - w2 := aItem2.Name; - result := strcomp(PWideChar(w1), PWideChar(w2)); - end; -end; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function FormatType(const aType: THeaderGenerator.TvkObjectType): WideString; begin @@ -332,7 +376,7 @@ var x: TDOMNode; begin x := xml.FindNode(aName); if not Assigned(x) then - raise XmlException.Create(xml.NodeName + ' witout child ''' + aName + '''', xml); + raise XmlException.Create(xml.NodeName + ' without child ''' + aName + '''', xml); result := x.TextContent; end; @@ -370,6 +414,21 @@ begin raise XmlException.Create(xml.NodeName + ' without ''' + aName + ''' attribute', xml); end; +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TryGetNodeAttrib(xml: TDOMNode; const aName: WideString; out aValue: DOMString): Boolean; +var x: TDOMNode; +begin + result := true; + if xml.HasAttributes then begin + x := xml.Attributes.GetNamedItem(aName); + if Assigned(x) then begin + aValue := x.TextContent; + exit; + end; + end; + result := false; +end; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function GetNodeAttrib(xml: TDOMNode; const aName: WideString; const aDefault: DOMString): DOMString; var x: TDOMNode; @@ -391,6 +450,130 @@ begin xml := aXml; end; +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//THeaderGenerator.TStringTree////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function THeaderGenerator.TStringTree.GetLinesAfter: TStrings; +begin + result := fLinesAfter; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function THeaderGenerator.TStringTree.GetLinesBefore: TStrings; +begin + result := fLinesBefore; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function THeaderGenerator.TStringTree.GetItem(const aName: String): TStringTree; +begin + result := fItemMap[aName]; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function THeaderGenerator.TStringTree.GetItemCount: Integer; +begin + result := fItemList.Count; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function THeaderGenerator.TStringTree.GetItemsByIndex(const aIndex: Integer): TStringTree; +begin + result := fItemList[aIndex]; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function THeaderGenerator.TStringTree.GetText: String; +var + i: Integer; + s: String; + + procedure AddText(const aText: String; const aCanAddEmpty: Boolean); + begin + if not aCanAddEmpty and (aText = '') then + exit; + result := result + aText + sLineBreak; + end; + +begin + result := ''; + for i := 0 to fLinesBefore.Count-1 do + AddText(fLinesBefore[i], true); + for i := 0 to fItemList.Count-1 do begin + s := fItemList[i].Text; + if (UpperCase(Trim(s)) = '{$ENDIF}') then + result := TrimRight(result) + sLineBreak; + AddText(s, false); + end; + for i := 0 to fLinesAfter.Count-1 do + AddText(fLinesAfter[i], true); + result := copy(result, 0, Length(result) - Length(sLineBreak)); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function THeaderGenerator.TStringTree.IndexOf(const aItem: TStringTree): Integer; +begin + result := fItemList.IndexOf(aItem); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function THeaderGenerator.TStringTree.GetOrCreateItem(const aName: String): TStringTree; +begin + result := GetItem(aName); + if not Assigned(result) then begin + result := TStringTree.Create; + fItemMap.Add(aName, result); + fItemList.Add(result); + end; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function THeaderGenerator.TStringTree.CreateItemAt(const aName: String; const aIndex: Integer): TStringTree; +begin + result := TStringTree.Create; + fItemMap.Add(aName, result); + fItemList.Insert(aIndex, result); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function THeaderGenerator.TStringTree.DestroyItem(const aName: String): Boolean; +var t: TStringTree; +begin + t := GetItem(aName); + result := Assigned(t); + if result then begin + fItemList.Remove(t); + fItemMap.Delete(aName); + end; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure THeaderGenerator.TStringTree.Clear; +begin + fItemList.Clear; + fItemMap.Clear; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor THeaderGenerator.TStringTree.Create; +begin + inherited Create; + fLinesBefore := TStringList.Create; + fLinesAfter := TStringList.Create; + fItemList := TItemList.Create(false); + fItemMap := TItemMap.Create(true); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +destructor THeaderGenerator.TStringTree.Destroy; +begin + FreeAndNil(fItemList); + FreeAndNil(fItemMap); + FreeAndNil(fLinesBefore); + FreeAndNil(fLinesAfter); + inherited Destroy; +end; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //THeaderGenerator.TvkObjectList//////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -401,7 +584,7 @@ begin raise Exception.Create('empty name'); for result := 0 to Count-1 do begin - o := Get(result); + o := GetItem(result); if (o.VkType in aTypes) and (o.Name = aName) then exit; end; @@ -415,19 +598,10 @@ begin i := IndexOfObj(aName, aTypes); result := (i >= 0); if result - then TvkObject(aObject) := Get(i) + then TvkObject(aObject) := GetItem(i) else TvkObject(aObject) := nil; end; -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -procedure THeaderGenerator.TvkObjectList.MarkObj(const aName: DOMstring; const aTypes: TvkObjectTypes; const aMark: Integer); -var o: TvkObject; -begin - if FindObj(aName, aTypes, o) - then o.Mark := aMark - else WriteResolveWarning(aName); -end; - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function THeaderGenerator.TvkObjectList.GetPascalName(const aName: DOMString; const aPointer: Integer; const aArrSize: WideString): WideString; @@ -439,26 +613,30 @@ begin end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//THeaderGenerator.TvkObject//////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -procedure THeaderGenerator.TvkObject.SetMark(aValue: Integer); +function THeaderGenerator.TvkObjectList.GenerateCode(const aName: String; const aCode: TStringTree): Boolean; +var o: TvkObject; begin - if (fMark <> 0) then - exit; - fMark := aValue; - DoMark(fMark); + result := FindObj(aName, VK_OBJECT_ALL, o); + if result then + o.GenerateCode(aCode); end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -function THeaderGenerator.TvkObject.GetDependencyOrder: Integer; +procedure THeaderGenerator.TvkObjectList.AddObject(const aObj: TvkObject); begin - result := 0; + if Assigned(aObj) then begin + Add(aObj); + aObj.List := self; + WriteLn(Format(' %-10s%s', [FormatType(aObj.VkType), aObj.Name])); + end; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -procedure THeaderGenerator.TvkObject.DoMark(const aMark: Integer); +//THeaderGenerator.TvkObject//////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function THeaderGenerator.TvkObject.GetDependencyOrder: Integer; begin - WriteLn(Format(' %-10s%-50s marked for generation', [FormatType(fType), fName])); + result := 0; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -483,11 +661,10 @@ begin end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -procedure THeaderGenerator.TvkObject.AddCommentFromXml(xml: TDOMNode); +constructor THeaderGenerator.TvkObject.Create(const aType: TvkObjectType); begin - xml := xml.FindNode('comment'); - if Assigned(xml) then - fComment := xml.TextContent; + inherited Create; + fType := aType; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -498,135 +675,141 @@ begin end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -function THeaderGenerator.TvkObject.GenerateConst(const aCode: TStrings): Boolean; -begin - result := not fConstGenerated; - if not fConstGenerated then begin - fConstGenerated := true; - WriteLn(Format(' %-10s%-50s constants generated', [FormatType(fType), fName])); - end; -end; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -function THeaderGenerator.TvkObject.GenerateType(const aCode: TStrings): Boolean; -begin - result := not fTypeGenerated; - if not fTypeGenerated then begin - fTypeGenerated := true; - WriteLn(Format(' %-10s%-50s type generated', [FormatType(fType), fName])); - end; -end; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -function THeaderGenerator.TvkObject.GeneratePtr(const aCode: TStrings): Boolean; -begin - result := not fPtrGenerated; - if not fPtrGenerated then begin - fPtrGenerated := true; - WriteLn(Format(' %-10s%-50s pointer type generated', [FormatType(fType), fName])); - end; -end; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -function THeaderGenerator.TvkObject.GenerateVar(const aCode: TStrings): Boolean; -begin - result := not fVarGenerated; - if not fVarGenerated then begin - fVarGenerated := true; - WriteLn(Format(' %-10s%-50s variables generated', [FormatType(fType), fName])); - end; -end; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -function THeaderGenerator.TvkObject.GenerateImpl(const aCode: TStrings): Boolean; +procedure THeaderGenerator.TvkObject.ReadXml(const xml: TDOMNode); begin - result := not fImplGenerated; - if not fImplGenerated then begin - fImplGenerated := true; - WriteLn(Format(' %-10s%-50s implementation generated', [FormatType(fType), fName])); - end; + // DUMMY end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -constructor THeaderGenerator.TvkObject.Create(const aType: TvkObjectType); +procedure THeaderGenerator.TvkObject.GenerateCode(const aCode: TStringTree); begin - inherited Create; - fType := aType; + // DUMMY end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -class function THeaderGenerator.TvkObject.CreateFromXml(const xml: TDOMNode): THeaderGenerator.TvkObject; +class procedure THeaderGenerator.TvkObject.CreateFromXml(const xml: TDOMNode; const aList: TvkObjectList); var s, n: DOMString; - x: TDOMNode; - function GenerateVersionEnum: TvkTypeEnum; + procedure GenerateVersionEnum; var + c: TvkConst; rx: TRegExpr; - v: TvkTypeEnum.TValue; begin - result := TvkTypeEnum.Create(otConst); rx := TRegExpr.Create('\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)'); - try try - if not rx.Exec(xml.TextContent) then + try + if not rx.Exec(String(xml.TextContent)) then raise XmlException.Create('VK_API_VERSION with malformed version', xml); - v := TvkTypeEnum.TValue.Create; - result.Values.Add(v); - v.Name := 'VK_API_VERSION'; - v.Value := (StrToInt(rx.Match[1]) shl 22) or - (StrToInt(rx.Match[2]) shl 12) or - (StrToInt(rx.Match[3]) shl 0); - - v := TvkTypeEnum.TValue.Create; - result.Values.Add(v); - v.Name := 'VK_API_VERSION_MAJOR'; - v.Value := StrToInt(rx.Match[1]); - - v := TvkTypeEnum.TValue.Create; - result.Values.Add(v); - v.Name := 'VK_API_VERSION_MINOR'; - v.Value := StrToInt(rx.Match[2]); - - v := TvkTypeEnum.TValue.Create; - result.Values.Add(v); - v.Name := 'VK_API_VERSION_BUGFIX'; - v.Value := StrToInt(rx.Match[3]); + + c := TvkConst.Create; + try + c.Name := 'VK_API_VERSION'; + c.Value := (StrToInt(rx.Match[1]) shl 22) or + (StrToInt(rx.Match[2]) shl 12) or + (StrToInt(rx.Match[3]) shl 0); + aList.AddObject(c); + except + FreeAndNil(c); + raise + end; + + c := TvkConst.Create; + try + c.Name := 'VK_API_VERSION_MAJOR'; + c.Value := StrToInt(rx.Match[1]); + aList.AddObject(c); + except + FreeAndNil(c); + raise + end; + + c := TvkConst.Create; + try + c.Name := 'VK_API_VERSION_MINOR'; + c.Value := StrToInt(rx.Match[2]); + aList.AddObject(c); + except + FreeAndNil(c); + raise + end; + + c := TvkConst.Create; + try + c.Name := 'VK_API_VERSION_BUGFIX'; + c.Value := StrToInt(rx.Match[3]); + aList.AddObject(c); + except + FreeAndNil(c); + raise + end; finally FreeAndNil(rx); end; - except - FreeAndNil(result); - raise; - end; end; + procedure GenerateConstants; + var + x: TDOMNode; + c: TvkConst; + begin + x := xml.FirstChild; + while Assigned(x) do begin + if (x.NodeName = 'enum') then begin + c := TvkConst.Create; + try + c.Name := GetNodeAttrib(x, 'name'); + c.Value := StrToValue(String(GetNodeAttrib(x, 'value'))); + if (c.Value = Unassigned) then + raise Exception.Create('Invalid constant value: ' + GetNodeAttrib(x, 'value')); + aList.AddObject(c); + except + FreeAndNil(c); + raise; + end; + end; + x := x.NextSibling; + end; + end; +var + obj: TvkObject; begin - result := nil; - if (xml.NodeName = 'type') and xml.HasAttributes then begin - x := xml.Attributes.GetNamedItem('category'); - if not Assigned(x) then - exit; - s := x.TextContent; - if (s = 'basetype') or (s = 'bitmask') then - result := TvkTypeSimple.CreateFromXml(xml) - else if (s = 'handle') then - result := TvkTypeHandle.CreateFromXml(xml) - else if (s = 'funcpointer') then - result := TvkTypeFunctionPtr.CreateFromXml(xml) - else if (s = 'struct') or (s = 'union') then - result := TvkTypeStruct.CreateFromXml(xml) - else if (s = 'define') and TryGetNodeValue(xml, 'name', n) and (n = 'VK_API_VERSION') then begin - result := GenerateVersionEnum; + try + obj := nil; + if (xml.NodeName = 'type') and TryGetNodeAttrib(xml, 'category', s) then begin + if (s = 'basetype') or (s = 'bitmask') then + obj := TvkType.Create + else if (s = 'handle') then + obj := TvkHandle.Create + else if (s = 'funcpointer') then + obj := TvkFunctionPtr.Create + else if (s = 'struct') or (s = 'union') then + obj := TvkStruct.Create + else if (s = 'define') and TryGetNodeValue(xml, 'name', n) and (n = 'VK_API_VERSION') then + GenerateVersionEnum; + end else if (xml.NodeName = 'command') then + obj := TvkCommand.Create + else if (xml.NodeName = 'enums') then begin + if not TryGetNodeAttrib(xml, 'type', s) then + GenerateConstants + else if (s = 'enum') or (s = 'bitmask') then + obj := TvkEnum.Create; + end; + + if Assigned(obj) then begin + obj.ReadXml(xml); + aList.AddObject(obj); end; - end else if (xml.NodeName = 'command') then - result := TvkCommand.CreateFromXml(xml); + except + FreeAndNil(obj); + raise; + end; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//THeaderGenerator.TvkTypeSimple//////////////////////////////////////////////////////////////////////////////////////// +//THeaderGenerator.TvkTypeBase////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -function THeaderGenerator.TvkTypeSimple.GetDependencyOrder: Integer; +function THeaderGenerator.TvkTypeBase.GetDependencyOrder: Integer; begin result := inherited GetDependencyOrder; if Assigned(List) and (fParent <> '') then @@ -634,17 +817,7 @@ begin end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -procedure THeaderGenerator.TvkTypeSimple.DoMark(const aMark: Integer); -begin - inherited DoMark(aMark); - if (fParent <> '') and Assigned(fList) then - fList.MarkObj(fParent, VK_OBJECT_TYPES, aMark); - if (fAlias <> '') and Assigned(fList) then - fList.MarkObj(fAlias, VK_OBJECT_TYPES, aMark); -end; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -procedure THeaderGenerator.TvkTypeSimple.GenPascalName(var aName: WideString; const aPointer: Integer; const aArrSize: WideString); +procedure THeaderGenerator.TvkTypeBase.GenPascalName(var aName: WideString; const aPointer: Integer; const aArrSize: WideString); var i: Integer; begin if (fAlias <> '') @@ -654,58 +827,69 @@ begin aName := 'VkVoid'; for i := 0 to aPointer-1 do aName := 'P' + aName; + if (aName = 'VkVoid') then + raise Exception.Create('void can not be used as type'); inherited GenPascalName(aName, aPointer, aArrSize); end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -function THeaderGenerator.TvkTypeSimple.GenerateType(const aCode: TStrings): Boolean; +procedure THeaderGenerator.TvkTypeBase.GenerateCode(const aCode: TStringTree); +var st: TStringTree; begin - result := inherited GenerateType(aCode); - if result and (fParent <> '') and Assigned(List) then - aCode.Add(Format(' %-62s = %s;', [ fName, List.GetPascalName(fParent, 0) ])); + inherited GenerateCode(aCode); + + if Assigned(fList) and (fParent <> '') then + fList.GenerateCode(fParent, aCode); + if Assigned(fList) and (fAlias <> '') then + fList.GenerateCode(fAlias, aCode); + + st := aCode.GetOrCreateItem(KEYWORD_INTF).GetOrCreateItem(KEYWORD_TYPES); + if (st.LinesBefore.Count = 0) then + st.LinesBefore.Add('type { simple types }'); + st := st.GetOrCreateItem(fName); + if (st.LinesBefore.Count = 0) and (fParent <> '') and Assigned(List) then begin + st.LinesBefore.Add(Format(' %-62s = %s;', [ fName, List.GetPascalName(fParent, 0) ])); + st.LinesBefore.Add(Format(' P%-61s = ^%0:s;', [ fName ])); + st.LinesBefore.Add(Format(' PP%-60s = ^P%0:s;', [ fName ])); + st.LinesBefore.Add(''); + end; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -function THeaderGenerator.TvkTypeSimple.GeneratePtr(const aCode: TStrings): Boolean; +//THeaderGenerator.TvkType////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure THeaderGenerator.TvkType.ReadXml(const xml: TDOMNode); begin - result := inherited GeneratePtr(aCode); - if result and (fParent <> '') and Assigned(List) then begin - aCode.Add(Format(' P%-61s = ^%0:s;', [ fName ])); - aCode.Add(Format(' PP%-60s = ^P%0:s;', [ fName ])); - end; + inherited ReadXml(xml); + Name := GetNodeValue(xml, 'name'); + Parent := GetNodeValue(xml, 'type'); end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -class function THeaderGenerator.TvkTypeSimple.CreateFromXml(const xml: TDOMNode): THeaderGenerator.TvkTypeSimple; +constructor THeaderGenerator.TvkType.Create; begin - result := TvkTypeSimple.Create(otType); - try - result.Name := GetNodeValue(xml, 'name'); - result.Parent := GetNodeValue(xml, 'type'); - except - FreeAndNil(result); - raise; - end; + inherited Create(otType); end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//THeaderGenerator.TvkTypeHandle//////////////////////////////////////////////////////////////////////////////////////// +//THeaderGenerator.TvkHandle//////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -class function THeaderGenerator.TvkTypeHandle.CreateFromXml(const xml: TDOMNode): THeaderGenerator.TvkTypeHandle; +constructor THeaderGenerator.TvkHandle.Create; begin - result := TvkTypeHandle.Create(otHandle); - try - result.Name := GetNodeValue(xml, 'name'); - result.Parent := GetNodeValue(xml, 'parent', 'VkHandle'); - result.NonDispatchable := (GetNodeValue(xml, 'type', '') = 'VK_DEFINE_NON_DISPATCHABLE_HANDLE'); - except - FreeAndNil(result); - raise; - end; + inherited Create(otHandle); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure THeaderGenerator.TvkHandle.ReadXml(const xml: TDOMNode); +begin + inherited ReadXml(xml); + Name := GetNodeValue (xml, 'name'); + //Parent := GetNodeAttrib(xml, 'parent', 'VkHandle'); + Parent := 'VkHandle'; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -function THeaderGenerator.TvkTypeFunction.GetDependencyOrder: Integer; +function THeaderGenerator.TvkFunctionBase.GetDependencyOrder: Integer; var a: TArgument; begin result := inherited GetDependencyOrder; @@ -716,19 +900,7 @@ begin end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -procedure THeaderGenerator.TvkTypeFunction.DoMark(const aMark: Integer); -var a: TArgument; -begin - inherited DoMark(aMark); - if Assigned(fList) then begin - fList.MarkObj(fReturnValue.Typ, VK_OBJECT_TYPES, aMark); - for a in fArguments do - fList.MarkObj(a.Typ, VK_OBJECT_TYPES, aMark); - end; -end; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -procedure THeaderGenerator.TvkTypeFunction.GenPascalName(var aName: WideString; const aPointer: Integer; +procedure THeaderGenerator.TvkFunctionBase.GenPascalName(var aName: WideString; const aPointer: Integer; const aArrSize: WideString); var rx: TRegExpr; begin @@ -748,33 +920,53 @@ begin end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -procedure THeaderGenerator.TvkTypeFunction.GenerateFunctionPtr(const aCode: TStrings); +procedure THeaderGenerator.TvkFunctionBase.GenerateFunctionPtr(const aCode, aSub: TStringTree); var - s: WideString; + st: TStringTree; i: Integer; + s: WideString; a: TArgument; begin - s := WideString(Format(' %-50s', [ GetPascalName(0, '') ])); - if (ReturnValue.Typ = 'void') and (ReturnValue.IsPointer = 0) - then s := s + ' = procedure(' - else s := s + ' = function ('; - for i := 0 to fArguments.Count-1 do begin - a := fArguments[i]; - if a.IsConst then - s := s + 'const '; - s := s + PrepareName(a.Name, a.Typ) + ': ' + List.GetPascalName(a.Typ, a.IsPointer); - if (i < fArguments.Count-1) then - s := s + '; '; + if Assigned(fList) then begin + fList.GenerateCode(fReturnValue.Typ, aCode); + for a in fArguments do + fList.GenerateCode(a.Typ, aCode); + end; + + st := aSub.GetOrCreateItem(GetPascalName(0, '')); + if (st.LinesBefore.Count = 0) then begin + // head + s := WideString(Format(' %s', [ GetPascalName(0, '') ])); + if (ReturnValue.Typ = 'void') and (ReturnValue.IsPointer = 0) + then s := s + ' = procedure(' + else s := s + ' = function ('; + st.LinesBefore.Add(s); + + // params + for i := 0 to fArguments.Count-1 do begin + s := ' '; + a := fArguments[i]; + if a.IsConst + then s := s + 'const ' + else s := s + ' '; + s := s + Format('%-30s%s', [ PrepareName(a.Name, a.Typ)+':', List.GetPascalName(a.Typ, a.IsPointer) ]); + if (i < fArguments.Count-1) then + s := s + '; '; + st.LinesBefore.Add(s); + end; + + // result + s := ' )'; + if (ReturnValue.Typ <> 'void') or (ReturnValue.IsPointer > 0) then + s := s + ': ' + List.GetPascalName(ReturnValue.Typ, ReturnValue.IsPointer); + s := s + '; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF};'; + st.LinesBefore.Add(s); + st.LinesBefore.Add(''); end; - s := s + ')'; - if (ReturnValue.Typ <> 'void') or (ReturnValue.IsPointer > 0) then - s := s + ': ' + List.GetPascalName(ReturnValue.Typ, ReturnValue.IsPointer); - s := s + '; {$IFDEF VK_CDECL}cdecl{$ELSE}stdcall{$ENDIF};'; - aCode.Add(String(s)); end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -constructor THeaderGenerator.TvkTypeFunction.Create(const aType: TvkObjectType); +constructor THeaderGenerator.TvkFunctionBase.Create(const aType: TvkObjectType); begin inherited Create(aType); fReturnValue := TArgument.Create; @@ -782,7 +974,7 @@ begin end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -destructor THeaderGenerator.TvkTypeFunction.Destroy; +destructor THeaderGenerator.TvkFunctionBase.Destroy; begin FreeAndNil(fReturnValue); FreeAndNil(fArguments); @@ -790,113 +982,91 @@ begin end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//THeaderGenerator.TvkTypeFunctionPtr/////////////////////////////////////////////////////////////////////////////////// +//THeaderGenerator.TvkFunctionPtr/////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -function THeaderGenerator.TvkTypeFunctionPtr.GenerateType(const aCode: TStrings): Boolean; - -begin - result := inherited GenerateType(aCode); - if result and Assigned(List) then - GenerateFunctionPtr(aCode); -end; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -class function THeaderGenerator.TvkTypeFunctionPtr.CreateFromXml(const xml: TDOMNode): THeaderGenerator.TvkTypeFunctionPtr; +procedure THeaderGenerator.TvkFunctionPtr.ReadXml(const xml: TDOMNode); var x, p: TDOMNode; a: TArgument; rx: TRegExpr; begin - result := TvkTypeFunctionPtr.Create(otFuncPtr); - try - x := xml.FindNode('name'); - if not Assigned(x) then - raise XmlException.Create(xml.NodeName + ' witout child ''name''', xml); - result.Name := x.TextContent; + x := xml.FindNode('name'); + if not Assigned(x) then + raise XmlException.Create(xml.NodeName + ' witout child ''name''', xml); + Name := x.TextContent; - p := x.PreviousSibling; - if not Assigned(p) then - raise XmlException.Create(xml.NodeName + ' witout return type', xml); + p := x.PreviousSibling; + if not Assigned(p) then + raise XmlException.Create(xml.NodeName + ' witout return type', xml); - rx := TRegExpr.Create('typedef\s+((const)?)\s*([-_A-Za-z0-9\s]+?)\s*((\*\s*(const)?\s*)*)\s*\('); - try - if not rx.Exec(String(p.TextContent)) then - raise XmlException.Create('unable to parse return type of function pointer', xml); + rx := TRegExpr.Create('typedef\s+((const)?)\s*([-_A-Za-z0-9\s]+?)\s*((\*\s*(const)?\s*)*)\s*\('); + try + if not rx.Exec(String(p.TextContent)) then + raise XmlException.Create('unable to parse return type of function pointer', xml); - result.ReturnValue.IsConst := (Trim(rx.Match[1]) = 'const'); - result.ReturnValue.Typ := WideString(Trim(rx.Match[3])); - result.ReturnValue.IsPointer := PointerCount(Trim(rx.Match[4])); + ReturnValue.IsConst := (Trim(rx.Match[1]) = 'const'); + ReturnValue.Typ := WideString(Trim(rx.Match[3])); + ReturnValue.IsPointer := PointerCount(Trim(rx.Match[4])); - x := xml.FirstChild; - while Assigned(x) do begin - if (x.NodeName = 'type') then begin - a := TArgument.Create; - try - p := x.PreviousSibling; - if not Assigned(p) then - raise XmlException.Create('unable to parse function pointer arguments', xml); - rx.Expression := '[A-Za-z]*'; - a.IsConst := rx.Exec(String(p.TextContent)) and (rx.Match[0] = 'const'); - a.Typ := x.TextContent; - - p := x.NextSibling; - if not Assigned(p) then - raise XmlException.Create('unable to parse function pointer arguments', xml); - rx.Expression := '((\*\s*(const)?\s*)*)\s*([-_A-Za-z0-9]+)'; - if not rx.Exec(String(p.TextContent)) then - raise XmlException.Create('unable to parse function pointer arguments', xml); - - a.IsPointer := PointerCount((rx.Match[1])); - a.Name := WideString(Trim(rx.Match[4])); - result.Arguments.Add(a); - except - FreeAndNil(a) - end; + x := xml.FirstChild; + while Assigned(x) do begin + if (x.NodeName = 'type') then begin + a := TArgument.Create; + try + p := x.PreviousSibling; + if not Assigned(p) then + raise XmlException.Create('unable to parse function pointer arguments', xml); + rx.Expression := '[A-Za-z]*'; + a.IsConst := rx.Exec(String(p.TextContent)) and (rx.Match[0] = 'const'); + a.Typ := x.TextContent; + + p := x.NextSibling; + if not Assigned(p) then + raise XmlException.Create('unable to parse function pointer arguments', xml); + rx.Expression := '((\*\s*(const)?\s*)*)\s*([-_A-Za-z0-9]+)'; + if not rx.Exec(String(p.TextContent)) then + raise XmlException.Create('unable to parse function pointer arguments', xml); + + a.IsPointer := PointerCount((rx.Match[1])); + a.Name := WideString(Trim(rx.Match[4])); + Arguments.Add(a); + except + FreeAndNil(a) end; - x := x.NextSibling; end; - finally - FreeAndNil(rx); + x := x.NextSibling; end; - except - FreeAndNil(result); - raise; + finally + FreeAndNil(rx); end; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//THeaderGenerator.TvkCommand/////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -function THeaderGenerator.TvkCommand.GenerateType(const aCode: TStrings): Boolean; +procedure THeaderGenerator.TvkFunctionPtr.GenerateCode(const aCode: TStringTree); +var st: TStringTree; begin - result := inherited GenerateType(aCode); - if result and Assigned(List) then - GenerateFunctionPtr(aCode); + inherited GenerateCode(aCode); + st := aCode.GetOrCreateItem(KEYWORD_INTF).GetOrCreateItem(KEYWORD_FUNCPTR); + if (st.LinesBefore.Count = 0) then + st.LinesBefore.Add('type { function pointers }'); + GenerateFunctionPtr(aCode, st); end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -function THeaderGenerator.TvkCommand.GenerateVar(const aCode: TStrings): Boolean; +constructor THeaderGenerator.TvkFunctionPtr.Create; begin - result := inherited GenerateVar(aCode); - if result then - aCode.Add(Format(' %-50s %s = nil;', [ fName + ':', GetPascalName(0, '') ])); + inherited Create(otFuncPtr); end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -function THeaderGenerator.TvkCommand.GenerateImpl(const aCode: TStrings): Boolean; -begin - result := inherited GenerateImpl(aCode); - if result then - aCode.Add(Format(' %-50s := vkGetProcAddress(''%0:s'');', [ fName ])); -end; - +//THeaderGenerator.TvkCommand/////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -class function THeaderGenerator.TvkCommand.CreateFromXml(const xml: TDOMNode): THeaderGenerator.TvkCommand; +procedure THeaderGenerator.TvkCommand.ReadXml(const xml: TDOMNode); procedure ParseProto(const x: TDOMNode); begin - result.Name := GetNodeValue(x, 'name'); - result.ReturnValue.Typ := GetNodeValue(x, 'type'); + Name := GetNodeValue(x, 'name'); + ReturnValue.Typ := GetNodeValue(x, 'type'); end; procedure ParseParam(const x: TDOMNode); @@ -922,7 +1092,7 @@ class function THeaderGenerator.TvkCommand.CreateFromXml(const xml: TDOMNode): T rx.Expression := '((\*\s*(const)?\s*)*)'; if Assigned(p.NextSibling) and rx.Exec(String(p.NextSibling.TextContent)) then a.IsPointer := PointerCount(rx.Match[0]); - result.Arguments.Add(a); + Arguments.Add(a); finally FreeAndNil(rx); end; @@ -935,26 +1105,50 @@ class function THeaderGenerator.TvkCommand.CreateFromXml(const xml: TDOMNode): T var x: TDOMNode; begin - result := TvkCommand.Create(otCommand); - try - x := xml.FirstChild; - while Assigned(x) do begin - if (x.NodeName = 'proto') then - ParseProto(x) - else if (x.NodeName = 'param') then - ParseParam(x); - x := x.NextSibling; - end; - except - FreeAndNil(result); - raise; + inherited ReadXml(xml); + x := xml.FirstChild; + while Assigned(x) do begin + if (x.NodeName = 'proto') then + ParseProto(x) + else if (x.NodeName = 'param') then + ParseParam(x); + x := x.NextSibling; end; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//THeaderGenerator.TvkTypeStruct//////////////////////////////////////////////////////////////////////////////////////// +procedure THeaderGenerator.TvkCommand.GenerateCode(const aCode: TStringTree); +var st: TStringTree; +begin + inherited GenerateCode(aCode); + st := aCode.GetOrCreateItem(KEYWORD_INTF).GetOrCreateItem(KEYWORD_COMMAND); + if (st.LinesBefore.Count = 0) then + st.LinesBefore.Add('type { commands }'); + GenerateFunctionPtr(aCode, st); + + st := aCode.GetOrCreateItem(KEYWORD_INTF).GetOrCreateItem(KEYWORD_VAR); + if (st.LinesBefore.Count = 0) then + st.LinesBefore.Add('var'); + + st := st.GetOrCreateItem(fName); + if (st.LinesBefore.Count = 0) then + st.LinesBefore.Add(Format(' %-50s%s;', [fName + ':', GetPascalName(0, '')])); + + st := aCode.GetOrCreateItem(KEYWORD_IMPL).GetOrCreateItem(KEYWORD_CODE).GetOrCreateItem(fName); + if (st.LinesBefore.Count = 0) then + st.LinesBefore.Add(Format(' %-50s := T%0:-50s(vkGetProcAddress(%-50saInstance));', [fName, '''' + fName + ''','])); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor THeaderGenerator.TvkCommand.Create; +begin + inherited Create(otCommand); +end; + //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -function THeaderGenerator.TvkTypeStruct.GetDependencyOrder: Integer; +//THeaderGenerator.TvkStruct//////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function THeaderGenerator.TvkStruct.GetDependencyOrder: Integer; var m: TMember; begin @@ -966,18 +1160,7 @@ begin end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -procedure THeaderGenerator.TvkTypeStruct.DoMark(const aMark: Integer); -var m: TMember; -begin - inherited DoMark(aMark); - if Assigned(fList) then begin - for m in fMember do - fList.MarkObj(m.Typ, VK_OBJECT_TYPES, aMark); - end; -end; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -procedure THeaderGenerator.TvkTypeStruct.GenPascalName(var aName: WideString; const aPointer: Integer; const aArrSize: WideString); +procedure THeaderGenerator.TvkStruct.GenPascalName(var aName: WideString; const aPointer: Integer; const aArrSize: WideString); var i: Integer; begin if (aPointer > 0) then begin @@ -990,20 +1173,88 @@ begin end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -function THeaderGenerator.TvkTypeStruct.GenerateType(const aCode: TStrings): Boolean; +procedure THeaderGenerator.TvkStruct.ReadXml(const xml: TDOMNode); var - prefix, postfix: String; - i, indent: Integer; + x, p: TDOMNode; m: TMember; + rx: TRegExpr; begin - result := inherited GenerateType(aCode); - result := inherited GeneratePtr(aCode) or result; - if result and Assigned(List) then begin + Name := GetNodeAttrib(xml, 'name'); + IsUnion := (GetNodeAttrib(xml, 'category') = 'union'); + + x := xml.FirstChild; + while Assigned(x) do begin + if (x.NodeName = 'member') then begin + m := TMember.Create; + rx := TRegExpr.Create(''); + try try + // read name + p := x.FindNode('name'); + if not Assigned(p) then + raise XmlException.Create('struct member without name', xml); + m.Name := p.TextContent; + p := p.NextSibling; + while Assigned(p) do begin + m.Name := m.Name + p.TextContent; + p := p.NextSibling; + end; + m.Name := Trim(m.Name); + + rx.Expression := '([-_A-Za-z0-9]+)\s*\[\s*([-_A-Za-z0-9]+)\s*\]'; + if rx.Exec(String(m.Name)) then begin + m.Name := WideString(rx.Match[1]); + m.ArrSize := WideString(rx.Match[2]); + end; + + // read type + p := x.FindNode('type'); + if not Assigned(p) then + raise XmlException.Create('struct member without type', xml); + m.Typ := p.TextContent; + m.IsConst := Assigned(p.PreviousSibling) and (Trim(p.PreviousSibling.TextContent) = 'const'); + rx.Expression := '((\*\s*(const)?\s*)*)'; + if Assigned(p.NextSibling) and rx.Exec(String(p.NextSibling.TextContent)) then + m.IsPointer := PointerCount(rx.Match[0]); + Member.Add(m); + finally + FreeAndNil(rx); + end; + except + FreeAndNil(m); + end; + end; + x := x.NextSibling; + end; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure THeaderGenerator.TvkStruct.GenerateCode(const aCode: TStringTree); +var + m: TMember; + st: TStringTree; + postfix, prefix: String; + i, indent: Integer; +begin + inherited GenerateCode(aCode); + + if Assigned(fList) then begin + for m in fMember do begin + if (m.ArrSize <> '') then + fList.GenerateCode(m.ArrSize, aCode); + fList.GenerateCode(m.Typ, aCode); + end; + end; + + st := aCode.GetOrCreateItem(KEYWORD_INTF).GetOrCreateItem(KEYWORD_STRUCT); + if (st.LinesBefore.Count = 0) then + st.LinesBefore.Add('type { structures }'); + st := st.GetOrCreateItem(GetPascalName(0, '')); + if (st.LinesBefore.Count = 0) then begin postfix := ';'; indent := 50; - aCode.Add(' T%s = record', [ fName ]); + st.LinesBefore.Add(' T%s = record', [ fName ]); if IsUnion then begin - aCode.Add(' case Integer of'); + st.LinesBefore.Add(' case Integer of'); postfix := ');'; indent := 42; end; @@ -1012,96 +1263,33 @@ begin if IsUnion then prefix := Format(' %.3d: (', [ i ]) else prefix := ' '; - aCode.Add(Format('%s%-*s%s%s', [ prefix, indent, PrepareName(m.Name, m.Typ) + ': ', List.GetPascalName(m.Typ, m.IsPointer, m.ArrSize), postfix ])); + st.LinesBefore.Add(Format('%s%-*s%s%s', [ prefix, indent, PrepareName(m.Name, m.Typ) + ': ', List.GetPascalName(m.Typ, m.IsPointer, m.ArrSize), postfix ])); end; - aCode.Add(' end;'); - aCode.Add(' P%s = ^T%0:s;', [ fName ]); - aCode.Add(' PP%s = ^P%0:s;', [ fName ]); - aCode.Add(''); + st.LinesAfter.Add(' end;'); + st.LinesAfter.Add(' P%s = ^T%0:s;', [ fName ]); + st.LinesAfter.Add(' PP%s = ^P%0:s;', [ fName ]); + st.LinesAfter.Add(''); end; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//THeaderGenerator.TvkTypeStruct//////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -constructor THeaderGenerator.TvkTypeStruct.Create(const aType: TvkObjectType); +constructor THeaderGenerator.TvkStruct.Create; begin - inherited Create(aType); + inherited Create(otStruct); fMember := TMemberList.Create; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -destructor THeaderGenerator.TvkTypeStruct.Destroy; +destructor THeaderGenerator.TvkStruct.Destroy; begin FreeAndNil(fMember); inherited Destroy; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -class function THeaderGenerator.TvkTypeStruct.CreateFromXml(const xml: TDOMNode): THeaderGenerator.TvkTypeStruct; -var - x, p: TDOMNode; - m: TMember; - rx: TRegExpr; -begin - result := TvkTypeStruct.Create(otStruct); - try - result.Name := GetNodeAttrib(xml, 'name'); - result.IsUnion := (GetNodeAttrib(xml, 'category') = 'union'); - - x := xml.FirstChild; - while Assigned(x) do begin - if (x.NodeName = 'member') then begin - m := TMember.Create; - rx := TRegExpr.Create(''); - try try - // read name - p := x.FindNode('name'); - if not Assigned(p) then - raise XmlException.Create('struct member without name', xml); - m.Name := p.TextContent; - p := p.NextSibling; - while Assigned(p) do begin - m.Name := m.Name + p.TextContent; - p := p.NextSibling; - end; - m.Name := Trim(m.Name); - - rx.Expression := '([-_A-Za-z0-9]+)\s*\[\s*([-_A-Za-z0-9]+)\s*\]'; - if rx.Exec(String(m.Name)) then begin - m.Name := WideString(rx.Match[1]); - m.ArrSize := WideString(rx.Match[2]); - end; - - // read type - p := x.FindNode('type'); - if not Assigned(p) then - raise XmlException.Create('struct member without type', xml); - m.Typ := p.TextContent; - m.IsConst := Assigned(p.PreviousSibling) and (Trim(p.PreviousSibling.TextContent) = 'const'); - rx.Expression := '((\*\s*(const)?\s*)*)'; - if Assigned(p.NextSibling) and rx.Exec(String(p.NextSibling.TextContent)) then - m.IsPointer := PointerCount(rx.Match[0]); - result.Member.Add(m); - finally - FreeAndNil(rx); - end; - except - FreeAndNil(m); - end; - end; - x := x.NextSibling; - end; - except - FreeAndNil(result); - raise; - end; -end; - -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//THeaderGenerator.TvkTypeEnum////////////////////////////////////////////////////////////////////////////////////////// +//THeaderGenerator.TvkEnum////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -procedure THeaderGenerator.TvkTypeEnum.GenPascalName(var aName: WideString; const aPointer: Integer; const aArrSize: WideString); +procedure THeaderGenerator.TvkEnum.GenPascalName(var aName: WideString; const aPointer: Integer; const aArrSize: WideString); var i: Integer; begin if (fName = '') then @@ -1116,302 +1304,335 @@ begin end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -function THeaderGenerator.TvkTypeEnum.GenerateConst(const aCode: TStrings): Boolean; +procedure THeaderGenerator.TvkEnum.ReadXml(const xml: TDOMNode); var - value: String; - i: Integer; + x, p: TDOMNode; v: TValue; begin - result := inherited GenerateConst(aCode); - if result and (VkType = otConst) then begin - for i := 0 to fValues.Count-1 do begin - v := fValues[i]; - if v.IsBit - then value := Format('(1 shl %s)', [ IntToStr(v.Value) ]) - else value := v.Value; - aCode.Add(Format(' %-62s = %s;', [ v.Name, value ])); + Name := GetNodeAttrib(xml, 'name'); + Expands := GetNodeAttrib(xml, 'expand', ''); + x := xml.FirstChild; + while Assigned(x) do begin + if (x.NodeName = 'enum') then begin + v := TValue.Create; + try + v.Name := GetNodeAttrib(x, 'name'); + p := x.Attributes.GetNamedItem('value'); + if Assigned(p) then begin + v.IsBit := false; + v.Value := StrToValue(String(p.TextContent)); + end else begin + p := x.Attributes.GetNamedItem('bitpos'); + if not Assigned(p) then + raise XmlException.Create('enum without value or bitpos', xml); + v.IsBit := true; + v.Value := StrToValue(String(p.TextContent)); + end; + + if (v.Value = Unassigned) then + raise XmlException.Create(WideString('invalid enum value (' + p.TextContent + ')'), xml); + + Values.Add(v); + except + FreeAndNil(v); + raise; + end; end; - aCode.Add(''); + x := x.NextSibling; end; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -function THeaderGenerator.TvkTypeEnum.GenerateType(const aCode: TStrings): Boolean; +procedure THeaderGenerator.TvkEnum.GenerateCode(const aCode: TStringTree); var - value: String; + st, vt: TStringTree; i: Integer; v: TValue; -begin - result := inherited GenerateType(aCode); - if result and (VkType = otEnum) then begin - aCode.Add(Format(' T%s = (', [ fName ])); + postfix: String; +begin + inherited GenerateCode(aCode); + st := aCode + .GetOrCreateItem(KEYWORD_INTF) + .GetOrCreateItem(KEYWORD_ENUM); + if (st.LinesBefore.Count = 0) then + st.LinesBefore.Add('type { enumerations }'); + st := st.GetOrCreateItem(fName); + if (st.LinesBefore.Count = 0) then begin + st.LinesBefore.Add(Format(' %s = (', [GetPascalName(0, '')])); + postfix := ','; + vt := st.GetOrCreateItem(KEYWORD_ENUM_VALUES); for i := 0 to fValues.Count-1 do begin v := fValues[i]; - if v.IsBit - then value := Format('(1 shl %s)', [ IntToStr(v.Value) ]) - else value := v.Value; - aCode.Add(Format(' %-60s = %s', [ v.Name, value ])); - if (i < fValues.Count-1) then - aCode[aCode.Count-1] := aCode[aCode.Count-1] + ','; + if (i = fValues.Count-1) and (fExpands = '') then + postfix := ''; + if (v.IsBit) + then vt.LinesBefore.Add(Format(' %-60s = (1 shl %s)%s', [v.Name, v.Value, postfix])) + else vt.LinesBefore.Add(Format(' %-60s = %s%s', [v.Name, v.Value, postfix])); end; - aCode.Add(' );'); - aCode.Add(Format(' P%s = ^T%0:s;', [ fName ])); - aCode.Add(''); + if (fExpands <> '') then + st.LinesAfter.Add(Format(' %-60s = %s', [fExpands + '_MAX_ENUM', '$7FFFFFFF'])); + st.LinesAfter.Add(' );'); + st.LinesAfter.Add(' P%s = ^T%0:s;', [ fName ]); + st.LinesAfter.Add(' PP%s = ^P%0:s;', [ fName ]); + st.LinesAfter.Add(''); end; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -constructor THeaderGenerator.TvkTypeEnum.Create(const aType: TvkObjectType); +constructor THeaderGenerator.TvkEnum.Create; begin - inherited Create(aType); + inherited Create(otEnum); fValues := TValueList.Create; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -destructor THeaderGenerator.TvkTypeEnum.Destroy; +destructor THeaderGenerator.TvkEnum.Destroy; begin FreeAndNil(fValues); inherited Destroy; end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -class function THeaderGenerator.TvkTypeEnum.CreateFromXml(const xml: TDOMNode): THeaderGenerator.TvkTypeEnum; +//THeaderGenerator.TvkConst///////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure THeaderGenerator.TvkConst.GenerateCode(const aCode: TStringTree); var - x, p: TDOMNode; - v: TValue; - - function StrToValue(s: String): Variant; - var - f: TFormatSettings; - rx: TRegExpr; - begin - f.DecimalSeparator := '.'; - rx := TRegExpr.Create; - try - result := Unassigned; - - rx.Expression := '^-?([0-9]+)$'; - if rx.Exec(s) then - result := StrToInt(rx.Match[0]); - - rx.Expression := '^0x([0-9A-Fa-f]+)$'; - if rx.Exec(s) then - result := '$' + rx.Match[1]; - - rx.Expression := '^([0-9\.]+)(f|d)?$'; - if rx.Exec(s) then begin - result := StrToFloat(rx.Match[1], f); - if (rx.Match[2] = 'd') then - result := Double(result); - end; - - rx.Expression := '^\(~0U([L]*)\)$'; - if rx.Exec(s) then begin - if (rx.Match[2] = '') - then result := '$' + IntToHex(High(UInt32), 2 * sizeof(UInt32)) - else result := '$' + IntToHex(High(UInt64), 2 * sizeof(UInt64)); - end; - - if (result = Unassigned) then - raise XmlException.Create(WideString('invalid enum value (' + s + ')'), xml); - finally - FreeAndNil(rx); - end; - end; - + st: TStringTree; begin - x := xml.Attributes.GetNamedItem('type'); - if Assigned(x) - then result := TvkTypeEnum.Create(otEnum) - else result := TvkTypeEnum.Create(otConst); - try - result.Name := GetNodeAttrib(xml, 'name'); - x := xml.FirstChild; - while Assigned(x) do begin - if (x.NodeName = 'enum') then begin - v := TValue.Create; - try - v.Name := GetNodeAttrib(x, 'name'); - p := x.Attributes.GetNamedItem('value'); - if Assigned(p) then begin - v.IsBit := false; - v.Value := StrToValue(String(p.TextContent)); - end else begin - p := x.Attributes.GetNamedItem('bitpos'); - if not Assigned(p) then - raise XmlException.Create('enum without value or bitpos', xml); - v.IsBit := true; - v.Value := StrToValue(String(p.TextContent)); - end; - result.Values.Add(v); - except - FreeAndNil(v); - raise; - end; - end; - x := x.NextSibling; - end; - except - FreeAndNil(result); - raise; - end; + inherited GenerateCode(aCode); + st := aCode + .GetOrCreateItem(KEYWORD_INTF) + .GetOrCreateItem(KEYWORD_CONST); + if (st.LinesBefore.Count = 0) then + st.LinesBefore.Add('const'); + st := st.GetOrCreateItem(fName); + if (st.LinesBefore.Count = 0) then + st.LinesBefore.Add(Format(' %-62s = %s;', [fName, fValue])); end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -//THeaderGenerator////////////////////////////////////////////////////////////////////////////////////////////////////// -//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -procedure THeaderGenerator.ReadFile(const aFilename: String); -var - fs: TFileStream; +constructor THeaderGenerator.TvkConst.Create; begin - if not FileExists(aFilename) then - raise Exception.Create('file does not exist: ' + aFilename); - fs := TFileStream.Create(aFilename, fmOpenRead); - try - ReadFile(fs); - finally - FreeAndNil(fs); - end; + inherited Create(otConst); end; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -procedure THeaderGenerator.ReadFile(const aStream: TStream); +//THeaderGenerator////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure THeaderGenerator.GenerateCode(const aName: WideString; const aTemplate: String; const aOutput: String); type - TGenPass = ( - gpConst, - gpType, - gpPointer, - gpVar, - gpImpl - ); - + TPosMap = specialize TutlMap; var - xml: TDOMNode; - CurrentMark: Integer; - tpl: TStringList; + CurrentName: WideString; + CurrentNumber: Integer; + Code: TStringTree; + PosMap: TPosMap; - procedure AddObject(const aObj: TvkObject); + procedure UpdateComment(const aRoot: TStringTree; const aName: String); + var + i: Integer; + s, tmp: String; + st: TStringTree; begin - if Assigned(aObj) then begin - fObjects.Add(aObj); - aObj.List := fObjects; - WriteLn(Format(' %-10s%s', [FormatType(aObj.VkType), aObj.Name])); - if (aObj.VkType = otConst) then - aObj.Mark := CurrentMark; - end; + st := aRoot.GetOrCreateItem(aName); + if PosMap.TryGetValue(aName, i) and (st.ItemCount > i) and (CurrentName <> '') then + with st.CreateItemAt(aName + CurrentName, i).LinesBefore do begin + s := ' ' + CurrentName + ' '; + if ((Length(s) and 1) = 1) then + s := s + '='; + tmp := StringOfChar('=', (100 - Length(s)) div 2); + s := '{ ' + tmp + s + tmp + ' }'; + Add(''); + Add(s); + end; + PosMap[aName] := st.ItemCount; end; - procedure ParseTypes(const xml: TDOMNode); + procedure UpdateComments; + var st: TStringTree; + begin + st := Code.GetOrCreateItem(KEYWORD_INTF); + UpdateComment(st, KEYWORD_CONST); + UpdateComment(st, KEYWORD_TYPES); + UpdateComment(st, KEYWORD_ENUM); + UpdateComment(st, KEYWORD_FUNCPTR); + UpdateComment(st, KEYWORD_STRUCT); + UpdateComment(st, KEYWORD_COMMAND); + UpdateComment(st, KEYWORD_VAR); + + st := Code.GetOrCreateItem(KEYWORD_IMPL); + UpdateComment(st, KEYWORD_CODE); + end; + + procedure AddGuard(const aTree: TStringTree; const aName: String); var - x: TDOMNode; + i: Integer; begin - x := xml.FirstChild; - while Assigned(x) do begin - AddObject(TvkObject.CreateFromXml(x)); - x := x.NextSibling; + for i := 0 to aTree.ItemCount-1 do + AddGuard(aTree.ItemsByIndex[i], aName); + with aTree.GetOrCreateItem('GUARD' + aName).LinesBefore do begin + Add('{$IFDEF ' + aName + '}'); end; end; - procedure GenerateType(const aCode: TStrings; const aType: TvkObjectType; const aPass: TGenPass); + procedure RemoveGuard(const aTree: TStringTree; const aName: String); var - o: TvkObject; + i: Integer; + g: TStringTree; begin - for o in fObjects do begin - if (o.VkType = aType) and (o.Mark = CurrentMark) then begin - case aPass of - gpConst: o.GenerateConst(aCode); - gpType: o.GenerateType(aCode); - gpPointer: o.GeneratePtr(aCode); - gpVar: o.GenerateVar(aCode); - gpImpl: o.GenerateImpl(aCode); - end; + for i := 0 to aTree.ItemCount-1 do + RemoveGuard(aTree.ItemsByIndex[i], aName); + g := aTree.GetOrCreateItem('GUARD' + aName); + if (g = aTree.ItemsByIndex[aTree.ItemCount-1]) + then aTree.DestroyItem('GUARD' + aName) + else with aTree.GetOrCreateItem('GUARD_END'+ aName).LinesAfter do begin + Add('{$ENDIF}'); + Add(''); end; - end; end; - procedure InsertAt(const aPlaceholder: String; const aText: TStrings); - var i, j: Integer; + procedure CreateGuard(const aName: String); begin - for i := tpl.Count-1 downto 0 do begin - if (Pos(aPlaceholder, tpl[i]) > 0) then begin - for j := aText.Count-1 downto 0 do - tpl.Insert(i, aText[j]); + if (aName = '') then + exit; + AddGuard(Code, aName); + end; + + procedure CloseGuard(const aName: String); + begin + if (aName = '') then + exit; + RemoveGuard(Code, aName); + end; + + procedure GenerateFeatureCode(const aName: String); + var + i: Integer; + begin + i := fObjects.IndexOfObj(aName, VK_OBJECT_ALL); + if (i >= 0) then + fObjects[i].GenerateCode(Code); + end; + + function GenerateEnum(const xml: TDOMNode): Boolean; + var + name: DOMString; + ex: DOMString; + value: DOMString; + offset: Integer; + s: String; + c: TvkConst; + begin + result := false; + name := GetNodeAttrib(xml, 'name'); + if TryGetNodeAttrib(xml, 'extends', ex) then begin + if (CurrentNumber <= 0) then + raise Exception.Create('current extension has no number'); + offset := StrToInt(GetNodeAttrib(xml, 'offset')); + offset := 1000000000 + 1000 * (CurrentNumber-1) + offset; + if (GetNodeAttrib(xml, 'dir', '') = '-') then + offset := -1 * offset; + Code + .GetOrCreateItem(KEYWORD_INTF) + .GetOrCreateItem(KEYWORD_ENUM) + .GetOrCreateItem(ex) + .GetOrCreateItem(KEYWORD_ENUM_VALUES) + .LinesBefore.Add(Format(' %-60s = %s,', [name, IntToStr(offset)])); + end else begin + if not TryGetNodeAttrib(xml, 'value', value) then + exit; + s := StringReplace(string(value), '"', '''', [rfReplaceAll]); + c := TvkConst.Create; + try + c.Name := name; + c.Value := s; + fObjects.AddObject(c); + except + FreeAndNil(c); + raise; end; + c.GenerateCode(Code); end; + result := true; end; - procedure InsertAt(const aPlaceholder: String; const aText: String); - var sl: TStringList; + procedure GenerateFeatureCode(const xml: TDOMNode); + var + x: TDOMNode; begin - sl := TStringList.Create; - try - sl.Text := aText; - InsertAt(aPlaceholder, sl); - finally - FreeAndNil(sl); + x := xml.FirstChild; + while Assigned(x) do begin + if (x.NodeName = 'type') or + (x.NodeName = 'command') then + begin + GenerateFeatureCode(GetNodeAttrib(x, 'name')); + end else if (x.NodeName = 'enum') then begin + if not GenerateEnum(x) then + GenerateFeatureCode(GetNodeAttrib(x, 'name')); + end; + x := x.NextSibling; end; end; - procedure GeneratePass(const aType: TvkObjectType; const aPass: TGenPass; const aPrefix, aPlaceholder: String); - var sl: TStringList; + procedure Generate(const xml: TDOMNode); + var + x: TDOMNode; + g: DOMString; begin - sl := TStringList.Create; + UpdateComments; + g := GetNodeAttrib(xml, 'protect', ''); + CreateGuard(g); try - GenerateType(sl, aType, aPass); - if (sl.Count > 0) then begin - sl.Insert(0, aPrefix); - sl.Add(''); + CurrentName := GetNodeAttrib(xml, 'name'); + if not TryStrToInt(String(GetNodeAttrib(xml, 'number', '-1')), CurrentNumber) then + CurrentNumber := -1; + WriteLn('generate code for feature: ', CurrentName); + x := xml.FirstChild; + while Assigned(x) do begin + if (x.NodeName = 'require') then + GenerateFeatureCode(x); + x := x.NextSibling; end; - InsertAt(aPlaceholder, sl); finally - FreeAndNil(sl); + CloseGuard(g); + UpdateComments; + CurrentName := ''; end; end; - procedure Generate(const aTypes: TvkObjectTypes); - var t: TvkObjectType; + procedure EnableFeature; + var x: TDOMNode; begin - for t in aTypes do begin - GeneratePass(t, gpConst, Format('const { %ss }', [ LowerCase(FormatType(t)) ]), '{%INTERFACE%}'); - GeneratePass(t, gpType, Format('type { %ss }', [ LowerCase(FormatType(t)) ]), '{%INTERFACE%}'); - GeneratePass(t, gpPointer, Format('type { %s pointers }', [ LowerCase(FormatType(t)) ]), '{%INTERFACE%}'); - GeneratePass(t, gpVar, Format('var { %s variables }', [ LowerCase(FormatType(t)) ]), '{%INTERFACE%}'); - GeneratePass(t, gpImpl, '', '{%IMPLEMENTATION%}'); - end; - end; + GenerateFeatureCode('VK_API_VERSION'); + GenerateFeatureCode('VK_API_VERSION_MAJOR'); + GenerateFeatureCode('VK_API_VERSION_MINOR'); + GenerateFeatureCode('VK_API_VERSION_BUGFIX'); - procedure Generate(const aName: DOMString); - begin - fObjects.Sort(@CompareVkObjDependency); - InsertAt('{%INTERFACE%}', Format('{********************************* %s *********************************}', [ aName ])); - InsertAt('{%IMPLEMENTATION%}', Format('{********************************* %s *********************************}', [ aName ])); - Generate([ otConst ]); - Generate([ otType, otHandle, otEnum, otStruct, otFuncPtr ]); - Generate([ otCommand ]); - inc(CurrentMark); + x := fDocument.DocumentElement.FirstChild; + while Assigned(x) do begin + if (x.NodeName = 'feature') and (GetNodeAttrib(x, 'api', '') = aName) then + Generate(x); + x := x.NextSibling; + end; end; - procedure EnableFeature(const xml: TDOMNode); + procedure EnableExtensions; var x: TDOMNode; + g: String; begin - x := xml.FirstChild; + x := fDocument.DocumentElement.FindNode('extensions'); + if not Assigned(x) then + exit; + x := x.FirstChild; while Assigned(x) do begin - if (x.NodeName = 'require') then - EnableFeature(x) - else if (x.NodeName = 'type') then - fObjects.MarkObj(GetNodeAttrib(x, 'name'), VK_OBJECT_TYPES, CurrentMark) - else if (x.NodeName = 'command') then - fObjects.MarkObj(GetNodeAttrib(x, 'name'), [ otCommand ], CurrentMark); - + if (x.NodeName = 'extension') and (GetNodeAttrib(x, 'supported', '') = aName) then + Generate(x); x := x.NextSibling; end; - - if (xml.NodeName = 'feature') or (xml.NodeName = 'extension') then - Generate(GetNodeAttrib(xml, 'name')); end; - procedure RemoveLines(const aText: TStrings); + procedure RemoveEmptyLines(const aText: TStrings); var i: Integer; b: Boolean; @@ -1442,34 +1663,113 @@ var end; end; -begin - Clear; - ReadXMLFile(fDocument, aStream); + procedure PrepareTemplate; + var + sl: TStringList; + s, n: String; + st: TStringTree; + p0, p1: Integer; + begin + sl := TStringList.Create; + try + sl.LoadFromFile(aTemplate); + s := sl.Text; + p0 := Pos('{%', s); + while (p0 > 0) do begin + p1 := Pos('%}', s, p0); + if (p1 <= 0) then + raise Exception.Create('unclosed tag in template'); + n := Trim(Copy(s, p0+2, p1-p0-2)); + st := Code.Items[n]; + n := Copy(s, p0, p1 - p0 + 2); + if Assigned(st) + then s := StringReplace(s, n, st.Text, [rfReplaceAll]) + else s := StringReplace(s, n, '', [rfReplaceAll]); + p0 := Pos('{%', s, p0); + end; + sl.Text := Trim(s); + RemoveEmptyLines(sl); + sl.SaveToFile(aOutput); + finally + FreeAndNil(sl); + end; + end; - if not FileExists(TemplateFile) then - raise Exception.Create('file does not exist: ' + TemplateFile); +begin + if not Assigned(fDocument) then + raise Exception.Create('no xml file loaded, did you call ReadFile before?'); - tpl := TStringList.Create; + Code := TStringTree.Create; + PosMap := TPosMap.Create; try - tpl.LoadFromFile(TemplateFile); - CurrentMark := 1; - WriteLn('read xml data'); - xml := fDocument.DocumentElement.FirstChild; - while Assigned(xml) do begin - if (xml.NodeName = 'types') or (xml.NodeName = 'commands') then - ParseTypes(xml) - else if (xml.NodeName = 'enums') then - AddObject(TvkTypeEnum.CreateFromXml(xml)) - else if (xml.NodeName = 'comment') then - tpl.Text := Trim(COMMENT_HEAD + Trim(xml.TextContent) + COMMENT_BREAK + COMMENT_CONTENT + COMMENT_TAIL) + sLineBreak + tpl.Text - else if (xml.NodeName = 'feature') then - EnableFeature(xml); - xml := xml.NextSibling; + Code.GetOrCreateItem(KEYWORD_COMMENT).LinesBefore.Text := Trim(String(fComment)); + with Code.GetOrCreateItem(KEYWORD_INTF) do begin + GetOrCreateItem(KEYWORD_CONST).LinesAfter.Add(''); + GetOrCreateItem(KEYWORD_TYPES).LinesAfter.Add(''); + GetOrCreateItem(KEYWORD_ENUM).LinesAfter.Add(''); + GetOrCreateItem(KEYWORD_FUNCPTR).LinesAfter.Add(''); + GetOrCreateItem(KEYWORD_STRUCT).LinesAfter.Add(''); + GetOrCreateItem(KEYWORD_COMMAND).LinesAfter.Add(''); + GetOrCreateItem(KEYWORD_VAR).LinesAfter.Add(''); end; - RemoveLines(tpl); - tpl.SaveToFile(OutputFile); + with Code.GetOrCreateItem(KEYWORD_IMPL) do begin + GetOrCreateItem(KEYWORD_CODE).LinesAfter.Add(''); + end; + Code.GetOrCreateItem(KEYWORD_IMPL); + EnableFeature; + EnableExtensions; + PrepareTemplate; + finally + FreeAndNil(PosMap); + FreeAndNil(Code); + end; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure THeaderGenerator.ReadFile(const aFilename: String); +var + fs: TFileStream; +begin + if not FileExists(aFilename) then + raise Exception.Create('file does not exist: ' + aFilename); + fs := TFileStream.Create(aFilename, fmOpenRead); + try + ReadFile(fs); finally - FreeAndNil(tpl); + FreeAndNil(fs); + end; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure THeaderGenerator.ReadFile(const aStream: TStream); +var + xml: TDOMNode; + + procedure ParseTypes(const xml: TDOMNode); + var + x: TDOMNode; + begin + x := xml.FirstChild; + while Assigned(x) do begin + TvkObject.CreateFromXml(x, fObjects); + x := x.NextSibling; + end; + end; + +begin + Clear; + ReadXMLFile(fDocument, aStream); + + WriteLn('read xml data'); + xml := fDocument.DocumentElement.FirstChild; + while Assigned(xml) do begin + if (xml.NodeName = 'types') or (xml.NodeName = 'commands') then + ParseTypes(xml) + else if (xml.NodeName = 'enums') then + TvkObject.CreateFromXml(xml, fObjects) + else if (xml.NodeName = 'comment') then + fComment := WideString(Trim(String(xml.TextContent))); + xml := xml.NextSibling; end; end; @@ -1477,15 +1777,14 @@ end; procedure THeaderGenerator.Clear; procedure CreateBaseType(const aName, aAlias, aParent: DOMString); - var t: TvkTypeSimple; + var t: TvkTypeBase; begin - t := TvkTypeSimple.Create(otType); + t := TvkTypeBase.Create(otType); try t.Name := aName; t.Alias := aAlias; t.Parent := aParent; t.List := fObjects; - t.Mark := 1; fObjects.Add(t); except FreeAndNil(t); @@ -1496,20 +1795,6 @@ procedure THeaderGenerator.Clear; begin fObjects.Clear; - CreateBaseType('PVkVoid', '', 'Pointer'); - CreateBaseType('VkHandle', '', 'Pointer'); - CreateBaseType('VkUint8', '', 'Byte'); - CreateBaseType('VkUint16', '', 'Word'); - CreateBaseType('VkUint32', '', 'Cardinal'); - CreateBaseType('VkUint64', '', 'QWord'); - CreateBaseType('VkInt16', '', 'SmallInt'); - CreateBaseType('VkInt32', '', 'Integer'); - CreateBaseType('VkInt64', '', 'Int64'); - CreateBaseType('VkFloat', '', 'Single'); - CreateBaseType('VkDouble', '', 'Double'); - CreateBaseType('VkChar', '', 'AnsiChar'); - CreateBaseType('VkSize', '', 'SizeUInt'); - CreateBaseType('void', 'VkVoid', ''); CreateBaseType('uint8_t', 'VkUint8', ''); CreateBaseType('uint16_t', 'VkUint16', ''); diff --git a/projects/generator/generator.lpi b/projects/generator/generator.lpi index 5d332e7..64feb4b 100644 --- a/projects/generator/generator.lpi +++ b/projects/generator/generator.lpi @@ -50,7 +50,8 @@ - + + diff --git a/projects/generator/generator.lpr b/projects/generator/generator.lpr index 084e78c..20ec755 100644 --- a/projects/generator/generator.lpr +++ b/projects/generator/generator.lpr @@ -7,7 +7,9 @@ uses cthreads, {$ENDIF}{$ENDIF} Classes, SysUtils, - HeaderGenerator; + HeaderGenerator + , Vulkan + ; var InputFile: String; @@ -66,9 +68,8 @@ begin gen := THeaderGenerator.Create; try - gen.OutputFile := OutputFile; - gen.TemplateFile := TemplateFile; gen.ReadFile(InputFile); + gen.GenerateCode('vulkan', TemplateFile, OutputFile); finally FreeAndNil(gen); end; diff --git a/projects/generator/generator.lps b/projects/generator/generator.lps index 7a92571..337d1e4 100644 --- a/projects/generator/generator.lps +++ b/projects/generator/generator.lps @@ -4,22 +4,21 @@ - + - - - + + - - - - + + + + @@ -27,7 +26,7 @@ - + @@ -35,40 +34,41 @@ - + - + - + - - - - + + + + + - + - + @@ -77,21 +77,22 @@ - + - + - - - - + + + + + @@ -99,35 +100,37 @@ - + - + - - + - + - + - - - + + + + + + @@ -135,148 +138,186 @@ - + - - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + @@ -286,6 +327,12 @@ + + + + + + diff --git a/projects/generator/uutlGenerics.pas b/projects/generator/uutlGenerics.pas new file mode 100644 index 0000000..935743b --- /dev/null +++ b/projects/generator/uutlGenerics.pas @@ -0,0 +1,1997 @@ +unit uutlGenerics; + +{ Package: Utils + Prefix: utl - UTiLs + Beschreibung: diese Unit implementiert allgemein nützliche ausschließlich-generische Klassen } + +{$mode objfpc}{$H+} +{$modeswitch nestedprocvars} + +interface + +uses + Classes, SysUtils, typinfo; + +type +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + generic IutlEqualityComparer = interface + function EqualityCompare(const i1, i2: T): Boolean; + end; + + generic TutlEqualityComparer = class(TInterfacedObject, specialize IutlEqualityComparer) + public + function EqualityCompare(const i1, i2: T): Boolean; + end; + + generic TutlEventEqualityComparer = class(TInterfacedObject, specialize IutlEqualityComparer) + public type + TEqualityEvent = function(const i1, i2: T): Boolean; + TEqualityEventO = function(const i1, i2: T): Boolean of object; + TEqualityEventN = function(const i1, i2: T): Boolean is nested; + private type + TEqualityEventType = (eetNormal, eetObject, eetNested); + private + fEvent: TEqualityEvent; + fEventO: TEqualityEventO; + fEventN: TEqualityEventN; + fEventType: TEqualityEventType; + public + function EqualityCompare(const i1, i2: T): Boolean; + constructor Create(const aEvent: TEqualityEvent); overload; + constructor Create(const aEvent: TEqualityEventO); overload; + constructor Create(const aEvent: TEqualityEventN); overload; + { HINT: you need to activate "$modeswitch nestedprocvars" when you want to use nested callbacks } + end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + generic IutlComparer = interface + function Compare(const i1, i2: T): Integer; + end; + + generic TutlComparer = class(TInterfacedObject, specialize IutlComparer) + public + function Compare(const i1, i2: T): Integer; + end; + + generic TutlEventComparer = class(TInterfacedObject, specialize IutlComparer) + public type + TEvent = function(const i1, i2: T): Integer; + TEventO = function(const i1, i2: T): Integer of object; + TEventN = function(const i1, i2: T): Integer is nested; + private type + TEventType = (etNormal, etObject, etNested); + private + fEvent: TEvent; + fEventO: TEventO; + fEventN: TEventN; + fEventType: TEventType; + public + function Compare(const i1, i2: T): Integer; + constructor Create(const aEvent: TEvent); overload; + constructor Create(const aEvent: TEventO); overload; + constructor Create(const aEvent: TEventN); overload; + { HINT: you need to activate "$modeswitch nestedprocvars" when you want to use nested callbacks } + end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + generic TutlListBase = class(TObject) + private type + TListItem = packed record + data: T; + end; + PListItem = ^TListItem; + + public type + TEnumerator = class(TObject) + private + fReverse: Boolean; + fList: TFPList; + fPosition: Integer; + function GetCurrent: T; + public + property Current: T read GetCurrent; + function GetEnumerator: TEnumerator; + function MoveNext: Boolean; + constructor Create(const aList: TFPList; const aReverse: Boolean = false); + end; + + private + fList: TFPList; + fOwnsObjects: Boolean; + + protected + property List: TFPList read fList; + + function GetCount: Integer; + function GetItem(const aIndex: Integer): T; + procedure SetCount(const aValue: Integer); + procedure SetItem(const aIndex: Integer; const aItem: T); + + function CreateItem: PListItem; virtual; + procedure DestroyItem(const aItem: PListItem; const aFreeItem: Boolean = true); virtual; + procedure InsertIntern(const aIndex: Integer; const aItem: T); virtual; + procedure DeleteIntern(const aIndex: Integer; const aFreeItem: Boolean = true); virtual; + + public + property OwnsObjects: Boolean read fOwnsObjects write fOwnsObjects; + + function GetEnumerator: TEnumerator; + function GetReverseEnumerator: TEnumerator; + procedure Clear; + + constructor Create(const aOwnsObjects: Boolean = true); + destructor Destroy; override; + end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + { a simple list without the ability to compare objects (e.g. for IndexOf, Remove, Extract) } + generic TutlSimpleList = class(specialize TutlListBase) + public type + IComparer = specialize IutlComparer; + TSortDirection = (sdAscending, sdDescending); + private + function Split(aComparer: IComparer; const aDirection: TSortDirection; const aLeft, aRight: Integer): Integer; + procedure QuickSort(aComparer: IComparer; const aDirection: TSortDirection; const aLeft, aRight: Integer); + public + property Items[const aIndex: Integer]: T read GetItem write SetItem; default; + property Count: Integer read GetCount write SetCount; + + function Add(const aItem: T): Integer; + procedure Insert(const aIndex: Integer; const aItem: T); + + procedure Exchange(const aIndex1, aIndex2: Integer); + procedure Move(const aCurIndex, aNewIndex: Integer); + procedure Sort(aComparer: IComparer; const aDirection: TSortDirection = sdAscending); + + procedure Delete(const aIndex: Integer); + + function First: T; + procedure PushFirst(const aItem: T); + function PopFirst(const aFreeItem: Boolean = false): T; + + function Last: T; + procedure PushLast(const aItem: T); + function PopLast(const aFreeItem: Boolean = false): T; + end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + generic TutlCustomList = class(specialize TutlSimpleList) + public type + IEqualityComparer = specialize IutlEqualityComparer; + private + fEqualityComparer: IEqualityComparer; + public + function IndexOf(const aItem: T): Integer; + function Extract(const aItem: T; const aDefault: T): T; + function Remove(const aItem: T): Integer; + + constructor Create(aEqualityComparer: IEqualityComparer; const aOwnsObjects: Boolean = true); + destructor Destroy; override; + end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + generic TutlList = class(specialize TutlCustomList) + public type + TEqualityComparer = specialize TutlEqualityComparer; + public + constructor Create(const aOwnsObjects: Boolean = true); + end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + generic TutlHashSetBase = class(specialize TutlListBase) + public type + IComparer = specialize IutlComparer; + private + fComparer: IComparer; + protected + function SearchItem(const aMin, aMax: Integer; const aItem: T; out aIndex: Integer): Integer; + public + constructor Create(aComparer: IComparer; const aOwnsObjects: Boolean = true); + destructor Destroy; override; + end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + generic TutlCustomHashSet = class(specialize TutlHashSetBase) + public + property Items[const aIndex: Integer]: T read GetItem; default; + property Count: Integer read GetCount; + + function Add(const aItem: T): Boolean; + function Contains(const aItem: T): Boolean; + function IndexOf(const aItem: T): Integer; + function Remove(const aItem: T): Boolean; + procedure Delete(const aIndex: Integer); + end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + generic TutlHashSet = class(specialize TutlCustomHashSet) + public type + TComparer = specialize TutlComparer; + public + constructor Create(const aOwnsObjects: Boolean = true); + end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + EutlMap = class(Exception); + EutlMapKeyNotFound = class(EutlMap) + public + constructor Create; + end; + EutlMapKeyAlreadyExists = class(EutlMap) + public + constructor Create; + end; + + generic TutlMapBase = class(TObject) + public type + IComparer = specialize IutlComparer; + TKeyValuePair = packed record + Key: TKey; + Value: TValue; + end; + + THashSet = class(specialize TutlCustomHashSet) + protected + procedure DestroyItem(const aItem: PListItem; const aFreeItem: Boolean = true); override; + public + property Items[const aIndex: Integer]: TKeyValuePair read GetItem write SetItem; default; + end; + + TKeyValuePairComparer = class(TInterfacedObject, THashSet.IComparer) + private + fComparer: IComparer; + public + function Compare(const i1, i2: TKeyValuePair): Integer; + constructor Create(aComparer: IComparer); + destructor Destroy; override; + end; + + TEnumeratorProxy = class(TObject) + fEnumerator: THashSet.TEnumerator; + function MoveNext: Boolean; + constructor Create(const aEnumerator: THashSet.TEnumerator); + destructor Destroy; override; + end; + + TValueEnumerator = class(TEnumeratorProxy) + function GetCurrent: TValue; + property Current: TValue read GetCurrent; + function GetEnumerator: TValueEnumerator; + end; + + TKeyEnumerator = class(TEnumeratorProxy) + function GetCurrent: TKey; + property Current: TKey read GetCurrent; + function GetEnumerator: TKeyEnumerator; + end; + + TKeyWrapper = class(TObject) + private + fHashSet: THashSet; + function GetItem(const aIndex: Integer): TKey; + function GetCount: Integer; + public + property Items[const aIndex: Integer]: TKey read GetItem; default; + property Count: Integer read GetCount; + function GetEnumerator: TKeyEnumerator; + function GetReverseEnumerator: TKeyEnumerator; + constructor Create(const aHashSet: THashSet); + end; + + TKeyValuePairWrapper = class(TObject) + private + fHashSet: THashSet; + function GetItem(const aIndex: Integer): TKeyValuePair; + function GetCount: Integer; + public + property Items[const aIndex: Integer]: TKeyValuePair read GetItem; default; + property Count: Integer read GetCount; + function GetEnumerator: THashSet.TEnumerator; + function GetReverseEnumerator: THashSet.TEnumerator; + constructor Create(const aHashSet: THashSet); + end; + + private + fHashSetRef: THashSet; + fKeyWrapper: TKeyWrapper; + fKeyValuePairWrapper: TKeyValuePairWrapper; + + function GetValues(const aKey: TKey): TValue; + function GetValueAt(const aIndex: Integer): TValue; + function GetCount: Integer; + + procedure SetValueAt(const aIndex: Integer; aValue: TValue); + procedure SetValues(const aKey: TKey; aValue: TValue); + public + property Values [const aKey: TKey]: TValue read GetValues write SetValues; default; + property ValueAt[const aIndex: Integer]: TValue read GetValueAt write SetValueAt; + property Keys: TKeyWrapper read fKeyWrapper; + property KeyValuePairs: TKeyValuePairWrapper read fKeyValuePairWrapper; + property Count: Integer read GetCount; + + procedure Add(const aKey: TKey; const aValue: TValue); + function IndexOf(const aKey: TKey): Integer; + function Contains(const aKey: TKey): Boolean; + procedure Delete(const aKey: TKey); + procedure DeleteAt(const aIndex: Integer); + procedure Clear; + function TryGetValue(const aKey: TKey; out aValue: TValue): Boolean; + + function GetEnumerator: TValueEnumerator; + function GetReverseEnumerator: TValueEnumerator; + + constructor Create(const aHashSet: THashSet); + destructor Destroy; override; + end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + generic TutlCustomMap = class(specialize TutlMapBase) + private + fHashSetImpl: THashSet; + public + constructor Create(const aComparer: IComparer; const aOwnsObjects: Boolean = true); + destructor Destroy; override; + end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + generic TutlMap = class(specialize TutlCustomMap) + public type + TComparer = specialize TutlComparer; + public + constructor Create(const aOwnsObjects: Boolean = true); + end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + generic TutlQueue = class(TObject) + public type + PListItem = ^TListItem; + TListItem = packed record + data: T; + next: PListItem; + end; + private + function GetCount: Integer; + protected + fFirst: PListItem; + fLast: PListItem; + fCount: Integer; + fOwnsObjects: Boolean; + public + property Count: Integer read GetCount; + + procedure Push(const aItem: T); virtual; + function Pop(out aItem: T): Boolean; virtual; + function Pop: Boolean; + procedure Clear; + + constructor Create(const aOwnsObjects: Boolean = true); + destructor Destroy; override; + end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + generic TutlInterfaceList = class(TInterfaceList) + private type + TInterfaceEnumerator = class(TObject) + private + fList: TInterfaceList; + fPos: Integer; + function GetCurrent: T; + public + property Current: T read GetCurrent; + function MoveNext: Boolean; + constructor Create(const aList: TInterfaceList); + end; + + private + function Get(i : Integer): T; + procedure Put(i : Integer; aItem : T); + public + property Items[Index : Integer]: T read Get write Put; default; + + function First: T; + function IndexOf(aItem : T): Integer; + function Add(aItem : IUnknown): Integer; + procedure Insert(i : Integer; aItem : T); + function Last : T; + function Remove(aItem : T): Integer; + + function GetEnumerator: TInterfaceEnumerator; + end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + EutlEnumConvert = class(EConvertError) + public + constructor Create(const aValue, aExpectedType: String); + end; + generic TutlEnumHelper = class(TObject) + private type + TValueArray = array of T; + private class var + FTypeInfo: PTypeInfo; + FValues: TValueArray; + public + class constructor Initialize; + class function ToString(aValue: T): String; reintroduce; + class function TryToEnum(aStr: String; out aValue: T): Boolean; + class function ToEnum(aStr: String): T; overload; + class function ToEnum(aStr: String; const aDefault: T): T; overload; + class function Values: TValueArray; + class function TypeInfo: PTypeInfo; + end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + generic TutlPagedDataFiFo = class + private type + PPage = ^TPage; + TPage = packed record + Next: PPage; + Data: array of TData; + ReadPos: Integer; + WritePos: Integer; + end; + public type + PData = ^TData; + + IDataProvider = interface(IUnknown) + function Give(const aBuffer: PData; aCount: Integer): Integer; + end; + + IDataConsumer = interface(IUnknown) + function Take(const aBuffer: PData; aCount: Integer): Integer; + end; + + // read from buffer, write to fifo + TDataProvider = class(TInterfacedObject, IDataProvider) + private + fData: PData; + fPos: Integer; + fCount: Integer; + public + function Give(const aBuffer: PData; aCount: Integer): Integer; + constructor Create(const aData: PData; const aCount: Integer); + end; + + // read from fifo, write to buffer + TDataConsumer = class(TInterfacedObject, IDataConsumer) + private + fData: PData; + fPos: Integer; + fCount: Integer; + public + function Take(const aBuffer: PData; aCount: Integer): Integer; + constructor Create(const aData: PData; const aCount: Integer); + end; + + // read from nested callback, write to fifo + TDataCallback = function(const aBuffer: PData; aCount: Integer): Integer is nested; + TNestedDataProvider = class(TInterfacedObject, IDataProvider) + private + fCallback: TDataCallback; + public + function Give(const aBuffer: PData; aCount: Integer): Integer; + constructor Create(const aCallback: TDataCallback); + end; + + // read from fifo, write to nested callback + TNestedDataConsumer = class(TInterfacedObject, IDataConsumer) + private + fCallback: TDataCallback; + public + function Take(const aBuffer: PData; aCount: Integer): Integer; + constructor Create(const aCallback: TDataCallback); + end; + + // read from stream, write to fifo + TStreamDataProvider = class(TInterfacedObject, IDataProvider) + private + fStream: TStream; + public + function Give(const aBuffer: PData; aCount: Integer): Integer; + constructor Create(const aStream: TStream); + end; + + // read from fifo, write to stream + TStreamDataConsumer = class(TInterfacedObject, IDataConsumer) + private + fStream: TStream; + public + function Take(const aBuffer: PData; aCount: Integer): Integer; + constructor Create(const aStream: TStream); + end; + + private + fPageSize: Integer; + fReadPage: PPage; + fWritePage: PPage; + fSize: Integer; + protected + function WriteIntern(const aProvider: IDataProvider; aCount: Integer): Integer; virtual; + function ReadIntern(const aConsumer: IDataConsumer; aCount: Integer; const aMoveReadPos: Boolean): Integer; virtual; + public + property Size: Integer read fSize; + property PageSize: Integer read fPageSize; + + function Write(const aProvider: IDataProvider; const aCount: Integer): Integer; overload; + function Write(const aData: PData; const aCount: Integer): Integer; overload; + + function Read(const aConsumer: IDataConsumer; const aCount: Integer): Integer; overload; + function Read(const aData: PData; const aCount: Integer): Integer; overload; + + function Peek(const aConsumer: IDataConsumer; const aCount: Integer): Integer; overload; + function Peek(const aData: PData; const aCount: Integer): Integer; overload; + + function Discard(const aCount: Integer): Integer; + procedure Clear; + + constructor Create(const aPageSize: Integer = 2048); + destructor Destroy; override; + end; + + function utlFreeOrFinalize(var obj; const aTypeInfo: PTypeInfo; const aFreeObj: Boolean = true): Boolean; + +operator < (const i1, i2: TObject): Boolean; inline; +operator > (const i1, i2: TObject): Boolean; inline; + +implementation + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//Helper//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +operator < (const i1, i2: TObject): Boolean; +begin + result := Pointer(i1) < Pointer(i2); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +operator > (const i1, i2: TObject): Boolean; +begin + result := Pointer(i1) > Pointer(i2); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function utlFreeOrFinalize(var obj; const aTypeInfo: PTypeInfo; const aFreeObj: Boolean = true): Boolean; +var + o: TObject; +begin + result := true; + case aTypeInfo^.Kind of + tkClass: begin + if (aFreeObj) then begin + o := TObject(obj); + Pointer(obj) := nil; + o.Free; + end; + end; + + tkInterface: begin + IUnknown(obj) := nil; + end; + + tkAString: begin + AnsiString(Obj) := ''; + end; + + tkUString: begin + UnicodeString(Obj) := ''; + end; + + tkString: begin + String(Obj) := ''; + end; + else + result := false; + end; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlCustomMap.Create(const aComparer: IComparer; const aOwnsObjects: Boolean); +begin + fHashSetImpl := THashSet.Create(TKeyValuePairComparer.Create(aComparer), aOwnsObjects); + inherited Create(fHashSetImpl); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +destructor TutlCustomMap.Destroy; +begin + inherited Destroy; + FreeAndNil(fHashSetImpl); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//EutlEnumConvert/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor EutlEnumConvert.Create(const aValue, aExpectedType: String); +begin + inherited Create(Format('%s is not a %s', [aValue, aExpectedType])); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//EutlMapKeyNotFound//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor EutlMapKeyNotFound.Create; +begin + inherited Create('key not found'); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//EutlMapKeyAlreadyExists/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor EutlMapKeyAlreadyExists.Create; +begin + inherited Create('key already exists'); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlEqualityComparer////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlEqualityComparer.EqualityCompare(const i1, i2: T): Boolean; +begin + result := (i1 = i2); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlEventEqualityComparer.EqualityCompare(const i1, i2: T): Boolean; +begin + case fEventType of + eetNormal: result := fEvent(i1, i2); + eetObject: result := fEventO(i1, i2); + eetNested: result := fEventN(i1, i2); + end; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlEventEqualityComparer.Create(const aEvent: TEqualityEvent); +begin + inherited Create; + fEvent := aEvent; + fEventType := eetNormal; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlEventEqualityComparer.Create(const aEvent: TEqualityEventO); +begin + inherited Create; + fEventO := aEvent; + fEventType := eetObject; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlEventEqualityComparer.Create(const aEvent: TEqualityEventN); +begin + inherited Create; + fEventN := aEvent; + fEventType := eetNested; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlComparer////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlComparer.Compare(const i1, i2: T): Integer; +begin + if (i1 < i2) then + result := -1 + else if (i1 > i2) then + result := 1 + else + result := 0; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlEventComparer.Compare(const i1, i2: T): Integer; +begin + case fEventType of + etNormal: result := fEvent(i1, i2); + etObject: result := fEventO(i1, i2); + etNested: result := fEventN(i1, i2); + end; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlEventComparer.Create(const aEvent: TEvent); +begin + inherited Create; + fEvent := aEvent; + fEventType := etNormal; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlEventComparer.Create(const aEvent: TEventO); +begin + inherited Create; + fEventO := aEvent; + fEventType := etObject; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlEventComparer.Create(const aEvent: TEventN); +begin + inherited Create; + fEventN := aEvent; + fEventType := etNested; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlListBase////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlListBase.TEnumerator.GetCurrent: T; +begin + result := PListItem(fList[fPosition])^.data; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlListBase.TEnumerator.GetEnumerator: TEnumerator; +begin + result := self; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlListBase.TEnumerator.MoveNext: Boolean; +begin + if fReverse then begin + dec(fPosition); + result := (fPosition >= 0); + end else begin + inc(fPosition); + result := (fPosition < fList.Count) + end; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlListBase.TEnumerator.Create(const aList: TFPList; const aReverse: Boolean); +begin + inherited Create; + fList := aList; + fReverse := aReverse; + if fReverse then + fPosition := fList.Count + else + fPosition := -1; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlListBase////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlListBase.GetCount: Integer; +begin + result := fList.Count; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlListBase.GetItem(const aIndex: Integer): T; +begin + if (aIndex >= 0) and (aIndex < fList.Count) then + result := PListItem(fList[aIndex])^.data + else + raise Exception.CreateFmt('index (%d) out of range (%d:%d)', [aIndex, 0, fList.Count-1]); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlListBase.SetCount(const aValue: Integer); +var + item: PListItem; +begin + if (aValue < 0) then + raise Exception.Create('new value for count must be positiv'); + while (aValue > fList.Count) do begin + item := CreateItem; + FillByte(item^, SizeOf(item^), 0); + fList.Add(item); + end; + while (aValue < fList.Count) do + DeleteIntern(fList.Count-1); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlListBase.SetItem(const aIndex: Integer; const aItem: T); +var + item: PListItem; +begin + if (aIndex >= 0) and (aIndex < fList.Count) then begin + item := PListItem(fList[aIndex]); + utlFreeOrFinalize(item^, TypeInfo(item^), fOwnsObjects); + item^.data := aItem; + end else + raise Exception.CreateFmt('index (%d) out of range (%d:%d)', [aIndex, 0, fList.Count-1]); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlListBase.CreateItem: PListItem; +begin + new(result); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlListBase.DestroyItem(const aItem: PListItem; const aFreeItem: Boolean); +begin + utlFreeOrFinalize(aItem^.data, TypeInfo(aItem^.data), fOwnsObjects and aFreeItem); + Dispose(aItem); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlListBase.InsertIntern(const aIndex: Integer; const aItem: T); +var + item: PListItem; +begin + item := CreateItem; + try + item^.data := aItem; + fList.Insert(aIndex, item); + except + DestroyItem(item, false); + raise; + end; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlListBase.DeleteIntern(const aIndex: Integer; const aFreeItem: Boolean); +var + item: PListItem; +begin + if (aIndex >= 0) and (aIndex < fList.Count) then begin + item := PListItem(fList[aIndex]); + fList.Delete(aIndex); + DestroyItem(item, aFreeItem); + end else + raise Exception.CreateFmt('index (%d) out of range (%d:%d)', [aIndex, 0, fList.Count-1]); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlListBase.GetEnumerator: TEnumerator; +begin + result := TEnumerator.Create(fList, false); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlListBase.GetReverseEnumerator: TEnumerator; +begin + result := TEnumerator.Create(fList, true); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlListBase.Clear; +begin + while (fList.Count > 0) do + DeleteIntern(fList.Count-1); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlListBase.Create(const aOwnsObjects: Boolean); +begin + inherited Create; + fOwnsObjects := aOwnsObjects; + fList := TFPList.Create; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +destructor TutlListBase.Destroy; +begin + Clear; + FreeAndNil(fList); + inherited Destroy; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlSimpleList//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlSimpleList.Split(aComparer: IComparer; const aDirection: TSortDirection; const aLeft, aRight: Integer): Integer; +var + i, j: Integer; + pivot: T; +begin + i := aLeft; + j := aRight - 1; + pivot := GetItem(aRight); + repeat + while ((aDirection = sdAscending) and (aComparer.Compare(GetItem(i), pivot) <= 0) or + (aDirection = sdDescending) and (aComparer.Compare(GetItem(i), pivot) >= 0)) and + (i < aRight) do inc(i); + + while ((aDirection = sdAscending) and (aComparer.Compare(GetItem(j), pivot) >= 0) or + (aDirection = sdDescending) and (aComparer.Compare(GetItem(j), pivot) <= 0)) and + (j > aLeft) do dec(j); + + if (i < j) then + Exchange(i, j); + until (i >= j); + + if ((aDirection = sdAscending) and (aComparer.Compare(GetItem(i), pivot) > 0)) or + ((aDirection = sdDescending) and (aComparer.Compare(GetItem(i), pivot) < 0)) then + Exchange(i, aRight); + + result := i; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlSimpleList.QuickSort(aComparer: IComparer; const aDirection: TSortDirection; const aLeft, aRight: Integer); +var + s: Integer; +begin + if (aLeft < aRight) then begin + s := Split(aComparer, aDirection, aLeft, aRight); + QuickSort(aComparer, aDirection, aLeft, s - 1); + QuickSort(aComparer, aDirection, s + 1, aRight); + end; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlSimpleList.Add(const aItem: T): Integer; +begin + result := Count; + InsertIntern(result, aItem); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlSimpleList.Insert(const aIndex: Integer; const aItem: T); +begin + InsertIntern(aIndex, aItem); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlSimpleList.Exchange(const aIndex1, aIndex2: Integer); +begin + if (aIndex1 < 0) or (aIndex1 >= Count) then + raise Exception.CreateFmt('index (%d) out of range (%d:%d)', [aIndex1, 0, Count-1]); + if (aIndex2 < 0) or (aIndex2 >= Count) then + raise Exception.CreateFmt('index (%d) out of range (%d:%d)', [aIndex1, 0, Count-1]); + fList.Exchange(aIndex1, aIndex2); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlSimpleList.Move(const aCurIndex, aNewIndex: Integer); +begin + if (aCurIndex < 0) or (aCurIndex >= Count) then + raise Exception.CreateFmt('index (%d) out of range (%d:%d)', [aCurIndex, 0, Count-1]); + if (aNewIndex < 0) or (aNewIndex >= Count) then + raise Exception.CreateFmt('index (%d) out of range (%d:%d)', [aNewIndex, 0, Count-1]); + fList.Move(aCurIndex, aNewIndex); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlSimpleList.Sort(aComparer: IComparer; const aDirection: TSortDirection); +begin + QuickSort(aComparer, aDirection, 0, fList.Count-1); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlSimpleList.Delete(const aIndex: Integer); +begin + DeleteIntern(aIndex); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlSimpleList.First: T; +begin + result := Items[0]; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlSimpleList.PushFirst(const aItem: T); +begin + InsertIntern(0, aItem); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlSimpleList.PopFirst(const aFreeItem: Boolean): T; +begin + if aFreeItem then + FillByte(result{%H-}, SizeOf(result), 0) + else + result := First; + DeleteIntern(0, aFreeItem); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlSimpleList.Last: T; +begin + result := Items[Count-1]; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlSimpleList.PushLast(const aItem: T); +begin + InsertIntern(Count, aItem); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlSimpleList.PopLast(const aFreeItem: Boolean): T; +begin + if aFreeItem then + FillByte(result{%H-}, SizeOf(result), 0) + else + result := Last; + DeleteIntern(Count-1, aFreeItem); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlCustomList//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlCustomList.IndexOf(const aItem: T): Integer; +var + c: Integer; +begin + c := List.Count; + result := 0; + while (result < c) and + not fEqualityComparer.EqualityCompare(PListItem(List[result])^.data, aItem) do + inc(result); + if (result >= c) then + result := -1; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlCustomList.Extract(const aItem: T; const aDefault: T): T; +var + i: Integer; +begin + i := IndexOf(aItem); + if (i >= 0) then begin + result := Items[i]; + DeleteIntern(i, false); + end else + result := aDefault; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlCustomList.Remove(const aItem: T): Integer; +begin + result := IndexOf(aItem); + if (result >= 0) then + DeleteIntern(result); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlCustomList.Create(aEqualityComparer: IEqualityComparer; const aOwnsObjects: Boolean); +begin + inherited Create(aOwnsObjects); + fEqualityComparer := aEqualityComparer; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +destructor TutlCustomList.Destroy; +begin + fEqualityComparer := nil; + inherited Destroy; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlList////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlList.Create(const aOwnsObjects: Boolean); +begin + inherited Create(TEqualityComparer.Create, aOwnsObjects); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlHashSetBase/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlHashSetBase.SearchItem(const aMin, aMax: Integer; const aItem: T; out aIndex: Integer): Integer; +var + i, cmp: Integer; +begin + if (aMin <= aMax) then begin + i := aMin + Trunc((aMax - aMin) / 2); + cmp := fComparer.Compare(aItem, GetItem(i)); + if (cmp = 0) then + result := i + else if (cmp < 0) then + result := SearchItem(aMin, i-1, aItem, aIndex) + else if (cmp > 0) then + result := SearchItem(i+1, aMax, aItem, aIndex); + end else begin + result := -1; + aIndex := aMin; + end; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlHashSetBase.Create(aComparer: IComparer; const aOwnsObjects: Boolean); +begin + inherited Create(aOwnsObjects); + fComparer := aComparer; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +destructor TutlHashSetBase.Destroy; +begin + fComparer := nil; + inherited Destroy; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlCustomHashSet///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlCustomHashSet.Add(const aItem: T): Boolean; +var + i: Integer; +begin + result := (SearchItem(0, List.Count-1, aItem, i) < 0); + if result then + InsertIntern(i, aItem); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlCustomHashSet.Contains(const aItem: T): Boolean; +var + tmp: Integer; +begin + result := (SearchItem(0, List.Count-1, aItem, tmp) >= 0); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlCustomHashSet.IndexOf(const aItem: T): Integer; +var + tmp: Integer; +begin + result := SearchItem(0, List.Count-1, aItem, tmp); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlCustomHashSet.Remove(const aItem: T): Boolean; +var + i, tmp: Integer; +begin + i := SearchItem(0, List.Count-1, aItem, tmp); + result := (i >= 0); + if result then + DeleteIntern(i); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlCustomHashSet.Delete(const aIndex: Integer); +begin + DeleteIntern(aIndex); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlHashSet/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlHashSet.Create(const aOwnsObjects: Boolean); +begin + inherited Create(TComparer.Create, aOwnsObjects); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlMapBase.THashSet////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlMapBase.THashSet.DestroyItem(const aItem: PListItem; const aFreeItem: Boolean); +begin + // never free objects used as keys, but do finalize strings, interfaces etc. + utlFreeOrFinalize(aItem^.data.key, TypeInfo(aItem^.data.key), false); + utlFreeOrFinalize(aItem^.data.value, TypeInfo(aItem^.data.value), aFreeItem and OwnsObjects); + inherited DestroyItem(aItem, aFreeItem); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlMapBase.TKeyValuePairComparer///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlMapBase.TKeyValuePairComparer.Compare(const i1, i2: TKeyValuePair): Integer; +begin + result := fComparer.Compare(i1.Key, i2.Key); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlMapBase.TKeyValuePairComparer.Create(aComparer: IComparer); +begin + inherited Create; + fComparer := aComparer; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +destructor TutlMapBase.TKeyValuePairComparer.Destroy; +begin + fComparer := nil; + inherited Destroy; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlMapBase.TEnumeratorProxy////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlMapBase.TEnumeratorProxy.MoveNext: Boolean; +begin + result := fEnumerator.MoveNext; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlMapBase.TEnumeratorProxy.Create(const aEnumerator: THashSet.TEnumerator); +begin + inherited Create; + fEnumerator := aEnumerator; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +destructor TutlMapBase.TEnumeratorProxy.Destroy; +begin + FreeAndNil(fEnumerator); + inherited Destroy; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlMapBase.TValueEnumerator////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlMapBase.TValueEnumerator.GetCurrent: TValue; +begin + result := fEnumerator.GetCurrent.Value; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlMapBase.TValueEnumerator.GetEnumerator: TValueEnumerator; +begin + result := self; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlMapBase.TKeyEnumerator//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlMapBase.TKeyEnumerator.GetCurrent: TKey; +begin + result := fEnumerator.GetCurrent.Key; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlMapBase.TKeyEnumerator.GetEnumerator: TKeyEnumerator; +begin + result := self; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlMapBase.TKeyWrapper/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlMapBase.TKeyWrapper.GetItem(const aIndex: Integer): TKey; +begin + result := fHashSet[aIndex].Key; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlMapBase.TKeyWrapper.GetCount: Integer; +begin + result := fHashSet.Count; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlMapBase.TKeyWrapper.GetEnumerator: TKeyEnumerator; +begin + result := TKeyEnumerator.Create(fHashSet.GetEnumerator); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlMapBase.TKeyWrapper.GetReverseEnumerator: TKeyEnumerator; +begin + result := TKeyEnumerator.Create(fHashSet.GetReverseEnumerator); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlMapBase.TKeyWrapper.Create(const aHashSet: THashSet); +begin + inherited Create; + fHashSet := aHashSet; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlMapBase.TKeyValuePairWrapper////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlMapBase.TKeyValuePairWrapper.GetItem(const aIndex: Integer): TKeyValuePair; +begin + result := fHashSet[aIndex]; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlMapBase.TKeyValuePairWrapper.GetCount: Integer; +begin + result := fHashSet.Count; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlMapBase.TKeyValuePairWrapper.GetEnumerator: THashSet.TEnumerator; +begin + result := fHashSet.GetEnumerator; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlMapBase.TKeyValuePairWrapper.GetReverseEnumerator: THashSet.TEnumerator; +begin + result := fHashSet.GetReverseEnumerator; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlMapBase.TKeyValuePairWrapper.Create(const aHashSet: THashSet); +begin + inherited Create; + fHashSet := aHashSet; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlMapBase/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlMapBase.GetValues(const aKey: TKey): TValue; +var + i: Integer; + kvp: TKeyValuePair; +begin + kvp.Key := aKey; + i := fHashSetRef.IndexOf(kvp); + if (i < 0) then + FillByte(result{%H-}, SizeOf(result), 0) + else + result := fHashSetRef[i].Value; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlMapBase.GetValueAt(const aIndex: Integer): TValue; +begin + result := fHashSetRef[aIndex].Value; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlMapBase.GetCount: Integer; +begin + result := fHashSetRef.Count; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlMapBase.SetValues(const aKey: TKey; aValue: TValue); +var + i: Integer; + kvp: TKeyValuePair; +begin + kvp.Key := aKey; + kvp.Value := aValue; + i := fHashSetRef.IndexOf(kvp); + if (i < 0) + then Add(aKey, aValue) + else fHashSetRef[i] := kvp; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlMapBase.SetValueAt(const aIndex: Integer; aValue: TValue); +var + kvp: TKeyValuePair; +begin + kvp := fHashSetRef[aIndex]; + kvp.Value := aValue; + fHashSetRef[aIndex] := kvp; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlMapBase.Add(const aKey: TKey; const aValue: TValue); +var + kvp: TKeyValuePair; +begin + kvp.Key := aKey; + kvp.Value := aValue; + if not fHashSetRef.Add(kvp) then + raise EutlMapKeyAlreadyExists.Create(); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlMapBase.IndexOf(const aKey: TKey): Integer; +var + kvp: TKeyValuePair; +begin + kvp.Key := aKey; + result := fHashSetRef.IndexOf(kvp); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlMapBase.Contains(const aKey: TKey): Boolean; +var + kvp: TKeyValuePair; +begin + kvp.Key := aKey; + result := (fHashSetRef.IndexOf(kvp) >= 0); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlMapBase.Delete(const aKey: TKey); +var + kvp: TKeyValuePair; +begin + kvp.Key := aKey; + if not fHashSetRef.Remove(kvp) then + raise EutlMapKeyNotFound.Create; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlMapBase.DeleteAt(const aIndex: Integer); +begin + fHashSetRef.Delete(aIndex); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlMapBase.Clear; +begin + fHashSetRef.Clear; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlMapBase.TryGetValue(const aKey: TKey; out aValue: TValue): Boolean; +var i: Integer; +begin + i := IndexOf(aKey); + result := (i >= 0); + if result then + aValue := GetValueAt(i); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlMapBase.GetEnumerator: TValueEnumerator; +begin + result := TValueEnumerator.Create(fHashSetRef.GetEnumerator); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlMapBase.GetReverseEnumerator: TValueEnumerator; +begin + result := TValueEnumerator.Create(fHashSetRef.GetReverseEnumerator); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlMapBase.Create(const aHashSet: THashSet); +begin + inherited Create; + fHashSetRef := aHashSet; + fKeyWrapper := TKeyWrapper.Create(fHashSetRef); + fKeyValuePairWrapper := TKeyValuePairWrapper.Create(fHashSetRef); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +destructor TutlMapBase.Destroy; +begin + FreeAndNil(fKeyValuePairWrapper); + FreeAndNil(fKeyWrapper); + fHashSetRef := nil; + inherited Destroy; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlMap/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlMap.Create(const aOwnsObjects: Boolean); +begin + inherited Create(TComparer.Create, aOwnsObjects); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlQueue///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlQueue.GetCount: Integer; +begin + InterLockedExchange(result{%H-}, fCount); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlQueue.Push(const aItem: T); +var + p: PListItem; +begin + new(p); + p^.data := aItem; + p^.next := nil; + fLast^.next := p; + fLast := fLast^.next; + InterLockedIncrement(fCount); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlQueue.Pop(out aItem: T): Boolean; +var + old: PListItem; +begin + result := false; + FillByte(aItem{%H-}, SizeOf(aItem), 0); + if (Count <= 0) then + exit; + result := true; + old := fFirst; + fFirst := fFirst^.next; + aItem := fFirst^.data; + InterLockedDecrement(fCount); + Dispose(old); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlQueue.Pop: Boolean; +var + tmp: T; +begin + result := Pop(tmp); + utlFreeOrFinalize(tmp, TypeInfo(tmp), fOwnsObjects); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlQueue.Clear; +begin + while Pop do; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlQueue.Create(const aOwnsObjects: Boolean); +begin + inherited Create; + new(fFirst); + FillByte(fFirst^, SizeOf(fFirst^), 0); + fLast := fFirst; + fCount := 0; + fOwnsObjects := aOwnsObjects; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +destructor TutlQueue.Destroy; +begin + Clear; + if Assigned(fLast) then begin + Dispose(fLast); + fLast := nil; + end; + inherited Destroy; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlInterfaceList.TInterfaceEnumerator//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlInterfaceList.TInterfaceEnumerator.GetCurrent: T; +begin + result := T(fList[fPos]); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlInterfaceList.TInterfaceEnumerator.MoveNext: Boolean; +begin + inc(fPos); + result := (fPos < fList.Count); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlInterfaceList.TInterfaceEnumerator.Create(const aList: TInterfaceList); +begin + inherited Create; + fPos := -1; + fList := aList; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlInterfaceList///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlInterfaceList.Get(i : Integer): T; +begin + result := T(inherited Get(i)); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlInterfaceList.Put(i : Integer; aItem : T); +begin + inherited Put(i, aItem); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlInterfaceList.First: T; +begin + result := T(inherited First); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlInterfaceList.IndexOf(aItem : T): Integer; +begin + result := inherited IndexOf(aItem); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlInterfaceList.Add(aItem : IUnknown): Integer; +begin + result := inherited Add(aItem); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlInterfaceList.Insert(i : Integer; aItem : T); +begin + inherited Insert(i, aItem); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlInterfaceList.Last : T; +begin + result := T(inherited Last); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlInterfaceList.Remove(aItem : T): Integer; +begin + result := inherited Remove(aItem); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlInterfaceList.GetEnumerator: TInterfaceEnumerator; +begin + result := TInterfaceEnumerator.Create(self); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlEnumHelper//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +class constructor TutlEnumHelper.Initialize; +var + tiArray: PTypeInfo; + tdArray, tdEnum: PTypeData; + aName: PShortString; + i: integer; + en: T; +begin + { + See FPC Bug http://bugs.freepascal.org/view.php?id=27622 + For Sparse Enums, the compiler won't give us TypeInfo, because it contains some wrong data. This is + safe, but sadly we don't even get the *correct* fields (TypeName, NameList), even though they are + generated in any case. + Fortunately, arrays do know this type info segment as their Element Type (and we declared one anyway). + } + tiArray := System.TypeInfo(TValueArray); + tdArray := GetTypeData(tiArray); + FTypeInfo:= tdArray^.elType2; + + { + Now that we have the TypeInfo, fill our values from it. This is safe because while the *values* in + TypeData are wrong for Sparse Enums, the *names* are always correct. + } + tdEnum:= GetTypeData(FTypeInfo); + aName:= @tdEnum^.NameList; + SetLength(FValues, 0); + i:= 0; + While Length(aName^) > 0 do begin + SetLength(FValues, i+1); + { + Memory layout for TTypeData has the declaring EnumUnitName after the last NameList entry. + This can normally not be the same as a valid enum value, because it is in the same identifier + namespace. However, with scoped enums we might have the same name for module and element, because + the full identifier for the element would be TypeName.ElementName. + In either case, the next PShortString will point to a zero-length string, and the loop is left + with the last element being invalid (either empty or whatever value the unit-named element has). + } + if TryToEnum(aName^, en) then + FValues[i]:= en; + inc(i); + inc(PByte(aName), Length(aName^) + 1); + end; + // remove the EnumUnitName item + SetLength(FValues, Length(FValues) - 1); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +class function TutlEnumHelper.ToString(aValue: T): String; +begin + {$Push} + {$IOChecks OFF} + WriteStr(Result, aValue); + if IOResult = 107 then + Result:= ''; + {$Pop} +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +class function TutlEnumHelper.TryToEnum(aStr: String; out aValue: T): Boolean; +var + a: T; +begin + Result:= false; + if Length(aStr) = 0 then + exit; + + {$Push} + {$IOChecks OFF} + ReadStr(aStr, a); + Result:= IOResult <> 106; + {$Pop} + if Result then + aValue:= a; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +class function TutlEnumHelper.ToEnum(aStr: String): T; +begin + if not TryToEnum(aStr, result) then + raise EutlEnumConvert.Create(aStr, TypeInfo^.Name); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +class function TutlEnumHelper.ToEnum(aStr: String; const aDefault: T): T; +begin + if not TryToEnum(aStr, result) then + result := aDefault; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +class function TutlEnumHelper.Values: TValueArray; +begin + Result:= FValues; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +class function TutlEnumHelper.TypeInfo: PTypeInfo; +begin + Result:= FTypeInfo; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlPagedDataFiFo.TDataProvider/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlPagedDataFiFo.TDataProvider.Give(const aBuffer: PData; aCount: Integer): Integer; +begin + result := 0; + if (aCount > fCount - fPos) then + aCount := fCount - fPos; + if (aCount <= 0) then + exit; + Move((fData + fPos)^, aBuffer^, aCount * SizeOf(TData)); + inc(fPos, aCount); + result := aCount; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlPagedDataFiFo.TDataProvider.Create(const aData: PData; const aCount: Integer); +begin + inherited Create; + fData := aData; + fCount := aCount; + fPos := 0; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlPagedDataFiFo.TDataConsumer/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlPagedDataFiFo.TDataConsumer.Take(const aBuffer: PData; aCount: Integer): Integer; +begin + result := 0; + if (aCount > fCount - fPos) then + aCount := fCount - fPos; + if (aCount <= 0) then + exit; + Move(aBuffer^, (fData + fPos)^, aCount * SizeOf(TData)); + inc(fPos, aCount); + result := aCount; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlPagedDataFiFo.TDataConsumer.Create(const aData: PData; const aCount: Integer); +begin + inherited Create; + fData := aData; + fCount := aCount; + fPos := 0; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlPagedDataFiFo.TNestedDataProvider///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlPagedDataFiFo.TNestedDataProvider.Give(const aBuffer: PData; aCount: Integer): Integer; +begin + result := fCallback(aBuffer, aCount); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlPagedDataFiFo.TNestedDataProvider.Create(const aCallback: TDataCallback); +begin + inherited Create; + fCallback := aCallback; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlPagedDataFiFo.TNestedDataConsumer///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlPagedDataFiFo.TNestedDataConsumer.Take(const aBuffer: PData; aCount: Integer): Integer; +begin + result := fCallback(aBuffer, aCount); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlPagedDataFiFo.TNestedDataConsumer.Create(const aCallback: TDataCallback); +begin + inherited Create; + fCallback := aCallback; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlPagedDataFiFo.TStreamDataProvider///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlPagedDataFiFo.TStreamDataProvider.Give(const aBuffer: PData; aCount: Integer): Integer; +begin + result := fStream.Read(aBuffer^, aCount); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlPagedDataFiFo.TStreamDataProvider.Create(const aStream: TStream); +begin + inherited Create; + fStream := aStream; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlPagedDataFiFo.TStreamDataConsumer///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlPagedDataFiFo.TStreamDataConsumer.Take(const aBuffer: PData; aCount: Integer): Integer; +begin + result := fStream.Write(aBuffer^, aCount); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlPagedDataFiFo.TStreamDataConsumer.Create(const aStream: TStream); +begin + inherited Create; + fStream := aStream; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//TutlPagedDataFiFo///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlPagedDataFiFo.WriteIntern(const aProvider: IDataProvider; aCount: Integer): Integer; +var + c, r: Integer; + p: PPage; +begin + if not Assigned(aProvider) then + raise Exception.Create('argument nil: aProvider'); + + result := 0; + while (aCount > 0) do begin + if not Assigned(fWritePage) or (fWritePage^.WritePos >= fPageSize) then begin + new(p); + p^.ReadPos := 0; + p^.WritePos := 0; + p^.Next := nil; + SetLength(p^.Data, fPageSize); + if Assigned(fWritePage) then + fWritePage^.Next := p; + fWritePage := p; + if not Assigned(fReadPage) then + fReadPage := fWritePage; + end; + + c := fPageSize - fWritePage^.WritePos; + if (c > aCount) then + c := aCount; + + r := aProvider.Give(@fWritePage^.Data[fWritePage^.WritePos], c); + if (r = 0) then + exit; + + inc(result, r); + inc(fWritePage^.WritePos, r); + inc(fSize, r); + dec(aCount, r); + end; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlPagedDataFiFo.ReadIntern(const aConsumer: IDataConsumer; aCount: Integer; const aMoveReadPos: Boolean): Integer; +var + ReadPage: PPage; + DummyPage: TPage; + c, r: Integer; + +begin + result := 0; + + if not Assigned(fReadPage) then + exit; + + //init read page + if not aMoveReadPos then begin + DummyPage := fReadPage^; // copy page (data is not copied, because it's a dynamic array) + ReadPage := @DummyPage; + end else + ReadPage := fReadPage; + + while (aCount > 0) do begin + if (ReadPage^.ReadPos >= fPageSize) then begin + if not Assigned(ReadPage^.Next) then + exit; + if aMoveReadPos then begin + if (fReadPage = fWritePage) then // write finished with page end, so reset WritePage wenn disposing ReadPage + fWritePage := nil; + fReadPage := fReadPage^.Next; + Dispose(ReadPage); + ReadPage := fReadPage; + end else + ReadPage^ := ReadPage^.Next^; + end; + + c := ReadPage^.WritePos - ReadPage^.ReadPos; + if (c = 0) then + exit; + if (c > aCount) then + c := aCount; + + if Assigned(aConsumer) then begin + + r := aConsumer.Take(@ReadPage^.Data[ReadPage^.ReadPos], c); + if (r = 0) then + exit; + end else + r := c; + + inc(result, r); + inc(ReadPage^.ReadPos, r); + dec(aCount, r); + if aMoveReadPos then + dec(fSize, r); + end; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlPagedDataFiFo.Write(const aProvider: IDataProvider; const aCount: Integer): Integer; +begin + result := WriteIntern(aProvider, aCount); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlPagedDataFiFo.Write(const aData: PData; const aCount: Integer): Integer; +var + provider: IDataProvider; +begin + provider := TDataProvider.Create(aData, aCount); + result := WriteIntern(provider, aCount); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlPagedDataFiFo.Read(const aConsumer: IDataConsumer; const aCount: Integer): Integer; +begin + result := ReadIntern(aConsumer, aCount, true); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlPagedDataFiFo.Read(const aData: PData; const aCount: Integer): Integer; +var + consumer: IDataConsumer; +begin + consumer := TDataConsumer.Create(aData, aCount); + result := ReadIntern(consumer, aCount, true); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlPagedDataFiFo.Peek(const aConsumer: IDataConsumer; const aCount: Integer): Integer; +begin + result := ReadIntern(aConsumer, aCount, false); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlPagedDataFiFo.Peek(const aData: PData; const aCount: Integer): Integer; +var + consumer: IDataConsumer; +begin + consumer := TDataConsumer.Create(aData, aCount); + result := ReadIntern(consumer, aCount, false); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +function TutlPagedDataFiFo.Discard(const aCount: Integer): Integer; +begin + result := ReadIntern(nil, aCount, true); +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +procedure TutlPagedDataFiFo.Clear; +var + tmp: PPage; +begin + while Assigned(fReadPage) do begin + tmp := fReadPage; + fReadPage := tmp^.Next; + Dispose(tmp); + end; + fReadPage := nil; + fWritePage := nil; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +constructor TutlPagedDataFiFo.Create(const aPageSize: Integer); +begin + inherited Create; + fReadPage := nil; + fWritePage := nil; + fPageSize := aPageSize; +end; + +//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +destructor TutlPagedDataFiFo.Destroy; +begin + Clear; + inherited Destroy; +end; + +end. diff --git a/projects/triangle/triangle.lps b/projects/triangle/triangle.lps index be9570a..83dcd1f 100644 --- a/projects/triangle/triangle.lps +++ b/projects/triangle/triangle.lps @@ -4,7 +4,7 @@ - + @@ -18,29 +18,26 @@ - - - + + + - - - - - + + + - - - - + + + @@ -55,210 +52,219 @@ - - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - - + + - - + + - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/utils/uvkuInstance.pas b/projects/utils/uvkuInstance.pas index 74ffe7d..78f9e4f 100644 --- a/projects/utils/uvkuInstance.pas +++ b/projects/utils/uvkuInstance.pas @@ -95,6 +95,7 @@ begin e := vkCreateInstance(aCreateInfo, fAllocCallbacks, @fHandle); if (e < VK_SUCCESS) then raise TvkuErrorException.Create('unable to create vulkan instance', e); + LoadVulkanCommands(fHandle); end; /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////