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

◆ processing_function()

void MayaFlux::Buffers::TextureBindingsProcessor::processing_function ( std::shared_ptr< Buffer buffer)
overridevirtual

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 86 of file TextureBindingsProcessor.cpp.

87{
88 if (m_bindings.empty()) {
89 return;
90 }
91
92 auto vk_buffer = std::dynamic_pointer_cast<VKBuffer>(buffer);
93 if (!vk_buffer) {
95 "TextureBindingsProcessor requires VKBuffer, got different buffer type");
96 return;
97 }
98
99 bool attached_is_host_visible = vk_buffer->is_host_visible();
100
101 for (auto& [name, binding] : m_bindings) {
102 if (!binding.node->needs_gpu_update()) {
104 "Texture '{}' unchanged, skipping upload", name);
105 continue;
106 }
107
108 auto pixels = binding.node->get_pixel_buffer();
109
110 if (pixels.empty()) {
112 "Texture node '{}' has empty pixel buffer, skipping upload", name);
113 continue;
114 }
115
117 pixels.data(),
118 pixels.size_bytes(),
119 binding.gpu_texture,
120 binding.staging_buffer);
121
122 binding.node->clear_gpu_update_flag();
123 }
124
125 if (!m_bindings.empty()) {
126 auto& first_binding = m_bindings.begin()->second;
127
128 bool attached_is_target = false;
129 for (const auto& [name, binding] : m_bindings) {
130 if (binding.gpu_texture == vk_buffer) {
131 attached_is_target = true;
132 break;
133 }
134 }
135
136 if (!attached_is_target) {
137 auto pixels = first_binding.node->get_pixel_buffer();
138
139 if (!pixels.empty()) {
140 std::shared_ptr<VKBuffer> staging = attached_is_host_visible ? nullptr : first_binding.staging_buffer;
141
143 pixels.data(),
144 pixels.size_bytes(),
145 vk_buffer,
146 staging);
147 }
148 }
149 }
150}
#define MF_RT_WARN(comp, ctx,...)
#define MF_RT_ERROR(comp, ctx,...)
#define MF_TRACE(comp, ctx,...)
std::unordered_map< std::string, TextureBinding > m_bindings
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.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, m_bindings, MF_RT_ERROR, MF_RT_WARN, MF_TRACE, and MayaFlux::Buffers::upload_to_gpu().

+ Here is the call graph for this function: