r300g: nuke the fallback for fragment color clamping
authorMarek Olšák <maraeo@gmail.com>
Mon, 23 Jan 2012 02:38:39 +0000 (03:38 +0100)
committerMarek Olšák <maraeo@gmail.com>
Wed, 25 Jan 2012 11:35:19 +0000 (12:35 +0100)
src/gallium/drivers/r300/compiler/r3xx_fragprog.c
src/gallium/drivers/r300/compiler/radeon_code.h
src/gallium/drivers/r300/r300_context.h
src/gallium/drivers/r300/r300_fs.c
src/gallium/drivers/r300/r300_state.c

index 3bee2b64d35b63da545a0dd261f49bf77b8509bc..8fea4db94ea8c6216d8575d929306ce987409958 100644 (file)
@@ -78,32 +78,12 @@ static void rc_rewrite_depth_out(struct radeon_compiler *cc, void *user)
        }
 }
 
-static int radeon_saturate_output(
-               struct radeon_compiler * c,
-               struct rc_instruction * inst,
-               void* data)
-{
-       const struct rc_opcode_info *info = rc_get_opcode_info(inst->U.I.Opcode);
-
-       if (!info->HasDstReg || inst->U.I.DstReg.File != RC_FILE_OUTPUT)
-               return 0;
-
-       inst->U.I.SaturateMode = RC_SATURATE_ZERO_ONE;
-       return 1;
-}
-
 void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
 {
        int is_r500 = c->Base.is_r500;
        int opt = !c->Base.disable_optimizations;
-       int sat_out = c->state.frag_clamp;
 
        /* Lists of instruction transformations. */
-       struct radeon_program_transformation saturate_output[] = {
-               { &radeon_saturate_output, c },
-               { 0, 0 }
-       };
-
        struct radeon_program_transformation rewrite_tex[] = {
                { &radeonTransformTEX, c },
                { 0, 0 }
@@ -137,7 +117,6 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
                {"unroll loops",                1, is_r500,     rc_unroll_loops,                NULL},
                {"transform loops",             1, !is_r500,    rc_transform_loops,             NULL},
                {"emulate branches",            1, !is_r500,    rc_emulate_branches,            NULL},
-               {"saturate output writes",      1, sat_out,     rc_local_transform,             saturate_output},
                {"transform TEX",               1, 1,           rc_local_transform,             rewrite_tex},
                {"transform IF",                1, is_r500,     rc_local_transform,             rewrite_if},
                {"native rewrite",              1, is_r500,     rc_local_transform,             native_rewrite_r500},
index 67e6acf8b108e70b8a1e3dcff46f80d8c882e84e..4280d664f0a5706e75196bcab322bd26a23532f7 100644 (file)
@@ -179,8 +179,6 @@ struct r300_fragment_program_external_state {
                 */
                unsigned convert_unorm_to_snorm:1;
        } unit[16];
-
-       unsigned frag_clamp:1;
 };
 
 
index e40b7af45dd35e1ba0ea1c0af955c4d1a32d6ea9..f32504c530adab3884e7015b567e95340a9b9c2b 100644 (file)
@@ -569,8 +569,6 @@ struct r300_context {
     int sprite_coord_enable;
     /* Whether two-sided color selection is enabled (AKA light_twoside). */
     boolean two_sided_color;
-    /* Whether fragment color clamping is enabled. */
-    boolean frag_clamp;
     /* Whether fast color clear is enabled. */
     boolean cbzb_clear;
     /* Whether fragment shader needs to be validated. */
index 320f3987e9aa72b213d88984227062f54e8247e2..051b29217ad18479021553be89799aa2794b4475 100644 (file)
@@ -147,11 +147,8 @@ static void get_external_state(
     struct r300_fragment_program_external_state* state)
 {
     struct r300_textures_state *texstate = r300->textures_state.state;
-    struct r300_rs_state *rs = r300->rs_state.state;
     unsigned i;
 
-    state->frag_clamp = rs ? rs->rs.clamp_fragment_color : 0;
-
     for (i = 0; i < texstate->sampler_state_count; i++) {
         struct r300_sampler_state *s = texstate->sampler_states[i];
         struct r300_sampler_view *v = texstate->sampler_views[i];
index 5d4a895e87c9d5bb761b89a71cb7b003c79716da..33fdf3b6261422e6e6001c87e4602bb2bd5f9b46 100644 (file)
@@ -1231,7 +1231,6 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
     struct r300_rs_state* rs = (struct r300_rs_state*)state;
     int last_sprite_coord_enable = r300->sprite_coord_enable;
     boolean last_two_sided_color = r300->two_sided_color;
-    boolean last_frag_clamp = r300->frag_clamp;
 
     if (r300->draw && rs) {
         draw_set_rasterizer_state(r300->draw, &rs->rs_draw, state);
@@ -1241,12 +1240,10 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
         r300->polygon_offset_enabled = rs->polygon_offset_enable;
         r300->sprite_coord_enable = rs->rs.sprite_coord_enable;
         r300->two_sided_color = rs->rs.light_twoside;
-        r300->frag_clamp = rs->rs.clamp_fragment_color;
     } else {
         r300->polygon_offset_enabled = FALSE;
         r300->sprite_coord_enable = 0;
         r300->two_sided_color = FALSE;
-        r300->frag_clamp = FALSE;
     }
 
     UPDATE_STATE(state, r300->rs_state);
@@ -1256,11 +1253,6 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
         last_two_sided_color != r300->two_sided_color) {
         r300_mark_atom_dirty(r300, &r300->rs_block_state);
     }
-
-    if (last_frag_clamp != r300->frag_clamp &&
-        r300->fs_status == FRAGMENT_SHADER_VALID) {
-        r300->fs_status = FRAGMENT_SHADER_MAYBE_DIRTY;
-    }
 }
 
 /* Free rasterizer state. */