diff options
| author | Mark Young <marky@lunarg.com> | 2016-06-30 11:03:59 -0600 |
|---|---|---|
| committer | Mark Young <marky@lunarg.com> | 2016-06-30 11:03:59 -0600 |
| commit | 4adf813386db856e56c147bc3faf1bf3425930ce (patch) | |
| tree | 70ffd14e81b87331a482c3fc152e9f5efe0a1cd0 /loader/debug_report.c | |
| parent | 34b0129554078322aef9ec03eb1733fc9c825f7b (diff) | |
| download | usermoji-4adf813386db856e56c147bc3faf1bf3425930ce.tar.xz | |
Revert "loader: GH370 - re-enable allocator usage"
This reverts commit 0860f9dbac51b241a9690d23b53db14f307b0181.
Diffstat (limited to 'loader/debug_report.c')
| -rw-r--r-- | loader/debug_report.c | 83 |
1 files changed, 20 insertions, 63 deletions
diff --git a/loader/debug_report.c b/loader/debug_report.c index 4da1413a..c339c701 100644 --- a/loader/debug_report.c +++ b/loader/debug_report.c @@ -66,16 +66,12 @@ util_CreateDebugReportCallback(struct loader_instance *inst, const VkAllocationCallbacks *pAllocator, VkDebugReportCallbackEXT callback) { VkLayerDbgFunctionNode *pNewDbgFuncNode; -#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); + sizeof(int *), VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); } else { -#endif - pNewDbgFuncNode = (VkLayerDbgFunctionNode *)loader_instance_heap_alloc( + pNewDbgFuncNode = (VkLayerDbgFunctionNode *)loader_heap_alloc( inst, sizeof(VkLayerDbgFunctionNode), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT); } @@ -141,14 +137,10 @@ void util_DestroyDebugReportCallback(struct loader_instance *inst, pPrev->pNext = pTrav->pNext; if (inst->DbgFunctionHead == pTrav) inst->DbgFunctionHead = pTrav->pNext; -#if (DEBUG_DISABLE_APP_ALLOCATORS == 1) - { -#else if (pAllocator != NULL) { pAllocator->pfnFree(pAllocator->pUserData, pTrav); } else { -#endif - loader_instance_heap_free(inst, pTrav); + loader_heap_free(inst, pTrav); } break; } @@ -167,8 +159,6 @@ VkResult util_CopyDebugReportCreateInfos( uint32_t *num_callbacks, VkDebugReportCallbackCreateInfoEXT **infos, VkDebugReportCallbackEXT **callbacks) { uint32_t n = *num_callbacks = 0; - VkDebugReportCallbackCreateInfoEXT *pInfos = NULL; - VkDebugReportCallbackEXT *pCallbacks = NULL; // NOTE: The loader is not using pAllocator, and so this function doesn't // either. @@ -186,38 +176,17 @@ VkResult util_CopyDebugReportCreateInfos( return VK_SUCCESS; } -// 2nd, allocate memory for each VkDebugReportCallbackCreateInfoEXT: -#if (DEBUG_DISABLE_APP_ALLOCATORS == 1) - { -#else - if (pAllocator != NULL) { - pInfos = *infos = - ((VkDebugReportCallbackCreateInfoEXT *)pAllocator->pfnAllocation( - pAllocator->pUserData, - n * sizeof(VkDebugReportCallbackCreateInfoEXT), sizeof(void *), - VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); - } else { -#endif - pInfos = *infos = ((VkDebugReportCallbackCreateInfoEXT *)malloc( + // 2nd, allocate memory for each VkDebugReportCallbackCreateInfoEXT: + VkDebugReportCallbackCreateInfoEXT *pInfos = *infos = + ((VkDebugReportCallbackCreateInfoEXT *)malloc( n * sizeof(VkDebugReportCallbackCreateInfoEXT))); - } if (!pInfos) { return VK_ERROR_OUT_OF_HOST_MEMORY; } -// 3rd, allocate memory for a unique handle for each callback: -#if (DEBUG_DISABLE_APP_ALLOCATORS == 1) - { -#else - if (pAllocator != NULL) { - pCallbacks = *callbacks = - ((VkDebugReportCallbackEXT *)pAllocator->pfnAllocation( - pAllocator->pUserData, n * sizeof(VkDebugReportCallbackEXT), - sizeof(void *), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); - } else { -#endif - pCallbacks = *callbacks = ((VkDebugReportCallbackEXT *)malloc( - n * sizeof(VkDebugReportCallbackEXT))); - } + // 3rd, allocate memory for a unique handle for each callback: + VkDebugReportCallbackEXT *pCallbacks = *callbacks = + ((VkDebugReportCallbackEXT *)malloc(n * + sizeof(VkDebugReportCallbackEXT))); if (!pCallbacks) { free(pInfos); return VK_ERROR_OUT_OF_HOST_MEMORY; @@ -312,21 +281,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallback( VkResult res = VK_SUCCESS; uint32_t storage_idx; -#if (DEBUG_DISABLE_APP_ALLOCATORS == 1) - { -#else - if (pAllocator != NULL) { - icd_info = ((VkDebugReportCallbackEXT *)pAllocator->pfnAllocation( - pAllocator->pUserData, - inst->total_icd_count * sizeof(VkDebugReportCallbackEXT), - sizeof(void *), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT)); - memset(icd_info, 0, - inst->total_icd_count * sizeof(VkDebugReportCallbackEXT)); - } else { -#endif - icd_info = - calloc(sizeof(VkDebugReportCallbackEXT), inst->total_icd_count); - } + icd_info = calloc(sizeof(VkDebugReportCallbackEXT), inst->total_icd_count); if (!icd_info) { return VK_ERROR_OUT_OF_HOST_MEMORY; } @@ -373,9 +328,10 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallback( * This is the instance chain terminator function * for DestroyDebugReportCallback */ -VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugReportCallback( - VkInstance instance, VkDebugReportCallbackEXT callback, - const VkAllocationCallbacks *pAllocator) { +VKAPI_ATTR void VKAPI_CALL +terminator_DestroyDebugReportCallback(VkInstance instance, + VkDebugReportCallbackEXT callback, + const VkAllocationCallbacks *pAllocator) { uint32_t storage_idx; VkDebugReportCallbackEXT *icd_info; const struct loader_icd *icd; @@ -400,10 +356,11 @@ VKAPI_ATTR void VKAPI_CALL terminator_DestroyDebugReportCallback( * This is the instance chain terminator function * for DebugReportMessage */ -VKAPI_ATTR void VKAPI_CALL terminator_DebugReportMessage( - VkInstance instance, VkDebugReportFlagsEXT flags, - VkDebugReportObjectTypeEXT objType, uint64_t object, size_t location, - int32_t msgCode, const char *pLayerPrefix, const char *pMsg) { +VKAPI_ATTR void VKAPI_CALL +terminator_DebugReportMessage(VkInstance instance, VkDebugReportFlagsEXT flags, + VkDebugReportObjectTypeEXT objType, + uint64_t object, size_t location, int32_t msgCode, + const char *pLayerPrefix, const char *pMsg) { const struct loader_icd *icd; struct loader_instance *inst = (struct loader_instance *)instance; |
