Bug 1250710 - Remove redundant IsCurrent checks. - r=ethlin
MozReview-Commit-ID: GApYK5HC0EO
--- a/gfx/gl/ScopedGLHelpers.cpp
+++ b/gfx/gl/ScopedGLHelpers.cpp
@@ -81,19 +81,16 @@ ScopedBindFramebuffer::ScopedBindFramebu
{
Init();
mGL->BindFB(aNewFB);
}
void
ScopedBindFramebuffer::UnwrapImpl()
{
- // Check that we're not falling out of scope after the current context changed.
- MOZ_ASSERT(mGL->IsCurrent());
-
if (mOldReadFB == mOldDrawFB) {
mGL->BindFB(mOldDrawFB);
} else {
mGL->BindDrawFB(mOldDrawFB);
mGL->BindReadFB(mOldReadFB);
}
}
@@ -105,76 +102,60 @@ ScopedBindTextureUnit::ScopedBindTexture
{
MOZ_ASSERT(aTexUnit >= LOCAL_GL_TEXTURE0);
mGL->GetUIntegerv(LOCAL_GL_ACTIVE_TEXTURE, &mOldTexUnit);
mGL->fActiveTexture(aTexUnit);
}
void
ScopedBindTextureUnit::UnwrapImpl() {
- // Check that we're not falling out of scope after the current context changed.
- MOZ_ASSERT(mGL->IsCurrent());
-
mGL->fActiveTexture(mOldTexUnit);
}
/* ScopedTexture **************************************************************/
ScopedTexture::ScopedTexture(GLContext* aGL)
: ScopedGLWrapper<ScopedTexture>(aGL)
{
- MOZ_ASSERT(mGL->IsCurrent());
mGL->fGenTextures(1, &mTexture);
}
void
ScopedTexture::UnwrapImpl()
{
- // Check that we're not falling out of scope after
- // the current context changed.
- MOZ_ASSERT(mGL->IsCurrent());
mGL->fDeleteTextures(1, &mTexture);
}
-
/* ScopedFramebuffer **************************************************************/
ScopedFramebuffer::ScopedFramebuffer(GLContext* aGL)
: ScopedGLWrapper<ScopedFramebuffer>(aGL)
{
- MOZ_ASSERT(mGL->IsCurrent());
mGL->fGenFramebuffers(1, &mFB);
}
void
ScopedFramebuffer::UnwrapImpl()
{
- // Check that we're not falling out of scope after
- // the current context changed.
- MOZ_ASSERT(mGL->IsCurrent());
mGL->fDeleteFramebuffers(1, &mFB);
}
/* ScopedRenderbuffer **************************************************************/
ScopedRenderbuffer::ScopedRenderbuffer(GLContext* aGL)
: ScopedGLWrapper<ScopedRenderbuffer>(aGL)
{
- MOZ_ASSERT(mGL->IsCurrent());
mGL->fGenRenderbuffers(1, &mRB);
}
void
ScopedRenderbuffer::UnwrapImpl()
{
- // Check that we're not falling out of scope after
- // the current context changed.
- MOZ_ASSERT(mGL->IsCurrent());
mGL->fDeleteRenderbuffers(1, &mRB);
}
/* ScopedBindTexture **********************************************************/
static GLuint
GetBoundTexture(GLContext* gl, GLenum texTarget)
{
@@ -246,20 +227,18 @@ ScopedBindRenderbuffer::ScopedBindRender
ScopedBindRenderbuffer::ScopedBindRenderbuffer(GLContext* aGL, GLuint aNewRB)
: ScopedGLWrapper<ScopedBindRenderbuffer>(aGL)
{
Init();
mGL->fBindRenderbuffer(LOCAL_GL_RENDERBUFFER, aNewRB);
}
void
-ScopedBindRenderbuffer::UnwrapImpl() {
- // Check that we're not falling out of scope after the current context changed.
- MOZ_ASSERT(mGL->IsCurrent());
-
+ScopedBindRenderbuffer::UnwrapImpl()
+{
mGL->fBindRenderbuffer(LOCAL_GL_RENDERBUFFER, mOldRB);
}
/* ScopedFramebufferForTexture ************************************************/
ScopedFramebufferForTexture::ScopedFramebufferForTexture(GLContext* aGL,
GLuint aTexture,
GLenum aTarget)
@@ -545,19 +524,16 @@ ScopedPackState::ScopedPackState(GLConte
if (mRowLength != 0) mGL->fPixelStorei(LOCAL_GL_PACK_ROW_LENGTH, 0);
if (mSkipPixels != 0) mGL->fPixelStorei(LOCAL_GL_PACK_SKIP_PIXELS, 0);
if (mSkipRows != 0) mGL->fPixelStorei(LOCAL_GL_PACK_SKIP_ROWS, 0);
}
void
ScopedPackState::UnwrapImpl()
{
- // Check that we're not falling out of scope after the current context changed.
- MOZ_ASSERT(mGL->IsCurrent());
-
mGL->fPixelStorei(LOCAL_GL_PACK_ALIGNMENT, mAlignment);
if (!HasPBOState(mGL))
return;
mGL->fBindBuffer(LOCAL_GL_PIXEL_PACK_BUFFER, mPixelBuffer);
mGL->fPixelStorei(LOCAL_GL_PACK_ROW_LENGTH, mRowLength);
mGL->fPixelStorei(LOCAL_GL_PACK_SKIP_PIXELS, mSkipPixels);
@@ -590,19 +566,16 @@ ScopedUnpackState::ScopedUnpackState(GLC
if (mSkipImages != 0) mGL->fPixelStorei(LOCAL_GL_UNPACK_SKIP_IMAGES, 0);
if (mSkipPixels != 0) mGL->fPixelStorei(LOCAL_GL_UNPACK_SKIP_PIXELS, 0);
if (mSkipRows != 0) mGL->fPixelStorei(LOCAL_GL_UNPACK_SKIP_ROWS, 0);
}
void
ScopedUnpackState::UnwrapImpl()
{
- // Check that we're not falling out of scope after the current context changed.
- MOZ_ASSERT(mGL->IsCurrent());
-
mGL->fPixelStorei(LOCAL_GL_UNPACK_ALIGNMENT, mAlignment);
if (!HasPBOState(mGL))
return;
mGL->fBindBuffer(LOCAL_GL_PIXEL_UNPACK_BUFFER, mPixelBuffer);
mGL->fPixelStorei(LOCAL_GL_UNPACK_IMAGE_HEIGHT, mImageHeight);
mGL->fPixelStorei(LOCAL_GL_UNPACK_ROW_LENGTH, mRowLength);