[Mesa-dev] [PATCH 02/19] i965: Mark brw_reg_type and register_file enums as PACKED.

Kenneth Graunke kenneth at whitecape.org
Fri Feb 21 14:25:11 PST 2014


On 02/20/2014 01:41 PM, Matt Turner wrote:
> Will now take a byte, rather than four.
> ---
>  src/mesa/drivers/dri/i965/brw_reg.h    | 3 ++-
>  src/mesa/drivers/dri/i965/brw_shader.h | 3 ++-
>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_reg.h b/src/mesa/drivers/dri/i965/brw_reg.h
> index 978dd3f..6f48b7d 100644
> --- a/src/mesa/drivers/dri/i965/brw_reg.h
> +++ b/src/mesa/drivers/dri/i965/brw_reg.h
> @@ -43,6 +43,7 @@
>  #define BRW_REG_H
>  
>  #include <stdbool.h>
> +#include "main/compiler.h"
>  #include "program/prog_instruction.h"
>  #include "brw_defines.h"
>  
> @@ -88,7 +89,7 @@ brw_is_single_value_swizzle(int swiz)
>             swiz == BRW_SWIZZLE_WWWW);
>  }
>  
> -enum brw_reg_type {
> +enum PACKED brw_reg_type {
>     BRW_REGISTER_TYPE_UD = 0,
>     BRW_REGISTER_TYPE_D,
>     BRW_REGISTER_TYPE_UW,
> diff --git a/src/mesa/drivers/dri/i965/brw_shader.h b/src/mesa/drivers/dri/i965/brw_shader.h
> index 4c79861..4d98cbc 100644
> --- a/src/mesa/drivers/dri/i965/brw_shader.h
> +++ b/src/mesa/drivers/dri/i965/brw_shader.h
> @@ -23,11 +23,12 @@
>  
>  #include <stdint.h>
>  #include "brw_defines.h"
> +#include "main/compiler.h"
>  #include "glsl/ir.h"
>  
>  #pragma once
>  
> -enum register_file {
> +enum PACKED register_file {
>     BAD_FILE,
>     GRF,
>     MRF,
> 

Generally, I only use PACKED when something -relies- on a particular
memory layout.  Is it really worth second guessing the compiler here?
Presumably it had a reason for choosing a larger size other than sheer
stupidity...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140221/36fa2f28/attachment.pgp>


More information about the mesa-dev mailing list