From 29bbff0e1a9a6cc31ccb4b0ec3108ef038f9887d Mon Sep 17 00:00:00 2001 From: Jason Simmons Date: Wed, 20 Nov 2024 11:20:44 -0800 Subject: [PATCH] Revert "Added assert for opengles thread safety (#56585)" This reverts commit 79fe6b466041648b2241a6fc17af406c3ab10226. The implementation of the assert assumes that there is a single raster thread ID that will remain constant throughout the lifetime of the process. That is not true for scenarios like recreating the engine after suspending and resuming an Android app, or instantiating multiple engines within one process. --- .../renderer/backend/gles/proc_table_gles.cc | 4 ---- .../renderer/backend/gles/proc_table_gles.h | 20 ------------------- 2 files changed, 24 deletions(-) diff --git a/impeller/renderer/backend/gles/proc_table_gles.cc b/impeller/renderer/backend/gles/proc_table_gles.cc index b89df5daecc21..cf2482d6fb6e2 100644 --- a/impeller/renderer/backend/gles/proc_table_gles.cc +++ b/impeller/renderer/backend/gles/proc_table_gles.cc @@ -144,10 +144,6 @@ ProcTableGLES::ProcTableGLES( // NOLINT(google-readability-function-size) capabilities_ = std::make_shared(*this); - // This this will force glUseProgram to only be used on one thread in debug - // builds to identify threading violations in the engine. - UseProgram.enforce_one_thread = true; - is_valid_ = true; } diff --git a/impeller/renderer/backend/gles/proc_table_gles.h b/impeller/renderer/backend/gles/proc_table_gles.h index 2917f19754714..f17c42949d9cb 100644 --- a/impeller/renderer/backend/gles/proc_table_gles.h +++ b/impeller/renderer/backend/gles/proc_table_gles.h @@ -6,9 +6,7 @@ #define FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_PROC_TABLE_GLES_H_ #include -#include #include -#include #include "flutter/fml/logging.h" #include "flutter/fml/mapping.h" @@ -101,14 +99,6 @@ struct GLProc { /// bool log_calls = false; - //---------------------------------------------------------------------------- - /// Whether the OpenGL call asserts it is only used from / one thread in - /// IMPELLER_DEBUG builds. - /// - /// This is used to block drawing calls from happening anywhere but the raster - /// thread. - bool enforce_one_thread = false; - //---------------------------------------------------------------------------- /// @brief Call the GL function with the appropriate parameters. Lookup /// the documentation for the GL function being called to @@ -128,16 +118,6 @@ struct GLProc { FML_LOG(IMPORTANT) << name << BuildGLArguments(std::forward(args)...); } - if (enforce_one_thread) { - static std::thread::id allowed_thread; - static std::once_flag flag; - std::call_once(flag, - []() { allowed_thread = std::this_thread::get_id(); }); - FML_CHECK(std::this_thread::get_id() == allowed_thread) - << "This symbol is expected to be called from one thread, the raster " - "thread. As of this addition, the design of the engine should be " - "using non-raster threads only for uploading images."; - } #endif // defined(IMPELLER_DEBUG) && !defined(NDEBUG) return function(std::forward(args)...); }