summaryrefslogtreecommitdiffstats
path: root/src/glsl/ir_optimization.h
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2013-10-17 10:28:40 -0700
committerEric Anholt <eric@anholt.net>2013-11-01 10:25:33 -0700
commitfd05ede0d05ee896cf07e2f690ddb42567f9f606 (patch)
treec6af3f15dfb1c1172c9d26d645cb88ef7b488b21 /src/glsl/ir_optimization.h
parent3641b97bdce558d980799b00422c6aee7d472cf5 (diff)
downloadexternal_mesa3d-fd05ede0d05ee896cf07e2f690ddb42567f9f606.zip
external_mesa3d-fd05ede0d05ee896cf07e2f690ddb42567f9f606.tar.gz
external_mesa3d-fd05ede0d05ee896cf07e2f690ddb42567f9f606.tar.bz2
glsl: Add a CSE pass.
This only operates on constant/uniform values for now, because otherwise I'd have to deal with killing my available CSE entries when assignments happen, and getting even this working in the tree ir was painful enough. As is, it has the following effect in shader-db: total instructions in shared programs: 1524077 -> 1521964 (-0.14%) instructions in affected programs: 50629 -> 48516 (-4.17%) GAINED: 0 LOST: 0 And, for tropics, that accounts for most of the effect, the FPS improvement is 11.67% +/- 0.72% (n=3). v2: Use read_only field of the variable, manually check the lod_info union members, use get_num_operands(), rename cse_operands_visitor to is_cse_candidate_visitor, move all is-a-candidate logic to that function, and call it before checking for CSE on a given rvalue, more comments, use private keyword. Reviewed-by: Paul Berry <stereotype441@gmail.com>
Diffstat (limited to 'src/glsl/ir_optimization.h')
-rw-r--r--src/glsl/ir_optimization.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/glsl/ir_optimization.h b/src/glsl/ir_optimization.h
index 074686c..3ca9f57 100644
--- a/src/glsl/ir_optimization.h
+++ b/src/glsl/ir_optimization.h
@@ -77,6 +77,7 @@ bool do_constant_variable_unlinked(exec_list *instructions);
bool do_copy_propagation(exec_list *instructions);
bool do_copy_propagation_elements(exec_list *instructions);
bool do_constant_propagation(exec_list *instructions);
+bool do_cse(exec_list *instructions);
void do_dead_builtin_varyings(struct gl_context *ctx,
gl_shader *producer, gl_shader *consumer,
unsigned num_tfeedback_decls,