New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 772654 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Oct 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug

Blocked on:
issue angleproject:3064



Sign in to add a comment

GLSL bug: clamp behave differently on openGL vs Angle

Reported by fabrice....@gmail.com, Oct 7 2017

Issue description

UserAgent: 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.
 
Components: Blink>WebGL Internals>GPU
Cc: ranjitkan@chromium.org
Labels: Needs-Triage-M61 Needs-Feedback
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.!
Components: -Blink

Comment 4 by zmo@chromium.org, Oct 9 2017

Status: WontFix (was: Unconfirmed)
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)
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 ).
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".

Comment 7 by kkinnu...@nvidia.com, Jan 21 (2 days ago)

Blockedon: angleproject:3064
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