summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIago Toral Quiroga <[email protected]>2014-05-08 13:29:20 +0200
committerIago Toral Quiroga <[email protected]>2014-05-13 10:09:35 +0200
commit54216173252bdaffd12c1bbbaba85e8131396cff (patch)
tree59dddfadb5c334818be4ea804cd13febec6de00d
parenta143fbb3220e4c40cd2c75eca6f3e94fba0fe324 (diff)
i965: Avoid redundant call to brw_merge_inputs() in brw_try_draw_prims()
We always call brw_merge_inputs() right before looping over the primitives but this can be called inside the loop for each primitive too. In the case we do it for the first primitive the call is redundant and can be skipped. Reviewed-by: Eric Anholt <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_draw.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_draw.c b/src/mesa/drivers/dri/i965/brw_draw.c
index fef1c063e15..ac21656012a 100644
--- a/src/mesa/drivers/dri/i965/brw_draw.c
+++ b/src/mesa/drivers/dri/i965/brw_draw.c
@@ -458,15 +458,14 @@ static bool brw_try_draw_prims( struct gl_context *ctx,
intel_batchbuffer_require_space(brw, estimated_max_prim_size, RENDER_RING);
intel_batchbuffer_save_state(brw);
- if (brw->num_instances != prims[i].num_instances) {
+ if (brw->num_instances != prims[i].num_instances ||
+ brw->basevertex != prims[i].basevertex) {
brw->num_instances = prims[i].num_instances;
- brw->state.dirty.brw |= BRW_NEW_VERTICES;
- brw_merge_inputs(brw, arrays);
- }
- if (brw->basevertex != prims[i].basevertex) {
brw->basevertex = prims[i].basevertex;
- brw->state.dirty.brw |= BRW_NEW_VERTICES;
- brw_merge_inputs(brw, arrays);
+ if (i > 0) { /* For i == 0 we just did this before the loop */
+ brw->state.dirty.brw |= BRW_NEW_VERTICES;
+ brw_merge_inputs(brw, arrays);
+ }
}
if (brw->gen < 6)
brw_set_prim(brw, &prims[i]);