From c2b800cf38b299c1ab1c53dc0e4ea00c7acef853 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marek=20Ol=C5=A1=C3=A1k?= Date: Mon, 23 Jan 2012 03:43:54 +0100 Subject: [PATCH] r600g: nuke the fallback for vertex and fragment color clamping --- src/gallium/drivers/r600/evergreen_state.c | 2 -- src/gallium/drivers/r600/r600_pipe.h | 4 --- src/gallium/drivers/r600/r600_shader.c | 35 -------------------- src/gallium/drivers/r600/r600_shader.h | 1 - src/gallium/drivers/r600/r600_state.c | 2 -- src/gallium/drivers/r600/r600_state_common.c | 10 +----- 6 files changed, 1 insertion(+), 53 deletions(-) diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index 6b91bab98c6..69e3be967f4 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -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; diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h index 65e84c190c5..9de8e7efaca 100644 --- a/src/gallium/drivers/r600/r600_pipe.h +++ b/src/gallium/drivers/r600/r600_pipe.h @@ -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; diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 164b4746c9f..4fe657c9b61 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -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++) { diff --git a/src/gallium/drivers/r600/r600_shader.h b/src/gallium/drivers/r600/r600_shader.h index 323f94810f6..fd98d09da86 100644 --- a/src/gallium/drivers/r600/r600_shader.h +++ b/src/gallium/drivers/r600/r600_shader.h @@ -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] */ diff --git a/src/gallium/drivers/r600/r600_state.c b/src/gallium/drivers/r600/r600_state.c index 8f4e9f20837..e093e5003a9 100644 --- a/src/gallium/drivers/r600/r600_state.c +++ b/src/gallium/drivers/r600/r600_state.c @@ -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; diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c index 6a313096f94..80b28d9e7ca 100644 --- a/src/gallium/drivers/r600/r600_state_common.c +++ b/src/gallium/drivers/r600/r600_state_common.c @@ -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); -- 2.30.2