report glsl shader warings as errors
This commit is contained in:
parent
714ff50fdf
commit
2c010f530e
|
@ -133,6 +133,22 @@ bool PixelShaderCache::CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrpr
|
||||||
|
|
||||||
glShaderSource(result, 1, &pstrprogram, NULL);
|
glShaderSource(result, 1, &pstrprogram, NULL);
|
||||||
glCompileShader(result);
|
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;
|
GLint compileStatus;
|
||||||
glGetShaderiv(result, GL_COMPILE_STATUS, &compileStatus);
|
glGetShaderiv(result, GL_COMPILE_STATUS, &compileStatus);
|
||||||
|
@ -141,21 +157,6 @@ bool PixelShaderCache::CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrpr
|
||||||
// Compile failed
|
// Compile failed
|
||||||
ERROR_LOG(VIDEO, "Shader compilation failed; see info log");
|
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
|
// Don't try to use this shader
|
||||||
glDeleteShader(result);
|
glDeleteShader(result);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -119,6 +119,22 @@ bool VertexShaderCache::CompileVertexShader(VERTEXSHADER& vs, const char* pstrpr
|
||||||
|
|
||||||
glShaderSource(result, 1, &pstrprogram, NULL);
|
glShaderSource(result, 1, &pstrprogram, NULL);
|
||||||
glCompileShader(result);
|
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;
|
GLint compileStatus;
|
||||||
glGetShaderiv(result, GL_COMPILE_STATUS, &compileStatus);
|
glGetShaderiv(result, GL_COMPILE_STATUS, &compileStatus);
|
||||||
|
@ -126,22 +142,7 @@ bool VertexShaderCache::CompileVertexShader(VERTEXSHADER& vs, const char* pstrpr
|
||||||
{
|
{
|
||||||
// Compile failed
|
// Compile failed
|
||||||
ERROR_LOG(VIDEO, "Shader compilation failed; see info log");
|
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
|
// Don't try to use this shader
|
||||||
glDeleteShader(result);
|
glDeleteShader(result);
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue