[Mesa-dev] [PATCH] radeonsi: shorten "shader->selector" to "sel" in si_shader_create

Edward O'Callaghan funfunctor at folklore1984.net
Fri Oct 14 04:37:33 UTC 2016


yes, nicer.

Reviewed-by: Edward O'Callaghan <funfunctor at folklore1984.net>

On 10/14/2016 04:16 AM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> ---
>  src/gallium/drivers/radeonsi/si_shader.c | 15 ++++++++-------
>  1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
> index b2d7699..e6edd90 100644
> --- a/src/gallium/drivers/radeonsi/si_shader.c
> +++ b/src/gallium/drivers/radeonsi/si_shader.c
> @@ -7850,35 +7850,36 @@ static void si_fix_num_sgprs(struct si_shader *shader)
>  {
>  	unsigned min_sgprs = shader->info.num_input_sgprs + 2; /* VCC */
>  
>  	shader->config.num_sgprs = MAX2(shader->config.num_sgprs, min_sgprs);
>  }
>  
>  int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm,
>  		     struct si_shader *shader,
>  		     struct pipe_debug_callback *debug)
>  {
> -	struct si_shader *mainp = shader->selector->main_shader_part;
> +	struct si_shader_selector *sel = shader->selector;
> +	struct si_shader *mainp = sel->main_shader_part;
>  	int r;
>  
>  	/* LS, ES, VS are compiled on demand if the main part hasn't been
>  	 * compiled for that stage.
>  	 */
>  	if (!mainp ||
> -	    (shader->selector->type == PIPE_SHADER_VERTEX &&
> +	    (sel->type == PIPE_SHADER_VERTEX &&
>  	     (shader->key.vs.as_es != mainp->key.vs.as_es ||
>  	      shader->key.vs.as_ls != mainp->key.vs.as_ls)) ||
> -	    (shader->selector->type == PIPE_SHADER_TESS_EVAL &&
> +	    (sel->type == PIPE_SHADER_TESS_EVAL &&
>  	     shader->key.tes.as_es != mainp->key.tes.as_es) ||
> -	    (shader->selector->type == PIPE_SHADER_TESS_CTRL &&
> +	    (sel->type == PIPE_SHADER_TESS_CTRL &&
>  	     shader->key.tcs.epilog.inputs_to_copy) ||
> -	    shader->selector->type == PIPE_SHADER_COMPUTE) {
> +	    sel->type == PIPE_SHADER_COMPUTE) {
>  		/* Monolithic shader (compiled as a whole, has many variants,
>  		 * may take a long time to compile).
>  		 */
>  		r = si_compile_tgsi_shader(sscreen, tm, shader, true, debug);
>  		if (r)
>  			return r;
>  	} else {
>  		/* The shader consists of 2-3 parts:
>  		 *
>  		 * - the middle part is the user shader, it has 1 variant only
> @@ -7898,21 +7899,21 @@ int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm,
>  		shader->info.num_input_vgprs = mainp->info.num_input_vgprs;
>  		shader->info.face_vgpr_index = mainp->info.face_vgpr_index;
>  		memcpy(shader->info.vs_output_param_offset,
>  		       mainp->info.vs_output_param_offset,
>  		       sizeof(mainp->info.vs_output_param_offset));
>  		shader->info.uses_instanceid = mainp->info.uses_instanceid;
>  		shader->info.nr_pos_exports = mainp->info.nr_pos_exports;
>  		shader->info.nr_param_exports = mainp->info.nr_param_exports;
>  
>  		/* Select prologs and/or epilogs. */
> -		switch (shader->selector->type) {
> +		switch (sel->type) {
>  		case PIPE_SHADER_VERTEX:
>  			if (!si_shader_select_vs_parts(sscreen, tm, shader, debug))
>  				return -1;
>  			break;
>  		case PIPE_SHADER_TESS_CTRL:
>  			if (!si_shader_select_tcs_parts(sscreen, tm, shader, debug))
>  				return -1;
>  			break;
>  		case PIPE_SHADER_TESS_EVAL:
>  			if (!si_shader_select_tes_parts(sscreen, tm, shader, debug))
> @@ -7939,21 +7940,21 @@ int si_shader_create(struct si_screen *sscreen, LLVMTargetMachineRef tm,
>  		}
>  		if (shader->epilog) {
>  			shader->config.num_sgprs = MAX2(shader->config.num_sgprs,
>  							shader->epilog->config.num_sgprs);
>  			shader->config.num_vgprs = MAX2(shader->config.num_vgprs,
>  							shader->epilog->config.num_vgprs);
>  		}
>  	}
>  
>  	si_fix_num_sgprs(shader);
> -	si_shader_dump(sscreen, shader, debug, shader->selector->info.processor,
> +	si_shader_dump(sscreen, shader, debug, sel->info.processor,
>  		       stderr);
>  
>  	/* Upload. */
>  	r = si_shader_binary_upload(sscreen, shader);
>  	if (r) {
>  		fprintf(stderr, "LLVM failed to upload shader\n");
>  		return r;
>  	}
>  
>  	return 0;
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161014/e469a7b5/attachment.sig>


More information about the mesa-dev mailing list