From cabc7b44c0fef2122ee001363e4d6e5cb6e66012 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Thu, 27 Jun 2013 18:19:16 +0800 Subject: [PATCH] ilo: track if primitive restart has changed Re-emit 3DSTATE_INDEX_BUFFER to enable/disable primitive restart. --- src/gallium/drivers/ilo/ilo_3d_pipeline.h | 1 + src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c | 7 ++++++- src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.h | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline.h b/src/gallium/drivers/ilo/ilo_3d_pipeline.h index 7a867aaea27..f26fa83c2dc 100644 --- a/src/gallium/drivers/ilo/ilo_3d_pipeline.h +++ b/src/gallium/drivers/ilo/ilo_3d_pipeline.h @@ -187,6 +187,7 @@ struct ilo_3d_pipeline { struct ilo_3d_pipeline_state { bool has_gen6_wa_pipe_control; + bool primitive_restart; int reduced_prim; int so_num_vertices, so_max_vertices; diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c index 190f6a9d9fb..5e9e9869ee1 100644 --- a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c +++ b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c @@ -399,7 +399,8 @@ gen6_pipeline_vf(struct ilo_3d_pipeline *p, struct gen6_pipeline_session *session) { /* 3DSTATE_INDEX_BUFFER */ - if (DIRTY(INDEX_BUFFER) || session->batch_bo_changed) { + if (DIRTY(INDEX_BUFFER) || session->primitive_restart_changed || + session->batch_bo_changed) { p->gen6_3DSTATE_INDEX_BUFFER(p->dev, &ilo->ib, ilo->draw->primitive_restart, p->cp); } @@ -1306,6 +1307,7 @@ gen6_pipeline_prepare(const struct ilo_3d_pipeline *p, session->state_bo_changed = true; session->kernel_bo_changed = true; session->prim_changed = true; + session->primitive_restart_changed = true; } else { /* @@ -1325,6 +1327,8 @@ gen6_pipeline_prepare(const struct ilo_3d_pipeline *p, session->kernel_bo_changed = (p->invalidate_flags & ILO_3D_PIPELINE_INVALIDATE_KERNEL_BO); session->prim_changed = (p->state.reduced_prim != session->reduced_prim); + session->primitive_restart_changed = + (p->state.primitive_restart != ilo->draw->primitive_restart); } } @@ -1363,6 +1367,7 @@ gen6_pipeline_end(struct ilo_3d_pipeline *p, assert(used <= estimate); p->state.reduced_prim = session->reduced_prim; + p->state.primitive_restart = ilo->draw->primitive_restart; } static void diff --git a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.h b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.h index 11e3cb0b55f..a9c4051d2df 100644 --- a/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.h +++ b/src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.h @@ -44,6 +44,7 @@ struct gen6_pipeline_session { bool state_bo_changed; bool kernel_bo_changed; bool prim_changed; + bool primitive_restart_changed; void (*emit_draw_states)(struct ilo_3d_pipeline *p, const struct ilo_context *ilo, -- 2.30.2