Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Feature Request DrawMeshInstancedIndirect API requires an args ComputeBuffer per DrawCall O.o

Discussion in 'Universal Render Pipeline' started by Opeth001, Apr 12, 2021.

  1. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    997
    Hello Everyone,

    I'm building a hybrid render package on top of the DrawMeshInstancedIndirect API while keeping the midrange 'OpenGL ES 3+' devices in mind, so I have a very limited number of ComputeBuffers. 'AFAIK is a minimum of 4'.

    the problem with this API is that it requires creating a ComputeBuffer args per DrawCall, which is a big waste.
    Is there an alternative / workaround to this?

    Thanks in advance!
     
  2. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,686
    Hi!
    'A minimum of 4' is per draw call, not total. Normally there's more, that's just what is guaranteed by the specification. Note: compute is available on OpenGL ES 3.1+.
     
    Opeth001 likes this.
  3. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    997
    Thank you for the reply!
    what do you mean by "A minimum of 4 per draw call".
    can you please give an example of use case where it is possible and where it is not.

    Thanks again!
     
  4. aleksandrk

    aleksandrk

    Unity Technologies

    Joined:
    Jul 3, 2017
    Posts:
    2,686
    This means that a single draw call can use up to at least 4 compute buffers in total. A compute buffer that is used for DrawMeshInstancedIndirect counts towards that limit. So if you are on a device that supports up to 4 compute buffers per draw call, you can use the remaining three in your shader for rendering.
     
    Opeth001 likes this.
  5. Opeth001

    Opeth001

    Joined:
    Jan 28, 2017
    Posts:
    997
    Thanks!