diff options
author | Tom Stellard <[email protected]> | 2012-09-06 16:18:11 -0400 |
---|---|---|
committer | Tom Stellard <[email protected]> | 2012-09-11 14:53:47 -0400 |
commit | 0fb1e68a0ba0dc58e0b97f5bb3f7a46d9b3eae29 (patch) | |
tree | bf10d38d850cd44c688f7534b487e7a4f0fe5f87 /src/gallium/drivers/radeonsi/radeonsi_shader.c | |
parent | 0410e9e8c7d3d91b62d970ca2a3f6ae400272c5f (diff) |
radeonsi: Handle position input parameter for pixel shaders v2
v2:
- Don't increment ninterp or set any of the have_* flags for
TGSI_SEMANTIC_POSITION
Reviewed-by: Michel Dänzer <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/radeonsi_shader.c')
-rw-r--r-- | src/gallium/drivers/radeonsi/radeonsi_shader.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c index 0994fac6f21..466d5658d5a 100644 --- a/src/gallium/drivers/radeonsi/radeonsi_shader.c +++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c @@ -261,6 +261,7 @@ static void declare_input_fs( struct lp_build_context * base = &si_shader_ctx->radeon_bld.soa.bld_base.base; struct gallivm_state * gallivm = base->gallivm; + LLVMTypeRef input_type = LLVMFloatTypeInContext(gallivm->context); /* This value is: * [15:0] NewPrimMask (Bit mask for each quad. It is set it the @@ -278,6 +279,20 @@ static void declare_input_fs( /* XXX: Is this the input_index? */ LLVMValueRef attr_number = lp_build_const_int32(gallivm, input_index); + if (decl->Semantic.Name == TGSI_SEMANTIC_POSITION) { + for (chan = 0; chan < TGSI_NUM_CHANNELS; chan++) { + LLVMValueRef args[1]; + unsigned soa_index = + radeon_llvm_reg_index_soa(input_index, chan); + args[0] = lp_build_const_int32(gallivm, chan); + si_shader_ctx->radeon_bld.inputs[soa_index] = + build_intrinsic(base->gallivm->builder, + "llvm.SI.fs.read.pos", input_type, + args, 1, LLVMReadNoneAttribute); + } + return; + } + /* XXX: Handle all possible interpolation modes */ switch (decl->Interp.Interpolate) { case TGSI_INTERPOLATE_COLOR: @@ -332,7 +347,6 @@ static void declare_input_fs( LLVMValueRef args[3]; LLVMValueRef llvm_chan = lp_build_const_int32(gallivm, chan); unsigned soa_index = radeon_llvm_reg_index_soa(input_index, chan); - LLVMTypeRef input_type = LLVMFloatTypeInContext(gallivm->context); args[0] = llvm_chan; args[1] = attr_number; args[2] = params; |