Commit 70019b57 authored by Geoff Lang's avatar Geoff Lang Committed by Commit Bot

Fix use_static_angle build flag and require a flag to use ANGLE.

ui/gl initialization is now in a sub library, move the dependencies.

Require a flag to use ANGLE on Android, this allows ANGLE and the native
driver to both work with a given build so we can test on the bots.

BUG=726002

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I2d3e0c4e844dca9e72c363f07e011c710e1a9f57
Reviewed-on: https://chromium-review.googlesource.com/c/1244078Reviewed-by: default avatarKenneth Russell <kbr@chromium.org>
Commit-Queue: Geoff Lang <geofflang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596236}
parent 353b5538
......@@ -201,10 +201,6 @@ jumbo_component("gl") {
"gl_surface_egl_surface_control.cc",
"gl_surface_egl_surface_control.h",
]
if (use_static_angle) {
deps += [ "//third_party/angle:libEGL_static" ]
}
}
if (is_posix && !is_fuchsia && !is_mac) {
......
......@@ -4,6 +4,7 @@
import("//build/config/jumbo.gni")
import("//build/config/ui.gni")
import("//ui/gl/features.gni")
jumbo_component("init") {
output_name = "gl_init"
......@@ -38,6 +39,10 @@ jumbo_component("init") {
"gl_factory_android.cc",
"gl_initializer_android.cc",
]
if (use_static_angle) {
deps += [ "//third_party/angle:libEGL_static" ]
}
} else if (is_win && !use_ozone) {
sources += [
"gl_factory_win.cc",
......
......@@ -24,13 +24,17 @@ namespace init {
namespace {
bool InitializeStaticEGLInternal() {
#if BUILDFLAG(USE_STATIC_ANGLE)
bool InitializeStaticANGLEEGLInternal() {
#pragma push_macro("eglGetProcAddress")
#undef eglGetProcAddress
SetGLGetProcAddressProc(&eglGetProcAddress);
#pragma pop_macro("eglGetProcAddress")
#else // BUILDFLAG(USE_STATIC_ANGLE)
return true;
}
#endif // BUILDFLAG(USE_STATIC_ANGLE)
bool InitializeStaticNativeEGLInternal() {
base::NativeLibrary gles_library = LoadLibraryAndPrintError("libGLESv2.so");
if (!gles_library)
return false;
......@@ -54,7 +58,32 @@ bool InitializeStaticEGLInternal() {
SetGLGetProcAddressProc(get_proc_address);
AddGLNativeLibrary(egl_library);
AddGLNativeLibrary(gles_library);
return true;
}
bool InitializeStaticEGLInternal() {
bool initialized = false;
#if BUILDFLAG(USE_STATIC_ANGLE)
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
// Use ANGLE if it is requested via the --use-gl=angle flag and it is
// statically linked
if (command_line->GetSwitchValueASCII(switches::kUseGL) ==
kGLImplementationANGLEName) {
initialized = InitializeStaticANGLEEGLInternal();
}
#endif // BUILDFLAG(USE_STATIC_ANGLE)
if (!initialized) {
initialized = InitializeStaticNativeEGLInternal();
}
if (!initialized) {
return false;
}
SetGLImplementation(kGLImplementationEGLGLES2);
InitializeStaticGLBindingsGL();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment