From: Marek Olšák Date: Tue, 11 Feb 2020 00:54:44 +0000 (-0500) Subject: i965: stop using "indirect" parameter from Driver.Draw (non-indirect) X-Git-Tag: upstream/20.1.8~3089 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9556805ac4d149d370de97e6a409e99250b94ebc;p=platform%2Fupstream%2Fmesa.git i965: stop using "indirect" parameter from Driver.Draw (non-indirect) The parameter will be removed. v2: added UNUSED, removed "!!" Reviewed-by: Ian Romanick Part-of: --- diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 754d651..ecd40af 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -907,6 +907,11 @@ struct brw_context */ struct brw_bo *draw_params_count_bo; uint32_t draw_params_count_offset; + + /** + * Draw indirect buffer. + */ + struct gl_buffer_object *draw_indirect_data; } draw; struct { diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c index 3f705bc..92c5774 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.c +++ b/src/mesa/drivers/dri/i965/brw_draw.c @@ -956,12 +956,12 @@ brw_draw_single_prim(struct gl_context *ctx, const struct _mesa_prim *prim, unsigned prim_id, struct brw_transform_feedback_object *xfb_obj, - unsigned stream, - struct gl_buffer_object *indirect) + unsigned stream) { struct brw_context *brw = brw_context(ctx); const struct gen_device_info *devinfo = &brw->screen->devinfo; bool fail_next; + bool is_indirect = brw->draw.draw_indirect_data != NULL; /* Flag BRW_NEW_DRAW_CALL on every draw. This allows us to have * atoms that happen on every draw call. @@ -1003,7 +1003,7 @@ brw_draw_single_prim(struct gl_context *ctx, vs_prog_data->uses_firstvertex || vs_prog_data->uses_baseinstance; - if ((uses_draw_parameters && indirect) || + if ((uses_draw_parameters && is_indirect) || (vs_prog_data->uses_firstvertex && brw->draw.params.firstvertex != new_firstvertex) || (vs_prog_data->uses_baseinstance && @@ -1015,7 +1015,7 @@ brw_draw_single_prim(struct gl_context *ctx, brw->draw.params.gl_baseinstance = new_baseinstance; brw_bo_unreference(brw->draw.draw_params_bo); - if (indirect) { + if (is_indirect) { /* Point draw_params_bo at the indirect buffer. */ brw->draw.draw_params_bo = intel_buffer_object(ctx->DrawIndirectBuffer)->buffer; @@ -1066,7 +1066,7 @@ retry: if (devinfo->gen == 9) gen9_emit_preempt_wa(brw, prim); - brw_emit_prim(brw, prim, brw->primitive, xfb_obj, stream, !!indirect); + brw_emit_prim(brw, prim, brw->primitive, xfb_obj, stream, is_indirect); brw->batch.no_wrap = false; @@ -1105,7 +1105,7 @@ brw_draw_prims(struct gl_context *ctx, GLuint max_index, struct gl_transform_feedback_object *gl_xfb_obj, unsigned stream, - struct gl_buffer_object *indirect) + UNUSED struct gl_buffer_object *unused_indirect) { unsigned i; struct brw_context *brw = brw_context(ctx); @@ -1117,7 +1117,7 @@ brw_draw_prims(struct gl_context *ctx, return; /* Handle primitive restart if needed */ - if (brw_handle_primitive_restart(ctx, prims, nr_prims, ib, indirect)) { + if (brw_handle_primitive_restart(ctx, prims, nr_prims, ib)) { /* The draw was handled, so we can exit now */ return; } @@ -1183,7 +1183,7 @@ brw_draw_prims(struct gl_context *ctx, brw->predicate.state = BRW_PREDICATE_STATE_USE_BIT; } - brw_draw_single_prim(ctx, &prims[i], i, xfb_obj, stream, indirect); + brw_draw_single_prim(ctx, &prims[i], i, xfb_obj, stream); } brw_finish_drawing(ctx); @@ -1230,11 +1230,14 @@ brw_draw_indirect_prims(struct gl_context *ctx, brw->draw.draw_params_count_offset = indirect_params_offset; } + brw->draw.draw_indirect_data = indirect_data; + brw_draw_prims(ctx, prim, draw_count, ib, false, 0, ~0, NULL, 0, - indirect_data); + NULL); + brw->draw.draw_indirect_data = NULL; free(prim); } diff --git a/src/mesa/drivers/dri/i965/brw_draw.h b/src/mesa/drivers/dri/i965/brw_draw.h index c74a253..1e111fe 100644 --- a/src/mesa/drivers/dri/i965/brw_draw.h +++ b/src/mesa/drivers/dri/i965/brw_draw.h @@ -66,8 +66,7 @@ GLboolean brw_handle_primitive_restart(struct gl_context *ctx, const struct _mesa_prim *prims, GLuint nr_prims, - const struct _mesa_index_buffer *ib, - struct gl_buffer_object *indirect); + const struct _mesa_index_buffer *ib); void brw_draw_indirect_prims(struct gl_context *ctx, diff --git a/src/mesa/drivers/dri/i965/brw_primitive_restart.c b/src/mesa/drivers/dri/i965/brw_primitive_restart.c index 3b696aa..4e4aeeb 100644 --- a/src/mesa/drivers/dri/i965/brw_primitive_restart.c +++ b/src/mesa/drivers/dri/i965/brw_primitive_restart.c @@ -130,8 +130,7 @@ GLboolean brw_handle_primitive_restart(struct gl_context *ctx, const struct _mesa_prim *prims, GLuint nr_prims, - const struct _mesa_index_buffer *ib, - struct gl_buffer_object *indirect) + const struct _mesa_index_buffer *ib) { struct brw_context *brw = brw_context(ctx); @@ -164,13 +163,18 @@ brw_handle_primitive_restart(struct gl_context *ctx, */ brw->prim_restart.enable_cut_index = true; brw_draw_prims(ctx, prims, nr_prims, ib, GL_FALSE, -1, -1, NULL, 0, - indirect); + NULL); brw->prim_restart.enable_cut_index = false; } else { /* Not all the primitive draw modes are supported by the cut index, * so take the software path */ - vbo_sw_primitive_restart(ctx, prims, nr_prims, ib, indirect); + struct gl_buffer_object *indirect_data = brw->draw.draw_indirect_data; + + /* Clear this to make the draw direct. */ + brw->draw.draw_indirect_data = NULL; + + vbo_sw_primitive_restart(ctx, prims, nr_prims, ib, indirect_data); } brw->prim_restart.in_progress = false;