|
- unit uvkuPhysicalDevice;
-
- {$mode objfpc}{$H+}
-
- interface
-
- uses
- Classes, SysUtils,
- Vulkan;
-
- type
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- TVkSparseImageFormatPropertiesArr = array of TVkSparseImageFormatProperties;
- TvkuPhysicalDevice = class(TObject)
- private type
- TPropertyFlag = (
- pfFeatures,
- pfProperties,
- pfMemoryProperties
- );
- TPropertyFlags = set of TPropertyFlag;
- private
- fHandle: VkPhysicalDevice;
- fCached: TPropertyFlags;
-
- fFeatures: TVkPhysicalDeviceFeatures;
- fProperties: TVkPhysicalDeviceProperties;
- fMemoryProperties: TVkPhysicalDeviceMemoryProperties;
- fFormatProperties: array[TVkFormat] of PVkFormatProperties;
-
- function GetFeatures: TVkPhysicalDeviceFeatures;
- function GetProperties: TVkPhysicalDeviceProperties;
- function GetMemoryProperties: TVkPhysicalDeviceMemoryProperties;
- function GetQueueFamilyPropertyCount: Integer;
- function GetQueueFamilyProperties(const aIndex: Integer): TVkQueueFamilyProperties;
- function GetFormatProperties(const aFormat: TVkFormat): TVkFormatProperties;
- public
- property Handle: VkPhysicalDevice read fHandle;
- property Features: TVkPhysicalDeviceFeatures read GetFeatures;
- property Properties: TVkPhysicalDeviceProperties read GetProperties;
- property MemoryProperties: TVkPhysicalDeviceMemoryProperties read GetMemoryProperties;
-
- property QueueFamilyPropertyCount: Integer read GetQueueFamilyPropertyCount;
- property QueueFamilyProperties[const aIndex: Integer]: TVkQueueFamilyProperties read GetQueueFamilyProperties;
-
- property FormatProperties[const aFormat: TVkFormat]: TVkFormatProperties read GetFormatProperties;
-
- function GetImageFormatProperties(
- const aFormat: TVkFormat;
- const aImageType: TVkImageType;
- const aTiling: TVkImageTiling;
- const aUsage: VkImageUsageFlags;
- const aFlags: VkImageCreateFlags): TVkImageFormatProperties;
-
- function GetSparseImageFormatProperties(
- const aFormat: TVkFormat;
- const aImageType: TVkImageType;
- const aSamples: TVkSampleCountFlagBits;
- const aUsage: VkImageUsageFlags;
- const aTiling: TVkImageTiling): TVkSparseImageFormatPropertiesArr;
-
- constructor Create(const aHandle: VkPhysicalDevice);
- end;
-
- implementation
-
- uses
- uvkuUtils;
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- //TvkuPhysicalDevice/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function TvkuPhysicalDevice.GetFeatures: TVkPhysicalDeviceFeatures;
- begin
- if not (pfFeatures in fCached) then begin
- vkGetPhysicalDeviceFeatures(fHandle, @fFeatures);
- Include(fCached, pfFeatures);
- end;
- result := fFeatures;
- end;
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function TvkuPhysicalDevice.GetProperties: TVkPhysicalDeviceProperties;
- begin
- if not (pfProperties in fCached) then begin
- vkGetPhysicalDeviceProperties(fHandle, @fProperties);
- Include(fCached, pfProperties);
- end;
- result := fProperties;
- end;
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function TvkuPhysicalDevice.GetMemoryProperties: TVkPhysicalDeviceMemoryProperties;
- begin
- if not (pfMemoryProperties in fCached) then begin
- vkGetPhysicalDeviceMemoryProperties(fHandle, @fMemoryProperties);
- Include(fCached, pfMemoryProperties);
- end;
- result := fMemoryProperties;
- end;
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function TvkuPhysicalDevice.GetQueueFamilyPropertyCount: Integer;
- begin
-
- end;
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function TvkuPhysicalDevice.GetQueueFamilyProperties(const aIndex: Integer): TVkQueueFamilyProperties;
- begin
-
- end;
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function TvkuPhysicalDevice.GetFormatProperties(const aFormat: TVkFormat): TVkFormatProperties;
- begin
-
- end;
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function TvkuPhysicalDevice.GetImageFormatProperties(const aFormat: TVkFormat; const aImageType: TVkImageType;
- const aTiling: TVkImageTiling; const aUsage: VkImageUsageFlags; const aFlags: VkImageCreateFlags): TVkImageFormatProperties;
- begin
-
- end;
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- function TvkuPhysicalDevice.GetSparseImageFormatProperties(const aFormat: TVkFormat; const aImageType: TVkImageType;
- const aSamples: TVkSampleCountFlagBits; const aUsage: VkImageUsageFlags; const aTiling: TVkImageTiling): TVkSparseImageFormatPropertiesArr;
- begin
-
- end;
-
- /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- constructor TvkuPhysicalDevice.Create(const aHandle: VkPhysicalDevice);
- begin
- if not Assigned(aHandle) then
- raise TvkuException.Create('invalid physical device handle');
- inherited Create;
- fHandle := aHandle;
- end;
-
- end.
|