Mesa (master): i965/msaa: Adapt clip setup for centroid noperspective interpolation.

Paul Berry stereotype441 at kemper.freedesktop.org
Mon Jun 25 18:08:48 UTC 2012


Module: Mesa
Branch: master
Commit: 6d7ebb21f8848a4a407e458e2772a45f9c3bd28a
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=6d7ebb21f8848a4a407e458e2772a45f9c3bd28a

Author: Paul Berry <stereotype441 at gmail.com>
Date:   Mon Jun 18 11:23:01 2012 -0700

i965/msaa: Adapt clip setup for centroid noperspective interpolation.

To save time, we only instruct the clip stage of the pipeline to
compute noperspective barycentric coordinates if those coordinates are
needed by the fragment shader.  Previously, we would determine whether
the coordinates were needed by seeing whether the fragment shader used
the BRW_WM_NONPERSPECTIVE_PIXEL_BARYCENTRIC interpolation mode.

However, with MSAA, it's possible that the fragment shader might use
BRW_WM_NONPERSPECTIVE_CENTROID_BARYCENTRIC instead.  In the future,
when we support ARB_sample_shading, it might use
BRW_WM_NONPERSPECTIVE_SAMPLE_BARYCENTRIC.

This patch modifies the upload_clip_state() functions to check for all
three possible noperspective interpolation modes.

Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/mesa/drivers/dri/i965/brw_defines.h     |    4 ++++
 src/mesa/drivers/dri/i965/gen6_clip_state.c |    2 +-
 src/mesa/drivers/dri/i965/gen7_clip_state.c |    2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h
index ff6cc6e..73a8c90 100644
--- a/src/mesa/drivers/dri/i965/brw_defines.h
+++ b/src/mesa/drivers/dri/i965/brw_defines.h
@@ -1257,6 +1257,10 @@ enum brw_wm_barycentric_interp_mode {
    BRW_WM_NONPERSPECTIVE_SAMPLE_BARYCENTRIC	= 5,
    BRW_WM_BARYCENTRIC_INTERP_MODE_COUNT  = 6
 };
+#define BRW_WM_NONPERSPECTIVE_BARYCENTRIC_BITS \
+   ((1 << BRW_WM_NONPERSPECTIVE_PIXEL_BARYCENTRIC) | \
+    (1 << BRW_WM_NONPERSPECTIVE_CENTROID_BARYCENTRIC) | \
+    (1 << BRW_WM_NONPERSPECTIVE_SAMPLE_BARYCENTRIC))
 
 #define _3DSTATE_WM				0x7814 /* GEN6+ */
 /* DW1: kernel pointer */
diff --git a/src/mesa/drivers/dri/i965/gen6_clip_state.c b/src/mesa/drivers/dri/i965/gen6_clip_state.c
index 5d88978..c34d87e 100644
--- a/src/mesa/drivers/dri/i965/gen6_clip_state.c
+++ b/src/mesa/drivers/dri/i965/gen6_clip_state.c
@@ -42,7 +42,7 @@ upload_clip_state(struct brw_context *brw)
 
    /* CACHE_NEW_WM_PROG */
    if (brw->wm.prog_data->barycentric_interp_modes &
-       (1 << BRW_WM_NONPERSPECTIVE_PIXEL_BARYCENTRIC)) {
+       BRW_WM_NONPERSPECTIVE_BARYCENTRIC_BITS) {
       nonperspective_barycentric_enable_flag =
          GEN6_CLIP_NON_PERSPECTIVE_BARYCENTRIC_ENABLE;
    }
diff --git a/src/mesa/drivers/dri/i965/gen7_clip_state.c b/src/mesa/drivers/dri/i965/gen7_clip_state.c
index 8ff31a8..3bc6de0 100644
--- a/src/mesa/drivers/dri/i965/gen7_clip_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_clip_state.c
@@ -43,7 +43,7 @@ upload_clip_state(struct brw_context *brw)
 
    /* CACHE_NEW_WM_PROG */
    if (brw->wm.prog_data->barycentric_interp_modes &
-       (1 << BRW_WM_NONPERSPECTIVE_PIXEL_BARYCENTRIC)) {
+       BRW_WM_NONPERSPECTIVE_BARYCENTRIC_BITS) {
       nonperspective_barycentric_enable_flag =
          GEN6_CLIP_NON_PERSPECTIVE_BARYCENTRIC_ENABLE;
    }




More information about the mesa-commit mailing list