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

◆ processing_function()

void MayaFlux::Buffers::RenderProcessor::processing_function ( std::shared_ptr< Buffer buffer)
overrideprotectedvirtual

The core processing function that must be implemented by derived classes.

Parameters
bufferBuffer to process

This method is where the actual transformation logic is implemented. It should contain the algorithmic details of how the buffer's data is transformed, analyzed, or processed. The implementation can utilize any backend capabilities available to the processor, including:

  • Parallel Processing: Using multi-threading or GPU compute for large datasets
  • Data Transformations: Applying mathematical operations, filters, or effects
  • Feature Extraction: Analyzing data characteristics for further processing

Derived classes must override this method to provide specific processing behavior.

Implements MayaFlux::Buffers::BufferProcessor.

Definition at line 225 of file RenderProcessor.cpp.

226{
227 auto vk_buffer = std::dynamic_pointer_cast<VKBuffer>(buffer);
228 if (!vk_buffer || !m_target_window) {
229 return;
230 }
231
232 if (m_buffer_info.find(vk_buffer) == m_buffer_info.end()) {
233 if (vk_buffer->has_vertex_layout()) {
234 auto vertex_layout = vk_buffer->get_vertex_layout();
235 if (vertex_layout.has_value()) {
236 m_buffer_info[vk_buffer] = {
237 .semantic_layout = vertex_layout.value(),
238 .use_reflection = false
239 };
240 }
241 }
242 }
243
244 if (!m_target_window->is_graphics_registered()) {
245 return;
246 }
247
249 initialize_pipeline(buffer);
250 }
251
253 return;
254 }
255
256 auto vertex_layout = vk_buffer->get_vertex_layout();
257 if (!vertex_layout.has_value()) {
259 "VKBuffer has no vertex layout set. Use buffer->set_vertex_layout()");
260 return;
261 }
262
263 if (vertex_layout->vertex_count == 0) {
265 "Vertex layout has zero vertices, skipping draw");
266 return;
267 }
268
269 if (vertex_layout->attributes.empty()) {
271 "Vertex layout has no attributes");
272 return;
273 }
274
275 vk_buffer->set_pipeline_window(m_render_pipeline_id, m_target_window);
276
277 auto& foundry = Portal::Graphics::get_shader_foundry();
279
280 auto cmd_id = foundry.begin_commands(Portal::Graphics::ShaderFoundry::CommandBufferType::GRAPHICS);
281
282 flow.begin_render_pass(cmd_id, m_target_window);
283
284 uint32_t width = 0, height = 0;
286
287 if (width > 0 && height > 0) {
288 auto cmd = foundry.get_command_buffer(cmd_id);
289
290 vk::Viewport viewport { 0.0F, 0.0F, static_cast<float>(width), static_cast<float>(height), 0.0F, 1.0F };
291 cmd.setViewport(0, 1, &viewport);
292
293 vk::Rect2D scissor { { 0, 0 }, { width, height } };
294 cmd.setScissor(0, 1, &scissor);
295 }
296
297 flow.bind_pipeline(cmd_id, m_render_pipeline_id);
298
299 if (!m_descriptor_set_ids.empty()) {
300 flow.bind_descriptor_sets(cmd_id, m_render_pipeline_id, m_descriptor_set_ids);
301 }
302
303 flow.bind_vertex_buffers(cmd_id, { vk_buffer });
304
305 flow.draw(cmd_id, vertex_layout->vertex_count);
306
307 flow.end_render_pass(cmd_id);
308
309 vk_buffer->set_pipeline_command(m_render_pipeline_id, cmd_id);
310}
#define MF_RT_WARN(comp, ctx,...)
#define MF_RT_ERROR(comp, ctx,...)
void initialize_pipeline(const std::shared_ptr< Buffer > &buffer) override
std::unordered_map< std::shared_ptr< VKBuffer >, VertexInfo > m_buffer_info
Registry::Service::DisplayService * m_display_service
std::shared_ptr< Core::Window > m_target_window
Portal::Graphics::RenderPipelineID m_render_pipeline_id
std::vector< Portal::Graphics::DescriptorSetID > m_descriptor_set_ids
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
constexpr RenderPipelineID INVALID_RENDER_PIPELINE
MAYAFLUX_API RenderFlow & get_render_flow()
Get the global render flow instance.
MAYAFLUX_API ShaderFoundry & get_shader_foundry()
Get the global shader compiler instance.
std::function< void(const std::shared_ptr< void > &, uint32_t &, uint32_t &)> get_swapchain_extent
Get swapchain extent for a window.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Portal::Graphics::get_render_flow(), MayaFlux::Portal::Graphics::get_shader_foundry(), MayaFlux::Registry::Service::DisplayService::get_swapchain_extent, MayaFlux::Portal::Graphics::ShaderFoundry::GRAPHICS, initialize_pipeline(), MayaFlux::Portal::Graphics::INVALID_RENDER_PIPELINE, m_buffer_info, MayaFlux::Buffers::ShaderProcessor::m_descriptor_set_ids, m_display_service, MayaFlux::Buffers::ShaderProcessor::m_needs_pipeline_rebuild, m_render_pipeline_id, m_target_window, MF_RT_ERROR, and MF_RT_WARN.

+ Here is the call graph for this function: