Bug 1395497 - Modify ScopedBindTexture to allow save/restore r=jgilbert
MozReview-Commit-ID: JLYMWXslUHd
--- a/gfx/gl/ScopedGLHelpers.cpp
+++ b/gfx/gl/ScopedGLHelpers.cpp
@@ -194,17 +194,19 @@ GetBoundTexture(GLContext* gl, GLenum te
return ret;
}
ScopedBindTexture::ScopedBindTexture(GLContext* aGL, GLuint aNewTex, GLenum aTarget)
: ScopedGLWrapper<ScopedBindTexture>(aGL)
, mTarget(aTarget)
, mOldTex(GetBoundTexture(aGL, aTarget))
{
- mGL->fBindTexture(mTarget, aNewTex);
+ if (aNewTex) {
+ mGL->fBindTexture(mTarget, aNewTex);
+ }
}
void
ScopedBindTexture::UnwrapImpl()
{
mGL->fBindTexture(mTarget, mOldTex);
}