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 6b91bab98c64c885954fd5ec655bfe4b55afeebb..69e3be967f4b4ac96f878a49a4d31868ed197d4c 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 65e84c190c52128f1729f692ad1c1126adb0539e..9de8e7efaca2d9450f52103017b680e004cdeded 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 164b4746c9fd9931ca377dc6128c6173ce1927a9..4fe657c9b61a20dfd77831ee51d9af69e46786dd 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 323f94810f61bed322729ea534a29de2a65da5a1..fd98d09da86980f2a333a5cd16438b0f61ddb365 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 8f4e9f20837c61d8ed53d1a952cbb54d6978526d..e093e5003a9368dd1ebef9962c0a91d7f5a60336 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 6a313096f94918ed6ed5213439ad44dd51524d2d..80b28d9e7ca8683956ebcbe2dad22fa81593d92b 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);