Can we implement async analogue of ComputeBuffer.GetData using native plugins?

Hey, I’ve been googling all day about this issue, got no results, so finally decided to ask the community.

It’s a well known issue that ComputeBuffer.GetData method stalls pipeline and waits until GPU could sync and do stuff. So, compute shaders do great, but if we need to get data from gpu every frame, fps drops significantly.

But there’s new ComputeBuffer.GetNativeBufferPtr thing appeared in 5.5. So, the question is: can we do async data read from GPU to CPU using native directx stuff?

I’m a complete noob at native plugin coding, but I need this feature alot, and could study and try until it works, but it’s hard to understand where to start. The closest thing I found is is this: ID3D11DeviceContext::GetData method

Tell me please, is it something that can replace functionality of ComputeBuffer.GetData but the async way? And if I’m wrong, is there still a way to async-read data from gpu with native plugins?

From the documentation:

It says it gets you the pointer so that way you can hand it off to a native plugin which can than access it on its own terms… which yeah, that’d technically be async, since your native plugin would be running asynchronously from Unity.

Note its warning that you should call this at initialization to get the pointer, as it has the syncing issue when called. Get the pointer up front, then let your native plugin do the rest.

Alright, cool. Now it’s time to learn that whole native D3D11 stuff to make it work.