Search Unity

Compute Shader Append Buffer into NativeArray length problem

Discussion in 'Shaders' started by esgnn, Jan 13, 2022.

  1. esgnn

    esgnn

    Joined:
    Mar 3, 2020
    Posts:
    38
    Hi,
    I am trying to read back an append buffer into a NativeArray by AsyncGPUReadback.
    When I try to read the buffer into a NativeArray, with length based on ComputeBuffer.CopyCount() result, Unity crashes (I don't even get a post crash screen, editor just closes). However, I can read it into a NativeArray, with length based on buffer's size.
    I can read the buffer back into a Vector3 array, with length based on ComputeBuffer.CopyCount() result, using GetData().
    Is this an expected result?
    (Unity 2022.1.0b2.2474 - HDRP)