[Mesa-dev] [PATCH 14/21] glsl: Use short names for flattening temporaries
Ian Romanick
idr at freedesktop.org
Tue May 27 19:49:09 PDT 2014
From: Ian Romanick <ian.d.romanick at intel.com>
Reduces the peak ir_variable memory usage in a trimmed apitrace of dota2
by 66KiB on 64-bit.
Before: IR MEM: variable usage / name / total: 5746368 1208630 6954998
After: IR MEM: variable usage / name / total: 5746368 1140817 6887185
Reduces the peak ir_variable memory usage in a trimmed apitrace of dota2
by 42KiB on 32-bit.
Before: IR MEM: variable usage / name / total: 4327584 844096 5171680
After: IR MEM: variable usage / name / total: 4327584 800183 5127767
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/glsl/ir_expression_flattening.cpp | 2 +-
src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp | 16 +++++++++++++---
2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/src/glsl/ir_expression_flattening.cpp b/src/glsl/ir_expression_flattening.cpp
index c1cadb1..4fd4733 100644
--- a/src/glsl/ir_expression_flattening.cpp
+++ b/src/glsl/ir_expression_flattening.cpp
@@ -78,7 +78,7 @@ ir_expression_flattening_visitor::handle_rvalue(ir_rvalue **rvalue)
void *ctx = ralloc_parent(ir);
- var = new(ctx) ir_variable(ir->type, "flattening_tmp", ir_var_temporary);
+ var = new(ctx) ir_variable(ir->type, "$f", ir_var_temporary);
base_ir->insert_before(var);
assign = new(ctx) ir_assignment(new(ctx) ir_dereference_variable(var),
diff --git a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp
index a9125ca..aac515b 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_vector_splitting.cpp
@@ -368,9 +368,19 @@ brw_do_vector_splitting(exec_list *instructions)
entry->mem_ctx = ralloc_parent(entry->var);
for (unsigned int i = 0; i < entry->var->type->vector_elements; i++) {
- const char *name = ralloc_asprintf(mem_ctx, "%s_%c",
- entry->var->name,
- "xyzw"[i]);
+ const char *name;
+ char buf[3];
+
+ if (entry->var->name[0] == '$') {
+ buf[0] = '$';
+ buf[1] = "xyzw"[i];
+ buf[2] = '\0';
+ name = buf;
+ } else {
+ name = ralloc_asprintf(mem_ctx, "%s_%c",
+ entry->var->name,
+ "xyzw"[i]);
+ }
entry->components[i] = new(entry->mem_ctx) ir_variable(type, name,
ir_var_temporary);
--
1.8.1.4
More information about the mesa-dev
mailing list