MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / DownloadDataAsync

Method DownloadDataAsync

Source/Engine/Graphics/GPUBuffer.cpp:408–434  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

406};
407
408Task* GPUBuffer::DownloadDataAsync(BytesContainer& result)
409{
410 // Skip for empty ones
411 if (GetSize() == 0)
412 return nullptr;
413
414 // Create the staging resource
415 const auto staging = ToStagingReadback();
416 if (staging == nullptr)
417 {
418 LOG(Warning, "Cannot create staging resource from {0}.", ToString());
419 return nullptr;
420 }
421
422 // Create async resource copy task
423 auto copyTask = ::New<GPUCopyResourceTask>(this, staging);
424 ASSERT(copyTask->HasReference(this) && copyTask->HasReference(staging));
425
426 // Create task to copy downloaded data to BytesContainer
427 const auto getDataTask = ::New<BufferDownloadDataTask>(this, staging, result);
428 ASSERT(getDataTask->HasReference(this) && getDataTask->HasReference(staging));
429
430 // Set continuation
431 copyTask->ContinueWith(getDataTask);
432
433 return copyTask;
434}
435
436bool GPUBuffer::GetData(BytesContainer& output)
437{

Callers 3

UpdateMethod · 0.45
CaptureMethod · 0.45
FlushMethod · 0.45

Calls 4

ContinueWithMethod · 0.80
GetSizeFunction · 0.70
ToStringFunction · 0.70
HasReferenceMethod · 0.45

Tested by

no test coverage detected