dw2 |= GEN6_CLIP_NON_PERSPECTIVE_BARYCENTRIC_ENABLE;
}
- if (brw->gen >= 7) {
+ if (brw->gen >= 7)
dw1 |= GEN7_CLIP_EARLY_CULL;
+ if (brw->gen == 7) {
/* _NEW_POLYGON */
if ((ctx->Polygon.FrontFace == GL_CCW) ^ _mesa_is_user_fbo(fb))
dw1 |= GEN7_CLIP_WINDING_CCW;
}
}
- if (!ctx->Transform.DepthClamp)
+ if (brw->gen < 8 && !ctx->Transform.DepthClamp)
dw2 |= GEN6_CLIP_Z_TEST;
/* _NEW_LIGHT */
dw2 |= (ctx->Transform.ClipPlanesEnabled <<
GEN6_USER_CLIP_CLIP_DISTANCES_SHIFT);
- if (ctx->Viewport.X == 0 &&
- ctx->Viewport.Y == 0 &&
- ctx->Viewport.Width == fb->Width &&
- ctx->Viewport.Height == fb->Height) {
- dw2 |= GEN6_CLIP_GB_TEST;
+ dw2 |= GEN6_CLIP_GB_TEST;
+ for (unsigned i = 0; i < ctx->Const.MaxViewports; i++) {
+ if (ctx->ViewportArray[i].X != 0 ||
+ ctx->ViewportArray[i].Y != 0 ||
+ ctx->ViewportArray[i].Width != (float) fb->Width ||
+ ctx->ViewportArray[i].Height != (float) fb->Height) {
+ dw2 &= ~GEN6_CLIP_GB_TEST;
+ if (brw->gen >= 8) {
+ perf_debug("Disabling GB clipping due to lack of Gen8 viewport "
+ "clipping setup code. This should be fixed.");
+ }
+ break;
+ }
}
/* BRW_NEW_RASTERIZER_DISCARD */
dw2);
OUT_BATCH(U_FIXED(0.125, 3) << GEN6_CLIP_MIN_POINT_WIDTH_SHIFT |
U_FIXED(255.875, 3) << GEN6_CLIP_MAX_POINT_WIDTH_SHIFT |
- (fb->NumLayers > 0 ? 0 : GEN6_CLIP_FORCE_ZERO_RTAINDEX));
+ (fb->MaxNumLayers > 0 ? 0 : GEN6_CLIP_FORCE_ZERO_RTAINDEX) |
+ ((ctx->Const.MaxViewports - 1) & GEN6_CLIP_MAX_VP_INDEX_MASK));
ADVANCE_BATCH();
}