MayaFlux 0.5.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 817 of file ShaderFoundry.cpp.

820{
821 auto& cmd_manager = m_backend->get_command_manager();
822
824
825 vk::CommandBuffer cmd = cmd_manager.allocate_command_buffer(vk::CommandBufferLevel::eSecondary);
826
827 vk::CommandBufferInheritanceRenderingInfo inheritance_rendering;
828 inheritance_rendering.colorAttachmentCount = 1;
829 inheritance_rendering.pColorAttachmentFormats = &color_format;
830 inheritance_rendering.depthAttachmentFormat = depth_format;
831 inheritance_rendering.rasterizationSamples = vk::SampleCountFlagBits::e1;
832
833 vk::CommandBufferInheritanceInfo inheritance_info;
834 inheritance_info.pNext = &inheritance_rendering;
835
836 vk::CommandBufferBeginInfo begin_info;
837 begin_info.flags = vk::CommandBufferUsageFlagBits::eRenderPassContinue | vk::CommandBufferUsageFlagBits::eOneTimeSubmit;
838 begin_info.pInheritanceInfo = &inheritance_info;
839
840 cmd.begin(begin_info);
841
842 CommandBufferState& state = m_command_buffers[id];
843 state.cmd = cmd;
844 state.type = CommandBufferType::GRAPHICS;
845 state.level = CommandBufferLevel::SECONDARY;
846 state.is_active = true;
847
848 return id;
849}
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.