[Mesa-dev] [PATCH 07/13] i965: make brw_reg imm attibs accessible as a value

Emil Velikov emil.l.velikov at gmail.com
Thu Nov 5 08:17:55 PST 2015


From: Emil Velikov <emil.velikov at collabora.co.uk>

Will allow us an easy once-off get/set of the attribs. Thus we can drop
all the memset/memcmp + magic casting.

XXX: alternative name(s) are welcome

Signed-off-by: Emil Velikov <emil.velikov at collabora.co.uk>
---
 src/mesa/drivers/dri/i965/brw_reg.h | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_reg.h b/src/mesa/drivers/dri/i965/brw_reg.h
index 209ccb5..c8f8f72 100644
--- a/src/mesa/drivers/dri/i965/brw_reg.h
+++ b/src/mesa/drivers/dri/i965/brw_reg.h
@@ -230,14 +230,19 @@ const char *brw_reg_type_letters(unsigned brw_reg_type);
  * or "structure of array" form:
  */
 struct brw_reg {
-   enum brw_reg_type type:4;
-   enum brw_reg_file file:3;      /* :2 hardware format */
-   unsigned negate:1;             /* source only */
-   unsigned abs:1;                /* source only */
-   unsigned address_mode:1;       /* relative addressing, hopefully! */
-   unsigned pad0:1;
-   unsigned subnr:5;              /* :1 in align16 */
-   unsigned nr:16;
+   union {
+      struct {
+         enum brw_reg_type type:4;
+         enum brw_reg_file file:3;      /* :2 hardware format */
+         unsigned negate:1;             /* source only */
+         unsigned abs:1;                /* source only */
+         unsigned address_mode:1;       /* relative addressing, hopefully! */
+         unsigned pad0:1;
+         unsigned subnr:5;              /* :1 in align16 */
+         unsigned nr:16;
+      };
+      unsigned v;
+   };
 
    union {
       struct {
-- 
2.6.2



More information about the mesa-dev mailing list