Bug 1381610 - Check bindRenderbuffer called before framebufferRenderbuffer. r=jgilbert
authorSamuel Vargas <svargas@mozilla.com>
Mon, 17 Jul 2017 16:52:00 -0400
changeset 418302 28836e42d21a1e125f5cd06b766197436384c44b
parent 418301 477268fa767f88f50fc99380a1bf3b303bb1b53d
child 418303 b230bd5c696b7e057e76d504a5798af878870220
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1381610
milestone56.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 1381610 - Check bindRenderbuffer called before framebufferRenderbuffer. r=jgilbert
dom/canvas/WebGLFramebuffer.cpp
--- a/dom/canvas/WebGLFramebuffer.cpp
+++ b/dom/canvas/WebGLFramebuffer.cpp
@@ -1384,18 +1384,27 @@ WebGLFramebuffer::FramebufferRenderbuffe
 
     // `rbTarget`
     if (rbtarget != LOCAL_GL_RENDERBUFFER) {
         mContext->ErrorInvalidEnumInfo("framebufferRenderbuffer: rbtarget:", rbtarget);
         return;
     }
 
     // `rb`
-    if (rb && !mContext->ValidateObject("framebufferRenderbuffer: rb", *rb))
-        return;
+    if (rb) {
+        if (!mContext->ValidateObject("framebufferRenderbuffer: rb", *rb))
+            return;
+
+        if (!rb->mHasBeenBound) {
+            mContext->ErrorInvalidOperation("%s: bindRenderbuffer must be called before"
+                                            " attachment to %04x",
+                                            funcName, attachEnum);
+            return;
+      }
+    }
 
     // End of validation.
 
     if (mContext->IsWebGL2() && attachEnum == LOCAL_GL_DEPTH_STENCIL_ATTACHMENT) {
         mDepthAttachment.SetRenderbuffer(funcName, rb);
         mStencilAttachment.SetRenderbuffer(funcName, rb);
     } else {
         attach->SetRenderbuffer(funcName, rb);