Bug 204446

Summary: [GTK] Check EGL image extension by using native gl API in AcceleratedBackingStoreWayland
Product: WebKit Reporter: ChangSeok Oh <changseok>
Component: WebKitGTKAssignee: ChangSeok Oh <changseok>
Status: RESOLVED FIXED    
Severity: Normal CC: bugs-noreply, cgarcia, commit-queue, zan
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 199060    
Attachments:
Description Flags
Patch
none
Patch
none
Patch none

Description ChangSeok Oh 2019-11-21 00:28:05 PST
This is part of efforts bringing ANGLE support for WebGL to gtk port.
Comment 1 ChangSeok Oh 2019-11-21 00:50:27 PST
Created attachment 384034 [details]
Patch
Comment 2 ChangSeok Oh 2019-11-21 01:07:59 PST
Created attachment 384035 [details]
Patch
Comment 3 Carlos Garcia Campos 2019-11-22 05:04:04 PST
Comment on attachment 384035 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=384035&action=review

> Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:84
> +        if (!availableExtensions.contains("GL_ARB_texture_storage"_s)) {
> +            GLint majorVersion;
> +            ::glGetIntegerv(GL_MAJOR_VERSION, &majorVersion);
> +            GLint minorVersion;
> +            ::glGetIntegerv(GL_MINOR_VERSION, &minorVersion);
> +            if (majorVersion > 4 || (majorVersion == 4 && minorVersion >= 2))
> +                availableExtensions.add("GL_ARB_texture_storage"_s);
> +            }

We can simply this, since are only interested in GL_OES_EGL_image and glEGLImageTargetTexture2DOES we don't need to handle this exception here for GL_ARB_texture_storage.

> Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:115
> +        if (availableExtensions.contains("GL_OES_EGL_image") || availableExtensions.contains("GL_OES_EGL_image_external"))

If we are going to build the list of extensions here, we can simplify this even more. Let's just add checkEGLImageAvailable (or something like that) and check any of those are available using the gl api directly, instead of first building a has set to then check if any of those are present.
Comment 4 ChangSeok Oh 2019-11-23 01:54:57 PST
Created attachment 384234 [details]
Patch
Comment 5 ChangSeok Oh 2019-11-23 01:55:53 PST
Comment on attachment 384035 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=384035&action=review

>> Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:84
>> +            }
> 
> We can simply this, since are only interested in GL_OES_EGL_image and glEGLImageTargetTexture2DOES we don't need to handle this exception here for GL_ARB_texture_storage.

You're right.

>> Source/WebKit/UIProcess/gtk/AcceleratedBackingStoreWayland.cpp:115
>> +        if (availableExtensions.contains("GL_OES_EGL_image") || availableExtensions.contains("GL_OES_EGL_image_external"))
> 
> If we are going to build the list of extensions here, we can simplify this even more. Let's just add checkEGLImageAvailable (or something like that) and check any of those are available using the gl api directly, instead of first building a has set to then check if any of those are present.

That is a good suggestion. Thanks!
Comment 6 WebKit Commit Bot 2019-11-25 02:08:46 PST
Comment on attachment 384234 [details]
Patch

Clearing flags on attachment: 384234

Committed r252851: <https://trac.webkit.org/changeset/252851>
Comment 7 WebKit Commit Bot 2019-11-25 02:08:48 PST
All reviewed patches have been landed.  Closing bug.