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

Issue 628954 link

Starred by 2 users

Issue metadata

Status: Fixed
Owner:
Closed: Aug 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Windows , Mac
Pri: 1
Type: Bug

Blocked on:
issue angleproject:1228
issue 626431

Blocking:
issue 295792



Sign in to add a comment

conformance/textures/image_bitmap_from_canvas fails in WebGL2 on Win/Mac

Project Member Reported by zmo@chromium.org, Jul 17 2016

Issue description

Open chrome browser with --enable-unsafe-es3-apis

goto https://www.khronos.org/registry/webgl/sdk/tests/webgl-conformance-tests.html?version=2.0.0

run the conformance/textures/image_bitmap_from_canvas tests, they all fail with an INVALID_OPERATION generated in command buffer.

However, if you run conformance2/textures/image_bitmap_from_canvas, these tests all pass.

Such failures are only seen on Windows and Mac, but not on Linux.  The reason is Linux does not GPU accelerate 2D canvas.
 
updates:

I have build chrome locally on a Mac desktop, and both conformance and conformance2 tests are passing. Here are my command for running the tests:

content/test/gpu/run_gpu_test.py webgl_conformance --show-stdout --browser=default -v '--extra-browser-args=--enable-logging=stderr --enable-unsafe-es3-apis' --story-filter=conformance_textures_image_bitmap_from_canvas*

content/test/gpu/run_gpu_test.py webgl_conformance --show-stdout --browser=default -v '--extra-browser-args=--enable-logging=stderr --enable-unsafe-es3-apis --js-flags=--expose-gc' '--webgl-conformance-version=2.0.0' '--webgl2-only=true' --story-filter=conformance2_textures_image_bitmap_from_canvas*

Am I missing some argument in the command line?

I am building chrome on Win10 now, it is slow, may take another hour.

Comment 2 by zmo@chromium.org, Jul 18 2016

That's because we mark the tests as expected to fail.

You can just open chrome browser with --enable-unsafe-es3-apis and see them fail in WebGL 2.
Blockedon: 626431
Labels: OS-Linux
reproducible on Linux as well, we just need to enable the "Accelerated 2D canvas" on chrome://flags
updates:

In those tests, it is testing multiple cases like this:
cases = [
    {sub: false, ...},
    {sub: true, ...},
    ...
];

where sub is true indicating use of texSubImage2D. I found that by commenting out either one of these two, the entire tests pass, but running both fails. It is strange...
When running both, the error happens when sub is true, and the error message is:

[142990:142990:0719/093315:ERROR:texture_manager.cc(2203)] [.Offscreen-For-WebGL-0x1ed4b21aac00]GL ERROR :GL_INVALID_OPERATION : glTexSubImage2D: invalid internalformat/format/type combination

[142990:142990:0719/093315:ERROR:vertex_attrib_manager.cc(202)] [.Offscreen-For-WebGL-0x1ed4b21aac00]GL ERROR :GL_INVALID_OPERATION : glDrawArrays: attempt to access out of range vertices in attribute 0

I did a fprintf on internalformat/format/type, and the internalformat for texSubImage2D is always 0, the format/type combinations are:

6408  5121
6408  32819
6408  32820
6407  5121
6407  33635
Just an extra info:

The bug can be reproducible on linux by running the conformance tests using the following command line:

content/test/gpu/run_gpu_test.py webgl_conformance --show-stdout --browser=default -v '--extra-browser-args=--ignore-gpu-blacklist --enable-unsafe-es3-apis' '--webgl-conformance-version=2.0.0' --story-filter=conformance_textures_image_bitmap_from_canvas*
Here is what I have found:

The tests will call the function canUseTexImageByGPU() to determine whether to use GPU-GPU texture copy or not. This function has this line:

