fix bad realloc

submit_rewrite
cosmonaut 2022-01-17 21:28:25 -08:00
parent 80fdf09d86
commit c5a689c6d6
1 changed files with 5 additions and 3 deletions

View File

@ -6300,7 +6300,9 @@ static void VULKAN_INTERNAL_MaybeExpandTransferBuffer(
nextStagingSize *= 2; nextStagingSize *= 2;
} }
commandBuffer->transferBuffers = SDL_realloc(commandBuffer->transferBuffers, sizeof(VulkanTransferBuffer*) * commandBuffer->transferBufferCount); commandBuffer->transferBuffers = SDL_realloc(commandBuffer->transferBuffers, sizeof(VulkanTransferBuffer*) * (commandBuffer->transferBufferCount + 1));
commandBuffer->transferBuffers[commandBuffer->transferBufferCount] = SDL_malloc(sizeof(VulkanTransferBuffer));
commandBuffer->transferBuffers[commandBuffer->transferBufferCount]->offset = 0; commandBuffer->transferBuffers[commandBuffer->transferBufferCount]->offset = 0;
commandBuffer->transferBuffers[commandBuffer->transferBufferCount]->buffer = VULKAN_INTERNAL_CreateBuffer( commandBuffer->transferBuffers[commandBuffer->transferBufferCount]->buffer = VULKAN_INTERNAL_CreateBuffer(
@ -8579,7 +8581,7 @@ static void VULKAN_Submit(
if (present) if (present)
{ {
/* Wait for the previous submission to complete */ /* Wait for the previous submission to complete */
if (renderer->usedFenceCount) if (renderer->usedFenceCount > 0)
{ {
vulkanResult = renderer->vkWaitForFences( vulkanResult = renderer->vkWaitForFences(
renderer->logicalDevice, renderer->logicalDevice,