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

◆ upload_to_gpu() [2/3]

MAYAFLUX_API void MayaFlux::Buffers::upload_to_gpu ( const void *  data,
size_t  size,
const std::shared_ptr< VKBuffer > &  target,
const std::shared_ptr< VKBuffer > &  staging = nullptr 
)

Upload raw data to GPU buffer (auto-detects host-visible vs device-local)

Parameters
dataSource data pointer
sizeSize in bytes
targetTarget GPU buffer
stagingOptional staging buffer (created if needed for device-local)

Convenience wrapper over StagingUtils that:

  • Converts raw pointer → DataVariant
  • Auto-detects if buffer is host-visible or device-local
  • Handles staging buffer creation if needed

Definition at line 272 of file StagingUtils.cpp.

277{
278 if (!target) {
279 error<std::invalid_argument>(
280 Journal::Component::Buffers,
281 Journal::Context::BufferProcessing,
282 std::source_location::current(),
283 "upload_to_gpu: target buffer is null");
284 }
285
286 if (size == 0) {
287 return;
288 }
289
290 std::vector<uint8_t> raw_bytes(size);
291 std::memcpy(raw_bytes.data(), data, size);
292 Kakshya::DataVariant data_variant(raw_bytes);
293
294 if (target->is_host_visible()) {
295 upload_host_visible(target, data_variant);
296 } else {
297 std::shared_ptr<VKBuffer> staging_buf = staging;
298
299 if (!staging_buf) {
300 staging_buf = create_staging_buffer(size);
301 }
302
303 upload_device_local(target, staging_buf, data_variant);
304 }
305}
void upload_device_local(const std::shared_ptr< VKBuffer > &target, const std::shared_ptr< VKBuffer > &staging_buffer, const Kakshya::DataVariant &data)
Upload data to a device-local buffer using a staging buffer.
std::shared_ptr< VKBuffer > create_staging_buffer(size_t size)
Create staging buffer for transfers.

References MayaFlux::Journal::BufferProcessing, MayaFlux::Journal::Buffers, create_staging_buffer(), upload_device_local(), and upload_host_visible().

Referenced by MayaFlux::Buffers::NodeTextureProcessor::initialize_gpu_resources(), MayaFlux::IO::ImageReader::load_into_buffer(), MayaFlux::Buffers::CompositeGeometryProcessor::processing_function(), MayaFlux::Buffers::GeometryBindingsProcessor::processing_function(), MayaFlux::Buffers::NetworkGeometryProcessor::processing_function(), MayaFlux::Buffers::AggregateBindingsProcessor::processing_function(), MayaFlux::Buffers::DescriptorBindingsProcessor::update_descriptor_from_node(), MayaFlux::Buffers::TextureProcessor::update_geometry_if_dirty(), upload_audio_to_gpu(), upload_from_view(), MayaFlux::Buffers::TextureProcessor::upload_initial_geometry(), upload_structured_view(), upload_to_gpu(), and upload_to_gpu().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: