From 134337d7fe8813a041fd66dbde11389ebd7dd874 Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Thu, 11 Jul 2024 16:01:08 -0500 Subject: [PATCH 1/7] cmake: Add required to necessary dependencies The Vulkan-Headers and volk dependencies are always required, while the Vulkan-Loader dependency is only necessary on APPLE hardware or when testing is enabled. --- CMakeLists.txt | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d770ca57b..dfa30c469 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,6 +39,11 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON) option(BUILD_CUBE "Build cube" ON) option(BUILD_VULKANINFO "Build vulkaninfo" ON) option(BUILD_ICD "Build icd" ON) +option(BUILD_TESTS "Build the tests") +option(BUILD_WERROR "Treat compiler warnings as errors") +# NOTE: Our custom code generation target isn't desirable for system package managers or add_subdirectory users. +# So this target needs to be off by default to avoid obtuse build errors or patches. +option(TOOLS_CODEGEN "Enable helper codegen target") option(ENABLE_ADDRESS_SANITIZER "Use address sanitization") if (ENABLE_ADDRESS_SANITIZER) @@ -50,13 +55,14 @@ endif() set_property(GLOBAL PROPERTY USE_FOLDERS ON) -find_package(VulkanHeaders QUIET CONFIG) -find_package(VulkanLoader QUIET CONFIG) -find_package(volk QUIET CONFIG) +find_package(VulkanHeaders REQUIRED QUIET CONFIG) +find_package(volk REQUIRED QUIET CONFIG) +if (APPLE OR BUILD_TESTS) + find_package(VulkanLoader REQUIRED QUIET CONFIG) +endif() include(GNUInstallDirs) -option(BUILD_WERROR "Treat compiler warnings as errors") if (BUILD_WERROR) add_compile_options("$,/WX,-Werror>") endif() @@ -96,9 +102,7 @@ elseif(MSVC) add_compile_options("/w34245") endif() -# NOTE: Our custom code generation target isn't desirable for system package managers or add_subdirectory users. -# So this target needs to be off by default to avoid obtuse build errors or patches. -option(TOOLS_CODEGEN "Enable helper codegen target") + if (TOOLS_CODEGEN) find_package(Python3 REQUIRED QUIET) add_custom_target(tools_codegen @@ -146,7 +150,6 @@ endif() add_subdirectory(windows-runtime-installer) -option(BUILD_TESTS "Build the tests") if(BUILD_TESTS) enable_testing() add_subdirectory(tests) From b3fb29a274b5928160126d62cb12ae492b2f1942 Mon Sep 17 00:00:00 2001 From: Michel Zou Date: Wed, 3 Jul 2024 18:45:01 +0200 Subject: [PATCH 2/7] CMake: Mark dependencies mandatory Closes #959 --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index dfa30c469..d7f464d6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,10 +55,10 @@ endif() set_property(GLOBAL PROPERTY USE_FOLDERS ON) -find_package(VulkanHeaders REQUIRED QUIET CONFIG) -find_package(volk REQUIRED QUIET CONFIG) +find_package(VulkanHeaders QUIET REQUIRED CONFIG) +find_package(volk REQUIRED QUIET REQUIRED CONFIG) if (APPLE OR BUILD_TESTS) - find_package(VulkanLoader REQUIRED QUIET CONFIG) + find_package(VulkanLoader QUIET REQUIRED CONFIG) endif() include(GNUInstallDirs) From 86a848a9a6d63cc6ede04212cc7d8b70ce204055 Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Thu, 11 Jul 2024 16:08:23 -0500 Subject: [PATCH 3/7] cmake: Dont require Loader on ANDROID --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d7f464d6f..5580c471f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) find_package(VulkanHeaders QUIET REQUIRED CONFIG) find_package(volk REQUIRED QUIET REQUIRED CONFIG) -if (APPLE OR BUILD_TESTS) +if ((APPLE OR BUILD_TESTS) AND NOT ANDROID) find_package(VulkanLoader QUIET REQUIRED CONFIG) endif() From d2f31204841ed618d11c3279e5e6a6d816295543 Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Mon, 1 Jul 2024 16:56:54 -0500 Subject: [PATCH 4/7] vulkaninfo: Support 2-call structs in codegen for pNext chains There are now multiple structs in pNext chains which require calling once to get the size, allocating memory, then calling again to get the data. The codegen now handles such functions, although not very cleanly. --- scripts/vulkaninfo_generator.py | 60 ++++++++++++----- vulkaninfo/generated/vulkaninfo.hpp | 99 ++++++++++++++++++++++------- vulkaninfo/outputprinter.h | 14 +++- vulkaninfo/vulkaninfo.cpp | 46 +++++--------- vulkaninfo/vulkaninfo.h | 4 ++ 5 files changed, 150 insertions(+), 73 deletions(-) diff --git a/scripts/vulkaninfo_generator.py b/scripts/vulkaninfo_generator.py index abb9de91c..b5c5f6626 100644 --- a/scripts/vulkaninfo_generator.py +++ b/scripts/vulkaninfo_generator.py @@ -114,8 +114,7 @@ {'extends': 'VkPhysicalDeviceProperties2', 'type': EXTENSION_TYPE_BOTH, 'holder_type': 'VkPhysicalDeviceProperties2', - 'print_iterator': True, - 'exclude': ['VkPhysicalDeviceHostImageCopyPropertiesEXT', 'VkPhysicalDeviceLayeredApiPropertiesListKHR']}), + 'print_iterator': True}), ('phys_device_mem_props2', {'extends': 'VkPhysicalDeviceMemoryProperties2', 'type': EXTENSION_TYPE_DEVICE, @@ -131,7 +130,9 @@ 'type': EXTENSION_TYPE_BOTH, 'holder_type': 'VkSurfaceCapabilities2KHR', 'print_iterator': True, - 'exclude': ['VkSurfacePresentScalingCapabilitiesEXT', 'VkSurfacePresentModeCompatibilityEXT']}), + 'exclude': [# VK_EXT_surface_maintenance1 is difficult to code-gen + 'VkSurfacePresentScalingCapabilitiesEXT', 'VkSurfacePresentModeCompatibilityEXT' + ]}), ('format_properties2', {'extends': 'VkFormatProperties2', 'type': EXTENSION_TYPE_DEVICE, @@ -318,7 +319,7 @@ def endFile(self): out += PrintBitMaskToString(bitmask, flag.name, self) for s in (x for x in self.all_structures if x.name in types_to_gen and x.name not in STRUCT_BLACKLIST): - out += PrintStructure(s, types_to_gen) + out += PrintStructure(s) for key, value in EXTENSION_CATEGORIES.items(): out += PrintChainStruct(key, self.extension_sets[key], self.all_structures, value, self.extTypes, self.aliases, self.vulkan_versions) @@ -600,7 +601,7 @@ def PrintBitMaskToString(bitmask, name, generator): return out -def PrintStructure(struct, types_to_gen): +def PrintStructure(struct): if len(struct.members) == 0: return '' out = '' @@ -655,21 +656,12 @@ def PrintStructure(struct, types_to_gen): out += f' for (uint32_t i = 0; i < {v.arrayLength}; i++) {{ p.PrintElement(obj.{v.name}[i]); }}\n' out += ' }\n' else: # dynamic array length based on other member - out += f' if (obj.{v.arrayLength} == 0) {{\n' + out += f' if (obj.{v.arrayLength} == 0 || obj.{v.name} == nullptr) {{\n' out += f' p.PrintKeyString("{v.name}", "NULL");\n' out += ' } else {\n' out += f' ArrayWrapper arr(p,"{v.name}", obj.{v.arrayLength});\n' out += f' for (uint32_t i = 0; i < obj.{v.arrayLength}; i++) {{\n' - if v.typeID in types_to_gen: - out += f' if (obj.{v.name} != nullptr) {{\n' - out += ' p.SetElementIndex(i);\n' - out += ' if (p.Type() == OutputType::json)\n' - out += f' p.PrintString(std::string("VK_") + {v.typeID}String(obj.{v.name}[i]));\n' - out += ' else\n' - out += f' p.PrintString({v.typeID}String(obj.{v.name}[i]));\n' - out += ' }\n' - else: - out += f' p.PrintElement(obj.{v.name}[i]);\n' + out += f' Dump{v.typeID}(p, std::to_string(i), obj.{v.name}[i]);\n' out += ' }\n' out += ' }\n' elif v.typeID == 'VkBool32': @@ -750,6 +742,10 @@ def PrintChainStruct(listName, structures, all_structures, chain_details, extTyp # members which don't exist. if s.name in ['VkPhysicalDeviceShaderIntegerDotProductFeatures', 'VkPhysicalDeviceHostImageCopyFeaturesEXT']: out += f' char {s.name}_padding[64];\n' + if s.hasLengthmember: + for member in s.members: + if member.lengthMember: + out += f' std::vector<{member.typeID}> {s.name}_{member.name};\n' out += AddGuardFooter(s) out += ' void initialize_chain(' if chain_details.get('type') in [EXTENSION_TYPE_INSTANCE, EXTENSION_TYPE_BOTH]: @@ -919,6 +915,32 @@ def PrintChainStruct(listName, structures, all_structures, chain_details, extTyp out += ' }\n' out += '}\n' + should_print_twocall_func = False + for s in structs_to_print: + if not s.hasLengthmember: + continue + if s.name in STRUCT_BLACKLIST: + continue + should_print_twocall_func = True + + if not should_print_twocall_func: + return out + + out += '\n' + out += f'void prepare_{listName}_twocall_chain_vectors(std::unique_ptr<{listName}_chain>& chain) {{\n' + for s in structs_to_print: + if not s.hasLengthmember: + continue + if s.name in STRUCT_BLACKLIST: + continue + out += AddGuardHeader(s) + for member in s.members: + if member.lengthMember: + out += f' chain->{s.name}_{member.name}.resize(chain->{s.name[2:]}.{member.arrayLength});\n' + out += f' chain->{s.name[2:]}.{member.name} = chain->{s.name}_{member.name}.data();\n' + out += AddGuardFooter(s) + out += '}\n' + return out @@ -1112,12 +1134,18 @@ def __init__(self, name, rootNode, constants, extTypes): self.guard = None self.sTypeName = None self.extendsStruct = rootNode.get('structextends') + self.hasLengthmember = False for node in rootNode.findall('member'): if node.get('values') is not None: self.sTypeName = node.get('values') self.members.append(VulkanVariable(node, constants)) + for member in self.members: + if member.lengthMember: + self.hasLengthmember = True + break + for k, elem in extTypes.items(): if k == self.name: for e in elem: diff --git a/vulkaninfo/generated/vulkaninfo.hpp b/vulkaninfo/generated/vulkaninfo.hpp index d67d84f50..f0cc2f2d3 100644 --- a/vulkaninfo/generated/vulkaninfo.hpp +++ b/vulkaninfo/generated/vulkaninfo.hpp @@ -425,6 +425,22 @@ void DumpVkImageTiling(Printer &p, std::string name, VkImageTiling value) { else p.PrintKeyString(name, VkImageTilingString(value)); } +std::string VkPhysicalDeviceLayeredApiKHRString(VkPhysicalDeviceLayeredApiKHR value) { + switch (value) { + case (VK_PHYSICAL_DEVICE_LAYERED_API_VULKAN_KHR): return "PHYSICAL_DEVICE_LAYERED_API_VULKAN_KHR"; + case (VK_PHYSICAL_DEVICE_LAYERED_API_D3D12_KHR): return "PHYSICAL_DEVICE_LAYERED_API_D3D12_KHR"; + case (VK_PHYSICAL_DEVICE_LAYERED_API_METAL_KHR): return "PHYSICAL_DEVICE_LAYERED_API_METAL_KHR"; + case (VK_PHYSICAL_DEVICE_LAYERED_API_OPENGL_KHR): return "PHYSICAL_DEVICE_LAYERED_API_OPENGL_KHR"; + case (VK_PHYSICAL_DEVICE_LAYERED_API_OPENGLES_KHR): return "PHYSICAL_DEVICE_LAYERED_API_OPENGLES_KHR"; + default: return std::string("UNKNOWN_VkPhysicalDeviceLayeredApiKHR_value") + std::to_string(value); + } +} +void DumpVkPhysicalDeviceLayeredApiKHR(Printer &p, std::string name, VkPhysicalDeviceLayeredApiKHR value) { + if (p.Type() == OutputType::json) + p.PrintKeyString(name, std::string("VK_") + VkPhysicalDeviceLayeredApiKHRString(value)); + else + p.PrintKeyString(name, VkPhysicalDeviceLayeredApiKHRString(value)); +} std::string VkPhysicalDeviceTypeString(VkPhysicalDeviceType value) { switch (value) { case (VK_PHYSICAL_DEVICE_TYPE_OTHER): return "PHYSICAL_DEVICE_TYPE_OTHER"; @@ -1989,33 +2005,21 @@ void DumpVkPhysicalDeviceHostImageCopyPropertiesEXT(Printer &p, std::string name ObjectWrapper object{p, name}; p.SetMinKeyWidth(35); p.PrintKeyValue("copySrcLayoutCount", obj.copySrcLayoutCount); - if (obj.copySrcLayoutCount == 0) { + if (obj.copySrcLayoutCount == 0 || obj.pCopySrcLayouts == nullptr) { p.PrintKeyString("pCopySrcLayouts", "NULL"); } else { ArrayWrapper arr(p,"pCopySrcLayouts", obj.copySrcLayoutCount); for (uint32_t i = 0; i < obj.copySrcLayoutCount; i++) { - if (obj.pCopySrcLayouts != nullptr) { - p.SetElementIndex(i); - if (p.Type() == OutputType::json) - p.PrintString(std::string("VK_") + VkImageLayoutString(obj.pCopySrcLayouts[i])); - else - p.PrintString(VkImageLayoutString(obj.pCopySrcLayouts[i])); - } + DumpVkImageLayout(p, std::to_string(i), obj.pCopySrcLayouts[i]); } } p.PrintKeyValue("copyDstLayoutCount", obj.copyDstLayoutCount); - if (obj.copyDstLayoutCount == 0) { + if (obj.copyDstLayoutCount == 0 || obj.pCopyDstLayouts == nullptr) { p.PrintKeyString("pCopyDstLayouts", "NULL"); } else { ArrayWrapper arr(p,"pCopyDstLayouts", obj.copyDstLayoutCount); for (uint32_t i = 0; i < obj.copyDstLayoutCount; i++) { - if (obj.pCopyDstLayouts != nullptr) { - p.SetElementIndex(i); - if (p.Type() == OutputType::json) - p.PrintString(std::string("VK_") + VkImageLayoutString(obj.pCopyDstLayouts[i])); - else - p.PrintString(VkImageLayoutString(obj.pCopyDstLayouts[i])); - } + DumpVkImageLayout(p, std::to_string(i), obj.pCopyDstLayouts[i]); } } p.PrintKeyValue("optimalTilingLayoutUUID", obj.optimalTilingLayoutUUID); @@ -2093,6 +2097,27 @@ void DumpVkPhysicalDeviceInlineUniformBlockProperties(Printer &p, std::string na p.PrintKeyValue("maxDescriptorSetInlineUniformBlocks", obj.maxDescriptorSetInlineUniformBlocks); p.PrintKeyValue("maxDescriptorSetUpdateAfterBindInlineUniformBlocks", obj.maxDescriptorSetUpdateAfterBindInlineUniformBlocks); } +void DumpVkPhysicalDeviceLayeredApiPropertiesKHR(Printer &p, std::string name, const VkPhysicalDeviceLayeredApiPropertiesKHR &obj) { + ObjectWrapper object{p, name}; + p.SetMinKeyWidth(15); + p.PrintKeyValue("vendorID", obj.vendorID); + p.PrintKeyValue("deviceID", obj.deviceID); + DumpVkPhysicalDeviceLayeredApiKHR(p, "layeredAPI", obj.layeredAPI); + p.PrintKeyString("deviceName", obj.deviceName); +} +void DumpVkPhysicalDeviceLayeredApiPropertiesListKHR(Printer &p, std::string name, const VkPhysicalDeviceLayeredApiPropertiesListKHR &obj) { + ObjectWrapper object{p, name}; + p.SetMinKeyWidth(29); + p.PrintKeyValue("layeredApiCount", obj.layeredApiCount); + if (obj.layeredApiCount == 0 || obj.pLayeredApis == nullptr) { + p.PrintKeyString("pLayeredApis", "NULL"); + } else { + ArrayWrapper arr(p,"pLayeredApis", obj.layeredApiCount); + for (uint32_t i = 0; i < obj.layeredApiCount; i++) { + DumpVkPhysicalDeviceLayeredApiPropertiesKHR(p, std::to_string(i), obj.pLayeredApis[i]); + } + } +} void DumpVkPhysicalDeviceLegacyDitheringFeaturesEXT(Printer &p, std::string name, const VkPhysicalDeviceLegacyDitheringFeaturesEXT &obj) { ObjectWrapper object{p, name}; p.SetMinKeyWidth(15); @@ -3341,18 +3366,12 @@ void DumpVkSurfacePresentModeCompatibilityEXT(Printer &p, std::string name, cons ObjectWrapper object{p, name}; p.SetMinKeyWidth(31); p.PrintKeyValue("presentModeCount", obj.presentModeCount); - if (obj.presentModeCount == 0) { + if (obj.presentModeCount == 0 || obj.pPresentModes == nullptr) { p.PrintKeyString("pPresentModes", "NULL"); } else { ArrayWrapper arr(p,"pPresentModes", obj.presentModeCount); for (uint32_t i = 0; i < obj.presentModeCount; i++) { - if (obj.pPresentModes != nullptr) { - p.SetElementIndex(i); - if (p.Type() == OutputType::json) - p.PrintString(std::string("VK_") + VkPresentModeKHRString(obj.pPresentModes[i])); - else - p.PrintString(VkPresentModeKHRString(obj.pPresentModes[i])); - } + DumpVkPresentModeKHR(p, std::to_string(i), obj.pPresentModes[i]); } } } @@ -3396,8 +3415,13 @@ struct phys_device_props2_chain { VkPhysicalDeviceFragmentShaderBarycentricPropertiesKHR PhysicalDeviceFragmentShaderBarycentricPropertiesKHR{}; VkPhysicalDeviceFragmentShadingRatePropertiesKHR PhysicalDeviceFragmentShadingRatePropertiesKHR{}; VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT PhysicalDeviceGraphicsPipelineLibraryPropertiesEXT{}; + VkPhysicalDeviceHostImageCopyPropertiesEXT PhysicalDeviceHostImageCopyPropertiesEXT{}; + std::vector VkPhysicalDeviceHostImageCopyPropertiesEXT_pCopySrcLayouts; + std::vector VkPhysicalDeviceHostImageCopyPropertiesEXT_pCopyDstLayouts; VkPhysicalDeviceIDProperties PhysicalDeviceIDProperties{}; VkPhysicalDeviceInlineUniformBlockProperties PhysicalDeviceInlineUniformBlockProperties{}; + VkPhysicalDeviceLayeredApiPropertiesListKHR PhysicalDeviceLayeredApiPropertiesListKHR{}; + std::vector VkPhysicalDeviceLayeredApiPropertiesListKHR_pLayeredApis; VkPhysicalDeviceLegacyVertexAttributesPropertiesEXT PhysicalDeviceLegacyVertexAttributesPropertiesEXT{}; VkPhysicalDeviceLineRasterizationPropertiesKHR PhysicalDeviceLineRasterizationPropertiesKHR{}; VkPhysicalDeviceMaintenance3Properties PhysicalDeviceMaintenance3Properties{}; @@ -3460,8 +3484,10 @@ struct phys_device_props2_chain { PhysicalDeviceFragmentShaderBarycentricPropertiesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_PROPERTIES_KHR; PhysicalDeviceFragmentShadingRatePropertiesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_PROPERTIES_KHR; PhysicalDeviceGraphicsPipelineLibraryPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GRAPHICS_PIPELINE_LIBRARY_PROPERTIES_EXT; + PhysicalDeviceHostImageCopyPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES_EXT; PhysicalDeviceIDProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES; PhysicalDeviceInlineUniformBlockProperties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES; + PhysicalDeviceLayeredApiPropertiesListKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LAYERED_API_PROPERTIES_LIST_KHR; PhysicalDeviceLegacyVertexAttributesPropertiesEXT.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LEGACY_VERTEX_ATTRIBUTES_PROPERTIES_EXT; PhysicalDeviceLineRasterizationPropertiesKHR.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_PROPERTIES_KHR; PhysicalDeviceMaintenance3Properties.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES; @@ -3548,6 +3574,8 @@ struct phys_device_props2_chain { chain_members.push_back(reinterpret_cast(&PhysicalDeviceFragmentShadingRatePropertiesKHR)); if (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_GRAPHICS_PIPELINE_LIBRARY_EXTENSION_NAME)) chain_members.push_back(reinterpret_cast(&PhysicalDeviceGraphicsPipelineLibraryPropertiesEXT)); + if (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_HOST_IMAGE_COPY_EXTENSION_NAME)) + chain_members.push_back(reinterpret_cast(&PhysicalDeviceHostImageCopyPropertiesEXT)); if ((inst.CheckExtensionEnabled(VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME) || inst.CheckExtensionEnabled(VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME) || inst.CheckExtensionEnabled(VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME)) @@ -3556,6 +3584,8 @@ struct phys_device_props2_chain { if ((gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_INLINE_UNIFORM_BLOCK_EXTENSION_NAME)) && gpu.api_version < VK_API_VERSION_1_3) chain_members.push_back(reinterpret_cast(&PhysicalDeviceInlineUniformBlockProperties)); + if (gpu.CheckPhysicalDeviceExtensionIncluded(VK_KHR_MAINTENANCE_7_EXTENSION_NAME)) + chain_members.push_back(reinterpret_cast(&PhysicalDeviceLayeredApiPropertiesListKHR)); if (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_LEGACY_VERTEX_ATTRIBUTES_EXTENSION_NAME)) chain_members.push_back(reinterpret_cast(&PhysicalDeviceLegacyVertexAttributesPropertiesEXT)); if (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_LINE_RASTERIZATION_EXTENSION_NAME) @@ -3789,6 +3819,12 @@ void chain_iterator_phys_device_props2(Printer &p, AppInstance &inst, AppGpu &gp DumpVkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT(p, "VkPhysicalDeviceGraphicsPipelineLibraryPropertiesEXT", *props); p.AddNewline(); } + if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES_EXT && + (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_HOST_IMAGE_COPY_EXTENSION_NAME))) { + VkPhysicalDeviceHostImageCopyPropertiesEXT* props = (VkPhysicalDeviceHostImageCopyPropertiesEXT*)structure; + DumpVkPhysicalDeviceHostImageCopyPropertiesEXT(p, "VkPhysicalDeviceHostImageCopyPropertiesEXT", *props); + p.AddNewline(); + } if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES && ((inst.CheckExtensionEnabled(VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME) || inst.CheckExtensionEnabled(VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME) || inst.CheckExtensionEnabled(VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME)) && gpu.api_version < VK_API_VERSION_1_1)) { @@ -3803,6 +3839,12 @@ void chain_iterator_phys_device_props2(Printer &p, AppInstance &inst, AppGpu &gp DumpVkPhysicalDeviceInlineUniformBlockProperties(p, gpu.api_version >= VK_API_VERSION_1_3 ?"VkPhysicalDeviceInlineUniformBlockProperties":"VkPhysicalDeviceInlineUniformBlockPropertiesEXT", *props); p.AddNewline(); } + if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LAYERED_API_PROPERTIES_LIST_KHR && + (gpu.CheckPhysicalDeviceExtensionIncluded(VK_KHR_MAINTENANCE_7_EXTENSION_NAME))) { + VkPhysicalDeviceLayeredApiPropertiesListKHR* props = (VkPhysicalDeviceLayeredApiPropertiesListKHR*)structure; + DumpVkPhysicalDeviceLayeredApiPropertiesListKHR(p, "VkPhysicalDeviceLayeredApiPropertiesListKHR", *props); + p.AddNewline(); + } if (structure->sType == VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LEGACY_VERTEX_ATTRIBUTES_PROPERTIES_EXT && (gpu.CheckPhysicalDeviceExtensionIncluded(VK_EXT_LEGACY_VERTEX_ATTRIBUTES_EXTENSION_NAME))) { VkPhysicalDeviceLegacyVertexAttributesPropertiesEXT* props = (VkPhysicalDeviceLegacyVertexAttributesPropertiesEXT*)structure; @@ -4051,6 +4093,15 @@ void chain_iterator_phys_device_props2(Printer &p, AppInstance &inst, AppGpu &gp place = structure->pNext; } } + +void prepare_phys_device_props2_twocall_chain_vectors(std::unique_ptr& chain) { + chain->VkPhysicalDeviceHostImageCopyPropertiesEXT_pCopySrcLayouts.resize(chain->PhysicalDeviceHostImageCopyPropertiesEXT.copySrcLayoutCount); + chain->PhysicalDeviceHostImageCopyPropertiesEXT.pCopySrcLayouts = chain->VkPhysicalDeviceHostImageCopyPropertiesEXT_pCopySrcLayouts.data(); + chain->VkPhysicalDeviceHostImageCopyPropertiesEXT_pCopyDstLayouts.resize(chain->PhysicalDeviceHostImageCopyPropertiesEXT.copyDstLayoutCount); + chain->PhysicalDeviceHostImageCopyPropertiesEXT.pCopyDstLayouts = chain->VkPhysicalDeviceHostImageCopyPropertiesEXT_pCopyDstLayouts.data(); + chain->VkPhysicalDeviceLayeredApiPropertiesListKHR_pLayeredApis.resize(chain->PhysicalDeviceLayeredApiPropertiesListKHR.layeredApiCount); + chain->PhysicalDeviceLayeredApiPropertiesListKHR.pLayeredApis = chain->VkPhysicalDeviceLayeredApiPropertiesListKHR_pLayeredApis.data(); +} struct phys_device_mem_props2_chain { phys_device_mem_props2_chain() = default; phys_device_mem_props2_chain(const phys_device_mem_props2_chain &) = delete; diff --git a/vulkaninfo/outputprinter.h b/vulkaninfo/outputprinter.h index 687231807..d515b62d7 100644 --- a/vulkaninfo/outputprinter.h +++ b/vulkaninfo/outputprinter.h @@ -438,8 +438,7 @@ class Printer { } else { get_top().is_first_item = false; } - out << std::string(static_cast(get_top().indents), '\t') << "\"" << array_name << "\": " - << "[\n"; + out << std::string(static_cast(get_top().indents), '\t') << "\"" << array_name << "\": " << "[\n"; assert(get_top().is_array == false && "Cant start an array object inside another array, must be enclosed in an object"); break; @@ -471,6 +470,12 @@ class Printer { // value_description is for reference information and is displayed inside parenthesis after the value template void PrintKeyValue(std::string key, T value) { + // If we are inside of an array, Print the value as an element + if (get_top().is_array) { + PrintElement(value); + return; + } + switch (output_type) { case (OutputType::text): out << std::string(static_cast(get_top().indents), '\t') << key; @@ -568,6 +573,11 @@ class Printer { // print inside array template void PrintElement(T element) { + // If we are inside of an object, just use an empty string as the key + if (!get_top().is_array) { + PrintKeyValue("placeholder", element); + return; + } switch (output_type) { case (OutputType::text): out << std::string(static_cast(get_top().indents), '\t') << element << "\n"; diff --git a/vulkaninfo/vulkaninfo.cpp b/vulkaninfo/vulkaninfo.cpp index 58cae208c..719c0a37f 100644 --- a/vulkaninfo/vulkaninfo.cpp +++ b/vulkaninfo/vulkaninfo.cpp @@ -93,7 +93,7 @@ void DumpLayers(Printer &p, std::vector layers, const std::v ObjectWrapper obj(p, header); DumpExtensions(p, "Layer Extensions", layer.extension_properties); - ArrayWrapper arr_devices(p, "Devices", gpus.size()); + ObjectWrapper arr_devices(p, "Devices", gpus.size()); for (auto &gpu : gpus) { p.SetValueDescription(std::string(gpu->props.deviceName)).PrintKeyValue("GPU id", gpu->id); auto exts = gpu->inst.AppGetPhysicalDeviceLayerExtensions(gpu->phys_device, props.layerName); @@ -351,28 +351,6 @@ void DumpGroups(Printer &p, AppInstance &inst) { } } -void GetAndDumpHostImageCopyPropertiesEXT(Printer &p, AppGpu &gpu) { - if (!gpu.CheckPhysicalDeviceExtensionIncluded("VK_EXT_host_image_copy")) { - return; - } - - // Manually implement VkPhysicalDeviceHostImageCopyPropertiesEXT due to it needing to be called twice - VkPhysicalDeviceHostImageCopyPropertiesEXT host_image_copy_properties_ext{}; - host_image_copy_properties_ext.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_PROPERTIES_EXT; - VkPhysicalDeviceProperties2KHR props2{}; - props2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR; - props2.pNext = static_cast(&host_image_copy_properties_ext); - vkGetPhysicalDeviceProperties2KHR(gpu.phys_device, &props2); - std::vector src_layouts(host_image_copy_properties_ext.copySrcLayoutCount); - host_image_copy_properties_ext.pCopySrcLayouts = src_layouts.data(); - std::vector dst_layouts(host_image_copy_properties_ext.copyDstLayoutCount); - host_image_copy_properties_ext.pCopyDstLayouts = dst_layouts.data(); - vkGetPhysicalDeviceProperties2KHR(gpu.phys_device, &props2); - p.SetSubHeader(); - DumpVkPhysicalDeviceHostImageCopyPropertiesEXT(p, "VkPhysicalDeviceHostImageCopyPropertiesEXT", host_image_copy_properties_ext); - p.AddNewline(); -} - void GpuDumpProps(Printer &p, AppGpu &gpu) { auto props = gpu.GetDeviceProperties(); p.SetSubHeader(); @@ -401,7 +379,6 @@ void GpuDumpProps(Printer &p, AppGpu &gpu) { if (gpu.inst.CheckExtensionEnabled(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) { void *place = gpu.props2.pNext; chain_iterator_phys_device_props2(p, gpu.inst, gpu, place); - GetAndDumpHostImageCopyPropertiesEXT(p, gpu); } } @@ -942,21 +919,28 @@ const char *help_message_body = "[-o , --output ]\n" " Print output to a new file whose name is specified by filename.\n" " File will be written to the current working directory.\n" - "[--text] Produce a text version of " APP_SHORT_NAME " output to stdout. This is\n" + "[--text] Produce a text version of " APP_SHORT_NAME + " output to stdout. This is\n" " the default output.\n" - "[--html] Produce an html version of " APP_SHORT_NAME " output, saved as\n" - " \"" APP_SHORT_NAME ".html\" in the directory in which the command\n" + "[--html] Produce an html version of " APP_SHORT_NAME + " output, saved as\n" + " \"" APP_SHORT_NAME + ".html\" in the directory in which the command\n" " is run.\n" - "[-j, --json] Produce a json version of " APP_SHORT_NAME " output conforming to the Vulkan\n" + "[-j, --json] Produce a json version of " APP_SHORT_NAME + " output conforming to the Vulkan\n" " Profiles schema, saved as \n" - " \"VP_" APP_UPPER_CASE_NAME "_[DEVICE_NAME]_[DRIVER_VERSION].json\"\n" + " \"VP_" APP_UPPER_CASE_NAME + "_[DEVICE_NAME]_[DRIVER_VERSION].json\"\n" " of the first gpu in the system.\n" "[-j=, --json=]\n" " For a multi-gpu system, a single gpu can be targetted by\n" " specifying the gpu-number associated with the gpu of \n" " interest. This number can be determined by running\n" - " " APP_SHORT_NAME " without any options specified.\n" - "[--show-tool-props] Show the active VkPhysicalDeviceToolPropertiesEXT that " APP_SHORT_NAME " finds.\n" + " " APP_SHORT_NAME + " without any options specified.\n" + "[--show-tool-props] Show the active VkPhysicalDeviceToolPropertiesEXT that " APP_SHORT_NAME + " finds.\n" "[--show-formats] Display the format properties of each physical device.\n" " Note: This only affects text output.\n"; diff --git a/vulkaninfo/vulkaninfo.h b/vulkaninfo/vulkaninfo.h index a3f356b1e..7abe10bd7 100644 --- a/vulkaninfo/vulkaninfo.h +++ b/vulkaninfo/vulkaninfo.h @@ -274,6 +274,8 @@ void setup_surface_capabilities2_chain(VkSurfaceCapabilities2KHR &start, std::un void setup_format_properties2_chain(VkFormatProperties2 &start, std::unique_ptr &chain, AppGpu &gpu); void setup_queue_properties2_chain(VkQueueFamilyProperties2 &start, std::unique_ptr &chain, AppGpu &gpu); +void prepare_phys_device_props2_twocall_chain_vectors(std::unique_ptr &chain); + /* An ptional contains either a value or nothing. The optional asserts if a value is trying to be gotten but none exist. * The interface is taken from C++17's with many aspects removed. * This class assumes the template type is 'trivial' @@ -1474,6 +1476,8 @@ struct AppGpu { props2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR; setup_phys_device_props2_chain(props2, chain_for_phys_device_props2, inst, *this); + vkGetPhysicalDeviceProperties2KHR(phys_device, &props2); + prepare_phys_device_props2_twocall_chain_vectors(chain_for_phys_device_props2); vkGetPhysicalDeviceProperties2KHR(phys_device, &props2); // VkPhysicalDeviceMemoryProperties2 From 145675c7915c5041dac106c9827dc0b21992c091 Mon Sep 17 00:00:00 2001 From: xantares Date: Fri, 12 Jul 2024 07:44:12 +0200 Subject: [PATCH 5/7] CMake: Fix duplicate REQUIRED --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5580c471f..2dc2a6322 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,7 +56,7 @@ endif() set_property(GLOBAL PROPERTY USE_FOLDERS ON) find_package(VulkanHeaders QUIET REQUIRED CONFIG) -find_package(volk REQUIRED QUIET REQUIRED CONFIG) +find_package(volk QUIET REQUIRED CONFIG) if ((APPLE OR BUILD_TESTS) AND NOT ANDROID) find_package(VulkanLoader QUIET REQUIRED CONFIG) endif() From b47676a03827fc0c287409b243b1fd62886e79c0 Mon Sep 17 00:00:00 2001 From: Mike Schuchardt Date: Fri, 12 Jul 2024 10:47:16 -0700 Subject: [PATCH 6/7] build: Update to header 1.3.290 --- icd/VkICD_mock_icd.json.in | 2 +- icd/generated/function_declarations.h | 4 ++-- scripts/known_good.json | 9 +++------ 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/icd/VkICD_mock_icd.json.in b/icd/VkICD_mock_icd.json.in index cc1c9da82..9c286f9e4 100644 --- a/icd/VkICD_mock_icd.json.in +++ b/icd/VkICD_mock_icd.json.in @@ -2,6 +2,6 @@ "file_format_version": "1.0.1", "ICD": { "library_path": "@JSON_LIBRARY_PATH@", - "api_version": "1.3.289" + "api_version": "1.3.290" } } \ No newline at end of file diff --git a/icd/generated/function_declarations.h b/icd/generated/function_declarations.h index 2f0bf2b77..3e60cd0cb 100644 --- a/icd/generated/function_declarations.h +++ b/icd/generated/function_declarations.h @@ -51,7 +51,7 @@ static const std::unordered_map instance_extension_map = {"VK_EXT_direct_mode_display", 1}, {"VK_EXT_acquire_xlib_display", 1}, {"VK_EXT_display_surface_counter", 1}, - {"VK_EXT_swapchain_colorspace", 4}, + {"VK_EXT_swapchain_colorspace", 5}, {"VK_KHR_external_fence_capabilities", 1}, {"VK_KHR_get_surface_capabilities2", 1}, {"VK_KHR_get_display_properties2", 1}, @@ -140,7 +140,7 @@ static const std::unordered_map device_extension_map = { {"VK_EXT_discard_rectangles", 2}, {"VK_EXT_conservative_rasterization", 1}, {"VK_EXT_depth_clip_enable", 1}, - {"VK_EXT_hdr_metadata", 2}, + {"VK_EXT_hdr_metadata", 3}, {"VK_KHR_imageless_framebuffer", 1}, {"VK_KHR_create_renderpass2", 1}, {"VK_IMG_relaxed_line_rasterization", 1}, diff --git a/scripts/known_good.json b/scripts/known_good.json index 6600620ed..47f737cc1 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -7,10 +7,7 @@ "sub_dir": "Vulkan-Headers", "build_dir": "Vulkan-Headers/build", "install_dir": "Vulkan-Headers/build/install", - "cmake_options": [ - "-DVULKAN_HEADERS_ENABLE_MODULE=OFF" - ], - "commit": "v1.3.289" + "commit": "v1.3.290" }, { "name": "MoltenVK", @@ -77,7 +74,7 @@ "cmake_options": [ "-DLOADER_USE_UNSAFE_FILE_SEARCH=ON" ], - "commit": "v1.3.289", + "commit": "v1.3.290", "build_platforms": [ "windows", "linux", @@ -98,4 +95,4 @@ "googletest": "GOOGLETEST_INSTALL_DIR", "Vulkan-Loader": "VULKAN_LOADER_INSTALL_DIR" } -} \ No newline at end of file +} From 53a6ba7c235cbe0b0f3e85e3de6d9070bcfec710 Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Tue, 16 Jul 2024 12:22:02 -0500 Subject: [PATCH 7/7] deps: Update volk to vulkan-sdk-1.3.290 --- scripts/known_good.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/known_good.json b/scripts/known_good.json index 47f737cc1..64ab598de 100644 --- a/scripts/known_good.json +++ b/scripts/known_good.json @@ -35,7 +35,7 @@ "cmake_options": [ "-DVOLK_INSTALL=ON" ], - "commit": "vulkan-sdk-1.3.283", + "commit": "vulkan-sdk-1.3.290", "deps": [ { "var_name": "VULKAN_HEADERS_INSTALL_DIR",