From 1913c544ae68b9e55ecaee55582f4c532c246e94 Mon Sep 17 00:00:00 2001 From: James Rumble Date: Mon, 28 Oct 2024 17:24:39 +0000 Subject: [PATCH] Default initialize layer inserted VkApplicationInfos If a VkApplicationInfo is not provided by an application and an apiVersion is requested then the layer inserts its own VkApplicationInfo. This structure should be default initialized to avoid issues for further layers and icds reading this member. --- scripts/gen_profiles_layer.py | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/scripts/gen_profiles_layer.py b/scripts/gen_profiles_layer.py index 796244f2..cb7386d1 100644 --- a/scripts/gen_profiles_layer.py +++ b/scripts/gen_profiles_layer.py @@ -2074,21 +2074,6 @@ class JsonLoader { } } - // Add VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME - VkApplicationInfo new_app_info; - if (app_info) { - new_app_info.sType = app_info->sType; - new_app_info.pNext = app_info->pNext; - new_app_info.pApplicationName = app_info->pApplicationName; - new_app_info.applicationVersion = app_info->applicationVersion; - new_app_info.pEngineName = app_info->pEngineName; - new_app_info.engineVersion = app_info->engineVersion; - new_app_info.apiVersion = requested_version; - } else { - new_app_info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; - new_app_info.apiVersion = requested_version; - } - VkInstanceCreateInfo create_info; create_info.sType = pCreateInfo->sType; create_info.pNext = pCreateInfo->pNext; @@ -2097,13 +2082,29 @@ class JsonLoader { create_info.flags |= VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR; } + VkApplicationInfo new_app_info; if (changed_version) { + if (app_info) { + new_app_info.sType = app_info->sType; + new_app_info.pNext = app_info->pNext; + new_app_info.pApplicationName = app_info->pApplicationName; + new_app_info.applicationVersion = app_info->applicationVersion; + new_app_info.pEngineName = app_info->pEngineName; + new_app_info.engineVersion = app_info->engineVersion; + new_app_info.apiVersion = requested_version; + } else { + new_app_info = {VK_STRUCTURE_TYPE_APPLICATION_INFO}; + new_app_info.apiVersion = requested_version; + } + create_info.pApplicationInfo = &new_app_info; } else { create_info.pApplicationInfo = app_info; } create_info.enabledLayerCount = pCreateInfo->enabledLayerCount; create_info.ppEnabledLayerNames = pCreateInfo->ppEnabledLayerNames; + + // Add VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME std::vector extension_names; if (!get_physical_device_properties2_active) { create_info.enabledExtensionCount = pCreateInfo->enabledExtensionCount + 1;