From 653c7af3d6659ed824ae248e398ac4aec94e0a41 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Sun, 16 Oct 2011 08:12:54 -0700 Subject: [PATCH] r300/compiler: Only convert RGB->Alpha when optimizations are enabled --- src/gallium/drivers/r300/compiler/r3xx_fragprog.c | 2 +- src/gallium/drivers/r300/compiler/radeon_pair_schedule.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/r300/compiler/r3xx_fragprog.c b/src/gallium/drivers/r300/compiler/r3xx_fragprog.c index 70354ab8164..3bee2b64d35 100644 --- a/src/gallium/drivers/r300/compiler/r3xx_fragprog.c +++ b/src/gallium/drivers/r300/compiler/r3xx_fragprog.c @@ -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}, diff --git a/src/gallium/drivers/r300/compiler/radeon_pair_schedule.c b/src/gallium/drivers/r300/compiler/radeon_pair_schedule.c index e03afb4c82f..7ecdc7c43d8 100644 --- a/src/gallium/drivers/r300/compiler/radeon_pair_schedule.c +++ b/src/gallium/drivers/r300/compiler/radeon_pair_schedule.c @@ -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); -- 2.30.2