Clear GPU memory pointer later;

This commit is contained in:
bjorn 2022-11-27 20:51:11 -08:00
parent 72ecd9cb04
commit e2c73edabb
1 changed files with 2 additions and 1 deletions

View File

@ -2580,6 +2580,8 @@ static gpu_memory* gpu_allocate(gpu_memory_type type, VkMemoryRequirements info,
memory->handle = NULL; memory->handle = NULL;
return NULL; return NULL;
} }
} else {
memory->pointer = NULL;
} }
allocator->block = memory; allocator->block = memory;
@ -2597,7 +2599,6 @@ static gpu_memory* gpu_allocate(gpu_memory_type type, VkMemoryRequirements info,
static void gpu_release(gpu_memory* memory) { static void gpu_release(gpu_memory* memory) {
if (memory && --memory->refs == 0) { if (memory && --memory->refs == 0) {
condemn(memory->handle, VK_OBJECT_TYPE_DEVICE_MEMORY); condemn(memory->handle, VK_OBJECT_TYPE_DEVICE_MEMORY);
memory->pointer = NULL;
memory->handle = NULL; memory->handle = NULL;
for (uint32_t i = 0; i < COUNTOF(state.allocators); i++) { for (uint32_t i = 0; i < COUNTOF(state.allocators); i++) {