GLProgram should not abort() if shader compilation fails, returning false will allow app to show custom error message to user (or use other simple shaders if a complicated shader fails to compile on some device).

This commit is contained in:
Sachin Garg 2014-06-10 17:59:15 +05:30
Родитель 8222cdd8aa
Коммит 8ba4c7a083
1 изменённых файлов: 12 добавлений и 4 удалений

Просмотреть файл

@ -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);
} }