Bug 1318507 - SharedArrayBuffer must be wrapped in a view before being passed to WebGL. a=gchang
☠☠ backed out by 0da2d0158f98 ☠ ☠
authorJeff Gilbert (:jgilbert) <jgilbert@mozilla.com>
Fri, 18 Nov 2016 14:46:52 -0800
changeset 352991 b5d390d820b03c007954bd627a4d84f2deb6728f
parent 352990 11dc44b794665b2417acc5463b9e790af9b4cdea
child 352992 3f1441255bca982628cd3250927fa6bb7eaefd8b
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgchang
bugs1318507
milestone52.0a2
Bug 1318507 - SharedArrayBuffer must be wrapped in a view before being passed to WebGL. a=gchang MozReview-Commit-ID: LwfI62iChno
dom/canvas/test/webgl-mochitest/test_sab_with_webgl.html
--- a/dom/canvas/test/webgl-mochitest/test_sab_with_webgl.html
+++ b/dom/canvas/test/webgl-mochitest/test_sab_with_webgl.html
@@ -94,19 +94,19 @@ function TestScreenColor(gl, r, g, b, a)
   gl.useProgram(prog);
 
   // Test gl.bufferData(), gl.bufferSubData() and gl.readPixels() APIs with SAB as input.
   var arr = new SharedArrayBuffer(8*4);
   var view = new Float32Array(arr);
   view.set(new Float32Array([-1, -1, 1, -1, -1,  1, 1,  1]));
   var vb = gl.createBuffer();
   gl.bindBuffer(gl.ARRAY_BUFFER, vb);
-  gl.bufferData(gl.ARRAY_BUFFER, arr, gl.STATIC_DRAW);
+  gl.bufferData(gl.ARRAY_BUFFER, view, gl.STATIC_DRAW);
   ok(gl.getError() == 0, 'bufferData with SAB as input parameter works ok.');
-  gl.bufferSubData(gl.ARRAY_BUFFER, 0, arr);
+  gl.bufferSubData(gl.ARRAY_BUFFER, 0, view);
   ok(gl.getError() == 0, 'bufferSubData with SAB as input parameter works ok.');
   gl.enableVertexAttribArray(0);
   gl.vertexAttribPointer(0, 2, gl.FLOAT, false, 0, 0);
   gl.clearColor(0, 0, 0, 1.0);
   gl.clear(gl.COLOR_BUFFER_BIT);
   gl.uniform4f(prog.uFragColor, 0.2, 0.4, 0.6, 1.0);
   gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
   var arr = new Uint8Array(4);
@@ -148,17 +148,17 @@ function TestScreenColor(gl, r, g, b, a)
     return;
   }
 
   var arr = new SharedArrayBuffer(8*4);
   var view = new Float32Array(arr);
   view.set(new Float32Array([-1, -1, 1, -1, -1,  1, 1,  1]));
   var vb = gl.createBuffer();
   gl.bindBuffer(gl.ARRAY_BUFFER, vb);
-  gl.bufferData(gl.ARRAY_BUFFER, arr, gl.STATIC_DRAW);
+  gl.bufferData(gl.ARRAY_BUFFER, view, gl.STATIC_DRAW);
 
   var arr2 = new SharedArrayBuffer(8*4);
   var view2 = new Float32Array(arr2);
   gl.getBufferSubData(gl.ARRAY_BUFFER, 0, view2);
   var equal = true;
   for(var i = 0; i < 8; ++i) {
     if (view[i] != view2[i]) equal = false;
   }