Mesa (7.9): r300/compiler: Don' t allow presubtract sources to be remapped twice

Tom Stellard tstellar at kemper.freedesktop.org
Fri Dec 10 19:19:49 UTC 2010


Module: Mesa
Branch: 7.9
Commit: e8bc8d6a5c83a708881e2bef2d3f65fee9210f95
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e8bc8d6a5c83a708881e2bef2d3f65fee9210f95

Author: Tom Stellard <tstellar at gmail.com>
Date:   Mon Nov 22 23:48:47 2010 -0800

r300/compiler: Don't allow presubtract sources to be remapped twice

https://bugs.freedesktop.org/show_bug.cgi?id=31193

NOTE: This is a candidate for the 7.9 branch.
(cherry picked from commit 4265c2f81980eae37f6081979c65b2d1bae60b82)

---

 .../drivers/dri/r300/compiler/radeon_dataflow.c    |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c
index e73700f..7ed48e1 100644
--- a/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c
+++ b/src/mesa/drivers/dri/r300/compiler/radeon_dataflow.c
@@ -250,6 +250,7 @@ static void remap_normal_instruction(struct rc_instruction * fullinst,
 {
 	struct rc_sub_instruction * inst = &fullinst->U.I;
 	const struct rc_opcode_info * opcode = rc_get_opcode_info(inst->Opcode);
+	unsigned int remapped_presub = 0;
 
 	if (opcode->HasDstReg) {
 		rc_register_file file = inst->DstReg.File;
@@ -269,6 +270,12 @@ static void remap_normal_instruction(struct rc_instruction * fullinst,
 			unsigned int i;
 			unsigned int srcp_srcs = rc_presubtract_src_reg_count(
 						inst->PreSub.Opcode);
+			/* Make sure we only remap presubtract sources once in
+			 * case more than one source register reads the
+			 * presubtract result. */
+			if (remapped_presub)
+				continue;
+
 			for(i = 0; i < srcp_srcs; i++) {
 				file = inst->PreSub.SrcReg[i].File;
 				index = inst->PreSub.SrcReg[i].Index;
@@ -276,7 +283,7 @@ static void remap_normal_instruction(struct rc_instruction * fullinst,
 				inst->PreSub.SrcReg[i].File = file;
 				inst->PreSub.SrcReg[i].Index = index;
 			}
-
+			remapped_presub = 1;
 		}
 		else {
 			cb(userdata, fullinst, &file, &index);




More information about the mesa-commit mailing list