From: Dave Airlie Date: Fri, 6 Jan 2012 13:31:07 +0000 (+0000) Subject: st/mesa: fix default interpolation for colors. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e1ff84371c0e8c58297611f95ec1e2cb5d5acaa4;p=mesa.git st/mesa: fix default interpolation for colors. 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 --- diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index aceaaf8c552..35d0e0fc42f 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -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; } }