Mesa (master): freedreno: Drop custom driver lowering of two-sided color.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Feb 24 22:06:17 UTC 2021


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

Author: Eric Anholt <eric at anholt.net>
Date:   Wed Feb 10 10:22:22 2021 -0800

freedreno: Drop custom driver lowering of two-sided color.

The GL frontend can do it for us now, so just use their code instead of
our own shader variants.  In the past we had to do hide the GL shader
variants in the driver to get precompiles from st, but no longer as of
!8601.

I tested with drawoverhead -test 6 (shader program change, n=30) and -test
1 (no statechanges, n=43) and saw no change in driver overhead.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8997>

---

 src/freedreno/ir3/ir3_nir.c                      | 4 ----
 src/freedreno/ir3/ir3_shader.c                   | 1 -
 src/freedreno/ir3/ir3_shader.h                   | 4 ----
 src/gallium/drivers/freedreno/a3xx/fd3_draw.c    | 1 -
 src/gallium/drivers/freedreno/a4xx/fd4_draw.c    | 1 -
 src/gallium/drivers/freedreno/a5xx/fd5_draw.c    | 1 -
 src/gallium/drivers/freedreno/a6xx/fd6_draw.c    | 1 -
 src/gallium/drivers/freedreno/freedreno_screen.c | 2 ++
 8 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/src/freedreno/ir3/ir3_nir.c b/src/freedreno/ir3/ir3_nir.c
index 35bcad20412..87e7df8176a 100644
--- a/src/freedreno/ir3/ir3_nir.c
+++ b/src/freedreno/ir3/ir3_nir.c
@@ -482,10 +482,6 @@ ir3_nir_lower_variant(struct ir3_shader_variant *so, nir_shader *s)
 		if (layer_zero || view_zero)
 			progress |= OPT(s, ir3_nir_lower_view_layer_id, layer_zero, view_zero);
 	}
-	if (so->key.color_two_side) {
-		OPT_V(s, nir_lower_two_sided_color, true);
-		progress = true;
-	}
 
 	struct nir_lower_tex_options tex_options = { };
 
