Merge pull request #1971 from jpark37/gl-error-infinite-loop

libobs-opengl: Fix glGetError() infinite loop
master
Jim 2019-07-20 17:05:52 -07:00 committed by GitHub
commit e6796edcb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -27,10 +27,18 @@ static inline bool gl_success(const char *funcname)
{
GLenum errorcode = glGetError();
if (errorcode != GL_NO_ERROR) {
int attempts = 8;
do {
blog(LOG_ERROR, "%s failed, glGetError returned 0x%X",
funcname, errorcode);
errorcode = glGetError();
--attempts;
if (attempts == 0) {
blog(LOG_ERROR, "Too many GL errors, moving on",
funcname, errorcode);
break;
}
} while (errorcode != GL_NO_ERROR);
return false;
}