gallium: introduce GLSL based interpolation rules. (v2)
This introduces an unspecified interpolation paramter that is only allowed for color semantics, so a specified GLSL interpolation will override the ShadeModel specified interpolation, but not vice-versa. This fixes a lot of the interpolation tests in piglit. v2: rename from unspecified to color Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
@@ -2371,6 +2371,10 @@ exec_declaration(struct tgsi_exec_machine *mach,
|
|||||||
eval = eval_perspective_coef;
|
eval = eval_perspective_coef;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case TGSI_INTERPOLATE_COLOR:
|
||||||
|
eval = mach->flatshade_color ? eval_constant_coef : eval_perspective_coef;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
return;
|
return;
|
||||||
|
@@ -263,7 +263,7 @@ struct tgsi_exec_machine
|
|||||||
const struct tgsi_interp_coef *InterpCoefs;
|
const struct tgsi_interp_coef *InterpCoefs;
|
||||||
struct tgsi_exec_vector QuadPos;
|
struct tgsi_exec_vector QuadPos;
|
||||||
float Face; /**< +1 if front facing, -1 if back facing */
|
float Face; /**< +1 if front facing, -1 if back facing */
|
||||||
|
bool flatshade_color;
|
||||||
/* Conditional execution masks */
|
/* Conditional execution masks */
|
||||||
uint CondMask; /**< For IF/ELSE/ENDIF */
|
uint CondMask; /**< For IF/ELSE/ENDIF */
|
||||||
uint LoopMask; /**< For BGNLOOP/ENDLOOP */
|
uint LoopMask; /**< For BGNLOOP/ENDLOOP */
|
||||||
|
@@ -117,7 +117,8 @@ const char *tgsi_interpolate_names[TGSI_INTERPOLATE_COUNT] =
|
|||||||
{
|
{
|
||||||
"CONSTANT",
|
"CONSTANT",
|
||||||
"LINEAR",
|
"LINEAR",
|
||||||
"PERSPECTIVE"
|
"PERSPECTIVE",
|
||||||
|
"COLOR"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *tgsi_primitive_names[PIPE_PRIM_MAX] =
|
const char *tgsi_primitive_names[PIPE_PRIM_MAX] =
|
||||||
|
@@ -74,6 +74,7 @@ shade_quad(struct quad_stage *qs, struct quad_header *quad)
|
|||||||
struct tgsi_exec_machine *machine = softpipe->fs_machine;
|
struct tgsi_exec_machine *machine = softpipe->fs_machine;
|
||||||
|
|
||||||
/* run shader */
|
/* run shader */
|
||||||
|
machine->flatshade_color = softpipe->rasterizer->flatshade ? TRUE : FALSE;
|
||||||
return softpipe->fs_variant->run( softpipe->fs_variant, machine, quad );
|
return softpipe->fs_variant->run( softpipe->fs_variant, machine, quad );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -100,6 +100,9 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
|
|||||||
case TGSI_INTERPOLATE_PERSPECTIVE:
|
case TGSI_INTERPOLATE_PERSPECTIVE:
|
||||||
interp = INTERP_PERSPECTIVE;
|
interp = INTERP_PERSPECTIVE;
|
||||||
break;
|
break;
|
||||||
|
case TGSI_INTERPOLATE_COLOR:
|
||||||
|
assert(fsInfo->input_semantic_name[i] == TGSI_SEMANTIC_COLOR);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
assert(0);
|
assert(0);
|
||||||
interp = INTERP_LINEAR;
|
interp = INTERP_LINEAR;
|
||||||
@@ -111,8 +114,11 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case TGSI_SEMANTIC_COLOR:
|
case TGSI_SEMANTIC_COLOR:
|
||||||
if (softpipe->rasterizer->flatshade) {
|
if (fsInfo->input_interpolate[i] == TGSI_INTERPOLATE_COLOR) {
|
||||||
|
if (softpipe->rasterizer->flatshade)
|
||||||
interp = INTERP_CONSTANT;
|
interp = INTERP_CONSTANT;
|
||||||
|
else
|
||||||
|
interp = INTERP_PERSPECTIVE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@@ -100,7 +100,8 @@ enum tgsi_file_type {
|
|||||||
#define TGSI_INTERPOLATE_CONSTANT 0
|
#define TGSI_INTERPOLATE_CONSTANT 0
|
||||||
#define TGSI_INTERPOLATE_LINEAR 1
|
#define TGSI_INTERPOLATE_LINEAR 1
|
||||||
#define TGSI_INTERPOLATE_PERSPECTIVE 2
|
#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_X (1 << 0)
|
||||||
#define TGSI_CYLINDRICAL_WRAP_Y (1 << 1)
|
#define TGSI_CYLINDRICAL_WRAP_Y (1 << 1)
|
||||||
|
@@ -441,7 +441,7 @@ st_translate_interp(enum glsl_interp_qualifier glsl_qual, bool is_color)
|
|||||||
switch (glsl_qual) {
|
switch (glsl_qual) {
|
||||||
case INTERP_QUALIFIER_NONE:
|
case INTERP_QUALIFIER_NONE:
|
||||||
if (is_color)
|
if (is_color)
|
||||||
return TGSI_INTERPOLATE_LINEAR;
|
return TGSI_INTERPOLATE_COLOR;
|
||||||
return TGSI_INTERPOLATE_PERSPECTIVE;
|
return TGSI_INTERPOLATE_PERSPECTIVE;
|
||||||
case INTERP_QUALIFIER_SMOOTH:
|
case INTERP_QUALIFIER_SMOOTH:
|
||||||
return TGSI_INTERPOLATE_PERSPECTIVE;
|
return TGSI_INTERPOLATE_PERSPECTIVE;
|
||||||
|
Reference in New Issue
Block a user