[Mesa-dev] [PATCH] radeonsi: Fix w component of TGSI_SEMANTIC_POSITION fragment shader inputs.
Michel Dänzer
michel at daenzer.net
Wed Feb 13 07:38:34 PST 2013
From: Michel Dänzer <michel.daenzer at amd.com>
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.
Signed-off-by: Michel Dänzer <michel.daenzer at amd.com>
---
src/gallium/drivers/radeonsi/radeonsi_shader.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/gallium/drivers/radeonsi/radeonsi_shader.c b/src/gallium/drivers/radeonsi/radeonsi_shader.c
index 704f859..7922928 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;
}
--
1.8.1.3
More information about the mesa-dev
mailing list