Changeset 247422 in webkit


Ignore:
Timestamp:
Jul 14, 2019 1:21:38 PM (5 years ago)
Author:
dino@apple.com
Message:

WebGL not supported on WKWebView on UIKit for Mac
https://bugs.webkit.org/show_bug.cgi?id=199785
<rdar://problem/52911449>

Reviewed by Antoine Quint.

Source/WebCore:

UIKit for Mac was not creating a CGLPixelFormatObj because
it wasn't using the code hidden in PLATFORM(MAC). Instead
we should be guarding for USE(OPENGL).

There are still some inconsistencies: <rdar://53062794>

Test: webgl/smell-test.html

  • platform/graphics/cocoa/GraphicsContext3DCocoa.mm:

(WebCore::GraphicsContext3D::GraphicsContext3D):
(WebCore::GraphicsContext3D::allowOfflineRenderers const): We have to return
true for this, since we don't have access to the Window Server.

Source/WTF:

MacCatalyst has Apple Graphics Control, although
this area is very messy, see <rdar://53062794>.

  • wtf/Platform.h:

LayoutTests:

Even though we don't yet run tests on UIKit for Mac, we
should have the most simple "is WebGL working?" ref test.

  • webgl/smell-test-expected.html: Added.
  • webgl/smell-test.html: Added.
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r247421 r247422  
     12019-07-14  Dean Jackson  <dino@apple.com>
     2
     3        WebGL not supported on WKWebView on UIKit for Mac
     4        https://bugs.webkit.org/show_bug.cgi?id=199785
     5        <rdar://problem/52911449>
     6
     7        Reviewed by Antoine Quint.
     8
     9        Even though we don't yet run tests on UIKit for Mac, we
     10        should have the most simple "is WebGL working?" ref test.
     11
     12        * webgl/smell-test-expected.html: Added.
     13        * webgl/smell-test.html: Added.
     14
    1152019-07-13  Wenson Hsieh  <wenson_hsieh@apple.com>
    216
  • trunk/Source/WTF/ChangeLog

    r247377 r247422  
     12019-07-14  Dean Jackson  <dino@apple.com>
     2
     3        WebGL not supported on WKWebView on UIKit for Mac
     4        https://bugs.webkit.org/show_bug.cgi?id=199785
     5        <rdar://problem/52911449>
     6
     7        Reviewed by Antoine Quint.
     8
     9        MacCatalyst has Apple Graphics Control, although
     10        this area is very messy, see <rdar://53062794>.
     11
     12        * wtf/Platform.h:
     13
    1142019-07-11  Myles C. Maxfield  <mmaxfield@apple.com>
    215
  • trunk/Source/WTF/wtf/Platform.h

    r247377 r247422  
    12181218#endif
    12191219
     1220#if PLATFORM(MAC) || PLATFORM(MACCATALYST)
     1221#define HAVE_APPLE_GRAPHICS_CONTROL 1
     1222#endif
     1223
    12201224#if PLATFORM(MAC)
    1221 #define HAVE_APPLE_GRAPHICS_CONTROL 1
    12221225#define USE_COREAUDIO 1
    12231226#endif
  • trunk/Source/WebCore/ChangeLog

    r247421 r247422  
     12019-07-14  Dean Jackson  <dino@apple.com>
     2
     3        WebGL not supported on WKWebView on UIKit for Mac
     4        https://bugs.webkit.org/show_bug.cgi?id=199785
     5        <rdar://problem/52911449>
     6
     7        Reviewed by Antoine Quint.
     8
     9        UIKit for Mac was not creating a CGLPixelFormatObj because
     10        it wasn't using the code hidden in PLATFORM(MAC). Instead
     11        we should be guarding for USE(OPENGL).
     12
     13        There are still some inconsistencies: <rdar://53062794>
     14
     15        Test: webgl/smell-test.html
     16
     17        * platform/graphics/cocoa/GraphicsContext3DCocoa.mm:
     18        (WebCore::GraphicsContext3D::GraphicsContext3D):
     19        (WebCore::GraphicsContext3D::allowOfflineRenderers const): We have to return
     20        true for this, since we don't have access to the Window Server.
     21
    1222019-07-13  Wenson Hsieh  <wenson_hsieh@apple.com>
    223
  • trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContext3DCocoa.mm

    r247315 r247422  
    181181}
    182182
    183 #if PLATFORM(MAC) && USE(OPENGL)
     183#if PLATFORM(MAC) && USE(OPENGL) // FIXME: This probably should be just USE(OPENGL) - see <rdar://53062794>.
    184184
    185185#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
     
    266266    , m_private(std::make_unique<GraphicsContext3DPrivate>(this))
    267267{
    268 #if USE(ANGLE)
    269     // In the ANGLE backend, the only shader compiler instantiated is
    270     // the one ANGLE uses internally.
    271 #else
    272 #if PLATFORM(IOS_FAMILY)
     268#if !USE(ANGLE)
     269#if USE(OPENGL_ES)
    273270    if (m_attrs.isWebGL2)
    274271        m_compiler = ANGLEWebKitBridge(SH_ESSL_OUTPUT, SH_WEBGL2_SPEC);
     
    278275    if (m_attrs.isWebGL2)
    279276        m_compiler = ANGLEWebKitBridge(SH_GLSL_410_CORE_OUTPUT, SH_WEBGL2_SPEC);
    280 #endif // PLATFORM(IOS_FAMILY)
    281 #endif // USE(ANGLE)
     277#endif // USE(OPENGL_ES)
     278#endif // !USE(ANGLE)
    282279
    283280#if USE(OPENGL_ES)
     
    297294    GLint numPixelFormats = 0;
    298295   
     296#if HAVE(APPLE_GRAPHICS_CONTROL)
     297    m_powerPreferenceUsedForCreation = (hasLowAndHighPowerGPUs() && attrs.powerPreference == GraphicsContext3DPowerPreference::HighPerformance) ? GraphicsContext3DPowerPreference::HighPerformance : GraphicsContext3DPowerPreference::Default;
     298#else
     299    m_powerPreferenceUsedForCreation = GraphicsContext3DPowerPreference::Default;
     300#endif
     301
    299302    // If we're configured to demand the software renderer, we'll
    300303    // do so. We attempt to create contexts in this order:
     
    309312    // 4) closest to 32 bit RGBA/16 bit depth/software renderer
    310313    //
    311     // If none of that works, we simply fail and set m_contextObj to 0.
     314    // If none of that works, we fail and leave m_contextObj as nullptr.
    312315
    313316    bool useMultisampling = m_attrs.antialias;
    314 
    315 #if HAVE(APPLE_GRAPHICS_CONTROL)
    316     m_powerPreferenceUsedForCreation = (hasLowAndHighPowerGPUs() && attrs.powerPreference == GraphicsContext3DPowerPreference::HighPerformance) ? GraphicsContext3DPowerPreference::HighPerformance : GraphicsContext3DPowerPreference::Default;
    317 #else
    318     m_powerPreferenceUsedForCreation = GraphicsContext3DPowerPreference::Default;
    319 #endif
    320317
    321318    setPixelFormat(attribs, 32, 32, !attrs.forceSoftwareRenderer, true, false, useMultisampling, attrs.isWebGL2, allowOfflineRenderers());
     
    323320
    324321    if (!numPixelFormats) {
    325         setPixelFormat(attribs, 32, 32, !attrs.forceSoftwareRenderer, false, false, useMultisampling, attrs.isWebGL2, allowOfflineRenderers());
     322        setPixelFormat(attribs, 32, 32, !attrs.forceSoftwareRenderer, true, false, useMultisampling, attrs.isWebGL2, allowOfflineRenderers());
    326323        CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
    327324
    328325        if (!numPixelFormats) {
    329             setPixelFormat(attribs, 32, 16, !attrs.forceSoftwareRenderer, false, false, useMultisampling, attrs.isWebGL2, allowOfflineRenderers());
     326            setPixelFormat(attribs, 32, 32, !attrs.forceSoftwareRenderer, false, false, useMultisampling, attrs.isWebGL2, allowOfflineRenderers());
    330327            CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
    331328
    332             if (!attrs.forceSoftwareRenderer && !numPixelFormats) {
    333                 setPixelFormat(attribs, 32, 16, false, false, true, false, attrs.isWebGL2, allowOfflineRenderers());
     329            if (!numPixelFormats) {
     330                setPixelFormat(attribs, 32, 16, !attrs.forceSoftwareRenderer, false, false, useMultisampling, attrs.isWebGL2, allowOfflineRenderers());
    334331                CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
    335                 useMultisampling = false;
     332
     333                if (!attrs.forceSoftwareRenderer && !numPixelFormats) {
     334                    setPixelFormat(attribs, 32, 16, false, false, true, false, attrs.isWebGL2, allowOfflineRenderers());
     335                    CGLChoosePixelFormat(attribs.data(), &pixelFormatObj, &numPixelFormats);
     336                    useMultisampling = false;
     337                }
    336338            }
    337339        }
     
    345347    CGLSetParameter(m_contextObj, kCGLCPAbortOnGPURestartStatusBlacklisted, &abortOnBlacklist);
    346348   
    347 #if PLATFORM(MAC)
     349#if PLATFORM(MAC) // FIXME: This probably should be USE(OPENGL) - see <rdar://53062794>.
    348350
    349351#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
     
    815817    if (primaryOpenGLDisplayMask())
    816818        return true;
     819#elif PLATFORM(MACCATALYST)
     820    // FIXME: <rdar://53062794> We're very inconsistent about WEBPROCESS_WINDOWSERVER_BLOCKING
     821    // and MAC/MACCATALYST and OPENGL/OPENGLES.
     822    return true;
    817823#endif
    818824       
Note: See TracChangeset for help on using the changeset viewer.