st/mesa: fix default interpolation for colors.
authorDave Airlie <airlied@redhat.com>
Fri, 6 Jan 2012 13:31:07 +0000 (13:31 +0000)
committerDave Airlie <airlied@redhat.com>
Sat, 7 Jan 2012 08:30:23 +0000 (08:30 +0000)
Brian mentioned that mesa-demos/reflect was broken on softpipe,
by my previous commit. The problem was were blindly translating none
to perspective, when color/pntc at least need it linear.

this is the final version that fixes the reflect regression.

Signed-off-by: Dave Airlie <airlied@redhat.com>
src/mesa/state_tracker/st_program.c

index aceaaf8c552be4a48f1a23e08e751bf5a2a5c3bd..35d0e0fc42f5aa434f96b833c1f4c0d87e8cb2c2 100644 (file)
@@ -432,10 +432,13 @@ st_get_vp_variant(struct st_context *st,
 
 
 static unsigned
-st_translate_interp(enum glsl_interp_qualifier glsl_qual)
+st_translate_interp(enum glsl_interp_qualifier glsl_qual, bool is_color)
 {
    switch (glsl_qual) {
    case INTERP_QUALIFIER_NONE:
+      if (is_color)
+         return TGSI_INTERPOLATE_LINEAR;
+      return TGSI_INTERPOLATE_PERSPECTIVE;
    case INTERP_QUALIFIER_SMOOTH:
       return TGSI_INTERPOLATE_PERSPECTIVE;
    case INTERP_QUALIFIER_FLAT:
@@ -538,12 +541,14 @@ st_translate_fragment_program(struct st_context *st,
             case FRAG_ATTRIB_COL0:
                input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
                input_semantic_index[slot] = 0;
-               interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr]);
+               interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr],
+                                                      TRUE);
                break;
             case FRAG_ATTRIB_COL1:
                input_semantic_name[slot] = TGSI_SEMANTIC_COLOR;
                input_semantic_index[slot] = 1;
-               interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr]);
+               interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr],
+                                                      TRUE);
                break;
             case FRAG_ATTRIB_FOGC:
                input_semantic_name[slot] = TGSI_SEMANTIC_FOG;
@@ -600,7 +605,8 @@ st_translate_fragment_program(struct st_context *st,
                if (attr == FRAG_ATTRIB_PNTC)
                   interpMode[slot] = TGSI_INTERPOLATE_LINEAR;
                else
-                  interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr]);
+                  interpMode[slot] = st_translate_interp(stfp->Base.InterpQualifier[attr],
+                                                         FALSE);
                break;
             }
          }