Bug 1143979 - Use RAII local instead of useless temporary. - r=kamidphish
authorJeff Gilbert <jgilbert@mozilla.com>
Mon, 16 Mar 2015 19:38:06 -0700
changeset 265343 7be2bc492deb2ef9ae1b4fa58fa3377ead10b3ec
parent 265342 7d9bc7d1998456ec0a750473350b3c890e316ea6
child 265344 f75beaf3149fd745e760143ef08053f461210f6e
push id830
push userraliiev@mozilla.com
push dateFri, 19 Jun 2015 19:24:37 +0000
treeherdermozilla-release@932614382a68 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskamidphish
bugs1143979
milestone39.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 1143979 - Use RAII local instead of useless temporary. - r=kamidphish
dom/canvas/WebGLRenderbuffer.cpp
dom/canvas/WebGLTexture.cpp
--- a/dom/canvas/WebGLRenderbuffer.cpp
+++ b/dom/canvas/WebGLRenderbuffer.cpp
@@ -174,16 +174,18 @@ RenderbufferStorageMaybeMultisample(gl::
                                  height);
     }
 }
 
 void
 WebGLRenderbuffer::RenderbufferStorage(GLsizei samples, GLenum internalFormat,
                                        GLsizei width, GLsizei height) const
 {
+    MOZ_ASSERT(mContext->mBoundRenderbuffer == this);
+
     gl::GLContext* gl = mContext->gl;
     MOZ_ASSERT(samples >= 0 && samples <= 256); // Sanity check.
 
     GLenum primaryFormat = internalFormat;
     GLenum secondaryFormat = 0;
 
     if (NeedsDepthStencilEmu(mContext->gl, primaryFormat)) {
         primaryFormat = DepthStencilDepthFormat(gl);
--- a/dom/canvas/WebGLTexture.cpp
+++ b/dom/canvas/WebGLTexture.cpp
@@ -594,20 +594,20 @@ ClearWithTempFB(WebGLContext* webgl, GLu
 
     if (mask & LOCAL_GL_COLOR_BUFFER_BIT) {
         // Nope, it already had one.
         return false;
     }
 
     gl::ScopedRenderbuffer rb(gl);
     {
-        gl::ScopedBindRenderbuffer(gl, rb.RB());
-        gl->fRenderbufferStorage(LOCAL_GL_RENDERBUFFER,
-                                 LOCAL_GL_RGBA4,
-                                 width, height);
+        // Only GLES guarantees RGBA4.
+        GLenum format = gl->IsGLES() ? LOCAL_GL_RGBA4 : LOCAL_GL_RGBA8;
+        gl::ScopedBindRenderbuffer rbBinding(gl, rb.RB());
+        gl->fRenderbufferStorage(LOCAL_GL_RENDERBUFFER, format, width, height);
     }
 
     gl->fFramebufferRenderbuffer(LOCAL_GL_FRAMEBUFFER, LOCAL_GL_COLOR_ATTACHMENT0,
                                  LOCAL_GL_RENDERBUFFER, rb.RB());
     mask |= LOCAL_GL_COLOR_BUFFER_BIT;
 
     // Last chance!
     return ClearByMask(webgl, mask);