diff options
author | Plamena Manolova <[email protected]> | 2017-10-02 23:58:24 +0300 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2017-10-02 16:25:36 -0700 |
commit | c63c8f51358e47383aa0f447b6882070a6d509a1 (patch) | |
tree | fb925430f632dfb1d9d34f557b1c70364cc6a236 /src/mesa/drivers | |
parent | 765e1fa3724411047e5ad044d2c86d10172ca275 (diff) |
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 <[email protected]>
Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_draw.c | 46 |
1 files 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 06c6ed72c98..1e93cb67c67 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 |