report glsl shader warings as errors

This commit is contained in:
degasus 2013-01-18 12:49:48 +01:00
parent 714ff50fdf
commit 2c010f530e
2 changed files with 33 additions and 31 deletions

View File

@ -134,6 +134,22 @@ bool PixelShaderCache::CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrpr
glShaderSource(result, 1, &pstrprogram, NULL);
glCompileShader(result);
GLsizei length = 0;
glGetShaderiv(result, GL_INFO_LOG_LENGTH, &length);
if (length > 1)
{
GLsizei charsWritten;
GLchar* infoLog = new GLchar[length];
glGetShaderInfoLog(result, length, &charsWritten, infoLog);
ERROR_LOG(VIDEO, "PS Shader info log:\n%s", infoLog);
char szTemp[MAX_PATH];
sprintf(szTemp, "ps_%d.txt", result);
FILE *fp = fopen(szTemp, "wb");
fwrite(pstrprogram, strlen(pstrprogram), 1, fp);
fclose(fp);
delete[] infoLog;
}
GLint compileStatus;
glGetShaderiv(result, GL_COMPILE_STATUS, &compileStatus);
if (compileStatus != GL_TRUE)
@ -141,21 +157,6 @@ bool PixelShaderCache::CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrpr
// Compile failed
ERROR_LOG(VIDEO, "Shader compilation failed; see info log");
GLsizei length = 0;
glGetShaderiv(result, GL_INFO_LOG_LENGTH, &length);
if (length > 0)
{
GLsizei charsWritten;
GLchar* infoLog = new GLchar[length];
glGetShaderInfoLog(result, length, &charsWritten, infoLog);
WARN_LOG(VIDEO, "PS Shader info log:\n%s", infoLog);
char szTemp[MAX_PATH];
sprintf(szTemp, "ps_%d.txt", result);
FILE *fp = fopen(szTemp, "wb");
fwrite(pstrprogram, strlen(pstrprogram), 1, fp);
fclose(fp);
delete[] infoLog;
}
// Don't try to use this shader
glDeleteShader(result);
return false;

View File

@ -120,6 +120,22 @@ bool VertexShaderCache::CompileVertexShader(VERTEXSHADER& vs, const char* pstrpr
glShaderSource(result, 1, &pstrprogram, NULL);
glCompileShader(result);
GLsizei length = 0;
glGetShaderiv(result, GL_INFO_LOG_LENGTH, &length);
if (length > 1)
{
GLsizei charsWritten;
GLchar* infoLog = new GLchar[length];
glGetShaderInfoLog(result, length, &charsWritten, infoLog);
ERROR_LOG(VIDEO, "VS Shader info log:\n%s", infoLog);
char szTemp[MAX_PATH];
sprintf(szTemp, "vs_%d.txt", result);
FILE *fp = fopen(szTemp, "wb");
fwrite(pstrprogram, strlen(pstrprogram), 1, fp);
fclose(fp);
delete[] infoLog;
}
GLint compileStatus;
glGetShaderiv(result, GL_COMPILE_STATUS, &compileStatus);
if (compileStatus != GL_TRUE)
@ -127,21 +143,6 @@ bool VertexShaderCache::CompileVertexShader(VERTEXSHADER& vs, const char* pstrpr
// Compile failed
ERROR_LOG(VIDEO, "Shader compilation failed; see info log");
GLsizei length = 0;
glGetShaderiv(result, GL_INFO_LOG_LENGTH, &length);
if (length > 0)
{
GLsizei charsWritten;
GLchar* infoLog = new GLchar[length];
glGetShaderInfoLog(result, length, &charsWritten, infoLog);
WARN_LOG(VIDEO, "VS Shader info log:\n%s", infoLog);
char szTemp[MAX_PATH];
sprintf(szTemp, "vs_%d.txt", result);
FILE *fp = fopen(szTemp, "wb");
fwrite(pstrprogram, strlen(pstrprogram), 1, fp);
fclose(fp);
delete[] infoLog;
}
// Don't try to use this shader
glDeleteShader(result);
return false;