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

◆ setup_rendering()

void MayaFlux::Buffers::NodeTextureBuffer::setup_rendering ( const RenderConfig config)

Setup rendering with RenderProcessor.

Parameters
configRendering configuration

Configures the buffer for direct rendering to screen. The GPU texture will be bound and drawn automatically.

Definition at line 85 of file NodeTextureBuffer.cpp.

86{
87 if (!m_render_processor) {
88 ShaderConfig shader_config { config.vertex_shader };
89 shader_config.bindings[config.default_texture_binding] = ShaderBinding(
90 0, 0, vk::DescriptorType::eCombinedImageSampler);
91
92 uint32_t binding_index = 1;
93 for (const auto& [name, _] : config.additional_textures) {
94 shader_config.bindings[name] = ShaderBinding(
95 0, binding_index++, vk::DescriptorType::eCombinedImageSampler);
96 }
97
98 m_render_processor = std::make_shared<RenderProcessor>(shader_config);
99 }
100
101 m_render_processor->set_fragment_shader(config.fragment_shader);
102 m_render_processor->set_target_window(config.target_window);
103 m_render_processor->set_primitive_topology(config.topology);
104
105 m_render_processor->bind_texture(config.default_texture_binding, get_gpu_texture());
106
107 for (const auto& [name, texture] : config.additional_textures) {
108 m_render_processor->bind_texture(name, texture);
109 }
110
111 get_processing_chain()->add_final_processor(m_render_processor, shared_from_this());
112
114 "NodeTextureBuffer '{}' rendering configured: shader={}, topology={}",
115 m_binding_name, config.fragment_shader,
116 static_cast<int>(config.topology));
117}
#define MF_INFO(comp, ctx,...)
std::shared_ptr< Core::VKImage > get_gpu_texture() const
Get the GPU-resident texture (VKImage)
std::shared_ptr< RenderProcessor > m_render_processor
std::shared_ptr< Buffers::BufferProcessingChain > get_processing_chain() override
Access the buffer's processing chain.
Definition VKBuffer.cpp:277
@ Init
Engine/subsystem initialization.
@ Buffers
Buffers, Managers, processors and processing chains.

References MayaFlux::Buffers::NodeTextureBuffer::RenderConfig::additional_textures, MayaFlux::Journal::Buffers, MayaFlux::Buffers::NodeTextureBuffer::RenderConfig::default_texture_binding, MayaFlux::Buffers::NodeTextureBuffer::RenderConfig::fragment_shader, get_gpu_texture(), MayaFlux::Buffers::VKBuffer::get_processing_chain(), MayaFlux::Journal::Init, m_binding_name, m_render_processor, MF_INFO, MayaFlux::Buffers::NodeTextureBuffer::RenderConfig::target_window, MayaFlux::Buffers::NodeTextureBuffer::RenderConfig::topology, and MayaFlux::Buffers::NodeTextureBuffer::RenderConfig::vertex_shader.

+ Here is the call graph for this function: