Skip to content

Commit

Permalink
[110] Disable SwiftShader for WebGL on M1 Macs.
Browse files Browse the repository at this point in the history
SwiftShader's LLVM 10 doesn't fully support code generation on ARM.
Continue to support SwiftShader for rasterization which is used in
testing and explicitly requested through flags.

(cherry picked from commit ceef12f)

Bug: chromium:1378476
Change-Id: If452edabb9ca385cb40dbb33c9591814bd862396
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4133390
Reviewed-by: Kenneth Russell <kbr@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Cr-Original-Commit-Position: refs/heads/main@{#1088867}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4143761
Reviewed-by: Prudhvikumar Bommana <pbommana@google.com>
Commit-Queue: Prudhvikumar Bommana <pbommana@google.com>
Cr-Commit-Position: refs/branch-heads/5481@{#159}
Cr-Branched-From: 130f3e4-refs/heads/main@{#1084008}
  • Loading branch information
vonture authored and Chromium LUCI CQ committed Jan 6, 2023
1 parent 36c8840 commit 2a352cd
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ui/gl/gl_context_egl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#include "ui/gl/gl_gl_api_implementation.h"
#include "ui/gl/gl_surface_egl.h"

#if BUILDFLAG(IS_APPLE)
#include "base/mac/mac_util.h"
#endif

#ifndef EGL_CHROMIUM_create_context_bind_generates_resource
#define EGL_CHROMIUM_create_context_bind_generates_resource 1
#define EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM 0x33AD
Expand Down Expand Up @@ -174,6 +178,18 @@ bool GLContextEGL::Initialize(GLSurface* compatible_surface,

bool is_swangle = IsSoftwareGLImplementation(GetGLImplementationParts());

#if BUILDFLAG(IS_APPLE)
if (is_swangle && attribs.webgl_compatibility_context &&
base::mac::GetCPUType() == base::mac::CPUType::kArm) {
// crbug.com/1378476: LLVM 10 is used as the JIT compiler for SwiftShader,
// which doesn't fully support ARM. Disable Swiftshader on ARM CPUs for
// WebGL until LLVM is upgraded.
DVLOG(1) << __FUNCTION__
<< ": Software WebGL contexts are not supported on ARM MacOS.";
return false;
}
#endif

if (gl_display_->ext->b_EGL_EXT_create_context_robustness || is_swangle) {
DVLOG(1) << "EGL_EXT_create_context_robustness supported.";
context_attributes.push_back(EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT);
Expand Down

0 comments on commit 2a352cd

Please sign in to comment.