diff options
| author | Courtney Goeltzenleuchter <courtney@LunarG.com> | 2015-06-01 14:29:58 -0600 |
|---|---|---|
| committer | Courtney Goeltzenleuchter <courtney@LunarG.com> | 2015-06-18 10:18:19 -0600 |
| commit | 5d3d85d129403ebd376e61d52ec0a8de7e51b114 (patch) | |
| tree | 1312064705ff3429291188881d86a8fe49530125 /layers/draw_state.cpp | |
| parent | 172a0bfdc137b30b6a769246913cab2da34cec0e (diff) | |
| download | usermoji-5d3d85d129403ebd376e61d52ec0a8de7e51b114.tar.xz | |
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.
Diffstat (limited to 'layers/draw_state.cpp')
| -rw-r--r-- | layers/draw_state.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/layers/draw_state.cpp b/layers/draw_state.cpp index bbf0b5e4..34971f43 100644 --- a/layers/draw_state.cpp +++ b/layers/draw_state.cpp @@ -1525,6 +1525,21 @@ static void initDrawState(void) } } +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 @@ VK_LAYER_EXPORT void * VKAPI vkGetInstanceProcAddr(VkInstance instance, const ch 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")) |