if (functionID == TexSubImage2D && (isWebGL2OrHigher() ||...)
    return false;

So basically when doing TexSubImage2D with WebGL2, it always does a GPU memory readback, that somehow fails. If I make it a special case for ImageBitmap, and asking it to do GPU-GPU texture copy for conformance1 tests, they will pass.

Is there a good way to test whether a combination of format+type is a conformance1 test?

Comment 9 by zmo@chromium.org, Jul 19 2016

It seems to me the code path is confused about whether it's using readback path or GPU-GPU path somewhere. Even if we return false in canUseTexImageByGPU() and fall back to readback path.  It should just work (and it works on Linux when the canvas is not hardware accelerated).  So there must be a bug somewhere it's confused about whether it's readback path or GPU-GPU path.
In each html test file, it includes multiple test cases like this:
cases = [
    {sub: false, ...},
    {sub: true, ...},
    ...
];

Using fprintf I can see that it does GPU-GPU path when sub=false, and using readback path when sub=true, the problem is that it gives the error when doing the readback path, which makes no sense...

Comment 11 by zmo@chromium.org, Jul 19 2016

I suggest you compare the code paths on Linux between when you enable accelerated 2d canvas and when you disable it. You should have a feeling where things go run when the path begin to differ.

In WebGL 2, they should both go down the the readback path (until we fix the copy{Sub}TextureCHROMIUM to work for all formats).
Project Member

Comment 12 by bugdroid1@chromium.org, Jul 20 2016

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

commit f5c988930b7a2f2aacd7cabf2573caeed2770b69
Author: xidachen <xidachen@chromium.org>
Date: Wed Jul 20 20:48:31 2016

Invalidate m_image after GPU-GPU texture copy

The image_bitmap_from_canvas conformance1 tests are failing with WebGL
2.0. It fails in this case:
Call texImage2D(ImageBitmap), which does GPU-GPU texture copy. Then
call texSubImage2D(ImageBitmap), which does GPU readback. In the call
to texSubImage2D, there is a error says glTexSubImage2D: invalid
internalformat/format/type combination, which doesn't make sense.

The solution here is to set m_image to be null after GPU-GPU texture
copy. So next time when m_image is needed, it has to use a new context
provider to consume the mailbox to get a new m_image.

To make sure this CL does the right thing, I have tested the following:
conformance1 tests with WebGL 1.0 and 2.0 (with GPU accelerated canvas)
conformance2 tests (with GPU accelerated canvas, WebGL 2.0 only)
layout tests:
fast/canvas/,
virtual/gpu/fast/canvas,
virtual/display_list_2d_canvas/fast/canvas.
All the above tests pass.

When committing this CL, we should add the optional GPU bots to make
sure they are green.

BUG= 628954 
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

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

[modify] https://crrev.com/f5c988930b7a2f2aacd7cabf2573caeed2770b69/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py
[modify] https://crrev.com/f5c988930b7a2f2aacd7cabf2573caeed2770b69/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.cpp
[modify] https://crrev.com/f5c988930b7a2f2aacd7cabf2573caeed2770b69/third_party/WebKit/Source/platform/graphics/StaticBitmapImage.h

Just double checked on windows with canary:

With --enable-unsafe-es3-apis, there are still 3 formats failed on windows which are unsigned_short_5_6_5, unsigned_short_4_4_4_4, unsigned_short_5_5_5_1

With --enable-unsafe-es3-apis --use-gl=desktop, these three formats passes.

Comment 14 by zmo@chromium.org, Jul 21 2016

Cc: geoffl...@chromium.org cwallez@chromium.org xidac...@chromium.org
Owner: jmad...@chromium.org
jmadill said he will look into ANGLE.
Status: Started (was: Assigned)
Looking.
Blockedon: angleproject:1228
This is actually a duplicate of the same issue with CopyTexImage validation and unsized formats. Will look at fixing this today.
Project Member

Comment 17 by bugdroid1@chromium.org, Jul 23 2016

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

commit dd5bcd3ee0e38d0622de580545fdfe43f4131395
Author: jmadill <jmadill@chromium.org>
Date: Sat Jul 23 18:33:17 2016

WebGL 2: Update expectations.

BUG= 628954 ,  483282 , 478572
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
TBR=zmo@chromium.org
NOTRY=true

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

[modify] https://crrev.com/dd5bcd3ee0e38d0622de580545fdfe43f4131395/content/test/gpu/gpu_tests/webgl2_conformance_expectations.py

Status: Fixed (was: Started)

Sign in to add a comment