Bug 141178

Summary: [WebGL2] Use Open GL ES 3.0 to back WebGL2 contexts
Product: WebKit Reporter: Roger Fong <roger_fong>
Component: WebGLAssignee: Antoine Quint <graouts>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, clopez, commit-queue, dino, esprehn+autocc, graouts, gyuyoung.kim, kondapallykalyan, roger_fong, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Roger Fong 2015-02-02 15:24:25 PST
We currently have a way to create a WebGL2 context, but this context still uses the old OpenGL/GLES headers and contexts.
We need it to use the new OpenGL headers (gl3.h?) and the GLES 3.0 resources.

Ideally I would like to simply replace all instances of gl.h with gl3.h and GLES2.0 with GLES3.0 but I’m not sure the newer stuff is fully backwards compatible with the older stuff.

I know that if I have to do this I’ll have to replace calls in WebKit that use various extension calls (like renderbufferStorageMultisampleEXT)

If I cannot do this, I’ll have to create two different GraphicsContexts, one for WebGL2 and one for WebGL1, which would be unfortunate.
Comment 1 Carlos Alberto Lopez Perez 2015-07-10 11:01:27 PDT
I suggest you to take a look on libepoxy.

See https://bugs.webkit.org/show_bug.cgi?id=146680 for a summary of what this library can do, also check https://github.com/anholt/libepoxy

Maybe it can help with this problem ?
Comment 2 Antoine Quint 2016-04-11 02:50:00 PDT
Repurposing this bug to be about adopting Open GL ES 3.0 as a backend for WebGL2 contexts.
Comment 3 Radar WebKit Bug Importer 2016-04-11 02:52:01 PDT
<rdar://problem/25651492>
Comment 4 Antoine Quint 2016-04-11 02:54:22 PDT
Created attachment 276135 [details]
Patch
Comment 5 Dean Jackson 2016-04-11 12:10:10 PDT
Comment on attachment 276135 [details]
Patch

I wonder if there is a way to test this. Maybe by getParameter(RENDERER)? Although "This name is typically specific to a particular configuration of a hardware platform. It does not change from release to release."

Hmm, UNMASKED_RENDERER_WEBGL should probably work. You'd need to get it via the https://www.khronos.org/registry/webgl/extensions/WEBGL_debug_renderer_info/ extension. I think we have a testcase that can be used as a base.
Comment 6 Dean Jackson 2016-04-11 13:42:57 PDT
(In reply to comment #5)
> 
> Hmm, UNMASKED_RENDERER_WEBGL should probably work. You'd need to get it via
> the
> https://www.khronos.org/registry/webgl/extensions/WEBGL_debug_renderer_info/
> extension. I think we have a testcase that can be used as a base.

It doesn't. 

gl.getParameter(extension.UNMASKED_RENDERER_WEBGL) on an iOS device gives something like

Apple A8X GPU
Comment 7 Dean Jackson 2016-04-11 13:52:15 PDT
Comment on attachment 276135 [details]
Patch

Adding r+. I think we want to expose something via Internals that allows us to get more info on the context being used. Can you file a bug?
Comment 8 WebKit Commit Bot 2016-04-11 14:42:10 PDT
Comment on attachment 276135 [details]
Patch

Clearing flags on attachment: 276135

Committed r199314: <http://trac.webkit.org/changeset/199314>
Comment 9 WebKit Commit Bot 2016-04-11 14:42:17 PDT
All reviewed patches have been landed.  Closing bug.