i965: Consider all viewports before enabling guardband clipping
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 8 Jan 2014 20:14:49 +0000 (12:14 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Mon, 20 Jan 2014 19:32:05 +0000 (11:32 -0800)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/gen6_clip_state.c

index 3499e371ef9ba0f2c157bd6d95c47b9ff004b6c6..ed7afd7d754a0d39e23a2c0364b4d45d9f969c13 100644 (file)
@@ -96,11 +96,15 @@ upload_clip_state(struct brw_context *brw)
    dw2 |= (ctx->Transform.ClipPlanesEnabled <<
            GEN6_USER_CLIP_CLIP_DISTANCES_SHIFT);
 
-   if (ctx->ViewportArray[0].X == 0 &&
-       ctx->ViewportArray[0].Y == 0 &&
-       ctx->ViewportArray[0].Width == (float) fb->Width &&
-       ctx->ViewportArray[0].Height == (float) 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;
+         break;
+      }
    }
 
    /* BRW_NEW_RASTERIZER_DISCARD */