[Mesa-dev] [PATCH 22/70] i965: Add dword aliases to bitfield structs
Martin Peres
martin.peres at linux.intel.com
Mon Aug 10 08:29:56 PDT 2015
On 07/08/15 23:13, Chris Wilson wrote:
> When processing the packed fields, it often much easier to pass around
verb missing after "it"?
> the dword value (as would be seen by hardware) than it is manipulating
> the bitfield. By aliasing the bitfield with a uint32_t member, we can
> treat the value as either a collection of bits or a single value
> depending upon the situation.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
> src/mesa/drivers/dri/i965/brw_structs.h | 33 +++++++++++++++++++--------------
> 1 file changed, 19 insertions(+), 14 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_structs.h b/src/mesa/drivers/dri/i965/brw_structs.h
> index 55338c0..b09d4ba 100644
> --- a/src/mesa/drivers/dri/i965/brw_structs.h
> +++ b/src/mesa/drivers/dri/i965/brw_structs.h
> @@ -391,13 +391,16 @@ struct brw_sf_unit_state
> unsigned pad3:1;
> } thread4;
>
> - struct
> + union
> {
> - unsigned front_winding:1;
> - unsigned viewport_transform:1;
> - unsigned pad0:3;
> - unsigned sf_viewport_state_offset:27; /* Offset from GENERAL_STATE_BASE */
> - } sf5;
> + struct {
> + unsigned front_winding:1;
> + unsigned viewport_transform:1;
> + unsigned pad0:3;
> + unsigned sf_viewport_state_offset:27; /* Offset from GENERAL_STATE_BASE */
> + } sf5;
> + uint32_t dw5;
> + };
>
> struct
> {
> @@ -525,15 +528,17 @@ struct brw_wm_unit_state
> struct thread2 thread2;
> struct thread3 thread3;
>
> - struct {
> - unsigned stats_enable:1;
> - unsigned depth_buffer_clear:1;
> - unsigned sampler_count:3;
> - unsigned sampler_state_pointer:27;
> - } wm4;
> + union {
> + struct {
> + unsigned stats_enable:1;
> + unsigned depth_buffer_clear:1;
> + unsigned sampler_count:3;
> + unsigned sampler_state_pointer:27;
> + } wm4;
> + uint32_t dw4;
> + };
>
> - struct
> - {
> + struct {
> unsigned enable_8_pix:1;
> unsigned enable_16_pix:1;
> unsigned enable_32_pix:1;
Patches 14-22 are:
Reviewed-by: Martin Peres <martin.peres at linux.intel.com>
More information about the mesa-dev
mailing list