diff options
author | Michel Dänzer <[email protected]> | 2012-09-25 12:41:31 +0200 |
---|---|---|
committer | Michel Dänzer <[email protected]> | 2012-10-26 15:51:18 +0200 |
commit | 97078b198d7362c465ff9d726ccbf4e072e51ae9 (patch) | |
tree | ef5f3ca971520688df1657c02a3e49a46334f49b /src/gallium/drivers/radeonsi/radeonsi_shader.c | |
parent | 691f08dbeaeb71bfa26784e7ec18aa07e34893fb (diff) |
radeonsi: Handle TGSI_SEMANTIC_FACE.
Fixes two piglit tests using gl_FrontFacing.
Signed-off-by: Michel Dänzer <[email protected]>
Reviewed-by: Tom Stellard <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/radeonsi_shader.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/radeonsi_shader.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c index aec5c2ea222..53e889c19de 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_shader.c +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c @@ -266,6 +266,33 @@ static void declare_input_fs( return; } + if (decl->Semantic.Name == TGSI_SEMANTIC_FACE) { + LLVMValueRef face, is_face_positive; + + face = build_intrinsic(gallivm->builder, + "llvm.SI.fs.read.face", + input_type, + NULL, 0, LLVMReadNoneAttribute); + is_face_positive = LLVMBuildFCmp(gallivm->builder, + LLVMRealUGT, face, + lp_build_const_float(gallivm, 0.0f), + ""); + + si_shader_ctx->radeon_bld.inputs[radeon_llvm_reg_index_soa(input_index, 0)] = + LLVMBuildSelect(gallivm->builder, + is_face_positive, + lp_build_const_float(gallivm, 1.0f), + lp_build_const_float(gallivm, 0.0f), + ""); + si_shader_ctx->radeon_bld.inputs[radeon_llvm_reg_index_soa(input_index, 1)] = + si_shader_ctx->radeon_bld.inputs[radeon_llvm_reg_index_soa(input_index, 2)] = + lp_build_const_float(gallivm, 0.0f); + si_shader_ctx->radeon_bld.inputs[radeon_llvm_reg_index_soa(input_index, 3)] = + lp_build_const_float(gallivm, 1.0f); + + return; + } + shader->input[input_index].param_offset = shader->ninterp++; attr_number = lp_build_const_int32(gallivm, shader->input[input_index].param_offset); |