i965: Create a macro for setting a dirty bit.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_cc.c
index eeb63c6d0bd3b9e3ff6927d6fb009fc3ec25665c..0e31aa2eacc5ce2bb6c2f683043e2865b7c59e50 100644 (file)
@@ -45,19 +45,24 @@ brw_upload_cc_vp(struct brw_context *brw)
    struct brw_cc_viewport *ccv;
 
    ccv = brw_state_batch(brw, AUB_TRACE_CC_VP_STATE,
-                        sizeof(*ccv), 32, &brw->cc.vp_offset);
+                        sizeof(*ccv) * ctx->Const.MaxViewports, 32,
+                         &brw->cc.vp_offset);
 
    /* _NEW_TRANSFORM */
-   if (ctx->Transform.DepthClamp) {
-      /* _NEW_VIEWPORT */
-      ccv->min_depth = MIN2(ctx->ViewportArray[0].Near, ctx->ViewportArray[0].Far);
-      ccv->max_depth = MAX2(ctx->ViewportArray[0].Near, ctx->ViewportArray[0].Far);
-   } else {
-      ccv->min_depth = 0.0;
-      ccv->max_depth = 1.0;
+   for (unsigned i = 0; i < ctx->Const.MaxViewports; i++) {
+      if (ctx->Transform.DepthClamp) {
+         /* _NEW_VIEWPORT */
+         ccv[i].min_depth = MIN2(ctx->ViewportArray[i].Near,
+                                 ctx->ViewportArray[i].Far);
+         ccv[i].max_depth = MAX2(ctx->ViewportArray[i].Near,
+                                 ctx->ViewportArray[i].Far);
+      } else {
+         ccv[i].min_depth = 0.0;
+         ccv[i].max_depth = 1.0;
+      }
    }
 
-   brw->state.dirty.cache |= CACHE_NEW_CC_VP;
+   SET_DIRTY_BIT(cache, CACHE_NEW_CC_VP);
 }
 
 const struct brw_tracked_state brw_cc_vp = {
@@ -92,7 +97,7 @@ brw_fix_xRGB_alpha(GLenum function)
 }
 
 /**
- * Creates the state cache entry for the given CC unit key.
+ * Creates a CC unit packet from the current blend state.
  */
 static void upload_cc_unit(struct brw_context *brw)
 {
@@ -215,10 +220,10 @@ static void upload_cc_unit(struct brw_context *brw)
       cc->cc5.statistics_enable = 1;
 
    /* CACHE_NEW_CC_VP */
-   cc->cc4.cc_viewport_state_offset = (brw->batch.bo->offset +
+   cc->cc4.cc_viewport_state_offset = (brw->batch.bo->offset64 +
                                       brw->cc.vp_offset) >> 5; /* reloc */
 
-   brw->state.dirty.cache |= CACHE_NEW_CC_UNIT;
+   SET_DIRTY_BIT(cache, CACHE_NEW_CC_UNIT);
 
    /* Emit CC viewport relocation */
    drm_intel_bo_emit_reloc(brw->batch.bo,