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 <muhamad.sammar@arm.com>
Change-Id: Icd67fa4fb819a6f5ab4c5f40d73514ba79174c05
This commit is contained in:
Muhamad Sammar 2025-11-26 12:37:12 +00:00
parent a0947a5ae8
commit 29a7a23847

View file

@ -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) &&