i965/msaa: Adapt clip setup for centroid noperspective interpolation.
authorPaul Berry <stereotype441@gmail.com>
Mon, 18 Jun 2012 18:23:01 +0000 (11:23 -0700)
committerPaul Berry <stereotype441@gmail.com>
Mon, 25 Jun 2012 18:03:26 +0000 (11:03 -0700)
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@anholt.net>
src/mesa/drivers/dri/i965/brw_defines.h
src/mesa/drivers/dri/i965/gen6_clip_state.c
src/mesa/drivers/dri/i965/gen7_clip_state.c

index ff6cc6e27d6a6eaa37fec0b5054de16f121f5ba4..73a8c906692151f37e116232701abf28f4924c49 100644 (file)
@@ -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 */
index 5d889784b408dc50e71a4348df319c4674021394..c34d87e29f390b1b8a5abd4744c0084b1b9a430b 100644 (file)
@@ -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;
    }
index 8ff31a8b42e9dc2eaeadf28b905f7c6d66a90b67..3bc6de05393c97b5ac07c1cb8e65e742d07618df 100644 (file)
@@ -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;
    }