<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, May 31, 2018 at 10:32 AM, Matt Turner <span dir="ltr"><<a href="mailto:mattst88@gmail.com" target="_blank">mattst88@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Thu, May 24, 2018 at 2:56 PM, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>> wrote:<br>
> From: Francisco Jerez <<a href="mailto:currojerez@riseup.net">currojerez@riseup.net</a>><br>
><br>
> v2 (Jason Ekstrand):<br>
> - Disallow gl_SampleId in SIMD32 on gen7<br>
><br>
> Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
> ---<br>
> src/intel/compiler/brw_fs.cpp | 31 ++++++++++++++++++++++--------<wbr>-<br>
> 1 file changed, 22 insertions(+), 9 deletions(-)<br>
><br>
> diff --git a/src/intel/compiler/brw_fs.<wbr>cpp b/src/intel/compiler/brw_fs.<wbr>cpp<br>
> index ae59716..9ffa3ca 100644<br>
> --- a/src/intel/compiler/brw_fs.<wbr>cpp<br>
> +++ b/src/intel/compiler/brw_fs.<wbr>cpp<br>
> @@ -861,6 +861,11 @@ fs_inst::size_read(int arg) const<br>
> return mlen * REG_SIZE;<br>
> break;<br>
><br>
> + case FS_OPCODE_SET_SAMPLE_ID:<br>
> + if (arg == 1)<br>
> + return 1;<br>
> + break;<br>
> +<br>
> case FS_OPCODE_UNIFORM_PULL_<wbr>CONSTANT_LOAD_GEN7:<br>
> /* The payload is actually stored in src1 */<br>
> if (arg == 1)<br>
> @@ -1284,16 +1289,20 @@ fs_visitor::emit_sampleid_<wbr>setup()<br>
> * TODO: These payload bits exist on Gen7 too, but they appear to always<br>
> * be zero, so this code fails to work. We should find out why.<br>
> */<br>
> - fs_reg tmp(VGRF, alloc.allocate(1), BRW_REGISTER_TYPE_UW);<br>
> + const fs_reg tmp = abld.vgrf(BRW_REGISTER_TYPE_<wbr>UW);<br>
> +<br>
> + for (unsigned i = 0; i < DIV_ROUND_UP(dispatch_width, 16); i++) {<br>
> + const fs_builder hbld = abld.group(MIN2(16, dispatch_width), i);<br>
> + hbld.SHR(offset(tmp, hbld, i),<br>
> + stride(retype(brw_vec1_grf(1 + i, 0), BRW_REGISTER_TYPE_UB),<br>
> + 1, 8, 0),<br>
> + brw_imm_v(0x44440000));<br>
> + }<br>
><br>
> - abld.SHR(tmp, fs_reg(stride(retype(brw_vec1_<wbr>grf(1, 0),<br>
> - BRW_REGISTER_TYPE_UB), 1, 8, 0)),<br>
> - brw_imm_v(0x44440000));<br>
> abld.AND(*reg, tmp, brw_imm_w(0xf));<br>
> } else {<br>
> - const fs_reg t1 = component(fs_reg(VGRF, alloc.allocate(1),<br>
> - BRW_REGISTER_TYPE_UD), 0);<br>
> - const fs_reg t2(VGRF, alloc.allocate(1), BRW_REGISTER_TYPE_UW);<br>
> + const fs_reg t1 = component(abld.vgrf(BRW_<wbr>REGISTER_TYPE_UD), 0);<br>
> + const fs_reg t2 = abld.vgrf(BRW_REGISTER_TYPE_<wbr>UW);<br>
><br>
> /* The PS will be run in MSDISPMODE_PERSAMPLE. For example with<br>
> * 8x multisampling, subspan 0 will represent sample N (where N<br>
> @@ -1323,8 +1332,12 @@ fs_visitor::emit_sampleid_<wbr>setup()<br>
> brw_imm_ud(0xc0));<br>
> abld.exec_all().group(1, 0).SHR(t1, t1, brw_imm_d(5));<br>
><br>
> - /* This works for both SIMD8 and SIMD16 */<br>
> - abld.exec_all().group(4, 0).MOV(t2, brw_imm_v(0x3210));<br>
> + /* This works for SIMD8-SIMD16. It also works for SIMD32 but only if we<br>
> + * can assume 4x MSAA. Disallow it on IVB+<br>
> + */<br>
> + if (devinfo->gen >= 7)<br>
> + limit_dispatch_width(16, "gl_SampleId is unsupported in SIMD32 on gen7");<br>
> + abld.exec_all().group(8, 0).MOV(t2, brw_imm_v(0x32103210));<br>
<br>
</div></div>Can we mark this with FINISHME?<br>
</blockquote></div></div><div class="gmail_extra"><br></div><div class="gmail_extra">Sure. Done.<br></div></div>