Mesa (master): glsl: Store ir_variable::depth_layout using 3 bits

Ian Romanick idr at kemper.freedesktop.org
Tue Sep 30 20:35:11 UTC 2014


Module: Mesa
Branch: master
Commit: 8afe6efa218f87158c35857fad41926b404a2cbd
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8afe6efa218f87158c35857fad41926b404a2cbd

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Wed May 14 18:36:57 2014 -0700

glsl: Store ir_variable::depth_layout using 3 bits

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 at intel.com>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Matt Turner <mattst88 at gmail.com> [v1]
Reviewed-by: Tapani Pälli <tapani.palli at intel.com> [v1]

---

 src/glsl/ir.h |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 67150ce..d96f440 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -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




More information about the mesa-commit mailing list