- Home /
DirectX11 + AsyncGPUReadback and R32_SFloat in 2019.1.9+
I created a Unity tool that writes the depth buffer into an single-channel 32-bit floating point render texture (RenderTextureFormat.RFloat), then reads that back off the GPU with AsyncGPUReadback and does further processing. The script was developed under 2018.x. In 2019.1.x, however, the functionality breaks with the error: 'R32_SFloat' doesn't support ReadPixels usage on this platform. Async GPU readback failed.
Is there a new blessed path to retrieve non-RGB data from the GPU?
After a bit of research, it looks like 16-bit floats are supported. Then the challenge is "how do I get those into a data structure in system memory I can do arithmetic with?" Seems like I can get a byte array easily, but then getting that to a float[] array is unclear..
I am working on the same code base and could confirm this with Unity 2019.2.3f1. I discovered also the Following: When i try to AsyncGPUReadback.Request with some TextureFormat on a Texture2DArray, i get the error: '[Error] '88' doesn't support ReadPixels usage on this platform. Async GPU readback failed
. I tried TextureFormat.ARGB32, RGBA32, a couple of others. The Texture2DArray, which should be retrieved from the GPU, has the format ARGB32. However, if i don't specify the format, the readback works and i get ARGB32 pixels from the request. This behaviour seems odd to me. I would like to see some working examples for a Texture2DArray AsyncGPUReadback with a TextureFormat added as parameter.