summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-01-28 17:01:34 -0700
committerAlan Hourihane <alanh@vmware.com>2009-01-29 00:59:54 +0000
commit80b37673846e9eea7917c761c8d97687a07cf964 (patch)
tree2e77669f5bdd1da130761a962bec37679a8ea9db
parent477c1820a0a4b0a438e8f36ea6ac498ef53d07e1 (diff)
i965: fix bug in pass0_precalc_mov()
Previously, "in-place" swizzles such as: MOV t, t.xxyx; were handled incorrectly. Fixed by splitting the one loop into two loops so we get all the refs before assigning them (to avoid potential clobbering). (cherry picked from master/commit faa48915d27634a12f123eaa6e954ec79565e365)
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_pass0.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm_pass0.c b/src/mesa/drivers/dri/i965/brw_wm_pass0.c
index 205a7160d3..fca7b7a50c 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_pass0.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_pass0.c
@@ -379,14 +379,22 @@ static void pass0_precalc_mov( struct brw_wm_compile *c,
{
const struct prog_dst_register *dst = &inst->DstReg;
GLuint writemask = inst->DstReg.WriteMask;
+ struct brw_wm_ref *refs[4];
GLuint i;
/* Get the effect of a MOV by manipulating our register table:
+ * First get all refs, then assign refs. This ensures that "in-place"
+ * swizzles such as:
+ * MOV t, t.xxyx
+ * are handled correctly. Previously, these two steps were done in
+ * one loop and the above case was incorrectly handled.
*/
for (i = 0; i < 4; i++) {
- if (writemask & (1<<i)) {
- pass0_set_fpreg_ref( c, dst->File, dst->Index, i,
- get_new_ref(c, inst->SrcReg[0], i, NULL));
+ refs[i] = get_new_ref(c, inst->SrcReg[0], i, NULL);
+ }
+ for (i = 0; i < 4; i++) {
+ if (writemask & (1 << i)) {
+ pass0_set_fpreg_ref( c, dst->File, dst->Index, i, refs[i]);
}
}
}