MayaFlux 1.0.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 708 of file RenderFlow.cpp.

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

+ Here is the call graph for this function: