From 29a7a23847173f1e8b975db0a1712cf432fd6d97 Mon Sep 17 00:00:00 2001 From: Muhamad Sammar Date: Wed, 26 Nov 2025 12:37:12 +0000 Subject: [PATCH] Handle NULL instance parameter in vkGetInstanceProcAddr The Vulkan spec allows passing a NULL VkInstance to vkGetInstanceProcAddr when querying global (pre-instance) function pointers, but these functions must be resolved only through the loader, not through layers. This change ensures that the layer correctly handles NULL instance and prevents such incorrect behavior comming from upper layers. Signed-off-by: Muhamad Sammar Change-Id: Icd67fa4fb819a6f5ab4c5f40d73514ba79174c05 --- layer/layer.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/layer/layer.cpp b/layer/layer.cpp index a1ab943..4f6d1fe 100644 --- a/layer/layer.cpp +++ b/layer/layer.cpp @@ -756,6 +756,11 @@ wsi_layer_vkGetInstanceProcAddr(VkInstance instance, const char *funcName) VWL_A GET_PROC_ADDR(vkDestroyInstance); GET_PROC_ADDR(vkCreateDevice); + if (instance == VK_NULL_HANDLE) + { + return nullptr; + } + auto &instance_data = layer::instance_private_data::get(instance); const bool core_1_1 = instance_data.api_version >= VK_API_VERSION_1_1; if ((instance_data.is_instance_extension_enabled(VK_KHR_DEVICE_GROUP_EXTENSION_NAME) &&