Fix ScopedCopyTex* and fix build error on Mac. draft
authorJeff Gilbert <jdashg@gmail.com>
Thu, 17 Dec 2015 16:16:52 -0800
changeset 316083 04cc2f3be0b7c720c273b0ada76a868a087b2051
parent 316082 9e2b96f2efddeb8b29cba56f9ae7d86bf40b583b
child 316084 4e4963104c3eff60281b8166caae4d51cd156445
push id8514
push userjgilbert@mozilla.com
push dateFri, 18 Dec 2015 00:24:33 +0000
milestone45.0a1
Fix ScopedCopyTex* and fix build error on Mac.
dom/canvas/WebGLContextDraw.cpp
dom/canvas/WebGLTextureUpload.cpp
--- a/dom/canvas/WebGLContextDraw.cpp
+++ b/dom/canvas/WebGLContextDraw.cpp
@@ -24,18 +24,18 @@ namespace mozilla {
 static const int MAX_DRAW_CALLS_SINCE_FLUSH = 100;
 
 ////////////////////////////////////////
 
 class ScopedResolveTexturesForDraw
 {
     struct TexRebindRequest
     {
-        const uint32_t texUnit;
-        WebGLTexture* const tex;
+        uint32_t texUnit;
+        WebGLTexture* tex;
     };
 
     WebGLContext* const mWebGL;
     std::vector<TexRebindRequest> mRebindRequests;
 
 public:
     ScopedResolveTexturesForDraw(WebGLContext* webgl, const char* funcName,
                                  bool* const out_error);
--- a/dom/canvas/WebGLTextureUpload.cpp
+++ b/dom/canvas/WebGLTextureUpload.cpp
@@ -1664,16 +1664,22 @@ template<typename T>
 static inline GLenum
 ToGLHandle(const T& obj)
 {
     return (obj ? obj->mGLName : 0);
 }
 
 ScopedCopyTexImageSource::~ScopedCopyTexImageSource()
 {
+    if (!mFB) {
+        MOZ_ASSERT(!mRB);
+        return;
+    }
+    MOZ_ASSERT(mRB);
+
     gl::GLContext* gl = mWebGL->gl;
 
     // If we're swizzling, it's because we're on a GL core (3.2+) profile, which has
     // split framebuffer support.
     gl->fBindFramebuffer(LOCAL_GL_DRAW_FRAMEBUFFER,
                          ToGLHandle(mWebGL->mBoundDrawFramebuffer));
     gl->fBindFramebuffer(LOCAL_GL_READ_FRAMEBUFFER,
                          ToGLHandle(mWebGL->mBoundReadFramebuffer));