r300/compiler: Only convert RGB->Alpha when optimizations are enabled

This commit is contained in:
Tom Stellard
2011-10-16 08:12:54 -07:00
parent e9edcf8b1d
commit 653c7af3d6
2 changed files with 8 additions and 1 deletions
@@ -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},
@@ -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);