Mesa (master): i965: Always hand the absolute value to RSQ.
Eric Anholt
anholt at kemper.freedesktop.org
Tue Dec 7 21:13:48 UTC 2010
Module: Mesa
Branch: master
Commit: fa0d5a2c5bfb6109d365a6f0b9bee53dfee50325
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fa0d5a2c5bfb6109d365a6f0b9bee53dfee50325
Author: Eric Anholt <eric at anholt.net>
Date: Tue Dec 7 12:34:30 2010 -0800
i965: Always hand the absolute value to RSQ.
gen6 builtin RSQ apparently clamps negative values to 0 instead of
returning the RSQ of the absolute value like ARB_fragment_program
desires and pre-gen6 apparently does.
Fixes:
glean/fp1-RSQ test 2 (reciprocal square root of negative value)
glean/vp1-RSQ test 2 (reciprocal square root of negative value)
---
src/mesa/drivers/dri/i965/brw_vs_emit.c | 2 +-
src/mesa/drivers/dri/i965/brw_wm_fp.c | 5 +++++
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c
index 407358f..1844526 100644
--- a/src/mesa/drivers/dri/i965/brw_vs_emit.c
+++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c
@@ -1958,7 +1958,7 @@ void brw_vs_emit(struct brw_vs_compile *c )
emit_math1(c, BRW_MATH_FUNCTION_INV, dst, args[0], BRW_MATH_PRECISION_FULL);
break;
case OPCODE_RSQ:
- emit_math1(c, BRW_MATH_FUNCTION_RSQ, dst, args[0], BRW_MATH_PRECISION_FULL);
+ emit_math1(c, BRW_MATH_FUNCTION_RSQ, dst, brw_abs(args[0]), BRW_MATH_PRECISION_FULL);
break;
case OPCODE_SEQ:
diff --git a/src/mesa/drivers/dri/i965/brw_wm_fp.c b/src/mesa/drivers/dri/i965/brw_wm_fp.c
index 36330c1..4759b28 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_fp.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_fp.c
@@ -1131,6 +1131,11 @@ void brw_wm_pass_fp( struct brw_wm_compile *c )
precalc_lit(c, inst);
break;
+ case OPCODE_RSQ:
+ out = emit_scalar_insn(c, inst);
+ out->SrcReg[0].Abs = GL_TRUE;
+ break;
+
case OPCODE_TEX:
precalc_tex(c, inst);
break;
More information about the mesa-commit
mailing list