Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use FRHIGPUTextureReadback for Image download from GPU to CPU (Async/Non-Blocking Texture transfer) #20

Merged
merged 1 commit into from
Sep 17, 2022

Conversation

Panakotta00
Copy link
Contributor

This PR changes the way how images get downloaded from the GPU to the CPU.

Instead of using ReadSufaceData it will use the FRHIGPUTextureReadback 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.

@TimmHess
Copy link
Owner

That sounds awesome! Thanks a lot for taking the time to integrate this!
I will find time (hopefully tomorrow) to briefly test this for my setup and then integrate it right away 👍

@TimmHess TimmHess merged commit 632b5a3 into TimmHess:master Sep 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants