summaryrefslogtreecommitdiff
path: root/vulkan/libvulkan/driver.cpp
diff options
context:
space:
mode:
author Jörg Wagner <jorwag@google.com> 2024-05-13 19:44:08 +0000
committer Jörg Wagner <jorwag@google.com> 2024-05-15 08:04:27 +0000
commit7b48c207960226c57c5be154f7f84be73c4bd4a6 (patch)
tree58393f1c67573cc0d75fcb81db4b4dcdfb3899cd /vulkan/libvulkan/driver.cpp
parentd70d6bc673b73314417f341cbf2d7ee4aadc4614 (diff)
Filter hook entry points by ICD entry point presence
For device proc hooks which intercept core functions check whether there exists an exposed core function from the ICD, and skip exposure if none is found. This avoids having to replicate exposure filtering based on requested Vulkan API versions inside the Loader - rely on the ICD to handle it correctly. Bug: 309752984 Change-Id: Ibeb13dae8eccaa859072ee5233013d99d5b26ef0
Diffstat (limited to 'vulkan/libvulkan/driver.cpp')
-rw-r--r--vulkan/libvulkan/driver.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/vulkan/libvulkan/driver.cpp b/vulkan/libvulkan/driver.cpp
index 7ea98f5469..3f89960e32 100644
--- a/vulkan/libvulkan/driver.cpp
+++ b/vulkan/libvulkan/driver.cpp
@@ -964,14 +964,20 @@ PFN_vkVoidFunction GetInstanceProcAddr(VkInstance instance, const char* pName) {
PFN_vkVoidFunction GetDeviceProcAddr(VkDevice device, const char* pName) {
const ProcHook* hook = GetProcHook(pName);
+ PFN_vkVoidFunction drv_func = GetData(device).driver.GetDeviceProcAddr(device, pName);
+
if (!hook)
- return GetData(device).driver.GetDeviceProcAddr(device, pName);
+ return drv_func;
if (hook->type != ProcHook::DEVICE) {
ALOGE("internal vkGetDeviceProcAddr called for %s", pName);
return nullptr;
}
+ // Don't hook if we don't have a device entry function below for the core function.
+ if (!drv_func && (hook->extension >= ProcHook::EXTENSION_CORE_1_0))
+ return nullptr;
+
return (GetData(device).hook_extensions[hook->extension]) ? hook->proc
: nullptr;
}