<p dir="ltr"><br>
On Feb 15, 2015 11:55 PM, "Ben Widawsky" <<a href="mailto:benjamin.widawsky@intel.com">benjamin.widawsky@intel.com</a>> wrote:<br>
><br>
> The short version: we need to set bits in R0.7 which provide a mask to be used<br>
> for PS kill samples/pixels. Since the VS has no such concept, we just need to<br>
> set all 1.<br>
><br>
> The longer version...<br>
> Execution for SIMD8 atomics is defined as follows:<br>
> SIMD8: The low 8 bits of the execution mask are ANDed with 8 bits of the<br>
> Pixel/Sample Mask from the message header. For the typed messages, the Slot<br>
> Group in the message descriptor selects either the low or high 8 bits. For the<br>
> untyped messages, the low 8 bits are always selected. The resulting mask is used<br>
> to determine which slots are read into the destination GRF register (for read),<br>
> or which slots are written to the surface (for write). If the header is not<br>
> present, only the low 8 bits of the execution mask are used.<br>
><br>
> The message header for untyped messages is defined in R0.7 "This field contains<br>
> the 16-bit pixel/sample mask to be used for SIMD16 and SIMD8 messages. All 16<br>
> bits are used for SIMD16 messages.  For typed SIMD8 messages, Slot Group selects<br>
> which 8 bits of this field are used. For untyped SIMD8 messages, the low 8 bits<br>
> of this field are used." Furthermore, "The message header for the untyped<br>
> messages only needs to be delivered for pixel shader threads, where the<br>
> execution mask may indicate pixels/samples that are enabled only due to<br>
> derivative (LOD) calculations, but the corresponding slot on the surface must<br>
> not be accessed." We're not using a pixel shader here, but AFAICT, this mask is<br>
> used for all stages.<br>
><br>
> This leaves two options, Remove the header, or make the VS code emit the correct<br>
> thing for the header. I believe one of the goals of using SIMD8 VS was to get as<br>
> much code reuse as possible, and so I chose the latter. Since the VS has no such<br>
> thing as kill instructions, the mask is derived simple as all 1's.</p>
<p dir="ltr">Hm. This seems a little fishy. Don't we still have an execution mask for vertex shaders?  The second half of the if copies that into the bit field.</p>
<p dir="ltr">> Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=87258">https://bugs.freedesktop.org/show_bug.cgi?id=87258</a><br>
> Cc: Kristian Høgsberg <<a href="mailto:krh@bitplanet.net">krh@bitplanet.net</a>><br>
> Signed-off-by: Ben Widawsky <<a href="mailto:ben@bwidawsk.net">ben@bwidawsk.net</a>><br>
> ---<br>
>  src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 3 +++<br>
>  1 file changed, 3 insertions(+)<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
> index 2a36d94..c20289f 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
> +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp<br>
> @@ -2994,6 +2994,9 @@ fs_visitor::emit_untyped_atomic(unsigned atomic_op, unsigned surf_index,<br>
>     if (uses_kill) {<br>
>        emit(MOV(component(sources[0], 7), brw_flag_reg(0, 1)))<br>
>           ->force_writemask_all = true;<br>
> +   } else if (stage == MESA_SHADER_VERTEX) {<br>
> +      emit(MOV(component(sources[0], 7),<br>
> +               brw_imm_ud(0xff)))->force_writemask_all = true;<br>
>     } else {<br>
>        emit(MOV(component(sources[0], 7),<br>
>                 retype(brw_vec1_grf(1, 7), BRW_REGISTER_TYPE_UD));</p>
<p dir="ltr">Also would you mind rearranging the logic a bit here.  Something like this would make it more clear that the header stuff is only for vertex shaders:</p>
<p dir="ltr">If (fragment) {<br>
   If (uses_kill) {<br>
   } else {<br>
   }<br>
} else {<br>
   // vertex stuff<br>
}</p>
<p dir="ltr">> --<br>
> 2.3.0<br>
><br>
> _______________________________________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/mesa-dev">http://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</p>