r300/compiler: Only convert RGB->Alpha when optimizations are enabled
authorTom Stellard <tstellar@gmail.com>
Sun, 16 Oct 2011 15:12:54 +0000 (08:12 -0700)
committerTom Stellard <tstellar@gmail.com>
Mon, 17 Oct 2011 02:54:48 +0000 (19:54 -0700)
src/gallium/drivers/r300/compiler/r3xx_fragprog.c
src/gallium/drivers/r300/compiler/radeon_pair_schedule.c

index 70354ab8164413a8f5d29aa748e9e366755d9804..3bee2b64d35b63da545a0dd261f49bf77b8509bc 100644 (file)
@@ -149,7 +149,7 @@ void r3xx_compile_fragment_program(struct r300_fragment_program_compiler* c)
                {"dataflow swizzles",           1, 1,           rc_dataflow_swizzles,           NULL},
                {"dead constants",              1, 1,           rc_remove_unused_constants,     &c->code->constants_remap_table},
                {"pair translate",              1, 1,           rc_pair_translate,              NULL},
-               {"pair scheduling",             1, 1,           rc_pair_schedule,               NULL},
+               {"pair scheduling",             1, 1,           rc_pair_schedule,               &opt},
                {"dead sources",                1, 1,           rc_pair_remove_dead_sources, NULL},
                {"register allocation",         1, 1,           rc_pair_regalloc,               &opt},
                {"final code validation",       0, 1,           rc_validate_final_shader,       NULL},
index e03afb4c82fcb5f0f24733376e5824262ea2cb41..7ecdc7c43d83667b7fb084be6a7fe9da4fb88594 100644 (file)
@@ -151,6 +151,7 @@ struct schedule_state {
        long max_tex_group;
        unsigned PrevBlockHasTex:1;
        unsigned TEXCount;
+       unsigned Opt:1;
 };
 
 static struct reg_value ** get_reg_valuep(struct schedule_state * s,
@@ -962,6 +963,10 @@ static void pair_instructions(struct schedule_state * s)
                rgb_ptr = rgb_next;
        }
 
+       if (!s->Opt) {
+               return;
+       }
+
        /* Try to convert some of the RGB instructions to Alpha and
         * try to pair it with another RGB. */
        rgb_ptr = s->ReadyRGB;
@@ -1283,8 +1288,10 @@ void rc_pair_schedule(struct radeon_compiler *cc, void *user)
        struct r300_fragment_program_compiler *c = (struct r300_fragment_program_compiler*)cc;
        struct schedule_state s;
        struct rc_instruction * inst = c->Base.Program.Instructions.Next;
+       unsigned int * opt = user;
 
        memset(&s, 0, sizeof(s));
+       s.Opt = *opt;
        s.C = &c->Base;
        s.CalcScore = calc_score_readers;
        s.max_tex_group = debug_get_num_option("RADEON_TEX_GROUP", 8);