From 8afe6efa218f87158c35857fad41926b404a2cbd Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Wed, 14 May 2014 18:36:57 -0700 Subject: [PATCH] glsl: Store ir_variable::depth_layout using 3 bits MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit warn_extension_index was moved to improve packing. 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): 73 40,580,476,304 68,488,400 62,796,151 5,692,249 0 After (32-bit): 73 40,575,751,558 68,116,528 62,618,607 5,497,921 0 Before (64-bit): 71 37,124,890,613 95,889,584 88,089,008 7,800,576 0 After (64-bit): 62 37,123,578,526 95,150,784 87,711,304 7,439,480 0 A real savings of 173KiB on 32-bit and 368KiB on 64-bit. v2: Use the enum name with the bit-field and remove the extra casts. Suggested by Ken. Signed-off-by: Ian Romanick Reviewed-by: Kenneth Graunke Reviewed-by: Matt Turner [v1] Reviewed-by: Tapani Pälli [v1] --- src/glsl/ir.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/glsl/ir.h b/src/glsl/ir.h index 67150ce6cd8..d96f44029c9 100644 --- a/src/glsl/ir.h +++ b/src/glsl/ir.h @@ -709,6 +709,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. + */ + ir_depth_layout depth_layout:3; /** * ARB_shader_image_load_store qualifiers. @@ -719,9 +726,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. */ @@ -729,13 +733,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 -- 2.30.2