diff --git a/src/freedreno/ir3/ir3_shader.c b/src/freedreno/ir3/ir3_shader.c
index 68ee2b9c429..17f6f684d95 100644
--- a/src/freedreno/ir3/ir3_shader.c
+++ b/src/freedreno/ir3/ir3_shader.c
@@ -436,7 +436,6 @@ ir3_setup_used_key(struct ir3_shader *shader)
 
 		if (info->inputs_read & VARYING_BITS_COLOR) {
 			key->rasterflat = true;
-			key->color_two_side = true;
 		}
 
 		if (info->inputs_read & VARYING_BIT_LAYER) {
diff --git a/src/freedreno/ir3/ir3_shader.h b/src/freedreno/ir3/ir3_shader.h
index 5d2aaab1550..ac95ea51c7e 100644
--- a/src/freedreno/ir3/ir3_shader.h
+++ b/src/freedreno/ir3/ir3_shader.h
@@ -297,7 +297,6 @@ struct ir3_shader_key {
 			 */
 			unsigned sample_shading : 1;
 			unsigned msaa           : 1;
-			unsigned color_two_side : 1;
 			/* used when shader needs to handle flat varyings (a4xx)
 			 * for front/back color inputs to frag shader:
 			 */
@@ -389,9 +388,6 @@ ir3_shader_key_changes_fs(struct ir3_shader_key *key, struct ir3_shader_key *las
 	if (last_key->fclamp_color != key->fclamp_color)
 		return true;
 
-	if (last_key->color_two_side != key->color_two_side)
-		return true;
-
 	if (last_key->rasterflat != key->rasterflat)
 		return true;
 
diff --git a/src/gallium/drivers/freedreno/a3xx/fd3_draw.c b/src/gallium/drivers/freedreno/a3xx/fd3_draw.c
index 1b5e84be646..4bfdd5d07ab 100644
--- a/src/gallium/drivers/freedreno/a3xx/fd3_draw.c
+++ b/src/gallium/drivers/freedreno/a3xx/fd3_draw.c
@@ -130,7 +130,6 @@ fd3_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info,
 		.indirect = indirect,
 		.draw = draw,
 		.key = {
-			.color_two_side = ctx->rasterizer->light_twoside,
 			.vclamp_color = ctx->rasterizer->clamp_vertex_color,
 			.fclamp_color = ctx->rasterizer->clamp_fragment_color,
 			.has_per_samp = (fd3_ctx->fsaturate || fd3_ctx->vsaturate),
diff --git a/src/gallium/drivers/freedreno/a4xx/fd4_draw.c b/src/gallium/drivers/freedreno/a4xx/fd4_draw.c
index 44961e4b86f..051df9aca9b 100644
--- a/src/gallium/drivers/freedreno/a4xx/fd4_draw.c
+++ b/src/gallium/drivers/freedreno/a4xx/fd4_draw.c
@@ -114,7 +114,6 @@ fd4_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info,
 		.indirect = indirect,
 		.draw = draw,
 		.key = {
-			.color_two_side = ctx->rasterizer->light_twoside,
 			.vclamp_color = ctx->rasterizer->clamp_vertex_color,
 			.fclamp_color = ctx->rasterizer->clamp_fragment_color,
 			.rasterflat = ctx->rasterizer->flatshade,
diff --git a/src/gallium/drivers/freedreno/a5xx/fd5_draw.c b/src/gallium/drivers/freedreno/a5xx/fd5_draw.c
index ca023677881..be1f3ba3db1 100644
--- a/src/gallium/drivers/freedreno/a5xx/fd5_draw.c
+++ b/src/gallium/drivers/freedreno/a5xx/fd5_draw.c
@@ -109,7 +109,6 @@ fd5_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info,
 		.indirect = indirect,
 		.draw = draw,
 		.key = {
-			.color_two_side = ctx->rasterizer->light_twoside,
 			.vclamp_color = ctx->rasterizer->clamp_vertex_color,
 			.fclamp_color = ctx->rasterizer->clamp_fragment_color,
 			.rasterflat = ctx->rasterizer->flatshade,
diff --git a/src/gallium/drivers/freedreno/a6xx/fd6_draw.c b/src/gallium/drivers/freedreno/a6xx/fd6_draw.c
index 5d94a6f7711..b6009faa78e 100644
--- a/src/gallium/drivers/freedreno/a6xx/fd6_draw.c
+++ b/src/gallium/drivers/freedreno/a6xx/fd6_draw.c
@@ -186,7 +186,6 @@ fd6_draw_vbo(struct fd_context *ctx, const struct pipe_draw_info *info,
 			.gs = ctx->prog.gs,
 			.fs = ctx->prog.fs,
 			.key = {
-				.color_two_side = ctx->rasterizer->light_twoside,
 				.vclamp_color = ctx->rasterizer->clamp_vertex_color,
 				.fclamp_color = ctx->rasterizer->clamp_fragment_color,
 				.rasterflat = ctx->rasterizer->flatshade,
diff --git a/src/gallium/drivers/freedreno/freedreno_screen.c b/src/gallium/drivers/freedreno/freedreno_screen.c
index fb442996469..23a6dbaa11c 100644
--- a/src/gallium/drivers/freedreno/freedreno_screen.c
+++ b/src/gallium/drivers/freedreno/freedreno_screen.c
@@ -475,6 +475,8 @@ fd_screen_get_param(struct pipe_screen *pscreen, enum pipe_cap param)
 		return is_a6xx(screen);
 	case PIPE_CAP_SHADER_STENCIL_EXPORT:
 		return is_a6xx(screen);
+	case PIPE_CAP_TWO_SIDED_COLOR:
+		return 0;
 	default:
 		return u_pipe_screen_get_param_defaults(pscreen, param);
 	}



More information about the mesa-commit mailing list