Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

481 Zeilen
27 KiB

  1. unit uvkuUtils;
  2. {$mode objfpc}{$H+}
  3. interface
  4. uses
  5. Classes, SysUtils,
  6. Vulkan;
  7. type
  8. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  9. TvkuException = class(Exception);
  10. TvkuErrorException = class(TvkuException)
  11. private
  12. fError: TVkResult;
  13. public
  14. property Error: TVkResult read fError;
  15. constructor Create(const msg: string; const aError: TVkResult);
  16. end;
  17. TvkuInvalidFuncPtrException = class(TvkuException)
  18. private
  19. fExtensionName: String;
  20. fFunctionName: String;
  21. fExtentionName: String;
  22. public
  23. property FunctionName: String read fFunctionName;
  24. property ExtensionName: String read fExtensionName;
  25. constructor Create(const aFunctionName: String; const aExtensionName: String = '');
  26. end;
  27. function vkuMakeString(const aFeatures: TVkPhysicalDeviceFeatures; const aSeperator: String = sLineBreak): String;
  28. function vkuMakeString(const aProperties: TVkPhysicalDeviceProperties; const aPrintLimits, aPrintSparseProps: Boolean): String;
  29. function vkuMakeString(const aMemoryProperties: TVkPhysicalDeviceMemoryProperties): String;
  30. implementation
  31. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  32. //TvkuErrorException//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  33. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  34. constructor TvkuErrorException.Create(const msg: string; const aError: TVkResult);
  35. begin
  36. inherited Create(msg);
  37. fError := aError;
  38. end;
  39. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  40. //TvkuInvalidFuncPtrException////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  41. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  42. constructor TvkuInvalidFuncPtrException.Create(const aFunctionName: String; const aExtensionName: String);
  43. var s: String;
  44. begin
  45. fFunctionName := aFunctionName;
  46. fExtensionName := aExtensionName;
  47. s := 'did you load the vulkan core commands?';
  48. if (aExtensionName <> '') then
  49. s := 'did you enabled/load the ' + fExtensionName + ' extension?';
  50. inherited Create('invalid function pointer: ' + fFunctionName + '; ' + s);
  51. end;
  52. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  53. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  54. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  55. function vkuMakeString(const aFeatures: TVkPhysicalDeviceFeatures; const aSeperator: String): String;
  56. procedure AddToResult(const b: VkBool32; const aName: String);
  57. begin
  58. if (b = 0) then
  59. exit;
  60. if (result <> '') then
  61. result := result + aSeperator;
  62. result := result + aName;
  63. end;
  64. begin
  65. result := '';
  66. AddToResult(aFeatures.robustBufferAccess, 'RobustBufferAccess');
  67. AddToResult(aFeatures.fullDrawIndexUint32, 'FullDrawIndexUint32');
  68. AddToResult(aFeatures.imageCubeArray, 'ImageCubeArray');
  69. AddToResult(aFeatures.independentBlend, 'IndependentBlend');
  70. AddToResult(aFeatures.geometryShader, 'GeometryShader');
  71. AddToResult(aFeatures.tessellationShader, 'TessellationShader');
  72. AddToResult(aFeatures.sampleRateShading, 'SampleRateShading');
  73. AddToResult(aFeatures.dualSrcBlend, 'DualSrcBlend');
  74. AddToResult(aFeatures.logicOp, 'LogicOp');
  75. AddToResult(aFeatures.multiDrawIndirect, 'MultiDrawIndirect');
  76. AddToResult(aFeatures.drawIndirectFirstInstance, 'DrawIndirectFirstInstance');
  77. AddToResult(aFeatures.depthClamp, 'DepthClamp');
  78. AddToResult(aFeatures.depthBiasClamp, 'DepthBiasClamp');
  79. AddToResult(aFeatures.fillModeNonSolid, 'FillModeNonSolid');
  80. AddToResult(aFeatures.depthBounds, 'DepthBounds');
  81. AddToResult(aFeatures.wideLines, 'WideLines');
  82. AddToResult(aFeatures.largePoints, 'LargePoints');
  83. AddToResult(aFeatures.alphaToOne, 'AlphaToOne');
  84. AddToResult(aFeatures.multiViewport, 'MultiViewport');
  85. AddToResult(aFeatures.samplerAnisotropy, 'SamplerAnisotropy');
  86. AddToResult(aFeatures.textureCompressionETC2, 'TextureCompressionETC2');
  87. AddToResult(aFeatures.textureCompressionASTC_LDR, 'TextureCompressionASTC_LDR');
  88. AddToResult(aFeatures.textureCompressionBC, 'TextureCompressionBC');
  89. AddToResult(aFeatures.occlusionQueryPrecise, 'OcclusionQueryPrecise');
  90. AddToResult(aFeatures.pipelineStatisticsQuery, 'PipelineStatisticsQuery');
  91. AddToResult(aFeatures.vertexPipelineStoresAndAtomics, 'VertexPipelineStoresAndAtomics');
  92. AddToResult(aFeatures.fragmentStoresAndAtomics, 'FragmentStoresAndAtomics');
  93. AddToResult(aFeatures.shaderTessellationAndGeometryPointSize, 'ShaderTessellationAndGeometryPointSize');
  94. AddToResult(aFeatures.shaderImageGatherExtended, 'ShaderImageGatherExtended');
  95. AddToResult(aFeatures.shaderStorageImageExtendedFormats, 'ShaderStorageImageExtendedFormats');
  96. AddToResult(aFeatures.shaderStorageImageMultisample, 'ShaderStorageImageMultisample');
  97. AddToResult(aFeatures.shaderStorageImageReadWithoutFormat, 'ShaderStorageImageReadWithoutFormat');
  98. AddToResult(aFeatures.shaderStorageImageWriteWithoutFormat, 'ShaderStorageImageWriteWithoutFormat');
  99. AddToResult(aFeatures.shaderUniformBufferArrayDynamicIndexing, 'ShaderUniformBufferArrayDynamicIndexing');
  100. AddToResult(aFeatures.shaderSampledImageArrayDynamicIndexing, 'ShaderSampledImageArrayDynamicIndexing');
  101. AddToResult(aFeatures.shaderStorageBufferArrayDynamicIndexing, 'ShaderStorageBufferArrayDynamicIndexing');
  102. AddToResult(aFeatures.shaderStorageImageArrayDynamicIndexing, 'ShaderStorageImageArrayDynamicIndexing');
  103. AddToResult(aFeatures.shaderClipDistance, 'ShaderClipDistance');
  104. AddToResult(aFeatures.shaderCullDistance, 'ShaderCullDistance');
  105. AddToResult(aFeatures.shaderFloat64, 'ShaderFloat64');
  106. AddToResult(aFeatures.shaderInt64, 'ShaderInt64');
  107. AddToResult(aFeatures.shaderInt16, 'ShaderInt16');
  108. AddToResult(aFeatures.shaderResourceResidency, 'ShaderResourceResidency');
  109. AddToResult(aFeatures.shaderResourceMinLod, 'ShaderResourceMinLod');
  110. AddToResult(aFeatures.sparseBinding, 'SparseBinding');
  111. AddToResult(aFeatures.sparseResidencyBuffer, 'SparseResidencyBuffer');
  112. AddToResult(aFeatures.sparseResidencyImage2D, 'SparseResidencyImage2D');
  113. AddToResult(aFeatures.sparseResidencyImage3D, 'SparseResidencyImage3D');
  114. AddToResult(aFeatures.sparseResidency2Samples, 'SparseResidency2Samples');
  115. AddToResult(aFeatures.sparseResidency4Samples, 'SparseResidency4Samples');
  116. AddToResult(aFeatures.sparseResidency8Samples, 'SparseResidency8Samples');
  117. AddToResult(aFeatures.sparseResidency16Samples, 'SparseResidency16Samples');
  118. AddToResult(aFeatures.sparseResidencyAliased, 'SparseResidencyAliased');
  119. AddToResult(aFeatures.variableMultisampleRate, 'VariableMultisampleRate');
  120. AddToResult(aFeatures.inheritedQueries, 'InheritedQueries');
  121. end;
  122. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  123. function vkuMakeString(const aProperties: TVkPhysicalDeviceProperties; const aPrintLimits,
  124. aPrintSparseProps: Boolean): String;
  125. function UUIDtoStr: String;
  126. var i: Integer;
  127. begin
  128. result := '';
  129. for i := low(aProperties.pipelineCacheUUID) to High(aProperties.pipelineCacheUUID) do begin
  130. if (result <> '') then
  131. result := result + ':';
  132. result := result + IntToHex(aProperties.pipelineCacheUUID[i], 2);
  133. end;
  134. end;
  135. function toString(const i: Int64): String;
  136. begin
  137. result := IntToStr(i);
  138. end;
  139. function toString(const e: Extended): String;
  140. begin
  141. result := Format('%.3f', [e]);
  142. end;
  143. function toString(const arr: array of VkUint32): String;
  144. var i: Integer;
  145. begin
  146. result := '';
  147. for i := low(arr) to high(arr) do begin
  148. if (i <> low(arr)) then
  149. result := result + '; ';
  150. result := result + toString(arr[i]);
  151. end;
  152. end;
  153. function toString(const arr: array of VkFloat): String;
  154. var i: Integer;
  155. begin
  156. result := '';
  157. for i := low(arr) to high(arr) do begin
  158. if (i <> low(arr)) then
  159. result := result + '; ';
  160. result := result + toString(arr[i]);
  161. end;
  162. end;
  163. function toString(const aType: TVkPhysicalDeviceType): String;
  164. begin
  165. case aType of
  166. VK_PHYSICAL_DEVICE_TYPE_OTHER: result := 'Other';
  167. VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU: result := 'IntegratedGPU';
  168. VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU: result := 'DiscreteGPU';
  169. VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU: result := 'VirtualGPU';
  170. VK_PHYSICAL_DEVICE_TYPE_CPU: result := 'CPU';
  171. else
  172. result := 'Unknown';
  173. end;
  174. end;
  175. function toString(const aChar: PVkChar): String;
  176. begin
  177. result := String(aChar);
  178. end;
  179. begin
  180. result := Format(
  181. 'ApiVersion: %x (v%d.%d.%d)' + sLineBreak +
  182. 'DriverVersion: %s' + sLineBreak +
  183. 'VendorID: %s' + sLineBreak +
  184. 'DeviceID: %s' + sLineBreak +
  185. 'DeviceType: %s' + sLineBreak +
  186. 'deviceName: %s' + sLineBreak +
  187. 'PipelineCacheUUID: %s' + sLineBreak
  188. ,[
  189. aProperties.apiVersion, vkGetVersionMajor(aProperties.apiVersion), vkGetVersionMinor(aProperties.apiVersion), vkgetVersionPatch(aProperties.apiVersion),
  190. toString(aProperties.driverVersion),
  191. toString(aProperties.vendorID),
  192. toString(aProperties.deviceID),
  193. toString(aProperties.deviceType),
  194. toString(@aProperties.deviceName[0]),
  195. UUIDtoStr
  196. ]);
  197. if aPrintLimits then begin
  198. result := result + Format(
  199. 'Limits:' + sLineBreak +
  200. ' MaxImageDimension1D: %s' + sLineBreak +
  201. ' MaxImageDimension2D: %s' + sLineBreak +
  202. ' MaxImageDimension3D: %s' + sLineBreak +
  203. ' MaxImageDimensionCube: %s' + sLineBreak +
  204. ' MaxImageArrayLayers: %s' + sLineBreak +
  205. ' MaxTexelBufferElements: %s' + sLineBreak +
  206. ' MaxUniformBufferRange: %s' + sLineBreak +
  207. ' MaxStorageBufferRange: %s' + sLineBreak +
  208. ' MaxPushConstantsSize: %s' + sLineBreak +
  209. ' MaxMemoryAllocationCount: %s' + sLineBreak +
  210. ' MaxSamplerAllocationCount: %s' + sLineBreak +
  211. ' BufferImageGranularity: %s' + sLineBreak +
  212. ' SparseAddressSpaceSize: %s' + sLineBreak +
  213. ' MaxBoundDescriptorSets: %s' + sLineBreak +
  214. ' MaxPerStageDescriptorSamplers: %s' + sLineBreak +
  215. ' MaxPerStageDescriptorUniformBuffers: %s' + sLineBreak +
  216. ' MaxPerStageDescriptorStorageBuffers: %s' + sLineBreak +
  217. ' MaxPerStageDescriptorSampledImages: %s' + sLineBreak +
  218. ' MaxPerStageDescriptorStorageImages: %s' + sLineBreak +
  219. ' MaxPerStageDescriptorInputAttachments: %s' + sLineBreak +
  220. ' MaxPerStageResources: %s' + sLineBreak +
  221. ' MaxDescriptorSetSamplers: %s' + sLineBreak +
  222. ' MaxDescriptorSetUniformBuffers: %s' + sLineBreak +
  223. ' MaxDescriptorSetUniformBuffersDynamic: %s' + sLineBreak +
  224. ' MaxDescriptorSetStorageBuffers: %s' + sLineBreak +
  225. ' MaxDescriptorSetStorageBuffersDynamic: %s' + sLineBreak +
  226. ' MaxDescriptorSetSampledImages: %s' + sLineBreak +
  227. ' MaxDescriptorSetStorageImages: %s' + sLineBreak +
  228. ' MaxDescriptorSetInputAttachments: %s' + sLineBreak +
  229. ' MaxVertexInputAttributes: %s' + sLineBreak +
  230. ' MaxVertexInputBindings: %s' + sLineBreak +
  231. ' MaxVertexInputAttributeOffset: %s' + sLineBreak +
  232. ' MaxVertexInputBindingStride: %s' + sLineBreak +
  233. ' MaxVertexOutputComponents: %s' + sLineBreak +
  234. ' MaxTessellationGenerationLevel: %s' + sLineBreak +
  235. ' MaxTessellationPatchSize: %s' + sLineBreak +
  236. ' MaxTessellationControlPerVertexInputComponents: %s' + sLineBreak +
  237. ' MaxTessellationControlPerVertexOutputComponents: %s' + sLineBreak +
  238. ' MaxTessellationControlPerPatchOutputComponents: %s' + sLineBreak +
  239. ' MaxTessellationControlTotalOutputComponents: %s' + sLineBreak +
  240. ' MaxTessellationEvaluationInputComponents: %s' + sLineBreak +
  241. ' MaxTessellationEvaluationOutputComponents: %s' + sLineBreak +
  242. ' MaxGeometryShaderInvocations: %s' + sLineBreak +
  243. ' MaxGeometryInputComponents: %s' + sLineBreak +
  244. ' MaxGeometryOutputComponents: %s' + sLineBreak +
  245. ' MaxGeometryOutputVertices: %s' + sLineBreak +
  246. ' MaxGeometryTotalOutputComponents: %s' + sLineBreak +
  247. ' MaxFragmentInputComponents: %s' + sLineBreak +
  248. ' MaxFragmentOutputAttachments: %s' + sLineBreak +
  249. ' MaxFragmentDualSrcAttachments: %s' + sLineBreak +
  250. ' MaxFragmentCombinedOutputResources: %s' + sLineBreak +
  251. ' MaxComputeSharedMemorySize: %s' + sLineBreak +
  252. ' MaxComputeWorkGroupCount: %s' + sLineBreak +
  253. ' MaxComputeWorkGroupInvocations: %s' + sLineBreak +
  254. ' MaxComputeWorkGroupSize: %s' + sLineBreak +
  255. ' SubPixelPrecisionBits: %s' + sLineBreak +
  256. ' SubTexelPrecisionBits: %s' + sLineBreak +
  257. ' MipmapPrecisionBits: %s' + sLineBreak +
  258. ' MaxDrawIndexedIndexValue: %s' + sLineBreak +
  259. ' MaxDrawIndirectCount: %s' + sLineBreak +
  260. ' MaxSamplerLodBias: %s' + sLineBreak +
  261. ' MaxSamplerAnisotropy: %s' + sLineBreak +
  262. ' MaxViewports: %s' + sLineBreak +
  263. ' MaxViewportDimensions: %s' + sLineBreak +
  264. ' ViewportBoundsRange: %s' + sLineBreak +
  265. ' ViewportSubPixelBits: %s' + sLineBreak +
  266. ' MinMemoryMapAlignment: %s' + sLineBreak +
  267. ' MinTexelBufferOffsetAlignment: %s' + sLineBreak +
  268. ' MinUniformBufferOffsetAlignment: %s' + sLineBreak +
  269. ' MinStorageBufferOffsetAlignment: %s' + sLineBreak +
  270. ' MinTexelOffset: %s' + sLineBreak +
  271. ' MaxTexelOffset: %s' + sLineBreak +
  272. ' MinTexelGatherOffset: %s' + sLineBreak +
  273. ' MaxTexelGatherOffset: %s' + sLineBreak +
  274. ' MinInterpolationOffset: %s' + sLineBreak +
  275. ' MaxInterpolationOffset: %s' + sLineBreak +
  276. ' SubPixelInterpolationOffsetBits: %s' + sLineBreak +
  277. ' MaxFramebufferWidth: %s' + sLineBreak +
  278. ' MaxFramebufferHeight: %s' + sLineBreak +
  279. ' MaxFramebufferLayers: %s' + sLineBreak +
  280. ' FramebufferColorSampleCounts: %s' + sLineBreak +
  281. ' FramebufferDepthSampleCounts: %s' + sLineBreak +
  282. ' FramebufferStencilSampleCounts: %s' + sLineBreak +
  283. ' FramebufferNoAttachmentsSampleCounts: %s' + sLineBreak +
  284. ' MaxColorAttachments: %s' + sLineBreak +
  285. ' SampledImageColorSampleCounts: %s' + sLineBreak +
  286. ' SampledImageIntegerSampleCounts: %s' + sLineBreak +
  287. ' SampledImageDepthSampleCounts: %s' + sLineBreak +
  288. ' SampledImageStencilSampleCounts: %s' + sLineBreak +
  289. ' StorageImageSampleCounts: %s' + sLineBreak +
  290. ' MaxSampleMaskWords: %s' + sLineBreak +
  291. ' TimestampComputeAndGraphics: %s' + sLineBreak +
  292. ' TimestampPeriod: %s' + sLineBreak +
  293. ' MaxClipDistances: %s' + sLineBreak +
  294. ' MaxCullDistances: %s' + sLineBreak +
  295. ' MaxCombinedClipAndCullDistances: %s' + sLineBreak +
  296. ' DiscreteQueuePriorities: %s' + sLineBreak +
  297. ' PointSizeRange: %s' + sLineBreak +
  298. ' LineWidthRange: %s' + sLineBreak +
  299. ' PointSizeGranularity: %s' + sLineBreak +
  300. ' LineWidthGranularity: %s' + sLineBreak +
  301. ' StrictLines: %s' + sLineBreak +
  302. ' StandardSampleLocations: %s' + sLineBreak +
  303. ' OptimalBufferCopyOffsetAlignment: %s' + sLineBreak +
  304. ' OptimalBufferCopyRowPitchAlignment: %s' + sLineBreak +
  305. ' NonCoherentAtomSize: %s' + sLineBreak
  306. ,[
  307. toString(aProperties.limits.maxImageDimension1D),
  308. toString(aProperties.limits.maxImageDimension2D),
  309. toString(aProperties.limits.maxImageDimension3D),
  310. toString(aProperties.limits.maxImageDimensionCube),
  311. toString(aProperties.limits.maxImageArrayLayers),
  312. toString(aProperties.limits.maxTexelBufferElements),
  313. toString(aProperties.limits.maxUniformBufferRange),
  314. toString(aProperties.limits.maxStorageBufferRange),
  315. toString(aProperties.limits.maxPushConstantsSize),
  316. toString(aProperties.limits.maxMemoryAllocationCount),
  317. toString(aProperties.limits.maxSamplerAllocationCount),
  318. toString(aProperties.limits.bufferImageGranularity),
  319. toString(aProperties.limits.sparseAddressSpaceSize),
  320. toString(aProperties.limits.maxBoundDescriptorSets),
  321. toString(aProperties.limits.maxPerStageDescriptorSamplers),
  322. toString(aProperties.limits.maxPerStageDescriptorUniformBuffers),
  323. toString(aProperties.limits.maxPerStageDescriptorStorageBuffers),
  324. toString(aProperties.limits.maxPerStageDescriptorSampledImages),
  325. toString(aProperties.limits.maxPerStageDescriptorStorageImages),
  326. toString(aProperties.limits.maxPerStageDescriptorInputAttachments),
  327. toString(aProperties.limits.maxPerStageResources),
  328. toString(aProperties.limits.maxDescriptorSetSamplers),
  329. toString(aProperties.limits.maxDescriptorSetUniformBuffers),
  330. toString(aProperties.limits.maxDescriptorSetUniformBuffersDynamic),
  331. toString(aProperties.limits.maxDescriptorSetStorageBuffers),
  332. toString(aProperties.limits.maxDescriptorSetStorageBuffersDynamic),
  333. toString(aProperties.limits.maxDescriptorSetSampledImages),
  334. toString(aProperties.limits.maxDescriptorSetStorageImages),
  335. toString(aProperties.limits.maxDescriptorSetInputAttachments),
  336. toString(aProperties.limits.maxVertexInputAttributes),
  337. toString(aProperties.limits.maxVertexInputBindings),
  338. toString(aProperties.limits.maxVertexInputAttributeOffset),
  339. toString(aProperties.limits.maxVertexInputBindingStride),
  340. toString(aProperties.limits.maxVertexOutputComponents),
  341. toString(aProperties.limits.maxTessellationGenerationLevel),
  342. toString(aProperties.limits.maxTessellationPatchSize),
  343. toString(aProperties.limits.maxTessellationControlPerVertexInputComponents),
  344. toString(aProperties.limits.maxTessellationControlPerVertexOutputComponents),
  345. toString(aProperties.limits.maxTessellationControlPerPatchOutputComponents),
  346. toString(aProperties.limits.maxTessellationControlTotalOutputComponents),
  347. toString(aProperties.limits.maxTessellationEvaluationInputComponents),
  348. toString(aProperties.limits.maxTessellationEvaluationOutputComponents),
  349. toString(aProperties.limits.maxGeometryShaderInvocations),
  350. toString(aProperties.limits.maxGeometryInputComponents),
  351. toString(aProperties.limits.maxGeometryOutputComponents),
  352. toString(aProperties.limits.maxGeometryOutputVertices),
  353. toString(aProperties.limits.maxGeometryTotalOutputComponents),
  354. toString(aProperties.limits.maxFragmentInputComponents),
  355. toString(aProperties.limits.maxFragmentOutputAttachments),
  356. toString(aProperties.limits.maxFragmentDualSrcAttachments),
  357. toString(aProperties.limits.maxFragmentCombinedOutputResources),
  358. toString(aProperties.limits.maxComputeSharedMemorySize),
  359. toString(aProperties.limits.maxComputeWorkGroupCount),
  360. toString(aProperties.limits.maxComputeWorkGroupInvocations),
  361. toString(aProperties.limits.maxComputeWorkGroupSize),
  362. toString(aProperties.limits.subPixelPrecisionBits),
  363. toString(aProperties.limits.subTexelPrecisionBits),
  364. toString(aProperties.limits.mipmapPrecisionBits),
  365. toString(aProperties.limits.maxDrawIndexedIndexValue),
  366. toString(aProperties.limits.maxDrawIndirectCount),
  367. toString(aProperties.limits.maxSamplerLodBias),
  368. toString(aProperties.limits.maxSamplerAnisotropy),
  369. toString(aProperties.limits.maxViewports),
  370. toString(aProperties.limits.maxViewportDimensions),
  371. toString(aProperties.limits.viewportBoundsRange),
  372. toString(aProperties.limits.viewportSubPixelBits),
  373. toString(aProperties.limits.minMemoryMapAlignment),
  374. toString(aProperties.limits.minTexelBufferOffsetAlignment),
  375. toString(aProperties.limits.minUniformBufferOffsetAlignment),
  376. toString(aProperties.limits.minStorageBufferOffsetAlignment),
  377. toString(aProperties.limits.minTexelOffset),
  378. toString(aProperties.limits.maxTexelOffset),
  379. toString(aProperties.limits.minTexelGatherOffset),
  380. toString(aProperties.limits.maxTexelGatherOffset),
  381. toString(aProperties.limits.minInterpolationOffset),
  382. toString(aProperties.limits.maxInterpolationOffset),
  383. toString(aProperties.limits.subPixelInterpolationOffsetBits),
  384. toString(aProperties.limits.maxFramebufferWidth),
  385. toString(aProperties.limits.maxFramebufferHeight),
  386. toString(aProperties.limits.maxFramebufferLayers),
  387. toString(PVkUint32(@aProperties.limits.framebufferColorSampleCounts)^),
  388. toString(PVkUint32(@aProperties.limits.framebufferDepthSampleCounts)^),
  389. toString(PVkUint32(@aProperties.limits.framebufferStencilSampleCounts)^),
  390. toString(PVkUint32(@aProperties.limits.framebufferNoAttachmentsSampleCounts)^),
  391. toString(aProperties.limits.maxColorAttachments),
  392. toString(PVkUint32(@aProperties.limits.sampledImageColorSampleCounts)^),
  393. toString(PVkUint32(@aProperties.limits.sampledImageIntegerSampleCounts)^),
  394. toString(PVkUint32(@aProperties.limits.sampledImageDepthSampleCounts)^),
  395. toString(PVkUint32(@aProperties.limits.sampledImageStencilSampleCounts)^),
  396. toString(PVkUint32(@aProperties.limits.storageImageSampleCounts)^),
  397. toString(aProperties.limits.maxSampleMaskWords),
  398. toString(aProperties.limits.timestampComputeAndGraphics),
  399. toString(aProperties.limits.timestampPeriod),
  400. toString(aProperties.limits.maxClipDistances),
  401. toString(aProperties.limits.maxCullDistances),
  402. toString(aProperties.limits.maxCombinedClipAndCullDistances),
  403. toString(aProperties.limits.discreteQueuePriorities),
  404. toString(aProperties.limits.pointSizeRange),
  405. toString(aProperties.limits.lineWidthRange),
  406. toString(aProperties.limits.pointSizeGranularity),
  407. toString(aProperties.limits.lineWidthGranularity),
  408. toString(aProperties.limits.strictLines),
  409. toString(aProperties.limits.standardSampleLocations),
  410. toString(aProperties.limits.optimalBufferCopyOffsetAlignment),
  411. toString(aProperties.limits.optimalBufferCopyRowPitchAlignment),
  412. toString(aProperties.limits.nonCoherentAtomSize)
  413. ]);
  414. end;
  415. if aPrintSparseProps then begin
  416. result := result + Format(
  417. 'SparseProperties:' + sLineBreak +
  418. ' ResidencyStandard2DBlockShape: %s' + sLineBreak +
  419. ' ResidencyStandard2DMultisampleBlockShape: %s' + sLineBreak +
  420. ' ResidencyStandard3DBlockShape: %s' + sLineBreak +
  421. ' ResidencyAlignedMipSize: %s' + sLineBreak +
  422. ' ResidencyNonResidentStrict: %s' + sLineBreak,
  423. [
  424. toString(aProperties.sparseProperties.residencyStandard2DBlockShape),
  425. toString(aProperties.sparseProperties.residencyStandard2DMultisampleBlockShape),
  426. toString(aProperties.sparseProperties.residencyStandard3DBlockShape),
  427. toString(aProperties.sparseProperties.residencyAlignedMipSize),
  428. toString(aProperties.sparseProperties.residencyNonResidentStrict)
  429. ]);
  430. end;
  431. end;
  432. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  433. function vkuMakeString(const aMemoryProperties: TVkPhysicalDeviceMemoryProperties): String;
  434. var i: Integer;
  435. begin
  436. result := 'Types:' + sLineBreak;
  437. for i := 0 to aMemoryProperties.memoryTypeCount-1 do begin
  438. result := result + Format(
  439. ' Type %d:' + sLineBreak +
  440. ' PropertyFlags: 0x%.16X' + sLineBreak +
  441. ' HeapIndex: %d (0x%2:.16X)' + sLineBreak,
  442. [i, PVkUint32(@aMemoryProperties.memoryTypes[i].propertyFlags)^, aMemoryProperties.memoryTypes[i].heapIndex]);
  443. end;
  444. result := result + 'Heaps:' + sLineBreak;
  445. for i := 0 to aMemoryProperties.memoryHeapCount-1 do begin
  446. result := result + Format(
  447. ' Heap %d:' + sLineBreak +
  448. ' Size: %d (0x%1:.16X)' + sLineBreak +
  449. ' Flags: 0x%.16X' + sLineBreak,
  450. [i, aMemoryProperties.memoryHeaps[i].size, PVkUint32(@aMemoryProperties.memoryHeaps[i].flags)^]);
  451. end;
  452. end;
  453. end.