New issue
Advanced search Search tips

Issue 818660 link

Starred by 1 user

Issue metadata

Status: ExternalDependency
Owner: ----
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Compat



Sign in to add a comment

GLSL bug: return+break in switch compiles on Angle and not in OpenGL

Reported by fabrice....@gmail.com, Mar 5 2018

Issue description

UserAgent: 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/4ddcW2

Steps to reproduce the problem:
1. run the shader or do a switch with return; break; statements

What is the expected behavior?
should either compile everywhere or trigger an error everywhere.

What went wrong?
On true OpenGL this triggers a "unreachable statement" error
while on Angle this is accepted.

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: 16.04
Flash Version: Shockwave Flash 28.0 r0

Not sure which of Angle or OpenGl is faulty, but in practice many available windows shaders can be broadcasted since seeming correct but will fail on linux, macos(probably) and windows/OpenGL. So would seem safer to accept this everywhere.
And at first, how is this a fatal error and not just a warning ?

May somebody please add tags
Blink>WebGL
Internals>GPU
?
 
Components: Blink>WebGL
Components: Internals>GPU>ANGLE
Labels: -OS-Linux
Status: Available (was: Unconfirmed)
This seems like a driver bug. I don't know why something that should be a warning is surfaced as an error, though. (Could that be a Chrome bug?)

Without changing the driver, we can make this code accepted everywhere by automatically removing the dead code before handing it off to the driver. However this could prove difficult.

In practice, it's more important to make the behavior consistent than to make this particular code work. So we could also consider making it always an error. We also need to dive into the GLSL spec.
Cc: oetu...@nvidia.com

Comment 4 by oetu...@nvidia.com, Mar 6 2018

This might be a bug in NVIDIA OpenGL driver (and possibly other GL drivers?). I'm pretty sure any GLSL spec doesn't say anything about unreachable statements being disallowed, hence the most appropriate thing for the driver to do in this case would be to generate a warning. Some kinds of unreachable code are hard to detect, so it would be odd for the spec to require an error in that case. Of course for legacy compatibility a spec clause like "generating an error for unreachable code is allowed" could be informative.

I'd propose the following actions:
- Opening a bug on Khronos bug tracker to discuss how the spec should be
- After the spec discussion, fixing drivers if needed
- After the spec discussion, possibly adding pruning of most obvious kinds of unreachable code into ANGLE

Comment 5 by oetu...@nvidia.com, Mar 20 2018

Status: ExternalDependency (was: Available)
This also came up elsewhere, and we thought no further spec deliberation was needed - this should only be a warning, not an error. A fix will be in NVIDIA OpenGL drivers soon.

Not sure if this may affect any other vendors, but since NVIDIA is the only one mentioned in the bug so far I'm closing this as ExternalDependency.
bug still there ( NVIDIA 384.130 ) : any news about the fix schedule ?

Comment 7 by oetu...@nvidia.com, Jun 27 2018

The issue should be fixed in NVIDIA driver version 396 and newer.
Cc: -oetu...@nvidia.com

Sign in to add a comment