Fixes from Try. draft
authorJeff Gilbert <jdashg@gmail.com>
Thu, 17 Dec 2015 16:16:51 -0800
changeset 316079 96d9b10d0c81414adf03df0f2ecdf8849c66dd1b
parent 316078 f8e054f41b6b223b55a2d419a2a4f46ef34f21a0
child 316080 a2b8cd9ca4162b3794aa3f9315fc02ba03af0255
push id8514
push userjgilbert@mozilla.com
push dateFri, 18 Dec 2015 00:24:33 +0000
milestone45.0a1
Fixes from Try.
dom/canvas/WebGL2ContextFramebuffers.cpp
dom/canvas/WebGLContext.h
dom/canvas/WebGLFormats.h
dom/canvas/WebGLTextureUpload.cpp
gfx/gl/ScopedGLHelpers.h
--- a/dom/canvas/WebGL2ContextFramebuffers.cpp
+++ b/dom/canvas/WebGL2ContextFramebuffers.cpp
@@ -156,17 +156,19 @@ WebGL2Context::BlitFramebuffer(GLint src
     } else {
         dstSamples = gl->Screen()->Samples();
 
         GetBackbufferFormats(mOptions, &dstColorFormat, &dstDepthFormat,
                              &dstStencilFormat);
     }
 
     if (mask & LOCAL_GL_COLOR_BUFFER_BIT) {
-        const auto fnSignlessType = [](const webgl::FormatInfo* format) {
+        const auto fnSignlessType = [](const webgl::FormatInfo* format)
+                                    -> webgl::ComponentType
+        {
             if (!format)
                 return webgl::ComponentType::None;
 
             switch (format->componentType) {
             case webgl::ComponentType::UInt:
                 return webgl::ComponentType::Int;
 
             case webgl::ComponentType::NormUInt:
--- a/dom/canvas/WebGLContext.h
+++ b/dom/canvas/WebGLContext.h
@@ -1690,17 +1690,21 @@ public:
     UniqueBuffer()
         : mBuffer(nullptr)
     { }
 
     explicit UniqueBuffer(void* buffer)
         : mBuffer(buffer)
     { }
 
-    explicit UniqueBuffer(UniqueBuffer&& other) {
+    ~UniqueBuffer() {
+        free(mBuffer);
+    }
+
+    UniqueBuffer(UniqueBuffer&& other) {
         this->mBuffer = other.mBuffer;
         other.mBuffer = nullptr;
     }
 
     UniqueBuffer& operator =(UniqueBuffer&& other) {
         free(this->mBuffer);
         this->mBuffer = other.mBuffer;
         other.mBuffer = nullptr;
--- a/dom/canvas/WebGLFormats.h
+++ b/dom/canvas/WebGLFormats.h
@@ -242,17 +242,17 @@ struct FormatUsageInfo
 {
     const FormatInfo* const format;
     bool isRenderable;
     bool isFilterable;
     std::map<PackingInfo, DriverUnpackInfo> validUnpacks;
     const DriverUnpackInfo* idealUnpack;
     //const GLint* textureSwizzleRGBA;
 
-    FormatUsageInfo(const FormatInfo* _format)
+    explicit FormatUsageInfo(const FormatInfo* _format)
         : format(_format)
         , isRenderable(false)
         , isFilterable(false)
         , idealUnpack(nullptr)
     { }
 
     void AddUnpack(const PackingInfo& key, const DriverUnpackInfo& value);
     bool IsUnpackValid(const PackingInfo& key,
--- a/dom/canvas/WebGLTextureUpload.cpp
+++ b/dom/canvas/WebGLTextureUpload.cpp
@@ -1171,17 +1171,17 @@ WebGLTexture::TexImage(const char* funcN
                                             funcName, dstFormat->name);
             return;
         }
     }
 
     ////////////////////////////////////
     // Do the thing!
 
-    mContext->gl->MakeCurrent();
+    MOZ_ALWAYS_TRUE( mContext->gl->MakeCurrent() );
 
     // It's tempting to do allocation first, and TexSubImage second, but this is generally
     // slower.
 
     const bool isSubImage = false;
     const GLint xOffset = 0;
     const GLint yOffset = 0;
     const GLint zOffset = 0;
--- a/gfx/gl/ScopedGLHelpers.h
+++ b/gfx/gl/ScopedGLHelpers.h
@@ -40,16 +40,17 @@ protected:
     virtual ~ScopedGLWrapper() {
         if (!mIsUnwrapped)
             Unwrap();
     }
 
 public:
     void Unwrap() {
         MOZ_ASSERT(!mIsUnwrapped);
+        MOZ_ASSERT(IsContextCurrent(mGL));
 
         Derived* derived = static_cast<Derived*>(this);
         derived->UnwrapImpl();
 
         mIsUnwrapped = true;
     }
 };