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 <charles@lunarg.com>2022-06-07 18:54:10 +0300
commit322f7e3212b4fd9d70d7f48972963c83d24d06e4 (patch)
tree7298eba81e114b96bbc29aec297dd206a0ef0557
parent27e6bc30e964704ad5cb51ca97afca4182d1a86e (diff)
Only check first GPDPA in the layer chain.sdk-1.3.216.0sdk-1.3.216
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 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;
}