Mesa (master): radeonsi: Pass shader type to the compiler

Tom Stellard tstellar at kemper.freedesktop.org
Tue Sep 11 19:57:51 UTC 2012


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

Author: Tom Stellard <thomas.stellard at amd.com>
Date:   Fri Sep  7 09:12:51 2012 -0400

radeonsi: Pass shader type to the compiler

Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>

---

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

diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c
index 9fc3446..0994fac 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c
@@ -476,6 +476,17 @@ static void si_llvm_init_export_args(struct lp_build_tgsi_context *bld_base,
 	 * stage. */
 }
 
+static void si_llvm_emit_prologue(struct lp_build_tgsi_context *bld_base)
+{
+	struct si_shader_context *si_shader_ctx = si_shader_context(bld_base);
+	struct gallivm_state *gallivm = bld_base->base.gallivm;
+	lp_build_intrinsic_unary(gallivm->builder,
+			"llvm.AMDGPU.shader.type",
+			LLVMVoidTypeInContext(gallivm->context),
+			lp_build_const_int32(gallivm, si_shader_ctx->type));
+}
+
+
 /* XXX: This is partially implemented for VS only at this point.  It is not complete */
 static void si_llvm_emit_epilogue(struct lp_build_tgsi_context * bld_base)
 {
@@ -705,6 +716,7 @@ int si_pipe_shader_create(
 	tgsi_scan_shader(sel->tokens, &shader_info);
 	bld_base->info = &shader_info;
 	bld_base->emit_fetch_funcs[TGSI_FILE_CONSTANT] = fetch_constant;
+	bld_base->emit_prologue = si_llvm_emit_prologue;
 	bld_base->emit_epilogue = si_llvm_emit_epilogue;
 
 	bld_base->op_actions[TGSI_OPCODE_TEX] = tex_action;




More information about the mesa-commit mailing list