Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions loader/debug_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugUtilsMessengerEXT(VkInstanc
VkResult res = VK_SUCCESS;
VkLayerDbgFunctionNode *new_dbg_func_node = NULL;
uint32_t next_index = 0;
bool index_reserved = false;

uint32_t *pNextIndex = loader_instance_heap_alloc(inst, sizeof(uint32_t), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (NULL == pNextIndex) {
Expand All @@ -186,6 +187,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugUtilsMessengerEXT(VkInstanc
if (res != VK_SUCCESS) {
goto out;
}
index_reserved = true;

for (struct loader_icd_term *icd_term = inst->icd_terms; icd_term != NULL; icd_term = icd_term->next) {
if (icd_term->debug_utils_messenger_list.list == NULL) {
Expand Down Expand Up @@ -245,11 +247,11 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugUtilsMessengerEXT(VkInstanc
}
}
}
if (inst->debug_utils_messengers_list.list &&
inst->debug_utils_messengers_list.capacity > (*pNextIndex) * sizeof(struct loader_used_object_status)) {
inst->debug_utils_messengers_list.list[*pNextIndex].status = VK_FALSE;
if (index_reserved && inst->debug_utils_messengers_list.list &&
inst->debug_utils_messengers_list.capacity > next_index * sizeof(struct loader_used_object_status)) {
inst->debug_utils_messengers_list.list[next_index].status = VK_FALSE;
if (NULL != pAllocator) {
inst->debug_utils_messengers_list.list[*pNextIndex].allocation_callbacks = *pAllocator;
inst->debug_utils_messengers_list.list[next_index].allocation_callbacks = *pAllocator;
}
}
loader_free_with_instance_fallback(pAllocator, inst, new_dbg_func_node);
Expand Down Expand Up @@ -453,6 +455,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallbackEXT(VkInstanc
VkResult res = VK_SUCCESS;
VkLayerDbgFunctionNode *new_dbg_func_node = NULL;
uint32_t next_index = 0;
bool index_reserved = false;

uint32_t *pNextIndex = loader_instance_heap_alloc(inst, sizeof(uint32_t), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
if (NULL == pNextIndex) {
Expand All @@ -464,6 +467,7 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallbackEXT(VkInstanc
if (res != VK_SUCCESS) {
goto out;
}
index_reserved = true;

for (struct loader_icd_term *icd_term = inst->icd_terms; icd_term != NULL; icd_term = icd_term->next) {
if (icd_term->debug_report_callback_list.list == NULL) {
Expand Down Expand Up @@ -523,11 +527,11 @@ VKAPI_ATTR VkResult VKAPI_CALL terminator_CreateDebugReportCallbackEXT(VkInstanc
}
}
}
if (inst->debug_report_callbacks_list.list &&
inst->debug_report_callbacks_list.capacity > (*pNextIndex) * sizeof(struct loader_used_object_status)) {
inst->debug_report_callbacks_list.list[*pNextIndex].status = VK_FALSE;
if (index_reserved && inst->debug_report_callbacks_list.list &&
inst->debug_report_callbacks_list.capacity > next_index * sizeof(struct loader_used_object_status)) {
inst->debug_report_callbacks_list.list[next_index].status = VK_FALSE;
if (NULL != pAllocator) {
inst->debug_report_callbacks_list.list[*pNextIndex].allocation_callbacks = *pAllocator;
inst->debug_report_callbacks_list.list[next_index].allocation_callbacks = *pAllocator;
}
}
loader_free_with_instance_fallback(pAllocator, inst, new_dbg_func_node);
Expand Down
Loading