[Mesa-dev] [PATCH 23/31] radeonsi: get rid of si_llvm_emit_fs_epilogue

Nicolai Hähnle nhaehnle at gmail.com
Mon Oct 31 22:11:10 UTC 2016


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

It is no longer used.
---
 src/gallium/drivers/radeonsi/si_shader.c | 97 +-------------------------------
 1 file changed, 1 insertion(+), 96 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index f3b94d7..56892de 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -2953,112 +2953,20 @@ static void si_export_null(struct lp_build_tgsi_context *bld_base)
 	args[4] = uint->zero; /* COMPR flag (0 = 32-bit export) */
 	args[5] = base->undef; /* R */
 	args[6] = base->undef; /* G */
 	args[7] = base->undef; /* B */
 	args[8] = base->undef; /* A */
 
 	lp_build_intrinsic(base->gallivm->builder, "llvm.SI.export",
 			   ctx->voidt, args, 9, 0);
 }
 
-static void si_llvm_emit_fs_epilogue(struct lp_build_tgsi_context *bld_base)
-{
-	struct si_shader_context *ctx = si_shader_context(bld_base);
-	struct si_shader *shader = ctx->shader;
-	struct lp_build_context *base = &bld_base->base;
-	struct tgsi_shader_info *info = &shader->selector->info;
-	LLVMBuilderRef builder = base->gallivm->builder;
-	LLVMValueRef depth = NULL, stencil = NULL, samplemask = NULL;
-	int last_color_export = -1;
-	int i;
-	struct si_ps_exports exp = {};
-
-	/* Determine the last export. If MRTZ is present, it's always last.
-	 * Otherwise, find the last color export.
-	 */
-	if (!info->writes_z && !info->writes_stencil && !info->writes_samplemask) {
-		unsigned spi_format = shader->key.ps.epilog.spi_shader_col_format;
-
-		/* Don't export NULL and return if alpha-test is enabled. */
-		if (shader->key.ps.epilog.alpha_func != PIPE_FUNC_ALWAYS &&
-		    shader->key.ps.epilog.alpha_func != PIPE_FUNC_NEVER &&
-		    (spi_format & 0xf) == 0)
-			spi_format |= V_028714_SPI_SHADER_32_AR;
-
-		for (i = 0; i < info->num_outputs; i++) {
-			unsigned index = info->output_semantic_index[i];
-
-			if (info->output_semantic_name[i] != TGSI_SEMANTIC_COLOR)
-				continue;
-
-			/* If last_cbuf > 0, FS_COLOR0_WRITES_ALL_CBUFS is true. */
-			if (shader->key.ps.epilog.last_cbuf > 0) {
-				/* Just set this if any of the colorbuffers are enabled. */
-				if (spi_format &
-				    ((1llu << (4 * (shader->key.ps.epilog.last_cbuf + 1))) - 1))
-					last_color_export = i;
-				continue;
-			}
-
-			if ((spi_format >> (index * 4)) & 0xf)
-				last_color_export = i;
-		}
-
-		/* If there are no outputs, export NULL. */
-		if (last_color_export == -1) {
-			si_export_null(bld_base);
-			return;
-		}
-	}
-
-	for (i = 0; i < info->num_outputs; i++) {
-		unsigned semantic_name = info->output_semantic_name[i];
-		unsigned semantic_index = info->output_semantic_index[i];
-		unsigned j;
-		LLVMValueRef color[4] = {};
-
-		/* Select the correct target */
-		switch (semantic_name) {
-		case TGSI_SEMANTIC_POSITION:
-			depth = LLVMBuildLoad(builder,
-					      ctx->soa.outputs[i][2], "");
-			break;
-		case TGSI_SEMANTIC_STENCIL:
-			stencil = LLVMBuildLoad(builder,
-						ctx->soa.outputs[i][1], "");
-			break;
-		case TGSI_SEMANTIC_SAMPLEMASK:
-			samplemask = LLVMBuildLoad(builder,
-						   ctx->soa.outputs[i][0], "");
-			break;
-		case TGSI_SEMANTIC_COLOR:
-			for (j = 0; j < 4; j++)
-				color[j] = LLVMBuildLoad(builder,
-							 ctx->soa.outputs[i][j], "");
-
-			si_export_mrt_color(bld_base, color, semantic_index,
-					    SI_PARAM_SAMPLE_COVERAGE,
-					    last_color_export == i, &exp);
-			break;
-		default:
-			fprintf(stderr,
-				"Warning: SI unhandled fs output type:%d\n",
-				semantic_name);
-		}
-	}
-
-	if (depth || stencil || samplemask)
-		si_export_mrt_z(bld_base, depth, stencil, samplemask, &exp);
-
-	si_emit_ps_exports(ctx, &exp);
-}
-
 /**
  * Return PS outputs in this order:
  *
  * v[0:3] = color0.xyzw
  * v[4:7] = color1.xyzw
  * ...
  * vN+0 = Depth
  * vN+1 = Stencil
  * vN+2 = SampleMask
  * vN+3 = SampleMaskIn (used for OpenGL smoothing)
@@ -6639,24 +6547,21 @@ static bool si_compile_tgsi_main(struct si_shader_context *ctx,
 			bld_base->emit_epilogue = si_llvm_emit_es_epilogue;
 		else
 			bld_base->emit_epilogue = si_llvm_emit_vs_epilogue;
 		break;
 	case PIPE_SHADER_GEOMETRY:
 		bld_base->emit_fetch_funcs[TGSI_FILE_INPUT] = fetch_input_gs;
 		bld_base->emit_epilogue = si_llvm_emit_gs_epilogue;
 		break;
 	case PIPE_SHADER_FRAGMENT:
 		ctx->load_input = declare_input_fs;
-		if (ctx->no_epilog)
-			bld_base->emit_epilogue = si_llvm_emit_fs_epilogue;
-		else
-			bld_base->emit_epilogue = si_llvm_return_fs_outputs;
+		bld_base->emit_epilogue = si_llvm_return_fs_outputs;
 		break;
 	case PIPE_SHADER_COMPUTE:
 		ctx->declare_memory_region = declare_compute_memory;
 		break;
 	default:
 		assert(!"Unsupported shader type");
 		return false;
 	}
 
 	create_meta_data(ctx);
-- 
2.7.4



More information about the mesa-dev mailing list