From 3ca0c82c23d95f2173d5fa93029c74597a04976d Mon Sep 17 00:00:00 2001 From: Jon Ashburn Date: Mon, 18 Jan 2016 12:20:03 -0700 Subject: loader: Return the loader created instance rather than from the instance chain Fix's issue with layers that wrap instance. --- loader/trampoline.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/loader/trampoline.c b/loader/trampoline.c index f46d40f7..563fec60 100644 --- a/loader/trampoline.c +++ b/loader/trampoline.c @@ -43,6 +43,7 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance( VkInstance* pInstance) { struct loader_instance *ptr_instance = NULL; + VkInstance created_instance = VK_NULL_HANDLE; VkResult res = VK_ERROR_INITIALIZATION_FAILED; VkDebugReportCallbackEXT instance_callback = VK_NULL_HANDLE; void *pNext = (void *) pCreateInfo->pNext; @@ -180,11 +181,11 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance( wsi_create_instance(ptr_instance, pCreateInfo); debug_report_create_instance(ptr_instance, pCreateInfo); - - res = ptr_instance->disp->CreateInstance(pCreateInfo, pAllocator, &ptr_instance); + created_instance = (VkInstance) ptr_instance; + res = ptr_instance->disp->CreateInstance(pCreateInfo, pAllocator, &created_instance); if (res == VK_SUCCESS) { - *pInstance = (VkInstance) ptr_instance; + *pInstance = created_instance; /* * Finally have the layers in place and everyone has seen * the CreateInstance command go by. This allows the layer's -- cgit v1.2.3