GLSL bug: clamp behave differently on openGL vs Angle
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/XtXyDf Steps to reproduce the problem: clamp(0.,1.,x) (a frequent API mistake for clamp (x,0.,1.) What is the expected behavior? - same result on OpenGL and Angle: - according to the spec, should give the same result than #define myclamp(x, minVal, maxVal) min(max(x, minVal), maxVal) What went wrong? different result on windows and linux, linux different to spec. OpenGL doesn't implement it correctly Angle implement it correctly 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 it's important since the very frequent API mistake is often harmless on windows while it gives plain black on linux.
,
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 don't think it's a bug. GLSL ES 1.0 spec says clamp(x, min, max) returns undefined value if min > max. Shaders should not rely on one driver's behavior if the spec says it's undefined. Closing this as Won't Fix. Please reopen if you diagree with my read of the spec (and please provide spec reference to support your claim)
,
Oct 10 2017
the spec says " The returned value is computed as min(max(x, minVal), maxVal) " which is not the case (this is what the shadertoy compare). Apparently what is implemented is max(min(x, maxVal), minVal) instead. ( switch defines to test ).
,
Oct 11 2017
The statement that "Results are undefined if minVal > maxVal." takes precedence over "Returns min (max (x, minVal), maxVal)". That is, it only has to return "min (max (x, minVal), maxVal)" if "minVal <= maxVal".
,
Jan 21
(2 days ago)
Adding angleproject:3064 as a blocking to signal some sort of +1 for the feature in that bug. I think this would be the most pragmatic solution, fixing many of these sort of problems. (Not saying somebody should implement this feature ASAP.) This was originally reproed with NVIDIA HW and drivers. Unfortunately it's a rather uphill to argue that "undefined behavior" should behave in some defined way. Sort of an oxymoron. Other way to solve would be to fix the spec process to not have undefinedness. |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by jmad...@chromium.org
, Oct 7 2017