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

◆ begin_secondary_commands()

CommandBufferID MayaFlux::Portal::Graphics::ShaderFoundry::begin_secondary_commands ( vk::Format  color_format,
vk::Format  depth_format = vk::Format::eUndefined 
)

Begin recording a secondary command buffer for dynamic rendering.

Parameters
color_formatFormat of the color attachment (from swapchain)
Returns
Command buffer ID

With dynamic rendering, secondary buffers don't need render pass objects. They only need to know the attachment formats they'll render to.

Definition at line 737 of file ShaderFoundry.cpp.

740{
741 auto& cmd_manager = m_backend->get_command_manager();
742
744
745 vk::CommandBuffer cmd = cmd_manager.allocate_command_buffer(vk::CommandBufferLevel::eSecondary);
746
747 vk::CommandBufferInheritanceRenderingInfo inheritance_rendering;
748 inheritance_rendering.colorAttachmentCount = 1;
749 inheritance_rendering.pColorAttachmentFormats = &color_format;
750 inheritance_rendering.depthAttachmentFormat = depth_format;
751 inheritance_rendering.rasterizationSamples = vk::SampleCountFlagBits::e1;
752
753 vk::CommandBufferInheritanceInfo inheritance_info;
754 inheritance_info.pNext = &inheritance_rendering;
755
756 vk::CommandBufferBeginInfo begin_info;
757 begin_info.flags = vk::CommandBufferUsageFlagBits::eRenderPassContinue | vk::CommandBufferUsageFlagBits::eOneTimeSubmit;
758 begin_info.pInheritanceInfo = &inheritance_info;
759
760 cmd.begin(begin_info);
761
762 CommandBufferState& state = m_command_buffers[id];
763 state.cmd = cmd;
764 state.type = CommandBufferType::GRAPHICS;
765 state.level = CommandBufferLevel::SECONDARY;
766 state.is_active = true;
767
768 return id;
769}
vk::CommandBuffer cmd
std::unordered_map< CommandBufferID, CommandBufferState > m_command_buffers
std::shared_ptr< Core::VulkanBackend > m_backend

References cmd, MayaFlux::Portal::Graphics::ShaderFoundry::CommandBufferState::cmd, GRAPHICS, MayaFlux::Portal::Graphics::ShaderFoundry::CommandBufferState::is_active, MayaFlux::Portal::Graphics::ShaderFoundry::CommandBufferState::level, m_backend, m_command_buffers, m_next_command_id, SECONDARY, and MayaFlux::Portal::Graphics::ShaderFoundry::CommandBufferState::type.