diff options
author | Zack Rusin <[email protected]> | 2013-07-11 12:16:06 -0400 |
---|---|---|
committer | Zack Rusin <[email protected]> | 2013-07-11 20:19:04 -0400 |
commit | 00cd455bd50c6b16b2f72a6d2726de3d3818c7f5 (patch) | |
tree | 2b13c67bd84020a1bad285c3678b497a571ae1a4 /src/gallium/auxiliary/tgsi | |
parent | a171812d27afb1a52c5d81deaa6027f30bc102e8 (diff) |
gallium: fixup definitions of the rsq and sqrt
GLSL spec says that rsq is undefined for src<=0, but the D3D10
spec says it needs to be a NaN, so lets stop taking an absolute
value of the source which completely breaks that behavior. For
the gl program we can simply insert an extra abs instrunction
which produces the desired behavior there.
Signed-off-by: Zack Rusin <[email protected]>
Reviewed-by: Roland Scheidegger <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary/tgsi')
-rw-r--r-- | src/gallium/auxiliary/tgsi/tgsi_exec.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/gallium/auxiliary/tgsi/tgsi_exec.c b/src/gallium/auxiliary/tgsi/tgsi_exec.c index bed08522fcd..1f8e62d6f3e 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_exec.c +++ b/src/gallium/auxiliary/tgsi/tgsi_exec.c @@ -339,20 +339,20 @@ micro_rsq(union tgsi_exec_channel *dst, assert(src->f[2] != 0.0f); assert(src->f[3] != 0.0f); #endif - dst->f[0] = 1.0f / sqrtf(fabsf(src->f[0])); - dst->f[1] = 1.0f / sqrtf(fabsf(src->f[1])); - dst->f[2] = 1.0f / sqrtf(fabsf(src->f[2])); - dst->f[3] = 1.0f / sqrtf(fabsf(src->f[3])); + dst->f[0] = 1.0f / sqrtf(src->f[0]); + dst->f[1] = 1.0f / sqrtf(src->f[1]); + dst->f[2] = 1.0f / sqrtf(src->f[2]); + dst->f[3] = 1.0f / sqrtf(src->f[3]); } static void micro_sqrt(union tgsi_exec_channel *dst, const union tgsi_exec_channel *src) { - dst->f[0] = sqrtf(fabsf(src->f[0])); - dst->f[1] = sqrtf(fabsf(src->f[1])); - dst->f[2] = sqrtf(fabsf(src->f[2])); - dst->f[3] = sqrtf(fabsf(src->f[3])); + dst->f[0] = sqrtf(src->f[0]); + dst->f[1] = sqrtf(src->f[1]); + dst->f[2] = sqrtf(src->f[2]); + dst->f[3] = sqrtf(src->f[3]); } static void |