OSDN Git Service

ilo: track if primitive restart has changed
authorChia-I Wu <olvaffe@gmail.com>
Thu, 27 Jun 2013 10:19:16 +0000 (18:19 +0800)
committerChia-I Wu <olvaffe@gmail.com>
Fri, 28 Jun 2013 02:44:38 +0000 (10:44 +0800)
Re-emit 3DSTATE_INDEX_BUFFER to enable/disable primitive restart.

src/gallium/drivers/ilo/ilo_3d_pipeline.h
src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.c
src/gallium/drivers/ilo/ilo_3d_pipeline_gen6.h

index 7a867aa..f26fa83 100644 (file)
@@ -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;
 
index 190f6a9..5e9e986 100644 (file)
@@ -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
index 11e3cb0..a9c4051 100644 (file)
@@ -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,