Closed Bug 1124187 Opened 9 years ago Closed 5 years ago

Many WebGL demos broke in Firefox 35 on Windows when using ANGLE

Categories

(Core :: Graphics: CanvasWebGL, defect)

35 Branch
x86_64
Windows 7
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: postfilter, Unassigned)

References

Details

(Whiteboard: [gfx-noted])

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0
Build ID: 20150108202552

Steps to reproduce:

After stable Firefox updated to version 35, multiple WebGL demos from different authors / using different libraries broke on Windows when using ANGLE rendering backend.

Some examples of what got broken (there are many more, e.g. all three.js examples have broken shadows, all three.js and XG deferred rendering demos are broken):

http://threejs.org/examples/webgl_shadowmap.html
http://threejs.org/examples/webgl_morphtargets_md2.html
http://threejs.org/examples/webgl_postprocessing_advanced.html
http://threejs.org/examples/webgldeferred_animation.html
http://alteredqualia.com/three/examples/webgl_deferred_shadowmap_point.html

http://alteredqualia.com/xg/examples/deferred_skin.html
http://alteredqualia.com/xg/examples/animation_physics_terrain.html
http://alteredqualia.com/xg/examples/animation_physics_ammo.html

http://playcanv.as/b/abx8Go4g
http://playcanv.as/b/DM950Kkf
http://playcanv.as/b/XEYgcMyt

http://glge.org/demos/cardemo/

http://cabbi.bo/weirdkids/
http://madebyevan.com/webgl-water/
http://www.goodboydigital.com/pixijs/cracker/

https://www.shadertoy.com/




Actual results:

Troubles vary depending on the demo:

- all three.js examples with shadowmaps don't show shadows
- all three.js deferred rendering demos show just black screen
- postprocessing three.js example doesn't mask out applying of effects
- all XG deferred rendering examples are completely broken, either showing just black screen or heavily broken rendering
- all PlayCanvas demos with shadowmaps I tried don't show shadows, additionally rocket game doesn't show particle effect behind the rocket
- GLGE car demo misses shadows
- PixiJS cracker demo misses stylized shadow and crack fullscreen effect (just shows white screen at that time)
- WebGL Water demo renders water surface incorrectly
- visiting ShaderToy just freezes Firefox, then it crashes

All these depend on rendering into textures, so my guess something broke there.


Expected results:

These demos did work ok in Firefox 34 ANGLE (as far as I remember), they still work ok in Firefox 35 when using OpenGL rendering backend. 

Also they work ok in Chrome 39 with ANGLE (and have been working ok throughout multiple Chrome and ANGLE versions). 

So it's likely problem is somewhere in some Firefox WebGL implementation change that came in version 35, not ANGLE itself.
Here's another demo that's broken:

http://floooh.github.io/oryol/VertexTexture.html

This uses a vertex shader texture fetch from an RGBA8 texture to displace vertex positions. The offscreen texture seems to be rendered right, but the texture fetch from the texture alpha component seems to fail.
PS: the http://floooh.github.io/oryol/VertexTexture.html demo samples the alpha channel which is broken. Changing the vertex shader to sample r,g or b works. So it looks like sampling the alpha channel of a texture is broken, at least when sampling from the vertex shader.

