summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichel Dänzer <[email protected]>2013-02-13 15:57:23 +0100
committerMichel Dänzer <[email protected]>2013-02-22 20:15:17 +0100
commit5baa8ec737e82bbfec1561b4018bae9804d708fd (patch)
treeed3cb783b15c594275128d91bfd43a3058e3f749 /src
parent0c3b96a6c69861ecf25debb27aeed17302693094 (diff)
radeonsi: Fix w component of TGSI_SEMANTIC_POSITION fragment shader inputs.
It's the reciprocal of the register value. Fixes piglit fragcoord_w and glsl-fs-fragcoord-zw-perspective. NOTE: This is a candidate for the 9.1 branch. (cherry picked from commit 954bc4ac34b821cdc4ecb3ea8e394a66bcc2dda0)
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/radeonsi/radeonsi_shader.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c
index 7c57f4c2f3e..25456343040 100644
--- a/src/gallium/drivers/radeonsi/radeonsi_shader.c
+++ b/src/gallium/drivers/radeonsi/radeonsi_shader.c
@@ -263,6 +263,14 @@ static void declare_input_fs(
build_intrinsic(base->gallivm->builder,
"llvm.SI.fs.read.pos", input_type,
args, 1, LLVMReadNoneAttribute);
+
+ if (chan == 3)
+ /* RCP for fragcoord.w */
+ si_shader_ctx->radeon_bld.inputs[soa_index] =
+ LLVMBuildFDiv(gallivm->builder,
+ lp_build_const_float(gallivm, 1.0f),
+ si_shader_ctx->radeon_bld.inputs[soa_index],
+ "");
}
return;
}