Bug 1492580 - Limit glGetError flush loop and handle CONTEXT_LOST. r=lsalzman

Differential Revision: https://phabricator.services.mozilla.com/D11270

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jeff Gilbert 2018-11-08 17:19:02 +00:00
parent c803ccff25
commit ba222f72b8
2 changed files with 25 additions and 12 deletions

View File

@ -2058,6 +2058,30 @@ GLContext::MarkDestroyed()
mSymbols = {};
}
// -
GLenum
GLContext::RawGetErrorAndClear() const
{
const GLenum ret = mSymbols.fGetError();
auto flushedErr = ret;
uint32_t i = 1;
while (flushedErr && flushedErr != LOCAL_GL_CONTEXT_LOST) {
if (i == 100) {
gfxCriticalError() << "Flushing glGetError still " << gfx::hexa(flushedErr)
<< " after " << i << " calls.";
break;
}
flushedErr = mSymbols.fGetError();
i += 1;
}
return ret;
}
// -
#ifdef MOZ_GL_DEBUG
/* static */ void
GLContext::AssertNotPassingStackBufferToTheGL(const void* ptr)

View File

@ -579,18 +579,7 @@ public:
private:
mutable GLenum mTopError = 0;
GLenum RawGetError() const {
return mSymbols.fGetError();
}
GLenum RawGetErrorAndClear() const {
GLenum err = RawGetError();
if (err)
while (RawGetError()) {}
return err;
}
GLenum RawGetErrorAndClear() const;
GLenum FlushErrors() const {
GLenum err = RawGetErrorAndClear();