Record an already validated attachment without repeating its lookup.
829{
831
834
835 vk::Format color_format = static_cast<vk::Format>(
837
839 ? vk::Format::eD32Sfloat
840 : vk::Format::eUndefined;
841
842 auto cmd_id = foundry.begin_secondary_commands(color_format, depth_format);
843 auto cmd = foundry.get_command_buffer(cmd_id);
844
847
849 auto cmd = foundry.get_command_buffer(cmd_id);
850
851 vk::Viewport viewport {
852 0.0F,
853 static_cast<float>(
height),
854 static_cast<float>(
width),
855 -
static_cast<float>(
height),
856 0.0F,
857 1.0F
858 };
859 cmd.setViewport(0, 1, &viewport);
860
862 cmd.setScissor(0, 1, &scissor);
863 }
864
866
867 auto& engine_bindings =
buffer->get_engine_context().ssbo_bindings;
868 for (const auto& binding : engine_bindings) {
869 if (binding.set == 0 && binding.binding == 0) {
871 "Engine SSBO at binding=0 is reserved for RenderTransform UBO");
872 continue;
873 }
876 "Engine SSBO binding {} skipped: engine descriptor set not allocated", binding.binding);
877 continue;
878 }
879 foundry.update_descriptor_buffer(
881 binding.binding,
882 binding.type,
883 binding.buffer_info.buffer,
884 binding.buffer_info.offset,
885 binding.buffer_info.range);
886 }
887
888 auto& descriptor_bindings =
buffer->get_pipeline_context().descriptor_buffer_bindings;
889 if (!descriptor_bindings.empty()) {
890 for (const auto& binding : descriptor_bindings) {
892 if (!ds_index) {
894 "Descriptor set index {} out of range or reserved", binding.set);
895 continue;
896 }
897
898 foundry.update_descriptor_buffer(
900 binding.binding,
901 binding.type,
902 binding.buffer_info.buffer,
903 binding.buffer_info.offset,
904 binding.buffer_info.range);
905 }
906 }
907
910 }
911
913 flow.bind_descriptor_sets(
916 0);
917 }
918
920 flow.bind_descriptor_sets(
923 1);
924 }
925
927 if (!push_data.empty()) {
928 flow.push_constants(
930 }
931
933
934 flow.bind_vertex_buffers(cmd_id, { state.draw_source });
935
936 if (state.vertex_count > 0) {
937 if (state.draw_source->has_index_buffer()) {
938 flow.bind_index_buffer(cmd_id, state.draw_source);
941 && std::ranges::all_of(
m_runs, [
this](
const Portal::Graphics::DrawRun&
run) {
942 return run.topology == m_primitive_topology;
943 })) {
945 if (
run.vertex_count > 0) {
947 }
948 }
949 } else {
950 flow.draw(cmd_id, state.vertex_count,
m_instance_count, state.first_vertex, 0);
951 }
952 }
953
954 foundry.end_commands(cmd_id);
955
958
960 "Recorded secondary command buffer {} for window '{}'",
962}
#define MF_RT_ERROR(comp, ctx,...)
#define MF_RT_TRACE(comp, ctx,...)
std::shared_ptr< NetworkGeometryBuffer > buffer
Registry::Service::DisplayService * m_display_service
uint32_t m_instance_count
std::vector< Portal::Graphics::DrawRun > m_runs
bool on_before_execute(Portal::Graphics::CommandBufferID cmd_id, const std::shared_ptr< VKBuffer > &buffer) override
Called before each process callback.
vk::Rect2D resolve_scissor_rect(uint32_t width, uint32_t height) const noexcept
Resolve the active scissor against a live framebuffer size.
Portal::Graphics::RenderPipelineID m_pipeline_id
Portal::Graphics::DescriptorSetID m_render_transform_descriptor_set_id
std::shared_ptr< Core::Window > m_target_window
std::optional< uint32_t > resolve_ds_index(uint32_t set) const
Resolve logical descriptor set index to actual index.
std::vector< Portal::Graphics::DescriptorSetID > m_descriptor_set_ids
std::vector< uint8_t > resolve_push_constants(const std::shared_ptr< VKBuffer > &buffer) const
This processor's push constant data with buffer-staged fragments overlaid at their declared offsets.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
MAYAFLUX_API RenderFlow & get_render_flow()
Get the global render flow instance.
MAYAFLUX_API ShaderFoundry & get_shader_foundry()
Get the global shader compiler instance.
constexpr DescriptorSetID INVALID_DESCRIPTOR_SET
std::function< int(const std::shared_ptr< void > &)> get_swapchain_format
Get actual swapchain format for a window.
std::function< void(const std::shared_ptr< void > &, uint32_t &, uint32_t &)> get_swapchain_extent
Get swapchain extent for a window.