Mesa (master): glsl: Use a single bit for the dual-source blend index

Kenneth Graunke kwg at kemper.freedesktop.org
Sat Aug 30 06:38:24 UTC 2014


Module: Mesa
Branch: master
Commit: 8eeca7a56cf1ef47b6f86cc5a0397a532a7c2932
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8eeca7a56cf1ef47b6f86cc5a0397a532a7c2932

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Mon Jul 14 15:48:37 2014 -0700

glsl: Use a single bit for the dual-source blend index

The only values allowed are 0 and 1, and the value is checked before
assigning.

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): 74 40,580,119,657       69,186,544       63,506,327     5,680,217            0
After  (32-bit): 76 40,572,916,873       68,831,248       63,328,783     5,502,465            0

Before (64-bit): 89 36,822,971,897       96,526,616       88,735,296     7,791,320            0
After  (64-bit): 60 36,822,640,058       96,526,824       88,735,296     7,791,528            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>
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/glsl/ir.h |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/glsl/ir.h b/src/glsl/ir.h
index 535693d..5032c26 100644
--- a/src/glsl/ir.h
+++ b/src/glsl/ir.h
@@ -689,6 +689,15 @@ public:
       unsigned must_be_shader_input:1;
 
       /**
+       * Output index for dual source blending.
+       *
+       * \note
+       * The GLSL spec only allows the values 0 or 1 for the index in \b dual
+       * source blending.
+       */
+      unsigned index:1;
+
+      /**
        * \brief Layout qualifier for gl_FragDepth.
        *
        * This is not equal to \c ir_depth_layout_none if and only if this
@@ -722,11 +731,6 @@ public:
       unsigned stream;
 
       /**
-       * output index for dual source blending.
-       */
-      int index;
-
-      /**
        * Initial binding point for a sampler, atomic, or UBO.
        *
        * For array types, this represents the binding point for the first element.




More information about the mesa-commit mailing list