[Mesa-dev] [PATCH 4/4] radeonsi: add instance divisor support

Michel Dänzer michel at daenzer.net
Tue Mar 26 07:56:09 PDT 2013


On Die, 2013-03-26 at 14:51 +0100, Christian König wrote: 
> From: Christian König <christian.koenig at amd.com>
> 
> Signed-off-by: Christian König <christian.koenig at amd.com>
> [...]
> diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.h b/src/gallium/drivers/radeonsi/radeonsi_shader.h
> index 9dae742..e09f297 100644
> --- a/src/gallium/drivers/radeonsi/radeonsi_shader.h
> +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.h
> @@ -111,13 +111,18 @@ struct si_shader {
>  	unsigned		nr_cbufs;
>  };
>  
> -struct si_shader_key {
> -	unsigned		export_16bpc:8;
> -	unsigned		nr_cbufs:4;
> -	unsigned		color_two_side:1;
> -	unsigned		alpha_func:3;
> -	unsigned		flatshade:1;
> -	float			alpha_ref;
> +union si_shader_key {
> +	struct {
> +		unsigned	export_16bpc:8;
> +		unsigned	nr_cbufs:4;
> +		unsigned	color_two_side:1;
> +		unsigned	alpha_func:3;
> +		unsigned	flatshade:1;
> +		float		alpha_ref;
> +	} ps;
> +	struct {
> +		unsigned	instance_divisors[PIPE_MAX_ATTRIBS];
> +	} vs;
>  };

This grows the shader key from 8 to 128 bytes. I don't suppose the
instance divisors could be encoded in a more compact way? E.g. loading
the divisor values from constants and only tracking which elements use a
divisor in a bitmask in the key.


-- 
Earthling Michel Dänzer           |                   http://www.amd.com
Libre software enthusiast         |          Debian, X and DRI developer


More information about the mesa-dev mailing list