MayaFlux 0.4.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 703 of file RenderFlow.cpp.

706{
708 if (!cmd) {
710 "Invalid command buffer ID: {}", cmd_id);
711 return;
712 }
713
714 cmd.endRendering();
715
716 auto it = m_window_associations.find(window);
717 if (it == m_window_associations.end() || !it->second.swapchain_image) {
719 "No swapchain image tracked for window '{}'",
720 window->get_create_info().title);
721 return;
722 }
723
724 vk::ImageMemoryBarrier post_barrier {};
725 post_barrier.oldLayout = vk::ImageLayout::eColorAttachmentOptimal;
726 post_barrier.newLayout = vk::ImageLayout::ePresentSrcKHR;
727 post_barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
728 post_barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
729 post_barrier.image = it->second.swapchain_image;
730 post_barrier.subresourceRange.aspectMask = vk::ImageAspectFlagBits::eColor;
731 post_barrier.subresourceRange.baseMipLevel = 0;
732 post_barrier.subresourceRange.levelCount = 1;
733 post_barrier.subresourceRange.baseArrayLayer = 0;
734 post_barrier.subresourceRange.layerCount = 1;
735 post_barrier.srcAccessMask = vk::AccessFlagBits::eColorAttachmentWrite;
736 post_barrier.dstAccessMask = vk::AccessFlagBits::eNone;
737
738 cmd.pipelineBarrier(
739 vk::PipelineStageFlagBits::eColorAttachmentOutput,
740 vk::PipelineStageFlagBits::eBottomOfPipe,
741 vk::DependencyFlags {},
742 0, nullptr,
743 0, nullptr,
744 1, &post_barrier);
745
746 it->second.swapchain_image = nullptr;
747
749 "Ended dynamic rendering for window '{}'",
750 window->get_create_info().title);
751}
#define MF_ERROR(comp, ctx,...)
#define MF_RT_ERROR(comp, ctx,...)
#define MF_TRACE(comp, ctx,...)
vk::CommandBuffer cmd
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 cmd, 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: