Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 2557027

Browse files
Revert "Added assert for opengles thread safety (#56585)" (#56730)
This reverts commit 79fe6b4. 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.
1 parent 3828681 commit 2557027

File tree

2 files changed

+0
-24
lines changed

2 files changed

+0
-24
lines changed

impeller/renderer/backend/gles/proc_table_gles.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,6 @@ ProcTableGLES::ProcTableGLES( // NOLINT(google-readability-function-size)
144144

145145
capabilities_ = std::make_shared<CapabilitiesGLES>(*this);
146146

147-
// This this will force glUseProgram to only be used on one thread in debug
148-
// builds to identify threading violations in the engine.
149-
UseProgram.enforce_one_thread = true;
150-
151147
is_valid_ = true;
152148
}
153149

impeller/renderer/backend/gles/proc_table_gles.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
#define FLUTTER_IMPELLER_RENDERER_BACKEND_GLES_PROC_TABLE_GLES_H_
77

88
#include <functional>
9-
#include <mutex>
109
#include <string>
11-
#include <thread>
1210

1311
#include "flutter/fml/logging.h"
1412
#include "flutter/fml/mapping.h"
@@ -101,14 +99,6 @@ struct GLProc {
10199
///
102100
bool log_calls = false;
103101

104-
//----------------------------------------------------------------------------
105-
/// Whether the OpenGL call asserts it is only used from / one thread in
106-
/// IMPELLER_DEBUG builds.
107-
///
108-
/// This is used to block drawing calls from happening anywhere but the raster
109-
/// thread.
110-
bool enforce_one_thread = false;
111-
112102
//----------------------------------------------------------------------------
113103
/// @brief Call the GL function with the appropriate parameters. Lookup
114104
/// the documentation for the GL function being called to
@@ -128,16 +118,6 @@ struct GLProc {
128118
FML_LOG(IMPORTANT) << name
129119
<< BuildGLArguments(std::forward<Args>(args)...);
130120
}
131-
if (enforce_one_thread) {
132-
static std::thread::id allowed_thread;
133-
static std::once_flag flag;
134-
std::call_once(flag,
135-
[]() { allowed_thread = std::this_thread::get_id(); });
136-
FML_CHECK(std::this_thread::get_id() == allowed_thread)
137-
<< "This symbol is expected to be called from one thread, the raster "
138-
"thread. As of this addition, the design of the engine should be "
139-
"using non-raster threads only for uploading images.";
140-
}
141121
#endif // defined(IMPELLER_DEBUG) && !defined(NDEBUG)
142122
return function(std::forward<Args>(args)...);
143123
}

0 commit comments

Comments
 (0)