[Mesa-dev] [PATCH 6/8] radeon/llvm: add support for non-scalar system values

Marek Olšák maraeo at gmail.com
Wed May 7 06:53:42 PDT 2014


From: Marek Olšák <marek.olsak at amd.com>

The sample position is one of them.
---
 src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
index 60ade78..f8be0df 100644
--- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
+++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
@@ -218,7 +218,13 @@ static LLVMValueRef fetch_system_value(
 	unsigned swizzle)
 {
 	struct radeon_llvm_context * ctx = radeon_llvm_context(bld_base);
+	struct gallivm_state *gallivm = bld_base->base.gallivm;
+
 	LLVMValueRef cval = ctx->system_values[reg->Register.Index];
+	if (LLVMGetTypeKind(LLVMTypeOf(cval)) == LLVMVectorTypeKind) {
+		cval = LLVMBuildExtractElement(gallivm->builder, cval,
+					       lp_build_const_int32(gallivm, swizzle), "");
+	}
 	return bitcast(bld_base, type, cval);
 }
 
-- 
1.9.1



More information about the mesa-dev mailing list