<div dir="auto"><div>Rb<br><div class="gmail_extra"><br><div class="gmail_quote">On Dec 14, 2016 2:58 PM, "Kenneth Graunke" <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="quoted-text">We want to perform the URB read to a vec4 temporary, with no writemask,<br>
then issue a MOV to swizzle the data and store it to the actual<br>
destination, using the final writemask.<br>
<br>
We were doing this wrong. For example, let's say we wanted to read<br>
a vec2 stored in components 2-3 of a vec4. We would generate a URB<br>
read message of:<br>
<br>
SEND <actual destination>.XY <header with mask set to XY><br>
MOV <actual destination>.XY <actual destination>.ZW<br>
<br>
This doesn't work, because the URB message reads the .XY components<br>
of the vec4, rather than the ZW. It writes to the right place, but<br>
with the wrong data. Then the MOV comes along and overwrites it<br>
with data that didn't even come from the URB at all.<br>
<br>
Instead we want to do:<br>
<br>
</div> SEND <temporary> <header with mask set to ZW><br>
<div class="quoted-text"> MOV <actual destination>.XY <temporary>.ZW<br>
<br>
</div><div class="quoted-text">Signed-off-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
---<br>
</div> src/mesa/drivers/dri/i965/brw_<wbr>vec4_tcs.cpp | 10 +++++-----<br>
1 file changed, 5 insertions(+), 5 deletions(-)<br>
<br>
diff --git a/src/mesa/drivers/dri/i965/<wbr>brw_vec4_tcs.cpp b/src/mesa/drivers/dri/i965/<wbr>brw_vec4_tcs.cpp<br>
index c7278e4..b6ff4fd 100644<br>
--- a/src/mesa/drivers/dri/i965/<wbr>brw_vec4_tcs.cpp<br>
+++ b/src/mesa/drivers/dri/i965/<wbr>brw_vec4_tcs.cpp<br>
@@ -209,19 +209,19 @@ vec4_tcs_visitor::emit_output_<wbr>urb_read(const dst_reg &dst,<br>
/* Set up the message header to reference the proper parts of the URB */<br>
dst_reg header = dst_reg(this, glsl_type::uvec4_type);<br>
inst = emit(TCS_OPCODE_SET_OUTPUT_<wbr>URB_OFFSETS, header,<br>
- brw_imm_ud(dst.writemask), indirect_offset);<br>
+ brw_imm_ud(dst.writemask << first_component), indirect_offset);<br>
inst->force_writemask_all = true;<br>
<br>
- /* Read into a temporary, ignoring writemasking. */<br>
vec4_instruction *read = emit(VEC4_OPCODE_URB_READ, dst, src_reg(header));<br>
read->offset = base_offset;<br>
read->mlen = 1;<br>
<div class="quoted-text"> read->base_mrf = -1;<br>
<br>
if (first_component) {<br>
- src_reg src = src_reg(dst);<br>
- src.swizzle = BRW_SWZ_COMP_INPUT(first_<wbr>component);<br>
- emit(MOV(dst, src));<br>
</div>+ /* Read into a temporary and copy with a swizzle and writemask. */<br>
<div class="quoted-text">+ read->dst = retype(dst_reg(this, glsl_type::ivec4_type), dst.type);<br>
+ emit(MOV(dst, swizzle(src_reg(read->dst),<br>
+ BRW_SWZ_COMP_INPUT(first_<wbr>component))));<br>
}<br>
}<br>
<br>
</div><div class="elided-text">--<br>
2.10.2<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</div></blockquote></div><br></div></div></div>