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

Ian Romanick idr at freedesktop.org
Mon Jul 14 15:48:45 PDT 2014


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

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): 44 40,577,049,140       68,118,608       62,441,063     5,677,545            0
After  (32-bit): 71 40,583,408,411       67,761,528       62,263,519     5,498,009            0

Before (64-bit): 63 37,122,829,194       95,153,008       87,333,600     7,819,408            0
After  (64-bit): 67 37,123,303,706       95,150,544       87,333,600     7,816,944            0

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

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 e73b113..1071858 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -768,10 +768,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.
@@ -797,13 +812,6 @@ public:
       unsigned stream;
 
       /**
-       * 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