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

Method DownloadDataAsync

Source/Engine/Graphics/GPUSwapChain.cpp:51–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49}
50
51Task* GPUSwapChain::DownloadDataAsync(TextureData& result)
52{
53 if (_downloadTask)
54 {
55 LOG(Warning, "Can download window backuffer data only once at the time.");
56 return nullptr;
57 }
58
59 auto texture = GPUDevice::Instance->CreateTexture();
60 if (texture->Init(GPUTextureDescription::New2D(GetWidth(), GetHeight(), GetFormat(), GPUTextureFlags::None, 1).ToStagingReadback()))
61 {
62 LOG(Warning, "Failed to create staging texture for the window swapchain backuffer download.");
63 return nullptr;
64 }
65
66 auto task = New<GPUSwapChainDownloadTask>();
67 task->SwapChain = this;
68 task->Texture = texture;
69
70 const auto downloadTask = texture->DownloadDataAsync(result);
71 task->ContinueWith(downloadTask);
72
73 _downloadTask = task;
74 return task;
75}
76
77void GPUSwapChain::End(RenderTask* task)
78{

Callers

nothing calls this directly

Calls 8

New2DFunction · 0.85
GetWidthFunction · 0.85
GetFormatFunction · 0.85
ContinueWithMethod · 0.80
GetHeightFunction · 0.70
CreateTextureMethod · 0.45
InitMethod · 0.45
ToStagingReadbackMethod · 0.45

Tested by

no test coverage detected