diff options
-rw-r--r-- | loader/unknown_function_handling.c | 15 | ||||
-rw-r--r-- | tests/framework/layer/test_layer.cpp | 10 |
2 files changed, 17 insertions, 8 deletions
diff --git a/loader/unknown_function_handling.c b/loader/unknown_function_handling.c index 16120c189..23e4e69f3 100644 --- a/loader/unknown_function_handling.c +++ b/loader/unknown_function_handling.c @@ -178,18 +178,17 @@ bool loader_check_icds_for_phys_dev_ext_address(struct loader_instance *inst, co bool loader_check_layer_list_for_phys_dev_ext_address(struct loader_instance *inst, const char *funcName) { struct loader_layer_properties *layer_prop_list = inst->expanded_activated_layer_list.list; - for (uint32_t layer = 0; layer < inst->expanded_activated_layer_list.count; ++layer) { - // If this layer supports the vk_layerGetPhysicalDeviceProcAddr, then call - // it and see if it returns a valid pointer for this function name. + for (uint32_t layer = 0; layer < inst->expanded_activated_layer_list.count; layer++) { + // Find the first layer in the call chain which supports vk_layerGetPhysicalDeviceProcAddr + // and call that, returning whether it found a valid pointer for this function name. + // We return if the topmost layer supports GPDPA since the layer should call down the chain for us. if (layer_prop_list[layer].interface_version > 1) { const struct loader_layer_functions *const functions = &(layer_prop_list[layer].functions); - if (NULL != functions->get_physical_device_proc_addr && - NULL != functions->get_physical_device_proc_addr((VkInstance)inst->instance, funcName)) { - return true; + if (NULL != functions->get_physical_device_proc_addr) { + return NULL != functions->get_physical_device_proc_addr((VkInstance)inst->instance, funcName); } } } - return false; } @@ -327,4 +326,4 @@ void *loader_phys_dev_ext_gpa_term_no_check(struct loader_instance *inst, const } return NULL; -}
\ No newline at end of file +} diff --git a/tests/framework/layer/test_layer.cpp b/tests/framework/layer/test_layer.cpp index 5be8d8ddc..171703d1e 100644 --- a/tests/framework/layer/test_layer.cpp +++ b/tests/framework/layer/test_layer.cpp @@ -413,6 +413,12 @@ VKAPI_ATTR void VKAPI_CALL test_vkDestroyDevice(VkDevice device, const VkAllocat } } } +// forward declarations needed for trampolines +#if TEST_LAYER_EXPORT_GET_PHYSICAL_DEVICE_PROC_ADDR +extern "C" { +FRAMEWORK_EXPORT VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_layerGetPhysicalDeviceProcAddr(VkInstance instance, const char* pName); +} +#endif // trampolines @@ -435,6 +441,10 @@ VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL get_physical_device_func(VkInstance ins return to_vkVoidFunction(func.function); } } + +#if TEST_LAYER_EXPORT_GET_PHYSICAL_DEVICE_PROC_ADDR + if (string_eq(pName, "vk_layerGetPhysicalDeviceProcAddr")) return to_vkVoidFunction(vk_layerGetPhysicalDeviceProcAddr); +#endif return nullptr; } |