Use GLSL #line preprocessor directive instead of manually trying to convert error message lines; flag shader objects for lazy-deletion after linking with program object instead of detaching them immediately (debuggers can now view source code of shader programs)

This commit is contained in:
Alexander Szpakowski
2012-12-28 21:32:13 -04:00
parent f54c270042
commit d62878fbb8
4 changed files with 21 additions and 62 deletions
+2 -17
View File
@@ -167,7 +167,7 @@ void ShaderEffect::createProgram(const std::vector<GLuint> &shaderids)
glLinkProgram(_program);
for (it = shaderids.begin(); it != shaderids.end(); ++it)
glDetachShader(_program, *it); // we can freely detach shaders after linking
glDeleteShader(*it); // flag shaders for deletion as soon as program object is deleted
GLint link_ok;
glGetProgramiv(_program, GL_LINK_STATUS, &link_ok);
@@ -196,22 +196,7 @@ bool ShaderEffect::loadVolatile()
if (shaderids.size() == 0)
throw love::Exception("Cannot create shader effect: no valid source code!");
try
{
createProgram(shaderids);
}
catch (love::Exception &e)
{
std::vector<GLuint>::const_iterator it;
for (it = shaderids.begin(); it != shaderids.end(); ++it)
glDeleteShader(*it);
throw;
}
std::vector<GLuint>::const_iterator it;
for (it = shaderids.begin(); it != shaderids.end(); ++it)
glDeleteShader(*it);
createProgram(shaderids);
if (current == this)
{