mirror of
https://github.com/MobileGL-Dev/MobileGlues.git
synced 2025-09-22 10:42:11 -04:00
misc(log): debug log force off
This commit is contained in:
parent
f2685fa2eb
commit
b416d6fbb3
@ -7,12 +7,21 @@
|
||||
#include "mg.h"
|
||||
|
||||
#define GLOBAL_DEBUG 0
|
||||
#define GLOBAL_DEBUG_FORCE_OFF 1
|
||||
|
||||
#if GLOBAL_DEBUG_FORCE_OFF
|
||||
#define LOG() {}
|
||||
#define LOG_D(...) {}
|
||||
#define LOG_W(...) {}
|
||||
#define LOG_E(...) {}
|
||||
#define LOG_F(...) {}
|
||||
#else
|
||||
#define LOG() if(DEBUG||GLOBAL_DEBUG) {__android_log_print(ANDROID_LOG_DEBUG, RENDERERNAME, "Use function: %s", __FUNCTION__);printf("Use function: %s\n", __FUNCTION__);write_log("Use function: %s\n", __FUNCTION__);}
|
||||
#define LOG_D(...) if(DEBUG||GLOBAL_DEBUG) {__android_log_print(ANDROID_LOG_DEBUG, RENDERERNAME, __VA_ARGS__);printf(__VA_ARGS__);printf("\n\n");write_log(__VA_ARGS__);}
|
||||
#define LOG_W(...) if(DEBUG||GLOBAL_DEBUG) {__android_log_print(ANDROID_LOG_WARN, RENDERERNAME, __VA_ARGS__);printf(__VA_ARGS__);printf("\n\n");write_log(__VA_ARGS__);}
|
||||
#define LOG_E(...) if(DEBUG||GLOBAL_DEBUG) {__android_log_print(ANDROID_LOG_ERROR, RENDERERNAME, __VA_ARGS__);printf(__VA_ARGS__);printf("\n\n");write_log(__VA_ARGS__);}
|
||||
#define LOG_F(...) if(DEBUG||GLOBAL_DEBUG) {__android_log_print(ANDROID_LOG_FATAL, RENDERERNAME, __VA_ARGS__);printf(__VA_ARGS__);printf("\n\n");write_log(__VA_ARGS__);}
|
||||
#endif
|
||||
|
||||
#define LOG_V(...) {__android_log_print(ANDROID_LOG_VERBOSE, RENDERERNAME, __VA_ARGS__);printf(__VA_ARGS__);printf("\n\n");write_log(__VA_ARGS__);}
|
||||
#define LOG_I(...) {__android_log_print(ANDROID_LOG_INFO, RENDERERNAME, __VA_ARGS__);printf(__VA_ARGS__);printf("\n\n");write_log(__VA_ARGS__);}
|
||||
|
@ -29,7 +29,7 @@ void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name) {
|
||||
char *result = NULL;
|
||||
|
||||
if (regcomp(®ex, targetPattern, REG_EXTENDED) != 0) {
|
||||
fprintf(stderr, "Failed to compile regex\n");
|
||||
LOG_E("Failed to compile regex\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name) {
|
||||
size_t matchLen = pmatch[0].rm_eo - pmatch[0].rm_so;
|
||||
origin = (char *)malloc(matchLen + 1);
|
||||
if (!origin) {
|
||||
fprintf(stderr, "Memory allocation failed\n");
|
||||
LOG_E("Memory allocation failed\n");
|
||||
break;
|
||||
}
|
||||
strncpy(origin, searchStart + pmatch[0].rm_so, matchLen);
|
||||
@ -47,7 +47,7 @@ void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name) {
|
||||
size_t resultLen = strlen(origin) + 30; // "layout (location = )" + colorNumber + null terminator
|
||||
result = (char *)malloc(resultLen);
|
||||
if (!result) {
|
||||
fprintf(stderr, "Memory allocation failed\n");
|
||||
LOG_E("Memory allocation failed\n");
|
||||
free(origin);
|
||||
break;
|
||||
}
|
||||
@ -61,7 +61,7 @@ void glBindFragDataLocation(GLuint program, GLuint color, const GLchar *name) {
|
||||
|
||||
char *newConverted = (char *)malloc(newLen);
|
||||
if (!newConverted) {
|
||||
fprintf(stderr, "Memory allocation failed\n");
|
||||
LOG_E("Memory allocation failed\n");
|
||||
free(origin);
|
||||
free(result);
|
||||
break;
|
||||
|
@ -116,9 +116,9 @@ static name##_PTR egl_##name = NULL; \
|
||||
ERR = gles_glGetError(); \
|
||||
}
|
||||
#else
|
||||
#define CHECK_GL_ERROR
|
||||
#define INIT_CHECK_GL_ERROR
|
||||
#define CHECK_GL_ERROR_NO_INIT
|
||||
#define CHECK_GL_ERROR {}
|
||||
#define INIT_CHECK_GL_ERROR {}
|
||||
#define CHECK_GL_ERROR_NO_INIT {}
|
||||
#endif
|
||||
|
||||
#define INIT_CHECK_GL_ERROR_FORCE \
|
||||
|
Loading…
x
Reference in New Issue
Block a user