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

Issue 772656 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: min,max,clamp,smoothstep not IEEE complient

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/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
 
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

Cc: kbr@chromium.org kainino@chromium.org
Labels: -Needs-Feedback -Via-Wizard-Content -Needs-Triage-M61
Status: WontFix (was: Unconfirmed)
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.

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

Cc: piman@chromium.org
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).
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 ! 

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

Blockedon: angleproject:3064
Adding blocked on bug angleproject:3064, an alternative to defining the undefined behavior

Sign in to add a comment