[Mesa-dev] [PATCH 10/13] radeonsi: remove flatshade from the shader key

Marek Olšák maraeo at gmail.com
Sun Jan 4 15:18:49 PST 2015


From: Marek Olšák <marek.olsak at amd.com>

---
 src/gallium/drivers/radeonsi/si_pipe.h          |  1 +
 src/gallium/drivers/radeonsi/si_shader.h        |  1 -
 src/gallium/drivers/radeonsi/si_state_shaders.c | 12 ++++++------
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 3632929..ba305e7 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -134,6 +134,7 @@ struct si_context {
 	struct si_cs_shader_state	cs_shader_state;
 	/* shader information */
 	unsigned			sprite_coord_enable;
+	bool				flatshade;
 	struct si_descriptors		vertex_buffers;
 	struct si_buffer_resources	const_buffers[SI_NUM_SHADERS];
 	struct si_buffer_resources	rw_buffers[SI_NUM_SHADERS];
diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h
index 124615e..21692f0 100644
--- a/src/gallium/drivers/radeonsi/si_shader.h
+++ b/src/gallium/drivers/radeonsi/si_shader.h
@@ -123,7 +123,6 @@ union si_shader_key {
 		unsigned	last_cbuf:3;
 		unsigned	color_two_side:1;
 		unsigned	alpha_func:3;
-		unsigned	flatshade:1;
 		unsigned	alpha_to_one:1;
 	} ps;
 	struct {
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index 355f8aa..de12b4e 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -362,7 +362,6 @@ static INLINE void si_shader_selector_key(struct pipe_context *ctx,
 
 		if (sctx->queued.named.rasterizer) {
 			key->ps.color_two_side = sctx->queued.named.rasterizer->two_side;
-			key->ps.flatshade = sctx->queued.named.rasterizer->flatshade;
 
 			if (sctx->queued.named.blend) {
 				key->ps.alpha_to_one = sctx->queued.named.blend->alpha_to_one &&
@@ -632,10 +631,8 @@ bcolor:
 		tmp = 0;
 
 		if (interpolate == TGSI_INTERPOLATE_CONSTANT ||
-		    (interpolate == TGSI_INTERPOLATE_COLOR &&
-		     ps->key.ps.flatshade)) {
+		    (interpolate == TGSI_INTERPOLATE_COLOR && sctx->flatshade))
 			tmp |= S_028644_FLAT_SHADE(1);
-		}
 
 		if (name == TGSI_SEMANTIC_GENERIC &&
 		    sctx->sprite_coord_enable & (1 << index)) {
@@ -711,6 +708,7 @@ static void si_init_gs_rings(struct si_context *sctx)
 void si_update_shaders(struct si_context *sctx)
 {
 	struct pipe_context *ctx = (struct pipe_context*)sctx;
+	struct si_state_rasterizer *rs = sctx->queued.named.rasterizer;
 
 	if (sctx->gs_shader) {
 		si_shader_select(ctx, sctx->gs_shader);
@@ -776,8 +774,10 @@ void si_update_shaders(struct si_context *sctx)
 	si_pm4_bind_state(sctx, ps, sctx->ps_shader->current->pm4);
 
 	if (si_pm4_state_changed(sctx, ps) || si_pm4_state_changed(sctx, vs) ||
-	    sctx->sprite_coord_enable != sctx->queued.named.rasterizer->sprite_coord_enable) {
-		sctx->sprite_coord_enable = sctx->queued.named.rasterizer->sprite_coord_enable;
+	    sctx->sprite_coord_enable != rs->sprite_coord_enable ||
+	    sctx->flatshade != rs->flatshade) {
+		sctx->sprite_coord_enable = rs->sprite_coord_enable;
+		sctx->flatshade = rs->flatshade;
 		si_update_spi_map(sctx);
 	}
 
-- 
2.1.0



More information about the mesa-dev mailing list