Cleanup: style

Also use gcc style file:line: syntax for errors.
This commit is contained in:
Campbell Barton 2015-10-17 02:46:38 +11:00
parent a1b34c0d28
commit d307c24a8b
1 changed files with 13 additions and 17 deletions

View File

@ -43,7 +43,7 @@
#define CASE_CODE_RETURN_STR(code) case code: return #code;
static const char* gpu_gl_error_symbol(GLenum err)
static const char *gpu_gl_error_symbol(GLenum err)
{
switch (err) {
CASE_CODE_RETURN_STR(GL_NO_ERROR)
@ -81,8 +81,8 @@ static bool gpu_report_gl_errors(const char *file, int line, const char *str)
}
else {
/* glGetError should have cleared the error flag, so if we get the
same flag twice that means glGetError itself probably triggered
the error. This happens on Windows if the GL context is invalid.
* same flag twice that means glGetError itself probably triggered
* the error. This happens on Windows if the GL context is invalid.
*/
{
GLenum new_error = glGetError();
@ -92,22 +92,18 @@ static bool gpu_report_gl_errors(const char *file, int line, const char *str)
}
}
fprintf(
stderr,
"%s(%d): ``%s'' -> GL Error (0x%04X - %s): %s\n",
file,
line,
str,
gl_error,
gpu_gl_error_symbol(gl_error),
gpuErrorString(gl_error));
fprintf(stderr,
"%s:%d: ``%s'' -> GL Error (0x%04X - %s): %s\n",
file, line, str, gl_error,
gpu_gl_error_symbol(gl_error),
gpuErrorString(gl_error));
return false;
}
}
const char* gpuErrorString(GLenum err)
const char *gpuErrorString(GLenum err)
{
switch (err) {
case GL_NO_ERROR:
@ -208,9 +204,9 @@ void gpu_debug_init(void)
if (GLEW_KHR_debug) {
#ifndef GLEW_ES_ONLY
glDebugMessageCallback(gpu_debug_proc, mxGetCurrentContext());
glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE);
GPU_string_marker(sizeof(success), success);
glDebugMessageCallback(gpu_debug_proc, mxGetCurrentContext());
glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE);
GPU_string_marker(sizeof(success), success);
#endif
return;
}
@ -324,7 +320,7 @@ void GPU_print_error_debug(const char *str)
}
void GPU_assert_no_gl_errors(const char* file, int line, const char* str)
void GPU_assert_no_gl_errors(const char *file, int line, const char *str)
{
if (G.debug) {
GLboolean gl_ok = gpu_report_gl_errors(file, line, str);