radeonsi: remove flatshade from the shader key
authorMarek Olšák <marek.olsak@amd.com>
Sun, 4 Jan 2015 19:23:51 +0000 (20:23 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 7 Jan 2015 11:06:43 +0000 (12:06 +0100)
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
src/gallium/drivers/radeonsi/si_pipe.h
src/gallium/drivers/radeonsi/si_shader.h
src/gallium/drivers/radeonsi/si_state_shaders.c

index 57a1e20ee0e6c2d518093d74c0f61afe006af79d..451eff115000fe1ec0569c6ceacbf60d0d78e0eb 100644 (file)
@@ -137,6 +137,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];
index 124615e19c6139cfcc955716c4cd6a8fb9360c60..21692f0ee33b59d57efd5fbe0c27cb5b506a58be 100644 (file)
@@ -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 {
index 355f8aaf454b986eedfcf940b3fdb513aa789125..de12b4eeb15aa64abc9e705f1aa7ec3d6ca1afae 100644 (file)
@@ -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);
        }