Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion include/vsg/app/Presentation.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ namespace vsg
VkResult present();

Windows windows;
Semaphores waitSemaphores; // taken from RecordAndSubmitTasks.signalSemaphores

ref_ptr<Queue> queue; // assign in application for GraphicsQueue from device
};
Expand Down
1 change: 0 additions & 1 deletion include/vsg/app/RecordAndSubmitTask.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ namespace vsg
Windows windows;
Semaphores waitSemaphores; // assign in application setup
CommandGraphs commandGraphs; // assign in application setup
Semaphores signalSemaphores; // connect to Presentation.waitSemaphores

ref_ptr<TransferTask> transferTask; // data is transferred for this frame

Expand Down
1 change: 1 addition & 0 deletions include/vsg/app/Window.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ namespace vsg
ref_ptr<ImageView> imageView;
ref_ptr<Framebuffer> framebuffer;
ref_ptr<Semaphore> imageAvailableSemaphore;
ref_ptr<Semaphore> renderFinishedSemaphore;
};

using Frames = std::vector<Frame>;
Expand Down
7 changes: 3 additions & 4 deletions src/vsg/app/Presentation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ VkResult Presentation::present()
//debug("Presentation::present()");

std::vector<VkSemaphore> vk_semaphores;
for (auto& semaphore : waitSemaphores)
{
vk_semaphores.emplace_back(*(semaphore));
}

std::vector<VkSwapchainKHR> vk_swapchains;
std::vector<uint32_t> indices;
Expand All @@ -34,6 +30,9 @@ VkResult Presentation::present()
{
vk_swapchains.emplace_back(*(window->getOrCreateSwapchain()));
indices.emplace_back(static_cast<uint32_t>(imageIndex));

auto& renderFinishedSemaphore = window->frame(imageIndex).renderFinishedSemaphore;
vk_semaphores.push_back(*renderFinishedSemaphore);
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/vsg/app/RecordAndSubmitTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ VkResult RecordAndSubmitTask::finish(ref_ptr<RecordedCommandBuffers> recordedCom
if (earlyDataTransferredSemaphore) transferTask->assignTransferConsumedCompletedSemaphore(TransferTask::TRANSFER_BEFORE_RECORD_TRAVERSAL, earlyTransferConsumerCompletedSemaphore);
if (lateDataTransferredSemaphore) transferTask->assignTransferConsumedCompletedSemaphore(TransferTask::TRANSFER_AFTER_RECORD_TRAVERSAL, lateTransferConsumerCompletedSemaphore);

current_fence->dependentSemaphores().clear();

for (auto& window : windows)
{
auto imageIndex = window->imageIndex();
Expand All @@ -224,6 +226,10 @@ VkResult RecordAndSubmitTask::finish(ref_ptr<RecordedCommandBuffers> recordedCom

vk_waitSemaphores.emplace_back(*semaphore);
vk_waitStages.emplace_back(semaphore->pipelineStageFlags());

auto& renderFinishedSemaphore = window->frame(imageIndex).renderFinishedSemaphore;
vk_signalSemaphores.emplace_back(*renderFinishedSemaphore);
current_fence->dependentSemaphores().push_back(renderFinishedSemaphore);
}

for (auto& semaphore : waitSemaphores)
Expand All @@ -232,12 +238,6 @@ VkResult RecordAndSubmitTask::finish(ref_ptr<RecordedCommandBuffers> recordedCom
vk_waitStages.emplace_back(semaphore->pipelineStageFlags());
}

current_fence->dependentSemaphores() = signalSemaphores;
for (auto& semaphore : signalSemaphores)
{
vk_signalSemaphores.emplace_back(*(semaphore));
}

if (earlyDataTransferredSemaphore)
{
vk_signalSemaphores.emplace_back(earlyTransferConsumerCompletedSemaphore->vk());
Expand Down
4 changes: 0 additions & 4 deletions src/vsg/app/Viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,13 +524,10 @@ void Viewer::assignRecordAndSubmitTaskAndPresentation(CommandGraphs in_commandGr

Windows activeWindows(findWindows.windows.begin(), findWindows.windows.end());

auto renderFinishedSemaphore = vsg::Semaphore::create(device);

// set up Submission with CommandBuffer and signals
auto recordAndSubmitTask = vsg::RecordAndSubmitTask::create(device, numBuffers);
recordAndSubmitTask->commandGraphs = commandGraphs;
recordAndSubmitTask->databasePager = databasePager;
recordAndSubmitTask->signalSemaphores.emplace_back(renderFinishedSemaphore);
recordAndSubmitTask->windows = activeWindows;
recordAndSubmitTask->queue = mainQueue;
recordAndSubmitTasks.emplace_back(recordAndSubmitTask);
Expand All @@ -541,7 +538,6 @@ void Viewer::assignRecordAndSubmitTaskAndPresentation(CommandGraphs in_commandGr
if (instrumentation) recordAndSubmitTask->assignInstrumentation(instrumentation);

auto presentation = vsg::Presentation::create();
presentation->waitSemaphores.emplace_back(renderFinishedSemaphore);
presentation->windows = activeWindows;
presentation->queue = device->getQueue(deviceQueueFamily.presentFamily);
presentations.emplace_back(presentation);
Expand Down
3 changes: 3 additions & 0 deletions src/vsg/app/Window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,9 @@ VkResult Window::acquireNextImage(uint64_t timeout)
// the acquired image's semaphore must be available now so make it the new _availableSemaphore and set its entry to the one to use for the next frame by swapping ref_ptr<>'s
_availableSemaphore.swap(_frames[nextImageIndex].imageAvailableSemaphore);

if (!_frames[nextImageIndex].renderFinishedSemaphore)
_frames[nextImageIndex].renderFinishedSemaphore = vsg::Semaphore::create(_device);

// shift up previous frame indices
for (size_t i = _indices.size() - 1; i > 0; --i)
{
Expand Down
Loading