GLSL bug (Angle): tanh(88) = 0, tanh(>=88) = NaN
Reported by
fabrice....@gmail.com,
Dec 15 2017
|
|||||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.94 Safari/537.36 Example URL: https://www.shadertoy.com/view/XtlBWj Steps to reproduce the problem: see url. On windows angle, tanh(v) for v = 87; 88 or more, with v not const. ( Note that const would give the right result = 1. ) What is the expected behavior? tanh(v) = 1 for v > 8 down to an error less than floating point precision. What went wrong? tanh = NaN for values >= 88 tanh = 0 for 87 Does it occur on multiple sites: N/A Is it a problem with a plugin? No Did this work before? N/A Does this work in other browsers? No firefox Chrome version: 62.0.3202.94 Channel: n/a OS Version: 10 Flash Version: Shockwave Flash 27.0 r0 may somebody please add the tags Blink>WebGL , Internals>GPU ? thanks ! ok on linux and windows+OpenGL. wrong on windows angles. the error consist in compiling tanh as sinh/cosh , which leads to inf/inf instead of 1 for "large" numbers (100 is "large"). openGl does the simple test: abs(x)>= 8 (or 15 for doubles) -> return sign(x) instead. Angle or hlsl doesn't.
,
Dec 18 2017
,
Dec 18 2017
Not sure whether this is an issue in ANGLE's constant folding or in the underlying HLSL compiler.
,
Dec 19 2017
ANGLE is currently using HLSL's native tanh() function to implement tanh. Using emulation instead would cost some performance, but I think it would be reasonable to add it in this case. That way GL and D3D would behave consistently. We might also pass a few more dEQP tests that are currently failing: dEQP-GLES3.functional.shaders.builtin_functions.precision.tanh*
,
Dec 20 2017
The following revision refers to this bug: https://chromium.googlesource.com/angle/angle/+/37385e11d38322cfc4d72e0b9cac51e380b263da commit 37385e11d38322cfc4d72e0b9cac51e380b263da Author: Olli Etuaho <oetuaho@nvidia.com> Date: Wed Dec 20 08:09:29 2017 Emulate tanh on HLSL This ensures mathematically correct results on large inputs. BUG= chromium:795269 BUG=angleproject:1093 TEST=dEQP-GLES3.functional.shaders.builtin_functions.precision.tanh* Change-Id: Id5ba05a3284e51a34f196b419abef0f4a41551e0 Reviewed-on: https://chromium-review.googlesource.com/832463 Reviewed-by: Jamie Madill <jmadill@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com> [modify] https://crrev.com/37385e11d38322cfc4d72e0b9cac51e380b263da/src/tests/deqp_support/deqp_gles3_test_expectations.txt [modify] https://crrev.com/37385e11d38322cfc4d72e0b9cac51e380b263da/src/compiler/translator/emulated_builtin_function_data_hlsl.json [modify] https://crrev.com/37385e11d38322cfc4d72e0b9cac51e380b263da/src/compiler/translator/emulated_builtin_functions_hlsl_autogen.cpp [modify] https://crrev.com/37385e11d38322cfc4d72e0b9cac51e380b263da/src/compiler/translator/OutputHLSL.cpp
,
Dec 29 2017
Works on current Chrome Canary. |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by krajshree@chromium.org
, Dec 17 2017