Skip to content

Commit

Permalink
[web] force WebGL 1 on iOS (flutter#29038)
Browse files Browse the repository at this point in the history
  • Loading branch information
yjbanov authored Oct 6, 2021
1 parent ad66cbb commit 9fe5125
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/web_ui/lib/src/engine/browser_detection.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import 'dart:html' as html;

import 'package:meta/meta.dart';

// iOS 15 launched WebGL 2.0, but there's something broken about it, which
// leads to apps failing to load. For now, we're forcing WebGL 1 on iOS.
//
// TODO(yjbanov): https://github.com/flutter/flutter/issues/91333
bool get _workAroundBug91333 => operatingSystem == OperatingSystem.iOs;

/// The HTML engine used by the current browser.
enum BrowserEngine {
/// The engine that powers Chrome, Samsung Internet Browser, UC Browser,
Expand Down Expand Up @@ -240,6 +246,9 @@ int _detectWebGLVersion() {
height: 1,
);
if (canvas.getContext('webgl2') != null) {
if (_workAroundBug91333) {
return WebGLVersion.webgl1;
}
return WebGLVersion.webgl2;
}
if (canvas.getContext('webgl') != null) {
Expand Down

0 comments on commit 9fe5125

Please sign in to comment.