Mesa (master): r600g: skip repeating vs, gs, and tes shader binds

Marek Olšák mareko at kemper.freedesktop.org
Mon Apr 10 20:48:12 UTC 2017


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

Author: Constantine Kharlamov <Hi-Angel at yandex.ru>
Date:   Mon Apr 10 23:04:35 2017 +0300

r600g: skip repeating vs, gs, and tes shader binds

The idea is taken from radeonsi. The code lacks some checks for null vs,
and I'm unsure about some changes against that, so I left it in place.

Some statistics for GTAⅣ:
Average tesselation bind skip per frame: ≈350
Average geometric shaders bind skip per frame: ≈260
Skip of binding vertex ones occurs rarely enough to not get into per-frame
counter at all, so I just gonna say: it happens.

v2: I've occasionally removed an empty line, don't do this.
v3: return a check for null tes and gs back, while I haven't figured out
the way to move stride assignment to r600_update_derived_state() (as it
is in radeonsi).

Signed-off-by: Constantine Kharlamov <Hi-Angel at yandex.ru>
Signed-off-by: Marek Olšák <marek.olsak at amd.com>

---

 src/gallium/drivers/r600/r600_state_common.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/r600/r600_state_common.c b/src/gallium/drivers/r600/r600_state_common.c
index 4de2a7344b..922030a1ed 100644
--- a/src/gallium/drivers/r600/r600_state_common.c
+++ b/src/gallium/drivers/r600/r600_state_common.c
@@ -931,7 +931,7 @@ static void r600_bind_vs_state(struct pipe_context *ctx, void *state)
 {
 	struct r600_context *rctx = (struct r600_context *)ctx;
 
-	if (!state)
+	if (!state || rctx->vs_shader == state)
 		return;
 
 	rctx->vs_shader = (struct r600_pipe_shader_selector *)state;
@@ -943,6 +943,9 @@ static void r600_bind_gs_state(struct pipe_context *ctx, void *state)
 {
 	struct r600_context *rctx = (struct r600_context *)ctx;
 
+	if (state == rctx->gs_shader)
+		return;
+
 	rctx->gs_shader = (struct r600_pipe_shader_selector *)state;
 	r600_update_vs_writes_viewport_index(&rctx->b, r600_get_vs_info(rctx));
 
@@ -962,6 +965,9 @@ static void r600_bind_tes_state(struct pipe_context *ctx, void *state)
 {
 	struct r600_context *rctx = (struct r600_context *)ctx;
 
+	if (state == rctx->tes_shader)
+		return;
+
 	rctx->tes_shader = (struct r600_pipe_shader_selector *)state;
 	r600_update_vs_writes_viewport_index(&rctx->b, r600_get_vs_info(rctx));
 




More information about the mesa-commit mailing list