GLSL bug: min,max,clamp,smoothstep not IEEE complient
Reported by
fabrice....@gmail.com,
Oct 7 2017
|
||||||
Issue descriptionUserAgent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36 Example URL: https://www.shadertoy.com/view/4tsyzf Steps to reproduce the problem: min(.5,NaN) ex: min(.5, -sqrt(-gl_FragCoord.x) ) min/max: https://www.shadertoy.com/view/4tsyzf clamp: https://www.shadertoy.com/view/Mtscz2 smoothstep: https://www.shadertoy.com/view/lllcz2 What is the expected behavior? NaN What went wrong? .5 Does it occur on multiple sites: Yes Is it a problem with a plugin? No Did this work before? N/A Does this work in other browsers? N/A Chrome version: 61.0.3163.100 Channel: stable OS Version: 14.04 Flash Version: Shockwave Flash 27.0 r0 same for max. and as a consequence, same for clamp and smoothstep. at list on linux, chrome Version 61.0.3163.100
,
Oct 9 2017
Thanks for filing the issue, could you please help us with a sample screen shot for expected and actual behavior. This will help us to triage the issue better. Thanks.!
,
Oct 9 2017
,
Oct 9 2017
I think this bug also falls into the same category as 772654 GLSL ES 1.0 spec says the output of sqrt(negative) is undefined value, so drivers can return anything. Therefore, min(0.5, x) can be either 0.5 or x, depending on what drivers return in x. Again, if you disagree with my reading of the spec, feel free to reopen with a reference to the spec section to support your claim.
,
Oct 9 2017
On a separate note, we probably should address the undefined behaviors in shaders. We did that for the ES APIs. Removing undefined behaviors in shaders are much harder and much more expensive (performance wise).
,
Oct 10 2017
what do you mean by "we probably should address the undefined behaviors in shaders. We did that for the ES APIs" ? detail: webGL is now 2.0, so relevant spec is GLSL ES 3.0, I would say. Not that it change something here. what is strange is that glslES does manage NaN for many things but the few exception I listed. (and CUDA manage NaN correctly). What is even stranger is that the run-time evaluation does handle the NaN and Inf; this is the precompilation of const expr that does not, despite no perf issues at this stage. So there is inconsistancy somewhere, if not in the spec !
,
Jan 21
(2 days ago)
Adding blocked on bug angleproject:3064, an alternative to defining the undefined behavior |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by jmad...@chromium.org
, Oct 7 2017