Mesa (master): iris: Optimize out redundant sampler state binds

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Sep 9 18:56:34 UTC 2019


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Sat Sep  7 22:30:02 2019 -0700

iris: Optimize out redundant sampler state binds

This cuts roughly 85% of the 3DSTATE_SAMPLER_STATE_POINTERS_PS calls in
the J2DBench images test.  For some reason, the state tracker is calling
bind_sampler_state with the same sampler state in a bunch of cases.

---

 src/gallium/drivers/iris/iris_state.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/iris/iris_state.c b/src/gallium/drivers/iris/iris_state.c
index 315b0133420..a503f38d6ca 100644
--- a/src/gallium/drivers/iris/iris_state.c
+++ b/src/gallium/drivers/iris/iris_state.c
@@ -1606,11 +1606,17 @@ iris_bind_sampler_states(struct pipe_context *ctx,
 
    assert(start + count <= IRIS_MAX_TEXTURE_SAMPLERS);
 
+   bool dirty = false;
+
    for (int i = 0; i < count; i++) {
-      shs->samplers[start + i] = states[i];
+      if (shs->samplers[start + i] != states[i]) {
+         shs->samplers[start + i] = states[i];
+         dirty = true;
+      }
    }
 
-   ice->state.dirty |= IRIS_DIRTY_SAMPLER_STATES_VS << stage;
+   if (dirty)
+      ice->state.dirty |= IRIS_DIRTY_SAMPLER_STATES_VS << stage;
 }
 
 /**




More information about the mesa-commit mailing list