aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Zulauf <jzulauf@lunarg.com>2018-03-30 16:52:23 -0600
committerjzulauf-lunarg <32470354+jzulauf-lunarg@users.noreply.github.com>2018-04-03 16:35:29 -0600
commit8df6eac0acf81cb49d1bf2b635a52921a6f6c15f (patch)
tree385fada5af915f66834e6d13d6b000962535e898
parent4da0da044a455eb21ba4a73bd3c314f536de969d (diff)
downloadusermoji-8df6eac0acf81cb49d1bf2b635a52921a6f6c15f.tar.xz
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
-rw-r--r--loader/loader.c5
1 files 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));