diff options
| author | Jon Ashburn <jon@lunarg.com> | 2016-03-29 11:16:01 -0600 |
|---|---|---|
| committer | Jon Ashburn <jon@lunarg.com> | 2016-04-01 10:47:17 -0600 |
| commit | 4323e2705d5b34e377c7cbe6cb3faa4b78995097 (patch) | |
| tree | f23a2fb23ac69b0b51cbbf3de1a7554afe9ff582 /loader | |
| parent | b16e5173a411e3a9c164b8a00273da372c9bdf33 (diff) | |
| download | usermoji-4323e2705d5b34e377c7cbe6cb3faa4b78995097.tar.xz | |
loader: Add instance callback to set dispatchable objects
Change-Id: I73b8b6edfee491c53216b730c99a7ea34ade3b4e
Diffstat (limited to 'loader')
| -rw-r--r-- | loader/loader.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/loader/loader.c b/loader/loader.c index 5a00b6f2..fd2d1fe4 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -261,6 +261,16 @@ void loader_log(const struct loader_instance *inst, VkFlags msg_type, fputc('\n', stderr); } +VKAPI_ATTR VkResult VKAPI_CALL vkSetInstanceDispatch(VkInstance instance, void *object) { + + struct loader_instance *inst = loader_get_instance(instance); + if (!inst) { + return VK_ERROR_INITIALIZATION_FAILED; + } + loader_set_dispatch(object, inst->disp); + return VK_SUCCESS; +} + #if defined(WIN32) static char *loader_get_next_path(char *path); /** @@ -3267,6 +3277,16 @@ VkResult loader_create_instance_chain(const VkInstanceCreateInfo *pCreateInfo, PFN_vkCreateInstance fpCreateInstance = (PFN_vkCreateInstance)nextGIPA(*created_instance, "vkCreateInstance"); if (fpCreateInstance) { + VkLayerInstanceCreateInfo create_info_disp; + + create_info_disp.sType = + VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO; + create_info_disp.function = VK_LOADER_DISPATCH_CALLBACK; + + create_info_disp.u.pfnSetInstanceLoaderData = vkSetInstanceDispatch; + + create_info_disp.pNext = loader_create_info.pNext; + loader_create_info.pNext = &create_info_disp; res = fpCreateInstance(&loader_create_info, pAllocator, created_instance); } else { |
