diff options
author | marha <marha@users.sourceforge.net> | 2014-09-08 23:30:36 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2014-09-08 23:30:36 +0200 |
commit | e16399e57caac9e859a7d28921c73ef9839b571e (patch) | |
tree | b86ed43f749ebfe0bb3842fcd76a34e386011fcc /mesalib/src/glsl/opt_copy_propagation_elements.cpp | |
parent | 166caebfaa2b217332a345ffb02c5b9e52f65a3d (diff) | |
parent | cb346e228aeb500cd61ec86644c034c238332d3b (diff) | |
download | vcxsrv-e16399e57caac9e859a7d28921c73ef9839b571e.tar.gz vcxsrv-e16399e57caac9e859a7d28921c73ef9839b571e.tar.bz2 vcxsrv-e16399e57caac9e859a7d28921c73ef9839b571e.zip |
Merge remote-tracking branch 'origin/released'
Diffstat (limited to 'mesalib/src/glsl/opt_copy_propagation_elements.cpp')
-rw-r--r-- | mesalib/src/glsl/opt_copy_propagation_elements.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/mesalib/src/glsl/opt_copy_propagation_elements.cpp b/mesalib/src/glsl/opt_copy_propagation_elements.cpp index f5f59b7d3..c3e55bcd1 100644 --- a/mesalib/src/glsl/opt_copy_propagation_elements.cpp +++ b/mesalib/src/glsl/opt_copy_propagation_elements.cpp @@ -207,8 +207,9 @@ ir_copy_propagation_elements_visitor::handle_rvalue(ir_rvalue **ir) int swizzle_chan[4]; ir_dereference_variable *deref_var; ir_variable *source[4] = {NULL, NULL, NULL, NULL}; - int source_chan[4]; + int source_chan[4] = {0, 0, 0, 0}; int chans; + bool noop_swizzle = true; if (!*ir) return; @@ -250,6 +251,9 @@ ir_copy_propagation_elements_visitor::handle_rvalue(ir_rvalue **ir) if (entry->write_mask & (1 << swizzle_chan[c])) { source[c] = entry->rhs; source_chan[c] = entry->swizzle[swizzle_chan[c]]; + + if (source_chan[c] != swizzle_chan[c]) + noop_swizzle = false; } } } @@ -266,6 +270,12 @@ ir_copy_propagation_elements_visitor::handle_rvalue(ir_rvalue **ir) if (!shader_mem_ctx) shader_mem_ctx = ralloc_parent(deref_var); + /* Don't pointlessly replace the rvalue with itself (or a noop swizzle + * of itself, which would just be deleted by opt_noop_swizzle). + */ + if (source[0] == var && noop_swizzle) + return; + if (debug) { printf("Copy propagation from:\n"); (*ir)->print(); @@ -278,6 +288,7 @@ ir_copy_propagation_elements_visitor::handle_rvalue(ir_rvalue **ir) source_chan[2], source_chan[3], chans); + progress = true; if (debug) { printf("to:\n"); |