Bug 1320030 - Clear away webgl buffer while deleting vertex array object; r?ethlin draft
authorDaosheng Mu <daoshengmu@gmail.com>
Mon, 28 Nov 2016 10:26:04 +0800
changeset 444610 4d183149415957490d06e979d4f7fe83403a3ac1
parent 444478 05328d3102efd4d5fc0696489734d7771d24459f
child 538333 c96187bed474dde0364adb657d9548aa608805c7
push id37306
push userbmo:dmu@mozilla.com
push dateMon, 28 Nov 2016 10:16:34 +0000
reviewersethlin
bugs1320030
milestone53.0a1
Bug 1320030 - Clear away webgl buffer while deleting vertex array object; r?ethlin 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 bBounded = false;
     for (int32_t i = 0; i < mGLMaxVertexAttribs; i++) {
-        if (mBoundVertexArray->HasAttrib(i)) {
+        if (mBoundVertexArray->HasAttrib(i) &&
+            mBoundVertexArray->mAttribs[i].mBuf == buffer) {
             fnClearIfBuffer(mBoundVertexArray->mAttribs[i].mBuf);
+            bBounded = true;
+        }
+    }
+
+    if (bBounded) {
+        for (auto iter = mVertexArrays.begin();
+             iter != mVertexArrays.end(); ++iter) {
+            WebGLVertexArray* vertexArray = (*iter);
+            for (int32_t i = 0; i < mGLMaxVertexAttribs; i++) {
+                if (vertexArray->HasAttrib(i)) {
+                    if (vertexArray->mAttribs[i].mBuf == buffer) {
+                        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')