MayaFlux 0.3.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
VKBuffer.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "Buffer.hpp"
4
7
9
11struct BufferService;
12struct ComputeService;
13}
14
15namespace MayaFlux::Core {
16class Window;
17}
18
19namespace MayaFlux::Buffers {
20
22 vk::Buffer buffer;
23 vk::DeviceMemory memory;
25};
26
27using RenderPipelineID = uint64_t;
28using CommandBufferID = uint64_t;
29
30/**
31 * @class VKBuffer
32 * @brief Vulkan-backed buffer wrapper used in processing chains
33 *
34 * VKBuffer is a lightweight, high-level representation of a GPU buffer used by
35 * the MayaFlux processing pipeline. It carries semantic metadata (Kakshya
36 * modalities and dimensions), integrates with the Buffer processing chain and
37 * BufferManager, and exposes Vulkan handles once the backend registers the
38 * buffer. Prior to registration the object contains no GPU resources and can
39 * be manipulated cheaply (like AudioBuffer).
40 *
41 * Responsibilities:
42 * - Store buffer size, usage intent and semantic modality
43 * - Provide inferred data dimensions for processors and pipeline inspection
44 * - Hold Vulkan handles (VkBuffer, VkDeviceMemory) assigned by graphics backend
45 * - Provide convenience helpers for common Vulkan creation flags and memory props
46 * - Integrate with BufferProcessor / BufferProcessingChain for default processing
47 *
48 * Note: Actual allocation, mapping and command-based transfers are performed by
49 * the graphics backend / BufferManager. VKBuffer only stores handles and
50 * metadata and provides helpers for processors to operate on it.
51 */
52class MAYAFLUX_API VKBuffer : public Buffer {
53public:
55
56 enum class Usage : uint8_t {
57 STAGING, ///< Host-visible staging buffer (CPU-writable)
58 DEVICE, ///< Device-local GPU-only buffer
59 COMPUTE, ///< Storage buffer for compute shaders
60 VERTEX, ///< Vertex buffer
61 INDEX, ///< Index buffer
62 UNIFORM ///< Uniform buffer (host-visible when requested)
63 };
64
65 /**
66 * @brief Context shared with BufferProcessors during pipeline execution
67 *
68 * Processors can use this struct to share data (e.g., push constant staging)
69 * and metadata during processing of this buffer in a chain.
70 */
72 std::vector<uint8_t> push_constant_staging;
73
74 std::vector<Portal::Graphics::DescriptorBindingInfo> descriptor_buffer_bindings;
75
76 std::unordered_map<std::string, std::any> metadata;
77 };
78
79 /**
80 * @brief Construct an unregistered VKBuffer
81 *
82 * Creates a VKBuffer object with the requested capacity, usage intent and
83 * semantic modality. No Vulkan resources are created by this constructor —
84 * registration with the BufferManager / backend is required to allocate
85 * VkBuffer and VkDeviceMemory.
86 *
87 * @param size_bytes Buffer capacity in bytes.
88 * @param usage Intended usage pattern (affects Vulkan flags and memory).
89 * @param modality Semantic interpretation of the buffer contents.
90 */
92 size_t size_bytes,
93 Usage usage,
94 Kakshya::DataModality modality);
95
96 VKBuffer() = default;
97
98 /**
99 * @brief Virtual destructor
100 *
101 * VKBuffer does not own Vulkan resources directly; cleanup is handled by
102 * the backend during unregistration. The destructor ensures derived class
103 * cleanup and safe destruction semantics.
104 */
105 ~VKBuffer() override;
106
107 /**
108 * @brief Clear buffer contents
109 *
110 * If the buffer is host-visible and mapped the memory is zeroed. For
111 * device-local buffers the backend must provide a ClearBufferProcessor
112 * that performs the appropriate GPU-side clear.
113 */
114 void clear() override;
115
116 /**
117 * @brief Read buffer contents as Kakshya DataVariant
118 *
119 * For host-visible buffers this returns a single DataVariant containing the
120 * raw bytes. For device-local buffers this warns and returns empty — a
121 * BufferDownloadProcessor should be used to read GPU-only memory.
122 *
123 * @return Vector of DataVariant objects representing buffer contents.
124 */
125 std::vector<Kakshya::DataVariant> get_data();
126
127 /**
128 * @brief Write data into the buffer
129 *
130 * If the buffer is host-visible and mapped the provided data is copied into
131 * the mapped memory. For device-local buffers, a BufferUploadProcessor must
132 * be present in the processing chain to perform the staging/upload.
133 *
134 * @param data Vector of Kakshya::DataVariant containing the payload to copy.
135 */
136 void set_data(const std::vector<Kakshya::DataVariant>& data);
137
138 /**
139 * @brief Resize buffer and recreate GPU resources if needed
140 * @param new_size New size in bytes
141 * @param preserve_data If true, copy existing data to new buffer
142 *
143 * If buffer is already initialized (has GPU resources), this will:
144 * 1. Create new GPU buffer with new size
145 * 2. Optionally copy old data
146 * 3. Destroy old GPU buffer
147 * 4. Update buffer resources
148 *
149 * If buffer is not initialized, just updates logical size.
150 */
151 void resize(size_t new_size, bool preserve_data = false);
152
153 /**
154 * @brief Get current logical size in bytes
155 * @return Buffer size in bytes.
156 */
157 size_t get_size() const { return m_size_bytes; }
158
159 /**
160 * @brief Run the buffer's default processor (if set and enabled)
161 *
162 * Invokes the attached default BufferProcessor. Processors should be
163 * prepared to handle mapped/unmapped memory according to buffer usage.
164 */
165 void process_default() override;
166
167 /**
168 * @brief Set the buffer's default processor
169 *
170 * Attaches a processor that will be invoked by process_default(). The
171 * previous default processor (if any) is detached first.
172 *
173 * @param processor Shared pointer to a BufferProcessor or nullptr to clear.
174 */
175 void set_default_processor(const std::shared_ptr<BufferProcessor>& processor) override;
176
177 /**
178 * @brief Get the currently attached default processor
179 * @return Shared pointer to the default BufferProcessor or nullptr.
180 */
181 std::shared_ptr<Buffers::BufferProcessor> get_default_processor() const override;
182
183 /**
184 * @brief Access the buffer's processing chain
185 * @return Shared pointer to the BufferProcessingChain used for this buffer.
186 */
187 std::shared_ptr<Buffers::BufferProcessingChain> get_processing_chain() override;
188
189 /**
190 * @brief Replace the buffer's processing chain
191 * @param chain New processing chain to assign.
192 * @param force If true, replaces existing chain even if one is set.
193 */
194 void set_processing_chain(const std::shared_ptr<BufferProcessingChain>& chain, bool force = false) override;
195
196 bool has_data_for_cycle() const override { return m_has_data; }
197 bool needs_removal() const override { return m_needs_removal; }
198 void mark_for_processing(bool has_data) override { m_has_data = has_data; }
199 void mark_for_removal() override { m_needs_removal = true; }
200 void enforce_default_processing(bool should_process) override { m_process_default = should_process; }
201 bool needs_default_processing() override { return m_process_default; }
202
203 /**
204 * @brief Try to acquire processing lock for this buffer
205 * @return True if lock acquired, false if already processing.
206 *
207 * Uses an atomic flag to guard concurrent processing attempts.
208 */
209 inline bool try_acquire_processing() override
210 {
211 bool expected = false;
212 return m_is_processing.compare_exchange_strong(expected, true,
213 std::memory_order_acquire, std::memory_order_relaxed);
214 }
215
216 /**
217 * @brief Release previously acquired processing lock
218 */
219 inline void release_processing() override
220 {
221 m_is_processing.store(false, std::memory_order_release);
222 }
223
224 /**
225 * @brief Query whether the buffer is currently being processed
226 * @return True if a processing operation holds the lock.
227 */
228 inline bool is_processing() const override
229 {
230 return m_is_processing.load(std::memory_order_acquire);
231 }
232
233 /** Get VkBuffer handle (VK_NULL_HANDLE if not registered) */
234 vk::Buffer& get_buffer() { return m_resources.buffer; }
235
236 /* Get logical buffer size as VkDeviceSize */
237 vk::DeviceSize get_size_bytes() const { return m_size_bytes; }
238
239 /**
240 * @brief Convert modality to a recommended VkFormat
241 * @return VkFormat corresponding to the buffer's modality, or VK_FORMAT_UNDEFINED.
242 */
243 vk::Format get_format() const;
244
245 /** Check whether Vulkan handles are present (buffer registered) */
246 bool is_initialized() const { return m_resources.buffer != VK_NULL_HANDLE; }
247
248 /**
249 * @brief Setup processors with a processing token
250 * @param token ProcessingToken to assign.
251 *
252 * For VKBuffer this is a no-op as processors get the token.
253 * This is meant for derived classes that need to setup default processors
254 */
255 virtual void setup_processors(ProcessingToken token) { }
256
257 /** Get the buffer's semantic modality */
258 Kakshya::DataModality get_modality() const { return m_modality; }
259
260 /** Get the inferred data dimensions for the buffer contents */
261 const std::vector<Kakshya::DataDimension>& get_dimensions() const { return m_dimensions; }
262
263 /**
264 * @brief Update the semantic modality and re-infer dimensions
265 * @param modality New Kakshya::DataModality to apply.
266 */
267 void set_modality(Kakshya::DataModality modality);
268
269 /** Retrieve the declared usage intent */
270 Usage get_usage() const { return m_usage; }
271
272 /** Set VkBuffer handle after backend allocation */
273 void set_buffer(vk::Buffer buffer) { m_resources.buffer = buffer; }
274
275 /** Set device memory handle after backend allocation */
276 void set_memory(vk::DeviceMemory memory) { m_resources.memory = memory; }
277
278 /** Set mapped host pointer (for host-visible allocations) */
279 void set_mapped_ptr(void* ptr) { m_resources.mapped_ptr = ptr; }
280
281 /** Set all buffer resources at once */
282 inline void set_buffer_resources(const VKBufferResources& resources)
283 {
284 m_resources = resources;
285 }
286
287 /** Get all buffer resources at once */
288 inline const VKBufferResources& get_buffer_resources() { return m_resources; }
289
290 /**
291 * @brief Whether this VKBuffer should be host-visible
292 * @return True for staging or uniform buffers, false for device-local types.
293 */
294 bool is_host_visible() const
295 {
296 return m_usage == Usage::STAGING || m_usage == Usage::UNIFORM;
297 }
298
299 /**
300 * @brief Get appropriate VkBufferUsageFlags for creation based on Usage
301 * @return VkBufferUsageFlags to be used when creating VkBuffer.
302 */
303 vk::BufferUsageFlags get_usage_flags() const;
304
305 /**
306 * @brief Get appropriate VkMemoryPropertyFlags for allocation based on Usage
307 * @return VkMemoryPropertyFlags to request during memory allocation.
308 */
309 vk::MemoryPropertyFlags get_memory_properties() const;
310
311 /** Get mapped host pointer (nullptr if not host-visible or unmapped) */
312 void* get_mapped_ptr() const { return m_resources.mapped_ptr; }
313
314 /** Get device memory handle */
315 void mark_dirty_range(size_t offset, size_t size);
316
317 /** Mark a range as invalid (needs download) */
318 void mark_invalid_range(size_t offset, size_t size);
319
320 /** Retrieve and clear all dirty ranges */
321 std::vector<std::pair<size_t, size_t>> get_and_clear_dirty_ranges();
322
323 /** Retrieve and clear all invalid ranges */
324 std::vector<std::pair<size_t, size_t>> get_and_clear_invalid_ranges();
325
326 /**
327 * @brief Associate this buffer with a window for rendering
328 * @param window Target window for rendering this buffer's content
329 *
330 * When this buffer is processed, its content will be rendered to the associated window.
331 * Currently supports one window per buffer (will be extended to multiple windows).
332 */
333 void set_pipeline_window(RenderPipelineID id, const std::shared_ptr<Core::Window>& window)
334 {
335 m_window_pipelines[id] = window;
336 }
337
338 /**
339 * @brief Get the window associated with this buffer
340 * @return Target window, or nullptr if not set
341 */
342 std::shared_ptr<Core::Window> get_pipeline_window(RenderPipelineID id) const
343 {
344 auto it = m_window_pipelines.find(id);
345 if (it != m_window_pipelines.end()) {
346 return it->second;
347 }
348 return nullptr;
349 }
350
351 /**
352 * @brief Check if this buffer has a rendering pipeline configured
353 */
355 {
356 return !m_window_pipelines.empty();
357 }
358
359 /**
360 * @brief Get all render pipelines associated with this buffer
361 * @return Map of RenderPipelineID to associated windows
362 */
363 std::unordered_map<RenderPipelineID, std::shared_ptr<Core::Window>> get_render_pipelines() const
364 {
365 return m_window_pipelines;
366 }
367
368 /**
369 * @brief Store recorded command buffer for a pipeline
370 */
372 CommandBufferID cmd_id)
373 {
374 m_pipeline_commands[pipeline_id] = cmd_id;
375 }
376
377 /**
378 * @brief Get recorded command buffer for a pipeline
379 */
381 {
382 auto it = m_pipeline_commands.find(pipeline_id);
383 return it != m_pipeline_commands.end() ? it->second : 0;
384 }
385
386 /**
387 * @brief Clear all recorded commands (called after presentation)
388 */
390 {
391 m_pipeline_commands.clear();
392 }
393
394 /**
395 * @brief Set vertex layout for this buffer
396 *
397 * Required before using buffer with graphics rendering.
398 * Describes how to interpret buffer data as vertices.
399 *
400 * @param layout VertexLayout describing vertex structure
401 */
402 void set_vertex_layout(const Kakshya::VertexLayout& layout);
403
404 /**
405 * @brief Get vertex layout if set
406 * @return Optional containing layout, or empty if not set
407 */
408 std::optional<Kakshya::VertexLayout> get_vertex_layout() const { return m_vertex_layout; }
409
410 /**
411 * @brief Check if this buffer has vertex layout configured
412 */
413 bool has_vertex_layout() const { return m_vertex_layout.has_value(); }
414
415 /**
416 * @brief Clear vertex layout
417 */
419 {
420 m_vertex_layout.reset();
421 }
422
423 std::shared_ptr<Buffer> clone_to(uint8_t dest_desc) override;
424
425 /**
426 * @brief Create a clone of this buffer with the same data and properties
427 * @param usage Usage enum for the cloned buffer
428 * @return Shared pointer to the cloned VKBuffer
429 *
430 * The cloned buffer will have the same size, modality, dimensions,
431 * processing chain and default processor as the original. Changes to
432 * one buffer after cloning do not affect the other.
433 */
434 std::shared_ptr<VKBuffer> clone_to(Usage usage);
435
436 /** Set whether this buffer is for internal engine usage */
437 void force_internal_usage(bool internal) override { m_internal_usage = internal; }
438
439 /** Check whether this buffer is for internal engine usage */
440 bool is_internal_only() const override { return m_internal_usage; }
441
442 /** Access the pipeline context for custom metadata (non-const) */
443 PipelineContext& get_pipeline_context() { return m_pipeline_context; }
444
445 /** Access the pipeline context for custom metadata (const) */
446 const PipelineContext& get_pipeline_context() const { return m_pipeline_context; }
447
448 /**
449 * @brief Mark config as changed (processors will detect and react)
450 * @param is_dirty Whether the config is now dirty (default: true)
451 * NOTE: Child classes override this to call their internal setup_rendering() with the new config, which may have additional side effects.
452 */
453 virtual void mark_render_config_dirty(bool is_dirty = true) { m_render_config_dirty = is_dirty; }
454
455 /**
456 * @brief Check if config has changed since last frame
457 */
458 [[nodiscard]] bool is_render_config_dirty() const { return m_render_config_dirty; }
459
460 /**
461 * @brief Get the current render configuration
462 * @return RenderConfig struct with current settings
463 */
464 RenderConfig get_render_config() const { return m_render_config; }
465
466 /**
467 * @brief Update the render configuration and mark as dirty
468 * @param config New RenderConfig to apply
469 *
470 * This will update the buffer's render configuration and set the dirty flag,
471 * signaling to any RenderProcessor that it needs to reconfigure rendering for this buffer.
472 * NOTE: Child classes override this to call their internal setup_rendering() with the new config, which may have additional side effects.
473 */
474 virtual void set_render_config(const RenderConfig& config)
475 {
476 m_render_config = config;
477 m_render_config_dirty = true;
478 }
479
480 /**
481 * @brief Mark this buffer as requiring depth testing when rendered
482 */
483 void set_needs_depth_attachment(bool needs) { m_needs_depth = needs; }
484
485 /**
486 * @brief Check if this buffer requires depth attachment for rendering
487 */
488 [[nodiscard]] bool needs_depth_attachment() const { return m_needs_depth; }
489
490protected:
491 /**
492 * @brief Called by derived classes to set their context-specific defaults
493 * @param config RenderConfig with default values for this buffer type
494 *
495 * Example (GeometryBuffer calls this in constructor):
496 * RenderConfig defaults;
497 * defaults.vertex_shader = "point.vert.spv";
498 * defaults.fragment_shader = "point.frag.spv";
499 * defaults.topology = PrimitiveTopology::POINT_LIST;
500 * set_default_render_config(defaults);
501 */
503 {
504 m_render_config = config;
505 m_render_config_dirty = false;
506 }
507
508 bool m_render_config_dirty {};
510
511private:
513
514 // Buffer parameters
515 size_t m_size_bytes {};
516 Usage m_usage {};
517 bool m_needs_depth {};
518
519 // Semantic metadata
521 std::vector<Kakshya::DataDimension> m_dimensions;
522
523 std::optional<Kakshya::VertexLayout> m_vertex_layout;
524
525 // Buffer interface state
526 bool m_has_data { true };
527 bool m_needs_removal {};
528 bool m_process_default { true };
529 bool m_internal_usage {};
530 std::atomic<bool> m_is_processing;
531 std::shared_ptr<Buffers::BufferProcessor> m_default_processor;
532 std::shared_ptr<Buffers::BufferProcessingChain> m_processing_chain;
535
536 std::unordered_map<RenderPipelineID, std::shared_ptr<Core::Window>> m_window_pipelines;
537 std::unordered_map<RenderPipelineID, CommandBufferID> m_pipeline_commands;
538
539 std::vector<std::pair<size_t, size_t>> m_dirty_ranges;
540 std::vector<std::pair<size_t, size_t>> m_invalid_ranges;
541
542 /**
543 * @brief Infer Kakshya::DataDimension entries from a given byte count
544 *
545 * Uses the current modality and provided byte count to populate
546 * m_dimensions so processors and UI code can reason about the buffer's layout.
547 *
548 * @param byte_count Number of bytes of data to infer dimensions from.
549 */
550 void infer_dimensions_from_data(size_t byte_count);
551};
552
561
562} // namespace MayaFlux::Buffers
Central computational transformation interface for continuous buffer processing.
Backend-agnostic interface for sequential data storage and transformation.
Definition Buffer.hpp:37
Registry::Service::ComputeService * m_compute_service
Definition VKBuffer.hpp:556
Registry::Service::BufferService * m_buffer_service
Definition VKBuffer.hpp:555
std::vector< std::pair< size_t, size_t > > m_dirty_ranges
Definition VKBuffer.hpp:539
bool is_render_config_dirty() const
Check if config has changed since last frame.
Definition VKBuffer.hpp:458
std::unordered_map< RenderPipelineID, std::shared_ptr< Core::Window > > get_render_pipelines() const
Get all render pipelines associated with this buffer.
Definition VKBuffer.hpp:363
void * get_mapped_ptr() const
Get mapped host pointer (nullptr if not host-visible or unmapped)
Definition VKBuffer.hpp:312
CommandBufferID get_pipeline_command(RenderPipelineID pipeline_id) const
Get recorded command buffer for a pipeline.
Definition VKBuffer.hpp:380
ProcessingToken m_processing_token
Definition VKBuffer.hpp:533
void set_pipeline_command(RenderPipelineID pipeline_id, CommandBufferID cmd_id)
Store recorded command buffer for a pipeline.
Definition VKBuffer.hpp:371
PipelineContext m_pipeline_context
Definition VKBuffer.hpp:534
std::unordered_map< RenderPipelineID, std::shared_ptr< Core::Window > > m_window_pipelines
Definition VKBuffer.hpp:536
std::optional< Kakshya::VertexLayout > m_vertex_layout
Definition VKBuffer.hpp:523
std::vector< Kakshya::DataDimension > m_dimensions
Definition VKBuffer.hpp:521
std::shared_ptr< Buffers::BufferProcessingChain > m_processing_chain
Definition VKBuffer.hpp:532
bool is_processing() const override
Query whether the buffer is currently being processed.
Definition VKBuffer.hpp:228
RenderConfig get_render_config() const
Get the current render configuration.
Definition VKBuffer.hpp:464
bool has_render_pipeline() const
Check if this buffer has a rendering pipeline configured.
Definition VKBuffer.hpp:354
bool needs_depth_attachment() const
Check if this buffer requires depth attachment for rendering.
Definition VKBuffer.hpp:488
bool needs_removal() const override
Checks if the buffer should be removed from processing chains.
Definition VKBuffer.hpp:197
bool has_data_for_cycle() const override
Checks if the buffer has data for the current processing cycle.
Definition VKBuffer.hpp:196
void clear_pipeline_commands()
Clear all recorded commands (called after presentation)
Definition VKBuffer.hpp:389
Usage get_usage() const
Retrieve the declared usage intent.
Definition VKBuffer.hpp:270
Kakshya::DataModality get_modality() const
Get the buffer's semantic modality.
Definition VKBuffer.hpp:258
const PipelineContext & get_pipeline_context() const
Access the pipeline context for custom metadata (const)
Definition VKBuffer.hpp:446
std::vector< std::pair< size_t, size_t > > m_invalid_ranges
Definition VKBuffer.hpp:540
void set_mapped_ptr(void *ptr)
Set mapped host pointer (for host-visible allocations)
Definition VKBuffer.hpp:279
vk::DeviceSize get_size_bytes() const
Definition VKBuffer.hpp:237
std::optional< Kakshya::VertexLayout > get_vertex_layout() const
Get vertex layout if set.
Definition VKBuffer.hpp:408
VKBufferResources m_resources
Definition VKBuffer.hpp:512
PipelineContext & get_pipeline_context()
Access the pipeline context for custom metadata (non-const)
Definition VKBuffer.hpp:443
void clear_vertex_layout()
Clear vertex layout.
Definition VKBuffer.hpp:418
void set_memory(vk::DeviceMemory memory)
Set device memory handle after backend allocation.
Definition VKBuffer.hpp:276
void set_needs_depth_attachment(bool needs)
Mark this buffer as requiring depth testing when rendered.
Definition VKBuffer.hpp:483
vk::Buffer & get_buffer()
Get VkBuffer handle (VK_NULL_HANDLE if not registered)
Definition VKBuffer.hpp:234
bool needs_default_processing() override
Checks if the buffer should undergo default processing.
Definition VKBuffer.hpp:201
std::shared_ptr< Buffers::BufferProcessor > m_default_processor
Definition VKBuffer.hpp:531
virtual void setup_processors(ProcessingToken token)
Setup processors with a processing token.
Definition VKBuffer.hpp:255
virtual void mark_render_config_dirty(bool is_dirty=true)
Mark config as changed (processors will detect and react)
Definition VKBuffer.hpp:453
void set_pipeline_window(RenderPipelineID id, const std::shared_ptr< Core::Window > &window)
Associate this buffer with a window for rendering.
Definition VKBuffer.hpp:333
bool is_initialized() const
Check whether Vulkan handles are present (buffer registered)
Definition VKBuffer.hpp:246
void enforce_default_processing(bool should_process) override
Controls whether the buffer should use default processing.
Definition VKBuffer.hpp:200
bool is_internal_only() const override
Check whether this buffer is for internal engine usage.
Definition VKBuffer.hpp:440
void set_buffer(vk::Buffer buffer)
Set VkBuffer handle after backend allocation.
Definition VKBuffer.hpp:273
bool has_vertex_layout() const
Check if this buffer has vertex layout configured.
Definition VKBuffer.hpp:413
const std::vector< Kakshya::DataDimension > & get_dimensions() const
Get the inferred data dimensions for the buffer contents.
Definition VKBuffer.hpp:261
virtual void set_render_config(const RenderConfig &config)
Update the render configuration and mark as dirty.
Definition VKBuffer.hpp:474
std::atomic< bool > m_is_processing
Definition VKBuffer.hpp:530
const VKBufferResources & get_buffer_resources()
Get all buffer resources at once.
Definition VKBuffer.hpp:288
void set_default_render_config(const RenderConfig &config)
Called by derived classes to set their context-specific defaults.
Definition VKBuffer.hpp:502
Kakshya::DataModality m_modality
Definition VKBuffer.hpp:520
void release_processing() override
Release previously acquired processing lock.
Definition VKBuffer.hpp:219
void set_buffer_resources(const VKBufferResources &resources)
Set all buffer resources at once.
Definition VKBuffer.hpp:282
void force_internal_usage(bool internal) override
Set whether this buffer is for internal engine usage.
Definition VKBuffer.hpp:437
size_t get_size() const
Get current logical size in bytes.
Definition VKBuffer.hpp:157
void mark_for_removal() override
Marks the buffer for removal from processing chains.
Definition VKBuffer.hpp:199
std::unordered_map< RenderPipelineID, CommandBufferID > m_pipeline_commands
Definition VKBuffer.hpp:537
bool is_host_visible() const
Whether this VKBuffer should be host-visible.
Definition VKBuffer.hpp:294
void mark_for_processing(bool has_data) override
Marks the buffer's data availability for the current processing cycle.
Definition VKBuffer.hpp:198
std::shared_ptr< Core::Window > get_pipeline_window(RenderPipelineID id) const
Get the window associated with this buffer.
Definition VKBuffer.hpp:342
~VKBuffer() override
Virtual destructor.
bool try_acquire_processing() override
Try to acquire processing lock for this buffer.
Definition VKBuffer.hpp:209
Vulkan-backed buffer wrapper used in processing chains.
Definition VKBuffer.hpp:52
ProcessingToken
Bitfield enum defining processing characteristics and backend requirements for buffer operations.
uint64_t RenderPipelineID
Definition VKBuffer.hpp:27
uint64_t CommandBufferID
Definition VKBuffer.hpp:28
DataModality
Data modality types for cross-modal analysis.
Definition NDData.hpp:78
std::vector< Portal::Graphics::DescriptorBindingInfo > descriptor_buffer_bindings
Definition VKBuffer.hpp:74
std::vector< uint8_t > push_constant_staging
Definition VKBuffer.hpp:72
std::unordered_map< std::string, std::any > metadata
Definition VKBuffer.hpp:76
Context shared with BufferProcessors during pipeline execution.
Definition VKBuffer.hpp:71
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.