eval = eval_perspective_coef;
break;
+ case TGSI_INTERPOLATE_COLOR:
+ eval = mach->flatshade_color ? eval_constant_coef : eval_perspective_coef;
+ break;
+
default:
assert(0);
return;
const struct tgsi_interp_coef *InterpCoefs;
struct tgsi_exec_vector QuadPos;
float Face; /**< +1 if front facing, -1 if back facing */
-
+ bool flatshade_color;
/* Conditional execution masks */
uint CondMask; /**< For IF/ELSE/ENDIF */
uint LoopMask; /**< For BGNLOOP/ENDLOOP */
{
"CONSTANT",
"LINEAR",
- "PERSPECTIVE"
+ "PERSPECTIVE",
+ "COLOR"
};
const char *tgsi_primitive_names[PIPE_PRIM_MAX] =
struct tgsi_exec_machine *machine = softpipe->fs_machine;
/* run shader */
+ machine->flatshade_color = softpipe->rasterizer->flatshade ? TRUE : FALSE;
return softpipe->fs_variant->run( softpipe->fs_variant, machine, quad );
}
case TGSI_INTERPOLATE_PERSPECTIVE:
interp = INTERP_PERSPECTIVE;
break;
+ case TGSI_INTERPOLATE_COLOR:
+ assert(fsInfo->input_semantic_name[i] == TGSI_SEMANTIC_COLOR);
+ break;
default:
assert(0);
interp = INTERP_LINEAR;
break;
case TGSI_SEMANTIC_COLOR:
- if (softpipe->rasterizer->flatshade) {
- interp = INTERP_CONSTANT;
+ if (fsInfo->input_interpolate[i] == TGSI_INTERPOLATE_COLOR) {
+ if (softpipe->rasterizer->flatshade)
+ interp = INTERP_CONSTANT;
+ else
+ interp = INTERP_PERSPECTIVE;
}
break;
}
#define TGSI_INTERPOLATE_CONSTANT 0
#define TGSI_INTERPOLATE_LINEAR 1
#define TGSI_INTERPOLATE_PERSPECTIVE 2
-#define TGSI_INTERPOLATE_COUNT 3
+#define TGSI_INTERPOLATE_COLOR 3 /* special color case for smooth/flat */
+#define TGSI_INTERPOLATE_COUNT 4
#define TGSI_CYLINDRICAL_WRAP_X (1 << 0)
#define TGSI_CYLINDRICAL_WRAP_Y (1 << 1)
switch (glsl_qual) {
case INTERP_QUALIFIER_NONE:
if (is_color)
- return TGSI_INTERPOLATE_LINEAR;
+ return TGSI_INTERPOLATE_COLOR;
return TGSI_INTERPOLATE_PERSPECTIVE;
case INTERP_QUALIFIER_SMOOTH:
return TGSI_INTERPOLATE_PERSPECTIVE;