Use FRHIGPUTextureReadback for Image download from GPU to CPU (Async/Non-Blocking Texture transfer) #20
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR changes the way how images get downloaded from the GPU to the CPU.
Instead of using
ReadSufaceData
it will use theFRHIGPUTextureReadback
structure to download the image from GPU to CPU asnychronously.This prevents the GPU from Blocking when the entire texture is transfered.
This also means it can take multiple frames till a texture finishes transfering.
After the Texture Readback is enqued, we not only check the render fence but also if the readback is ready.
Afterwards we lock the resource and get the pointer to the raw data.
Because we don't know the allocation size we have to calculate it our-self based on the additonally passed image size FIntPoint.
Additonally instead of raw pointers to the RenderRequest structures, the code now uses Reference Counted Shared Pointers.