I have tested on the Beta Channel btw, FF 36 on Windows7.
(In reply to Andre Weissflog from comment #2)
> PS: the http://floooh.github.io/oryol/VertexTexture.html demo samples the
> alpha channel which is broken. Changing the vertex shader to sample r,g or b
> works. So it looks like sampling the alpha channel of a texture is broken,
> at least when sampling from the vertex shader.
> 
> I have tested on the Beta Channel btw, FF 36 on Windows7.

PS: it could also be that writing the alpha channel into an offscreen frame buffer doesn't work and is set to 0.0 or 1.0
Here is my "about:support" graphics section:

-------------------
Adapter Description: NVIDIA Quadro 2000M
Adapter Drivers: nvd3dumx,nvwgf2umx,nvwgf2umx nvd3dum,nvwgf2um,nvwgf2um
Adapter RAM: 2048
Device ID: 0x0dda
Direct2D Enabled: true
DirectWrite Enabled: true (6.2.9200.16571)
Driver Date: 9-13-2014
Driver Version: 9.18.13.4411
GPU #2 Active: false
GPU Accelerated Windows: 1/1 Direct3D 11 (OMTC)
Subsys ID: 21cf17aa
Vendor ID: 0x10de
WebGL Renderer: Google Inc. -- ANGLE (NVIDIA Quadro 2000M Direct3D9Ex vs_3_0 ps_3_0)
windowLayerManagerRemote: true
AzureCanvasBackend: direct2d
AzureContentBackend: direct2d
AzureFallbackCanvasBackend: cairo
AzureSkiaAccelerated: 0
------------------------
Some broken demos have reported like in bug 1081497.
Thanks for the detailed reports. It's increasingly looking like a general problem with non-trivial alpha channels and the version of ANGLE we have.
Firefox Nightly seems to suffer from most of these issues too (not sure if it uses the same ANGLE version, in Nightly it's D3D11 ANGLE vs D3D9 ANGLE in Firefox 35).

Few demos from the above bug report are working in Nightly but most still have the same problems.
I can reproduce these issues on my laptop.
Possible duplicate bug 1124453
Good catch Alex. That other bug report seems to cover many broken demos listed here.

Confirming that forcing "WebGL context alpha:true" fixed broken rendering in at least these demos I listed in the initial bug report:

http://threejs.org/examples/webgl_shadowmap.html
http://threejs.org/examples/webgl_morphtargets_md2.html
http://threejs.org/examples/webgldeferred_animation.html
http://alteredqualia.com/three/examples/webgl_deferred_shadowmap_point.html

http://alteredqualia.com/xg/examples/deferred_skin.html
http://alteredqualia.com/xg/examples/animation_physics_terrain.html
http://alteredqualia.com/xg/examples/animation_physics_ammo.html

This one is still broken even with "alpha: true":

http://threejs.org/examples/webgl_postprocessing_advanced.html

Other ones I listed are not mine, so I can't tell.

Note: I did those changes in my local repo, online versions listed are not affected.

-------------

Curiously, Alex's Blend4Web Cartoon Interior demo seem to work ok for me (listed in that other bug report). 

https://www.blend4web.com/tutorials/examples/cartoon_interior/cartoon_interior.html

Not sure if there is already some workaround applied, or if I just don't know what to look for. To me it appears the same as in Chrome.

-------------

Another thing: this "alpha: true" workaround revealed massive performance regress with D3D9 ANGLE. 

For example this demo is now incredibly slow (I'm getting ~1 fps, used to be ~30 fps in Firefox 34, ~48 FPS in Chrome):

http://alteredqualia.com/xg/examples/animation_physics_terrain.html

This performance regress though seems to come from ANGLE itself. I already noticed in before in Chrome, just there it's mostly hidden as Chrome defaults to D3D11 ANGLE (I only noticed it because there was another Chrome bug in notebooks with Nvidia Optimus which was incorrectly blacklisting D3D11 ANGLE):

https://code.google.com/p/chromium/issues/detail?id=438413
Depends on: 1125445
Good news: The patch in bug 1125445 fixes all the pages mentioned here except the animation_physics ones, which I can't test with a DEBUG build. (asserts it code I don't know)

The fix is obvious and simple, so we'll try to backport it as far as we can.
Status: UNCONFIRMED → NEW
Ever confirmed: true
@Jeff Thanks, good news indeed ;)

If you need to narrow down debugging of remaining problems, those animation_physics demos differ from deferred_skin one mostly by using dynamic cubemaps. 

That code area got broken relatively recently also in Chrome though it should be already fixed (so maybe just updating ANGLE version could help?):

https://code.google.com/p/angleproject/issues/detail?id=849
Whiteboard: [gfx-noted]
(In reply to AlteredQualia from comment #13)
> @Jeff Thanks, good news indeed ;)
> 
> If you need to narrow down debugging of remaining problems, those
> animation_physics demos differ from deferred_skin one mostly by using
> dynamic cubemaps. 
> 
> That code area got broken relatively recently also in Chrome though it
> should be already fixed (so maybe just updating ANGLE version could help?):
> 
> https://code.google.com/p/angleproject/issues/detail?id=849

Good to know. It looks like the fix isn't in the current nightly, but it should be in tomorrow's.
(In reply to Jeff Gilbert [:jgilbert] from comment #14)
 
> Good to know. It looks like the fix isn't in the current nightly, but it
> should be in tomorrow's.

Seems fix is already in the latest Nightly 38.0a1 (2015-01-29).

For me it did fix everything I listed except my demos :(

All XG deferred rendering demos are still broken, with console errors about "incomplete framebuffer".

Seem like there may be some unnecessarily overcautious check somewhere? 

All framebuffers should be ok (except few temporary ones that are used for feature detection, but those are just one-time-shots at the beginning, these errors seem to be generated every frame). 

Those demos do work everywhere else (FF OpenGL, Chrome, Opera, Explorer). Whatever specs edge-cases were there I think were fixed when Chrome Canary was getting D3D11 ANGLE.
When will the patch be available in stable? The bug also causes issues in our application and we need to know if we need to implement a workaround for an upcoming release:

http://www.arcgis.com/home/webscene/viewer.html?url=http://services.arcgis.com/nzS0F0zdNLvs7nc8/arcgis/rest/services/05_HurricaneAndrew_1992/FeatureServer/0
(In reply to pirk from comment #16)
> When will the patch be available in stable? The bug also causes issues in
> our application and we need to know if we need to implement a workaround for
> an upcoming release:
> 
> http://www.arcgis.com/home/webscene/viewer.html?url=http://services.arcgis.
> com/nzS0F0zdNLvs7nc8/arcgis/rest/services/05_HurricaneAndrew_1992/
> FeatureServer/0

Is the problem fixed for you in the Beta release?  Just want to make sure we're talking about the issue that was fixed with bug 1125445.
@AlteredQualia 
http://alteredqualia.com/xg/examples/deferred_skin.html
http://alteredqualia.com/xg/examples/animation_physics_ammo.html
show a black canvas, but http://alteredqualia.com/xg/examples/animation_physics_terrain.html
shows the background/skybox if you look up. Could this help you to make a simpler test case?

@Jeff Gilbert
This appears to be a Firefox ANGLE integration issue as these demos are broken with both the D3D9 and D3D11 ANGLE back ends in Firefox, but work fine with Firefox's OpenGL back end. They also work fine with Chrome's ANGLE back end.
(In reply to Milan Sreckovic [:milan] from comment #17)
> (In reply to pirk from comment #16)
> > When will the patch be available in stable? The bug also causes issues in
> > our application and we need to know if we need to implement a workaround for
> > an upcoming release:
> > 
> > http://www.arcgis.com/home/webscene/viewer.html?url=http://services.arcgis.
> > com/nzS0F0zdNLvs7nc8/arcgis/rest/services/05_HurricaneAndrew_1992/
> > FeatureServer/0
> 
> Is the problem fixed for you in the Beta release?  Just want to make sure
> we're talking about the issue that was fixed with bug 1125445.


Yes it is fixed in Beta (36.0). Release date is 2015-02-24, right? Thanks for the fast reply!
@Luke @Jeff Gilbert

So I finally managed to narrow it down. It seems Firefox with ANGLE doesn't support rendering into half-float render targets, despite announcing OES_texture_half_float and OES_texture_half_float_linear WebGL extensions support.

I guess this may come from that WebGL float extensions mess, where for a long time float texture extensions meant both texture support and render target support (they still do mean this, just it's supposed to be deprecated).

Then came a separate WEBGL_color_buffer_float extension, but seems only Firefox implements this. But even with this, it's still missing corresponding EXT_color_buffer_half_float for half-float render targets, so right now it's not possible to render into half-floats in Firefox.

Chrome solves this by supporting just OES_texture_half_float and OES_texture_half_float_linear, but with also allowing rendering into half-float render targets.
Depends on: 1130616
(In reply to AlteredQualia from comment #20)
> @Luke @Jeff Gilbert
> 
> So I finally managed to narrow it down. It seems Firefox with ANGLE doesn't
> support rendering into half-float render targets, despite announcing
> OES_texture_half_float and OES_texture_half_float_linear WebGL extensions
> support.
> 
> I guess this may come from that WebGL float extensions mess, where for a
> long time float texture extensions meant both texture support and render
> target support (they still do mean this, just it's supposed to be
> deprecated).
> 
> Then came a separate WEBGL_color_buffer_float extension, but seems only
> Firefox implements this. But even with this, it's still missing
> corresponding EXT_color_buffer_half_float for half-float render targets, so
> right now it's not possible to render into half-floats in Firefox.
> 
> Chrome solves this by supporting just OES_texture_half_float and
> OES_texture_half_float_linear, but with also allowing rendering into
> half-float render targets.

Awesome, thanks for narrowing this down. The solution is simple, I think. (If I can trust my own code comments!) I filed bug 1130616 for this.
(In reply to pirk from comment #19) 
> Yes it is fixed in Beta (36.0). Release date is 2015-02-24, right? Thanks
> for the fast reply!

All is here: https://wiki.mozilla.org/Releases
By fixing  Bug 1130616 , the animation_physics demos are one again working.
(In reply to Loic from comment #22)
> (In reply to pirk from comment #19) 
> > Yes it is fixed in Beta (36.0). Release date is 2015-02-24, right? Thanks
> > for the fast reply!
> 
> All is here: https://wiki.mozilla.org/Releases

Thank you.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.