33 error<std::runtime_error>(
36 std::source_location::current(),
37 "TextureProcessor requires a valid buffer service");
40 auto tex_buffer = std::dynamic_pointer_cast<TextureBuffer>(buffer);
47 if (!tex_buffer->is_initialized()) {
50 }
catch (
const std::exception& e) {
54 std::source_location::current(),
55 "Failed to initialize texture buffer: {}", e.what());
62 "TextureProcessor attached to {}x{} TextureBuffer",
63 tex_buffer->get_width(), tex_buffer->get_height());
103 "TextureProcessor: GPU resources initialized");
119 "TextureProcessor: uploaded {} bytes of geometry data",
121 }
catch (
const std::exception& e) {
123 "Failed to upload initial geometry: {}", e.what());
134 if (pixel_data.empty()) {
136 "TextureProcessor: no pixel data to upload (uninitialized texture)");
147 "TextureProcessor: uploaded {} bytes of pixel data", pixel_data.size());
171 "TextureProcessor: geometry updated and uploaded");
172 }
catch (
const std::exception& e) {
174 "Failed to update geometry: {}", e.what());
189 if (pixel_data.empty()) {
216 "TextureProcessor: pixel data updated ({} bytes)", pixel_data.size());
231 auto texture = loom.create_2d(
239 error<std::runtime_error>(
242 std::source_location::current(),
243 "Failed to create GPU texture via TextureLoom");
247 "TextureProcessor: created GPU VKImage {}x{}",
#define MF_INFO(comp, ctx,...)
#define MF_ERROR(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
ProcessingToken m_processing_token
std::shared_ptr< Core::VKImage > create_gpu_texture()
Create VKImage for texture storage.
void on_detach(const std::shared_ptr< Buffer > &buffer) override
Called when this processor is detached from a buffer.
void update_geometry_if_dirty()
Regenerate quad vertices if transform changed, upload if needed.
void processing_function(const std::shared_ptr< Buffer > &buffer) override
The core processing function that must be implemented by derived classes.
void initialize_gpu_resources()
Initialize all GPU resources:
void update_pixels_if_dirty()
Re-upload pixels to GPU if they changed.
void upload_initial_pixels()
Upload initial pixel data to GPU texture.
~TextureProcessor() override
void on_attach(const std::shared_ptr< Buffer > &buffer) override
Called when this processor is attached to a buffer.
void generate_quad_vertices(std::vector< uint8_t > &out_bytes)
Generate quad vertices respecting current transform Handles both default quad and custom vertices.
std::shared_ptr< TextureBuffer > m_texture_buffer
std::shared_ptr< Buffers::VKBuffer > m_stream_staging
Persistent host-visible staging buffer for streaming pixel uploads.
void upload_initial_geometry()
Upload initial quad geometry based on default or custom vertices.
void initialize_buffer_service()
Registry::Service::BufferService * m_buffer_service
Interface * get_service()
Query for a backend service.
static BackendRegistry & instance()
Get the global registry instance.
std::shared_ptr< VKBuffer > create_image_staging_buffer(size_t size)
Allocate a persistent host-visible staging buffer sized for repeated streaming uploads to an image of...
@ GRAPHICS_BACKEND
Standard graphics processing backend configuration.
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.
MAYAFLUX_API TextureLoom & get_texture_manager()
Get the global texture manager instance.
std::function< void(const std::shared_ptr< void > &)> initialize_buffer
Initialize a buffer object.
Backend buffer management service interface.