Bug 42118

Summary: Detect necessary OpenGL extensions and fail to create WebGL context if not present
Product: WebKit Reporter: Sam Weinig <sam>
Component: WebGLAssignee: Chris Marrin <cmarrin>
Status: RESOLVED FIXED    
Severity: Normal CC: bfulgham, cmarrin, kbr, ossy, tonikitoo, zmo
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Bug Depends on:    
Bug Blocks: 43381    
Attachments:
Description Flags
Diffs from Sam Weinig between available GL extensions on machine where tests are working vs. not working
none
Patch to disable WebGL on Leopard
none
replacement patch - forgot to disable in WebKit and JavaScriptCore projects
none
Disable compositing/webgl tests if WebGL not enabled
none
Disable compositing/webgl tests if WebGL not enabled none

Sam Weinig
Reported 2010-07-12 16:50:18 PDT
Some of the WebGL tests don't pass if GL_ARB_framebuffer_object extension is not present. We should be falling back to the software renderer in this case.
Attachments
Diffs from Sam Weinig between available GL extensions on machine where tests are working vs. not working (5.41 KB, text/plain)
2010-07-12 19:00 PDT, Kenneth Russell
no flags
Patch to disable WebGL on Leopard (3.02 KB, patch)
2010-07-19 14:01 PDT, Chris Marrin
no flags
replacement patch - forgot to disable in WebKit and JavaScriptCore projects (5.76 KB, patch)
2010-07-19 14:10 PDT, Chris Marrin
no flags
Disable compositing/webgl tests if WebGL not enabled (2.01 KB, patch)
2010-07-20 10:34 PDT, Chris Marrin
no flags
Disable compositing/webgl tests if WebGL not enabled (1023 bytes, patch)
2010-07-20 10:34 PDT, Chris Marrin
no flags
Sam Weinig
Comment 1 2010-07-12 16:52:05 PDT
Specifically, fast/canvas/webgl/context-attributes-alpha-depth-stencil-antialias.html fast/canvas/webgl/copy-tex-image-and-sub-image-2d.html fast/canvas/webgl/gl-uniformmatrix4fv.html fast/canvas/webgl/index-validation-with-resized-buffer.html fast/canvas/webgl/point-size.html fast/canvas/webgl/tex-image-and-sub-image-2d-with-array-buffer-view.html fast/canvas/webgl/tex-image-and-sub-image-2d-with-image-data.html fast/canvas/webgl/texture-active-bind.html fast/canvas/webgl/viewport-unchanged-upon-resize.html don't pass.
Sam Weinig
Comment 2 2010-07-12 17:19:07 PDT
Kenneth Russell
Comment 3 2010-07-12 18:59:12 PDT
It isn't 100% clear that the lack of ARB_framebuffer_object is the most specific root cause. The Mac port assumes EXT_framebuffer_object and uses those entry points, which appear to be present on the machine in question. Sam provided a diff between the GL extensions on a machine where the tests work and on the machine where they're failing. Attaching this list separately. Note that EXT_framebuffer_object is present, though EXT_framebuffer_blit and EXT_framebuffer_multisample aren't, so antialiasing won't work -- but the WebGL implementation should notice that and simply disable antialiasing. There might be a problem, seen on Macs with older ATI drivers, using non-power-of-two textures as color attachments to framebuffer objects. On these older machines it was necessary to use a GL_TEXTURE_RECTANGLE_ARB texture for the WebGL back buffer.
Kenneth Russell
Comment 4 2010-07-12 19:00:16 PDT
Created attachment 61311 [details] Diffs from Sam Weinig between available GL extensions on machine where tests are working vs. not working
Chris Marrin
Comment 5 2010-07-19 14:01:48 PDT
Created attachment 61988 [details] Patch to disable WebGL on Leopard
Chris Marrin
Comment 6 2010-07-19 14:10:16 PDT
Created attachment 61990 [details] replacement patch - forgot to disable in WebKit and JavaScriptCore projects
Chris Marrin
Comment 7 2010-07-19 14:21:42 PDT
Leopard build disabled in http://trac.webkit.org/changeset/63688
Csaba Osztrogonác
Comment 8 2010-07-19 22:57:24 PDT
r63688 broke 2 tests on Leopard bots: compositing/webgl/webgl-background-color.html compositing/webgl/webgl-reflection.html http://build.webkit.org/results/Leopard%20Intel%20Release%20%28Tests%29/r63719%20%2817931%29/results.html I think we should commit these expected fails for mac-leopard platform to make buildbots happy.
Chris Marrin
Comment 9 2010-07-20 06:52:24 PDT
It appears that no driver for any Mac system before 10.6.3 supports this extension, not even the software renderer. Here is a nice chart that shows all the supported extensions: http://developer.apple.com/graphicsimaging/opengl/capabilities/index.html So our only choice for now is to turn off WebGL when the extension is not present. That means not running on any system before 10.6.3 and falling back to the software renderer on some hardware after that.
Kenneth Russell
Comment 10 2010-07-20 09:31:43 PDT
(In reply to comment #9) > It appears that no driver for any Mac system before 10.6.3 supports this extension, not even the software renderer. Here is a nice chart that shows all the supported extensions: > > http://developer.apple.com/graphicsimaging/opengl/capabilities/index.html > > So our only choice for now is to turn off WebGL when the extension is not present. That means not running on any system before 10.6.3 and falling back to the software renderer on some hardware after that. This seems drastic. WebGL has been working fine for me on a Mac Pro running 10.5.8 with a GeForce GT 210. Problems are seen with the GeForce 7300 GT. I have gotten access to such a machine over the past couple of days and done some investigation into why WebGL fails to allocate its back buffer. One reason is that the color buffer needs to be a minimum of 16x16, apparently to meet alignment restrictions of this card's back buffer. However, after performing this rounding up, the depth buffer still fails to attach properly. The FBOBunnies sample from Apple's developer web site runs fine, however. I'm continuing to investigate the differences between WebGL's setup code and that from this sample.
Chris Marrin
Comment 11 2010-07-20 10:34:15 PDT
Created attachment 62091 [details] Disable compositing/webgl tests if WebGL not enabled
Chris Marrin
Comment 12 2010-07-20 10:34:46 PDT
Created attachment 62092 [details] Disable compositing/webgl tests if WebGL not enabled
Chris Marrin
Comment 13 2010-07-20 10:35:18 PDT
Comment on attachment 62092 [details] Disable compositing/webgl tests if WebGL not enabled This patch replaces the previous one, which had some spurious diffs
Eric Seidel (no email)
Comment 14 2010-07-22 18:40:03 PDT
Comment on attachment 61988 [details] Patch to disable WebGL on Leopard Cleared Darin Adler's review+ from obsolete attachment 61988 [details] so that this bug does not appear in http://webkit.org/pending-commit.
Eric Seidel (no email)
Comment 15 2010-07-22 18:40:09 PDT
Comment on attachment 61990 [details] replacement patch - forgot to disable in WebKit and JavaScriptCore projects Cleared Darin Adler's review+ from obsolete attachment 61990 [details] so that this bug does not appear in http://webkit.org/pending-commit.
Chris Marrin
Comment 16 2010-07-23 09:21:02 PDT
I was mistaken about support for framebuffer objects in Leopard. It's true that GL_ARB_framebuffer_object is not supported anywhere before 10.6.3, but the GL_EXT_framebuffer_object extension is supported in 10.5.8 on some hardware and the software renderer. So we can actually run on Leopard, but on some hardware it will be slow because of the software renderer. I am working on a patch that checks for this extension and disables WebGL if it's not present. That will make sure we fall back to the software renderer as needed and will make sure WebGL doesn't try to run on older OS's that don't have this extension.
Zhenyao Mo
Comment 17 2010-07-23 19:04:41 PDT
(In reply to comment #16) > I was mistaken about support for framebuffer objects in Leopard. It's true that GL_ARB_framebuffer_object is not supported anywhere before 10.6.3, but the GL_EXT_framebuffer_object extension is supported in 10.5.8 on some hardware and the software renderer. So we can actually run on Leopard, but on some hardware it will be slow because of the software renderer. I am working on a patch that checks for this extension and disables WebGL if it's not present. That will make sure we fall back to the software renderer as needed and will make sure WebGL doesn't try to run on older OS's that don't have this extension. Can we roll out the original patch first? My dev machine is a leopard, so now I have to unapply this patch for coding/testing, then apply this patch for code-review and commiting. It's such a pain.
Chris Marrin
Comment 18 2010-07-26 11:19:30 PDT
I've made this a more general bug of making sure we have all the necessary OpenGL extensions present. This will cause us to fallback to the software renderer if a driver does not have the functionality, or fail to create a WebGL context if even the software renderer does not have it.
Adam Barth
Comment 19 2010-08-10 22:58:06 PDT
Comment on attachment 62092 [details] Disable compositing/webgl tests if WebGL not enabled Clearing simon.fraser's r+. This patch appears to have landed.
Brent Fulgham
Comment 20 2014-01-09 20:35:23 PST
This code is already landed.
Note You need to log in before you can comment on or make changes to this bug.