mesa: add indirect drawing buffer parameter to draw functions
authorChristoph Bumiller <e0425955@student.tuwien.ac.at>
Fri, 5 Apr 2013 10:12:08 +0000 (12:12 +0200)
committerChris Forbes <chrisf@ijw.co.nz>
Mon, 25 Nov 2013 09:01:35 +0000 (22:01 +1300)
Split from patch implementing ARB_draw_indirect.

v2: Const-qualify the struct gl_buffer_object *indirect argument.
v3: Fix up some more draw calls for new argument.
v4: Fix up rebase conflicts in i965.
v5: Undo const-qualification

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
18 files changed:
src/mesa/drivers/dri/i965/brw_draw.c
src/mesa/drivers/dri/i965/brw_draw.h
src/mesa/drivers/dri/i965/brw_primitive_restart.c
src/mesa/drivers/dri/nouveau/nouveau_vbo_t.c
src/mesa/state_tracker/st_cb_rasterpos.c
src/mesa/state_tracker/st_draw.c
src/mesa/state_tracker/st_draw.h
src/mesa/state_tracker/st_draw_feedback.c
src/mesa/tnl/t_draw.c
src/mesa/tnl/tnl.h
src/mesa/vbo/vbo.h
src/mesa/vbo/vbo_exec_array.c
src/mesa/vbo/vbo_exec_draw.c
src/mesa/vbo/vbo_primitive_restart.c
src/mesa/vbo/vbo_rebase.c
src/mesa/vbo/vbo_save_draw.c
src/mesa/vbo/vbo_split_copy.c
src/mesa/vbo/vbo_split_inplace.c

index 1da45df4aba70266868d4531aecd1a75054e458f..eeee5430474cf518beb2a532d8935911a9cffe42 100644 (file)
@@ -463,7 +463,8 @@ void brw_draw_prims( struct gl_context *ctx,
                     GLboolean index_bounds_valid,
                     GLuint min_index,
                     GLuint max_index,
-                    struct gl_transform_feedback_object *unused_tfb_object)
+                    struct gl_transform_feedback_object *unused_tfb_object,
+                    struct gl_buffer_object *indirect )
 {
    struct brw_context *brw = brw_context(ctx);
    const struct gl_client_array **arrays = ctx->Array._DrawArrays;
index fb96813b70f56dfdbc8b00e9d7756cbfa743f0de..119d6f16f7e4803043f902e112b2a359a971c58f 100644 (file)
@@ -41,7 +41,8 @@ void brw_draw_prims( struct gl_context *ctx,
                     GLboolean index_bounds_valid,
                     GLuint min_index,
                     GLuint max_index,
-                    struct gl_transform_feedback_object *unused_tfb_object);
+                    struct gl_transform_feedback_object *unused_tfb_object,
+                    struct gl_buffer_object *indirect );
 
 void brw_draw_init( struct brw_context *brw );
 void brw_draw_destroy( struct brw_context *brw );
