aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r600/r600_llvm.c
diff options
context:
space:
mode:
authorVincent Lejeune <[email protected]>2012-09-23 19:46:53 +0200
committerVincent Lejeune <[email protected]>2012-10-09 23:19:09 +0200
commit11e08f42e4fa5f1d296429415be6da7c03f105b0 (patch)
treee0aebf47d328e826bbfda65d0a60c6b1ad541e59 /src/gallium/drivers/r600/r600_llvm.c
parent80663cb1859c3398804d720022eebcf9a0df1716 (diff)
r600g: use a select to handle front/back color in llvm
Reviewed-by: Tom Stellard <[email protected]>
Diffstat (limited to 'src/gallium/drivers/r600/r600_llvm.c')
-rw-r--r--src/gallium/drivers/r600/r600_llvm.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c
index 71ea5781220..c6e60afaba3 100644
--- a/src/gallium/drivers/r600/r600_llvm.c
+++ b/src/gallium/drivers/r600/r600_llvm.c
@@ -86,6 +86,42 @@ static void llvm_load_input(
"llvm.R600.load.input",
ctx->soa.bld_base.base.elem_type, &reg, 1,
LLVMReadNoneAttribute);
+
+ if (decl->Semantic.Name == TGSI_SEMANTIC_COLOR && ctx->two_side) {
+ unsigned back_reg = ctx->r600_inputs[input_index]
+ .potential_back_facing_reg;
+ unsigned back_soa_index = radeon_llvm_reg_index_soa(
+ ctx->r600_inputs[back_reg].gpr
+ , chan);
+ LLVMValueRef backcolor_reg = lp_build_const_int32(
+ ctx->soa.bld_base.base.gallivm,
+ back_soa_index);
+ LLVMValueRef backcolor = build_intrinsic(
+ ctx->soa.bld_base.base.gallivm->builder,
+ "llvm.R600.load.input",
+ ctx->soa.bld_base.base.elem_type, &backcolor_reg, 1,
+ LLVMReadNoneAttribute);
+ LLVMValueRef face_reg = lp_build_const_int32(
+ ctx->soa.bld_base.base.gallivm,
+ ctx->face_input * 4);
+ LLVMValueRef face = build_intrinsic(
+ ctx->soa.bld_base.base.gallivm->builder,
+ "llvm.R600.load.input",
+ ctx->soa.bld_base.base.elem_type,
+ &face_reg, 1,
+ LLVMReadNoneAttribute);
+ LLVMValueRef is_face_positive = LLVMBuildFCmp(
+ ctx->soa.bld_base.base.gallivm->builder,
+ LLVMRealUGT, face,
+ lp_build_const_float(ctx->soa.bld_base.base.gallivm, 0.0f),
+ "");
+ ctx->inputs[soa_index] = LLVMBuildSelect(
+ ctx->soa.bld_base.base.gallivm->builder,
+ is_face_positive,
+ ctx->inputs[soa_index],
+ backcolor,
+ "");
+ }
}
}