Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 5162661

Browse files
committed
[Impeller] Wire up Angle use to a command line flag and enable it by default on macOS.
Similar to --use_swiftshader in #50298.
1 parent 9869d47 commit 5162661

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

impeller/playground/backend/gles/playground_impl_gles.cc

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,19 +76,12 @@ PlaygroundImplGLES::PlaygroundImplGLES(PlaygroundSwitches switches)
7676
::glfwDefaultWindowHints();
7777

7878
#if FML_OS_MACOSX
79-
if (use_angle_) {
80-
::glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API);
81-
::glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
82-
::glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
83-
::glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
84-
} else {
85-
::glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_API);
86-
}
87-
#else // FML_OS_MACOSX
79+
FML_CHECK(use_angle_) << "Must use Angle on macOS for OpenGL ES.";
80+
::glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API);
81+
#endif // FML_OS_MACOSX
8882
::glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API);
8983
::glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
9084
::glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 0);
91-
#endif // FML_OS_MACOSX
9285
::glfwWindowHint(GLFW_RED_BITS, 8);
9386
::glfwWindowHint(GLFW_GREEN_BITS, 8);
9487
::glfwWindowHint(GLFW_BLUE_BITS, 8);

impeller/playground/switches.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
#include <cstdlib>
88

9+
#include "flutter/fml/build_config.h"
10+
911
namespace impeller {
1012

1113
PlaygroundSwitches::PlaygroundSwitches() = default;
@@ -20,6 +22,11 @@ PlaygroundSwitches::PlaygroundSwitches(const fml::CommandLine& args) {
2022
}
2123
enable_vulkan_validation = args.HasOption("enable_vulkan_validation");
2224
use_swiftshader = args.HasOption("use_swiftshader");
25+
use_angle = args.HasOption("use_angle");
26+
#if FML_OS_MACOSX
27+
// OpenGL on macOS is busted and deprecated. Use Angle there by default.
28+
use_angle = true;
29+
#endif // FML_OS_MACOSX
2330
}
2431

2532
} // namespace impeller

impeller/playground/switches.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ struct PlaygroundSwitches {
2626
/// find a SwiftShader implementation.
2727
///
2828
bool use_swiftshader = false;
29+
/// Attempt to use Angle on the system instead of the available OpenGL ES
30+
/// implementation. This is on-by-default on macOS due to the broken-ness in
31+
/// the deprecated OpenGL implementation. On other platforms, it this opt-in
32+
/// via the flag with the system OpenGL ES implementation used by fault.
33+
///
2934
bool use_angle = false;
3035

3136
PlaygroundSwitches();

0 commit comments

Comments
 (0)