This is a combination of the patches Jason authored for ANGLE. ------------------------------------------------------------- Override operator new in ANGLE's pool allocator to meet the requirements of Flutter's build of libcxx with exceptions disabled I8acb7cbf8a0bba7f4739c50bed5be284e58057b1 ------------------------------------------------------------- Add an option to disable use of libdrm in ANGLE libdrm is not currently in the Flutter engine source tree and uses C library extensions that are not available in libcxx. I08dbe0f59234ab98c54eae722bedd4f386506839 ------------------------------------------------------------- Override the single object version of operator new with std::nothrow_t in ANGLE's pool allocator Flutter builds libcxx with exceptions disabled. Libcxx requires an override of the std::nothrow_t version of operator new if the exception throwing version has been overridden. See https://github.com/flutter/flutter/pull/180072 I85131e69cfa883cdd37bd15b3bd3814364d9874f ------------------------------------------------------------- Workaround for an uninitialized variable warning in the latest Clang See https://github.com/flutter/flutter/issues/182781 I38eb8982b900b9a093e42feda9356b27e65f1ed4 ------------------------------------------------------------- Override the path to gclient_args.gni in ANGLE's build scripts Flutter uses a gclient_args.gni file located within Dart's source tree because Dart build scripts import gclient_args.gni using relative paths. This PR changes ANGLE's build scripts to match Flutter's configuration. I3f9c85dda24022b735d10f00bb2e7153d313096a Change-Id: I6596998810034e39577486c961ca232be57706a1
diff --git a/gni/angle.gni b/gni/angle.gni index 34451e3..83ca8e0 100644 --- a/gni/angle.gni +++ b/gni/angle.gni
@@ -4,7 +4,7 @@ import("//build_overrides/angle.gni") if (angle_has_build) { - import("//build/config/gclient_args.gni") + import("//flutter/third_party/dart/build/config/gclient_args.gni") } if (!defined(checkout_angle_cl_deps)) { @@ -422,6 +422,11 @@ angle_enable_renderdoc = angle_enable_vulkan_validation_layers } +declare_args() { + # Flutter patch: make libdrm optional + angle_enable_libdrm = angle_has_build && (is_linux || is_chromeos) +} + if (!defined(angle_zlib_compression_utils_dir)) { angle_zlib_compression_utils_dir = "//third_party/zlib/google" }
diff --git a/src/common/PoolAlloc.cpp b/src/common/PoolAlloc.cpp index d8b9d90..44d5d98 100644 --- a/src/common/PoolAlloc.cpp +++ b/src/common/PoolAlloc.cpp
@@ -25,6 +25,16 @@ # include <sanitizer/asan_interface.h> #endif +// Flutter patch - libcxx requires overrides of operator new with +// std::nothrow_t if operator new has been overridden and exceptions are +// disabled. +void* operator new(size_t size, const std::nothrow_t&) noexcept { + return ::operator new(size); +} +void* operator new[](size_t size, const std::nothrow_t&) noexcept { + return ::operator new[](size); +} + namespace angle { // If we are using guard blocks, we must track each individual allocation. If we aren't using guard
diff --git a/src/libANGLE/renderer/gl/BUILD.gn b/src/libANGLE/renderer/gl/BUILD.gn index 6be9490..8ad115c 100644 --- a/src/libANGLE/renderer/gl/BUILD.gn +++ b/src/libANGLE/renderer/gl/BUILD.gn
@@ -29,7 +29,8 @@ ] } } - if (angle_has_build && (is_linux || is_chromeos)) { + # Flutter patch: make libdrm optional + if (angle_enable_libdrm) { defines += [ "ANGLE_HAS_LIBDRM" ] } include_dirs = [ "../../../third_party/khronos" ] @@ -46,7 +47,8 @@ "$angle_root:angle_image_util", ] - if (angle_has_build && (is_linux || is_chromeos)) { + # Flutter patch: make libdrm optional + if (angle_enable_libdrm) { deps += [ "//build/config/linux/libdrm" ] }
diff --git a/src/libANGLE/validationEGL.cpp b/src/libANGLE/validationEGL.cpp index e143c7e..e77afdc 100644 --- a/src/libANGLE/validationEGL.cpp +++ b/src/libANGLE/validationEGL.cpp
@@ -7229,7 +7229,7 @@ break; default: { - EGLint querySurfaceValue; + EGLint querySurfaceValue = 0; ANGLE_VALIDATION_TRY( ValidateQuerySurface(val, dpy, surfaceID, attribute, &querySurfaceValue)); }