[Mesa-dev] [PATCH 07/10] radeonsi: unify shader delete functions

Michel Dänzer michel at daenzer.net
Tue Oct 13 02:25:37 PDT 2015


On 11.10.2015 10:11, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
> 
> ---
>  src/gallium/drivers/radeonsi/si_state_shaders.c | 84 +++++--------------------
>  1 file changed, 17 insertions(+), 67 deletions(-)
> 
> diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
> index 9d05cb5..cc053bb 100644
> --- a/src/gallium/drivers/radeonsi/si_state_shaders.c
> +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
> @@ -907,11 +907,21 @@ static void si_bind_ps_shader(struct pipe_context *ctx, void *state)
>  	si_mark_atom_dirty(sctx, &sctx->cb_target_mask);
>  }
>  
> -static void si_delete_shader_selector(struct pipe_context *ctx,
> -				      struct si_shader_selector *sel)
> +static void si_delete_shader_selector(struct pipe_context *ctx, void *state)
>  {
>  	struct si_context *sctx = (struct si_context *)ctx;
> +	struct si_shader_selector *sel = (struct si_shader_selector *)state;
>  	struct si_shader *p = sel->current, *c;
> +	struct si_shader_selector **current_shader[SI_NUM_SHADERS] = {
> +		[PIPE_SHADER_VERTEX] = &sctx->vs_shader,
> +		[PIPE_SHADER_TESS_CTRL] = &sctx->tcs_shader,
> +		[PIPE_SHADER_TESS_EVAL] = &sctx->tes_shader,
> +		[PIPE_SHADER_GEOMETRY] = &sctx->gs_shader,
> +		[PIPE_SHADER_FRAGMENT] = &sctx->ps_shader,
> +	};

A switch (sel->type) statement might allow the compiler to generate more
efficient code than this. 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             |             Mesa and X developer


More information about the mesa-dev mailing list