diff --git a/impeller/renderer/backend/gles/reactor_gles.cc b/impeller/renderer/backend/gles/reactor_gles.cc index dfd26f3dde09d..df22c68573a80 100644 --- a/impeller/renderer/backend/gles/reactor_gles.cc +++ b/impeller/renderer/backend/gles/reactor_gles.cc @@ -159,6 +159,10 @@ bool ReactorGLES::React() { } TRACE_EVENT0("impeller", "ReactorGLES::React"); while (HasPendingOperations()) { + // Both the raster thread and the IO thread can flush queued operations. + // Ensure that execution of the ops is serialized. + Lock execution_lock(ops_execution_mutex_); + if (!ReactOnce()) { return false; } diff --git a/impeller/renderer/backend/gles/reactor_gles.h b/impeller/renderer/backend/gles/reactor_gles.h index 801542b4fb27a..00cd7ceff4656 100644 --- a/impeller/renderer/backend/gles/reactor_gles.h +++ b/impeller/renderer/backend/gles/reactor_gles.h @@ -69,6 +69,7 @@ class ReactorGLES { std::unique_ptr proc_table_; + Mutex ops_execution_mutex_; mutable Mutex ops_mutex_; std::vector ops_ IPLR_GUARDED_BY(ops_mutex_); @@ -88,7 +89,7 @@ class ReactorGLES { bool can_set_debug_labels_ = false; bool is_valid_ = false; - bool ReactOnce(); + bool ReactOnce() IPLR_REQUIRES(ops_execution_mutex_); bool HasPendingOperations() const;