aboutsummaryrefslogtreecommitdiff
path: root/loader/trampoline.c
diff options
context:
space:
mode:
authorCourtney Goeltzenleuchter <courtneygo@google.com>2015-12-02 15:29:33 -0700
committerJon Ashburn <jon@lunarg.com>2015-12-17 11:20:07 -0700
commit6fed229bcddf5c07eefc5a0d42841b7827189d0b (patch)
tree62e4707cbe9262bd0e15245d7630a9dec3ac6029 /loader/trampoline.c
parent24df68333a28df31316eda3dddf2939f35342068 (diff)
downloadusermoji-6fed229bcddf5c07eefc5a0d42841b7827189d0b.tar.xz
loader: utils for managing debug report events
Now need to create & destroy callbacks as part of vkCreateInstance, so refactor debug_report entries into API function and work function that can be used from the loader. Conflicts: loader/debug_report.c
Diffstat (limited to 'loader/trampoline.c')
-rw-r--r--loader/trampoline.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/loader/trampoline.c b/loader/trampoline.c
index 63574830..58a3d2fb 100644
--- a/loader/trampoline.c
+++ b/loader/trampoline.c
@@ -44,6 +44,8 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(
{
struct loader_instance *ptr_instance = NULL;
VkResult res = VK_ERROR_INITIALIZATION_FAILED;
+ VkDebugReportCallbackLUNARG instance_callback = VK_NULL_HANDLE;
+ void *pNext = (void *) pCreateInfo->pNext;
loader_platform_thread_once(&once_init, loader_initialize);
@@ -68,6 +70,17 @@ LOADER_EXPORT VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(
ptr_instance->alloc_callbacks = *pAllocator;
}
+ while (!pNext) {
+ if (((VkInstanceCreateInfo *)pNext)->sType == VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_LUNARG) {
+ instance_callback = (VkDebugReportCallbackLUNARG) ptr_instance;
+ if (util_CreateDebugReportCallback(ptr_instance, pNext, pAllocator, instance_callback)) {
+ free(ptr_instance);
+ loader_platform_thread_unlock_mutex(&loader_lock);
+ return VK_ERROR_OUT_OF_HOST_MEMORY;
+ }
+ }
+ }
+
/* Due to implicit layers need to get layer list even if
* enabledLayerNameCount == 0 and VK_INSTANCE_LAYERS is unset. For now always
* get layer list (both instance and device) via loader_layer_scan(). */