MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ upload_from_view()

template<typename T >
void MayaFlux::Buffers::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)

Template Parameters
TView type (double, glm::dvec2, glm::dvec3, glm::vec3, float, etc.)
Parameters
accessorDataAccess instance providing the view
targetTarget GPU buffer
stagingOptional staging buffer (auto-created if needed)

Zero-copy when types match, automatic conversion cache when they don't. For AUDIO modalities, defaults to DOUBLE precision to preserve accuracy.

Definition at line 259 of file StagingUtils.hpp.

263{
264 auto view = accessor.view<T>();
265
266 const void* data_ptr = view.data();
267 size_t data_bytes = view.size() * sizeof(T);
268
269 if constexpr (std::is_same_v<T, double>) {
270 const auto modality = target->get_modality();
271 if (modality != Kakshya::DataModality::AUDIO_1D
272 && modality != Kakshya::DataModality::AUDIO_MULTICHANNEL) {
273 MF_WARN(Journal::Component::Buffers, Journal::Context::BufferProcessing,
274 "Uploading double precision to buffer with modality {}. Consider using AUDIO_1D or AUDIO_MULTICHANNEL.",
275 Kakshya::modality_to_string(modality));
276 }
277 }
278
279 upload_to_gpu(data_ptr, data_bytes, target, staging);
280}
#define MF_WARN(comp, ctx,...)
auto view() const
Get explicit typed view of data.

References MayaFlux::Kakshya::AUDIO_1D, MayaFlux::Kakshya::AUDIO_MULTICHANNEL, MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, MF_WARN, MayaFlux::Kakshya::modality_to_string(), upload_to_gpu(), and MayaFlux::Kakshya::DataAccess::view().

+ Here is the call graph for this function: