<p dir="ltr"><br>
On Apr 23, 2016 4:39 PM, "Kenneth Graunke" <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>> wrote:<br>
><br>
> From: Jason Ekstrand <<a href="mailto:jason.ekstrand@intel.com">jason.ekstrand@intel.com</a>><br>
><br>
> Reviewed-by: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
> ---<br>
>  src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 8 +++++++-<br>
>  src/mesa/drivers/dri/i965/brw_shader.cpp | 3 ++-<br>
>  2 files changed, 9 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp<br>
> index 725f5da..43d3745 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp<br>
> +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp<br>
> @@ -3205,12 +3205,18 @@ fs_visitor::nir_emit_texture(const fs_builder &bld, nir_tex_instr *instr)<br>
>     case nir_texop_txs: op = ir_txs; break;<br>
>     case nir_texop_texture_samples: {<br>
>        fs_reg dst = retype(get_nir_dest(instr->dest), BRW_REGISTER_TYPE_D);<br>
> -      fs_inst *inst = bld.emit(SHADER_OPCODE_SAMPLEINFO, dst,<br>
> +<br>
> +      fs_reg tmp = bld.vgrf(BRW_REGISTER_TYPE_D, 4);</p>
<p dir="ltr">This one should Cc stable.  The previous behavior would only allocate one register and then write four thus potentially stomping three innocent bystanders.  I've never seen an actual bug related to it but sampleinfo is newish.</p>
<p dir="ltr">> +      fs_inst *inst = bld.emit(SHADER_OPCODE_SAMPLEINFO, tmp,<br>
>                                 bld.vgrf(BRW_REGISTER_TYPE_D, 1),<br>
>                                 texture_reg, texture_reg);<br>
>        inst->mlen = 1;<br>
>        inst->header_size = 1;<br>
>        inst->base_mrf = -1;<br>
> +      inst->regs_written = 4 * (dispatch_width / 8);<br>
> +<br>
> +      /* Pick off the one component we care about */<br>
> +      bld.MOV(dst, tmp);<br>
>        return;<br>
>     }<br>
>     case nir_texop_samples_identical: op = ir_samples_identical; break;<br>
> diff --git a/src/mesa/drivers/dri/i965/brw_shader.cpp b/src/mesa/drivers/dri/i965/brw_shader.cpp<br>
> index 376cb25..76c4a52 100644<br>
> --- a/src/mesa/drivers/dri/i965/brw_shader.cpp<br>
> +++ b/src/mesa/drivers/dri/i965/brw_shader.cpp<br>
> @@ -710,7 +710,8 @@ backend_instruction::is_tex() const<br>
>             opcode == SHADER_OPCODE_TXS ||<br>
>             opcode == SHADER_OPCODE_LOD ||<br>
>             opcode == SHADER_OPCODE_TG4 ||<br>
> -           opcode == SHADER_OPCODE_TG4_OFFSET);<br>
> +           opcode == SHADER_OPCODE_TG4_OFFSET ||<br>
> +           opcode == SHADER_OPCODE_SAMPLEINFO);<br>
>  }<br>
><br>
>  bool<br>
> --<br>
> 2.8.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="https://lists.freedesktop.org/mailman/listinfo/mesa-dev">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</p>