Ticket #4344: 4344_opengl.patch
File 4344_opengl.patch, 1.9 KB (added by , 8 years ago) |
---|
-
source/lib/ogl.cpp
373 373 374 374 //---------------------------------------------------------------------------- 375 375 376 static void dump_gl_error(GLenum err)376 const char* ogl_GetErrorName(GLenum err) 377 377 { 378 debug_printf("OGL| "); 379 #define E(e) case e: debug_printf("%s\n", #e); break; 378 #define E(e) case e: return #e; 380 379 switch (err) 381 380 { 382 381 E(GL_INVALID_ENUM) … … 388 387 #endif 389 388 E(GL_OUT_OF_MEMORY) 390 389 E(GL_INVALID_FRAMEBUFFER_OPERATION) 391 default: debug_printf("Unknown GL error: %04x\n", err); break;390 default: return "Unknown GL error"; 392 391 } 393 392 #undef E 394 393 } 395 394 395 static void dump_gl_error(GLenum err) 396 { 397 debug_printf("OGL| %s (%04x)\n", ogl_GetErrorName(err), err); 398 } 399 396 400 void ogl_WarnIfErrorLoc(const char *file, int line) 397 401 { 398 402 // glGetError may return multiple errors, so we poll it in a loop. -
source/lib/ogl.h
160 160 #endif 161 161 162 162 /** 163 * get a name of the error. 164 * 165 * useful for debug. 166 * 167 * @return read-only C string of unspecified length containing 168 * the error's name. 169 **/ 170 extern const char* ogl_GetErrorName(GLenum err); 171 172 /** 163 173 * ignore and reset the specified OpenGL error. 164 174 * 165 175 * this is useful for suppressing annoying error messages, e.g. -
source/renderer/Renderer.cpp
1624 1624 int err = glGetError(); 1625 1625 if (err) 1626 1626 { 1627 ONCE(LOGERROR("CRenderer::EndFrame: GL errors % i occurred", err));1627 ONCE(LOGERROR("CRenderer::EndFrame: GL errors %s (0x%04x) occurred", ogl_GetErrorName(err), err)); 1628 1628 } 1629 1629 } 1630 1630 }