From d7db171ca5e201d931a3fa94626f3d8d6bc099fe Mon Sep 17 00:00:00 2001 From: Charles Giessen Date: Fri, 9 Feb 2024 09:46:57 -0600 Subject: vulkaninfo: Fix text output for HostImageCopyPropertiesEXT Was missing a new line & underline of the title. Also forgot to check if the extension was supported. --- scripts/vulkaninfo_generator.py | 6 ++++-- vulkaninfo/generated/vulkaninfo.hpp | 12 +++++++++--- vulkaninfo/vulkaninfo.cpp | 7 ++++++- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/scripts/vulkaninfo_generator.py b/scripts/vulkaninfo_generator.py index d5008d10..6da95966 100644 --- a/scripts/vulkaninfo_generator.py +++ b/scripts/vulkaninfo_generator.py @@ -655,8 +655,10 @@ 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 += ' {\n' - out += f' ArrayWrapper arr(p,"{v.name}", obj.' + v.arrayLength + ');\n' + out += f' if (obj.{v.arrayLength} == 0) {{\n' + out += f' p.PrintKeyValue("{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' diff --git a/vulkaninfo/generated/vulkaninfo.hpp b/vulkaninfo/generated/vulkaninfo.hpp index 567e876a..01afba6b 100644 --- a/vulkaninfo/generated/vulkaninfo.hpp +++ b/vulkaninfo/generated/vulkaninfo.hpp @@ -1988,7 +1988,9 @@ void DumpVkPhysicalDeviceHostImageCopyPropertiesEXT(Printer &p, std::string name ObjectWrapper object{p, name}; p.SetMinKeyWidth(35); p.PrintKeyValue("copySrcLayoutCount", obj.copySrcLayoutCount); - { + if (obj.copySrcLayoutCount == 0) { + p.PrintKeyValue("pCopySrcLayouts", "NULL"); + } else { ArrayWrapper arr(p,"pCopySrcLayouts", obj.copySrcLayoutCount); for (uint32_t i = 0; i < obj.copySrcLayoutCount; i++) { if (obj.pCopySrcLayouts != nullptr) { @@ -2001,7 +2003,9 @@ void DumpVkPhysicalDeviceHostImageCopyPropertiesEXT(Printer &p, std::string name } } p.PrintKeyValue("copyDstLayoutCount", obj.copyDstLayoutCount); - { + if (obj.copyDstLayoutCount == 0) { + p.PrintKeyValue("pCopyDstLayouts", "NULL"); + } else { ArrayWrapper arr(p,"pCopyDstLayouts", obj.copyDstLayoutCount); for (uint32_t i = 0; i < obj.copyDstLayoutCount; i++) { if (obj.pCopyDstLayouts != nullptr) { @@ -3287,7 +3291,9 @@ void DumpVkSurfacePresentModeCompatibilityEXT(Printer &p, std::string name, cons ObjectWrapper object{p, name}; p.SetMinKeyWidth(31); p.PrintKeyValue("presentModeCount", obj.presentModeCount); - { + if (obj.presentModeCount == 0) { + p.PrintKeyValue("pPresentModes", "NULL"); + } else { ArrayWrapper arr(p,"pPresentModes", obj.presentModeCount); for (uint32_t i = 0; i < obj.presentModeCount; i++) { if (obj.pPresentModes != nullptr) { diff --git a/vulkaninfo/vulkaninfo.cpp b/vulkaninfo/vulkaninfo.cpp index 3d57f634..591db557 100644 --- a/vulkaninfo/vulkaninfo.cpp +++ b/vulkaninfo/vulkaninfo.cpp @@ -348,6 +348,10 @@ 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; @@ -360,7 +364,9 @@ void GetAndDumpHostImageCopyPropertiesEXT(Printer &p, AppGpu &gpu) { 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) { @@ -391,7 +397,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); - p.AddNewline(); GetAndDumpHostImageCopyPropertiesEXT(p, gpu); } } -- cgit v1.2.3