diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h index f5fe795575..9cd8ff9093 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.h @@ -70,7 +70,11 @@ bool OpenGL_ReportFBOError(const char *function, const char *file, int line); #endif // 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 #ifndef GL_ONE_MINUS_SRC1_ALPHA diff --git a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp index af08cc5402..c42e540042 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/ProgramShaderCache.cpp @@ -279,10 +279,11 @@ bool ProgramShaderCache::CompileShader ( SHADER& shader, const char* vcode, cons glDeleteShader(vsid); glDeleteShader(psid); -#if defined(_DEBUG) || defined(DEBUGFAST) || defined(DEBUG_GLSL) + GLint linkStatus; + glGetProgramiv(pid, GL_LINK_STATUS, &linkStatus); GLsizei length = 0; glGetProgramiv(pid, GL_INFO_LOG_LENGTH, &length); - if (length > 1) + if (linkStatus != GL_TRUE || (length > 1 && DEBUG_GLSL)) { GLsizei charsWritten; GLchar* infoLog = new GLchar[length]; @@ -299,9 +300,6 @@ bool ProgramShaderCache::CompileShader ( SHADER& shader, const char* vcode, cons fwrite(pcode, strlen(pcode), 1, fp); fclose(fp); } - - GLint linkStatus; - glGetProgramiv(pid, GL_LINK_STATUS, &linkStatus); if (linkStatus != GL_TRUE) { // Compile failed @@ -311,7 +309,6 @@ bool ProgramShaderCache::CompileShader ( SHADER& shader, const char* vcode, cons glDeleteProgram(pid); return false; } -#endif shader.SetProgramVariables(); @@ -326,10 +323,11 @@ GLuint ProgramShaderCache::CompileSingleShader (GLuint type, const char* code ) glShaderSource(result, 2, src, NULL); glCompileShader(result); -#if defined(_DEBUG) || defined(DEBUGFAST) || defined(DEBUG_GLSL) + GLint compileStatus; + glGetShaderiv(result, GL_COMPILE_STATUS, &compileStatus); GLsizei length = 0; glGetShaderiv(result, GL_INFO_LOG_LENGTH, &length); - if (length > 1) + if (compileStatus != GL_TRUE || (length > 1 && DEBUG_GLSL)) { GLsizei charsWritten; GLchar* infoLog = new GLchar[length]; @@ -344,9 +342,6 @@ GLuint ProgramShaderCache::CompileSingleShader (GLuint type, const char* code ) fclose(fp); delete[] infoLog; } - - GLint compileStatus; - glGetShaderiv(result, GL_COMPILE_STATUS, &compileStatus); if (compileStatus != GL_TRUE) { // Compile failed @@ -356,7 +351,6 @@ GLuint ProgramShaderCache::CompileSingleShader (GLuint type, const char* code ) glDeleteShader(result); return 0; } -#endif (void)GL_REPORT_ERROR(); return result; }