[Mesa-dev] [PATCH 23/26] glsl: Make compiler-added padding ir_instruction usable

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


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

No change Valgrind massif results for a trimmed apitrace of dota2.

v2: Fix a couple spelling errors in the comment.

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 5c565ff..ead0863 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -91,6 +91,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 usable.
+    * Subclasses of ir_instruction can store data here.  Care must be taken
+    * for two reasons:
+    *
+    * 1. Direct descendants 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