From 969a207fe356d152b65085a9113502c7fbb5712e Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Mon, 2 Jun 2008 20:16:49 +0900 Subject: gallium: Fix log<->cos typo in logf. --- src/gallium/include/pipe/p_util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/include/pipe/p_util.h b/src/gallium/include/pipe/p_util.h index 0d8ed167b2..3d8ad48d4f 100644 --- a/src/gallium/include/pipe/p_util.h +++ b/src/gallium/include/pipe/p_util.h @@ -452,7 +452,7 @@ static INLINE float fabsf( float f ) static INLINE float logf( float f ) { - return (float) cos( (double) f ); + return (float) log( (double) f ); } #endif /* _INC_MATH */ #endif -- cgit v1.2.3 From 58cccc8d6b49c75eeabe9b61055e69de824ff757 Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Mon, 2 Jun 2008 21:51:31 +0200 Subject: draw: Fix DP3 implementation by replacing SSE with x87 version. --- src/gallium/auxiliary/draw/draw_vs_aos.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/draw/draw_vs_aos.c b/src/gallium/auxiliary/draw/draw_vs_aos.c index 725f36b502..5bfcd96ac3 100644 --- a/src/gallium/auxiliary/draw/draw_vs_aos.c +++ b/src/gallium/auxiliary/draw/draw_vs_aos.c @@ -962,8 +962,35 @@ static boolean emit_COS( struct aos_compilation *cp, const struct tgsi_full_inst return TRUE; } +#if 1 + +/* The x87 version. + */ +static boolean emit_DP3( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) +{ + struct x86_reg st1 = x86_make_reg( file_x87, 1 ); + + x87_fld_src( cp, &op->FullSrcRegisters[0], 0 ); + x87_fld_src( cp, &op->FullSrcRegisters[1], 0 ); + x87_fmulp( cp->func, st1 ); + x87_fld_src( cp, &op->FullSrcRegisters[0], 1 ); + x87_fld_src( cp, &op->FullSrcRegisters[1], 1 ); + x87_fmulp( cp->func, st1 ); + x87_faddp( cp->func, st1 ); + x87_fld_src( cp, &op->FullSrcRegisters[0], 2 ); + x87_fld_src( cp, &op->FullSrcRegisters[1], 2 ); + x87_fmulp( cp->func, st1 ); + x87_faddp( cp->func, st1 ); + + x87_fstp_dest4( cp, &op->FullDstRegisters[0] ); + + return TRUE; +} + +#else /* The dotproduct instructions don't really do that well in sse: + * XXX: produces wrong results -- disabled. */ static boolean emit_DP3( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { @@ -985,7 +1012,7 @@ static boolean emit_DP3( struct aos_compilation *cp, const struct tgsi_full_inst return TRUE; } - +#endif static boolean emit_DP4( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { -- cgit v1.2.3 From 183d490ab139483c88d0b0f541714919de86235c Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 3 Jun 2008 10:59:46 +0200 Subject: draw: Fix fetch_src(). Resurrect SSE version of DP3. --- src/gallium/auxiliary/draw/draw_vs_aos.c | 43 +++++--------------------------- 1 file changed, 6 insertions(+), 37 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/draw/draw_vs_aos.c b/src/gallium/auxiliary/draw/draw_vs_aos.c index 5bfcd96ac3..891f8c211a 100644 --- a/src/gallium/auxiliary/draw/draw_vs_aos.c +++ b/src/gallium/auxiliary/draw/draw_vs_aos.c @@ -532,10 +532,11 @@ static struct x86_reg fetch_src( struct aos_compilation *cp, if (swz != SSE_SWIZZLE_NOOP || negs != 0 || abs != 0) { struct x86_reg dst = aos_get_xmm_reg(cp); - if (swz != SSE_SWIZZLE_NOOP) { + if (swz != SSE_SWIZZLE_NOOP) emit_pshufd(cp, dst, arg0, swz); - arg0 = dst; - } + else + sse_movaps(cp->func, dst, arg0); + arg0 = dst; if (negs && negs != 0xf) { struct x86_reg imm_swz = aos_get_internal_xmm(cp, IMM_SWZ); @@ -550,15 +551,13 @@ static struct x86_reg fetch_src( struct aos_compilation *cp, (negs & 2) ? 1 : 0, (negs & 4) ? 1 : 0, (negs & 8) ? 1 : 0)); - sse_mulps(cp->func, dst, arg0); + sse_mulps(cp->func, dst, tmp); aos_release_xmm_reg(cp, tmp.idx); - arg0 = dst; } else if (negs) { struct x86_reg imm_negs = aos_get_internal_xmm(cp, IMM_NEGS); sse_mulps(cp->func, dst, imm_negs); - arg0 = dst; } @@ -571,10 +570,9 @@ static struct x86_reg fetch_src( struct aos_compilation *cp, sse_movaps(cp->func, tmp, arg0); sse_mulps(cp->func, tmp, neg); - sse_maxps(cp->func, dst, arg0); + sse_maxps(cp->func, dst, tmp); aos_release_xmm_reg(cp, tmp.idx); - arg0 = dst; } } @@ -962,33 +960,6 @@ static boolean emit_COS( struct aos_compilation *cp, const struct tgsi_full_inst return TRUE; } -#if 1 - -/* The x87 version. - */ -static boolean emit_DP3( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) -{ - struct x86_reg st1 = x86_make_reg( file_x87, 1 ); - - x87_fld_src( cp, &op->FullSrcRegisters[0], 0 ); - x87_fld_src( cp, &op->FullSrcRegisters[1], 0 ); - x87_fmulp( cp->func, st1 ); - x87_fld_src( cp, &op->FullSrcRegisters[0], 1 ); - x87_fld_src( cp, &op->FullSrcRegisters[1], 1 ); - x87_fmulp( cp->func, st1 ); - x87_faddp( cp->func, st1 ); - x87_fld_src( cp, &op->FullSrcRegisters[0], 2 ); - x87_fld_src( cp, &op->FullSrcRegisters[1], 2 ); - x87_fmulp( cp->func, st1 ); - x87_faddp( cp->func, st1 ); - - x87_fstp_dest4( cp, &op->FullDstRegisters[0] ); - - return TRUE; -} - -#else - /* The dotproduct instructions don't really do that well in sse: * XXX: produces wrong results -- disabled. */ @@ -1012,8 +983,6 @@ static boolean emit_DP3( struct aos_compilation *cp, const struct tgsi_full_inst return TRUE; } -#endif - static boolean emit_DP4( struct aos_compilation *cp, const struct tgsi_full_instruction *op ) { struct x86_reg arg0 = fetch_src(cp, &op->FullSrcRegisters[0]); -- cgit v1.2.3 From 0a5df5bc7d711a766c9d0963fb2029d60cf70a8b Mon Sep 17 00:00:00 2001 From: Michal Krol Date: Tue, 3 Jun 2008 11:22:00 +0200 Subject: draw: Use register names more consistently. --- src/gallium/auxiliary/draw/draw_vs_aos.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/gallium') diff --git a/src/gallium/auxiliary/draw/draw_vs_aos.c b/src/gallium/auxiliary/draw/draw_vs_aos.c index 891f8c211a..3cf4a4d125 100644 --- a/src/gallium/auxiliary/draw/draw_vs_aos.c +++ b/src/gallium/auxiliary/draw/draw_vs_aos.c @@ -536,7 +536,6 @@ static struct x86_reg fetch_src( struct aos_compilation *cp, emit_pshufd(cp, dst, arg0, swz); else sse_movaps(cp->func, dst, arg0); - arg0 = dst; if (negs && negs != 0xf) { struct x86_reg imm_swz = aos_get_internal_xmm(cp, IMM_SWZ); @@ -568,12 +567,14 @@ static struct x86_reg fetch_src( struct aos_compilation *cp, struct x86_reg neg = aos_get_internal(cp, IMM_NEGS); struct x86_reg tmp = aos_get_xmm_reg(cp); - sse_movaps(cp->func, tmp, arg0); + sse_movaps(cp->func, tmp, dst); sse_mulps(cp->func, tmp, neg); sse_maxps(cp->func, dst, tmp); aos_release_xmm_reg(cp, tmp.idx); } + + return dst; } return arg0; -- cgit v1.2.3