[Mesa-dev] [PATCH 1/2] radeonsi: Add helper function for emitting constant loads

Michel Dänzer michel at daenzer.net
Tue Aug 6 03:31:24 PDT 2013


On Mon, 2013-08-05 at 14:58 -0400, Tom Stellard wrote:
> From: Tom Stellard <thomas.stellard at amd.com>

[...]

> diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c
> index fee6262..4d8a479 100644
> --- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
> +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c
> @@ -434,8 +450,7 @@ static LLVMValueRef fetch_constant(
>  	addr = lp_build_mul_imm(&bld_base->uint_bld, addr, 16);
>  	args[1] = lp_build_add(&bld_base->uint_bld, addr, args[1]);
>  
> -	result = build_intrinsic(base->gallivm->builder, "llvm.SI.load.const", base->elem_type,
> -                                 args, 2, LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
> +	result = build_constant_load(si_shader_ctx, args[0], args[1]);
>  
>  	return bitcast(bld_base, type, result);
>  }

[...]

> @@ -1287,8 +1298,8 @@ static void preload_constants(struct si_shader_context *si_shader_ctx)
>  			si_shader_ctx->const_resource,
>  			lp_build_const_int32(gallivm, i * 4)
>  		};
> -		si_shader_ctx->constants[i] = build_intrinsic(gallivm->builder, "llvm.SI.load.const",
> -			bld_base->base.elem_type, args, 2, LLVMReadNoneAttribute | LLVMNoUnwindAttribute);
> +		si_shader_ctx->constants[i] = build_constant_load(si_shader_ctx,
> +							args[0], args[1]);

You could get rid of the args[] array in these two functions.

Either way though, this patch is

Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>


-- 
Earthling Michel Dänzer           |                   http://www.amd.com
Libre software enthusiast         |          Debian, X and DRI developer


More information about the mesa-dev mailing list