mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 06:08:30 +09:00
[Fix] (DirectGLES): drain the ES error queue in ErrorLopper's non-debug arm too
This commit is contained in:
@@ -300,10 +300,32 @@ namespace MobileGL::MG_Backend::DirectGLES {
|
|||||||
Clear();
|
Clear();
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
void ErrorLopper::Loop(const std::function<void(GLenum)>& func) {}
|
// Error HYGIENE is not a debugging feature: every site that brackets a risky ES call with
|
||||||
void ErrorLopper::Clear() {}
|
// Clear()/Loop() relied on these to empty the driver's queue, and compiling them to
|
||||||
ErrorLopper::ErrorLopper() = default;
|
// nothing left whatever the driver raised sitting there for an unrelated later
|
||||||
ErrorLopper::~ErrorLopper() = default;
|
// `glGetError() == GL_NO_ERROR` probe to read as its own failure. The callback stays
|
||||||
|
// unused because MGLOG_D is compiled out at this level, but the queue still gets drained.
|
||||||
|
// Bounded like DrainESErrors: a driver that never returns GL_NO_ERROR (a lost context is
|
||||||
|
// the usual way) must not spin here.
|
||||||
|
constexpr Int kMaxDrainedESErrors = 32;
|
||||||
|
|
||||||
|
void ErrorLopper::Loop(const std::function<void(GLenum)>& func) {
|
||||||
|
static_cast<void>(func);
|
||||||
|
for (Int i = 0; i < kMaxDrainedESErrors && g_GLESFuncs.glGetError() != GL_NO_ERROR; ++i) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ErrorLopper::Clear() {
|
||||||
|
for (Int i = 0; i < kMaxDrainedESErrors && g_GLESFuncs.glGetError() != GL_NO_ERROR; ++i) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ErrorLopper::ErrorLopper() {
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
|
ErrorLopper::~ErrorLopper() {
|
||||||
|
Clear();
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MOBILEGL_LOG_ACTIVE_LEVEL <= MOBILEGL_LOG_LEVEL_DEBUG
|
#if MOBILEGL_LOG_ACTIVE_LEVEL <= MOBILEGL_LOG_LEVEL_DEBUG
|
||||||
|
|||||||
Reference in New Issue
Block a user