[Mesa-dev] [PATCH 04/18] radeonsi: use get_resinfo diretly in lower_gather4_integer

Samuel Pitoiset samuel.pitoiset at gmail.com
Tue Aug 14 12:45:03 UTC 2018


*directly*

Assuming this doesn't break anything, series is:

Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>

On 8/4/18 9:54 AM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> ---
>   .../drivers/radeonsi/si_shader_tgsi_mem.c     | 25 +++++++++----------
>   1 file changed, 12 insertions(+), 13 deletions(-)
> 
> diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
> index 40211837186..668238b1012 100644
> --- a/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
> +++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c
> @@ -1323,45 +1323,44 @@ si_lower_gather4_integer(struct si_shader_context *ctx,
>   		formats = LLVMBuildSelect(builder, wa_8888, wa_formats, formats, "");
>   		args->resource = LLVMBuildInsertElement(
>   			builder, args->resource, formats, ctx->i32_1, "");
>   	}
>   
>   	if (target == TGSI_TEXTURE_RECT ||
>   	    target == TGSI_TEXTURE_SHADOWRECT) {
>   		assert(!wa_8888);
>   		half_texel[0] = half_texel[1] = LLVMConstReal(ctx->f32, -0.5);
>   	} else {
> -		struct tgsi_full_instruction txq_inst = {};
> -		struct ac_image_args txq_args = {};
> -		struct lp_build_emit_data txq_emit_data = {};
> +		struct ac_image_args resinfo = {};
>   		struct lp_build_if_state if_ctx;
>   
>   		if (wa_8888) {
>   			/* Skip the texture size query entirely if we don't need it. */
>   			lp_build_if(&if_ctx, &ctx->gallivm, LLVMBuildNot(builder, wa_8888, ""));
>   		}
>   
>   		/* Query the texture size. */
> -		txq_inst.Texture.Texture = target;
> -		txq_emit_data.inst = &txq_inst;
> -		txq_emit_data.dst_type = ctx->v4i32;
> -		txq_args.resource = args->resource;
> -		txq_args.sampler = args->sampler;
> -		txq_args.lod = ctx->ac.i32_0;
> -		txq_args.dmask = 0xf;
> -		set_tex_fetch_args(ctx, &txq_emit_data, &txq_args, target);
> -		txq_emit(NULL, &ctx->bld_base, &txq_emit_data);
> +		resinfo.opcode = ac_image_get_resinfo;
> +		resinfo.dim = ac_texture_dim_from_tgsi_target(ctx->screen, target);
> +		resinfo.resource = args->resource;
> +		resinfo.sampler = args->sampler;
> +		resinfo.lod = ctx->ac.i32_0;
> +		resinfo.dmask = 0xf;
> +
> +		LLVMValueRef texsize =
> +			fix_resinfo(ctx, target,
> +				    ac_build_image_opcode(&ctx->ac, &resinfo));
>   
>   		/* Compute -0.5 / size. */
>   		for (unsigned c = 0; c < 2; c++) {
>   			half_texel[c] =
> -				LLVMBuildExtractElement(builder, txq_emit_data.output[0],
> +				LLVMBuildExtractElement(builder, texsize,
>   							LLVMConstInt(ctx->i32, c, 0), "");
>   			half_texel[c] = LLVMBuildUIToFP(builder, half_texel[c], ctx->f32, "");
>   			half_texel[c] = ac_build_fdiv(&ctx->ac, ctx->ac.f32_1, half_texel[c]);
>   			half_texel[c] = LLVMBuildFMul(builder, half_texel[c],
>   						      LLVMConstReal(ctx->f32, -0.5), "");
>   		}
>   
>   		if (wa_8888) {
>   			lp_build_endif(&if_ctx);
>   
> 


More information about the mesa-dev mailing list