index 2ee6055032e34f7f384d843f0e1d3ed0d600fd3b..a1311510daf676483e669bc13275c50c806834cb 100644 (file)
@@ -169,7 +169,7 @@ brw_handle_primitive_restart(struct gl_context *ctx,
       /* Cut index should work for primitive restart, so use it
        */
       brw->prim_restart.enable_cut_index = true;
-      brw_draw_prims(ctx, prims, nr_prims, ib, GL_FALSE, -1, -1, NULL);
+      brw_draw_prims(ctx, prims, nr_prims, ib, GL_FALSE, -1, -1, NULL, NULL);
       brw->prim_restart.enable_cut_index = false;
    } else {
       /* Not all the primitive draw modes are supported by the cut index,
index 436db328eedf95b299893b2ab0637f138884d359..dff947aa02828c2649a9e134bbaac693ddad74a0 100644 (file)
@@ -222,7 +222,8 @@ TAG(vbo_render_prims)(struct gl_context *ctx,
                      const struct _mesa_index_buffer *ib,
                      GLboolean index_bounds_valid,
                      GLuint min_index, GLuint max_index,
-                     struct gl_transform_feedback_object *tfb_vertcount);
+                     struct gl_transform_feedback_object *tfb_vertcount,
+                     struct gl_buffer_object *indirect);
 
 static GLboolean
 vbo_maybe_split(struct gl_context *ctx, const struct gl_client_array **arrays,
@@ -453,7 +454,8 @@ TAG(vbo_render_prims)(struct gl_context *ctx,
                      const struct _mesa_index_buffer *ib,
                      GLboolean index_bounds_valid,
                      GLuint min_index, GLuint max_index,
-                     struct gl_transform_feedback_object *tfb_vertcount)
+                     struct gl_transform_feedback_object *tfb_vertcount,
+                     struct gl_buffer_object *indirect)
 {
        struct nouveau_render_state *render = to_render_state(ctx);
        const struct gl_client_array **arrays = ctx->Array._DrawArrays;
@@ -489,7 +491,8 @@ TAG(vbo_check_render_prims)(struct gl_context *ctx,
                            const struct _mesa_index_buffer *ib,
                            GLboolean index_bounds_valid,
                            GLuint min_index, GLuint max_index,
-                           struct gl_transform_feedback_object *tfb_vertcount)
+                           struct gl_transform_feedback_object *tfb_vertcount,
+                           struct gl_buffer_object *indirect)
 {
        struct nouveau_context *nctx = to_nouveau_context(ctx);
 
@@ -498,12 +501,12 @@ TAG(vbo_check_render_prims)(struct gl_context *ctx,
        if (nctx->fallback == HWTNL)
                TAG(vbo_render_prims)(ctx, prims, nr_prims, ib,
                                      index_bounds_valid, min_index, max_index,
-                                     tfb_vertcount);
+                                     tfb_vertcount, indirect);
 
        if (nctx->fallback == SWTNL)
                _tnl_vbo_draw_prims(ctx, prims, nr_prims, ib,
                                    index_bounds_valid, min_index, max_index,
-                                   tfb_vertcount);
+                                   tfb_vertcount, indirect);
 }
 
 void
index 26a55909d5ae9f0bfff4615ea7249ca887983ffd..420dc5fc9e88f18b21c779c2a9317ef644112f22 100644 (file)
@@ -254,7 +254,7 @@ st_RasterPos(struct gl_context *ctx, const GLfloat v[4])
     * st_feedback_draw_vbo doesn't check for that flag. */
    ctx->Array._DrawArrays = rs->arrays;
    st_feedback_draw_vbo(ctx, &rs->prim, 1, NULL, GL_TRUE, 0, 1,
-                        NULL);
+                        NULL, NULL);
    ctx->Array._DrawArrays = saved_arrays;
 
    /* restore draw's rasterization stage depending on rendermode */
