74 std::unordered_map<std::string, std::any>
metadata;
112 void clear()
override;
123 std::vector<Kakshya::DataVariant> get_data();
134 void set_data(
const std::vector<Kakshya::DataVariant>& data);
149 void resize(
size_t new_size,
bool preserve_data =
false);
163 void process_default()
override;
173 void set_default_processor(
const std::shared_ptr<BufferProcessor>& processor)
override;
179 std::shared_ptr<Buffers::BufferProcessor> get_default_processor()
const override;
185 std::shared_ptr<Buffers::BufferProcessingChain> get_processing_chain()
override;
192 void set_processing_chain(
const std::shared_ptr<BufferProcessingChain>& chain,
bool force =
false)
override;
209 bool expected =
false;
210 return m_is_processing.compare_exchange_strong(expected,
true,
211 std::memory_order_acquire, std::memory_order_relaxed);
219 m_is_processing.store(
false, std::memory_order_release);
228 return m_is_processing.load(std::memory_order_acquire);
241 vk::Format get_format()
const;
259 const std::vector<Kakshya::DataDimension>&
get_dimensions()
const {
return m_dimensions; }
271 void set_buffer(vk::Buffer buffer) { m_resources.buffer = buffer; }
274 void set_memory(vk::DeviceMemory memory) { m_resources.memory = memory; }
282 m_resources = resources;
294 return m_usage == Usage::STAGING || m_usage == Usage::UNIFORM;
301 vk::BufferUsageFlags get_usage_flags()
const;
307 vk::MemoryPropertyFlags get_memory_properties()
const;
313 void mark_dirty_range(
size_t offset,
size_t size);
316 void mark_invalid_range(
size_t offset,
size_t size);
319 std::vector<std::pair<size_t, size_t>> get_and_clear_dirty_ranges();
322 std::vector<std::pair<size_t, size_t>> get_and_clear_invalid_ranges();
333 m_window_pipelines[id] = window;
342 auto it = m_window_pipelines.find(
id);
343 if (it != m_window_pipelines.end()) {
354 return !m_window_pipelines.empty();
363 return m_window_pipelines;
372 m_pipeline_commands[pipeline_id] = cmd_id;
380 auto it = m_pipeline_commands.find(pipeline_id);
381 return it != m_pipeline_commands.end() ? it->second : 0;
389 m_pipeline_commands.clear();
418 m_vertex_layout.reset();
421 std::shared_ptr<Buffer> clone_to(uint8_t dest_desc)
override;
432 std::shared_ptr<VKBuffer> clone_to(Usage usage);
450 size_t m_size_bytes {};
460 bool m_has_data {
true };
461 bool m_needs_removal {};
462 bool m_process_default {
true };
463 bool m_internal_usage {};
484 void infer_dimensions_from_data(
size_t byte_count);
static MayaFlux::Nodes::ProcessingToken token
Central computational transformation interface for continuous buffer processing.
Backend-agnostic interface for sequential data storage and transformation.
Registry::Service::ComputeService * m_compute_service
void initialize_compute_service()
void initialize_buffer_service()
Registry::Service::BufferService * m_buffer_service
std::vector< std::pair< size_t, size_t > > m_dirty_ranges
std::unordered_map< RenderPipelineID, std::shared_ptr< Core::Window > > get_render_pipelines() const
Get all render pipelines associated with this buffer.
void * get_mapped_ptr() const
Get mapped host pointer (nullptr if not host-visible or unmapped)
CommandBufferID get_pipeline_command(RenderPipelineID pipeline_id) const
Get recorded command buffer for a pipeline.
ProcessingToken m_processing_token
void set_pipeline_command(RenderPipelineID pipeline_id, CommandBufferID cmd_id)
Store recorded command buffer for a pipeline.
PipelineContext m_pipeline_context
std::unordered_map< RenderPipelineID, std::shared_ptr< Core::Window > > m_window_pipelines
std::optional< Kakshya::VertexLayout > m_vertex_layout
std::vector< Kakshya::DataDimension > m_dimensions
std::shared_ptr< Buffers::BufferProcessingChain > m_processing_chain
bool is_processing() const override
Query whether the buffer is currently being processed.
bool has_render_pipeline() const
Check if this buffer has a rendering pipeline configured.
bool needs_removal() const override
Checks if the buffer should be removed from processing chains.
bool has_data_for_cycle() const override
Checks if the buffer has data for the current processing cycle.
void clear_pipeline_commands()
Clear all recorded commands (called after presentation)
Usage get_usage() const
Retrieve the declared usage intent.
Kakshya::DataModality get_modality() const
Get the buffer's semantic modality.
const PipelineContext & get_pipeline_context() const
Access the pipeline context for custom metadata (const)
std::vector< std::pair< size_t, size_t > > m_invalid_ranges
void set_mapped_ptr(void *ptr)
Set mapped host pointer (for host-visible allocations)
vk::DeviceSize get_size_bytes() const
std::optional< Kakshya::VertexLayout > get_vertex_layout() const
Get vertex layout if set.
VKBufferResources m_resources
PipelineContext & get_pipeline_context()
Access the pipeline context for custom metadata (non-const)
void clear_vertex_layout()
Clear vertex layout.
void set_memory(vk::DeviceMemory memory)
Set device memory handle after backend allocation.
vk::Buffer & get_buffer()
Get VkBuffer handle (VK_NULL_HANDLE if not registered)
bool needs_default_processing() override
Checks if the buffer should undergo default processing.
std::shared_ptr< Buffers::BufferProcessor > m_default_processor
virtual void setup_processors(ProcessingToken token)
Setup processors with a processing token.
void set_pipeline_window(RenderPipelineID id, const std::shared_ptr< Core::Window > &window)
Associate this buffer with a window for rendering.
bool is_initialized() const
Check whether Vulkan handles are present (buffer registered)
void enforce_default_processing(bool should_process) override
Controls whether the buffer should use default processing.
bool is_internal_only() const override
Check whether this buffer is for internal engine usage.
void set_buffer(vk::Buffer buffer)
Set VkBuffer handle after backend allocation.
bool has_vertex_layout() const
Check if this buffer has vertex layout configured.
const std::vector< Kakshya::DataDimension > & get_dimensions() const
Get the inferred data dimensions for the buffer contents.
std::atomic< bool > m_is_processing
const VKBufferResources & get_buffer_resources()
Get all buffer resources at once.
Kakshya::DataModality m_modality
void release_processing() override
Release previously acquired processing lock.
void set_buffer_resources(const VKBufferResources &resources)
Set all buffer resources at once.
void force_internal_usage(bool internal) override
Set whether this buffer is for internal engine usage.
size_t get_size() const
Get current logical size in bytes.
void mark_for_removal() override
Marks the buffer for removal from processing chains.
std::unordered_map< RenderPipelineID, CommandBufferID > m_pipeline_commands
bool is_host_visible() const
Whether this VKBuffer should be host-visible.
void mark_for_processing(bool has_data) override
Marks the buffer's data availability for the current processing cycle.
std::shared_ptr< Core::Window > get_pipeline_window(RenderPipelineID id) const
Get the window associated with this buffer.
bool try_acquire_processing() override
Try to acquire processing lock for this buffer.
Vulkan-backed buffer wrapper used in processing chains.
ProcessingToken
Bitfield enum defining processing characteristics and backend requirements for buffer operations.
uint64_t RenderPipelineID
DataModality
Data modality types for cross-modal analysis.
std::vector< Portal::Graphics::DescriptorBindingInfo > descriptor_buffer_bindings
std::vector< uint8_t > push_constant_staging
std::unordered_map< std::string, std::any > metadata
Context shared with BufferProcessors during pipeline execution.
Complete description of vertex data layout in a buffer.
Backend buffer management service interface.
Backend compute shader and pipeline service interface.