MayaFlux 0.1.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 187 of file StagingUtils.hpp.

191{
192 auto view = accessor.view<T>();
193
194 const void* data_ptr = view.data();
195 size_t data_bytes = view.size() * sizeof(T);
196
197 if constexpr (std::is_same_v<T, double>) {
198 if (target->get_format() != vk::Format::eR64Sfloat) {
199 MF_WARN(Journal::Component::Buffers, Journal::Context::BufferProcessing,
200 "Uploading double precision to buffer with format {}. Consider using R64Sfloat for audio.",
201 vk::to_string(target->get_format()));
202 }
203 }
204
205 upload_to_gpu(data_ptr, data_bytes, target, staging);
206}
#define MF_WARN(comp, ctx,...)
auto view() const
Get explicit typed view of data.

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

+ Here is the call graph for this function: