Bug 118464 - REGRESSION(r151957): WebGL textures do not show
Summary: REGRESSION(r151957): WebGL textures do not show
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGL (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P1 Critical
Assignee: Csaba Osztrogonác
URL:
Keywords:
Depends on:
Blocks: 116041
  Show dependency treegraph
 
Reported: 2013-07-08 04:46 PDT by Tomasz Morawski
Modified: 2013-07-10 01:47 PDT (History)
13 users (show)

See Also:


Attachments
Texture loading test case (3.30 KB, application/octet-stream)
2013-07-09 04:28 PDT, Karol
no flags Details
Patch (3.16 KB, patch)
2013-07-09 09:44 PDT, Csaba Osztrogonác
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomasz Morawski 2013-07-08 04:46:02 PDT
Currently, WebGL textures do not show at all. It seems that the patch: 

Checking if frame is complete and access duration doesn't need a decode
https://bugs.webkit.org/show_bug.cgi?id=116041

is responsible for the regression. Moreover, one of Kronos conformance don't pass now.
https://www.khronos.org/registry/webgl/sdk/tests/conformance/textures/gl-teximage.html

Please also check any webgl sample that uses textures like this one: http://webglsamples.googlecode.com/hg/aquarium/aquarium.html

Tested on EFL port only.
Comment 1 Csaba Osztrogonác 2013-07-08 08:47:25 PDT
Thanks for reporting. I can confirm, http://trac.webkit.org/changeset/151957 is responsible for this bug on EFL and Nix too. Reverting this patch locally
solved the bug for me. (aquarius example and the khronos test too)

Additionally I checked it on Qt too and it works fine with and without 
this patch. I have an idea, maybe it is related to Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp somehow. Let me try to debug it.
Comment 2 Csaba Osztrogonác 2013-07-08 08:50:53 PDT
I got the following errors on the khronos test with Nix:

$ WebKitBuild/Release/bin/MiniBrowser https://www.khronos.org/registry/webgl/sdk/tests/conformance/textures/gl-teximage.html
MiniBrowser: Use Alt + Left and Alt + Right to navigate back and forward. Use F5 to reload.
Touch Emulation Mode enabled. Hold Control key to build and emit a multi-touch event: each mouse button should be a different touch point. Release Control Key to clear all tracking pressed touches.
Use Control + mouse wheel to zoom in and out.
[js:2099] requestAnimationFrame
[js:2099] cancelAnimationFrame
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
[js:0] WebGL: INVALID_VALUE: texImage2D: bad image data
X Error of failed request:  GLXBadPixmap
  Major opcode of failed request:  135 (GLX)
  Minor opcode of failed request:  16 (X_GLXVendorPrivate)
  Serial number of failed request:  0
  Current serial number in output stream:  28
Comment 3 Csaba Osztrogonác 2013-07-08 08:57:55 PDT
(In reply to comment #1)
> I have an idea, maybe it is related to Source/WebCore/platform/graphics/cairo/ImageBufferCairo.cpp somehow. Let me try to debug it.

Or BitmapImageCairo.cpp.
Comment 4 Karol 2013-07-09 04:28:39 PDT
Created attachment 206306 [details]
Texture loading test case

I prepared test case showing where problem can be:

At first it creates texture (no problem)
Than loads data to texture from array buffer (no problem)
Than attempts to load texture from separate *.png image (problem)

It passes on older version of webkit and in other browsers.
Comment 5 Csaba Osztrogonác 2013-07-09 09:12:55 PDT
I got the bug. ;)

The problem is that GraphicsContext3D::ImageExtractor::extractImage(...)
in Source/WebCore/platform/graphics/efl/GraphicsContext3DEfl.cpp returns
with false if !decoder.frameIsCompleteAtIndex(0).

Before r151957 frameIsCompleteAtIndex(...) called m_decoder->frameBufferAtIndex(...) which ensured that the image will be decoded:

-    ImageFrame* buffer = m_decoder->frameBufferAtIndex(index);
-    return buffer && buffer->status() == ImageFrame::FrameComplete;
+    return m_decoder && m_decoder->frameIsCompleteAtIndex(index);


But after r151957 frameIsCompleteAtIndex(...) doesn't trigger decoding,

Fix is coming soon.
Comment 6 Csaba Osztrogonác 2013-07-09 09:44:44 PDT
Created attachment 206331 [details]
Patch
Comment 7 Csaba Osztrogonác 2013-07-09 09:48:41 PDT
(In reply to comment #6)
> Created an attachment (id=206331) [details]
> Patch

Tested on EFL and Nix too. And it fixed the bug, of course. :)
Comment 8 Peter Kasting 2013-07-09 10:15:23 PDT
Comment on attachment 206331 [details]
Patch

I can confirm that this is what Chromium does.
Comment 9 Csaba Osztrogonác 2013-07-10 00:55:10 PDT
ping for review :)
Comment 10 Kalyan 2013-07-10 01:33:42 PDT
(In reply to comment #9)
> ping for review :)

Thanks for the fix. LGTM
Comment 11 Chris Dumez 2013-07-10 01:35:31 PDT
Comment on attachment 206331 [details]
Patch

R=me.
Comment 12 WebKit Commit Bot 2013-07-10 01:47:14 PDT
Comment on attachment 206331 [details]
Patch

Clearing flags on attachment: 206331

Committed r152531: <http://trac.webkit.org/changeset/152531>
Comment 13 WebKit Commit Bot 2013-07-10 01:47:18 PDT
All reviewed patches have been landed.  Closing bug.