r600g: nuke the fallback for vertex and fragment color clamping
authorMarek Olšák <maraeo@gmail.com>
Mon, 23 Jan 2012 02:43:54 +0000 (03:43 +0100)
committerMarek Olšák <maraeo@gmail.com>
Wed, 25 Jan 2012 11:35:19 +0000 (12:35 +0100)
src/gallium/drivers/r600/evergreen_state.c
src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/r600/r600_shader.c
src/gallium/drivers/r600/r600_shader.h
src/gallium/drivers/r600/r600_state.c
src/gallium/drivers/r600/r600_state_common.c

index 6b91bab..69e3be9 100644 (file)
@@ -902,8 +902,6 @@ static void *evergreen_create_rs_state(struct pipe_context *ctx,
        }
 
        rstate = &rs->rstate;
-       rs->clamp_vertex_color = state->clamp_vertex_color;
-       rs->clamp_fragment_color = state->clamp_fragment_color;
        rs->flatshade = state->flatshade;
        rs->sprite_coord_enable = state->sprite_coord_enable;
        rs->two_side = state->light_twoside;
index 65e84c1..9de8e7e 100644 (file)
@@ -105,8 +105,6 @@ struct r600_pipe_sampler_view {
 
 struct r600_pipe_rasterizer {
        struct r600_pipe_state          rstate;
-       boolean                         clamp_vertex_color;
-       boolean                         clamp_fragment_color;
        boolean                         flatshade;
        boolean                         two_side;
        unsigned                        sprite_coord_enable;
@@ -217,8 +215,6 @@ struct r600_pipe_context {
        struct pipe_query               *saved_render_cond;
        unsigned                        saved_render_cond_mode;
        /* shader information */
-       boolean                         clamp_vertex_color;
-       boolean                         clamp_fragment_color;
        boolean                         two_side;
        unsigned                        user_clip_plane_enable;
        unsigned                        clip_dist_enable;
index 164b474..4fe657c 100644 (file)
@@ -835,10 +835,6 @@ static int r600_shader_from_tgsi(struct r600_pipe_context * rctx, struct r600_pi
        ctx.clip_vertex_write = 0;
 
        shader->two_side = (ctx.type == TGSI_PROCESSOR_FRAGMENT) && rctx->two_side;
-
-       shader->clamp_color = (((ctx.type == TGSI_PROCESSOR_FRAGMENT) && rctx->clamp_fragment_color) ||
-               ((ctx.type == TGSI_PROCESSOR_VERTEX) && rctx->clamp_vertex_color));
-
        shader->nr_cbufs = rctx->nr_cbufs;
 
        /* register allocations */
@@ -1034,37 +1030,6 @@ static int r600_shader_from_tgsi(struct r600_pipe_context * rctx, struct r600_pi
                }
        }
 
-       /* clamp color outputs */
-       if (shader->clamp_color) {
-               for (i = 0; i < noutput; i++) {
-                       if (shader->output[i].name == TGSI_SEMANTIC_COLOR ||
-                               shader->output[i].name == TGSI_SEMANTIC_BCOLOR) {
-
-                               int j;
-                               for (j = 0; j < 4; j++) {
-                                       struct r600_bytecode_alu alu;
-                                       memset(&alu, 0, sizeof(struct r600_bytecode_alu));
-
-                                       /* MOV_SAT R, R */
-                                       alu.inst = BC_INST(ctx.bc, V_SQ_ALU_WORD1_OP2_SQ_OP2_INST_MOV);
-                                       alu.dst.sel = shader->output[i].gpr;
-                                       alu.dst.chan = j;
-                                       alu.dst.write = 1;
-                                       alu.dst.clamp = 1;
-                                       alu.src[0].sel = alu.dst.sel;
-                                       alu.src[0].chan = j;
-
-                                       if (j == 3) {
-                                               alu.last = 1;
-                                       }
-                                       r = r600_bytecode_add_alu(ctx.bc, &alu);
-                                       if (r)
-                                               return r;
-                               }
-                       }
-               }
-       }
-
        /* Add stream outputs. */
        if (ctx.type == TGSI_PROCESSOR_VERTEX && so.num_outputs) {
                for (i = 0; i < so.num_outputs; i++) {
index 323f948..fd98d09 100644 (file)
@@ -48,7 +48,6 @@ struct r600_shader {
        boolean                 uses_kill;
        boolean                 fs_write_all;
        boolean                 vs_prohibit_ucps;
-       boolean                 clamp_color;
        boolean                 two_side;
        unsigned                nr_cbufs;
        /* bit n is set if the shader writes gl_ClipDistance[n] */
index 8f4e9f2..e093e50 100644 (file)
@@ -954,8 +954,6 @@ static void *r600_create_rs_state(struct pipe_context *ctx,
        }
 
        rstate = &rs->rstate;
-       rs->clamp_vertex_color = state->clamp_vertex_color;
-       rs->clamp_fragment_color = state->clamp_fragment_color;
        rs->flatshade = state->flatshade;
        rs->sprite_coord_enable = state->sprite_coord_enable;
        rs->two_side = state->light_twoside;
index 6a31309..80b28d9 100644 (file)
@@ -99,9 +99,6 @@ void r600_bind_rs_state(struct pipe_context *ctx, void *state)
        if (state == NULL)
                return;
 
-       rctx->clamp_vertex_color = rs->clamp_vertex_color;
-       rctx->clamp_fragment_color = rs->clamp_fragment_color;
-
        rctx->sprite_coord_enable = rs->sprite_coord_enable;
        rctx->two_side = rs->two_side;
 
@@ -588,12 +585,7 @@ static void r600_update_derived_state(struct r600_pipe_context *rctx)
                r600_update_sampler_states(rctx);
        }
 
-       if (rctx->vs_shader->shader.clamp_color != rctx->clamp_vertex_color) {
-               r600_shader_rebuild(&rctx->context, rctx->vs_shader);
-       }
-
-       if ((rctx->ps_shader->shader.clamp_color != rctx->clamp_fragment_color) ||
-           (rctx->ps_shader->shader.two_side != rctx->two_side) ||
+       if ((rctx->ps_shader->shader.two_side != rctx->two_side) ||
            ((rctx->chip_class >= EVERGREEN) && rctx->ps_shader->shader.fs_write_all &&
             (rctx->ps_shader->shader.nr_cbufs != rctx->nr_cbufs))) {
                r600_shader_rebuild(&rctx->context, rctx->ps_shader);