draw_state: Add CreateInstance support
Layers need to intercept CreateInstance in order
to see what's been enabled on the Instance chain.
As this layer supports DEBUG_REPORT extension it
needs to know if that has been enabled or not.
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp
index bbf0b5e..34971f4 100644
--- a/layers/draw_state.cpp
+++ b/layers/draw_state.cpp
@@ -1525,6 +1525,21 @@
}
}
+VK_LAYER_EXPORT VkResult VKAPI vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, VkInstance* pInstance)
+{
+ VkLayerInstanceDispatchTable *pDisp = *(VkLayerInstanceDispatchTable **) (*pInstance);
+ VkLayerInstanceDispatchTable *pTable = tableInstanceMap[pDisp];
+
+ loader_platform_thread_once(&g_initOnce, initDrawState);
+
+ VkResult result = pTable->CreateInstance(pCreateInfo, pInstance);
+
+ if (result == VK_SUCCESS) {
+ enable_debug_report(pCreateInfo->extensionCount, pCreateInfo->pEnabledExtensions);
+ }
+ return result;
+}
+
/* hook DestroyInstance to remove tableInstanceMap entry */
VK_LAYER_EXPORT VkResult VKAPI vkDestroyInstance(VkInstance instance)
{
@@ -3056,6 +3071,8 @@
initInstanceTable((const VkBaseLayerObject *) instance);
return (void *) vkGetInstanceProcAddr;
}
+ if (!strcmp(funcName, "vkCreateInstance"))
+ return (void *) vkCreateInstance;
if (!strcmp(funcName, "vkDestroyInstance"))
return (void *) vkDestroyInstance;
if (!strcmp(funcName, "vkCreateDevice"))