diff --git a/android/app/src/main/cpp/xemu_android.cpp b/android/app/src/main/cpp/xemu_android.cpp index db88fe3749..d4aaaa8a66 100644 --- a/android/app/src/main/cpp/xemu_android.cpp +++ b/android/app/src/main/cpp/xemu_android.cpp @@ -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; diff --git a/hw/xbox/nv2a/pgraph/gl/display.c b/hw/xbox/nv2a/pgraph/gl/display.c index 3247e75a82..1546755d7c 100644 --- a/hw/xbox/nv2a/pgraph/gl/display.c +++ b/hw/xbox/nv2a/pgraph/gl/display.c @@ -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); diff --git a/hw/xbox/nv2a/pgraph/gl/surface.c b/hw/xbox/nv2a/pgraph/gl/surface.c index 2333d85c32..20b69b616f 100644 --- a/hw/xbox/nv2a/pgraph/gl/surface.c +++ b/hw/xbox/nv2a/pgraph/gl/surface.c @@ -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; }