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

◆ on_attach()

void MayaFlux::Buffers::TextureProcessor::on_attach ( std::shared_ptr< Buffer )
overrideprotectedvirtual

Called when this processor is attached to a buffer.

Parameters
bufferBuffer this processor is being attached to

Provides an opportunity for the processor to initialize buffer-specific state, allocate resources, or perform validation. With expanded processor capabilities, this method can also:

  • Analyze Buffer Characteristics: Examine data type, size, and format requirements
  • Select Optimal Backend: Choose the most appropriate processing backend for the buffer
  • Initialize Hardware Resources: Set up GPU contexts, CUDA streams, or other acceleration
  • Configure Processing Parameters: Adapt algorithm parameters to buffer characteristics
  • Establish Processing Strategy: Determine whether to use sequential or parallel execution
  • Validate Compatibility: Ensure the processor can handle the buffer's data type and format

Default implementation does nothing, but derived classes should override this method to leverage the full capabilities of the expanded processor architecture.

Reimplemented from MayaFlux::Buffers::BufferProcessor.

Definition at line 20 of file TextureProcessor.cpp.

21{
22 if (!m_buffer_service) {
24 .get_service<Registry::Service::BufferService>();
25 }
26
27 if (!m_buffer_service) {
28 error<std::runtime_error>(
31 std::source_location::current(),
32 "TextureProcessor requires a valid buffer service");
33 }
34
35 auto tex_buffer = std::dynamic_pointer_cast<TextureBuffer>(buffer);
36 if (!tex_buffer) {
37 return;
38 }
39
40 m_texture_buffer = tex_buffer;
41
42 if (!tex_buffer->is_initialized()) {
43 try {
45 } catch (const std::exception& e) {
49 std::source_location::current(),
50 "Failed to initialize texture buffer: {}", e.what());
51 }
52 }
53
55
57 "TextureProcessor attached to {}x{} TextureBuffer",
58 tex_buffer->get_width(), tex_buffer->get_height());
59}
#define MF_INFO(comp, ctx,...)
void initialize_gpu_resources()
Initialize all GPU resources:
std::shared_ptr< TextureBuffer > m_texture_buffer
Registry::Service::BufferService * m_buffer_service
Definition VKBuffer.hpp:468
Interface * get_service()
Query for a backend service.
static BackendRegistry & instance()
Get the global registry instance.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
void error_rethrow(Component component, Context context, std::source_location location=std::source_location::current(), std::string_view additional_context="")
Catch and log an exception, then rethrow it.
@ Buffers
Buffers, Managers, processors and processing chains.
std::function< void(const std::shared_ptr< void > &)> initialize_buffer
Initialize a buffer object.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MayaFlux::Registry::BackendRegistry::get_service(), MayaFlux::Registry::Service::BufferService::initialize_buffer, initialize_gpu_resources(), MayaFlux::Registry::BackendRegistry::instance(), MayaFlux::Buffers::VKBufferProcessor::m_buffer_service, m_texture_buffer, and MF_INFO.

+ Here is the call graph for this function: