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>
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 */
/* 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;
}
/* 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;
}