Fix memory issue in VulkanContext::SwapBuffers

This commit is contained in:
Attila Uygun 2023-08-08 00:02:20 +02:00
parent 26514fd142
commit 10823cd459
1 changed files with 3 additions and 14 deletions

View File

@ -1536,24 +1536,13 @@ bool VulkanContext::SwapBuffers() {
/*pWaitSemaphores*/
(separate_present_queue_) ? &image_ownership_semaphores_[frame_index_]
: &draw_complete_semaphores_[frame_index_],
/*swapchainCount*/ 0,
/*pSwapchain*/ nullptr,
/*pImageIndices*/ nullptr,
/*swapchainCount*/ 1,
/*pSwapchains*/ &window_.swapchain,
/*pImageIndices*/ &window_.current_buffer,
/*pResults*/ nullptr,
};
VkSwapchainKHR* swapchains = (VkSwapchainKHR*)alloca(sizeof(VkSwapchainKHR*));
uint32_t* pImageIndices = (uint32_t*)alloca(sizeof(uint32_t*));
present.pSwapchains = swapchains;
present.pImageIndices = pImageIndices;
DCHECK(window_.swapchain != VK_NULL_HANDLE);
swapchains[present.swapchainCount] = window_.swapchain;
pImageIndices[present.swapchainCount] = window_.current_buffer;
present.swapchainCount++;
err = QueuePresentKHR(present_queue_, &present);
frame_index_ += 1;