summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/mesa/drivers/dri/i965/brw_fs_visitor.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index e670ba79c18..bf1da9d4588 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -605,6 +605,12 @@ fs_visitor::try_rewrite_rhs_to_dst(ir_assignment *ir,
!src.equals(&last_rhs_inst->dst))
return false;
+ /* If last_rhs_inst wrote a different number of components than our LHS,
+ * we can't safely rewrite it.
+ */
+ if (ir->lhs->type->vector_elements != last_rhs_inst->regs_written())
+ return false;
+
/* Success! Rewrite the instruction. */
last_rhs_inst->dst = dst;