- struct gl_context *ctx = &brw->intel.ctx;
- struct brw_cc_viewport ccv;
-
- memset(&ccv, 0, sizeof(ccv));
+ struct gl_context *ctx = &brw->ctx;
+ struct brw_cc_viewport *ccv;
+
+ ccv = brw_state_batch(brw, AUB_TRACE_CC_VP_STATE,
+ sizeof(*ccv) * ctx->Const.MaxViewports, 32,
+ &brw->cc.vp_offset);
+
+ /* _NEW_TRANSFORM */
+ 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;
+ }
+ }