Skip to content

Commit 283fc00

Browse files
committed
WIP
1 parent d7c4aff commit 283fc00

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

extensions/pl_graphics_vulkan.c

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3815,12 +3815,21 @@ pl_present(plCommandBuffer* ptCmdBuffer, const plSubmitInfo* ptSubmitInfo, plSwa
38153815
tResult = vkQueuePresentKHR(ptDevice->tPresentQueue, &tPresentInfo);
38163816
if (tResult == VK_SUBOPTIMAL_KHR || tResult == VK_ERROR_OUT_OF_DATE_KHR)
38173817
{
3818-
const VkSemaphoreCreateInfo tSemaphoreInfo = {
3819-
.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
3820-
};
3821-
vkDestroySemaphore(ptDevice->tLogicalDevice, ptSwaps[0]->sbtRenderFinish[ptSwaps[0]->uCurrentImageIndex], gptGraphics->ptAllocationCallbacks);
3822-
PL_VULKAN(vkCreateSemaphore(ptDevice->tLogicalDevice, &tSemaphoreInfo, gptGraphics->ptAllocationCallbacks, &ptSwaps[0]->sbtRenderFinish[ptSwaps[0]->uCurrentImageIndex]));
3823-
pl__set_vulkan_object_name(ptDevice, (uint64_t)&ptSwaps[0]->sbtRenderFinish[ptSwaps[0]->uCurrentImageIndex], VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT, "new render finish");
3818+
vkDeviceWaitIdle(ptDevice->tLogicalDevice);
3819+
3820+
for (uint32_t i = 0; i < ptSubmitInfo->uSignalSemaphoreCount; i++)
3821+
{
3822+
const VkSemaphoreSignalInfo tSignalInfo = {
3823+
.sType = VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO,
3824+
.semaphore = ptSubmitInfo->atSignalSempahores[i]->tSemaphore,
3825+
.value = ptSubmitInfo->auSignalSemaphoreValues[i],
3826+
.pNext = NULL,
3827+
};
3828+
vkSignalSemaphore(ptDevice->tLogicalDevice, &tSignalInfo);
3829+
}
3830+
3831+
3832+
38243833
pl_sb_push(ptCmdBuffer->ptPool->sbtPendingCommandBuffers, ptCmdBuffer->tCmdBuffer);
38253834
pl_end_cpu_sample(gptProfile, 0);
38263835
return false;
@@ -5199,8 +5208,13 @@ pl__create_swapchain(uint32_t uWidth, uint32_t uHeight, plSwapchain* ptSwap)
51995208
.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO
52005209
};
52015210

5202-
const uint32_t uNewSemaphoreCount = ptSwap->uImageCount - pl_sb_size(ptSwap->sbtRenderFinish);
5203-
for (uint32_t i = 0; i < uNewSemaphoreCount; i++)
5211+
for (uint32_t i = 0; i < pl_sb_size(ptSwap->sbtRenderFinish); i++)
5212+
{
5213+
vkDestroySemaphore(ptDevice->tLogicalDevice, ptSwap->sbtRenderFinish[i], gptGraphics->ptAllocationCallbacks);
5214+
}
5215+
pl_sb_reset(ptSwap->sbtRenderFinish);
5216+
5217+
for (uint32_t i = 0; i < ptSwap->uImageCount; i++)
52045218
{
52055219
pl_sb_add(ptSwap->sbtRenderFinish);
52065220
PL_VULKAN(vkCreateSemaphore(ptDevice->tLogicalDevice, &tSemaphoreInfo, gptGraphics->ptAllocationCallbacks, &pl_sb_top(ptSwap->sbtRenderFinish)));

0 commit comments

Comments
 (0)