[Mesa-dev] [PATCH 4/6] radeonsi: fix shader param and color count

Michel Dänzer michel at daenzer.net
Wed Aug 1 23:21:17 PDT 2012


On Mit, 2012-08-01 at 23:28 +0200, Christian König wrote: 
> Signed-off-by: Christian König <deathsimple at vodafone.de>
> ---
>  src/gallium/drivers/radeonsi/radeonsi_shader.c |   11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c
> index 81b44a7..522016e 100644
> --- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
> +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c
> @@ -355,6 +355,8 @@ static void si_llvm_emit_epilogue(struct lp_build_tgsi_context * bld_base)
>  				&si_shader_ctx->radeon_bld.soa.bld_base.uint_bld;
>  	struct tgsi_parse_context *parse = &si_shader_ctx->parse;
>  	LLVMValueRef last_args[9] = { 0 };
> +	unsigned color_count = 0;
> +	unsigned param_count = 0;
>  
>  	while (!tgsi_parse_end_of_tokens(parse)) {
>  		/* XXX: component_bits controls which components of the output
> @@ -369,8 +371,6 @@ static void si_llvm_emit_epilogue(struct lp_build_tgsi_context * bld_base)
>  		LLVMValueRef args[9];
>  		unsigned target;
>  		unsigned index;
> -		unsigned color_count = 0;
> -		unsigned param_count = 0;
>  		int i;
>  
>  		tgsi_parse_token(parse);

Good catch.


> @@ -384,17 +384,18 @@ static void si_llvm_emit_epilogue(struct lp_build_tgsi_context * bld_base)
>  			shader->input[i].sid = d->Semantic.Index;
>  			shader->input[i].interpolate = d->Interp.Interpolate;
>  			shader->input[i].centroid = d->Interp.Centroid;
> -			break;
> +			continue;
> +
>  		case TGSI_FILE_OUTPUT:
>  			i = shader->noutput++;
>  			shader->output[i].name = d->Semantic.Name;
>  			shader->output[i].sid = d->Semantic.Index;
>  			shader->output[i].interpolate = d->Interp.Interpolate;
>  			break;
> -		}
>  
> -		if (d->Declaration.File != TGSI_FILE_OUTPUT)
> +		default:
>  			continue;
> +		}

Not sure this hunk helps readability though, as it conflates the
assignment of shader->in/output[] and skipping the rest of the loop for
non-outputs.


Either way though, patches 1, 2, 4 and 6

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