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

Add support for asynchronous RenderingDevice.buffer_get_data() (hardware readbacks) #7886

Open
nelstuff opened this issue Sep 27, 2023 · 2 comments

Comments

@nelstuff
Copy link

Describe the project you are working on

Voxel game mostly running on GPU using compute shaders.

Describe the problem or limitation you are having in your project

Every time I want to read something on the GPU from the CPU, it stalls the compute pipeline to have up to date data.
var output_bytes := rd.buffer_get_data(buffer)
The performance penalty is very high.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Asynchronous function to read data when it is ready (can be a few frames delayed), without stalling the pipeline. Unity uses this: https://docs.unity3d.com/ScriptReference/Rendering.AsyncGPUReadback.html

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

rd.buffer_get_data_async(gpu_buffer, cpu_readback)

func cpu_readback(read_bytes):
    # do somehitng with read_bytes

If this enhancement will not be used often, can it be worked around with a few lines of script?

Not that I know of

Is there a reason why this should be core and not an add-on in the asset library?

I don't believe you can write this in an addon?

@Calinou
Copy link
Member

Calinou commented Sep 27, 2023

@Calinou Calinou changed the title Getting GPU data to the CPU without stalling the pipeline. Async buffer_get_data Add support for asynchronous RenderingDevice.buffer_get_data() (hardware readbacks) Sep 27, 2023
@granitrocky
Copy link

Has anyone begun work on this? Is there somewhere I could contribute to? I would really like to see this added to Godot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants