report glsl shader warings as errors
This commit is contained in:
parent
714ff50fdf
commit
2c010f530e
|
@ -134,21 +134,14 @@ bool PixelShaderCache::CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrpr
|
||||||
glShaderSource(result, 1, &pstrprogram, NULL);
|
glShaderSource(result, 1, &pstrprogram, NULL);
|
||||||
glCompileShader(result);
|
glCompileShader(result);
|
||||||
|
|
||||||
GLint compileStatus;
|
|
||||||
glGetShaderiv(result, GL_COMPILE_STATUS, &compileStatus);
|
|
||||||
if (compileStatus != GL_TRUE)
|
|
||||||
{
|
|
||||||
// Compile failed
|
|
||||||
ERROR_LOG(VIDEO, "Shader compilation failed; see info log");
|
|
||||||
|
|
||||||
GLsizei length = 0;
|
GLsizei length = 0;
|
||||||
glGetShaderiv(result, GL_INFO_LOG_LENGTH, &length);
|
glGetShaderiv(result, GL_INFO_LOG_LENGTH, &length);
|
||||||
if (length > 0)
|
if (length > 1)
|
||||||
{
|
{
|
||||||
GLsizei charsWritten;
|
GLsizei charsWritten;
|
||||||
GLchar* infoLog = new GLchar[length];
|
GLchar* infoLog = new GLchar[length];
|
||||||
glGetShaderInfoLog(result, length, &charsWritten, infoLog);
|
glGetShaderInfoLog(result, length, &charsWritten, infoLog);
|
||||||
WARN_LOG(VIDEO, "PS Shader info log:\n%s", infoLog);
|
ERROR_LOG(VIDEO, "PS Shader info log:\n%s", infoLog);
|
||||||
char szTemp[MAX_PATH];
|
char szTemp[MAX_PATH];
|
||||||
sprintf(szTemp, "ps_%d.txt", result);
|
sprintf(szTemp, "ps_%d.txt", result);
|
||||||
FILE *fp = fopen(szTemp, "wb");
|
FILE *fp = fopen(szTemp, "wb");
|
||||||
|
@ -156,6 +149,14 @@ bool PixelShaderCache::CompilePixelShader(FRAGMENTSHADER& ps, const char* pstrpr
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
delete[] infoLog;
|
delete[] infoLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLint compileStatus;
|
||||||
|
glGetShaderiv(result, GL_COMPILE_STATUS, &compileStatus);
|
||||||
|
if (compileStatus != GL_TRUE)
|
||||||
|
{
|
||||||
|
// Compile failed
|
||||||
|
ERROR_LOG(VIDEO, "Shader compilation failed; see info log");
|
||||||
|
|
||||||
// Don't try to use this shader
|
// Don't try to use this shader
|
||||||
glDeleteShader(result);
|
glDeleteShader(result);
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -120,21 +120,14 @@ bool VertexShaderCache::CompileVertexShader(VERTEXSHADER& vs, const char* pstrpr
|
||||||
glShaderSource(result, 1, &pstrprogram, NULL);
|
glShaderSource(result, 1, &pstrprogram, NULL);
|
||||||
glCompileShader(result);
|
glCompileShader(result);
|
||||||
|
|
||||||
GLint compileStatus;
|
|
||||||
glGetShaderiv(result, GL_COMPILE_STATUS, &compileStatus);
|
|
||||||
if (compileStatus != GL_TRUE)
|
|
||||||
{
|
|
||||||
// Compile failed
|
|
||||||
ERROR_LOG(VIDEO, "Shader compilation failed; see info log");
|
|
||||||
|
|
||||||
GLsizei length = 0;
|
GLsizei length = 0;
|
||||||
glGetShaderiv(result, GL_INFO_LOG_LENGTH, &length);
|
glGetShaderiv(result, GL_INFO_LOG_LENGTH, &length);
|
||||||
if (length > 0)
|
if (length > 1)
|
||||||
{
|
{
|
||||||
GLsizei charsWritten;
|
GLsizei charsWritten;
|
||||||
GLchar* infoLog = new GLchar[length];
|
GLchar* infoLog = new GLchar[length];
|
||||||
glGetShaderInfoLog(result, length, &charsWritten, infoLog);
|
glGetShaderInfoLog(result, length, &charsWritten, infoLog);
|
||||||
WARN_LOG(VIDEO, "VS Shader info log:\n%s", infoLog);
|
ERROR_LOG(VIDEO, "VS Shader info log:\n%s", infoLog);
|
||||||
char szTemp[MAX_PATH];
|
char szTemp[MAX_PATH];
|
||||||
sprintf(szTemp, "vs_%d.txt", result);
|
sprintf(szTemp, "vs_%d.txt", result);
|
||||||
FILE *fp = fopen(szTemp, "wb");
|
FILE *fp = fopen(szTemp, "wb");
|
||||||
|
@ -142,6 +135,14 @@ bool VertexShaderCache::CompileVertexShader(VERTEXSHADER& vs, const char* pstrpr
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
delete[] infoLog;
|
delete[] infoLog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLint compileStatus;
|
||||||
|
glGetShaderiv(result, GL_COMPILE_STATUS, &compileStatus);
|
||||||
|
if (compileStatus != GL_TRUE)
|
||||||
|
{
|
||||||
|
// Compile failed
|
||||||
|
ERROR_LOG(VIDEO, "Shader compilation failed; see info log");
|
||||||
|
|
||||||
// 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