22 const std::string& name,
23 const std::shared_ptr<Nodes::GpuSync::TextureNode>& node,
24 const std::shared_ptr<Core::VKImage>& texture)
27 error<std::invalid_argument>(
30 std::source_location::current(),
31 "Cannot bind null texture node '{}'", name);
35 error<std::invalid_argument>(
38 std::source_location::current(),
39 "Cannot bind texture node '{}' to null VKImage", name);
42 size_t texture_size =
static_cast<size_t>(node->get_width())
43 *
static_cast<size_t>(node->get_height())
49 .gpu_texture = texture
53 "Bound texture node '{}' ({}x{}, {} bytes)",
54 name, node->get_width(), node->get_height(), texture_size);
61 "Attempted to unbind non-existent texture node '{}'", name);
64 "Unbound texture node '{}'", name);
70 std::vector<std::string> names;
73 names.push_back(name);
78std::optional<NodeTextureProcessor::TextureBinding>
94 auto staging_buffer = std::dynamic_pointer_cast<VKBuffer>(buffer);
95 if (!staging_buffer) {
97 "NodeTextureProcessor requires VKBuffer for staging");
104 if (!binding.node->needs_gpu_update()) {
106 "Texture '{}' unchanged, skipping upload", name);
110 auto pixels = binding.node->get_pixel_buffer();
112 if (pixels.empty()) {
114 "Texture node '{}' has empty pixel buffer, skipping upload", name);
121 pixels.size_bytes());
123 binding.node->clear_gpu_update_flag();
126 "Uploaded texture '{}' ({} bytes)", name, pixels.size_bytes());
143 error<std::runtime_error>(
146 std::source_location::current(),
147 "TextureProcessor requires a valid buffer service");
153 }
catch (
const std::exception& e) {
157 std::source_location::current(),
158 "Failed to initialize texture buffer: {}", e.what());
169 "NodeTextureProcessor: no attached buffer or empty vertex data");
181 auto pixels = binding.node->get_pixel_buffer();
182 if (!pixels.empty()) {
183 loom.upload_data(binding.gpu_texture, pixels.data(), pixels.size_bytes());
188 "NodeTextureProcessor: uploaded {} bytes of vertex geometry",
#define MF_ERROR(comp, ctx,...)
#define MF_RT_WARN(comp, ctx,...)
#define MF_RT_ERROR(comp, ctx,...)
#define MF_TRACE(comp, ctx,...)
#define MF_WARN(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
ProcessingToken m_processing_token
std::shared_ptr< NodeTextureBuffer > m_attached_buffer
void bind_texture_node(const std::string &name, const std::shared_ptr< Nodes::GpuSync::TextureNode > &node, const std::shared_ptr< Core::VKImage > &texture)
Bind a TextureNode to a GPU texture.
void on_detach(const std::shared_ptr< Buffer > &buffer) override
Called when this processor is detached from a buffer.
std::unordered_map< std::string, TextureBinding > m_bindings
void processing_function(const std::shared_ptr< Buffer > &buffer) override
Process all texture uploads.
void unbind_texture_node(const std::string &name)
Remove a texture binding.
void initialize_gpu_resources()
std::vector< std::string > get_binding_names() const
Get all binding names.
std::optional< TextureBinding > get_binding(const std::string &name) const
Get a specific binding.
void on_attach(const std::shared_ptr< Buffer > &buffer) override
Called when this processor is attached to a buffer.
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::shared_ptr< Nodes::GpuSync::TextureNode > node
Represents a TextureNode → GPU texture binding.
std::function< void(const std::shared_ptr< void > &)> initialize_buffer
Initialize a buffer object.
Backend buffer management service interface.