6 Replies Latest reply on Oct 25, 2010 2:01 PM by pboudier

    Is GL_ARB_draw_indirect hardware accelerated?

    aqnuep

      Hi,

      The OpenGL extension GL_ARB_draw_indirect made core with OpenGL 4.0 enables one to source the drawing command parameters from within GPU buffer objects.

      My question is whether these calls are hardware accelerated. More precisely which of the followings is true?

      1. The driver reads the data from GPU buffer object and then issues the command normally.

      2. The driver issues an indirect command to the GPU and the GPU will unpack the info from the buffer object.

      If the later is true then why there is no MultiDraw*Indirect style commands? Those would enable to render heterogeneous object groups without the need of CPU/driver intervention.

        • Is GL_ARB_draw_indirect hardware accelerated?
          pboudier

           

          2. The driver issues an indirect command to the GPU and the GPU will unpack the info from the buffer object.

           

           



          yes.

          I am not sure what the MultiDraw*Indirect gives you extra (besides potential lower cpu overhead): can you clarify ?

          thanks,

          Pierre B.

            • Is GL_ARB_draw_indirect hardware accelerated?
              aqnuep

              MultiDraw*Indirect, if supported by hardware, could give the possibility that the GPU unpacks several draw command parameters one after another without the need of CPU/driver assistance.

              Sample use case:

              1. Store the whole scene's object information in a buffer object (including positions, bounding volume, start index, index count, etc.)

              2. Execute a geometry shader to do per-object view frustum culling and maybe other more sophisticated algorithms (e.g. GPU based dynamic LOD determination or Hierarchical-Z map based occlusion culling). The output will be start index, index count, etc. data.

              3. Use the previously generated buffer as the source for a MultiDraw*Indirect call and draw the whole scene with a single draw call.

              Of course, most of the cases you cannot reduce the number of draw calls to exactly one but it is much more efficient than having multiple Draw*Indirect calls on the CPU if the GPU is able to unpack several draw commands from the indirect buffer on its own without driver assistance.

                • Is GL_ARB_draw_indirect hardware accelerated?
                  aqnuep

                  Sorry for double posting but I don't really feel my question was 100% answered.

                  Is SM5.0 hardware capable of being able to execute a MultiDraw*Indirect command (if such would exist) on its own without driver assistance?

                  Are there any plans to include something like this in an upcoming extension? (e.g. GL_ARB_draw_indirect2)

                  Besides that GL_ARB_draw_indirect also mentions the "firstInstance" field that would be available if there would be a new version of GL_ARB_instanced_arrays / GL_ARB_draw_instanced which would also provide a "firstInstance" parameter.

                  If I understand correctly, this new "firstInstance" parameter would specify from where the GLSL built-in variable gl_InstanceID counts and also specifies the starting vertex index in case of instanced arrays as this is currently always starting from 0 if a new draw command is issued.

                  Can you tell anything about whether these feature is planned for the next revision of the OpenGL specification?

                    • Is GL_ARB_draw_indirect hardware accelerated?
                      pboudier

                       

                      thanks for the  description of your high level request. I believe that you can already achieve this behavior with the regular Draw*Indirect. 

                      the only difference with MultiDraw*Indirect would be that you would call the driver only once instead of multiple times. the overall behavior would still be the same, with the GPU directly fetching the parameters when appropriate without any CPU synchronization.

                      if your application is GPU bound, you would not tell any difference.

                      Pierre B.

                        • Is GL_ARB_draw_indirect hardware accelerated?
                          aqnuep

                          Yes, agree. I can do this with simple Draw*Indirect commands, however I'm worried about the additional CPU overhead that may arise in case of possibly hundreds of Draw*Indirect commands.

                          If there would be a MultiDraw*Indirect command at least the application developer could be esured that the commands are sent in one batch if it is made possible by hardware.

                          To be honest, in my case the best would be that also the primCount parameter of the MultiDraw*Indirect commands would also come from a buffer thus avoiding all possibilities of CPU sync as with only Draw*Indirect commands I still have to use asynchronous queries to figure out how many draw calls I have to issue.

                          Take my observations as feature requests that would be valuable for the developers in a future OpenGL release. I understand that this is currently impossible.