Log the same shader code as is actually compiled

For whatever reason, the shader code that was passed to the compiler was
different from the code that got written to the shader log. This is a
huge pain in the ass when trying to debug shader errors because the line
information is completely wrong. I assume this decision was a premature
optimization, so I've removed it and we'll now log the exact same code
as the shader compiler sees.
lights3
Nicolas Hake 2015-08-16 14:20:15 +02:00
parent 0d16e67066
commit 5ef76d63a9
1 changed files with 5 additions and 4 deletions

View File

@ -317,19 +317,20 @@ bool C4Shader::Init(const char *szWhat, const char **szUniforms)
if (hProg) Clear();
#endif
StdStrBuf VertexShader = Build(VertexSlices, true),
FragmentShader = Build(FragmentSlices, true);
// Dump
if (C4Shader::IsLogging())
{
ShaderLogF("******** Vertex shader for %s:", szWhat);
ShaderLog(Build(VertexSlices, true).getData());
ShaderLog(VertexShader.getData());
ShaderLogF("******** Fragment shader for %s:", szWhat);
ShaderLog(Build(FragmentSlices, true).getData());
ShaderLog(FragmentShader.getData());
}
#ifndef USE_CONSOLE
// Attempt to create shaders
StdStrBuf VertexShader = Build(VertexSlices),
FragmentShader = Build(FragmentSlices);
hVert = Create(GL_VERTEX_SHADER_ARB,
FormatString("%s vertex shader", szWhat).getData(),
VertexShader.getData());