MayaFlux 0.3.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 196 of file StagingUtils.hpp.

200{
201 auto view = accessor.view<T>();
202
203 const void* data_ptr = view.data();
204 size_t data_bytes = view.size() * sizeof(T);
205
206 if constexpr (std::is_same_v<T, double>) {
207 if (target->get_format() != vk::Format::eR64Sfloat) {
208 MF_WARN(Journal::Component::Buffers, Journal::Context::BufferProcessing,
209 "Uploading double precision to buffer with format {}. Consider using R64Sfloat for audio.",
210 vk::to_string(target->get_format()));
211 }
212 }
213
214 upload_to_gpu(data_ptr, data_bytes, target, staging);
215}
#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: