VkDebugReportCallbackCreateInfoEXT *pCreateInfo,
const VkAllocationCallbacks *pAllocator,
VkDebugReportCallbackEXT callback) {
- VkLayerDbgFunctionNode *pNewDbgFuncNode;
+ VkLayerDbgFunctionNode *pNewDbgFuncNode = NULL;
+
#if (DEBUG_DISABLE_APP_ALLOCATORS == 1)
{
#else
if (pAllocator != NULL) {
- pNewDbgFuncNode = (VkLayerDbgFunctionNode *)pAllocator->pfnAllocation(
- pAllocator->pUserData, sizeof(VkLayerDbgFunctionNode),
- sizeof(int *), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+ pNewDbgFuncNode =
+ (VkLayerDbgFunctionNode *)pAllocator->pfnAllocation(
+ pAllocator->pUserData, sizeof(VkLayerDbgFunctionNode),
+ sizeof(int *), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
} else {
#endif
- pNewDbgFuncNode = (VkLayerDbgFunctionNode *)loader_instance_heap_alloc(
- inst, sizeof(VkLayerDbgFunctionNode),
- VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+ pNewDbgFuncNode =
+ (VkLayerDbgFunctionNode *)loader_instance_heap_alloc(
+ inst, sizeof(VkLayerDbgFunctionNode),
+ VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
}
- if (!pNewDbgFuncNode)
+ if (!pNewDbgFuncNode) {
return VK_ERROR_OUT_OF_HOST_MEMORY;
+ }
+ memset(pNewDbgFuncNode, 0, sizeof(VkLayerDbgFunctionNode));
pNewDbgFuncNode->msgCallback = callback;
pNewDbgFuncNode->pfnMsgCallback = pCreateInfo->pfnCallback;
loader_platform_thread_lock_mutex(&loader_lock);
VkResult result = inst->disp->CreateDebugReportCallbackEXT(
instance, pCreateInfo, pAllocator, pCallback);
- if (result == VK_SUCCESS) {
- result = util_CreateDebugReportCallback(inst, pCreateInfo, pAllocator,
- *pCallback);
- }
loader_platform_thread_unlock_mutex(&loader_lock);
return result;
}
struct loader_instance *inst = (struct loader_instance *)instance;
VkResult res = VK_SUCCESS;
uint32_t storage_idx;
+ VkLayerDbgFunctionNode *pNewDbgFuncNode = NULL;
#if (DEBUG_DISABLE_APP_ALLOCATORS == 1)
{
storage_idx++;
}
+ // Setup the debug report callback in the terminator since a layer may want
+ // to grab the information itself (RenderDoc) and then return back to the
+ // user callback a sub-set of the messages.
+#if (DEBUG_DISABLE_APP_ALLOCATORS == 0)
+ if (pAllocator != NULL) {
+ pNewDbgFuncNode =
+ (VkLayerDbgFunctionNode *)pAllocator->pfnAllocation(
+ pAllocator->pUserData, sizeof(VkLayerDbgFunctionNode),
+ sizeof(int *), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+ } else {
+#else
+ {
+#endif
+ pNewDbgFuncNode =
+ (VkLayerDbgFunctionNode *)loader_instance_heap_alloc(
+ inst, sizeof(VkLayerDbgFunctionNode),
+ VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+ }
+ if (!pNewDbgFuncNode) {
+ return VK_ERROR_OUT_OF_HOST_MEMORY;
+ }
+ memset(pNewDbgFuncNode, 0, sizeof(VkLayerDbgFunctionNode));
+
+ pNewDbgFuncNode->msgCallback = *pCallback;
+ pNewDbgFuncNode->pfnMsgCallback = pCreateInfo->pfnCallback;
+ pNewDbgFuncNode->msgFlags = pCreateInfo->flags;
+ pNewDbgFuncNode->pUserData = pCreateInfo->pUserData;
+ pNewDbgFuncNode->pNext = inst->DbgFunctionHead;
+ inst->DbgFunctionHead = pNewDbgFuncNode;
+
/* roll back on errors */
if (icd) {
storage_idx = 0;