Skip to content

Commit

Permalink
If the json does not declare api_version, assume it is a 1.0 driver
Browse files Browse the repository at this point in the history
This works around some old ICDs that crash if you try to look up an unrecognized function.
  • Loading branch information
hg-ctangora committed Apr 25, 2019
1 parent edc8fbe commit 74a45b5
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions loader/loader.c
Original file line number Diff line number Diff line change
Expand Up @@ -5812,16 +5812,19 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateInstance(const VkInstanceCreateI

// Get the driver version from vkEnumerateInstanceVersion
uint32_t icd_version = VK_API_VERSION_1_0;
PFN_vkEnumerateInstanceVersion icd_enumerate_instance_version = (PFN_vkEnumerateInstanceVersion)
icd_term->scanned_icd->GetInstanceProcAddr(NULL, "vkEnumerateInstanceVersion");
VkResult icd_result = VK_SUCCESS;
if (icd_enumerate_instance_version != NULL) {
icd_result = icd_enumerate_instance_version(&icd_version);
if (icd_result != VK_SUCCESS) {
icd_version = VK_API_VERSION_1_0;
loader_log(ptr_instance, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, "terminator_CreateInstance: ICD \"%s\" "
"vkEnumerateInstanceVersion returned error. The ICD will be treated as a 1.0 ICD",
icd_term->scanned_icd->lib_name);

if (icd_term->scanned_icd->api_version > 0) {
PFN_vkEnumerateInstanceVersion icd_enumerate_instance_version =
(PFN_vkEnumerateInstanceVersion)icd_term->scanned_icd->GetInstanceProcAddr(NULL, "vkEnumerateInstanceVersion");
if (icd_enumerate_instance_version != NULL) {
icd_result = icd_enumerate_instance_version(&icd_version);
if (icd_result != VK_SUCCESS) {
icd_version = VK_API_VERSION_1_0;
loader_log(ptr_instance, VK_DEBUG_REPORT_DEBUG_BIT_EXT, 0, "terminator_CreateInstance: ICD \"%s\" "
"vkEnumerateInstanceVersion returned error. The ICD will be treated as a 1.0 ICD",
icd_term->scanned_icd->lib_name);
}
}
}

Expand Down

0 comments on commit 74a45b5

Please sign in to comment.