@@ -1515,36 +1515,43 @@ lvk::SubmitHandle lvk::VulkanImmediateCommands::submit(const CommandBufferWrappe
15151515 LVK_ASSERT (wrapper.isEncoding_ );
15161516 VK_ASSERT (vkEndCommandBuffer (wrapper.cmdBuf_ ));
15171517
1518- const VkPipelineStageFlags waitStageMasks[] = {VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_PIPELINE_STAGE_ALL_COMMANDS_BIT};
1519- VkSemaphore waitSemaphores[] = {VK_NULL_HANDLE, VK_NULL_HANDLE};
1518+ VkSemaphoreSubmitInfo waitSemaphores[] = {{}, {}};
15201519 uint32_t numWaitSemaphores = 0 ;
1521- if (waitSemaphore_) {
1520+ if (waitSemaphore_. semaphore ) {
15221521 waitSemaphores[numWaitSemaphores++] = waitSemaphore_;
15231522 }
1524- if (lastSubmitSemaphore_) {
1523+ if (lastSubmitSemaphore_. semaphore ) {
15251524 waitSemaphores[numWaitSemaphores++] = lastSubmitSemaphore_;
15261525 }
1526+ VkSemaphoreSubmitInfo signalSemaphores[] = {
1527+ VkSemaphoreSubmitInfo{.sType = VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO,
1528+ .semaphore = wrapper.semaphore_ ,
1529+ .stageMask = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT},
1530+ };
15271531
1528- LVK_PROFILER_ZONE (" vkQueueSubmit ()" , LVK_PROFILER_COLOR_SUBMIT);
1532+ LVK_PROFILER_ZONE (" vkQueueSubmit2 ()" , LVK_PROFILER_COLOR_SUBMIT);
15291533#if LVK_VULKAN_PRINT_COMMANDS
1530- LLOGL (" %p vkQueueSubmit ()\n\n " , wrapper.cmdBuf_ );
1534+ LLOGL (" %p vkQueueSubmit2 ()\n\n " , wrapper.cmdBuf_ );
15311535#endif // LVK_VULKAN_PRINT_COMMANDS
1532- const VkSubmitInfo si = {
1533- .sType = VK_STRUCTURE_TYPE_SUBMIT_INFO,
1534- .waitSemaphoreCount = numWaitSemaphores,
1535- .pWaitSemaphores = numWaitSemaphores ? waitSemaphores : nullptr ,
1536- .pWaitDstStageMask = waitStageMasks,
1537- .commandBufferCount = 1u ,
1538- .pCommandBuffers = &wrapper.cmdBuf_ ,
1539- .signalSemaphoreCount = 1u ,
1540- .pSignalSemaphores = &wrapper.semaphore_ ,
1536+ const VkCommandBufferSubmitInfo bufferSI = {
1537+ .sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_SUBMIT_INFO,
1538+ .commandBuffer = wrapper.cmdBuf_ ,
1539+ };
1540+ const VkSubmitInfo2 si = {
1541+ .sType = VK_STRUCTURE_TYPE_SUBMIT_INFO_2,
1542+ .waitSemaphoreInfoCount = numWaitSemaphores,
1543+ .pWaitSemaphoreInfos = waitSemaphores,
1544+ .commandBufferInfoCount = 1u ,
1545+ .pCommandBufferInfos = &bufferSI,
1546+ .signalSemaphoreInfoCount = 1u ,
1547+ .pSignalSemaphoreInfos = signalSemaphores,
15411548 };
1542- VK_ASSERT (vkQueueSubmit (queue_, 1u , &si, wrapper.fence_ ));
1549+ VK_ASSERT (vkQueueSubmit2 (queue_, 1u , &si,wrapper.fence_ ));
15431550 LVK_PROFILER_ZONE_END ();
15441551
1545- lastSubmitSemaphore_ = wrapper.semaphore_ ;
1552+ lastSubmitSemaphore_. semaphore = wrapper.semaphore_ ;
15461553 lastSubmitHandle_ = wrapper.handle_ ;
1547- waitSemaphore_ = VK_NULL_HANDLE;
1554+ waitSemaphore_. semaphore = VK_NULL_HANDLE;
15481555
15491556 // reset
15501557 const_cast <CommandBufferWrapper&>(wrapper).isEncoding_ = false ;
@@ -1559,13 +1566,13 @@ lvk::SubmitHandle lvk::VulkanImmediateCommands::submit(const CommandBufferWrappe
15591566}
15601567
15611568void lvk::VulkanImmediateCommands::waitSemaphore (VkSemaphore semaphore) {
1562- LVK_ASSERT (waitSemaphore_ == VK_NULL_HANDLE);
1569+ LVK_ASSERT (waitSemaphore_. semaphore == VK_NULL_HANDLE);
15631570
1564- waitSemaphore_ = semaphore;
1571+ waitSemaphore_. semaphore = semaphore;
15651572}
15661573
15671574VkSemaphore lvk::VulkanImmediateCommands::acquireLastSubmitSemaphore () {
1568- return std::exchange (lastSubmitSemaphore_, VK_NULL_HANDLE);
1575+ return std::exchange (lastSubmitSemaphore_. semaphore , VK_NULL_HANDLE);
15691576}
15701577
15711578VkFence lvk::VulkanImmediateCommands::getVkFence (lvk::SubmitHandle handle) const {
0 commit comments