Skip to content
Permalink
Browse files
Multisampling does not work on MTLGPUFamilyApple2 devices when using …
…ANGLE Metal

https://bugs.webkit.org/show_bug.cgi?id=241456
<rdar://problem/90949957>

Patch by Kimmo Kinnunen <kkinnunen@apple.com> on 2022-06-09
Reviewed by Dean Jackson.

Use OpenGL ES for WebGL for devices prior to MTLGPUFamilyApple3.
WebGL2 already was running OpenGL ES for these devices for different reasons.

The multisample codepath is not implemented for Apple2 which
does not support MTLStoreActionStoreAndMultisampleResolve.

* Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm:
(WebCore::platformSupportsMetal):
(WebCore::GraphicsContextGLCocoa::platformInitializeContext):

Canonical link: https://commits.webkit.org/251437@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295431 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
kkinnunen-apple authored and webkit-commit-queue committed Jun 9, 2022
1 parent 4c12dfb commit d386d621d0d700125a00f27d897d89b4326d8171
Showing 1 changed file with 4 additions and 7 deletions.
@@ -99,18 +99,15 @@ static bool checkVolatileContextSupportIfDeviceExists(EGLDisplay display, const
}
#endif

static bool platformSupportsMetal(bool isWebGL2)
static bool platformSupportsMetal()
{
auto device = adoptNS(MTLCreateSystemDefaultDevice());

if (device) {
#if PLATFORM(IOS_FAMILY) && !PLATFORM(IOS_FAMILY_SIMULATOR)
// A8 devices (iPad Mini 4, iPad Air 2) cannot use WebGL2 via Metal.
// A8 devices (iPad Mini 4, iPad Air 2) cannot use WebGL via Metal.
// This check can be removed once they are no longer supported.
if (isWebGL2)
return [device supportsFamily:MTLGPUFamilyApple3];
#else
UNUSED_PARAM(isWebGL2);
return [device supportsFamily:MTLGPUFamilyApple3];
#endif
return true;
}
@@ -247,7 +244,7 @@ static bool needsEAGLOnMac()
{
GraphicsContextGLAttributes attributes = contextAttributes();
m_isForWebGL2 = attributes.webGLVersion == GraphicsContextGLWebGLVersion::WebGL2;
if (attributes.useMetal && !platformSupportsMetal(m_isForWebGL2)) {
if (attributes.useMetal && !platformSupportsMetal()) {
attributes.useMetal = false;
setContextAttributes(attributes);
}

0 comments on commit d386d62

Please sign in to comment.