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

Author: Eric Anholt <[email protected]>
Date:   Fri Jul 20 13:31:49 2018 -0700

v3d: Skip emitting texture config parameter 2 if it's just the defaults.

shader-db:
total instructions in shared programs: 91275 -> 90768 (-0.56%)
instructions in affected programs:     20702 -> 20195 (-2.45%)

---

 src/broadcom/compiler/v3d40_tex.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/broadcom/compiler/v3d40_tex.c 
b/src/broadcom/compiler/v3d40_tex.c
index 00e52998e9..9f1fd9a0d2 100644
--- a/src/broadcom/compiler/v3d40_tex.c
+++ b/src/broadcom/compiler/v3d40_tex.c
@@ -53,6 +53,9 @@ v3d40_vir_emit_tex(struct v3d_compile *c, nir_tex_instr 
*instr)
 {
         unsigned unit = instr->texture_index;
         int tmu_writes = 0;
+        static const struct V3D41_TMU_CONFIG_PARAMETER_2 p2_unpacked_default = 
{
+                .op = V3D_TMU_OP_REGULAR,
+        };
 
         struct V3D41_TMU_CONFIG_PARAMETER_0 p0_unpacked = {
         };
@@ -185,7 +188,8 @@ v3d40_vir_emit_tex(struct v3d_compile *c, nir_tex_instr 
*instr)
 
         vir_WRTMUC(c, QUNIFORM_TMU_CONFIG_P0, p0_packed);
         vir_WRTMUC(c, QUNIFORM_TMU_CONFIG_P1, p1_packed);
-        vir_WRTMUC(c, QUNIFORM_CONSTANT, p2_packed);
+        if (memcmp(&p2_unpacked, &p2_unpacked_default, sizeof(p2_unpacked)) != 
0)
+                vir_WRTMUC(c, QUNIFORM_CONSTANT, p2_packed);
 
         if (instr->op == nir_texop_txf) {
                 assert(instr->sampler_dim != GLSL_SAMPLER_DIM_CUBE);

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to