mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
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:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -81,7 +81,7 @@ private:
|
||||
GLint getUniformLocation(const std::string &name);
|
||||
void checkSetUniformError();
|
||||
GLuint createShader(const ShaderSource &source);
|
||||
void createProgram(const std::vector<GLuint> &shaders);
|
||||
void createProgram(const std::vector<GLuint> &shaderids);
|
||||
|
||||
std::vector<ShaderSource> _shadersources; // all shader code attached to this ShaderEffect
|
||||
|
||||
|
||||
Reference in New Issue
Block a user