Merge pull request #7031 from sachingarg05/GLProgramNoAbort

GLProgram should not abort() if shader compilation fails, returning false is better.
This commit is contained in:
minggo 2014-06-12 15:03:29 +08:00
commit 5a28ba68b4
1 changed files with 12 additions and 4 deletions

View File

@ -138,9 +138,17 @@ GLProgram::~GLProgram()
{ {
CCLOGINFO("%s %d deallocing GLProgram: %p", __FUNCTION__, __LINE__, this); CCLOGINFO("%s %d deallocing GLProgram: %p", __FUNCTION__, __LINE__, this);
// there is no need to delete the shaders. They should have been already deleted. if (_vertShader)
CCASSERT(_vertShader == 0, "Vertex Shaders should have been already deleted"); {
CCASSERT(_fragShader == 0, "Fragment Shaders should have been already deleted"); glDeleteShader(_vertShader);
}
if (_fragShader)
{
glDeleteShader(_fragShader);
}
_vertShader = _fragShader = 0;
if (_program) if (_program)
{ {
@ -436,7 +444,7 @@ bool GLProgram::compileShader(GLuint * shader, GLenum type, const GLchar* source
} }
free(src); free(src);
abort(); return false;;
} }
return (status == GL_TRUE); return (status == GL_TRUE);
} }