Mesa (master): ac: add ac_build_export_null() helper

Samuel Pitoiset hakzsam at kemper.freedesktop.org
Thu Feb 8 21:15:58 UTC 2018


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

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Wed Feb  7 19:09:12 2018 +0100

ac: add ac_build_export_null() helper

Imported from RadeonSI.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/amd/common/ac_llvm_build.c           | 17 +++++++++++++++++
 src/amd/common/ac_llvm_build.h           |  2 ++
 src/gallium/drivers/radeonsi/si_shader.c | 21 +--------------------
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c
index a86ba962fa..e88456274f 100644
--- a/src/amd/common/ac_llvm_build.c
+++ b/src/amd/common/ac_llvm_build.c
@@ -1347,6 +1347,23 @@ void ac_build_export(struct ac_llvm_context *ctx, struct ac_export_args *a)
 			   AC_FUNC_ATTR_LEGACY);
 }
 
+void ac_build_export_null(struct ac_llvm_context *ctx)
+{
+	struct ac_export_args args;
+
+	args.enabled_channels = 0x0; /* enabled channels */
+	args.valid_mask = 1; /* whether the EXEC mask is valid */
+	args.done = 1; /* DONE bit */
+	args.target = V_008DFC_SQ_EXP_NULL;
+	args.compr = 0; /* COMPR flag (0 = 32-bit export) */
+	args.out[0] = LLVMGetUndef(ctx->f32); /* R */
+	args.out[1] = LLVMGetUndef(ctx->f32); /* G */
+	args.out[2] = LLVMGetUndef(ctx->f32); /* B */
+	args.out[3] = LLVMGetUndef(ctx->f32); /* A */
+
+	ac_build_export(ctx, &args);
+}
+
 LLVMValueRef ac_build_image_opcode(struct ac_llvm_context *ctx,
 				   struct ac_image_args *a)
 {
diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h
index 47c843fb4b..7e53115dc8 100644
--- a/src/amd/common/ac_llvm_build.h
+++ b/src/amd/common/ac_llvm_build.h
@@ -279,6 +279,8 @@ struct ac_export_args {
 
 void ac_build_export(struct ac_llvm_context *ctx, struct ac_export_args *a);
 
+void ac_build_export_null(struct ac_llvm_context *ctx);
+
 enum ac_image_opcode {
 	ac_image_sample,
 	ac_image_gather4,
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index f7413a2d6f..4ff00db55f 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -3725,25 +3725,6 @@ static void si_emit_ps_exports(struct si_shader_context *ctx,
 		ac_build_export(&ctx->ac, &exp->args[i]);
 }
 
-static void si_export_null(struct lp_build_tgsi_context *bld_base)
-{
-	struct si_shader_context *ctx = si_shader_context(bld_base);
-	struct lp_build_context *base = &bld_base->base;
-	struct ac_export_args args;
-
-	args.enabled_channels = 0x0; /* enabled channels */
-	args.valid_mask = 1; /* whether the EXEC mask is valid */
-	args.done = 1; /* DONE bit */
-	args.target = V_008DFC_SQ_EXP_NULL;
-	args.compr = 0; /* COMPR flag (0 = 32-bit export) */
-	args.out[0] = base->undef; /* R */
-	args.out[1] = base->undef; /* G */
-	args.out[2] = base->undef; /* B */
-	args.out[3] = base->undef; /* A */
-
-	ac_build_export(&ctx->ac, &args);
-}
-
 /**
  * Return PS outputs in this order:
  *
@@ -7735,7 +7716,7 @@ static void si_build_ps_epilog_function(struct si_shader_context *ctx,
 	if (depth || stencil || samplemask)
 		si_export_mrt_z(bld_base, depth, stencil, samplemask, &exp);
 	else if (last_color_export == -1)
-		si_export_null(bld_base);
+		ac_build_export_null(&ctx->ac);
 
 	if (exp.num)
 		si_emit_ps_exports(ctx, &exp);




More information about the mesa-commit mailing list