[Mesa-dev] [PATCH] r600: move per-type settings into a switch statement

Glenn Kennard glenn.kennard at gmail.com
Sun Nov 29 16:58:45 PST 2015


On Mon, 30 Nov 2015 01:38:03 +0100, Dave Airlie <airlied at gmail.com> wrote:

> From: Dave Airlie <airlied at redhat.com>
>
> This will allow adding tess stuff much cleaner later.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/gallium/drivers/r600/r600_shader.c | 16 +++++++++++-----
>  1 file changed, 11 insertions(+), 5 deletions(-)
>
> diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
> index 560197c..019fef7 100644
> --- a/src/gallium/drivers/r600/r600_shader.c
> +++ b/src/gallium/drivers/r600/r600_shader.c
> @@ -1909,13 +1909,21 @@ static int r600_shader_from_tgsi(struct r600_context *rctx,
>  	shader->processor_type = ctx.type;
>  	ctx.bc->type = shader->processor_type;
>-	if (ctx.type == TGSI_PROCESSOR_VERTEX) {
> +	switch (ctx.type) {
> +	case TGSI_PROCESSOR_VERTEX:
>  		shader->vs_as_gs_a = key.vs.as_gs_a;
>  		shader->vs_as_es = key.vs.as_es;
> +		if (shader->vs_as_es)
> +			ring_outputs = true;
> +		break;
> +	case TGSI_PROCESSOR_GEOMETRY:
> +		ring_outputs = true;
> +		break;
> +	case TGSI_PROCESSOR_FRAGMENT:
> +		shader->two_side = key.ps.color_two_side;
> +		break;
>  	}
>-	ring_outputs = shader->vs_as_es || ctx.type == TGSI_PROCESSOR_GEOMETRY;
> -
>  	if (shader->vs_as_es) {
>  		ctx.gs_for_vs = &rctx->gs_shader->current->shader;
>  	} else {
> @@ -1936,8 +1944,6 @@ static int r600_shader_from_tgsi(struct r600_context *rctx,
>  	shader->nr_ps_color_exports = 0;
>  	shader->nr_ps_max_color_exports = 0;
>-	if (ctx.type == TGSI_PROCESSOR_FRAGMENT)
> -		shader->two_side = key.ps.color_two_side;
> 	/* register allocations */
>  	/* Values [0,127] correspond to GPR[0..127].

Reviewed-by: Glenn Kennard <glenn.kennard at gmail.com>


More information about the mesa-dev mailing list