Mesa (master): i965/fs: use determine_interpolation_mode().

Paul Berry stereotype441 at kemper.freedesktop.org
Thu Oct 27 17:08:48 PDT 2011


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

Author: Paul Berry <stereotype441 at gmail.com>
Date:   Fri Oct 21 07:56:08 2011 -0700

i965/fs: use determine_interpolation_mode().

This patch changes how fs_visitor::emit_general_interpolation()
decides what kind of interpolation to do.  Previously, it used the
shade model to determine how to interpolate colors, and used smooth
interpolation on everything else.  Now it uses
ir_variable::determine_interpolation_mode(), so that it respects GLSL
1.30 interpolation qualifiers.

Fixes piglit tests interpolation-flat-*-smooth-{distance,fixed,vertex}
and interpolation-flat-other-flat-{distance,fixed,vertex}.

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

---

 src/mesa/drivers/dri/i965/brw_fs.cpp |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index b3ad505..185e00d 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -442,6 +442,9 @@ fs_visitor::emit_general_interpolation(ir_variable *ir)
       type = ir->type;
    }
 
+   glsl_interp_qualifier interpolation_mode =
+      ir->determine_interpolation_mode(c->key.flat_shade);
+
    int location = ir->location;
    for (unsigned int i = 0; i < array_elements; i++) {
       for (unsigned int j = 0; j < type->matrix_columns; j++) {
@@ -454,10 +457,7 @@ fs_visitor::emit_general_interpolation(ir_variable *ir)
 	    continue;
 	 }
 
-	 bool is_gl_Color =
-	    location == FRAG_ATTRIB_COL0 || location == FRAG_ATTRIB_COL1;
-
-	 if (c->key.flat_shade && is_gl_Color) {
+	 if (interpolation_mode == INTERP_QUALIFIER_FLAT) {
 	    /* Constant interpolation (flat shading) case. The SF has
 	     * handed us defined values in only the constant offset
 	     * field of the setup reg.



More information about the mesa-commit mailing list