[Mesa-dev] [PATCH 12/21] glsl: Make compiler-added padding ir_instruction usable

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


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

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

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

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

diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index bc02f6e..fb10c32 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -95,6 +95,20 @@ private:
    uint8_t ir_type;
 
 public:
+   /**
+    * Alignment padding that would be added by the compiler
+    *
+    * Putting a field here makes what would otherwise be dead space usabled.
+    * Subclasses of ir_instruction can store data here.  Care must be taken
+    * for two reasons:
+    *
+    * 1. Direct descendents in the class hierarchy (e.g., \c ir_dereference
+    *    and \c ir_dereference_array) must not try to use this space.
+    *
+    * 2. The size of the padding depends on the architecture.
+    */
+   uint8_t padding[sizeof(intptr_t) - 1];
+
    inline enum ir_node_type get_ir_type() const
    {
       STATIC_ASSERT(ir_type_max < 256);
-- 
1.8.1.4



More information about the mesa-dev mailing list