Move barriers and frame submit to synchronization2
Image barriers now carry their own stage masks and are recorded with pipelineBarrier2, so barriers flushed together no longer share the union of their stages. AccessState uses the 64-bit stage and access flags, and the frame submit uses submit2. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -86,22 +86,28 @@ void RenderContext::endFrame() {
|
||||
FrameData& frame = this->frames[this->currentFrameIndex];
|
||||
frame.commandBuffer.end();
|
||||
|
||||
vk::Semaphore waitSemaphore = frame.imageAvailable.get();
|
||||
vk::Semaphore signalSemaphore =
|
||||
this->renderFinishedSemaphores.at(this->currentImageIndex).get();
|
||||
vk::PipelineStageFlags waitStage = SWAPCHAIN_ACQUIRE_STAGE;
|
||||
vk::CommandBuffer commandBuffer = frame.commandBuffer;
|
||||
|
||||
vk::SubmitInfo submitInfo{};
|
||||
submitInfo.waitSemaphoreCount = 1;
|
||||
submitInfo.pWaitSemaphores = &waitSemaphore;
|
||||
submitInfo.pWaitDstStageMask = &waitStage;
|
||||
submitInfo.commandBufferCount = 1;
|
||||
submitInfo.pCommandBuffers = &commandBuffer;
|
||||
submitInfo.signalSemaphoreCount = 1;
|
||||
submitInfo.pSignalSemaphores = &signalSemaphore;
|
||||
vk::SemaphoreSubmitInfo waitInfo{};
|
||||
waitInfo.semaphore = frame.imageAvailable.get();
|
||||
waitInfo.stageMask = SWAPCHAIN_ACQUIRE_STAGE;
|
||||
|
||||
this->device.getGraphicsQueue().submit(submitInfo, frame.inFlight.get());
|
||||
// Present has no pipeline stage to wait on, so signal once everything in
|
||||
// the submission is done.
|
||||
vk::SemaphoreSubmitInfo signalInfo{};
|
||||
signalInfo.semaphore = signalSemaphore;
|
||||
signalInfo.stageMask = vk::PipelineStageFlagBits2::eAllCommands;
|
||||
|
||||
vk::CommandBufferSubmitInfo commandBufferInfo{};
|
||||
commandBufferInfo.commandBuffer = frame.commandBuffer;
|
||||
|
||||
vk::SubmitInfo2 submitInfo{};
|
||||
submitInfo.setWaitSemaphoreInfos(waitInfo);
|
||||
submitInfo.setCommandBufferInfos(commandBufferInfo);
|
||||
submitInfo.setSignalSemaphoreInfos(signalInfo);
|
||||
|
||||
this->device.getGraphicsQueue().submit2(submitInfo, frame.inFlight.get());
|
||||
|
||||
vk::Result result = this->swapchain->present(
|
||||
this->device.getPresentQueue(), this->currentImageIndex, signalSemaphore);
|
||||
|
||||
Reference in New Issue
Block a user