From 48f36ffd590bbbd57485600396f71bf3ddba8109 Mon Sep 17 00:00:00 2001 From: Mike Schuchardt Date: Wed, 9 Feb 2022 12:07:26 -0800 Subject: vulkaninfo: Enable portability extension for device groups Expand previous change to include device group creation. Also added some VK_ENABLE_BETA_EXTENSIONS guards around the portability identifiers. --- vulkaninfo/vulkaninfo.cpp | 4 ++-- vulkaninfo/vulkaninfo.h | 23 +++++++++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/vulkaninfo/vulkaninfo.cpp b/vulkaninfo/vulkaninfo.cpp index d53f93cc..b57b0261 100644 --- a/vulkaninfo/vulkaninfo.cpp +++ b/vulkaninfo/vulkaninfo.cpp @@ -75,7 +75,7 @@ void DumpLayers(Printer &p, std::vector layers, const std::v ArrayWrapper arr_devices(p, "Devices", gpus.size()); for (auto &gpu : gpus) { p.PrintKeyValue("GPU id", gpu->id, gpu->props.deviceName); - auto exts = gpu->AppGetPhysicalDeviceLayerExtensions(props.layerName); + auto exts = gpu->inst.AppGetPhysicalDeviceLayerExtensions(gpu->phys_device, props.layerName); DumpExtensions(p, "Layer-Device", exts); p.AddNewline(); } @@ -106,7 +106,7 @@ void DumpLayers(Printer &p, std::vector layers, const std::v for (auto &gpu : gpus) { ObjectWrapper obj_gpu(p, gpu->props.deviceName); p.PrintKeyValue("GPU id", gpu->id, gpu->props.deviceName); - auto exts = gpu->AppGetPhysicalDeviceLayerExtensions(layer.layer_properties.layerName); + auto exts = gpu->inst.AppGetPhysicalDeviceLayerExtensions(gpu->phys_device, layer.layer_properties.layerName); DumpExtensions(p, "Layer-Device", exts); } } diff --git a/vulkaninfo/vulkaninfo.h b/vulkaninfo/vulkaninfo.h index fb4cf4f5..789e7ad7 100644 --- a/vulkaninfo/vulkaninfo.h +++ b/vulkaninfo/vulkaninfo.h @@ -703,6 +703,11 @@ struct AppInstance { std::vector FindPhysicalDevices() { return GetVector("vkEnumeratePhysicalDevices", dll.fp_vkEnumeratePhysicalDevices, instance); } + + std::vector AppGetPhysicalDeviceLayerExtensions(VkPhysicalDevice phys_device, const char *layer_name) { + return GetVector("vkEnumerateDeviceExtensionProperties", dll.fp_vkEnumerateDeviceExtensionProperties, + phys_device, layer_name); + } }; // --------- Platform Specific Presentation Calls --------- // @@ -1277,6 +1282,15 @@ util::vulkaninfo_optional GetGroupCapabilit VkPhysicalDeviceGroupProperties group) { // Build create info for logical device made from all physical devices in this group. std::vector extensions_list = {VK_KHR_SWAPCHAIN_EXTENSION_NAME, VK_KHR_DEVICE_GROUP_EXTENSION_NAME}; + +#ifdef VK_ENABLE_BETA_EXTENSIONS + for (const auto &extension : inst.AppGetPhysicalDeviceLayerExtensions(group.physicalDevices[0], nullptr)) { + if (std::string(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME) == extension.extensionName) { + extensions_list.push_back(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME); + } + } +#endif + VkDeviceGroupDeviceCreateInfoKHR dg_ci = {VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO_KHR, nullptr, group.physicalDeviceCount, group.physicalDevices}; @@ -1507,18 +1521,20 @@ struct AppGpu { } } - device_extensions = AppGetPhysicalDeviceLayerExtensions(nullptr); + device_extensions = inst.AppGetPhysicalDeviceLayerExtensions(phys_device, nullptr); if (features.sparseBinding) { enabled_features.sparseBinding = VK_TRUE; } std::vector extensions_to_enable; +#ifdef VK_ENABLE_BETA_EXTENSIONS for (const auto &extension : device_extensions) { if (std::string(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME) == extension.extensionName) { extensions_to_enable.push_back(VK_KHR_PORTABILITY_SUBSET_EXTENSION_NAME); } } +#endif const float queue_priority = 1.0f; // pick the first queue index and hope for the best @@ -1663,11 +1679,6 @@ struct AppGpu { [extension_to_check](VkExtensionProperties &prop) { return prop.extensionName == extension_to_check; }); } - std::vector AppGetPhysicalDeviceLayerExtensions(const char *layer_name) { - return GetVector("vkEnumerateDeviceExtensionProperties", - inst.dll.fp_vkEnumerateDeviceExtensionProperties, phys_device, layer_name); - } - // Helper function to determine whether a format range is currently supported. bool FormatRangeSupported(FormatRange &format_range) { // True if standard and supported by both this instance and this GPU -- cgit v1.2.3