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

◆ processing_function()

void MayaFlux::Buffers::GeometryWriteProcessor::processing_function ( const 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 62 of file GeometryWriteProcessor.cpp.

63{
64 auto vk = std::dynamic_pointer_cast<VKBuffer>(buffer);
65 if (!vk) {
67 "GeometryWriteProcessor attached to non-VKBuffer");
68 return;
69 }
70
71 if (m_vertices_dirty.test(std::memory_order_acquire)) {
72 m_vertices_dirty.clear(std::memory_order_release);
74
75 if (m_active_vertices.has_value()) {
76 const size_t required = m_active_vertices->bytes.size();
77 const size_t available = vk->get_size_bytes();
78
79 if (required > available) {
80 vk->resize(static_cast<size_t>((float)required * 1.5F), false);
81 if (m_staging) {
82 m_staging = create_staging_buffer(vk->get_size_bytes());
83 }
84 }
85
86 upload_to_gpu(m_active_vertices->bytes.data(),
87 std::min<size_t>(required, vk->get_size_bytes()),
88 vk, m_staging);
89
90 vk->set_vertex_layout(m_active_vertices->layout);
91 return;
92 }
93 }
94
95 if (!m_data_dirty.test(std::memory_order_acquire)) {
96 return;
97 }
98
99 m_data_dirty.clear(std::memory_order_release);
100 std::swap(m_active_data, m_pending_data);
101
102 if (!m_active_data.has_value()) {
103 return;
104 }
105
106 std::optional<Kakshya::VertexAccess> access;
107 switch (m_mode) {
110 break;
113 break;
116 break;
117 }
118
119 if (!access.has_value()) {
121 "GeometryWriteProcessor: as_vertex_access returned nullopt — unsupported variant type");
122 return;
123 }
124
125 upload_resizing(access->data_ptr, access->byte_count, vk, m_staging);
126
127 vk->set_vertex_layout(access->layout);
128}
#define MF_RT_ERROR(comp, ctx,...)
std::optional< Kakshya::DataVariant > m_pending_data
std::optional< Kakshya::DataVariant > m_active_data
std::optional< VertexSnapshot > m_pending_vertices
std::optional< VertexSnapshot > m_active_vertices
void upload_resizing(const void *data, size_t size, const std::shared_ptr< VKBuffer > &target, const std::shared_ptr< VKBuffer > &staging, float growth_factor)
Upload size bytes to target, growing both buffers first if needed.
std::shared_ptr< VKBuffer > create_staging_buffer(size_t size)
Create staging buffer for transfers.
@ LINE
Interpret vertex data as Nodes::LineVertex.
@ MESH
Interpret vertex data as Nodes::MeshVertex.
@ POINT
Interpret vertex data as Nodes::PointVertex.
void upload_to_gpu(const void *data, size_t size, const std::shared_ptr< VKBuffer > &target, const std::shared_ptr< VKBuffer > &staging)
Upload raw data to GPU buffer (auto-detects host-visible vs device-local)
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
std::optional< VertexAccess > as_line_vertex_access(const DataVariant &variant, const VertexAccessConfig &config)
Convert DataVariant to line-vertex-compatible bytes.
std::optional< VertexAccess > as_mesh_vertex_access(const DataVariant &variant, const VertexAccessConfig &config)
Convert DataVariant to mesh-vertex-compatible bytes.
std::optional< VertexAccess > as_point_vertex_access(const DataVariant &variant, const VertexAccessConfig &config)
Convert DataVariant to point-vertex-compatible bytes.

References MayaFlux::Kakshya::as_line_vertex_access(), MayaFlux::Kakshya::as_mesh_vertex_access(), MayaFlux::Kakshya::as_point_vertex_access(), MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Buffers::create_staging_buffer(), MayaFlux::Buffers::LINE, m_active_data, m_active_vertices, m_config, m_data_dirty, m_mode, m_pending_data, m_pending_vertices, m_staging, m_vertices_dirty, MayaFlux::Buffers::MESH, MF_RT_ERROR, MayaFlux::Buffers::POINT, MayaFlux::Buffers::upload_resizing(), and MayaFlux::Buffers::upload_to_gpu().

+ Here is the call graph for this function: