Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question Copying contents of multiple compute buffers into a single compute buffer

Discussion in 'General Graphics' started by StormShadowXT, Aug 10, 2022.

  1. StormShadowXT

    StormShadowXT

    Joined:
    May 31, 2021
    Posts:
    5
    Hello everyone.
    I want to know if theres an efficient way to copy the contents of several compute buffers into a single buffer.

    For example,
    Suppose i have two buffers, C1 and C2. Each with a count of 100.
    Now theres another buffer called C3 with a count of 200 and with the same stride. I want to copy the contents of both C1 and C2 into C3. One after the other.

    Is there an efficient way to perform this? Something like a memcopy?
    I could just use a compute shader to copy everything manually. but that would be pretty slow.

    Thanks
     
  2. georgerh

    georgerh

    Joined:
    Feb 28, 2020
    Posts:
    72
    If you switch your ComputeBuffer for a GraphicsBuffer, you can use Graphics.CopyBuffer.

    According to this, GraphicsBuffer can be used everywhere ComputeBuffer can be used, but I have not tried it myself.