[Mesa-dev] [PATCH 19/21] glsl: Store ir_variable_data::_num_state_slots and ::binding in 16-bits each

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


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

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

Before: IR MEM: variable usage / name / total: 5537064 1121441 6658505
After:  IR MEM: variable usage / name / total: 5327760 1121441 6449201

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: 4222932 787727 5010659
After:  IR MEM: variable usage / name / total: 4118280 787727 4906007

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/glsl/ir.h | 24 ++++++++++++++++--------
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 95182fb..fccbfdd 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -762,10 +762,25 @@ public:
       uint16_t image_format;
 
    private:
-      unsigned _num_state_slots;    /**< Number of state slots used */
+      /**
+       * Number of state slots used
+       *
+       * \note
+       * This could be stored in as few as 7-bits, if necessary.  If it is made
+       * smaller, add an assertion to \c ir_variable::allocate_state_slots to
+       * be safe.
+       */
+      uint16_t _num_state_slots;
 
    public:
       /**
+       * Initial binding point for a sampler, atomic, or UBO.
+       *
+       * For array types, this represents the binding point for the first element.
+       */
+      int16_t binding;
+
+      /**
        * Storage location of the base of this variable
        *
        * The precise meaning of this field depends on the nature of the variable.
@@ -786,13 +801,6 @@ public:
       int location;
 
       /**
-       * Initial binding point for a sampler, atomic, or UBO.
-       *
-       * For array types, this represents the binding point for the first element.
-       */
-      int binding;
-
-      /**
        * Location an atomic counter is stored at.
        */
       struct {
-- 
1.8.1.4



More information about the mesa-dev mailing list