From 19306e828c4476ed42d45bca2dddf00d3a03775a Mon Sep 17 00:00:00 2001 From: John Zulauf Date: Fri, 30 Mar 2018 16:52:23 -0600 Subject: [PATCH] loader: Improve 1.0 driver apiVersion fixup The 1.1 loader attempts to avoid VK_ERROR_INCOMPATIBLE_DRIVER from 1.0 drivers by patching up the supplied apiVersion during CreateInstance. Added support for apiVersions > 0 and < 1.0. Change-Id: Iae350624c6f9f711890814b48adc3f5a17fdc47b --- loader/loader.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/loader/loader.c b/loader/loader.c index 80d363b5..99085957 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -5242,14 +5242,15 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI // Create an instance, substituting the version to 1.0 if necessary VkApplicationInfo icd_app_info; + uint32_t icd_version_nopatch = VK_MAKE_VERSION(VK_VERSION_MAJOR(icd_version), VK_VERSION_MINOR(icd_version), 0); uint32_t requested_version = pCreateInfo == NULL || pCreateInfo->pApplicationInfo == NULL ? VK_API_VERSION_1_0 : pCreateInfo->pApplicationInfo->apiVersion; - if (requested_version > icd_version) { + if ((requested_version != 0) && (icd_version_nopatch == VK_API_VERSION_1_0)) { if (icd_create_info.pApplicationInfo == NULL) { memset(&icd_app_info, 0, sizeof(icd_app_info)); } else { memcpy(&icd_app_info, icd_create_info.pApplicationInfo, sizeof(icd_app_info)); } - icd_app_info.apiVersion = icd_term->scanned_icd->api_version; + icd_app_info.apiVersion = icd_version; icd_create_info.pApplicationInfo = &icd_app_info; } icd_result = ptr_instance->icd_tramp_list.scanned_list[i].CreateInstance(&icd_create_info, pAllocator, &(icd_term->instance)); -- 2.34.1