Search Unity

NativeSlice and ComputeBuffers

Discussion in 'Data Oriented Technology Stack' started by LennartJohansen, Mar 21, 2018.

  1. LennartJohansen

    LennartJohansen

    Joined:
    Dec 1, 2014
    Posts:
    2,310
    Hi.

    Is there a way to convert a NativeSlice to a NativeArray for use with APIs like the SetData on the ComputeBuffers. Copying the data to a new NativeArray seems like a bit of overhead.

    Lennart
     
    laurentlavigne and DaDonik like this.
  2. GabrieleUnity

    GabrieleUnity

    Unity Technologies

    Joined:
    Sep 4, 2012
    Posts:
    116
    At the moment it is not possible because most of the API taking NativeArrays don't understand strides and offsets. But we are working on providing overloads for some of the API to take a NativeSlice when it makes sense.