Mesa (master): i965/fs: Perform CSE on texture operations.

Matt Turner mattst88 at kemper.freedesktop.org
Tue Jun 17 17:07:19 UTC 2014


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

Author: Matt Turner <mattst88 at gmail.com>
Date:   Fri Apr 11 12:26:25 2014 -0700

i965/fs: Perform CSE on texture operations.

Helps Unigine Tropics and some (old) gstreamer shaders in shader-db.

instructions in affected programs:     792 -> 744 (-6.06%)

Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/dri/i965/brw_fs_cse.cpp |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
index a319307..7828c27 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_cse.cpp
@@ -103,7 +103,7 @@ is_expression(const fs_inst *const inst)
    case SHADER_OPCODE_LOAD_PAYLOAD:
       return !is_copy_payload(inst);
    default:
-      return false;
+      return inst->is_tex();
    }
 }
 
@@ -153,6 +153,15 @@ instructions_match(fs_inst *a, fs_inst *b)
           a->conditional_mod == b->conditional_mod &&
           a->dst.type == b->dst.type &&
           a->sources == b->sources &&
+          (a->is_tex() ? (a->texture_offset == b->texture_offset &&
+                          a->mlen == b->mlen &&
+                          a->regs_written == b->regs_written &&
+                          a->base_mrf == b->base_mrf &&
+                          a->sampler == b->sampler &&
+                          a->eot == b->eot &&
+                          a->header_present == b->header_present &&
+                          a->shadow_compare == b->shadow_compare)
+                       : true) &&
           operands_match(a, b);
 }
 




More information about the mesa-commit mailing list