Search Unity

  1. Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community.
    Dismiss Notice

AsyncGpuReadBack returns with error

Discussion in 'Scripting' started by pyjamaslug, Aug 20, 2019.

  1. pyjamaslug

    pyjamaslug

    Joined:
    Jul 5, 2017
    Posts:
    46
    Hi,
    I have a number of camera clusters set up to capture images and other data using AsyncGpuReadBack. I have it working nicely and am getting good performance but I also get some readback errors.
    In one configuration, I have six cameras, three of which are capturing images from the screen and three are capturing other data from rendertextures. The readback request is being made in OnRenderImage() like this:
    Code (CSharp):
    1.     private void OnRenderImage (RenderTexture source, RenderTexture destination)
    2.     {
    3.         if (capturing)
    4.         {
    5.             switch (cameraType)
    6.             {
    7.                 case "image":
    8.                     {
    9.                         inputBundle.request = AsyncGPUReadback.Request(source,0,TextureFormat.RGBA32);
    10.                         inputQueue.Enqueue(inputBundle);
    11.                         inputCounter++;
    12.                         Graphics.Blit(source, destination);
    13.                         break;
    14.                     }
    15.                 case "mask":
    16.                     {
    17.                         inputBundle.request = AsyncGPUReadback.Request(rT);
    18.                         inputQueue.Enqueue(inputBundle);
    19.                         inputCounter++;
    20.                         RenderTexture.active = currentRT;
    21.                         GetComponent<Camera>().targetTexture = null;
    22.                         break;
    23.                     }
    24.                 default:
    25.                     break;
    26.             }
    27.             capturing = false;
    28.         }
    There seems to be zero documentation on what might be causing the errors - does anyone have an idea where to start looking to debug this?
     
unityunity