[Mesa-dev] [PATCH] st/mesa: fix default interpolation for colors.
Dave Airlie
airlied at gmail.com
Fri Jan 6 05:33:50 PST 2012
From: Dave Airlie <airlied at redhat.com>
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 fixes that and fixes reflect.
Signed-off-by: Dave Airlie <airlied at redhat.com>
---
src/mesa/state_tracker/st_program.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c
index 146a9f3..9d4679a 100644
--- a/src/mesa/state_tracker/st_program.c
+++ b/src/mesa/state_tracker/st_program.c
@@ -436,10 +436,14 @@ 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 none_is_linear)
{
switch (glsl_qual) {
case INTERP_QUALIFIER_NONE:
+ if (none_is_linear)
+ return TGSI_INTERPOLATE_LINEAR;
+ else
+ return TGSI_INTERPOLATE_PERSPECTIVE;
case INTERP_QUALIFIER_SMOOTH:
return TGSI_INTERPOLATE_PERSPECTIVE;
case INTERP_QUALIFIER_FLAT:
@@ -542,12 +546,12 @@ 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;
@@ -601,10 +605,8 @@ st_translate_fragment_program(struct st_context *st,
assert(attr >= FRAG_ATTRIB_TEX0);
input_semantic_index[slot] = (attr - FRAG_ATTRIB_TEX0);
input_semantic_name[slot] = TGSI_SEMANTIC_GENERIC;
- 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],
+ (attr == FRAG_ATTRIB_PNTC));
break;
}
}
--
1.7.7.4
More information about the mesa-dev
mailing list