MayaFlux 0.5.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches
StagingUtils.hpp
Go to the documentation of this file.
1#pragma once
2
5
6namespace MayaFlux::Buffers {
7
8class VKBuffer;
9class AudioBuffer;
10
11inline constexpr float k_buffer_growth_factor = 1.5F;
12
13/**
14 * @brief Opaque handle to an in-flight transfer.
15 */
16using TransferHandle = std::shared_ptr<void>;
17
18/**
19 * @brief Upload data to a host-visible buffer
20 * @param target Target VKBuffer to upload data into
21 * @param data DataVariant containing the data to upload
22 *
23 * This function handles uploading data from a Kakshya::DataVariant into a
24 * host-visible VKBuffer. It maps the buffer memory, copies the data, and
25 * marks the buffer as dirty for synchronization.
26 *
27 * @param dst_offset Byte offset into @p target to write at. The default 0
28 * reproduces the whole-buffer overwrite exactly; a nonzero value
29 * writes a sub-range and leaves the rest of the buffer untouched.
30 */
31MAYAFLUX_API void upload_host_visible(const std::shared_ptr<VKBuffer>& target, const Kakshya::DataVariant& data, size_t dst_offset = 0);
32
33/**
34 * @brief Upload data to a device-local buffer using a staging buffer
35 * @param target Target VKBuffer to upload data into
36 * @param staging_buffer Host-visible staging VKBuffer used for the upload
37 * @param data DataVariant containing the data to upload
38 *
39 * This function handles uploading data from a Kakshya::DataVariant into a
40 * device-local VKBuffer by utilizing a staging buffer. It copies the data
41 * into the staging buffer, flushes it, and then issues a command to copy
42 * from the staging buffer to the target device-local buffer.
43 *
44 * @param dst_offset Byte offset into @p target the staging copy lands at.
45 * The default 0 reproduces the whole-buffer overwrite exactly; a
46 * nonzero value writes a sub-range and leaves the rest untouched.
47 * The staging buffer itself only needs to hold @p data.
48 */
49MAYAFLUX_API void upload_device_local(const std::shared_ptr<VKBuffer>& target, const std::shared_ptr<VKBuffer>& staging_buffer, const Kakshya::DataVariant& data, size_t dst_offset = 0);
50
51/**
52 * @brief Upload host memory into a raw back_buffers slot.
53 * @param slot Destination slot, typically from VKBuffer::get_back_buffer().
54 * @param data Source pointer, at least @p size bytes.
55 * @param size Byte count to copy.
56 * @param staging Persistent staging buffer for device-local slots. Ignored,
57 * and may be null, when slot.mapped_ptr is already valid.
58 *
59 * Writes through slot.mapped_ptr directly when present (host-visible slot,
60 * no transfer). Otherwise copies into @p staging and records a fenced
61 * device-to-device copy into slot.buffer, mirroring download_back_buffer
62 * with the direction reversed.
63 */
64MAYAFLUX_API void upload_back_buffer(
66 const void* data,
67 size_t size,
68 std::shared_ptr<VKBuffer>& staging);
69
70/**
71 * @brief Upload to a back_buffers slot without waiting for completion.
72 * @param slot Destination slot, typically from VKBuffer::get_back_buffer().
73 * @param data Source pointer, at least @p size bytes. Copied into staging
74 * before returning, so the caller may free it immediately.
75 * @param size Byte count to copy.
76 * @param staging Persistent staging buffer, grown if too small.
77 * @return Handle to pass to resolve_transfer, or null for host-visible
78 * slots where the write was a direct memcpy.
79 *
80 * The staging buffer is in use until the returned handle is resolved. Any
81 * further transfer through the same staging buffer must resolve this one
82 * first, or the copy source is overwritten mid-flight.
83 */
86 const void* data,
87 size_t size,
88 std::shared_ptr<VKBuffer>& staging);
89
90/**
91 * @brief Wait for a transfer and release its resources.
92 * @param handle Handle from upload_back_buffer_async. Nulled on return.
93 *
94 * No-op on a null handle. Blocks the calling thread until the fence
95 * signals, which is immediate when a frame or more has elapsed since
96 * submission.
97 */
98MAYAFLUX_API void resolve_transfer(TransferHandle& handle);
99
100/**
101 * @brief Download data from a host-visible buffer
102 * @param source Source VKBuffer to download data from
103 * @param target Target VKBuffer to store the downloaded data
104 *
105 * This function handles downloading data from a host-visible VKBuffer.
106 * It maps the buffer memory, copies the data into a CPU-accessible format,
107 * and updates the associated target buffer.
108 */
109MAYAFLUX_API void download_host_visible(const std::shared_ptr<VKBuffer>& source, const std::shared_ptr<VKBuffer>& target);
110
111/**
112 * @brief Download data from a device-local buffer using a staging buffer
113 * @param source Source VKBuffer to download data from
114 * @param target Target VKBuffer to store the downloaded data
115 * @param staging_buffer Host-visible staging VKBuffer used for the download
116 *
117 * This function handles downloading data from a device-local VKBuffer by
118 * utilizing a staging buffer. It issues a command to copy the data from
119 * the device-local buffer to the staging buffer, invalidates the staging
120 * buffer memory, and then copies the data into a CPU-accessible format
121 * to update the target buffer.
122 */
123MAYAFLUX_API void download_device_local(const std::shared_ptr<VKBuffer>& source, const std::shared_ptr<VKBuffer>& target, const std::shared_ptr<VKBuffer>& staging_buffer);
124
125/**
126 * @brief Download a raw back_buffers slot to host memory.
127 * @param slot Source slot, typically from VKBuffer::get_back_buffer().
128 * @param size Byte count to copy.
129 * @param data Destination pointer, at least @p size bytes.
130 * @param staging Persistent staging buffer for device-local slots. Ignored,
131 * and may be null, when slot.mapped_ptr is already valid.
132 *
133 * Reads slot.mapped_ptr directly when present (host-visible slot, no
134 * transfer). Otherwise records a fenced copy into @p staging exactly as
135 * download_from_gpu_async does, using slot.buffer as the copy source.
136 */
137MAYAFLUX_API void download_back_buffer(
139 void* data,
140 size_t size,
141 std::shared_ptr<VKBuffer>& staging);
142
143/**
144 * @brief Upload raw data to GPU buffer (auto-detects host-visible vs device-local)
145 * @param data Source data pointer
146 * @param size Size in bytes
147 * @param target Target GPU buffer
148 * @param staging Optional staging buffer (created if needed for device-local)
149 *
150 * Convenience wrapper over StagingUtils that:
151 * - Converts raw pointer → DataVariant
152 * - Auto-detects if buffer is host-visible or device-local
153 * - Handles staging buffer creation if needed
154 *
155 * @param dst_offset Byte offset into @p target to write at. The default 0
156 * overwrites from the start; a nonzero value uploads a sub-range,
157 * leaving the rest of @p target as it was.
158 */
159MAYAFLUX_API void upload_to_gpu(
160 const void* data,
161 size_t size,
162 const std::shared_ptr<VKBuffer>& target,
163 const std::shared_ptr<VKBuffer>& staging = nullptr,
164 size_t dst_offset = 0);
165
166/**
167 * @brief Upload typed data to GPU buffer
168 * @tparam T Data type (float, double, int, etc.)
169 * @param data Source data span
170 * @param target Target GPU buffer
171 * @param staging Optional staging buffer
172 */
173template <typename T>
175 std::span<const T> data,
176 const std::shared_ptr<VKBuffer>& target,
177 const std::shared_ptr<VKBuffer>& staging = nullptr)
178{
179 upload_to_gpu(data.data(), data.size_bytes(), target, staging);
180}
181
182/**
183 * @brief Upload vector to GPU buffer
184 * @tparam T Data type
185 * @param data Source data vector
186 * @param target Target GPU buffer
187 * @param staging Optional staging buffer
188 */
189template <typename T>
191 const std::vector<T>& data,
192 const std::shared_ptr<VKBuffer>& target,
193 const std::shared_ptr<VKBuffer>& staging = nullptr)
194{
195 upload_to_gpu(std::span<const T>(data), target, staging);
196}
197
198/**
199 * @brief Upload @p size bytes to @p target, growing both buffers first if needed.
200 * @param data Source pointer.
201 * @param size Byte count to upload.
202 * @param target Destination GPU buffer.
203 * @param staging Paired staging buffer, or nullptr for host-visible targets.
204 * @param growth_factor Forwarded to ensure_gpu_capacity.
205 *
206 * Combines ensure_gpu_capacity() and upload_to_gpu() into a single call.
207 * The upload is clamped to the post-resize capacity, which is always >= @p size
208 * after ensure_gpu_capacity returns.
209 */
210MAYAFLUX_API void upload_resizing(
211 const void* data,
212 size_t size,
213 const std::shared_ptr<VKBuffer>& target,
214 const std::shared_ptr<VKBuffer>& staging,
215 float growth_factor = 1.5F);
216
217/**
218 * @brief Download from GPU buffer to raw data (auto-detects host-visible vs device-local)
219 * @param source Source GPU buffer
220 * @param data Destination data pointer
221 * @param size Size in bytes
222 * @param staging Optional staging buffer (created if needed for device-local)
223 *
224 * Convenience wrapper over StagingUtils that:
225 * - Auto-detects if buffer is host-visible or device-local
226 * - Handles staging buffer creation if needed
227 * - Copies data to destination pointer
228 */
229MAYAFLUX_API void download_from_gpu(
230 const std::shared_ptr<VKBuffer>& source,
231 void* data,
232 size_t size,
233 const std::shared_ptr<VKBuffer>& staging = nullptr);
234
235/**
236 * @brief Download from GPU buffer to typed span
237 * @tparam T Data type
238 * @param source Source GPU buffer
239 * @param data Destination data span
240 * @param staging Optional staging buffer
241 */
242template <typename T>
244 const std::shared_ptr<VKBuffer>& source,
245 std::span<T> data,
246 const std::shared_ptr<VKBuffer>& staging = nullptr)
247{
248 download_from_gpu(source, data.data(), data.size_bytes(), staging);
249}
250
251/**
252 * @brief Download from GPU buffer to vector
253 * @tparam T Data type
254 * @param source Source GPU buffer
255 * @param data Destination data vector (resized if needed)
256 * @param staging Optional staging buffer
257 */
258template <typename T>
260 const std::shared_ptr<VKBuffer>& source,
261 std::vector<T>& data,
262 const std::shared_ptr<VKBuffer>& staging = nullptr)
263{
264 size_t element_count = source->get_size_bytes() / sizeof(T);
265 data.resize(element_count);
266 download_from_gpu(source, std::span<T>(data), staging);
267}
268
269/**
270 * @brief Download from a device-local GPU buffer without stalling the graphics queue.
271 *
272 * Records a buffer copy into a fenced command buffer, waits on the fence from
273 * the calling thread, then memcpys from the mapped staging buffer into @p data.
274 * Unlike download_from_gpu, this does not call queue.waitIdle, making it safe
275 * to call from any thread that is not the graphics thread itself.
276 *
277 * @p staging is allocated and cached by the caller to avoid per-call Vulkan
278 * object churn. Pass the same staging buffer each frame; it is resized if
279 * @p size exceeds its current capacity.
280 *
281 * @param source Device-local source buffer.
282 * @param data Destination host pointer, at least @p size bytes.
283 * @param size Byte count to copy.
284 * @param staging Persistent host-visible staging buffer. Created via
285 * create_staging_buffer(). Resized in-place if too small.
286 */
287MAYAFLUX_API void download_from_gpu_async(
288 const std::shared_ptr<VKBuffer>& source,
289 void* data,
290 size_t size,
291 std::shared_ptr<VKBuffer>& staging);
292
293/**
294 * @brief Resolve the GPU-resident image from any GpuImageSource buffer.
295 *
296 * Selects get_texture() or get_gpu_texture() at compile time based on which
297 * the concrete buffer type exposes. Returns nullptr if the buffer has not yet
298 * produced a GPU texture.
299 *
300 * @tparam T A type satisfying GpuImageSource.
301 * @param buffer The pixel-bearing buffer to query.
302 * @return GPU-resident VKImage, or nullptr.
303 */
304template <GpuImageSource T>
305[[nodiscard]] std::shared_ptr<Core::VKImage> resolve_gpu_image(const T& buffer)
306{
307 if constexpr (requires(const T& b) {
308 { b.get_texture() } -> std::convertible_to<std::shared_ptr<Core::VKImage>>;
309 }) {
310 return buffer.get_texture();
311 } else {
312 return buffer.get_gpu_texture();
313 }
314}
315
316/**
317 * @brief Download a VKImage to CPU and return a normalised float span.
318 *
319 * Downloads @p image into @p raw_staging via TextureLoom::download_data,
320 * then normalises into @p work via Kakshya::as_normalised_float.
321 *
322 * @p raw_staging is resized to match the image byte footprint when the image
323 * dimensions or format change. @p work is the caller-owned scratch buffer
324 * reused across calls to avoid per-frame allocation.
325 *
326 * Returns an empty span if @p image is null, not initialised, or its format
327 * has no ImageFormat mapping.
328 *
329 * @param image GPU-resident source image.
330 * @param raw_staging Persistent byte buffer for the GPU download. Reuse across calls.
331 * @param work Persistent float buffer for normalisation output. Reuse across calls.
332 * @param gpu_staging Optional persistent staging buffer for device-local images. Reuse across calls.
333 * @return Normalised float span pointing into @p work (or directly into the
334 * variant storage for float-format images).
335 */
336[[nodiscard]] MAYAFLUX_API std::span<const float> download_and_normalise(
337 const std::shared_ptr<Core::VKImage>& image,
338 std::vector<uint8_t>& raw_staging,
339 std::vector<float>& work,
340 const std::shared_ptr<VKBuffer>& gpu_staging);
341
342/**
343 * @brief Create staging buffer for transfers
344 * @param size Size in bytes
345 * @return Host-visible staging buffer ready for transfers
346 */
347MAYAFLUX_API std::shared_ptr<VKBuffer> create_staging_buffer(size_t size);
348
349/**
350 * @brief Allocate a persistent host-visible staging buffer sized for
351 * repeated streaming uploads to an image of @p size bytes.
352 * Call once; pass the result to upload_image_streaming() every frame.
353 * @param size Byte footprint of the target image (use VKImage::get_size_bytes()).
354 * @return Initialised host-visible VKBuffer, or nullptr on failure.
355 */
356[[nodiscard]] MAYAFLUX_API std::shared_ptr<VKBuffer> create_image_staging_buffer(size_t size);
357
358/**
359 * @brief Check if buffer is device-local (staging needed)
360 * @param buffer Buffer to check
361 * @return True if buffer is device-local
362 */
363MAYAFLUX_API bool is_device_local(const std::shared_ptr<VKBuffer>& buffer);
364
365/**
366 * @brief Grow a GPU buffer (and its paired staging buffer) to fit @p required bytes.
367 * @param target Device-local or host-visible GPU buffer to resize.
368 * @param staging Paired staging buffer, or nullptr if the target is host-visible.
369 * @param required Bytes needed for the next upload.
370 * @param growth_factor Multiplier applied when a resize is triggered (default 1.5).
371 *
372 * No-op when @p target already has sufficient capacity. When a resize is necessary
373 * both buffers are grown to `required * growth_factor` so subsequent small
374 * increments do not trigger further allocations. Existing GPU data is not preserved
375 * (preserve_data = false) because the caller is about to overwrite it.
376 */
377MAYAFLUX_API void ensure_gpu_capacity(
378 const std::shared_ptr<VKBuffer>& target,
379 const std::shared_ptr<VKBuffer>& staging,
380 size_t required,
381 float growth_factor = k_buffer_growth_factor);
382
383/**
384 * @brief Upload data from DataAccess view to GPU buffer (precision-preserving)
385 * @tparam T View type (double, glm::dvec2, glm::dvec3, glm::vec3, float, etc.)
386 * @param accessor DataAccess instance providing the view
387 * @param target Target GPU buffer
388 * @param staging Optional staging buffer (auto-created if needed)
389 *
390 * Zero-copy when types match, automatic conversion cache when they don't.
391 * For AUDIO modalities, defaults to DOUBLE precision to preserve accuracy.
392 */
393template <typename T>
395 const Kakshya::DataAccess& accessor,
396 const std::shared_ptr<VKBuffer>& target,
397 const std::shared_ptr<VKBuffer>& staging = nullptr)
398{
399 auto view = accessor.view<T>();
400
401 const void* data_ptr = view.data();
402 size_t data_bytes = view.size() * sizeof(T);
403
404 if constexpr (std::is_same_v<T, double>) {
405 const auto modality = target->get_modality();
406 if (modality != Kakshya::DataModality::AUDIO_1D
409 "Uploading double precision to buffer with modality {}. Consider using AUDIO_1D or AUDIO_MULTICHANNEL.",
411 }
412 }
413
414 upload_to_gpu(data_ptr, data_bytes, target, staging);
415}
416
417/**
418 * @brief Upload structured data with GLM double-precision types
419 * @tparam T GLM type (glm::dvec2, glm::dvec3, glm::dvec4 for double precision)
420 * @param accessor DataAccess with structured dimensions
421 * @param target Target GPU buffer
422 * @param staging Optional staging buffer
423 *
424 * Use this for high-precision structured data like audio samples interpreted
425 * as multi-dimensional vectors. Supports both single and double precision GLM types.
426 */
427template <typename T>
428 requires GlmType<T>
430 const Kakshya::DataAccess& accessor,
431 const std::shared_ptr<VKBuffer>& target,
432 const std::shared_ptr<VKBuffer>& staging = nullptr)
433{
434 if (!accessor.is_structured()) {
435 error<std::invalid_argument>(
438 std::source_location::current(),
439 "Cannot upload structured view from non-structured data");
440 }
441
442 auto structured_view = accessor.view<T>();
443 upload_to_gpu(structured_view.data(), structured_view.size_bytes(), target, staging);
444}
445
446/**
447 * @brief Download GPU buffer to DataAccess-compatible format (precision-preserving)
448 */
449template <typename T>
451 const std::shared_ptr<VKBuffer>& source,
452 Kakshya::DataVariant& target_variant,
453 const std::vector<Kakshya::DataDimension>& dimensions,
454 Kakshya::DataModality modality,
455 const std::shared_ptr<VKBuffer>& staging = nullptr)
456{
457 size_t element_count = source->get_size_bytes() / sizeof(T);
458
459 std::vector<T> temp_buffer(element_count);
460 download_from_gpu(source, temp_buffer, staging);
461
462 target_variant = std::move(temp_buffer);
463
464 return Kakshya::DataAccess(target_variant, dimensions, modality);
465}
466
467/**
468 * @brief Upload AudioBuffer to GPU (always double precision)
469 * @param audio_buffer Source audio buffer (double[])
470 * @param gpu_buffer Target GPU buffer (must support R64Sfloat format)
471 * @param staging Optional staging buffer (auto-created if needed)
472 *
473 * AudioBuffer is always double precision. This function ensures the GPU buffer
474 * is configured for double precision and performs a direct upload with no conversion.
475 *
476 * @throws std::runtime_error if gpu_buffer doesn't support double precision
477 */
479 const std::shared_ptr<AudioBuffer>& audio_buffer,
480 const std::shared_ptr<VKBuffer>& gpu_buffer,
481 const std::shared_ptr<VKBuffer>& staging = nullptr);
482
483/**
484 * @brief Download GPU buffer to AudioBuffer (expects double precision)
485 * @param gpu_buffer Source GPU buffer (should contain double precision data)
486 * @param audio_buffer Target audio buffer (always double[])
487 * @param staging Optional staging buffer (auto-created if needed)
488 *
489 * Downloads GPU data and copies to AudioBuffer. If the GPU buffer contains
490 * float data instead of double, DataAccess will handle the upconversion
491 * (though this is not recommended for audio precision).
492 */
494 const std::shared_ptr<VKBuffer>& gpu_buffer,
495 const std::shared_ptr<AudioBuffer>& audio_buffer,
496 const std::shared_ptr<VKBuffer>& staging = nullptr);
497
498} // namespace MayaFlux::Buffers
#define MF_WARN(comp, ctx,...)
IO::ImageData image
Definition Decoder.cpp:64
size_t b
auto view() const
Get explicit typed view of data.
Type-erased accessor for NDData with semantic view construction.
void resolve_transfer(TransferHandle &handle)
Wait for a transfer and release its resources.
std::shared_ptr< VKBuffer > create_image_staging_buffer(size_t size)
Allocate a persistent host-visible staging buffer sized for repeated streaming uploads to an image of...
std::shared_ptr< void > TransferHandle
Opaque handle to an in-flight transfer.
void upload_audio_to_gpu(const std::shared_ptr< AudioBuffer > &audio_buffer, const std::shared_ptr< VKBuffer > &gpu_buffer, const std::shared_ptr< VKBuffer > &staging)
Upload AudioBuffer to GPU (always double precision)
void upload_structured_view(const Kakshya::DataAccess &accessor, const std::shared_ptr< VKBuffer > &target, const std::shared_ptr< VKBuffer > &staging=nullptr)
Upload structured data with GLM double-precision types.
void upload_resizing(const void *data, size_t size, const std::shared_ptr< VKBuffer > &target, const std::shared_ptr< VKBuffer > &staging, float growth_factor)
Upload size bytes to target, growing both buffers first if needed.
std::shared_ptr< Core::VKImage > resolve_gpu_image(const T &buffer)
Resolve the GPU-resident image from any GpuImageSource buffer.
constexpr float k_buffer_growth_factor
TransferHandle upload_back_buffer_async(const VKBufferResources::GenerationSlot &slot, const void *data, size_t size, std::shared_ptr< VKBuffer > &staging)
Upload to a back_buffers slot without waiting for completion.
std::span< const float > download_and_normalise(const std::shared_ptr< Core::VKImage > &image, std::vector< uint8_t > &raw_staging, std::vector< float > &work, const std::shared_ptr< VKBuffer > &gpu_staging)
Download a VKImage to CPU and return a normalised float span.
void download_from_gpu_async(const std::shared_ptr< VKBuffer > &source, void *data, size_t size, std::shared_ptr< VKBuffer > &staging)
Download from a device-local GPU buffer without stalling the graphics queue.
std::shared_ptr< VKBuffer > create_staging_buffer(size_t size)
Create staging buffer for transfers.
bool is_device_local(const std::shared_ptr< VKBuffer > &buffer)
Check if buffer is device-local (staging needed)
void download_audio_from_gpu(const std::shared_ptr< VKBuffer > &gpu_buffer, const std::shared_ptr< AudioBuffer > &audio_buffer, const std::shared_ptr< VKBuffer > &staging)
Download GPU buffer to AudioBuffer (expects double precision)
void upload_to_gpu(const void *data, size_t size, const std::shared_ptr< VKBuffer > &target, const std::shared_ptr< VKBuffer > &staging, size_t dst_offset)
Upload raw data to GPU buffer (auto-detects host-visible vs device-local)
void upload_from_view(const Kakshya::DataAccess &accessor, const std::shared_ptr< VKBuffer > &target, const std::shared_ptr< VKBuffer > &staging=nullptr)
Upload data from DataAccess view to GPU buffer (precision-preserving)
void download_from_gpu(const std::shared_ptr< VKBuffer > &source, void *data, size_t size, const std::shared_ptr< VKBuffer > &staging)
Download from GPU buffer to raw data (auto-detects host-visible vs device-local)
void download_host_visible(const std::shared_ptr< VKBuffer > &source, const std::shared_ptr< VKBuffer > &target)
Download data from a host-visible buffer.
void ensure_gpu_capacity(const std::shared_ptr< VKBuffer > &target, const std::shared_ptr< VKBuffer > &staging, size_t required, float growth_factor)
Grow a GPU buffer (and its paired staging buffer) to fit required bytes.
void download_back_buffer(const VKBufferResources::GenerationSlot &slot, void *data, size_t size, std::shared_ptr< VKBuffer > &staging)
Download a raw back_buffers slot to host memory.
void download_device_local(const std::shared_ptr< VKBuffer > &source, const std::shared_ptr< VKBuffer > &target, const std::shared_ptr< VKBuffer > &staging_buffer)
Download data from a device-local buffer using a staging buffer.
Kakshya::DataAccess download_to_view(const std::shared_ptr< VKBuffer > &source, Kakshya::DataVariant &target_variant, const std::vector< Kakshya::DataDimension > &dimensions, Kakshya::DataModality modality, const std::shared_ptr< VKBuffer > &staging=nullptr)
Download GPU buffer to DataAccess-compatible format (precision-preserving)
void upload_host_visible(const std::shared_ptr< VKBuffer > &target, const Kakshya::DataVariant &data, size_t dst_offset)
Upload data to a host-visible buffer.
void upload_device_local(const std::shared_ptr< VKBuffer > &target, const std::shared_ptr< VKBuffer > &staging_buffer, const Kakshya::DataVariant &data, size_t dst_offset)
Upload data to a device-local buffer using a staging buffer.
void upload_back_buffer(const VKBufferResources::GenerationSlot &slot, const void *data, size_t size, std::shared_ptr< VKBuffer > &staging)
Upload host memory into a raw back_buffers slot.
@ BufferProcessing
Buffer processing (Buffers::BufferManager, processing chains)
@ Buffers
Buffers, Managers, processors and processing chains.
std::variant< std::vector< double >, std::vector< float >, std::vector< uint8_t >, std::vector< uint16_t >, std::vector< uint32_t >, std::vector< std::complex< float > >, std::vector< std::complex< double > >, std::vector< glm::vec2 >, std::vector< glm::vec3 >, std::vector< glm::vec4 >, std::vector< glm::mat4 > > DataVariant
Multi-type data storage for different precision needs.
Definition NDData.hpp:102
DataModality
Data modality types for cross-modal analysis.
Definition NDData.hpp:164
@ AUDIO_MULTICHANNEL
Multi-channel audio.
std::string_view modality_to_string(DataModality modality)
Convert DataModality enum to string representation.
Definition NDData.cpp:130