Rename GL_ERRLOG() to GL_MAYBELOG()

This commit is contained in:
Aaron Culliney 2017-07-15 15:08:42 -10:00
parent 51a5f5fcf7
commit 153f1434db
7 changed files with 25 additions and 19 deletions

View File

@ -238,7 +238,8 @@ static const char *log_end = "\n";
} \
} //
#define GL_ERRLOG(...) \
// GL_MAYBELOG() only logs if an OpenGL error occurred
#define GL_MAYBELOG(...) \
if (do_logging) { \
GLenum _glerr = 0; \
while ( (_glerr = safeGLGetError()) ) { \
@ -256,24 +257,29 @@ static const char *log_end = "\n";
QUIT_FUNCTION(1); \
} while (0)
// GL_ERRQUIT() only logs/quits if an OpenGL error occurred
#define GL_ERRQUIT(...) \
do { \
GLenum _glerr = 0; \
GLenum _last_glerr = 0; \
while ( (_glerr = safeGLGetError()) ) { \
_last_glerr = _glerr; \
_LOG(__VA_ARGS__); \
QUIT_FUNCTION(_glerr); \
} \
if (_last_glerr) { \
QUIT_FUNCTION(_last_glerr); \
} \
} while (0)
#else // NDEBUG
#define ERRQUIT(...) \
do { } while (0)
#define LOG(...) \
do { } while (0)
#define GL_ERRLOG(...) \
#define GL_MAYBELOG(...) \
do { } while (0)
#define ERRQUIT(...) \
do { } while (0)
#define GL_ERRQUIT(...) \

View File

@ -274,7 +274,7 @@ void glhud_renderDefault(GLModel *parent) {
// Draw the object
_HACKAROUND_GLDRAW_PRE();
glDrawElements(parent->primType, parent->numElements, parent->elementType, 0);
GL_ERRLOG("glhudparent render");
GL_MAYBELOG("glhudparent render");
}
void glhud_destroyDefault(GLModel *parent) {

View File

@ -168,7 +168,7 @@ static void *_azimuth_create_model(GLModel *parent) {
err = false;
} while (0);
GL_ERRLOG("build Aziumth joystick");
GL_MAYBELOG("build Aziumth joystick");
if (vtxSource) {
glshader_destroySource(vtxSource);
@ -228,7 +228,7 @@ static void _azimuth_render(void) {
// back to main framebuffer/quad program
glUseProgram(mainShaderProgram);
GL_ERRLOG("Azimuth render");
GL_MAYBELOG("Azimuth render");
}
// ----------------------------------------------------------------------------

View File

@ -444,7 +444,7 @@ static void gltouchmenu_setup(void) {
isAvailable = true;
GL_ERRLOG("gltouchmenu_setup");
GL_MAYBELOG("gltouchmenu_setup");
}
static void gltouchmenu_render(void) {
@ -481,7 +481,7 @@ static void gltouchmenu_render(void) {
glUniform1i(texSamplerLoc, TEXTURE_ID_TOUCHMENU);
glhud_renderDefault(menu.model);
GL_ERRLOG("gltouchmenu_render");
GL_MAYBELOG("gltouchmenu_render");
}
static void gltouchmenu_reshape(int w, int h, bool landscape) {

View File

@ -218,7 +218,7 @@ static void glvideo_init(void) {
LOG("OOPS, no texture selector in shader : %d", alphaValue);
}
GL_ERRLOG("build program");
GL_MAYBELOG("build program");
// ----------------------------
// setup static OpenGL state
@ -240,7 +240,7 @@ static void glvideo_init(void) {
video_render();
// Check for errors to make sure all of our setup went ok
GL_ERRLOG("finished initialization");
GL_MAYBELOG("finished initialization");
if (glCheckFramebufferStatus != NULL) {
GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
@ -393,7 +393,7 @@ static void glvideo_render(void) {
_HACKAROUND_GLDRAW_PRE();
glDrawElements(GL_TRIANGLES, crtModel->numElements, crtModel->elementType, 0);
GL_ERRLOG("glvideo_render");
GL_MAYBELOG("glvideo_render");
}
static void glvideo_reshape(int w, int h, bool landscape) {

View File

@ -388,7 +388,7 @@ static void _quadCreateVAOAndVBOs(GLModel *model) {
FREE(model->texCoords);
#endif
GL_ERRLOG("quad creation of VAO/VBOs");
GL_MAYBELOG("quad creation of VAO/VBOs");
}
static GLuint _quadCreateTexture(GLModel *model) {
@ -412,7 +412,7 @@ static GLuint _quadCreateTexture(GLModel *model) {
// register texture with OpenGL
glTexImage2D(GL_TEXTURE_2D, /*level*/0, /*internal format*/TEX_FORMAT_INTERNAL, model->texWidth, model->texHeight, /*border*/0, TEX_FORMAT, TEX_TYPE, NULL);
GL_ERRLOG("quad texture creation");
GL_MAYBELOG("quad texture creation");
return texName;
}
@ -546,7 +546,7 @@ GLModel *mdlCreateQuad(GLModelParams_s parms, GLCustom clazz) {
model->custom->destroy = clazz.destroy;
}
GL_ERRLOG("quad creation");
GL_MAYBELOG("quad creation");
return model;
} while (0);

View File

@ -100,7 +100,7 @@ GLuint glshader_buildProgram(demoSource *vertexSource, demoSource *fragmentSourc
char *shaderLangVersion = (char *)glGetString(GL_SHADING_LANGUAGE_VERSION);
if (shaderLangVersion == NULL) {
ERRQUIT("shader toolchain unavailable");
GL_ERRQUIT("shader toolchain unavailable");
}
#if TARGET_OS_IPHONE
sscanf(shaderLangVersion, "OpenGL ES GLSL ES %f", &glLanguageVersion);
@ -247,7 +247,7 @@ GLuint glshader_buildProgram(demoSource *vertexSource, demoSource *fragmentSourc
return 0;
}
GL_ERRLOG("build program");
GL_MAYBELOG("build program");
return prgName;
}