Bug 665070 - part 5: implement WebGLContext::UpdateWebGLErrorAndClearGLError - r=jrmuizel

This commit is contained in:
Benoit Jacob 2011-07-07 20:01:16 -04:00
parent b9a7e5c7a7
commit 1d72ac0fab
2 changed files with 20 additions and 12 deletions

View File

@ -395,6 +395,23 @@ public:
// See section 2.2 in the WebGL spec.
void EnsureBackbufferClearedAsNeeded();
// checks for GL errors, clears any pending GL error, stores the current GL error in currentGLError,
// and copies it into mWebGLError if it doesn't already have an error set
void UpdateWebGLErrorAndClearGLError(GLenum *currentGLError) {
// get and clear GL error in ALL cases
*currentGLError = gl->GetAndClearError();
// only store in mWebGLError if is hasn't already recorded an error
if (!mWebGLError)
mWebGLError = *currentGLError;
}
// checks for GL errors, clears any pending GL error,
// and stores the current GL error into mWebGLError if it doesn't already have an error set
void UpdateWebGLErrorAndClearGLError() {
GLenum currentGLError;
UpdateWebGLErrorAndClearGLError(&currentGLError);
}
protected:
void SetDontKnowIfNeedFakeBlack() {
mFakeBlackStatus = DontKnowIfNeedFakeBlack;

View File

@ -2226,18 +2226,9 @@ WebGLContext::GetError(WebGLenum *_retval)
{
MakeContextCurrent();
// Always call GetAndClearError to clear any pending
// real GL error.
WebGLenum err = gl->GetAndClearError();
// mWebGLError has the first error that occurred,
// whether synthesized or real; if it's not NO_ERROR, use it.
if (mWebGLError != LOCAL_GL_NO_ERROR) {
err = mWebGLError;
mWebGLError = LOCAL_GL_NO_ERROR;
}
*_retval = err;
UpdateWebGLErrorAndClearGLError();
*_retval = mWebGLError;
mWebGLError = LOCAL_GL_NO_ERROR;
return NS_OK;
}