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

Method DownloadDataAsync

Source/Engine/Graphics/Textures/GPUTexture.cpp:839–883  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

837}
838
839Task* GPUTexture::DownloadDataAsync(TextureData& result)
840{
841 // Skip for empty ones
842 if (MipLevels() == 0)
843 {
844 LOG(Warning, "Cannot download texture data. It has not ben created yet.");
845 return nullptr;
846 }
847 if (Depth() != 1)
848 {
849 MISSING_CODE("support volume texture data downloading.");
850 }
851 PROFILE_CPU();
852 PROFILE_MEM(GraphicsTextures);
853
854 // Use faster path for staging resources
855 if (IsStaging())
856 {
857 // Create task to copy downloaded data to TextureData container
858 auto getDataTask = ::New<TextureDownloadDataTask>(this, this, result);
859 ASSERT(getDataTask->HasReference(this));
860 return getDataTask;
861 }
862
863 // Create the staging resource
864 const auto staging = ToStagingReadback();
865 if (staging == nullptr)
866 {
867 LOG(Error, "Cannot create staging resource from {0}.", ToString());
868 return nullptr;
869 }
870
871 // Create async resource copy task
872 auto copyTask = ::New<GPUCopyResourceTask>(this, staging);
873 ASSERT(copyTask->HasReference(this) && copyTask->HasReference(staging));
874
875 // Create task to copy downloaded data to TextureData container
876 auto getDataTask = ::New<TextureDownloadDataTask>(this, staging, result);
877 ASSERT(getDataTask->HasReference(this) && getDataTask->HasReference(staging));
878
879 // Set continuation
880 copyTask->ContinueWith(getDataTask);
881
882 return copyTask;
883}
884
885void GPUTexture::SetResidentMipLevels(int32 count)
886{

Callers 1

DownloadDataGPUAsyncMethod · 0.45

Calls 5

MipLevelsFunction · 0.85
ContinueWithMethod · 0.80
DepthFunction · 0.70
ToStringFunction · 0.70
HasReferenceMethod · 0.45

Tested by

no test coverage detected