i965/fs: Handle CMP.nz ... 0 and AND.nz ... 1 similarly in cmod propagation
[mesa.git] / src / mesa / drivers / dri / i965 / brw_primitive_restart.c
index 2ee6055032e34f7f384d843f0e1d3ed0d600fd3b..2c7a7e8b8dd5483a6806e23e450743a218f995ff 100644 (file)
@@ -62,8 +62,7 @@ can_cut_index_handle_restart_index(struct gl_context *ctx,
       cut_index_will_work = ctx->Array.RestartIndex == 0xffffffff;
       break;
    default:
-      cut_index_will_work = false;
-      assert(0);
+      unreachable("not reached");
    }
 
    return cut_index_will_work;
@@ -129,7 +128,8 @@ GLboolean
 brw_handle_primitive_restart(struct gl_context *ctx,
                              const struct _mesa_prim *prims,
                              GLuint nr_prims,
-                             const struct _mesa_index_buffer *ib)
+                             const struct _mesa_index_buffer *ib,
+                             struct gl_buffer_object *indirect)
 {
    struct brw_context *brw = brw_context(ctx);
 
@@ -138,14 +138,6 @@ brw_handle_primitive_restart(struct gl_context *ctx,
       return GL_FALSE;
    }
 
-   /* If the driver has requested software handling of primitive restarts,
-    * then the VBO module has already taken care of things, and we can
-    * just draw as normal.
-    */
-   if (ctx->Const.PrimitiveRestartInSoftware) {
-      return GL_FALSE;
-   }
-
    /* If we have set the in_progress flag, then we are in the middle
     * of handling the primitive restart draw.
     */
@@ -169,13 +161,13 @@ brw_handle_primitive_restart(struct gl_context *ctx,
       /* Cut index should work for primitive restart, so use it
        */
       brw->prim_restart.enable_cut_index = true;
-      brw_draw_prims(ctx, prims, nr_prims, ib, GL_FALSE, -1, -1, NULL);
+      brw_draw_prims(ctx, prims, nr_prims, ib, GL_FALSE, -1, -1, NULL, indirect);
       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);
+      vbo_sw_primitive_restart(ctx, prims, nr_prims, ib, indirect);
    }
 
    brw->prim_restart.in_progress = false;
@@ -190,7 +182,7 @@ haswell_upload_cut_index(struct brw_context *brw)
    struct gl_context *ctx = &brw->ctx;
 
    /* Don't trigger on Ivybridge */
-   if (!brw->is_haswell)
+   if (brw->gen < 8 && !brw->is_haswell)
       return;
 
    const unsigned cut_index_setting =
@@ -219,7 +211,6 @@ const struct brw_tracked_state haswell_cut_index = {
    .dirty = {
       .mesa  = _NEW_TRANSFORM,
       .brw   = BRW_NEW_INDEX_BUFFER,
-      .cache = 0,
    },
    .emit = haswell_upload_cut_index,
 };