-
Notifications
You must be signed in to change notification settings - Fork 29.2k
Description
We should disable ANGLE's "force context check" flag to improve performance and align with ANGLE's defaults. Before doing this, we should make sure that the ANGLE bugs uncovered by disabling this flag are fixed.
Background
In angle@54dfb62, ANGLE made the "force context check" flag off by default to improve performance. Disabling this flag uncovered several bugs in ANGLE's D3D11 renderer that can cause Flutter 3.3.0 to crash. This flag was re-enabled to bring Flutter back to the last known good state used by Flutter 3.0.5 and earlier.
What is the "force context check" flag?
Per the ANGLE team:
This flag is to allow our D3D11 backend to be multithreaded at the cost of additional synchronization. If flutter is using ANGLE from multiple threads on Windows, you should leave this flag enabled by default.
Flutter does not use ANGLE from multiple threads, so ideally Flutter would disable this flag.
Next steps to fix the ANGLE bug?
The ANGLE team were very helpful, but their suggested patches to the D3D11 renderer uncovered more bugs. They asked for a minimal repro of this crash so that they could investigate further on their end.
Suggested D3D11 renderer patch...
Suggestion by syoussefi@
... given what
ANGLE_FORCE_CONTEXT_CHECK_EVERY_CALL
does (it forces the state to be resynced) and where mFramebuffer11 is set (in response toDIRTY_BIT_DRAW_FRAMEBUFFER_BINDING
), it must be that the framebuffer binding state is not dirty when eglMakeCurrent is called... which makes sense. ... There is no reason why these pointers should be reset; the state may not be dirty and no one is re-setting these opinters back (in your case, mFramebuffer11).
diff --git a/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp b/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp
index 663b23826..89d35085c 100644
--- a/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp
+++ b/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp
@@ -1795,9 +1795,9 @@ angle::Result StateManager11::onMakeCurrent(const gl::Context *context)
}
// Reset the cache objects.
- mProgramD3D = nullptr;
- mVertexArray11 = nullptr;
- mFramebuffer11 = nullptr;
+ // mProgramD3D = nullptr;
+ // mVertexArray11 = nullptr;
+ // mFramebuffer11 = nullptr;
return angle::Result::Continue;
}
Crash reproduction
Here are the steps to reproduce the ANGLE to crash:
- Enable the "force context check" flag by switching to Flutter commit 220ffc7
- Checkout
MixinNetwork/flutter-plugins
@6f8458f - Launch the desktop_webview_window example on Windows
cd packages/desktop_webview_window/example
flutter run -d windows
- Press the
Open
button
The app should crash.