summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorTom Stellard <[email protected]>2010-09-04 19:10:23 -0700
committerTom Stellard <[email protected]>2010-09-10 18:18:09 -0700
commit598e220f9581db750cf212c59275d25fda810fe1 (patch)
tree66c25a26aad4f6c65b990ab548b51f2c144e7419 /src/mesa
parent63432ecfce5415fbf07f1781ec77b5ea3efff599 (diff)
r300/compiler: Clean up rc_pair_alloc_source()
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c32
1 files changed, 12 insertions, 20 deletions
diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c
index 5a50584b725..c31efdb0590 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_program_pair.c
@@ -45,23 +45,16 @@ int rc_pair_alloc_source(struct rc_pair_instruction *pair,
if ((!rgb && !alpha) || file == RC_FILE_NONE)
return 0;
- if (rgb && pair->RGB.Src[RC_PAIR_PRESUB_SRC].Used) {
- if (file == RC_FILE_PRESUB) {
- if (index != pair->RGB.Src[RC_PAIR_PRESUB_SRC].Index) {
+ /* Make sure only one presubtract operation is used per instruction. */
+ if (file == RC_FILE_PRESUB) {
+ if (rgb && pair->RGB.Src[RC_PAIR_PRESUB_SRC].Used
+ && index != pair->RGB.Src[RC_PAIR_PRESUB_SRC].Index) {
return -1;
- }
- } else {
- rgb_used++;
}
- }
- if (alpha && pair->Alpha.Src[RC_PAIR_PRESUB_SRC].Used) {
- if (file == RC_FILE_PRESUB) {
- if (index != pair->Alpha.Src[RC_PAIR_PRESUB_SRC].Index) {
+ if (alpha && pair->Alpha.Src[RC_PAIR_PRESUB_SRC].Used
+ && index != pair->Alpha.Src[RC_PAIR_PRESUB_SRC].Index) {
return -1;
- }
- } else {
- alpha_used++;
}
}
@@ -92,17 +85,16 @@ int rc_pair_alloc_source(struct rc_pair_instruction *pair,
candidate = i;
}
}
- if (candidate < 0 || (rgb && rgb_used > 2) || (alpha && alpha_used > 2))
+
+ if (file == RC_FILE_PRESUB) {
+ candidate = RC_PAIR_PRESUB_SRC;
+ } else if (candidate < 0 || (rgb && rgb_used > 2)
+ || (alpha && alpha_used > 2)) {
return -1;
+ }
/* candidate >= 0 */
- /* Even if we have a presub src, the above loop needs to run,
- * because we still need to make sure there is a free source.
- */
- if (file == RC_FILE_PRESUB)
- candidate = RC_PAIR_PRESUB_SRC;
-
if (rgb) {
pair->RGB.Src[candidate].Used = 1;
pair->RGB.Src[candidate].File = file;