[Mesa-dev] [PATCH 2/2] i965: Fix shared atomic intrinsics to pay attention to base.

Timothy Arceri timothy.arceri at collabora.com
Tue Jul 19 00:22:38 UTC 2016


On Mon, 2016-07-18 at 15:49 -0700, Kenneth Graunke wrote:

So this fixes a bug with indirects right? Is there a piglit test for
this?

With the typo Ilia pointed out fixed.

Reviewed-by: Timothy Arceri <timothy.arceri at collabora.com>


> Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
> ---
>  src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 15 +++++++++++++--
>  1 file changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
> b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
> index 6265dc6..a39c37e 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp
> @@ -4177,13 +4177,24 @@ fs_visitor::nir_emit_shared_atomic(const
> fs_builder &bld,
>        dest = get_nir_dest(instr->dest);
>  
>     fs_reg surface = brw_imm_ud(GEN7_BTI_SLM);
> -   fs_reg offset = get_nir_src(instr->src[0]);
> +   fs_reg offset;
>     fs_reg data1 = get_nir_src(instr->src[1]);
>     fs_reg data2;
>     if (op == BRW_AOP_CMPWR)
>        data2 = get_nir_src(instr->src[2]);
>  
> -   /* Emit the actual atomic operation operation */
> +   /* Get the offset */
> +   nir_const_value *const_offset = nir_src_as_const_value(instr-
> >src[0]);
> +   if (const_offset) {
> +      offset = brw_imm_ud(instr->const_index[0] + const_offset-
> >u32[0]);
> +   } else {
> +      offset = vgrf(glsl_type::uint_type);
> +      bld.ADD(offset,
> +	      retype(get_nir_src(instr->src[0]),
> BRW_REGISTER_TYPE_UD),
> +	      brw_imm_ud(instr->const_index[0]));
> +   }
> +
> +   /* Emit the actua atomic operation operation */
>  
>     fs_reg atomic_result = emit_untyped_atomic(bld, surface, offset,
>                                                data1, data2,


More information about the mesa-dev mailing list