76 std::unordered_map<std::string, std::any>
metadata;
114 void clear()
override;
125 std::vector<Kakshya::DataVariant> get_data();
136 void set_data(
const std::vector<Kakshya::DataVariant>& data);
151 void resize(
size_t new_size,
bool preserve_data =
false);
165 void process_default()
override;
175 void set_default_processor(
const std::shared_ptr<BufferProcessor>& processor)
override;
181 std::shared_ptr<Buffers::BufferProcessor> get_default_processor()
const override;
187 std::shared_ptr<Buffers::BufferProcessingChain> get_processing_chain()
override;
194 void set_processing_chain(
const std::shared_ptr<BufferProcessingChain>& chain,
bool force =
false)
override;
211 bool expected =
false;
212 return m_is_processing.compare_exchange_strong(expected,
true,
213 std::memory_order_acquire, std::memory_order_relaxed);
221 m_is_processing.store(
false, std::memory_order_release);
230 return m_is_processing.load(std::memory_order_acquire);
243 vk::Format get_format()
const;
261 const std::vector<Kakshya::DataDimension>&
get_dimensions()
const {
return m_dimensions; }
273 void set_buffer(vk::Buffer buffer) { m_resources.buffer = buffer; }
276 void set_memory(vk::DeviceMemory memory) { m_resources.memory = memory; }
284 m_resources = resources;
296 return m_usage == Usage::STAGING || m_usage == Usage::UNIFORM;
303 vk::BufferUsageFlags get_usage_flags()
const;
309 vk::MemoryPropertyFlags get_memory_properties()
const;
315 void mark_dirty_range(
size_t offset,
size_t size);
318 void mark_invalid_range(
size_t offset,
size_t size);
321 std::vector<std::pair<size_t, size_t>> get_and_clear_dirty_ranges();
324 std::vector<std::pair<size_t, size_t>> get_and_clear_invalid_ranges();
335 m_window_pipelines[id] = window;
344 auto it = m_window_pipelines.find(
id);
345 if (it != m_window_pipelines.end()) {
356 return !m_window_pipelines.empty();
365 return m_window_pipelines;
374 m_pipeline_commands[pipeline_id] = cmd_id;
382 auto it = m_pipeline_commands.find(pipeline_id);
383 return it != m_pipeline_commands.end() ? it->second : 0;
391 m_pipeline_commands.clear();
420 m_vertex_layout.reset();
423 std::shared_ptr<Buffer> clone_to(uint8_t dest_desc)
override;
434 std::shared_ptr<VKBuffer> clone_to(Usage usage);
476 m_render_config = config;
477 m_render_config_dirty =
true;
504 m_render_config = config;
505 m_render_config_dirty =
false;
508 bool m_render_config_dirty {};
515 size_t m_size_bytes {};
517 bool m_needs_depth {};
526 bool m_has_data {
true };
527 bool m_needs_removal {};
528 bool m_process_default {
true };
529 bool m_internal_usage {};
550 void infer_dimensions_from_data(
size_t byte_count);
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
RenderConfig m_render_config
std::vector< std::pair< size_t, size_t > > m_dirty_ranges
bool is_render_config_dirty() const
Check if config has changed since last frame.
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.
RenderConfig get_render_config() const
Get the current render configuration.
bool has_render_pipeline() const
Check if this buffer has a rendering pipeline configured.
bool needs_depth_attachment() const
Check if this buffer requires depth attachment for rendering.
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.
void set_needs_depth_attachment(bool needs)
Mark this buffer as requiring depth testing when rendered.
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.
virtual void mark_render_config_dirty(bool is_dirty=true)
Mark config as changed (processors will detect and react)
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.
virtual void set_render_config(const RenderConfig &config)
Update the render configuration and mark as dirty.
std::atomic< bool > m_is_processing
const VKBufferResources & get_buffer_resources()
Get all buffer resources at once.
void set_default_render_config(const RenderConfig &config)
Called by derived classes to set their context-specific defaults.
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.
~VKBuffer() override
Virtual destructor.
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.
Unified rendering configuration for graphics buffers.
Backend buffer management service interface.
Backend compute shader and pipeline service interface.