Bug 1395497 - Modify ScopedBindTexture to allow save/restore r=jgilbert draft
authorJames Willcox <snorp@snorp.net>
Thu, 28 Sep 2017 08:32:18 -0500
changeset 672892 e79081d81d52dd8153d112691cb5ecd56fa679ce
parent 672891 f1e97d601f8207a9c5dc1aa32c6e6414780ca501
child 672893 4197d97b7d22d1c7ff43e2d2b6d15232229fbfc0
push id82413
push userbmo:snorp@snorp.net
push dateFri, 29 Sep 2017 21:51:56 +0000
reviewersjgilbert
bugs1395497
milestone58.0a1
Bug 1395497 - Modify ScopedBindTexture to allow save/restore r=jgilbert MozReview-Commit-ID: JLYMWXslUHd
gfx/gl/ScopedGLHelpers.cpp
--- 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);
 }