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

Issue 666259 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Closed: Feb 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug

Blocking:
issue 690959



Sign in to add a comment

WebGL canvas with no alpha failing to render with alpha clear color

Reported by d...@playcanvas.com, Nov 17 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36

Steps to reproduce the problem:
Visit https://playcanv.as/e/b/UtouzLdf/ - this page has a webgl canvas with alpha=false . This seems to display the wrong behaviour

Visit https://playcanv.as/e/b/mrLWEUOh/ - this page has a webgl canvas with alpha=true . This seems to display the correct behaviour

In both applications the the canvas is cleared to #FFFFFF00

What is the expected behavior?
In the first example, in all browsers except Chrome on OSX you see a cube on a white background. In Chrome OSX you see a plain white canvas.

In the second example, behaviour differs between browsers, Safari shows a dark background all others show a white background. All browsers display the cube.

What went wrong?
Cube is not rendered when alpha=false

Did this work before? N/A 

Does this work in other browsers? N/A

Chrome version: 54.0.2840.98  Channel: stable
OS Version: OS X 10.11.6
Flash Version: Shockwave Flash 23.0 r0
 

Comment 1 by kbr@chromium.org, Nov 17 2016

Cc: erikc...@chromium.org
Status: Available (was: Unconfirmed)
Please try setting "premultipliedAlpha: false" in your context creation attributes. Currently you're assuming the alpha channel is treated separately from the color channels, but the context creation attribute "premultipliedAlpha" defaults to "true". This means that if you produce a color whose red, green or blue values is larger than the alpha value, the color is illegal (out of range) and its on-screen rendering will be browser-dependent.

I agree it seems likely there is a bug in Chrome for the first example -- the contents of the alpha channel shouldn't matter. But the second example's differing behavior is probably not a bug in Safari.

Comment 2 by kbr@chromium.org, Nov 17 2016

Owner: kainino@chromium.org
Status: Assigned (was: Available)
Kai, do you think you could help investigate Chrome's behavior with the first example? It might be a regression in how we handle alpha:false WebGL canvases.

Comment 3 by kbr@chromium.org, Nov 17 2016

--disable-webgl-image-chromium (from some of the GPU tests -- do a code search) may affect the behavior here; that's the first thing to check.

Comment 4 by kbr@chromium.org, Nov 17 2016

Note: this might now be controlled with something like:
  --disable-features=WebGLImageChromium
Not sure, please check.

Status: Started (was: Assigned)
Those flags do not appear to affect the behavior. Still searching.

P.S. Any of:
--disable-webgl-image-chromium
--disable-features=WebGLImageChromium
--disable-blink-features=WebGLImageChromium
work.
Project Member

Comment 6 by bugdroid1@chromium.org, Dec 2 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4259dbb0600a71bcff06f342294fe1546bec9f08

commit 4259dbb0600a71bcff06f342294fe1546bec9f08
Author: kainino <kainino@chromium.org>
Date: Fri Dec 02 04:02:23 2016

Prevent implicit framebuffer clear from clobbering alpha in emulated RGB

In the case of emulated RGB framebuffers (for alpha:false on Mac, where it is
backed by an RGBA IOSurface), the implicit framebuffer clear (due to
preserveDrawingBuffer:false) could sometimes clobber the alpha channel of the
RGBA IOSurface (which should always be 1.0).

BUG= 666259 
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2535173002
Cr-Commit-Position: refs/heads/master@{#435850}

[add] https://crrev.com/4259dbb0600a71bcff06f342294fe1546bec9f08/content/test/data/gpu/pixel_webgl_noalpha_implicit_clear.html
[modify] https://crrev.com/4259dbb0600a71bcff06f342294fe1546bec9f08/content/test/gpu/gpu_tests/pixel_expectations.py
[modify] https://crrev.com/4259dbb0600a71bcff06f342294fe1546bec9f08/content/test/gpu/gpu_tests/pixel_test_pages.py
[modify] https://crrev.com/4259dbb0600a71bcff06f342294fe1546bec9f08/third_party/WebKit/Source/modules/webgl/WebGL2RenderingContextBase.cpp
[modify] https://crrev.com/4259dbb0600a71bcff06f342294fe1546bec9f08/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.cpp
[modify] https://crrev.com/4259dbb0600a71bcff06f342294fe1546bec9f08/third_party/WebKit/Source/modules/webgl/WebGLRenderingContextBase.h
[modify] https://crrev.com/4259dbb0600a71bcff06f342294fe1546bec9f08/third_party/WebKit/Source/platform/graphics/gpu/DrawingBuffer.cpp

This has been fixed, but I still need to remove the pixel test failure once the golden images are generated and verified:
https://codereview.chromium.org/2535173002/diff/80001/content/test/gpu/gpu_tests/pixel_expectations.py

Comment 8 by kbr@chromium.org, Feb 10 2017

Blocking: 690959
Cc: kainino@chromium.org ligim...@chromium.org zmo@chromium.org ccameron@chromium.org dat1...@gmail.com
 Issue 690959  has been merged into this issue.
Project Member

Comment 10 by bugdroid1@chromium.org, Feb 11 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c0e5d3dd86889273b81949ad73f2a0994fbfb4cf

commit c0e5d3dd86889273b81949ad73f2a0994fbfb4cf
Author: kainino <kainino@chromium.org>
Date: Sat Feb 11 01:15:20 2017

Remove temporary expectation from pixel_expectations.py

Pixel_WebGLTransparentGreenTriangle_NoAlpha_ImplicitClear

BUG= 666259 
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel;master.tryserver.chromium.android:android_optional_gpu_tests_rel

Review-Url: https://codereview.chromium.org/2686323002
Cr-Commit-Position: refs/heads/master@{#449815}

[modify] https://crrev.com/c0e5d3dd86889273b81949ad73f2a0994fbfb4cf/content/test/gpu/gpu_tests/pixel_expectations.py

Status: Fixed (was: Started)

Sign in to add a comment