Bug 1320030 - Clear away webgl buffer while vertex array object is bound; r?jgilbert draft
authorDaosheng Mu <daoshengmu@gmail.com>
Mon, 28 Nov 2016 10:26:04 +0800
changeset 445146 578a7b5217c1d1d67a67f71e0e50afe183a03a16
parent 444478 05328d3102efd4d5fc0696489734d7771d24459f
child 538450 ff5a2f1bf8f2bc62ec805e2c28ee8a6ebc351b15
push id37431
push userbmo:dmu@mozilla.com
push dateTue, 29 Nov 2016 06:57:42 +0000
reviewersjgilbert
bugs1320030
milestone53.0a1
Bug 1320030 - Clear away webgl buffer while vertex array object is bound; r?jgilbert MozReview-Commit-ID: 8YCruwEPM2I
dom/canvas/WebGLContextBuffers.cpp
dom/canvas/test/webgl-conf/generated-mochitest.ini
dom/canvas/test/webgl-conf/mochitest-errata.ini
--- a/dom/canvas/WebGLContextBuffers.cpp
+++ b/dom/canvas/WebGLContextBuffers.cpp
@@ -511,19 +511,36 @@ WebGLContext::DeleteBuffer(WebGLBuffer* 
             }
         }
 
         for (auto& binding : mIndexedUniformBufferBindings) {
             fnClearIfBuffer(binding.mBufferBinding);
         }
     }
 
+    bool bBound = false;
     for (int32_t i = 0; i < mGLMaxVertexAttribs; i++) {
-        if (mBoundVertexArray->HasAttrib(i)) {
-            fnClearIfBuffer(mBoundVertexArray->mAttribs[i].mBuf);
+        if (mBoundVertexArray->HasAttrib(i) &&
+            mBoundVertexArray->mAttribs[i].mBuf == buffer) {
+            bBound = true;
+            break;
+        }
+    }
+
+    // Make sure this buffer is bound, then we clean all bindings of
+    // this buffer.
+    if (bBound) {
+        for (auto iter = mVertexArrays.begin();
+             iter != mVertexArrays.end(); ++iter) {
+            WebGLVertexArray* vertexArray = (*iter);
+            for (int32_t i = 0; i < mGLMaxVertexAttribs; i++) {
+                if (vertexArray->HasAttrib(i)) {
+                    fnClearIfBuffer(vertexArray->mAttribs[i].mBuf);
+                }
+            }
         }
     }
 
     ////
 
     buffer->RequestDelete();
 }
 
--- a/dom/canvas/test/webgl-conf/generated-mochitest.ini
+++ b/dom/canvas/test/webgl-conf/generated-mochitest.ini
@@ -4590,17 +4590,17 @@ fail-if = (os == 'mac')
 skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
 [generated/test_2_conformance2__state__gl-getstring.html]
 skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
 [generated/test_2_conformance2__state__gl-object-get-calls.html]
 skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
 [generated/test_2_conformance2__transform_feedback__transform_feedback.html]
 skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
 [generated/test_2_conformance2__vertex_arrays__vertex-array-object.html]
-fail-if = (os == 'mac') || (os == 'win')
+fail-if = (os == 'mac')
 skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
 [generated/test_2_conformance__attribs__gl-bindAttribLocation-aliasing.html]
 skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
 [generated/test_2_conformance__attribs__gl-bindAttribLocation-matrix.html]
 skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
 [generated/test_2_conformance__attribs__gl-bindAttribLocation-repeated.html]
 skip-if = (os == 'android' || os == 'linux' || (os == 'win' && os_version == '5.1'))
 [generated/test_2_conformance__attribs__gl-disabled-vertex-attrib.html]
@@ -6023,17 +6023,17 @@ fail-if = (os == 'android')
 [generated/test_conformance__extensions__oes-texture-half-float-with-video.html]
 skip-if = (os == 'win' && os_version == '6.1')
 fail-if = (os == 'android')
 [generated/test_conformance__extensions__oes-texture-half-float.html]
 fail-if = (os == 'mac') || (os == 'win') || (os == 'android') || (os == 'linux')
 [generated/test_conformance__extensions__oes-vertex-array-object-bufferData.html]
 [generated/test_conformance__extensions__oes-vertex-array-object.html]
 skip-if = (os == 'mac' && os_version == '10.6')
