[Mesa-dev] [PATCH 1/4] radeon/llvm: move system value fetching to common code

Christian König deathsimple at vodafone.de
Wed Mar 27 08:35:52 PDT 2013


From: Christian König <christian.koenig at amd.com>

This should be used by both SI and R600.

Signed-off-by: Christian König <christian.koenig at amd.com>
Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>
Tested-by: Michel Dänzer <michel.daenzer at amd.com>
---
 src/gallium/drivers/r600/r600_llvm.c               |   12 ------------
 .../drivers/radeon/radeon_setup_tgsi_llvm.c        |   12 ++++++++++++
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c
index 6e6edb7..81a60c2 100644
--- a/src/gallium/drivers/r600/r600_llvm.c
+++ b/src/gallium/drivers/r600/r600_llvm.c
@@ -72,17 +72,6 @@ static void llvm_load_system_value(
 			LLVMReadNoneAttribute);
 }
 
-static LLVMValueRef llvm_fetch_system_value(
-		struct lp_build_tgsi_context * bld_base,
-		const struct tgsi_full_src_register *reg,
-		enum tgsi_opcode_type type,
-		unsigned swizzle)
-{
-	struct radeon_llvm_context * ctx = radeon_llvm_context(bld_base);
-	LLVMValueRef cval = ctx->system_values[reg->Register.Index];
-	return bitcast(bld_base, type, cval);
-}
-
 static LLVMValueRef
 llvm_load_input_helper(
 	struct radeon_llvm_context * ctx,
@@ -529,7 +518,6 @@ LLVMModuleRef r600_tgsi_llvm(
 	bld_base->info = &shader_info;
 	bld_base->userdata = ctx;
 	bld_base->emit_fetch_funcs[TGSI_FILE_CONSTANT] = llvm_fetch_const;
-	bld_base->emit_fetch_funcs[TGSI_FILE_SYSTEM_VALUE] = llvm_fetch_system_value;
 	bld_base->emit_prologue = llvm_emit_prologue;
 	bld_base->emit_epilogue = llvm_emit_epilogue;
 	ctx->userdata = ctx;
diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
index e2a6bee..314c963 100644
--- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
+++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
@@ -200,6 +200,17 @@ emit_fetch(
 	return bitcast(bld_base, type, result);
 }
 
+static LLVMValueRef fetch_system_value(
+	struct lp_build_tgsi_context * bld_base,
+	const struct tgsi_full_src_register *reg,
+	enum tgsi_opcode_type type,
+	unsigned swizzle)
+{
+	struct radeon_llvm_context * ctx = radeon_llvm_context(bld_base);
+	LLVMValueRef cval = ctx->system_values[reg->Register.Index];
+	return bitcast(bld_base, type, cval);
+}
+
 static void emit_declaration(
 	struct lp_build_tgsi_context * bld_base,
 	const struct tgsi_full_declaration *decl)
@@ -1153,6 +1164,7 @@ void radeon_llvm_context_init(struct radeon_llvm_context * ctx)
 	bld_base->emit_fetch_funcs[TGSI_FILE_INPUT] = emit_fetch;
 	bld_base->emit_fetch_funcs[TGSI_FILE_TEMPORARY] = emit_fetch;
 	bld_base->emit_fetch_funcs[TGSI_FILE_OUTPUT] = emit_fetch;
+	bld_base->emit_fetch_funcs[TGSI_FILE_SYSTEM_VALUE] = fetch_system_value;
 
 	/* Allocate outputs */
 	ctx->soa.outputs = ctx->outputs;
-- 
1.7.9.5



More information about the mesa-dev mailing list