Vulkan: Fix cleanup race condition on Context destroy
In Context::onDestroy(), e7b3fe21866454bd3ea983acede162d34ae03dd8 had
moved surface deletion first which down the line caused
RendererVk::finish() to be called.
bf7b95db6b6f039f6c8797f1f4b930d46a761828 however made surface deletion
unnecessary, which means finish was never called.
This commit adds an explicit finish in Context::onDestroy(). In truth,
the wait is only necessary until all command buffers submitted for this
particular context have finished. This optimization is deferred to a
possible future work.
Bug: angleproject:2811
Change-Id: I56e6c88d3b4a6ec73f70d80d7775a0c85be651ea
Reviewed-on: https://chromium-review.googlesource.com/c/1302838
Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
Reviewed-by: Geoff Lang <geofflang@chromium.org>
diff --git a/src/libANGLE/Context.cpp b/src/libANGLE/Context.cpp
index b582f5b..686271f 100644
--- a/src/libANGLE/Context.cpp
+++ b/src/libANGLE/Context.cpp
@@ -545,12 +545,15 @@
egl::Error Context::onDestroy(const egl::Display *display)
{
+ // Trigger a finish() to make sure resources are not in use upon destruction. Particularly
+ // necessary for Vulkan.
+ finish();
+
if (mGLES1Renderer)
{
mGLES1Renderer->onDestroy(this, &mGLState);
}
- // Delete the Surface first to trigger a finish() in Vulkan.
ANGLE_TRY(releaseSurface(display));
for (auto fence : mFenceNVMap)