Mesa (master): r300/compiler: Only convert RGB-> Alpha when optimizations are enabled

Tom Stellard tstellar at kemper.freedesktop.org
Mon Oct 17 02:58:33 UTC 2011


Module: Mesa
Branch: master
Commit: 653c7af3d6659ed824ae248e398ac4aec94e0a41
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=653c7af3d6659ed824ae248e398ac4aec94e0a41

Author: Tom Stellard <tstellar at gmail.com>
Date:   Sun Oct 16 08:12:54 2011 -0700

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

---

 src/gallium/drivers/r300/compiler/r3xx_fragprog.c  |    2 +-
 .../drivers/r300/compiler/radeon_pair_schedule.c   |    7 +++++++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/gallium/drivers/r300/compiler/r3xx_fragprog.c b/src/gallium/drivers/r300/compiler/r3xx_fragprog.c
index 70354ab..3bee2b6 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 e03afb4..7ecdc7c 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);




More information about the mesa-commit mailing list