[Mesa-dev] [PATCH] radv/ac: apply slice rounding to 1d arrays as well.

Bas Nieuwenhuizen bas at basnieuwenhuizen.nl
Tue Jan 31 00:43:36 UTC 2017



On Tue, Jan 31, 2017, at 01:10, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
> 
> Fixes:
> dEQP-VK.glsl.texture_functions.texture.*1darray*
> 
> Signed-off-by: Dave Airlie <airlied at redhat.com>
>  Please enter the commit message for your changes. Lines starting

You probably did not intend to include this line.

Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
> ---
>  src/amd/common/ac_nir_to_llvm.c | 20 +++++++++++++++-----
>  1 file changed, 15 insertions(+), 5 deletions(-)
> 
> diff --git a/src/amd/common/ac_nir_to_llvm.c
> b/src/amd/common/ac_nir_to_llvm.c
> index 0e629de..e04a5cc 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -3545,6 +3545,15 @@ static void tex_fetch_ptrs(struct
> nir_to_llvm_context *ctx,
>  		*fmask_ptr = get_sampler_desc(ctx, instr->texture, DESC_FMASK);
>  }
>  
> +static LLVMValueRef apply_round_slice(struct nir_to_llvm_context *ctx,
> +                                     LLVMValueRef coord)
> +{
> +       coord = to_float(ctx, coord);
> +       coord = ac_emit_llvm_intrinsic(&ctx->ac, "llvm.rint.f32",
> ctx->f32, &coord, 1, 0);
> +       coord = to_integer(ctx, coord);
> +       return coord;
> +}
> +
>  static void visit_tex(struct nir_to_llvm_context *ctx, nir_tex_instr
>  *instr)
>  {
>  	LLVMValueRef result = NULL;
> @@ -3706,15 +3715,16 @@ static void visit_tex(struct nir_to_llvm_context
> *ctx, nir_tex_instr *instr)
>  	/* Pack texture coordinates */
>  	if (coord) {
>  		address[count++] = coords[0];
> -               if (instr->coord_components > 1)
> +               if (instr->coord_components > 1) {
> +                       if (instr->sampler_dim == GLSL_SAMPLER_DIM_1D &&
> instr->is_array && instr->op != nir_texop_txf) {
> +                               coords[1] = apply_round_slice(ctx,
> coords[1]);
> +                       }
>  			address[count++] = coords[1];
> +               }
>  		if (instr->coord_components > 2) {
>  			/* This seems like a bit of a hack - but it passes Vulkan CTS with it */
>  			if (instr->sampler_dim != GLSL_SAMPLER_DIM_3D && instr->op != nir_texop_txf) {
> -                               coords[2] = to_float(ctx, coords[2]);
> -                               coords[2] =
> ac_emit_llvm_intrinsic(&ctx->ac, "llvm.rint.f32", ctx->f32, &coords[2],
> -                                                               1, 0);
> -                               coords[2] = to_integer(ctx, coords[2]);
> +                               coords[2] = apply_round_slice(ctx,
> coords[2]);
>  			}
>  			address[count++] = coords[2];
>  		}
> -- 
> 2.9.3
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list