[Mesa-dev] [PATCH 1/2] i965/vs: When asked to make a dst_reg for a src.xxxx, just write to src.x.
Eric Anholt
eric at anholt.net
Fri Apr 5 11:11:28 PDT 2013
We have several places in our pull constant handling where we make a
temporary src_reg for an int, and then turn it into a dst. In doing so,
we were writing to the dst.xyzw, so we never register coalesced it with a
later mov from dst.x to real_dst.x.
These extra channels written would be removed if we had channel-wise DCE
in the backend, but we don't. Fix it for now by just not writing these
extra channels that won't get used.
---
src/mesa/drivers/dri/i965/brw_vec4.cpp | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
index c58fb44..e470ac8 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
@@ -200,7 +200,14 @@ dst_reg::dst_reg(src_reg reg)
this->reg = reg.reg;
this->reg_offset = reg.reg_offset;
this->type = reg.type;
- this->writemask = WRITEMASK_XYZW;
+ /* How should we do writemasking when converting from a src_reg? It seems
+ * pretty obvious that for src.xxxx the caller wants to write to src.x, but
+ * what about for src.wx? Just special-case src.xxxx for now.
+ */
+ if (reg.swizzle == BRW_SWIZZLE_XXXX)
+ this->writemask = WRITEMASK_X;
+ else
+ this->writemask = WRITEMASK_XYZW;
this->reladdr = reg.reladdr;
this->fixed_hw_reg = reg.fixed_hw_reg;
}
--
1.7.10.4
More information about the mesa-dev
mailing list