28 error<std::runtime_error>(
31 std::source_location::current(),
32 "TextureProcessor requires a valid buffer service");
35 auto tex_buffer = std::dynamic_pointer_cast<TextureBuffer>(buffer);
42 if (!tex_buffer->is_initialized()) {
45 }
catch (
const std::exception& e) {
49 std::source_location::current(),
50 "Failed to initialize texture buffer: {}", e.what());
57 "TextureProcessor attached to {}x{} TextureBuffer",
58 tex_buffer->get_width(), tex_buffer->get_height());
97 "TextureProcessor: GPU resources initialized");
113 "TextureProcessor: uploaded {} bytes of geometry data",
115 }
catch (
const std::exception& e) {
117 "Failed to upload initial geometry: {}", e.what());
128 if (pixel_data.empty()) {
130 "TextureProcessor: no pixel data to upload (uninitialized texture)");
141 "TextureProcessor: uploaded {} bytes of pixel data", pixel_data.size());
165 "TextureProcessor: geometry updated and uploaded");
166 }
catch (
const std::exception& e) {
168 "Failed to update geometry: {}", e.what());
183 if (pixel_data.empty()) {
196 "TextureProcessor: pixel data updated ({} bytes)", pixel_data.size());
211 auto texture = loom.create_2d(
219 error<std::runtime_error>(
222 std::source_location::current(),
223 "Failed to create GPU texture via TextureLoom");
227 "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_attach(std::shared_ptr< Buffer > buffer) override
Called when this processor is attached to a buffer.
void update_geometry_if_dirty()
Regenerate quad vertices if transform changed, upload if needed.
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.
void on_detach(std::shared_ptr< Buffer > buffer) override
Called when this processor is detached from a buffer.
~TextureProcessor() override
void processing_function(std::shared_ptr< Buffer > buffer) override
The core processing function that must be implemented by derived classes.
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
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.
@ 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.