Bug 863477 - Use SurfaceCaps::Any() for CreateOffscreen for GLContexts for NPAPI plugins. r=cpeterson
authorJeff Gilbert <jgilbert@mozilla.com>
Thu, 25 Apr 2013 09:35:50 -0700
changeset 129896 ad5badac802f
parent 129895 34819ac4912e
child 129897 cf9d73c44cbf
push id24590
push userryanvm@gmail.com
push date2013-04-26 01:39 +0000
treeherdermozilla-central@7f68735fc8da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpeterson
bugs863477
milestone23.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 863477 - Use SurfaceCaps::Any() for CreateOffscreen for GLContexts for NPAPI plugins. r=cpeterson
dom/plugins/base/nsNPAPIPluginInstance.cpp
gfx/gl/GLContext.cpp
gfx/gl/GLContext.h
--- a/dom/plugins/base/nsNPAPIPluginInstance.cpp
+++ b/dom/plugins/base/nsNPAPIPluginInstance.cpp
@@ -78,18 +78,18 @@ private:
 };
 
 static nsRefPtr<GLContext> sPluginContext = nullptr;
 
 static bool EnsureGLContext()
 {
   if (!sPluginContext) {
     gfxIntSize dummySize(16, 16);
-    GLContext::SurfaceCaps dummyCaps;
-    sPluginContext = GLContextProvider::CreateOffscreen(dummySize, dummyCaps);
+    sPluginContext = GLContextProvider::CreateOffscreen(dummySize,
+                                                        GLContext::SurfaceCaps::Any());
   }
 
   return sPluginContext != nullptr;
 }
 
 class SharedPluginTexture {
 public:
   NS_INLINE_DECL_REFCOUNTING(SharedPluginTexture)
--- a/gfx/gl/GLContext.cpp
+++ b/gfx/gl/GLContext.cpp
@@ -864,19 +864,22 @@ GLContext::QueryPixelFormat()
 }
 
 void
 GLContext::UpdatePixelFormat()
 {
     PixelBufferFormat format = QueryPixelFormat();
 #ifdef DEBUG
     const SurfaceCaps& caps = Caps();
+    MOZ_ASSERT(!caps.any, "Did you forget to DetermineCaps()?");
+
     MOZ_ASSERT(caps.color == !!format.red);
     MOZ_ASSERT(caps.color == !!format.green);
     MOZ_ASSERT(caps.color == !!format.blue);
+
     MOZ_ASSERT(caps.alpha == !!format.alpha);
     MOZ_ASSERT(caps.depth == !!format.depth);
     MOZ_ASSERT(caps.stencil == !!format.stencil);
     MOZ_ASSERT(caps.antialias == (format.samples > 1));
 #endif
     mPixelFormat = new PixelBufferFormat(format);
 }
 
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -1190,17 +1190,20 @@ public:
             return false;
 
         MakeCurrent();
         fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, 0);
         fScissor(0, 0, size.width, size.height);
         fViewport(0, 0, size.width, size.height);
 
         mCaps = mScreen->Caps();
-        UpdateGLFormats(caps);
+        if (mCaps.any)
+            DetermineCaps();
+
+        UpdateGLFormats(mCaps);
         UpdatePixelFormat();
 
         return true;
     }
 
 protected:
     // Note that it does -not- clear the resized buffers.
     bool CreateScreenBuffer(const gfxIntSize& size, const SurfaceCaps& caps) {