Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Using the ARB_multi_draw_indirect command

  1. #1
    Intern Contributor
    Join Date
    Apr 2014

    Question Using the ARB_multi_draw_indirect command


    Has anyone used the "ARB_multi_draw_indirect" command? Apparently it is supposed to make drawing much faster depending on the situation but I don't know how to use it.

    My drawing code is currently a loop where I bind each item I want to draw with a VAO, send my MVP/Normal Matrix via glUniformMatrix* functions, send a UBO object with my materials/colors, and then do my glDrawElements(*) function.

    But apparently using ARB_multi_draw_indirect is much faster.

    Anyone have an example of it's use and how to use it correctly?

    Thank you for your time.

  2. #2
    Advanced Member Frequent Contributor arekkusu's Avatar
    Join Date
    Nov 2003
    The point of "indirect" is that the draw arguments come from a buffer object.

    This is useful if your content is *generated on the GPU*, i.e. via transform feedback, or compute shaders.

    A simple example is to move frustum culling to the GPU. For a world containing N objects:
    a) draw N containers (spheres or AABB) with "culling shader"
    b) culling shader tests containers against frustum and outputs either zero, or real number of vertices to draw for that object, into buffer
    c) draw N objects, with vertex counts from the buffer (zero-vertex objects become no-op draws.)

    More complex examples would be procedural object generation, or some screen space effects (bokeh bloom...) that create varying number of vertices.
    The "indirect" draw allows the CPU to simply say "draw stuff, and then draw however many vertices that produces", without any intervening synchronization between CPU and GPU.

    If your draw arguments *already* come from the CPU, then draw indirect won't help you at all.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts