[Mesa-dev] [PATCH 08/21] glsl: Store ir_variable::depth_layout using 3 bits

Ian Romanick idr at freedesktop.org
Tue May 27 19:49:03 PDT 2014


From: Ian Romanick <ian.d.romanick at intel.com>

warn_extension_index was moved to improve packing.

No change in the peak ir_variable memory usage in a trimmed apitrace of
dota2 on 64-bit.

Reduces the peak ir_variable memory usage in a trimmed apitrace of dota2
by 102KiB on 32-bit.

Before: IR MEM: variable usage / name / total: 4432236 915817 5348053
After:  IR MEM: variable usage / name / total: 4327584 915817 5243401

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/glsl/ast_to_hir.cpp |  4 ++--
 src/glsl/ir.h           | 19 +++++++++----------
 2 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index 0621ea7..ef1607d 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -2824,8 +2824,8 @@ get_variable_being_redeclared(ir_variable *var, YYLTYPE loc,
                              "gl_FragDepth: depth layout is declared here "
                              "as '%s, but it was previously declared as "
                              "'%s'",
-                             depth_layout_string(var->data.depth_layout),
-                             depth_layout_string(earlier->data.depth_layout));
+                             depth_layout_string(ir_depth_layout(var->data.depth_layout)),
+                             depth_layout_string(ir_depth_layout(earlier->data.depth_layout)));
       }
 
       earlier->data.depth_layout = var->data.depth_layout;
diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 4147bbc..8515124 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -671,6 +671,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.
+       */
+      unsigned depth_layout:3;
 
       /**
        * ARB_shader_image_load_store qualifiers.
@@ -681,9 +688,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.
        */
@@ -691,13 +695,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
-- 
1.8.1.4



More information about the mesa-dev mailing list