only report errors without debug_glsl

This commit is contained in:
degasus 2013-03-07 20:26:56 +01:00
parent 8b232c7a4d
commit 2bd7ba76b9
2 changed files with 11 additions and 13 deletions

View File

@ -70,7 +70,11 @@ bool OpenGL_ReportFBOError(const char *function, const char *file, int line);
#endif #endif
// this should be removed in future, but as long as glsl is unstable, we should really read this messages // this should be removed in future, but as long as glsl is unstable, we should really read this messages
#define DEBUG_GLSL #if defined(_DEBUG) || defined(DEBUGFAST) || 1
#define DEBUG_GLSL 1
#else
#define DEBUG_GLSL 0
#endif
// Isn't defined if we aren't using GLEW 1.6 // Isn't defined if we aren't using GLEW 1.6
#ifndef GL_ONE_MINUS_SRC1_ALPHA #ifndef GL_ONE_MINUS_SRC1_ALPHA

View File

@ -279,10 +279,11 @@ bool ProgramShaderCache::CompileShader ( SHADER& shader, const char* vcode, cons
glDeleteShader(vsid); glDeleteShader(vsid);
glDeleteShader(psid); glDeleteShader(psid);
#if defined(_DEBUG) || defined(DEBUGFAST) || defined(DEBUG_GLSL) GLint linkStatus;
glGetProgramiv(pid, GL_LINK_STATUS, &linkStatus);
GLsizei length = 0; GLsizei length = 0;
glGetProgramiv(pid, GL_INFO_LOG_LENGTH, &length); glGetProgramiv(pid, GL_INFO_LOG_LENGTH, &length);
if (length > 1) if (linkStatus != GL_TRUE || (length > 1 && DEBUG_GLSL))
{ {
GLsizei charsWritten; GLsizei charsWritten;
GLchar* infoLog = new GLchar[length]; GLchar* infoLog = new GLchar[length];
@ -299,9 +300,6 @@ bool ProgramShaderCache::CompileShader ( SHADER& shader, const char* vcode, cons
fwrite(pcode, strlen(pcode), 1, fp); fwrite(pcode, strlen(pcode), 1, fp);
fclose(fp); fclose(fp);
} }
GLint linkStatus;
glGetProgramiv(pid, GL_LINK_STATUS, &linkStatus);
if (linkStatus != GL_TRUE) if (linkStatus != GL_TRUE)
{ {
// Compile failed // Compile failed
@ -311,7 +309,6 @@ bool ProgramShaderCache::CompileShader ( SHADER& shader, const char* vcode, cons
glDeleteProgram(pid); glDeleteProgram(pid);
return false; return false;
} }
#endif
shader.SetProgramVariables(); shader.SetProgramVariables();
@ -326,10 +323,11 @@ GLuint ProgramShaderCache::CompileSingleShader (GLuint type, const char* code )
glShaderSource(result, 2, src, NULL); glShaderSource(result, 2, src, NULL);
glCompileShader(result); glCompileShader(result);
#if defined(_DEBUG) || defined(DEBUGFAST) || defined(DEBUG_GLSL) GLint compileStatus;
glGetShaderiv(result, GL_COMPILE_STATUS, &compileStatus);
GLsizei length = 0; GLsizei length = 0;
glGetShaderiv(result, GL_INFO_LOG_LENGTH, &length); glGetShaderiv(result, GL_INFO_LOG_LENGTH, &length);
if (length > 1) if (compileStatus != GL_TRUE || (length > 1 && DEBUG_GLSL))
{ {
GLsizei charsWritten; GLsizei charsWritten;
GLchar* infoLog = new GLchar[length]; GLchar* infoLog = new GLchar[length];
@ -344,9 +342,6 @@ GLuint ProgramShaderCache::CompileSingleShader (GLuint type, const char* code )
fclose(fp); fclose(fp);
delete[] infoLog; delete[] infoLog;
} }
GLint compileStatus;
glGetShaderiv(result, GL_COMPILE_STATUS, &compileStatus);
if (compileStatus != GL_TRUE) if (compileStatus != GL_TRUE)
{ {
// Compile failed // Compile failed
@ -356,7 +351,6 @@ GLuint ProgramShaderCache::CompileSingleShader (GLuint type, const char* code )
glDeleteShader(result); glDeleteShader(result);
return 0; return 0;
} }
#endif
(void)GL_REPORT_ERROR(); (void)GL_REPORT_ERROR();
return result; return result;
} }