From 58e16a0ca788393b429fb7f0b75d8e5119bd467c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Sharma?= <737941+loic-sharma@users.noreply.github.com> Date: Mon, 31 Oct 2022 11:53:23 -0700 Subject: [PATCH] [ANGLE] Re-enable ANGLE's "force context check" build flag (flutter/engine#37055) In [angle@54dfb62](https://github.com/google/angle/commit/54dfb62c24ddd0fb825c874ad00ddbbd769fa2bc), ANGLE made the "force context check" flag off by default [to improve performance](https://chromium-review.googlesource.com/c/angle/angle/+/2809855). Disabling this flag uncovered several bugs in ANGLE's D3D11 renderer that can cause [Flutter 3.3.0+ to crash](https://github.com/flutter/flutter/issues/110311). This change re-enables the "force context check" flag, bringing Flutter back to the last known good state used by Flutter 3.0.5 and earlier. Fixes https://github.com/flutter/flutter/issues/110311 --- engine/src/flutter/tools/gn | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/engine/src/flutter/tools/gn b/engine/src/flutter/tools/gn index b4fcbe0b03..b41036145c 100755 --- a/engine/src/flutter/tools/gn +++ b/engine/src/flutter/tools/gn @@ -554,6 +554,11 @@ def to_gn_args(args): get_host_os() == 'win'): # Do not build unnecessary parts of the ANGLE tree. gn_args['angle_build_all'] = False + # Force ANGLE context checks on Windows to prevent crashes. + # TODO(loic-sharma): Remove this once ANGLE crashes have been fixed. + # https://github.com/flutter/flutter/issues/114107 + if get_host_os() == 'win': + gn_args['angle_force_context_check_every_call'] = True # Requires RTTI. We may want to build this in debug modes, punting on that # for now. gn_args['angle_enable_vulkan_validation_layers'] = False