MayaFlux 1.0.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 963 of file ShaderFoundry.cpp.

966{
967 auto& cmd_manager = m_backend->get_command_manager();
968
970
971 vk::CommandBuffer cmd = cmd_manager.allocate_command_buffer(vk::CommandBufferLevel::eSecondary);
972
973 vk::CommandBufferInheritanceRenderingInfo inheritance_rendering;
974 inheritance_rendering.colorAttachmentCount = 1;
975 inheritance_rendering.pColorAttachmentFormats = &color_format;
976 inheritance_rendering.depthAttachmentFormat = depth_format;
977 inheritance_rendering.rasterizationSamples = vk::SampleCountFlagBits::e1;
978
979 vk::CommandBufferInheritanceInfo inheritance_info;
980 inheritance_info.pNext = &inheritance_rendering;
981
982 vk::CommandBufferBeginInfo begin_info;
983 begin_info.flags = vk::CommandBufferUsageFlagBits::eRenderPassContinue | vk::CommandBufferUsageFlagBits::eOneTimeSubmit;
984 begin_info.pInheritanceInfo = &inheritance_info;
985
986 cmd.begin(begin_info);
987
988 CommandBufferState& state = m_command_buffers[id];
989 state.cmd = cmd;
990 state.type = CommandBufferType::GRAPHICS;
991 state.level = CommandBufferLevel::SECONDARY;
992 state.is_active = true;
993
994 return id;
995}
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.