MayaFlux 0.2.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ end_rendering()

void MayaFlux::Portal::Graphics::RenderFlow::end_rendering ( CommandBufferID  cmd_id,
const std::shared_ptr< Core::Window > &  window 
)

End dynamic rendering.

Parameters
cmd_idCommand buffer ID
windowTarget window

Definition at line 593 of file RenderFlow.cpp.

596{
597 auto cmd = m_shader_foundry->get_command_buffer(cmd_id);
598 if (!cmd) {
600 "Invalid command buffer ID: {}", cmd_id);
601 return;
602 }
603
604 cmd.endRendering();
605
606 auto it = m_window_associations.find(window);
607 if (it == m_window_associations.end() || !it->second.swapchain_image) {
609 "No swapchain image tracked for window '{}'",
610 window->get_create_info().title);
611 return;
612 }
613
614 vk::ImageMemoryBarrier post_barrier {};
615 post_barrier.oldLayout = vk::ImageLayout::eColorAttachmentOptimal;
616 post_barrier.newLayout = vk::ImageLayout::ePresentSrcKHR;
617 post_barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
618 post_barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
619 post_barrier.image = it->second.swapchain_image;
620 post_barrier.subresourceRange.aspectMask = vk::ImageAspectFlagBits::eColor;
621 post_barrier.subresourceRange.baseMipLevel = 0;
622 post_barrier.subresourceRange.levelCount = 1;
623 post_barrier.subresourceRange.baseArrayLayer = 0;
624 post_barrier.subresourceRange.layerCount = 1;
625 post_barrier.srcAccessMask = vk::AccessFlagBits::eColorAttachmentWrite;
626 post_barrier.dstAccessMask = vk::AccessFlagBits::eNone;
627
628 cmd.pipelineBarrier(
629 vk::PipelineStageFlagBits::eColorAttachmentOutput,
630 vk::PipelineStageFlagBits::eBottomOfPipe,
631 vk::DependencyFlags {},
632 0, nullptr,
633 0, nullptr,
634 1, &post_barrier);
635
636 it->second.swapchain_image = nullptr;
637
639 "Ended dynamic rendering for window '{}'",
640 window->get_create_info().title);
641}
#define MF_ERROR(comp, ctx,...)
#define MF_RT_ERROR(comp, ctx,...)
#define MF_TRACE(comp, ctx,...)
std::unordered_map< std::shared_ptr< Core::Window >, WindowRenderAssociation > m_window_associations
vk::CommandBuffer get_command_buffer(CommandBufferID cmd_id)
Get Vulkan command buffer handle from CommandBufferID.
@ Rendering
GPU rendering operations (graphics pipeline, frame rendering)
@ Portal
High-level user-facing API layer.

References MayaFlux::Portal::Graphics::ShaderFoundry::get_command_buffer(), m_shader_foundry, m_window_associations, MF_ERROR, MF_RT_ERROR, MF_TRACE, MayaFlux::Journal::Portal, and MayaFlux::Journal::Rendering.

+ Here is the call graph for this function: