[Mesa-dev] [PATCH v2 12/12] radeonsi: add an assertion that only two-dimensional constant references are used

Timothy Arceri tarceri at itsqueeze.com
Tue Aug 29 00:32:51 UTC 2017


I'd like to see the clean-ups mentioned in patch 3, that would mean you 
need to remove this assert. I guess you could leave this patch and do 
the clean-up as a follow-up so that you can more easily debug/bisect if 
something has gone wrong, up to you. Either way series:

Reviewed-by: Timothy Arceri <tarceri at itsqueeze.com>

On 28/08/17 18:58, Nicolai Hähnle wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
> 
> v2: remove some redundant checks
> 
> Acked-by: Roland Scheidegger <sroland at vmware.com> (v1)
> Tested-by: Dieter Nützel <Dieter at nuetzel-hh.de> (v1)
> ---
>   src/gallium/drivers/radeonsi/si_shader.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
> index f02fc9e9ba2..81b00246559 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -1844,24 +1844,25 @@ static LLVMValueRef fetch_constant(
>   
>   	if (swizzle == LP_CHAN_ALL) {
>   		unsigned chan;
>   		LLVMValueRef values[4];
>   		for (chan = 0; chan < TGSI_NUM_CHANNELS; ++chan)
>   			values[chan] = fetch_constant(bld_base, reg, type, chan);
>   
>   		return lp_build_gather_values(&ctx->gallivm, values, 4);
>   	}
>   
> -	buf = reg->Register.Dimension ? reg->Dimension.Index : 0;
> +	assert(reg->Register.Dimension);
> +	buf = reg->Dimension.Index;
>   	idx = reg->Register.Index * 4 + swizzle;
>   
> -	if (reg->Register.Dimension && reg->Dimension.Indirect) {
> +	if (reg->Dimension.Indirect) {
>   		LLVMValueRef ptr = LLVMGetParam(ctx->main_fn, ctx->param_const_and_shader_buffers);
>   		LLVMValueRef index;
>   		index = si_get_bounded_indirect_index(ctx, &reg->DimIndirect,
>   						      reg->Dimension.Index,
>   						      ctx->num_const_buffers);
>   		index = LLVMBuildAdd(ctx->gallivm.builder, index,
>   				     LLVMConstInt(ctx->i32, SI_NUM_SHADER_BUFFERS, 0), "");
>   		bufp = ac_build_indexed_load_const(&ctx->ac, ptr, index);
>   	} else
>   		bufp = load_const_buffer_desc(ctx, buf);
> 


More information about the mesa-dev mailing list