index 51bb23807e8f64bba634e71b68fc4dd86aa47f30..ef0a60732bcc59fb2e1bf4ef9d6137bc7ef41a23 100644 (file)
@@ -195,7 +195,8 @@ st_draw_vbo(struct gl_context *ctx,
            GLboolean index_bounds_valid,
             GLuint min_index,
             GLuint max_index,
-            struct gl_transform_feedback_object *tfb_vertcount)
+            struct gl_transform_feedback_object *tfb_vertcount,
+            struct gl_buffer_object *indirect)
 {
    struct st_context *st = st_context(ctx);
    struct pipe_index_buffer ibuffer = {0};
index 394473b20d5908012c86bdeedbefe2061914fcf9..9c4d6cbba968c9e83fd2e99ac82009657d289fec 100644 (file)
@@ -55,7 +55,8 @@ st_draw_vbo(struct gl_context *ctx,
            GLboolean index_bounds_valid,
             GLuint min_index,
             GLuint max_index,
-            struct gl_transform_feedback_object *tfb_vertcount);
+            struct gl_transform_feedback_object *tfb_vertcount,
+            struct gl_buffer_object *indirect);
 
 extern void
 st_feedback_draw_vbo(struct gl_context *ctx,
@@ -65,7 +66,8 @@ st_feedback_draw_vbo(struct gl_context *ctx,
                     GLboolean index_bounds_valid,
                      GLuint min_index,
                      GLuint max_index,
-                     struct gl_transform_feedback_object *tfb_vertcount);
+                     struct gl_transform_feedback_object *tfb_vertcount,
+                     struct gl_buffer_object *indirect);
 
 /**
  * When drawing with VBOs, the addresses specified with
index 1ac9585e7d51e1af16e296d9d735aeb7c5da54bd..f5566446f424149fc0d1a80d06b200e8c8e2afa2 100644 (file)
@@ -116,7 +116,8 @@ st_feedback_draw_vbo(struct gl_context *ctx,
                     GLboolean index_bounds_valid,
                      GLuint min_index,
                      GLuint max_index,
-                     struct gl_transform_feedback_object *tfb_vertcount)
+                     struct gl_transform_feedback_object *tfb_vertcount,
+                     struct gl_buffer_object *indirect)
 {
    struct st_context *st = st_context(ctx);
    struct pipe_context *pipe = st->pipe;
index 637ac6f9cfbfc14e6a09bbd406ea82f6328d5bc0..d6b09005e83456b5c22736d8c775e4efb744ec95 100644 (file)
@@ -415,7 +415,8 @@ void _tnl_vbo_draw_prims(struct gl_context *ctx,
                         GLboolean index_bounds_valid,
                         GLuint min_index,
                         GLuint max_index,
-                        struct gl_transform_feedback_object *tfb_vertcount)
+                        struct gl_transform_feedback_object *tfb_vertcount,
+                        struct gl_buffer_object *indirect)
 {
    const struct gl_client_array **arrays = ctx->Array._DrawArrays;
 
index 162b7abd73531b2e1a0d1a0178918a2174c1e2bc..86ef5057e873abe4ba003b44b43250b99a86ce48 100644 (file)
@@ -92,7 +92,8 @@ _tnl_vbo_draw_prims( struct gl_context *ctx,
                     GLboolean index_bounds_valid,
                     GLuint min_index,
                     GLuint max_index,
-                    struct gl_transform_feedback_object *tfb_vertcount );
+                    struct gl_transform_feedback_object *tfb_vertcount,
+                    struct gl_buffer_object *indirect );
 
 extern void
 _tnl_RasterPos(struct gl_context *ctx, const GLfloat vObj[4]);
index c4472e9c2ebd4336bf38ceffaafc9d26961fba81..827917fc37f51a42b1e755cb46806b10d2557a12 100644 (file)
@@ -89,7 +89,8 @@ typedef void (*vbo_draw_func)( struct gl_context *ctx,
                               GLboolean index_bounds_valid,
                               GLuint min_index,
                               GLuint max_index,
-                              struct gl_transform_feedback_object *tfb_vertcount );
+                              struct gl_transform_feedback_object *tfb_vertcount,
+                              struct gl_buffer_object *indirect );
 
 
 
index d72382376bd56f3cfd878b446a21e265f19279bf..a2c0c7d8f31625375fde2b4e24acdcf3aacf1e77 100644 (file)
@@ -583,7 +583,7 @@ vbo_handle_primitive_restart(struct gl_context *ctx,
    } else {
       /* Call driver directly for draw_prims */
       vbo->draw_prims(ctx, prim, nr_prims, ib,
-                      index_bounds_valid, min_index, max_index, NULL);
+                      index_bounds_valid, min_index, max_index, NULL, NULL);
    }
 }
 
