diff options
Diffstat (limited to 'src/gallium')
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_exec.c | 4 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_exec.h | 2 | ||||
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_strings.c | 3 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_quad_fs.c | 1 | ||||
-rw-r--r-- | src/gallium/drivers/softpipe/sp_state_derived.c | 10 | ||||
-rw-r--r-- | src/gallium/include/pipe/p_shader_tokens.h | 3 |
6 files changed, 18 insertions, 5 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index 3e2b899d40e..52d4ff4e80b 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -2371,6 +2371,10 @@ exec_declaration(struct tgsi_exec_machine *mach, eval = eval_perspective_coef; break; + case TGSI_INTERPOLATE_COLOR: + eval = mach->flatshade_color ? eval_constant_coef : eval_perspective_coef; + break; + default: assert(0); return; diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.h b/src/gallium/auxiliary/tgsi/tgsi_exec.h index 223da2cb1c6..0817e14101b 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.h +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.h @@ -263,7 +263,7 @@ struct tgsi_exec_machine 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 */ diff --git a/src/gallium/auxiliary/tgsi/tgsi_strings.c b/src/gallium/auxiliary/tgsi/tgsi_strings.c index aa12493d9b0..de9152dae21 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_strings.c +++ b/src/gallium/auxiliary/tgsi/tgsi_strings.c @@ -117,7 +117,8 @@ const char *tgsi_interpolate_names[TGSI_INTERPOLATE_COUNT] = { "CONSTANT", "LINEAR", - "PERSPECTIVE" + "PERSPECTIVE", + "COLOR" }; const char *tgsi_primitive_names[PIPE_PRIM_MAX] = diff --git a/src/gallium/drivers/softpipe/sp_quad_fs.c b/src/gallium/drivers/softpipe/sp_quad_fs.c index 7b08cd0cf30..7800ba8442f 100644 --- a/src/gallium/drivers/softpipe/sp_quad_fs.c +++ b/src/gallium/drivers/softpipe/sp_quad_fs.c @@ -74,6 +74,7 @@ shade_quad(struct quad_stage *qs, struct quad_header *quad) 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 ); } diff --git a/src/gallium/drivers/softpipe/sp_state_derived.c b/src/gallium/drivers/softpipe/sp_state_derived.c index 56859971d8e..7b2b04e84e9 100644 --- a/src/gallium/drivers/softpipe/sp_state_derived.c +++ b/src/gallium/drivers/softpipe/sp_state_derived.c @@ -100,6 +100,9 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe) 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; @@ -111,8 +114,11 @@ softpipe_get_vertex_info(struct softpipe_context *softpipe) 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; } diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h index 2fbe1df8312..cb1e698996e 100644 --- a/src/gallium/include/pipe/p_shader_tokens.h +++ b/src/gallium/include/pipe/p_shader_tokens.h @@ -100,7 +100,8 @@ enum tgsi_file_type { #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) |