[Mesa-dev] [PATCH v2] ac: fix texture query LOD for 1D textures on GFX9

Nicolai Hähnle nhaehnle at gmail.com
Fri Apr 27 09:11:17 UTC 2018


Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

On 25.04.2018 18:15, Samuel Pitoiset wrote:
> 1D textures are allocated as 2D which means we only need
> one coordinate for texture query LOD.
> 
> v2: - move the fixup into ac_nir_to_llvm
> 
> Fixes: 625dcbbc456 ("amd/common: pass address components individually to
> ac_build_image_intrinsic")
> Cc: 18.1 <mesa-stable at lists.freedesktop.org>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
>   src/amd/common/ac_nir_to_llvm.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
> 
> diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
> index 900c1c4afea..e4ae6ef49ad 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -1309,6 +1309,14 @@ static LLVMValueRef build_tex_intrinsic(struct ac_nir_context *ctx,
>   		}
>   	}
>   
> +	/* Fixup for GFX9 which allocates 1D textures as 2D. */
> +	if (instr->op == nir_texop_lod && ctx->ac.chip_class >= GFX9) {
> +		if ((args->dim == ac_image_2darray ||
> +		     args->dim == ac_image_2d) && !args->coords[1]) {
> +			args->coords[1] = ctx->ac.i32_0;
> +		}
> +	}
> +
>   	args->attributes = AC_FUNC_ATTR_READNONE;
>   	return ac_build_image_opcode(&ctx->ac, args);
>   }
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list