@@ -648,7 +648,7 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
          /* draw one or two prims */
          check_buffers_are_unmapped(exec->array.inputs);
          vbo->draw_prims(ctx, prim, primCount, NULL,
-                         GL_TRUE, start, start + count - 1, NULL);
+                         GL_TRUE, start, start + count - 1, NULL, NULL);
       }
    }
    else {
@@ -659,7 +659,7 @@ vbo_draw_arrays(struct gl_context *ctx, GLenum mode, GLint start,
       check_buffers_are_unmapped(exec->array.inputs);
       vbo->draw_prims(ctx, prim, 1, NULL,
                       GL_TRUE, start, start + count - 1,
-                      NULL);
+                      NULL, NULL);
    }
 
    if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) {
@@ -1490,7 +1490,7 @@ vbo_draw_transform_feedback(struct gl_context *ctx, GLenum mode,
 
    check_buffers_are_unmapped(exec->array.inputs);
    vbo->draw_prims(ctx, prim, 1, NULL,
-                   GL_TRUE, 0, 0, obj);
+                   GL_TRUE, 0, 0, obj, NULL);
 
    if (MESA_DEBUG_FLAGS & DEBUG_ALWAYS_FLUSH) {
       _mesa_flush(ctx);
index 1075bd5d4c67b74a008f0750b7b8e2875f8ca63b..a96502ffbeb2722364328c84eaea4002a95623c1 100644 (file)
@@ -403,7 +403,7 @@ vbo_exec_vtx_flush(struct vbo_exec_context *exec, GLboolean keepUnmapped)
                                       GL_TRUE,
                                       0,
                                       exec->vtx.vert_count - 1,
-                                      NULL);
+                                      NULL, NULL);
 
         /* If using a real VBO, get new storage -- unless asked not to.
           */
index 418f8829d9b7218e6508d64d3e908da388c99469..e5c93ac6dfc6c3246b946c1a43c2167d71a8c636 100644 (file)
@@ -214,11 +214,11 @@ vbo_sw_primitive_restart(struct gl_context *ctx,
                 (temp_prim.count == sub_prim->count)) {
                draw_prims_func(ctx, &temp_prim, 1, ib,
                                GL_TRUE, sub_prim->min_index, sub_prim->max_index,
-                               NULL);
+                               NULL, NULL);
             } else {
                draw_prims_func(ctx, &temp_prim, 1, ib,
                                GL_FALSE, -1, -1,
-                               NULL);
+                               NULL, NULL);
             }
          }
          if (sub_end_index >= end_index) {
index e8258727b2d4418a5d7375d12b78fcca07844fe3..f63c473752b6bf6d8da1f7c6c321f4b58e3ed2ff 100644 (file)
@@ -237,7 +237,7 @@ void vbo_rebase_prims( struct gl_context *ctx,
         GL_TRUE,
         0, 
         max_index - min_index,
-        NULL );
+        NULL, NULL );
 
    ctx->Array._DrawArrays = saved_arrays;
    ctx->NewDriverState |= ctx->DriverFlags.NewArray;
index b4c9176309502864f4a44886c1448bbbb200d4d2..e961c1d5c26b591faf49ea1663020e53e7c529ef 100644 (file)
@@ -313,7 +313,7 @@ vbo_save_playback_vertex_list(struct gl_context *ctx, void *data)
                                       GL_TRUE,
                                       0,    /* Node is a VBO, so this is ok */
                                       node->count - 1,
-                                      NULL);
+                                      NULL, NULL);
       }
    }
 
index 2175c8ac7345559c094b4ee2d072e8b51bd99d59..9e391a3ed2d5580cc6cf264a62eb6c3c0484a71a 100644 (file)
@@ -201,7 +201,7 @@ flush( struct copy_context *copy )
               GL_TRUE,
               0,
               copy->dstbuf_nr - 1,
-              NULL );
+              NULL, NULL );
 
    ctx->Array._DrawArrays = saved_arrays;
    ctx->NewDriverState |= ctx->DriverFlags.NewArray;
index d04429707060efa0139823b0c8373a4497f475d9..de00fc86ee0efc44d2ca172789efd40c2f579831 100644 (file)
@@ -94,7 +94,7 @@ static void flush_vertex( struct split_context *split )
               !split->ib,
               split->min_index,
               split->max_index,
-              NULL);
+              NULL, NULL);
 
    ctx->Array._DrawArrays = saved_arrays;
    ctx->NewDriverState |= ctx->DriverFlags.NewArray;