-fail-if = (os == 'win') || (os == 'mac') || (os == 'android') || (os == 'linux')
+fail-if = (os == 'mac') || (os == 'android') || (os == 'linux')
 [generated/test_conformance__extensions__webgl-compressed-texture-atc.html]
 [generated/test_conformance__extensions__webgl-compressed-texture-pvrtc.html]
 [generated/test_conformance__extensions__webgl-compressed-texture-s3tc.html]
 [generated/test_conformance__extensions__webgl-compressed-texture-size-limit.html]
 skip-if = (os == 'win')
 [generated/test_conformance__extensions__webgl-debug-renderer-info.html]
 [generated/test_conformance__extensions__webgl-debug-shaders.html]
 [generated/test_conformance__extensions__webgl-depth-texture.html]
@@ -6736,17 +6736,17 @@ skip-if = (os == 'android')
 [generated/test_conformance__textures__misc__texture-npot.html]
 skip-if = (os == 'android')
 [generated/test_conformance__textures__misc__texture-size-cube-maps.html]
 skip-if = (os == 'android')
 [generated/test_conformance__textures__misc__texture-size-limit.html]
 skip-if = (os == 'linux' && asan)
 fail-if = (os == 'linux') || (os == 'android')
 [generated/test_conformance__textures__misc__texture-size.html]
-skip-if = (os == 'android') || (os == 'win')
+skip-if = (os == 'android')
 [generated/test_conformance__textures__misc__texture-sub-image-cube-maps.html]
 skip-if = (os == 'android')
 [generated/test_conformance__textures__misc__texture-transparent-pixels-initialized.html]
 [generated/test_conformance__textures__misc__texture-upload-cube-maps.html]
 [generated/test_conformance__textures__misc__texture-upload-size.html]
 skip-if = (os == 'win') || (os == 'android')
 [generated/test_conformance__textures__video__tex-2d-rgb-rgb-unsigned_byte.html]
 fail-if = (os == 'android')
--- a/dom/canvas/test/webgl-conf/mochitest-errata.ini
+++ b/dom/canvas/test/webgl-conf/mochitest-errata.ini
@@ -124,34 +124,34 @@ skip-if = (os == 'android') || (os == 'b
 fail-if = (os == 'android')
 # void mozilla::gl::GLContext::fDetachShader(GLuint, GLuint): Generated unexpected GL_INVALID_VALUE error. (0x0501)
 skip-if = (os == 'android' && debug)
 
 [generated/test_conformance__extensions__oes-vertex-array-object.html]
 # 10.6 crash:
 # PROCESS-CRASH | dom/canvas/test/webgl-conf/generated/test_conformance__extensions__oes-vertex-array-object.html | application crashed [@ gleRunVertexSubmitImmediate + 0xf24]
 skip-if = (os == 'mac' && os_version == '10.6')
-fail-if = (os == 'win') || (os == 'mac') || (os == 'android') || (os == 'linux')
+fail-if = (os == 'mac') || (os == 'android') || (os == 'linux')
 [generated/test_conformance__textures__misc__texture-size.html]
 # application crashed [@ mozilla::gl::GLContext::AfterGLCall]
-skip-if = (os == 'android') || (os == 'win')
+skip-if = (os == 'android')
 
 [generated/test_2_conformance__textures__misc__cube-incomplete-fbo.html]
 fail-if = (os == 'mac')
 skip-if = (os == 'win')
 [generated/test_2_conformance__extensions__webgl-compressed-texture-s3tc.html]
 fail-if = (os == 'mac') || (os == 'win')
 [generated/test_2_conformance2__rendering__draw-buffers.html]
 fail-if = (os == 'mac') || (os == 'win')
 [generated/test_2_conformance__textures__misc__tex-image-with-format-and-type.html]
 fail-if = (os == 'mac')
 [generated/test_2_conformance__attribs__gl-vertexattribpointer.html]
 fail-if = (os == 'mac') || (os == 'win')
 [generated/test_2_conformance2__vertex_arrays__vertex-array-object.html]
-fail-if = (os == 'mac') || (os == 'win')
+fail-if = (os == 'mac')
 [generated/test_2_conformance__rendering__negative-one-index.html]
 fail-if = (os == 'mac')
 [generated/test_conformance__extensions__oes-texture-half-float.html]
 fail-if = (os == 'mac') || (os == 'win') || (os == 'android') || (os == 'linux')
 [generated/test_2_conformance2__reading__read-pixels-pack-parameters.html]
 fail-if = (os == 'mac') || (os == 'win')
 [generated/test_conformance__attribs__gl-vertexattribpointer.html]
 fail-if = (os == 'mac') || (os == 'win') || (os == 'android') || (os == 'linux')