| 837 | } |
| 838 | |
| 839 | Task* 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 | |
| 885 | void GPUTexture::SetResidentMipLevels(int32 count) |
| 886 | { |
no test coverage detected