From: Charles Giessen Date: Wed, 26 Jan 2022 20:37:04 +0000 (-0700) Subject: Warn when the apiVersion's variant isn't 0 X-Git-Tag: upstream/v1.3.207~60 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=469b7c03be956b6d5254d47e43324b5bb0565ed5;p=platform%2Fupstream%2FVulkan-Loader.git Warn when the apiVersion's variant isn't 0 The 1.2.175 header release saw the addition of API Variants. For the purposes of the loader, this should always be set to 0. If this value isn't zero, the loader should warn about it. --- diff --git a/loader/trampoline.c b/loader/trampoline.c index 42580e3e..4828c0c6 100644 --- a/loader/trampoline.c +++ b/loader/trampoline.c @@ -516,6 +516,17 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCr } } + // Make sure the application provided API version has 0 for its variant + if (NULL != pCreateInfo->pApplicationInfo) { + uint32_t variant_version = VK_API_VERSION_VARIANT(pCreateInfo->pApplicationInfo->apiVersion); + if (0 != variant_version) { + loader_log(ptr_instance, VULKAN_LOADER_WARN_BIT, 0, + "vkCreateInstance: The API Variant specified in pCreateInfo->pApplicationInfo.apiVersion is %d instead of " + "the expected value of 0.", + variant_version); + } + } + // Due to implicit layers need to get layer list even if // enabledLayerCount == 0 and VK_INSTANCE_LAYERS is unset. For now always // get layer list via loader_scan_for_layers(). diff --git a/tests/loader_version_tests.cpp b/tests/loader_version_tests.cpp index 4cfc0949..0b7b7978 100644 --- a/tests/loader_version_tests.cpp +++ b/tests/loader_version_tests.cpp @@ -595,4 +595,19 @@ TEST(MinorVersionUpdate, Version1_3) { QueueSubmit2(nullptr, 0, nullptr, VK_NULL_HANDLE); auto SetPrivateData = reinterpret_cast(inst.functions->vkGetDeviceProcAddr(device, "vkSetPrivateData")); SetPrivateData(device, VK_OBJECT_TYPE_UNKNOWN, 0, {}, 0); +} + +TEST(ApplicationInfoVersion, NonVulkanVariant) { + FrameworkEnvironment env{}; + env.add_icd(TestICDDetails(TEST_ICD_PATH_VERSION_6)); + env.get_test_icd().physical_devices.push_back({}); + + DebugUtilsLogger log; + InstWrapper inst{env.vulkan_functions}; + inst.create_info.set_api_version(VK_MAKE_API_VERSION(1, 0, 0, 0)); + FillDebugUtilsCreateDetails(inst.create_info, log); + inst.CheckCreate(); + ASSERT_TRUE(log.find( + std::string("vkCreateInstance: The API Variant specified in pCreateInfo->pApplicationInfo.apiVersion is 1 instead of " + "the expected value of 0."))); } \ No newline at end of file