summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300
diff options
context:
space:
mode:
authorTom Stellard <[email protected]>2011-10-15 17:55:40 -0400
committerTom Stellard <[email protected]>2011-10-16 19:54:48 -0700
commit8327fd18c9e2e89629696fb8dea729c7f3c773b5 (patch)
treef869485d1b008ddecd360cb4bec5184d9dafd9f7 /src/gallium/drivers/r300
parent653c7af3d6659ed824ae248e398ac4aec94e0a41 (diff)
r300/compiler: More agressive RGB to Alpha conversions
Diffstat (limited to 'src/gallium/drivers/r300')
-rw-r--r--src/gallium/drivers/r300/compiler/radeon_pair_schedule.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/gallium/drivers/r300/compiler/radeon_pair_schedule.c b/src/gallium/drivers/r300/compiler/radeon_pair_schedule.c
index 7ecdc7c43d8..94cf9a77cea 100644
--- a/src/gallium/drivers/r300/compiler/radeon_pair_schedule.c
+++ b/src/gallium/drivers/r300/compiler/radeon_pair_schedule.c
@@ -781,7 +781,7 @@ static void is_rgb_to_alpha_possible(
struct rc_pair_instruction_arg * arg,
struct rc_pair_instruction_source * src)
{
- unsigned int chan_count = 0;
+ unsigned int read_chan = RC_SWIZZLE_UNUSED;
unsigned int alpha_sources = 0;
unsigned int i;
struct rc_reader_data * reader_data = userdata;
@@ -803,8 +803,9 @@ static void is_rgb_to_alpha_possible(
return;
}
- /* Make sure the source only reads from one component.
- * XXX We should allow the source to read from the same component twice.
+ /* Make sure the source only reads the register component that we
+ * are going to be convering from. It is OK if the instruction uses
+ * this component more than once.
* XXX If the index we will be converting to is the same as the
* current index, then it is OK to read from more than one component.
*/
@@ -815,16 +816,17 @@ static void is_rgb_to_alpha_possible(
case RC_SWIZZLE_Y:
case RC_SWIZZLE_Z:
case RC_SWIZZLE_W:
- chan_count++;
+ if (read_chan == RC_SWIZZLE_UNUSED) {
+ read_chan = swz;
+ } else if (read_chan != swz) {
+ reader_data->Abort = 1;
+ return;
+ }
break;
default:
break;
}
}
- if (chan_count > 1) {
- reader_data->Abort = 1;
- return;
- }
/* Make sure there are enough alpha sources.
* XXX If we know what register all the readers are going