Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/KhronosGroup/Vulkan-Loader.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Giessen <charles@lunarg.com>2022-06-06 21:05:52 +0300
committerCharles Giessen <46324611+charles-lunarg@users.noreply.github.com>2022-06-07 06:34:36 +0300
commitc3601d4d914212a22e0ebed5329847b9ce89596f (patch)
treefccc713c0741bccb25d8fe901d6a859d73cfbd2b
parentd3db2f78d9c12a607bb2c224a452535cf0ab780c (diff)
Only check first GPDPA in the layer chain.
When checking for unknown physical device functions, check the first layer that supports vk_layerGetPhysicalDeviceProcAddr in the chain starting with the layer closest to the application. This prevents unecessary work being done, and if any layer wraps VkInstance will properly call through the wrapping layer first without calling into any other layer.
-rw-r--r--loader/unknown_function_handling.c15
-rw-r--r--tests/framework/layer/test_layer.cpp10
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 c5c333a3c..f4a43bd17 100644
--- a/tests/framework/layer/test_layer.cpp
+++ b/tests/framework/layer/test_layer.cpp
@@ -445,6 +445,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
@@ -467,6 +473,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;
}