Mesa (master): i965: Introduce brw_prepare_drawing.

Kenneth Graunke kwg at kemper.freedesktop.org
Mon Oct 2 23:26:02 UTC 2017


Module: Mesa
Branch: master
Commit: c63c8f51358e47383aa0f447b6882070a6d509a1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=c63c8f51358e47383aa0f447b6882070a6d509a1

Author: Plamena Manolova <plamena.n.manolova at gmail.com>
Date:   Mon Oct  2 23:58:24 2017 +0300

i965: Introduce brw_prepare_drawing.

In order to add our ARB_indirect_parameters implementation we
need to refactor brw_try_draw_prims so that it operates on a
per primitive basis and move the loop into brw_draw_prims.
This commit introduces the brw_prepare_drawing function where
we move the code that executes once before the loop.

Signed-off-by: Plamena Manolova <plamena.manolova at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/i965/brw_draw.c | 46 +++++++++++++++++++++---------------
 1 file changed, 27 insertions(+), 19 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index 06c6ed72c9..1e93cb67c6 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -593,26 +593,15 @@ brw_postdraw_reconcile_align_wa_slices(struct brw_context *brw)
    }
 }
 
-/* May fail if out of video memory for texture or vbo upload, or on
- * fallback conditions.
- */
 static void
-brw_try_draw_prims(struct gl_context *ctx,
-                   const struct gl_vertex_array *arrays[],
-                   const struct _mesa_prim *prims,
-                   GLuint nr_prims,
-                   const struct _mesa_index_buffer *ib,
-                   bool index_bounds_valid,
-                   GLuint min_index,
-                   GLuint max_index,
-                   struct brw_transform_feedback_object *xfb_obj,
-                   unsigned stream,
-                   struct gl_buffer_object *indirect)
+brw_prepare_drawing(struct gl_context *ctx,
+                    const struct gl_vertex_array *arrays[],
+                    const struct _mesa_index_buffer *ib,
+                    bool index_bounds_valid,
+                    GLuint min_index,
+                    GLuint max_index)
 {
    struct brw_context *brw = brw_context(ctx);
-   const struct gen_device_info *devinfo = &brw->screen->devinfo;
-   GLuint i;
-   bool fail_next = false;
 
    if (ctx->NewState)
       _mesa_update_state(ctx);
@@ -667,6 +656,24 @@ brw_try_draw_prims(struct gl_context *ctx,
    brw->vb.min_index = min_index;
    brw->vb.max_index = max_index;
    brw->ctx.NewDriverState |= BRW_NEW_VERTICES;
+}
+
+/* May fail if out of video memory for texture or vbo upload, or on
+ * fallback conditions.
+ */
+static void
+brw_try_draw_prims(struct gl_context *ctx,
+                   const struct gl_vertex_array *arrays[],
+                   const struct _mesa_prim *prims,
+                   GLuint nr_prims,
+                   struct brw_transform_feedback_object *xfb_obj,
+                   unsigned stream,
+                   struct gl_buffer_object *indirect)
+{
+   struct brw_context *brw = brw_context(ctx);
+   const struct gen_device_info *devinfo = &brw->screen->devinfo;
+   GLuint i;
+   bool fail_next = false;
 
    for (i = 0; i < nr_prims; i++) {
       /* Flag BRW_NEW_DRAW_CALL on every draw.  This allows us to have
@@ -849,12 +856,13 @@ brw_draw_prims(struct gl_context *ctx,
       index_bounds_valid = true;
    }
 
+   brw_prepare_drawing(ctx, arrays, ib, index_bounds_valid, min_index,
+                       max_index);
    /* Try drawing with the hardware, but don't do anything else if we can't
     * manage it.  swrast doesn't support our featureset, so we can't fall back
     * to it.
     */
-   brw_try_draw_prims(ctx, arrays, prims, nr_prims, ib, index_bounds_valid,
-                      min_index, max_index, xfb_obj, stream, indirect);
+   brw_try_draw_prims(ctx, arrays, prims, nr_prims, xfb_obj, stream, indirect);
 }
 
 void




More information about the mesa-commit mailing list