summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir.cpp
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2014-07-08 19:03:52 -0700
committerIan Romanick <[email protected]>2014-09-30 13:34:43 -0700
commitc87d09d7f09fe2e734e97e72baabd7c54f7614a9 (patch)
tree3395517ae49f884383155dacf43128dbf2e37b48 /src/glsl/ir.cpp
parenteaa0c7414285ff9d087a961e0d608538b5febba0 (diff)
glsl: Don't allocate a name for ir_var_temporary variables
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,578,719,715 67,762,208 62,263,404 5,498,804 0 After (32-bit): 52 40,565,579,466 66,359,800 61,187,818 5,171,982 0 Before (64-bit): 74 37,129,541,061 95,195,160 87,369,671 7,825,489 0 After (64-bit): 76 37,134,691,404 93,271,352 85,900,223 7,371,129 0 A real savings of 1.0MiB on 32-bit and 1.4MiB on 64-bit. Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Matt Turner <[email protected]>
Diffstat (limited to 'src/glsl/ir.cpp')
-rw-r--r--src/glsl/ir.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/glsl/ir.cpp b/src/glsl/ir.cpp
index 9c58f869dc4..c712c6a7bd9 100644
--- a/src/glsl/ir.cpp
+++ b/src/glsl/ir.cpp
@@ -1543,6 +1543,8 @@ ir_swizzle::variable_referenced() const
}
+bool ir_variable::temporaries_allocate_names = false;
+
const char ir_variable::tmp_name[] = "compiler_temp";
ir_variable::ir_variable(const struct glsl_type *type, const char *name,
@@ -1551,6 +1553,9 @@ ir_variable::ir_variable(const struct glsl_type *type, const char *name,
{
this->type = type;
+ if (mode == ir_var_temporary && !ir_variable::temporaries_allocate_names)
+ name = NULL;
+
/* The ir_variable clone method may call this constructor with name set to
* tmp_name.
*/