Mesa (master): r600/shader: only read back the necessary tess factor components.

Dave Airlie airlied at kemper.freedesktop.org
Wed Jan 10 00:54:48 UTC 2018


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Fri Dec 29 03:14:21 2017 +0000

r600/shader: only read back the necessary tess factor components.

This just reduces the lds reads for the the tess factor emission.

Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/gallium/drivers/r600/r600_shader.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index e28882b2e5..f6ff2055ee 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -2851,7 +2851,7 @@ static int r600_store_tcs_output(struct r600_shader_ctx *ctx)
 }
 
 static int r600_tess_factor_read(struct r600_shader_ctx *ctx,
-				 int output_idx)
+				 int output_idx, int nc)
 {
 	int param;
 	unsigned temp_reg = r600_get_temp(ctx);
@@ -2871,7 +2871,7 @@ static int r600_tess_factor_read(struct r600_shader_ctx *ctx,
 	if (r)
 		return r;
 
-	do_lds_fetch_values(ctx, temp_reg, dreg, 0xf);
+	do_lds_fetch_values(ctx, temp_reg, dreg, ((1u << nc) - 1));
 	return 0;
 }
 
@@ -2941,13 +2941,13 @@ static int r600_emit_tess_factor(struct r600_shader_ctx *ctx)
 		return -1;
 
 	if (tessouter_idx != -1) {
-		r = r600_tess_factor_read(ctx, tessouter_idx);
+		r = r600_tess_factor_read(ctx, tessouter_idx, outer_comps);
 		if (r)
 			return r;
 	}
 
 	if (tessinner_idx != -1) {
-		r = r600_tess_factor_read(ctx, tessinner_idx);
+		r = r600_tess_factor_read(ctx, tessinner_idx, inner_comps);
 		if (r)
 			return r;
 	}




More information about the mesa-commit mailing list