vulkaninfo: use gpu version instead of instance
authorCharles Giessen <charles@lunarg.com>
Fri, 24 Jan 2020 17:44:23 +0000 (10:44 -0700)
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>
Fri, 24 Jan 2020 22:28:19 +0000 (15:28 -0700)
vulkaninfo would previously use the instance version for determining
what capabilities to display. This leads to issues when running a 1.2
loader on a 1.1 or 1.0 driver.

Changes to be committed:
modified:   vulkaninfo/vulkaninfo.cpp
modified:   vulkaninfo/vulkaninfo.h

Change-Id: I7f12c10d48f99d429025337b00c677936a040d13

vulkaninfo/vulkaninfo.cpp
vulkaninfo/vulkaninfo.h

index 717360e..0c4d88f 100644 (file)
@@ -349,7 +349,7 @@ void GpuDumpProps(Printer &p, AppGpu &gpu) {
     if (p.Type() != OutputType::json) {
         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, gpu.inst.vk_version);
+            chain_iterator_phys_device_props2(p, gpu.inst, gpu, place, gpu.api_version);
         }
     }
     p.AddNewline();
@@ -521,7 +521,7 @@ void GpuDumpFeatures(Printer &p, AppGpu &gpu) {
     if (p.Type() != OutputType::json) {
         if (gpu.inst.CheckExtensionEnabled(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) {
             void *place = gpu.features2.pNext;
-            chain_iterator_phys_device_features2(p, gpu, place, gpu.inst.vk_version);
+            chain_iterator_phys_device_features2(p, gpu, place, gpu.api_version);
         }
     }
 }
index fee4a9d..c9a1dd0 100644 (file)
@@ -1053,6 +1053,7 @@ struct AppGpu {
     AppInstance &inst;
     uint32_t id;
     VkPhysicalDevice phys_device;
+    VulkanVersion api_version;
 
     VkPhysicalDeviceProperties props;
     VkPhysicalDeviceProperties2KHR props2;
@@ -1084,6 +1085,10 @@ struct AppGpu {
         : inst(inst), id(id), phys_device(phys_device) {
         vkGetPhysicalDeviceProperties(phys_device, &props);
 
+        // needs to find the minimum of the instance and device version, and use that to print the device info
+        uint32_t gpu_version = props.apiVersion < inst.instance_version ? props.apiVersion : inst.instance_version;
+        api_version = {VK_VERSION_MAJOR(gpu_version), VK_VERSION_MINOR(gpu_version), VK_VERSION_PATCH(gpu_version)};
+
         if (inst.CheckExtensionEnabled(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME)) {
             props2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR;
             buildpNextChain((VkStructureHeader *)&props2, chainInfos.phys_device_props2);