glsl: Store ir_variable::depth_layout using 3 bits
authorIan Romanick <ian.d.romanick@intel.com>
Thu, 15 May 2014 01:36:57 +0000 (18:36 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Tue, 30 Sep 2014 20:34:42 +0000 (13:34 -0700)
warn_extension_index was moved to improve packing.

Valgrind massif results for a trimmed apitrace of dota2:

                  n        time(i)         total(B)   useful-heap(B) extra-heap(B)    stacks(B)
Before (32-bit): 73 40,580,476,304       68,488,400       62,796,151     5,692,249            0
After  (32-bit): 73 40,575,751,558       68,116,528       62,618,607     5,497,921            0

Before (64-bit): 71 37,124,890,613       95,889,584       88,089,008     7,800,576            0
After  (64-bit): 62 37,123,578,526       95,150,784       87,711,304     7,439,480            0

A real savings of 173KiB on 32-bit and 368KiB on 64-bit.

v2: Use the enum name with the bit-field and remove the extra casts.
Suggested by Ken.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com> [v1]
Reviewed-by: Tapani Pälli <tapani.palli@intel.com> [v1]
src/glsl/ir.h

index 67150ce6cd8dba76722ea48c752f5bd3556ffb47..d96f44029c9679f4c7d5ecf7ac25f37108033170 100644 (file)
@@ -709,6 +709,13 @@ public:
        */
       unsigned index:1;
 
+      /**
+       * \brief Layout qualifier for gl_FragDepth.
+       *
+       * This is not equal to \c ir_depth_layout_none if and only if this
+       * variable is \c gl_FragDepth and a layout qualifier is specified.
+       */
+      ir_depth_layout depth_layout:3;
 
       /**
        * ARB_shader_image_load_store qualifiers.
@@ -719,9 +726,6 @@ public:
       unsigned image_volatile:1;
       unsigned image_restrict:1;
 
-      /** Image internal format if specified explicitly, otherwise GL_NONE. */
-      uint16_t image_format;
-
       /**
        * Emit a warning if this variable is accessed.
        */
@@ -729,13 +733,8 @@ public:
       uint8_t warn_extension_index;
 
    public:
-      /**
-       * \brief Layout qualifier for gl_FragDepth.
-       *
-       * This is not equal to \c ir_depth_layout_none if and only if this
-       * variable is \c gl_FragDepth and a layout qualifier is specified.
-       */
-      ir_depth_layout depth_layout;
+      /** Image internal format if specified explicitly, otherwise GL_NONE. */
+      uint16_t image_format;
 
       /**
        * Storage location of the base of this variable