[Mesa-dev] [PATCH 2/2] r600: Turn 'r600_shader_key' struct into union
Emil Velikov
emil.l.velikov at gmail.com
Thu Aug 20 11:38:17 PDT 2015
Hi Edward,
On 19 August 2015 at 09:58, Edward O'Callaghan
<edward.ocallaghan at koparo.com> wrote:
> From: Edward O'Callaghan <eocallaghan at alterapraxis.com>
>
> This struct was getting a bit crowded, following the lead of
> radeonsi, mirror the idea of having sub-structures for each
> shader type. Turning 'r600_shader_key' into an union saves
> some trivial memory and CPU cycles for the shader keys.
>
> Signed-off-by: Edward O'Callaghan <eocallaghan at alterapraxis.com>
> ---
[snip]
> diff --git a/src/gallium/drivers/r600/r600_shader.h b/src/gallium/drivers/r600/r600_shader.h
> index 5d05c81..e999997 100644
> --- a/src/gallium/drivers/r600/r600_shader.h
> +++ b/src/gallium/drivers/r600/r600_shader.h
> @@ -95,13 +95,18 @@ struct r600_shader {
> struct r600_shader_array * arrays;
> };
>
> -struct r600_shader_key {
> - unsigned color_two_side:1;
> - unsigned alpha_to_one:1;
> - unsigned nr_cbufs:4;
> - unsigned vs_as_es:1;
> - unsigned vs_as_gs_a:1;
> - unsigned vs_prim_id_out:8;
> +union r600_shader_key {
> + struct {
> + unsigned color_two_side:1;
> + unsigned alpha_to_one:1;
> + unsigned nr_cbufs:4;
> + } ps;
> + struct {
> + unsigned as_es:1; /* export shader */
> + unsigned as_ls:1; /* local shader */
This seems like a new addition. Perhaps you should introduce it when
there is a user for it ?
Cheers
Emil
More information about the mesa-dev
mailing list