Mesa (broadwell): i965: Update 3DSTATE_CLIP for Broadwell.

Kenneth Graunke kwg at kemper.freedesktop.org
Sat Feb 1 01:12:10 UTC 2014


Module: Mesa
Branch: broadwell
Commit: 71b1e8d249c059f07a7dda5d836690b8e01195c9
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=71b1e8d249c059f07a7dda5d836690b8e01195c9

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Fri Nov  1 16:29:33 2013 -0700

i965: Update 3DSTATE_CLIP for Broadwell.

Broadwell's winding order, polygon fill, and viewport Z test fields have
moved to DWord 1 of 3DSTATE_RASTER.

v2: Add a perf_debug for a future optimization and improve commit
    message (both suggested by Eric Anholt).

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/i965/brw_state_upload.c |    2 +-
 src/mesa/drivers/dri/i965/gen6_clip_state.c  |    9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index 76698da..986a64a 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -300,7 +300,7 @@ static const struct brw_tracked_state *gen8_atoms[] =
    &gen8_vs_state,
    &gen7_gs_state,
    &gen7_sol_state,
-   &gen7_clip_state,
+   &gen6_clip_state,
    &gen8_raster_state,
    &gen8_sbe_state,
    &gen8_sf_state,
diff --git a/src/mesa/drivers/dri/i965/gen6_clip_state.c b/src/mesa/drivers/dri/i965/gen6_clip_state.c
index ed7afd7..0ba190e 100644
--- a/src/mesa/drivers/dri/i965/gen6_clip_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_clip_state.c
@@ -49,9 +49,10 @@ upload_clip_state(struct brw_context *brw)
       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;
@@ -76,7 +77,7 @@ upload_clip_state(struct brw_context *brw)
       }
    }
 
-   if (!ctx->Transform.DepthClamp)
+   if (brw->gen < 8 && !ctx->Transform.DepthClamp)
       dw2 |= GEN6_CLIP_Z_TEST;
 
    /* _NEW_LIGHT */
@@ -103,6 +104,10 @@ upload_clip_state(struct brw_context *brw)
           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;
       }
    }




More information about the mesa-commit mailing list