[Mesa-dev] [PATCH 01/10] radeonsi: fix the offset in cube map coordinate conversion
Nicolai Hähnle
nhaehnle at gmail.com
Wed Jan 11 09:10:04 UTC 2017
On 10.01.2017 16:12, Nicolai Hähnle wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> The correct offset is really 0.5, both intuitively and according to the
> formulas in Section 8.13 (Cube Map Texture Selection) of the OpenGL spec.
> This mistake probably never hurt because wrap-around is constrained to
> individual cube faces.
Oddly, this actually breaks some tests. I don't yet understand why, but
reverting to adding 1.5 fixes at least the tests I've looked at... I'll
run some more comprehensive tests later.
Nicolai
> ---
> src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
> index 0a49bc2..277ed5b 100644
> --- a/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
> +++ b/src/gallium/drivers/radeonsi/si_shader_tgsi_alu.c
> @@ -954,21 +954,21 @@ static void si_llvm_cube_to_2d_coords(struct lp_build_tgsi_context *bld_base,
>
> for (i = 0; i < 4; ++i)
> coords[i] = LLVMBuildExtractElement(builder, v,
> lp_build_const_int32(gallivm, i), "");
>
> coords[2] = lp_build_intrinsic(builder, "llvm.fabs.f32",
> type, &coords[2], 1, LP_FUNC_ATTR_READNONE);
> coords[2] = lp_build_emit_llvm_unary(bld_base, TGSI_OPCODE_RCP, coords[2]);
>
> mad_args[1] = coords[2];
> - mad_args[2] = LLVMConstReal(type, 1.5);
> + mad_args[2] = LLVMConstReal(type, 0.5);
>
> mad_args[0] = coords[0];
> coords[0] = lp_build_emit_llvm_ternary(bld_base, TGSI_OPCODE_MAD,
> mad_args[0], mad_args[1], mad_args[2]);
>
> mad_args[0] = coords[1];
> coords[1] = lp_build_emit_llvm_ternary(bld_base, TGSI_OPCODE_MAD,
> mad_args[0], mad_args[1], mad_args[2]);
>
> /* apply xyz = yxw swizzle to cooords */
>
More information about the mesa-dev
mailing list