Mesa (master): radeonsi: Handle TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS

Michel Dänzer daenzer at kemper.freedesktop.org
Thu Feb 14 09:52:58 UTC 2013


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

Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Tue Feb 12 18:37:22 2013 +0100

radeonsi: Handle TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS

8 more little piglits.

NOTE: This is a candidate for the 9.1 branch.

---

 src/gallium/drivers/radeonsi/radeonsi_shader.c |   29 ++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c
index 7e61560..7c57f4c 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c
@@ -615,6 +615,12 @@ static void si_llvm_emit_epilogue(struct lp_build_tgsi_context * bld_base)
 		int i;
 
 		tgsi_parse_token(parse);
+
+		if (parse->FullToken.Token.Type == TGSI_TOKEN_TYPE_PROPERTY &&
+		    parse->FullToken.FullProperty.Property.PropertyName ==
+		    TGSI_PROPERTY_FS_COLOR0_WRITES_ALL_CBUFS)
+			shader->fs_write_all = TRUE;
+
 		if (parse->FullToken.Token.Type != TGSI_TOKEN_TYPE_DECLARATION)
 			continue;
 
@@ -778,6 +784,29 @@ static void si_llvm_emit_epilogue(struct lp_build_tgsi_context * bld_base)
 	last_args[1] = lp_build_const_int32(base->gallivm,
 					    si_shader_ctx->type == TGSI_PROCESSOR_FRAGMENT);
 
+	if (shader->fs_write_all && shader->nr_cbufs > 1) {
+		int i;
+
+		/* Specify that this is not yet the last export */
+		last_args[2] = lp_build_const_int32(base->gallivm, 0);
+
+		for (i = 1; i < shader->nr_cbufs; i++) {
+			/* Specify the target we are exporting */
+			last_args[3] = lp_build_const_int32(base->gallivm,
+							    V_008DFC_SQ_EXP_MRT + i);
+
+			lp_build_intrinsic(base->gallivm->builder,
+					   "llvm.SI.export",
+					   LLVMVoidTypeInContext(base->gallivm->context),
+					   last_args, 9);
+
+			si_shader_ctx->shader->spi_shader_col_format |=
+				si_shader_ctx->shader->spi_shader_col_format << 4;
+		}
+
+		last_args[3] = lp_build_const_int32(base->gallivm, V_008DFC_SQ_EXP_MRT);
+	}
+
 	/* Specify that this is the last export */
 	last_args[2] = lp_build_const_int32(base->gallivm, 1);
 




More information about the mesa-commit mailing list