glGetError() polling loops now only when debug switch is on

This commit is contained in:
izzy2lost
2026-03-18 09:42:20 -04:00
parent bff6a4f770
commit e040a8d918
3 changed files with 20 additions and 0 deletions
@@ -129,6 +129,10 @@ static bool NativeDebugLoggingEnabled() {
return g_native_debug_logging_enabled.load() && !g_native_debug_log_path.empty();
}
extern "C" bool xemu_android_is_debug_logging_enabled(void) {
return NativeDebugLoggingEnabled();
}
static void AppendNativeDebugLog(const char* level, const char* message) {
if (!NativeDebugLoggingEnabled() || !level || !message || !g_native_debug_log_mutex) {
return;
+6
View File
@@ -31,10 +31,16 @@
#endif
#ifdef __ANDROID__
extern bool xemu_android_is_debug_logging_enabled(void);
static void gl_log_errors(const char *ctx)
{
GLenum gl_err;
if (!xemu_android_is_debug_logging_enabled()) {
return;
}
while ((gl_err = glGetError()) != GL_NO_ERROR) {
__android_log_print(ANDROID_LOG_WARN, "xemu-android",
"GL error 0x%X at %s", gl_err, ctx);
+10
View File
@@ -31,11 +31,17 @@
#endif
#ifdef __ANDROID__
extern bool xemu_android_is_debug_logging_enabled(void);
static bool android_log_and_drain_gl_errors(const char *ctx)
{
GLenum err;
bool had_error = false;
if (!xemu_android_is_debug_logging_enabled()) {
return false;
}
while ((err = glGetError()) != GL_NO_ERROR) {
__android_log_print(ANDROID_LOG_WARN, "xemu-android",
"GL error 0x%X at %s", err, ctx);
@@ -75,6 +81,10 @@ static bool android_drain_gl_errors_silent(void)
GLenum err;
bool had_error = false;
if (!xemu_android_is_debug_logging_enabled()) {
return false;
}
while ((err = glGetError()) != GL_NO_ERROR) {
had_error = true;
}