Commit a1391806 authored by xidachen's avatar xidachen Committed by Commit bot

Removed some duplicate layout tests under fast/canvas/webgl

Most of these tests are testing conformance for TypedArrays, ArrayBuffer,
bufferData, and some basic WebGL functions. I believe all these tests
are upstreamed in Github, so there is no reason to keep it here.

Note that I didn't delete all tests under this dir, only the ones I
can quickly locate its duplicates on conformance test suite.

BUG=none

Review-Url: https://codereview.chromium.org/2447493002
Cr-Commit-Position: refs/heads/master@{#427194}
parent d2c61e49
...@@ -5,9 +5,6 @@ ...@@ -5,9 +5,6 @@
crbug.com/420198 [ Linux ] fast/js/regress [ Skip ] crbug.com/420198 [ Linux ] fast/js/regress [ Skip ]
crbug.com/420198 [ Linux ] virtual/slimmingpaint/fast/js/regress [ Skip ] crbug.com/420198 [ Linux ] virtual/slimmingpaint/fast/js/regress [ Skip ]
crbug.com/420198 [ Linux ] editing/selection/move-by-word-visually-crash-test-5.html [ Skip ] crbug.com/420198 [ Linux ] editing/selection/move-by-word-visually-crash-test-5.html [ Skip ]
crbug.com/420198 [ Linux ] fast/canvas/webgl/webgl-large-texture.html [ Skip ]
crbug.com/420198 [ Linux ] virtual/display_list_2d_canvas/fast/canvas/webgl/webgl-large-texture.html [ Skip ]
crbug.com/420198 [ Linux ] virtual/slimmingpaint/fast/canvas/webgl/webgl-large-texture.html [ Skip ]
crbug.com/420198 [ Linux ] perf/array-nested-loop.html [ Skip ] crbug.com/420198 [ Linux ] perf/array-nested-loop.html [ Skip ]
crbug.com/420198 [ Linux ] fast/css/fontface-arraybuffer.html [ Skip ] crbug.com/420198 [ Linux ] fast/css/fontface-arraybuffer.html [ Skip ]
crbug.com/420198 [ Linux ] virtual/slimmingpaint/fast/css/fontface-arraybuffer.html [ Skip ] crbug.com/420198 [ Linux ] virtual/slimmingpaint/fast/css/fontface-arraybuffer.html [ Skip ]
......
...@@ -247,8 +247,6 @@ crbug.com/490511 imported/wpt/html/semantics/embedded-content/media-elements/pla ...@@ -247,8 +247,6 @@ crbug.com/490511 imported/wpt/html/semantics/embedded-content/media-elements/pla
crbug.com/490511 imported/wpt/html/semantics/forms/textfieldselection/selection.html [ Slow ] crbug.com/490511 imported/wpt/html/semantics/forms/textfieldselection/selection.html [ Slow ]
crbug.com/346259 http/tests/websocket/no-crash-on-cookie-flood.html [ Slow ] crbug.com/346259 http/tests/websocket/no-crash-on-cookie-flood.html [ Slow ]
crbug.com/358313 virtual/gpu/fast/canvas/webgl/webgl-large-texture.html [ Slow ]
crbug.com/522646 http/tests/media/encrypted-media/encrypted-media-encrypted-event-different-origin.html [ Slow ] crbug.com/522646 http/tests/media/encrypted-media/encrypted-media-encrypted-event-different-origin.html [ Slow ]
crbug.com/411164 [ Win ] http/tests/security/powerfulFeatureRestrictions/serviceworker-on-insecure-origin.html [ Slow ] crbug.com/411164 [ Win ] http/tests/security/powerfulFeatureRestrictions/serviceworker-on-insecure-origin.html [ Slow ]
crbug.com/510337 inspector/console/console-format.html [ Slow ] crbug.com/510337 inspector/console/console-format.html [ Slow ]
......
PASS successfullyParsed is true
TEST COMPLETE
Test that the event passed to a listener of webglcontextlost is a WebGLContextEvent.
PASS evt.toString() is '[object WebGLContextEvent]'
PASS evt.statusMessage is ''
PASS context.getError() is context.NO_ERROR
Test that the event passed to a listener of webglcontextrestored is a WebGLContextEvent.
PASS evt.toString() is '[object WebGLContextEvent]'
PASS evt.statusMessage is ''
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
<script src="resources/webgl-test-utils.js"></script>
<script>
var evt;
var canvas;
var context;
var extension;
function createNewCanvas()
{
canvas = document.createElement("canvas");
canvas.width = 1;
canvas.height = 1;
context = WebGLTestUtils.create3DContext(canvas);
extension = context.getExtension("WEBGL_lose_context");
if (!extension) {
debug("Could not find the WEBGL_lose_context extension.");
return;
}
}
function runTest1()
{
if (window.initNonKhronosFramework)
window.initNonKhronosFramework(true);
createNewCanvas();
canvas.addEventListener("webglcontextlost", function(e) {
evt = e;
debug("Test that the event passed to a listener of webglcontextlost is a WebGLContextEvent.")
shouldBe("evt.toString()", "'[object WebGLContextEvent]'");
shouldBe("evt.statusMessage", "''");
// Start the next test when event dispatch has finished.
setTimeout(function() {
runTest2();
}, 0);
}, false);
extension.loseContext();
}
function runTest2()
{
createNewCanvas();
canvas.addEventListener("webglcontextlost", function(e) {
e.preventDefault();
// Restore the context after event dispatch has finished.
setTimeout(function() {
// Because context restoration is specified as being asynchronous, we can not verify
// that the GL error state is empty here.
extension.restoreContext();
}, 0);
}, false);
canvas.addEventListener("webglcontextrestored", function(e) {
evt = e;
shouldBe("context.getError()", "context.NO_ERROR");
debug("Test that the event passed to a listener of webglcontextrestored is a WebGLContextEvent.")
shouldBe("evt.toString()", "'[object WebGLContextEvent]'");
shouldBe("evt.statusMessage", "''");
setTimeout(finish, 0);
}, false);
extension.loseContext();
}
function finish() {
finishJSTest();
}
</script>
</head>
<body onload="runTest1()">
<div id="description"></div>
<div id="console"></div>
<canvas id="canvas">
</body>
</html>
Checks that array access in a shader can not read out of bounds
PASS Top left corner should clamp to index 0
PASS Inside top right corner should clamp to index 0
PASS Inside bottom left corner should clamp to index 0
PASS Bottom right corner should clamp to index 7
PASS Outside bottom left corner should clamp to index 7
PASS Outside top right corner should clamp to index 7
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>WebGL array bounds clamping conformance test.</title>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"> </script>
</head>
<body>
<canvas id="example" width="40" height="40" style="width: 40px; height: 40px;"></canvas>
<div id="description"></div>
<div id="console"></div>
<script id="vshader" type="x-shader/x-vertex">
#ifdef GL_ES
precision highp float;
#endif
attribute vec4 vPosition;
attribute float index;
uniform float shades[8];
varying vec4 texColor;
void main()
{
gl_Position = vPosition;
texColor = vec4(shades[int(index)], 0, 0, 1.0);
}
</script>
<script id="fshader" type="x-shader/x-fragment">
#ifdef GL_ES
precision highp float;
#endif
varying vec4 texColor;
void main()
{
gl_FragColor = texColor;
}
</script>
<script>
function init()
{
if (window.initNonKhronosFramework)
window.initNonKhronosFramework(false);
debug("Checks that array access in a shader can not read out of bounds");
debug("");
gl = initWebGL("example", "vshader", "fshader", [ "vPosition", "index" ],
[ 1, 1, 1, 1 ], 1);
gl.disable(gl.DEPTH_TEST);
gl.disable(gl.BLEND);
var vertexObject = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
gl.bufferData(gl.ARRAY_BUFFER,
new Float32Array([ -1,1,0, 1,1,0, -1,-1,0,
-1,-1,0, 1,1,0, 1,-1,0 ]),
gl.STATIC_DRAW);
gl.enableVertexAttribArray(0);
gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0);
var vertexObject = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
gl.bufferData(gl.ARRAY_BUFFER,
// Create an array that exercises well outside the
// limits on each side, near the limits, and the
// exact limits.
// This should be clamped to [0, 0, 0, 7, 7, 7]
new Float32Array([ -123456789, -1, 0, 7, 8, 123456789]),
gl.STATIC_DRAW);
gl.enableVertexAttribArray(1);
gl.vertexAttribPointer(1, 1, gl.FLOAT, false, 0, 0);
var loc = gl.getUniformLocation(gl.program, "shades");
gl.uniform1fv(loc, [0.25, 0.5, 0, 0, 0, 0, 0.75, 1]);
checkRedValue(0, 38, 64, "Top left corner should clamp to index 0");
checkRedValue(37, 38, 64, "Inside top right corner should clamp to index 0");
checkRedValue(0, 1, 64, "Inside bottom left corner should clamp to index 0");
checkRedValue(38, 0, 255, "Bottom right corner should clamp to index 7");
checkRedValue(3, 1, 255, "Outside bottom left corner should clamp to index 7");
checkRedValue(38, 37, 255, "Outside top right corner should clamp to index 7");
function checkRedValue(x, y, value, msg) {
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
gl.drawArrays(gl.TRIANGLES, 0, 6);
gl.flush();
var buf = new Uint8Array(4);
gl.readPixels(x, y, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, buf);
if (buf[0] != value || buf[1] != 0 || buf[2] != 0 || buf[3] != 255) {
debug('expected: rgb(' + value + ', 0, 0, 255) was rgb(' + buf[0] + ', ' + buf[1] + ', ' + buf[2] + ', ' + buf[3] + ')');
testFailed(msg);
return;
}
testPassed(msg);
}
}
init();
</script>
</body>
</html>
Verify that reassigning typed array constructor does not crash.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS reassigning typed array constructor did not crash
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description('Verify that reassigning typed array constructor does not crash.');
<!-- The following used to cause a crash in Chrome -->
Uint8Array = 0;
Uint16Array = "string";
Uint32Array = function() {};
Int16Array = function() {};
Int16Array.prototype.set = 0;
new Float64Array(function () {});
new Float32Array([1, 2, 3], 1);
new Int16Array(function() {});
testPassed("reassigning typed array constructor did not crash");
</script>
<script>
</script>
</body>
</html>
Verifies that when constructing WebGLArray with nan values, it results in a 0
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS 10 is 10
PASS 0 is 0
PASS 0 is 0
PASS 0 is 0
PASS 0 is 0
PASS 0 is 0
PASS 0 is 0
PASS 0 is 0
PASS 0 is 0
PASS 0 is 0
PASS 0 is 0
PASS 10 is 10
PASS 0 is 0
PASS 0 is 0
PASS 0 is 0
PASS 0 is 0
PASS 0 is 0
PASS 0 is 0
PASS 0 is 0
PASS 0 is 0
PASS 0 is 0
PASS 0 is 0
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description("Verifies that when constructing WebGLArray with nan values, it results in a 0");
var source, target, idx;
source = new Array(10);
target = new Uint8Array(source);
shouldBe(target.length.toString(), source.length.toString())
for (idx = 0; idx < target.length; idx++) {
shouldBeZero(target[idx].toString());
}
source = {length: 10};
target = new Uint8Array(source);
shouldBe(target.length.toString(), source.length.toString())
for (idx = 0; idx < target.length; idx++) {
shouldBeZero(target[idx].toString());
}
</script>
</body>
</html>
Verifies that the get method, and the set method for individual elements, on the WebGLArray types no longer exist.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Regression test for https://bugs.webkit.org/show_bug.cgi?id=38039
PASS webGLArray.get is undefined.
PASS webGLArray.set(0, 1) threw exception.
PASS webGLArray.get is undefined.
PASS webGLArray.set(0, 1) threw exception.
PASS webGLArray.get is undefined.
PASS webGLArray.set(0, 1) threw exception.
PASS webGLArray.get is undefined.
PASS webGLArray.set(0, 1) threw exception.
PASS webGLArray.get is undefined.
PASS webGLArray.set(0, 1) threw exception.
PASS webGLArray.get is undefined.
PASS webGLArray.set(0, 1) threw exception.
PASS webGLArray.get is undefined.
PASS webGLArray.set(0, 1) threw exception.
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description("Verifies that the get method, and the set method for individual elements, on the WebGLArray types no longer exist.");
debug('Regression test for <a href="https://bugs.webkit.org/show_bug.cgi?id=38039">https://bugs.webkit.org/show_bug.cgi?id=38039</a>');
// Global scope so shouldThrow can see it
var webGLArray;
function negativeTestGetAndSetMethods(typeName) {
var type = window[typeName];
webGLArray = new type([2, 3]);
shouldBeUndefined("webGLArray.get");
var exceptionThrown = false;
// We deliberately check for an exception here rather than using
// shouldThrow here because the precise contents of the syntax
// error are not specified.
try {
webGLArray.set(0, 1);
} catch (e) {
exceptionThrown = true;
}
var output = "webGLArray.set(0, 1) ";
if (exceptionThrown) {
testPassed(output + "threw exception.");
} else {
testFailed(output + "did not throw exception.");
}
}
negativeTestGetAndSetMethods("Int8Array");
negativeTestGetAndSetMethods("Uint8Array");
negativeTestGetAndSetMethods("Int16Array");
negativeTestGetAndSetMethods("Uint16Array");
negativeTestGetAndSetMethods("Int32Array");
negativeTestGetAndSetMethods("Uint32Array");
negativeTestGetAndSetMethods("Float32Array");
</script>
</body>
</html>
Verifies that calling the indexing operator on WebGLArrays with out-of-range indices returns undefined.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Regression test for https://bugs.webkit.org/show_bug.cgi?id=38039
PASS webGLArray[2] is undefined.
PASS webGLArray[-1] is undefined.
PASS webGLArray[0x20000000] is undefined.
PASS webGLArray[2] is undefined.
PASS webGLArray[-1] is undefined.
PASS webGLArray[0x20000000] is undefined.
PASS webGLArray[2] is undefined.
PASS webGLArray[-1] is undefined.
PASS webGLArray[0x20000000] is undefined.
PASS webGLArray[2] is undefined.
PASS webGLArray[-1] is undefined.
PASS webGLArray[0x20000000] is undefined.
PASS webGLArray[2] is undefined.
PASS webGLArray[-1] is undefined.
PASS webGLArray[0x20000000] is undefined.
PASS webGLArray[2] is undefined.
PASS webGLArray[-1] is undefined.
PASS webGLArray[0x20000000] is undefined.
PASS webGLArray[2] is undefined.
PASS webGLArray[-1] is undefined.
PASS webGLArray[0x20000000] is undefined.
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description("Verifies that calling the indexing operator on WebGLArrays with out-of-range indices returns undefined.");
debug('Regression test for <a href="https://bugs.webkit.org/show_bug.cgi?id=38039">https://bugs.webkit.org/show_bug.cgi?id=38039</a>');
// Global scope so shouldThrow can see it
var webGLArray;
function testGetWithOutOfRangeIndices(typeName) {
var type = window[typeName];
webGLArray = new type([2, 3]);
shouldBeUndefined("webGLArray[2]");
shouldBeUndefined("webGLArray[-1]");
shouldBeUndefined("webGLArray[0x20000000]");
}
testGetWithOutOfRangeIndices("Int8Array");
testGetWithOutOfRangeIndices("Uint8Array");
testGetWithOutOfRangeIndices("Int16Array");
testGetWithOutOfRangeIndices("Uint16Array");
testGetWithOutOfRangeIndices("Int32Array");
testGetWithOutOfRangeIndices("Uint32Array");
testGetWithOutOfRangeIndices("Float32Array");
</script>
</body>
</html>
Test passing ArrayBuffers and ArrayBufferViews in messages.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS ArrayBuffer0: classes are [object ArrayBuffer]
PASS ArrayBuffer0: buffer lengths are 0
PASS ArrayBuffer0: buffers have the same contents
PASS ArrayBuffer1: classes are [object ArrayBuffer]
PASS ArrayBuffer1: buffer lengths are 1
PASS ArrayBuffer1: buffers have the same contents
PASS ArrayBuffer128: classes are [object ArrayBuffer]
PASS ArrayBuffer128: buffer lengths are 128
PASS ArrayBuffer128: buffers have the same contents
PASS DataView0: classes are [object DataView]
PASS DataView0: classes are [object ArrayBuffer]
PASS DataView0: buffer lengths are 0
PASS DataView0: buffers have the same contents
PASS DataView0: offset is 0
PASS DataView0: length is 0
PASS DataView1: classes are [object DataView]
PASS DataView1: classes are [object ArrayBuffer]
PASS DataView1: buffer lengths are 1
PASS DataView1: buffers have the same contents
PASS DataView1: offset is 0
PASS DataView1: length is 1
PASS DataView1-dup: classes are [object DataView]
PASS DataView1-dup: classes are [object ArrayBuffer]
PASS DataView1-dup: buffer lengths are 1
PASS DataView1-dup: buffers have the same contents
PASS DataView1-dup: offset is 0
PASS DataView1-dup: length is 1
PASS DataView1-dup: classes are [object DataView]
PASS DataView1-dup: classes are [object ArrayBuffer]
PASS DataView1-dup: buffer lengths are 1
PASS DataView1-dup: buffers have the same contents
PASS DataView1-dup: offset is 0
PASS DataView1-dup: length is 1
PASS DataView1-dup2: classes are [object DataView]
PASS DataView1-dup2: classes are [object ArrayBuffer]
PASS DataView1-dup2: buffer lengths are 1
PASS DataView1-dup2: buffers have the same contents
PASS DataView1-dup2: offset is 0
PASS DataView1-dup2: length is 1
PASS DataView1-dup2: classes are [object DataView]
PASS DataView1-dup2: classes are [object ArrayBuffer]
PASS DataView1-dup2: buffer lengths are 1
PASS DataView1-dup2: buffers have the same contents
PASS DataView1-dup2: offset is 0
PASS DataView1-dup2: length is 1
PASS DataView128: classes are [object DataView]
PASS DataView128: classes are [object ArrayBuffer]
PASS DataView128: buffer lengths are 128
PASS DataView128: buffers have the same contents
PASS DataView128: offset is 0
PASS DataView128: length is 128
PASS DataView1_offset_at_end: classes are [object DataView]
PASS DataView1_offset_at_end: classes are [object ArrayBuffer]
PASS DataView1_offset_at_end: buffer lengths are 1
PASS DataView1_offset_at_end: buffers have the same contents
PASS DataView1_offset_at_end: offset is 1
PASS DataView1_offset_at_end: length is 0
PASS DataView128_offset_at_end: classes are [object DataView]
PASS DataView128_offset_at_end: classes are [object ArrayBuffer]
PASS DataView128_offset_at_end: buffer lengths are 128
PASS DataView128_offset_at_end: buffers have the same contents
PASS DataView128_offset_at_end: offset is 128
PASS DataView128_offset_at_end: length is 0
PASS DataView128_offset_slice_length_0: classes are [object DataView]
PASS DataView128_offset_slice_length_0: classes are [object ArrayBuffer]
PASS DataView128_offset_slice_length_0: buffer lengths are 128
PASS DataView128_offset_slice_length_0: buffers have the same contents
PASS DataView128_offset_slice_length_0: offset is 64
PASS DataView128_offset_slice_length_0: length is 0
PASS DataView128_offset_slice_length_1: classes are [object DataView]
PASS DataView128_offset_slice_length_1: classes are [object ArrayBuffer]
PASS DataView128_offset_slice_length_1: buffer lengths are 128
PASS DataView128_offset_slice_length_1: buffers have the same contents
PASS DataView128_offset_slice_length_1: offset is 64
PASS DataView128_offset_slice_length_1: length is 1
PASS DataView128_offset_slice_length_16: classes are [object DataView]
PASS DataView128_offset_slice_length_16: classes are [object ArrayBuffer]
PASS DataView128_offset_slice_length_16: buffer lengths are 128
PASS DataView128_offset_slice_length_16: buffers have the same contents
PASS DataView128_offset_slice_length_16: offset is 64
PASS DataView128_offset_slice_length_16: length is 16
PASS DataView128_offset_slice_unaligned: classes are [object DataView]
PASS DataView128_offset_slice_unaligned: classes are [object ArrayBuffer]
PASS DataView128_offset_slice_unaligned: buffer lengths are 128
PASS DataView128_offset_slice_unaligned: buffers have the same contents
PASS DataView128_offset_slice_unaligned: offset is 63
PASS DataView128_offset_slice_unaligned: length is 15
PASS Int32_0: classes are [object Int32Array]
PASS Int32_0: classes are [object ArrayBuffer]
PASS Int32_0: buffer lengths are 0
PASS Int32_0: buffers have the same contents
PASS Int32_0: offset is 0
PASS Int32_0: length is 0
PASS Uint32_0: classes are [object Uint32Array]
PASS Uint32_0: classes are [object ArrayBuffer]
PASS Uint32_0: buffer lengths are 0
PASS Uint32_0: buffers have the same contents
PASS Uint32_0: offset is 0
PASS Uint32_0: length is 0
PASS Int8_0: classes are [object Int8Array]
PASS Int8_0: classes are [object ArrayBuffer]
PASS Int8_0: buffer lengths are 0
PASS Int8_0: buffers have the same contents
PASS Int8_0: offset is 0
PASS Int8_0: length is 0
PASS Uint8_0: classes are [object Uint8Array]
PASS Uint8_0: classes are [object ArrayBuffer]
PASS Uint8_0: buffer lengths are 0
PASS Uint8_0: buffers have the same contents
PASS Uint8_0: offset is 0
PASS Uint8_0: length is 0
PASS Uint8Clamped_0: classes are [object Uint8ClampedArray]
PASS Uint8Clamped_0: classes are [object ArrayBuffer]
PASS Uint8Clamped_0: buffer lengths are 0
PASS Uint8Clamped_0: buffers have the same contents
PASS Uint8Clamped_0: offset is 0
PASS Uint8Clamped_0: length is 0
PASS Int16_0: classes are [object Int16Array]
PASS Int16_0: classes are [object ArrayBuffer]
PASS Int16_0: buffer lengths are 0
PASS Int16_0: buffers have the same contents
PASS Int16_0: offset is 0
PASS Int16_0: length is 0
PASS Uint16_0: classes are [object Uint16Array]
PASS Uint16_0: classes are [object ArrayBuffer]
PASS Uint16_0: buffer lengths are 0
PASS Uint16_0: buffers have the same contents
PASS Uint16_0: offset is 0
PASS Uint16_0: length is 0
PASS Float32_0: classes are [object Float32Array]
PASS Float32_0: classes are [object ArrayBuffer]
PASS Float32_0: buffer lengths are 0
PASS Float32_0: buffers have the same contents
PASS Float32_0: offset is 0
PASS Float32_0: length is 0
PASS Float64_0: classes are [object Float64Array]
PASS Float64_0: classes are [object ArrayBuffer]
PASS Float64_0: buffer lengths are 0
PASS Float64_0: buffers have the same contents
PASS Float64_0: offset is 0
PASS Float64_0: length is 0
PASS Int32_1: classes are [object Int32Array]
PASS Int32_1: classes are [object ArrayBuffer]
PASS Int32_1: buffer lengths are 4
PASS Int32_1: buffers have the same contents
PASS Int32_1: offset is 0
PASS Int32_1: length is 4
PASS Uint32_1: classes are [object Uint32Array]
PASS Uint32_1: classes are [object ArrayBuffer]
PASS Uint32_1: buffer lengths are 4
PASS Uint32_1: buffers have the same contents
PASS Uint32_1: offset is 0
PASS Uint32_1: length is 4
PASS Int8_1: classes are [object Int8Array]
PASS Int8_1: classes are [object ArrayBuffer]
PASS Int8_1: buffer lengths are 1
PASS Int8_1: buffers have the same contents
PASS Int8_1: offset is 0
PASS Int8_1: length is 1
PASS Uint8_1: classes are [object Uint8Array]
PASS Uint8_1: classes are [object ArrayBuffer]
PASS Uint8_1: buffer lengths are 1
PASS Uint8_1: buffers have the same contents
PASS Uint8_1: offset is 0
PASS Uint8_1: length is 1
PASS Uint8Clamped_1: classes are [object Uint8ClampedArray]
PASS Uint8Clamped_1: classes are [object ArrayBuffer]
PASS Uint8Clamped_1: buffer lengths are 1
PASS Uint8Clamped_1: buffers have the same contents
PASS Uint8Clamped_1: offset is 0
PASS Uint8Clamped_1: length is 1
PASS Int16_1: classes are [object Int16Array]
PASS Int16_1: classes are [object ArrayBuffer]
PASS Int16_1: buffer lengths are 2
PASS Int16_1: buffers have the same contents
PASS Int16_1: offset is 0
PASS Int16_1: length is 2
PASS Uint16_1: classes are [object Uint16Array]
PASS Uint16_1: classes are [object ArrayBuffer]
PASS Uint16_1: buffer lengths are 2
PASS Uint16_1: buffers have the same contents
PASS Uint16_1: offset is 0
PASS Uint16_1: length is 2
PASS Float32_1: classes are [object Float32Array]
PASS Float32_1: classes are [object ArrayBuffer]
PASS Float32_1: buffer lengths are 4
PASS Float32_1: buffers have the same contents
PASS Float32_1: offset is 0
PASS Float32_1: length is 4
PASS Float64_1: classes are [object Float64Array]
PASS Float64_1: classes are [object ArrayBuffer]
PASS Float64_1: buffer lengths are 8
PASS Float64_1: buffers have the same contents
PASS Float64_1: offset is 0
PASS Float64_1: length is 8
PASS Int32_128: classes are [object Int32Array]
PASS Int32_128: classes are [object ArrayBuffer]
PASS Int32_128: buffer lengths are 512
PASS Int32_128: buffers have the same contents
PASS Int32_128: offset is 0
PASS Int32_128: length is 512
PASS Uint32_128: classes are [object Uint32Array]
PASS Uint32_128: classes are [object ArrayBuffer]
PASS Uint32_128: buffer lengths are 512
PASS Uint32_128: buffers have the same contents
PASS Uint32_128: offset is 0
PASS Uint32_128: length is 512
PASS Int8_128: classes are [object Int8Array]
PASS Int8_128: classes are [object ArrayBuffer]
PASS Int8_128: buffer lengths are 128
PASS Int8_128: buffers have the same contents
PASS Int8_128: offset is 0
PASS Int8_128: length is 128
PASS Uint8_128: classes are [object Uint8Array]
PASS Uint8_128: classes are [object ArrayBuffer]
PASS Uint8_128: buffer lengths are 128
PASS Uint8_128: buffers have the same contents
PASS Uint8_128: offset is 0
PASS Uint8_128: length is 128
PASS Uint8Clamped_128: classes are [object Uint8ClampedArray]
PASS Uint8Clamped_128: classes are [object ArrayBuffer]
PASS Uint8Clamped_128: buffer lengths are 128
PASS Uint8Clamped_128: buffers have the same contents
PASS Uint8Clamped_128: offset is 0
PASS Uint8Clamped_128: length is 128
PASS Int16_128: classes are [object Int16Array]
PASS Int16_128: classes are [object ArrayBuffer]
PASS Int16_128: buffer lengths are 256
PASS Int16_128: buffers have the same contents
PASS Int16_128: offset is 0
PASS Int16_128: length is 256
PASS Uint16_128: classes are [object Uint16Array]
PASS Uint16_128: classes are [object ArrayBuffer]
PASS Uint16_128: buffer lengths are 256
PASS Uint16_128: buffers have the same contents
PASS Uint16_128: offset is 0
PASS Uint16_128: length is 256
PASS Float32_128: classes are [object Float32Array]
PASS Float32_128: classes are [object ArrayBuffer]
PASS Float32_128: buffer lengths are 512
PASS Float32_128: buffers have the same contents
PASS Float32_128: offset is 0
PASS Float32_128: length is 512
PASS Float64_128: classes are [object Float64Array]
PASS Float64_128: classes are [object ArrayBuffer]
PASS Float64_128: buffer lengths are 1024
PASS Float64_128: buffers have the same contents
PASS Float64_128: offset is 0
PASS Float64_128: length is 1024
PASS Int32_0_buffer: classes are [object Int32Array]
PASS Int32_0_buffer: classes are [object ArrayBuffer]
PASS Int32_0_buffer: buffer lengths are 0
PASS Int32_0_buffer: buffers have the same contents
PASS Int32_0_buffer: offset is 0
PASS Int32_0_buffer: length is 0
PASS Uint32_0_buffer: classes are [object Uint32Array]
PASS Uint32_0_buffer: classes are [object ArrayBuffer]
PASS Uint32_0_buffer: buffer lengths are 0
PASS Uint32_0_buffer: buffers have the same contents
PASS Uint32_0_buffer: offset is 0
PASS Uint32_0_buffer: length is 0
PASS Int8_0_buffer: classes are [object Int8Array]
PASS Int8_0_buffer: classes are [object ArrayBuffer]
PASS Int8_0_buffer: buffer lengths are 0
PASS Int8_0_buffer: buffers have the same contents
PASS Int8_0_buffer: offset is 0
PASS Int8_0_buffer: length is 0
PASS Uint8_0_buffer: classes are [object Uint8Array]
PASS Uint8_0_buffer: classes are [object ArrayBuffer]
PASS Uint8_0_buffer: buffer lengths are 0
PASS Uint8_0_buffer: buffers have the same contents
PASS Uint8_0_buffer: offset is 0
PASS Uint8_0_buffer: length is 0
PASS Uint8Clamped_0_buffer: classes are [object Uint8ClampedArray]
PASS Uint8Clamped_0_buffer: classes are [object ArrayBuffer]
PASS Uint8Clamped_0_buffer: buffer lengths are 0
PASS Uint8Clamped_0_buffer: buffers have the same contents
PASS Uint8Clamped_0_buffer: offset is 0
PASS Uint8Clamped_0_buffer: length is 0
PASS Int16_0_buffer: classes are [object Int16Array]
PASS Int16_0_buffer: classes are [object ArrayBuffer]
PASS Int16_0_buffer: buffer lengths are 0
PASS Int16_0_buffer: buffers have the same contents
PASS Int16_0_buffer: offset is 0
PASS Int16_0_buffer: length is 0
PASS Uint16_0_buffer: classes are [object Uint16Array]
PASS Uint16_0_buffer: classes are [object ArrayBuffer]
PASS Uint16_0_buffer: buffer lengths are 0
PASS Uint16_0_buffer: buffers have the same contents
PASS Uint16_0_buffer: offset is 0
PASS Uint16_0_buffer: length is 0
PASS Float32_0_buffer: classes are [object Float32Array]
PASS Float32_0_buffer: classes are [object ArrayBuffer]
PASS Float32_0_buffer: buffer lengths are 0
PASS Float32_0_buffer: buffers have the same contents
PASS Float32_0_buffer: offset is 0
PASS Float32_0_buffer: length is 0
PASS Float64_0_buffer: classes are [object Float64Array]
PASS Float64_0_buffer: classes are [object ArrayBuffer]
PASS Float64_0_buffer: buffer lengths are 0
PASS Float64_0_buffer: buffers have the same contents
PASS Float64_0_buffer: offset is 0
PASS Float64_0_buffer: length is 0
PASS Int32_1_buffer: classes are [object Int32Array]
PASS Int32_1_buffer: classes are [object ArrayBuffer]
PASS Int32_1_buffer: buffer lengths are 4
PASS Int32_1_buffer: buffers have the same contents
PASS Int32_1_buffer: offset is 0
PASS Int32_1_buffer: length is 4
PASS Uint32_1_buffer: classes are [object Uint32Array]
PASS Uint32_1_buffer: classes are [object ArrayBuffer]
PASS Uint32_1_buffer: buffer lengths are 4
PASS Uint32_1_buffer: buffers have the same contents
PASS Uint32_1_buffer: offset is 0
PASS Uint32_1_buffer: length is 4
PASS Int8_1_buffer: classes are [object Int8Array]
PASS Int8_1_buffer: classes are [object ArrayBuffer]
PASS Int8_1_buffer: buffer lengths are 1
PASS Int8_1_buffer: buffers have the same contents
PASS Int8_1_buffer: offset is 0
PASS Int8_1_buffer: length is 1
PASS Uint8_1_buffer: classes are [object Uint8Array]
PASS Uint8_1_buffer: classes are [object ArrayBuffer]
PASS Uint8_1_buffer: buffer lengths are 1
PASS Uint8_1_buffer: buffers have the same contents
PASS Uint8_1_buffer: offset is 0
PASS Uint8_1_buffer: length is 1
PASS Uint8Clamped_1_buffer: classes are [object Uint8ClampedArray]
PASS Uint8Clamped_1_buffer: classes are [object ArrayBuffer]
PASS Uint8Clamped_1_buffer: buffer lengths are 1
PASS Uint8Clamped_1_buffer: buffers have the same contents
PASS Uint8Clamped_1_buffer: offset is 0
PASS Uint8Clamped_1_buffer: length is 1
PASS Int16_1_buffer: classes are [object Int16Array]
PASS Int16_1_buffer: classes are [object ArrayBuffer]
PASS Int16_1_buffer: buffer lengths are 2
PASS Int16_1_buffer: buffers have the same contents
PASS Int16_1_buffer: offset is 0
PASS Int16_1_buffer: length is 2
PASS Uint16_1_buffer: classes are [object Uint16Array]
PASS Uint16_1_buffer: classes are [object ArrayBuffer]
PASS Uint16_1_buffer: buffer lengths are 2
PASS Uint16_1_buffer: buffers have the same contents
PASS Uint16_1_buffer: offset is 0
PASS Uint16_1_buffer: length is 2
PASS Float32_1_buffer: classes are [object Float32Array]
PASS Float32_1_buffer: classes are [object ArrayBuffer]
PASS Float32_1_buffer: buffer lengths are 4
PASS Float32_1_buffer: buffers have the same contents
PASS Float32_1_buffer: offset is 0
PASS Float32_1_buffer: length is 4
PASS Float64_1_buffer: classes are [object Float64Array]
PASS Float64_1_buffer: classes are [object ArrayBuffer]
PASS Float64_1_buffer: buffer lengths are 8
PASS Float64_1_buffer: buffers have the same contents
PASS Float64_1_buffer: offset is 0
PASS Float64_1_buffer: length is 8
PASS Int32_128_buffer: classes are [object Int32Array]
PASS Int32_128_buffer: classes are [object ArrayBuffer]
PASS Int32_128_buffer: buffer lengths are 512
PASS Int32_128_buffer: buffers have the same contents
PASS Int32_128_buffer: offset is 0
PASS Int32_128_buffer: length is 512
PASS Uint32_128_buffer: classes are [object Uint32Array]
PASS Uint32_128_buffer: classes are [object ArrayBuffer]
PASS Uint32_128_buffer: buffer lengths are 512
PASS Uint32_128_buffer: buffers have the same contents
PASS Uint32_128_buffer: offset is 0
PASS Uint32_128_buffer: length is 512
PASS Int8_128_buffer: classes are [object Int8Array]
PASS Int8_128_buffer: classes are [object ArrayBuffer]
PASS Int8_128_buffer: buffer lengths are 128
PASS Int8_128_buffer: buffers have the same contents
PASS Int8_128_buffer: offset is 0
PASS Int8_128_buffer: length is 128
PASS Uint8_128_buffer: classes are [object Uint8Array]
PASS Uint8_128_buffer: classes are [object ArrayBuffer]
PASS Uint8_128_buffer: buffer lengths are 128
PASS Uint8_128_buffer: buffers have the same contents
PASS Uint8_128_buffer: offset is 0
PASS Uint8_128_buffer: length is 128
PASS Uint8Clamped_128_buffer: classes are [object Uint8ClampedArray]
PASS Uint8Clamped_128_buffer: classes are [object ArrayBuffer]
PASS Uint8Clamped_128_buffer: buffer lengths are 128
PASS Uint8Clamped_128_buffer: buffers have the same contents
PASS Uint8Clamped_128_buffer: offset is 0
PASS Uint8Clamped_128_buffer: length is 128
PASS Int16_128_buffer: classes are [object Int16Array]
PASS Int16_128_buffer: classes are [object ArrayBuffer]
PASS Int16_128_buffer: buffer lengths are 256
PASS Int16_128_buffer: buffers have the same contents
PASS Int16_128_buffer: offset is 0
PASS Int16_128_buffer: length is 256
PASS Uint16_128_buffer: classes are [object Uint16Array]
PASS Uint16_128_buffer: classes are [object ArrayBuffer]
PASS Uint16_128_buffer: buffer lengths are 256
PASS Uint16_128_buffer: buffers have the same contents
PASS Uint16_128_buffer: offset is 0
PASS Uint16_128_buffer: length is 256
PASS Float32_128_buffer: classes are [object Float32Array]
PASS Float32_128_buffer: classes are [object ArrayBuffer]
PASS Float32_128_buffer: buffer lengths are 512
PASS Float32_128_buffer: buffers have the same contents
PASS Float32_128_buffer: offset is 0
PASS Float32_128_buffer: length is 512
PASS Float64_128_buffer: classes are [object Float64Array]
PASS Float64_128_buffer: classes are [object ArrayBuffer]
PASS Float64_128_buffer: buffer lengths are 1024
PASS Float64_128_buffer: buffers have the same contents
PASS Float64_128_buffer: offset is 0
PASS Float64_128_buffer: length is 1024
PASS Int32_1_buffer_offset_at_end: classes are [object Int32Array]
PASS Int32_1_buffer_offset_at_end: classes are [object ArrayBuffer]
PASS Int32_1_buffer_offset_at_end: buffer lengths are 4
PASS Int32_1_buffer_offset_at_end: buffers have the same contents
PASS Int32_1_buffer_offset_at_end: offset is 4
PASS Int32_1_buffer_offset_at_end: length is 0
PASS Uint32_1_buffer_offset_at_end: classes are [object Uint32Array]
PASS Uint32_1_buffer_offset_at_end: classes are [object ArrayBuffer]
PASS Uint32_1_buffer_offset_at_end: buffer lengths are 4
PASS Uint32_1_buffer_offset_at_end: buffers have the same contents
PASS Uint32_1_buffer_offset_at_end: offset is 4
PASS Uint32_1_buffer_offset_at_end: length is 0
PASS Int8_1_buffer_offset_at_end: classes are [object Int8Array]
PASS Int8_1_buffer_offset_at_end: classes are [object ArrayBuffer]
PASS Int8_1_buffer_offset_at_end: buffer lengths are 1
PASS Int8_1_buffer_offset_at_end: buffers have the same contents
PASS Int8_1_buffer_offset_at_end: offset is 1
PASS Int8_1_buffer_offset_at_end: length is 0
PASS Uint8_1_buffer_offset_at_end: classes are [object Uint8Array]
PASS Uint8_1_buffer_offset_at_end: classes are [object ArrayBuffer]
PASS Uint8_1_buffer_offset_at_end: buffer lengths are 1
PASS Uint8_1_buffer_offset_at_end: buffers have the same contents
PASS Uint8_1_buffer_offset_at_end: offset is 1
PASS Uint8_1_buffer_offset_at_end: length is 0
PASS Uint8Clamped_1_buffer_offset_at_end: classes are [object Uint8ClampedArray]
PASS Uint8Clamped_1_buffer_offset_at_end: classes are [object ArrayBuffer]
PASS Uint8Clamped_1_buffer_offset_at_end: buffer lengths are 1
PASS Uint8Clamped_1_buffer_offset_at_end: buffers have the same contents
PASS Uint8Clamped_1_buffer_offset_at_end: offset is 1
PASS Uint8Clamped_1_buffer_offset_at_end: length is 0
PASS Int16_1_buffer_offset_at_end: classes are [object Int16Array]
PASS Int16_1_buffer_offset_at_end: classes are [object ArrayBuffer]
PASS Int16_1_buffer_offset_at_end: buffer lengths are 2
PASS Int16_1_buffer_offset_at_end: buffers have the same contents
PASS Int16_1_buffer_offset_at_end: offset is 2
PASS Int16_1_buffer_offset_at_end: length is 0
PASS Uint16_1_buffer_offset_at_end: classes are [object Uint16Array]
PASS Uint16_1_buffer_offset_at_end: classes are [object ArrayBuffer]
PASS Uint16_1_buffer_offset_at_end: buffer lengths are 2
PASS Uint16_1_buffer_offset_at_end: buffers have the same contents
PASS Uint16_1_buffer_offset_at_end: offset is 2
PASS Uint16_1_buffer_offset_at_end: length is 0
PASS Float32_1_buffer_offset_at_end: classes are [object Float32Array]
PASS Float32_1_buffer_offset_at_end: classes are [object ArrayBuffer]
PASS Float32_1_buffer_offset_at_end: buffer lengths are 4
PASS Float32_1_buffer_offset_at_end: buffers have the same contents
PASS Float32_1_buffer_offset_at_end: offset is 4
PASS Float32_1_buffer_offset_at_end: length is 0
PASS Float64_1_buffer_offset_at_end: classes are [object Float64Array]
PASS Float64_1_buffer_offset_at_end: classes are [object ArrayBuffer]
PASS Float64_1_buffer_offset_at_end: buffer lengths are 8
PASS Float64_1_buffer_offset_at_end: buffers have the same contents
PASS Float64_1_buffer_offset_at_end: offset is 8
PASS Float64_1_buffer_offset_at_end: length is 0
PASS Int32_128_buffer_offset_at_end: classes are [object Int32Array]
PASS Int32_128_buffer_offset_at_end: classes are [object ArrayBuffer]
PASS Int32_128_buffer_offset_at_end: buffer lengths are 512
PASS Int32_128_buffer_offset_at_end: buffers have the same contents
PASS Int32_128_buffer_offset_at_end: offset is 512
PASS Int32_128_buffer_offset_at_end: length is 0
PASS Uint32_128_buffer_offset_at_end: classes are [object Uint32Array]
PASS Uint32_128_buffer_offset_at_end: classes are [object ArrayBuffer]
PASS Uint32_128_buffer_offset_at_end: buffer lengths are 512
PASS Uint32_128_buffer_offset_at_end: buffers have the same contents
PASS Uint32_128_buffer_offset_at_end: offset is 512
PASS Uint32_128_buffer_offset_at_end: length is 0
PASS Int8_128_buffer_offset_at_end: classes are [object Int8Array]
PASS Int8_128_buffer_offset_at_end: classes are [object ArrayBuffer]
PASS Int8_128_buffer_offset_at_end: buffer lengths are 128
PASS Int8_128_buffer_offset_at_end: buffers have the same contents
PASS Int8_128_buffer_offset_at_end: offset is 128
PASS Int8_128_buffer_offset_at_end: length is 0
PASS Uint8_128_buffer_offset_at_end: classes are [object Uint8Array]
PASS Uint8_128_buffer_offset_at_end: classes are [object ArrayBuffer]
PASS Uint8_128_buffer_offset_at_end: buffer lengths are 128
PASS Uint8_128_buffer_offset_at_end: buffers have the same contents
PASS Uint8_128_buffer_offset_at_end: offset is 128
PASS Uint8_128_buffer_offset_at_end: length is 0
PASS Uint8Clamped_128_buffer_offset_at_end: classes are [object Uint8ClampedArray]
PASS Uint8Clamped_128_buffer_offset_at_end: classes are [object ArrayBuffer]
PASS Uint8Clamped_128_buffer_offset_at_end: buffer lengths are 128
PASS Uint8Clamped_128_buffer_offset_at_end: buffers have the same contents
PASS Uint8Clamped_128_buffer_offset_at_end: offset is 128
PASS Uint8Clamped_128_buffer_offset_at_end: length is 0
PASS Int16_128_buffer_offset_at_end: classes are [object Int16Array]
PASS Int16_128_buffer_offset_at_end: classes are [object ArrayBuffer]
PASS Int16_128_buffer_offset_at_end: buffer lengths are 256
PASS Int16_128_buffer_offset_at_end: buffers have the same contents
PASS Int16_128_buffer_offset_at_end: offset is 256
PASS Int16_128_buffer_offset_at_end: length is 0
PASS Uint16_128_buffer_offset_at_end: classes are [object Uint16Array]
PASS Uint16_128_buffer_offset_at_end: classes are [object ArrayBuffer]
PASS Uint16_128_buffer_offset_at_end: buffer lengths are 256
PASS Uint16_128_buffer_offset_at_end: buffers have the same contents
PASS Uint16_128_buffer_offset_at_end: offset is 256
PASS Uint16_128_buffer_offset_at_end: length is 0
PASS Float32_128_buffer_offset_at_end: classes are [object Float32Array]
PASS Float32_128_buffer_offset_at_end: classes are [object ArrayBuffer]
PASS Float32_128_buffer_offset_at_end: buffer lengths are 512
PASS Float32_128_buffer_offset_at_end: buffers have the same contents
PASS Float32_128_buffer_offset_at_end: offset is 512
PASS Float32_128_buffer_offset_at_end: length is 0
PASS Float64_128_buffer_offset_at_end: classes are [object Float64Array]
PASS Float64_128_buffer_offset_at_end: classes are [object ArrayBuffer]
PASS Float64_128_buffer_offset_at_end: buffer lengths are 1024
PASS Float64_128_buffer_offset_at_end: buffers have the same contents
PASS Float64_128_buffer_offset_at_end: offset is 1024
PASS Float64_128_buffer_offset_at_end: length is 0
PASS Int32_128_buffer_offset_slice_length_0: classes are [object Int32Array]
PASS Int32_128_buffer_offset_slice_length_0: classes are [object ArrayBuffer]
PASS Int32_128_buffer_offset_slice_length_0: buffer lengths are 512
PASS Int32_128_buffer_offset_slice_length_0: buffers have the same contents
PASS Int32_128_buffer_offset_slice_length_0: offset is 256
PASS Int32_128_buffer_offset_slice_length_0: length is 0
PASS Uint32_128_buffer_offset_slice_length_0: classes are [object Uint32Array]
PASS Uint32_128_buffer_offset_slice_length_0: classes are [object ArrayBuffer]
PASS Uint32_128_buffer_offset_slice_length_0: buffer lengths are 512
PASS Uint32_128_buffer_offset_slice_length_0: buffers have the same contents
PASS Uint32_128_buffer_offset_slice_length_0: offset is 256
PASS Uint32_128_buffer_offset_slice_length_0: length is 0
PASS Int8_128_buffer_offset_slice_length_0: classes are [object Int8Array]
PASS Int8_128_buffer_offset_slice_length_0: classes are [object ArrayBuffer]
PASS Int8_128_buffer_offset_slice_length_0: buffer lengths are 128
PASS Int8_128_buffer_offset_slice_length_0: buffers have the same contents
PASS Int8_128_buffer_offset_slice_length_0: offset is 64
PASS Int8_128_buffer_offset_slice_length_0: length is 0
PASS Uint8_128_buffer_offset_slice_length_0: classes are [object Uint8Array]
PASS Uint8_128_buffer_offset_slice_length_0: classes are [object ArrayBuffer]
PASS Uint8_128_buffer_offset_slice_length_0: buffer lengths are 128
PASS Uint8_128_buffer_offset_slice_length_0: buffers have the same contents
PASS Uint8_128_buffer_offset_slice_length_0: offset is 64
PASS Uint8_128_buffer_offset_slice_length_0: length is 0
PASS Uint8Clamped_128_buffer_offset_slice_length_0: classes are [object Uint8ClampedArray]
PASS Uint8Clamped_128_buffer_offset_slice_length_0: classes are [object ArrayBuffer]
PASS Uint8Clamped_128_buffer_offset_slice_length_0: buffer lengths are 128
PASS Uint8Clamped_128_buffer_offset_slice_length_0: buffers have the same contents
PASS Uint8Clamped_128_buffer_offset_slice_length_0: offset is 64
PASS Uint8Clamped_128_buffer_offset_slice_length_0: length is 0
PASS Int16_128_buffer_offset_slice_length_0: classes are [object Int16Array]
PASS Int16_128_buffer_offset_slice_length_0: classes are [object ArrayBuffer]
PASS Int16_128_buffer_offset_slice_length_0: buffer lengths are 256
PASS Int16_128_buffer_offset_slice_length_0: buffers have the same contents
PASS Int16_128_buffer_offset_slice_length_0: offset is 128
PASS Int16_128_buffer_offset_slice_length_0: length is 0
PASS Uint16_128_buffer_offset_slice_length_0: classes are [object Uint16Array]
PASS Uint16_128_buffer_offset_slice_length_0: classes are [object ArrayBuffer]
PASS Uint16_128_buffer_offset_slice_length_0: buffer lengths are 256
PASS Uint16_128_buffer_offset_slice_length_0: buffers have the same contents
PASS Uint16_128_buffer_offset_slice_length_0: offset is 128
PASS Uint16_128_buffer_offset_slice_length_0: length is 0
PASS Float32_128_buffer_offset_slice_length_0: classes are [object Float32Array]
PASS Float32_128_buffer_offset_slice_length_0: classes are [object ArrayBuffer]
PASS Float32_128_buffer_offset_slice_length_0: buffer lengths are 512
PASS Float32_128_buffer_offset_slice_length_0: buffers have the same contents
PASS Float32_128_buffer_offset_slice_length_0: offset is 256
PASS Float32_128_buffer_offset_slice_length_0: length is 0
PASS Float64_128_buffer_offset_slice_length_0: classes are [object Float64Array]
PASS Float64_128_buffer_offset_slice_length_0: classes are [object ArrayBuffer]
PASS Float64_128_buffer_offset_slice_length_0: buffer lengths are 1024
PASS Float64_128_buffer_offset_slice_length_0: buffers have the same contents
PASS Float64_128_buffer_offset_slice_length_0: offset is 512
PASS Float64_128_buffer_offset_slice_length_0: length is 0
PASS Int32_128_buffer_offset_slice_length_1: classes are [object Int32Array]
PASS Int32_128_buffer_offset_slice_length_1: classes are [object ArrayBuffer]
PASS Int32_128_buffer_offset_slice_length_1: buffer lengths are 512
PASS Int32_128_buffer_offset_slice_length_1: buffers have the same contents
PASS Int32_128_buffer_offset_slice_length_1: offset is 256
PASS Int32_128_buffer_offset_slice_length_1: length is 4
PASS Uint32_128_buffer_offset_slice_length_1: classes are [object Uint32Array]
PASS Uint32_128_buffer_offset_slice_length_1: classes are [object ArrayBuffer]
PASS Uint32_128_buffer_offset_slice_length_1: buffer lengths are 512
PASS Uint32_128_buffer_offset_slice_length_1: buffers have the same contents
PASS Uint32_128_buffer_offset_slice_length_1: offset is 256
PASS Uint32_128_buffer_offset_slice_length_1: length is 4
PASS Int8_128_buffer_offset_slice_length_1: classes are [object Int8Array]
PASS Int8_128_buffer_offset_slice_length_1: classes are [object ArrayBuffer]
PASS Int8_128_buffer_offset_slice_length_1: buffer lengths are 128
PASS Int8_128_buffer_offset_slice_length_1: buffers have the same contents
PASS Int8_128_buffer_offset_slice_length_1: offset is 64
PASS Int8_128_buffer_offset_slice_length_1: length is 1
PASS Uint8_128_buffer_offset_slice_length_1: classes are [object Uint8Array]
PASS Uint8_128_buffer_offset_slice_length_1: classes are [object ArrayBuffer]
PASS Uint8_128_buffer_offset_slice_length_1: buffer lengths are 128
PASS Uint8_128_buffer_offset_slice_length_1: buffers have the same contents
PASS Uint8_128_buffer_offset_slice_length_1: offset is 64
PASS Uint8_128_buffer_offset_slice_length_1: length is 1
PASS Uint8Clamped_128_buffer_offset_slice_length_1: classes are [object Uint8ClampedArray]
PASS Uint8Clamped_128_buffer_offset_slice_length_1: classes are [object ArrayBuffer]
PASS Uint8Clamped_128_buffer_offset_slice_length_1: buffer lengths are 128
PASS Uint8Clamped_128_buffer_offset_slice_length_1: buffers have the same contents
PASS Uint8Clamped_128_buffer_offset_slice_length_1: offset is 64
PASS Uint8Clamped_128_buffer_offset_slice_length_1: length is 1
PASS Int16_128_buffer_offset_slice_length_1: classes are [object Int16Array]
PASS Int16_128_buffer_offset_slice_length_1: classes are [object ArrayBuffer]
PASS Int16_128_buffer_offset_slice_length_1: buffer lengths are 256
PASS Int16_128_buffer_offset_slice_length_1: buffers have the same contents
PASS Int16_128_buffer_offset_slice_length_1: offset is 128
PASS Int16_128_buffer_offset_slice_length_1: length is 2
PASS Uint16_128_buffer_offset_slice_length_1: classes are [object Uint16Array]
PASS Uint16_128_buffer_offset_slice_length_1: classes are [object ArrayBuffer]
PASS Uint16_128_buffer_offset_slice_length_1: buffer lengths are 256
PASS Uint16_128_buffer_offset_slice_length_1: buffers have the same contents
PASS Uint16_128_buffer_offset_slice_length_1: offset is 128
PASS Uint16_128_buffer_offset_slice_length_1: length is 2
PASS Float32_128_buffer_offset_slice_length_1: classes are [object Float32Array]
PASS Float32_128_buffer_offset_slice_length_1: classes are [object ArrayBuffer]
PASS Float32_128_buffer_offset_slice_length_1: buffer lengths are 512
PASS Float32_128_buffer_offset_slice_length_1: buffers have the same contents
PASS Float32_128_buffer_offset_slice_length_1: offset is 256
PASS Float32_128_buffer_offset_slice_length_1: length is 4
PASS Float64_128_buffer_offset_slice_length_1: classes are [object Float64Array]
PASS Float64_128_buffer_offset_slice_length_1: classes are [object ArrayBuffer]
PASS Float64_128_buffer_offset_slice_length_1: buffer lengths are 1024
PASS Float64_128_buffer_offset_slice_length_1: buffers have the same contents
PASS Float64_128_buffer_offset_slice_length_1: offset is 512
PASS Float64_128_buffer_offset_slice_length_1: length is 8
PASS Int32_128_buffer_offset_slice_length_16: classes are [object Int32Array]
PASS Int32_128_buffer_offset_slice_length_16: classes are [object ArrayBuffer]
PASS Int32_128_buffer_offset_slice_length_16: buffer lengths are 512
PASS Int32_128_buffer_offset_slice_length_16: buffers have the same contents
PASS Int32_128_buffer_offset_slice_length_16: offset is 256
PASS Int32_128_buffer_offset_slice_length_16: length is 64
PASS Uint32_128_buffer_offset_slice_length_16: classes are [object Uint32Array]
PASS Uint32_128_buffer_offset_slice_length_16: classes are [object ArrayBuffer]
PASS Uint32_128_buffer_offset_slice_length_16: buffer lengths are 512
PASS Uint32_128_buffer_offset_slice_length_16: buffers have the same contents
PASS Uint32_128_buffer_offset_slice_length_16: offset is 256
PASS Uint32_128_buffer_offset_slice_length_16: length is 64
PASS Int8_128_buffer_offset_slice_length_16: classes are [object Int8Array]
PASS Int8_128_buffer_offset_slice_length_16: classes are [object ArrayBuffer]
PASS Int8_128_buffer_offset_slice_length_16: buffer lengths are 128
PASS Int8_128_buffer_offset_slice_length_16: buffers have the same contents
PASS Int8_128_buffer_offset_slice_length_16: offset is 64
PASS Int8_128_buffer_offset_slice_length_16: length is 16
PASS Uint8_128_buffer_offset_slice_length_16: classes are [object Uint8Array]
PASS Uint8_128_buffer_offset_slice_length_16: classes are [object ArrayBuffer]
PASS Uint8_128_buffer_offset_slice_length_16: buffer lengths are 128
PASS Uint8_128_buffer_offset_slice_length_16: buffers have the same contents
PASS Uint8_128_buffer_offset_slice_length_16: offset is 64
PASS Uint8_128_buffer_offset_slice_length_16: length is 16
PASS Uint8Clamped_128_buffer_offset_slice_length_16: classes are [object Uint8ClampedArray]
PASS Uint8Clamped_128_buffer_offset_slice_length_16: classes are [object ArrayBuffer]
PASS Uint8Clamped_128_buffer_offset_slice_length_16: buffer lengths are 128
PASS Uint8Clamped_128_buffer_offset_slice_length_16: buffers have the same contents
PASS Uint8Clamped_128_buffer_offset_slice_length_16: offset is 64
PASS Uint8Clamped_128_buffer_offset_slice_length_16: length is 16
PASS Int16_128_buffer_offset_slice_length_16: classes are [object Int16Array]
PASS Int16_128_buffer_offset_slice_length_16: classes are [object ArrayBuffer]
PASS Int16_128_buffer_offset_slice_length_16: buffer lengths are 256
PASS Int16_128_buffer_offset_slice_length_16: buffers have the same contents
PASS Int16_128_buffer_offset_slice_length_16: offset is 128
PASS Int16_128_buffer_offset_slice_length_16: length is 32
PASS Uint16_128_buffer_offset_slice_length_16: classes are [object Uint16Array]
PASS Uint16_128_buffer_offset_slice_length_16: classes are [object ArrayBuffer]
PASS Uint16_128_buffer_offset_slice_length_16: buffer lengths are 256
PASS Uint16_128_buffer_offset_slice_length_16: buffers have the same contents
PASS Uint16_128_buffer_offset_slice_length_16: offset is 128
PASS Uint16_128_buffer_offset_slice_length_16: length is 32
PASS Float32_128_buffer_offset_slice_length_16: classes are [object Float32Array]
PASS Float32_128_buffer_offset_slice_length_16: classes are [object ArrayBuffer]
PASS Float32_128_buffer_offset_slice_length_16: buffer lengths are 512
PASS Float32_128_buffer_offset_slice_length_16: buffers have the same contents
PASS Float32_128_buffer_offset_slice_length_16: offset is 256
PASS Float32_128_buffer_offset_slice_length_16: length is 64
PASS Float64_128_buffer_offset_slice_length_16: classes are [object Float64Array]
PASS Float64_128_buffer_offset_slice_length_16: classes are [object ArrayBuffer]
PASS Float64_128_buffer_offset_slice_length_16: buffer lengths are 1024
PASS Float64_128_buffer_offset_slice_length_16: buffers have the same contents
PASS Float64_128_buffer_offset_slice_length_16: offset is 512
PASS Float64_128_buffer_offset_slice_length_16: length is 128
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script src="script-tests/array-message-passing.js"></script>
</body>
</html>
Test overriding the set method of WebGL array
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Regression test for https://bugs.webkit.org/show_bug.cgi?id=87862 : [v8] Crash after redefining setter on typed array to a number
PASS array[0] is 0
PASS array[0] is 0
PASS array[0] is 0
PASS array[0] is 0
PASS array[0] is 0
PASS array[0] is 0
PASS array[0] is 0
PASS array[0] is 0
PASS array[0] is 0
PASS array[0] is 0
PASS array[0] is 0
PASS array[0] is 0
PASS array[0] is 0
PASS array[0] is 0
PASS array[0] is 0
PASS array[0] is 0
PASS array[0] is 0
PASS array[0] is 0
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description("Test overriding the set method of WebGL array");
debug('Regression test for <a href="https://bugs.webkit.org/show_bug.cgi?id=87862">https://bugs.webkit.org/show_bug.cgi?id=87862</a> : <code>[v8] Crash after redefining setter on typed array to a number</code>');
var array;
var typeNames = ['Float32Array', 'Float64Array', 'Int8Array', 'Int16Array', 'Int32Array',
'Uint8Array', 'Uint8ClampedArray', 'Uint16Array', 'Uint32Array']
function overrideSetWithNumberAndConstruct(typeName) {
var type = window[typeName];
type.prototype.set = 0x3ffff;
array = new type([0], function() {});
shouldBe("array[0]", "0");
}
for (var i = 0; i < typeNames.length; i++) {
overrideSetWithNumberAndConstruct(typeNames[i]);
}
function overrideSetWithNumberAndSet(typeName) {
var type = window[typeName];
array = new type(10);
type.prototype.set = 0x3ffff;
array[0] = 8;
array.set([0], function() {});
shouldBe("array[0]", "0");
}
for (var i = 0; i < typeNames.length; i++) {
overrideSetWithNumberAndConstruct(typeNames[i]);
}
</script>
</body>
</html>
Verifies that attempting to set invalid elements to a Typed Array throws an exception
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS typedArray.set() threw exception TypeError: Cannot read property 'length' of undefined.
PASS typedArray.set('hello world') threw exception RangeError: Source is too large.
PASS typedArray.set(otherArray, 1) threw exception RangeError: Source is too large.
PASS typedArray.set() threw exception TypeError: Cannot read property 'length' of undefined.
PASS typedArray.set('hello world') threw exception RangeError: Source is too large.
PASS typedArray.set(otherArray, 1) threw exception RangeError: Source is too large.
PASS typedArray.set() threw exception TypeError: Cannot read property 'length' of undefined.
PASS typedArray.set('hello world') threw exception RangeError: Source is too large.
PASS typedArray.set(otherArray, 1) threw exception RangeError: Source is too large.
PASS typedArray.set() threw exception TypeError: Cannot read property 'length' of undefined.
PASS typedArray.set('hello world') threw exception RangeError: Source is too large.
PASS typedArray.set(otherArray, 1) threw exception RangeError: Source is too large.
PASS typedArray.set() threw exception TypeError: Cannot read property 'length' of undefined.
PASS typedArray.set('hello world') threw exception RangeError: Source is too large.
PASS typedArray.set(otherArray, 1) threw exception RangeError: Source is too large.
PASS typedArray.set() threw exception TypeError: Cannot read property 'length' of undefined.
PASS typedArray.set('hello world') threw exception RangeError: Source is too large.
PASS typedArray.set(otherArray, 1) threw exception RangeError: Source is too large.
PASS typedArray.set() threw exception TypeError: Cannot read property 'length' of undefined.
PASS typedArray.set('hello world') threw exception RangeError: Source is too large.
PASS typedArray.set(otherArray, 1) threw exception RangeError: Source is too large.
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description("Verifies that attempting to set invalid elements to a Typed Array throws an exception");
// Global scope so shouldThrow can see it
var typedArray, otherArray;
function negativeTestSet(typeName) {
var type = window[typeName];
typedArray = new type(10);
shouldThrow("typedArray.set()");
shouldThrow("typedArray.set('hello world')");
otherArray = new type(typedArray.length);
shouldThrow("typedArray.set(otherArray, 1)");
}
negativeTestSet("Int8Array");
negativeTestSet("Uint8Array");
negativeTestSet("Int16Array");
negativeTestSet("Uint16Array");
negativeTestSet("Int32Array");
negativeTestSet("Uint32Array");
negativeTestSet("Float32Array");
</script>
</body>
</html>
Verifies that attempting to set out-of-bounds elements of a WebGLArray from a JavaScript array throws an exception
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Regression test for https://bugs.webkit.org/show_bug.cgi?id=33352 : Passing array that is too large to set method of WebGLArrays does not throw an exception
Testing Int8Array
PASS webGLArray.set([4, 5], 1) threw exception RangeError: Source is too large.
PASS webGLArray.set([4, 5, 6]) threw exception RangeError: Source is too large.
Testing Uint8Array
PASS webGLArray.set([4, 5], 1) threw exception RangeError: Source is too large.
PASS webGLArray.set([4, 5, 6]) threw exception RangeError: Source is too large.
Testing Int16Array
PASS webGLArray.set([4, 5], 1) threw exception RangeError: Source is too large.
PASS webGLArray.set([4, 5, 6]) threw exception RangeError: Source is too large.
Testing Uint16Array
PASS webGLArray.set([4, 5], 1) threw exception RangeError: Source is too large.
PASS webGLArray.set([4, 5, 6]) threw exception RangeError: Source is too large.
Testing Int32Array
PASS webGLArray.set([4, 5], 1) threw exception RangeError: Source is too large.
PASS webGLArray.set([4, 5, 6]) threw exception RangeError: Source is too large.
Testing Uint32Array
PASS webGLArray.set([4, 5], 1) threw exception RangeError: Source is too large.
PASS webGLArray.set([4, 5, 6]) threw exception RangeError: Source is too large.
Testing Float32Array
PASS webGLArray.set([4, 5], 1) threw exception RangeError: Source is too large.
PASS webGLArray.set([4, 5, 6]) threw exception RangeError: Source is too large.
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description("Verifies that attempting to set out-of-bounds elements of a WebGLArray from a JavaScript array throws an exception");
debug('Regression test for <a href="https://bugs.webkit.org/show_bug.cgi?id=33352">https://bugs.webkit.org/show_bug.cgi?id=33352</a> : <code>Passing array that is too large to set method of WebGLArrays does not throw an exception</code>');
// Global scope so shouldThrow can see it
var webGLArray;
function negativeTestSet(typeName) {
var type = window[typeName];
webGLArray = new type([2, 3]);
debug('Testing ' + typeName);
shouldThrow("webGLArray.set([4, 5], 1)");
shouldThrow("webGLArray.set([4, 5, 6])");
}
negativeTestSet("Int8Array");
negativeTestSet("Uint8Array");
negativeTestSet("Int16Array");
negativeTestSet("Uint16Array");
negativeTestSet("Int32Array");
negativeTestSet("Uint32Array");
negativeTestSet("Float32Array");
</script>
</body>
</html>
Test setting WebGL array with offset
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Regression test for https://bugs.webkit.org/show_bug.cgi?id=76040 : Int16Array.set(array, offset) fails on first execution
Testing Int8Array
PASS webGLArray[0] is 0
PASS webGLArray[1] is 1
PASS webGLArray[2] is 2
PASS webGLArray[3] is bounds[0]
PASS webGLArray[4] is bounds[1]
Testing Uint8Array
PASS webGLArray[0] is 0
PASS webGLArray[1] is 1
PASS webGLArray[2] is 2
PASS webGLArray[3] is bounds[0]
PASS webGLArray[4] is bounds[1]
Testing Int16Array
PASS webGLArray[0] is 0
PASS webGLArray[1] is 1
PASS webGLArray[2] is 2
PASS webGLArray[3] is bounds[0]
PASS webGLArray[4] is bounds[1]
Testing Uint16Array
PASS webGLArray[0] is 0
PASS webGLArray[1] is 1
PASS webGLArray[2] is 2
PASS webGLArray[3] is bounds[0]
PASS webGLArray[4] is bounds[1]
Testing Int32Array
PASS webGLArray[0] is 0
PASS webGLArray[1] is 1
PASS webGLArray[2] is 2
PASS webGLArray[3] is bounds[0]
PASS webGLArray[4] is bounds[1]
Testing Uint32Array
PASS webGLArray[0] is 0
PASS webGLArray[1] is 1
PASS webGLArray[2] is 2
PASS webGLArray[3] is bounds[0]
PASS webGLArray[4] is bounds[1]
Testing Float32Array
PASS webGLArray[0] is 0
PASS webGLArray[1] is 1
PASS webGLArray[2] is 2
PASS webGLArray[3] is bounds[0]
PASS webGLArray[4] is bounds[1]
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description("Test setting WebGL array with offset");
debug('Regression test for <a href="https://bugs.webkit.org/show_bug.cgi?id=76040">https://bugs.webkit.org/show_bug.cgi?id=76040</a> : <code>Int16Array.set(array, offset) fails on first execution</code>');
var webGLArray = null;
var array = null;
var bounds = null;
function testSetters(typeName, low, high) {
bounds = [low, high];
var type = window[typeName];
var array_buffer = new ArrayBuffer(32);
webGLArray = new type(array_buffer);
debug("Testing " + typeName);
array = [1, 2, low, high];
webGLArray.set(array, 1);
shouldBe("webGLArray[0]", "0");
shouldBe("webGLArray[1]", "1");
shouldBe("webGLArray[2]", "2");
shouldBe("webGLArray[3]", "bounds[0]");
shouldBe("webGLArray[4]", "bounds[1]");
}
testSetters("Int8Array", -128, 127);
testSetters("Uint8Array", 0, 255);
testSetters("Int16Array", -32768, 32767);
testSetters("Uint16Array", 0, 65535);
testSetters("Int32Array", -2147483648, 2147483647);
testSetters("Uint32Array", 0, 4294967295);
testSetters("Float32Array", -2.5, 3.5);
</script>
</body>
</html>
Test all permutations of WebGLArray setters to make sure values don't get truncated
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Regression test for https://bugs.webkit.org/show_bug.cgi?id=33350 : WebGLArray subclasses do the wrong conversion in indexSetter
Testing Int8Array
PASS webGLArray is array
PASS webGLArray[0] is array[0]
PASS webGLArray[1] is array[1]
PASS webGLArray[0] is 0
PASS webGLArray[1] is 0
PASS webGLArray[0] is array[0]
PASS webGLArray[1] is array[1]
PASS webGLArray[2] is 88
PASS webGLArray[3] is 99
PASS webGLArray[1] is 88
PASS webGLArray[2] is 99
PASS array[0] is 99
PASS array[1] is 99
PASS webGLArray[3] is 99
PASS webGLArray[4] is 77
PASS array[0] is 99
PASS array[1] is 99
Testing Uint8Array
PASS webGLArray is array
PASS webGLArray[0] is array[0]
PASS webGLArray[1] is array[1]
PASS webGLArray[0] is 0
PASS webGLArray[1] is 0
PASS webGLArray[0] is array[0]
PASS webGLArray[1] is array[1]
PASS webGLArray[2] is 88
PASS webGLArray[3] is 99
PASS webGLArray[1] is 88
PASS webGLArray[2] is 99
PASS array[0] is 99
PASS array[1] is 99
PASS webGLArray[3] is 99
PASS webGLArray[4] is 77
PASS array[0] is 99
PASS array[1] is 99
Testing Int16Array
PASS webGLArray is array
PASS webGLArray[0] is array[0]
PASS webGLArray[1] is array[1]
PASS webGLArray[0] is 0
PASS webGLArray[1] is 0
PASS webGLArray[0] is array[0]
PASS webGLArray[1] is array[1]
PASS webGLArray[2] is 88
PASS webGLArray[3] is 99
PASS webGLArray[1] is 88
PASS webGLArray[2] is 99
PASS array[0] is 99
PASS array[1] is 99
PASS webGLArray[3] is 99
PASS webGLArray[4] is 77
PASS array[0] is 99
PASS array[1] is 99
Testing Uint16Array
PASS webGLArray is array
PASS webGLArray[0] is array[0]
PASS webGLArray[1] is array[1]
PASS webGLArray[0] is 0
PASS webGLArray[1] is 0
PASS webGLArray[0] is array[0]
PASS webGLArray[1] is array[1]
PASS webGLArray[2] is 88
PASS webGLArray[3] is 99
PASS webGLArray[1] is 88
PASS webGLArray[2] is 99
PASS array[0] is 99
PASS array[1] is 99
PASS webGLArray[3] is 99
PASS webGLArray[4] is 77
PASS array[0] is 99
PASS array[1] is 99
Testing Int32Array
PASS webGLArray is array
PASS webGLArray[0] is array[0]
PASS webGLArray[1] is array[1]
PASS webGLArray[0] is 0
PASS webGLArray[1] is 0
PASS webGLArray[0] is array[0]
PASS webGLArray[1] is array[1]
PASS webGLArray[2] is 88
PASS webGLArray[3] is 99
PASS webGLArray[1] is 88
PASS webGLArray[2] is 99
PASS array[0] is 99
PASS array[1] is 99
PASS webGLArray[3] is 99
PASS webGLArray[4] is 77
PASS array[0] is 99
PASS array[1] is 99
Testing Uint32Array
PASS webGLArray is array
PASS webGLArray[0] is array[0]
PASS webGLArray[1] is array[1]
PASS webGLArray[0] is 0
PASS webGLArray[1] is 0
PASS webGLArray[0] is array[0]
PASS webGLArray[1] is array[1]
PASS webGLArray[2] is 88
PASS webGLArray[3] is 99
PASS webGLArray[1] is 88
PASS webGLArray[2] is 99
PASS array[0] is 99
PASS array[1] is 99
PASS webGLArray[3] is 99
PASS webGLArray[4] is 77
PASS array[0] is 99
PASS array[1] is 99
Testing Float32Array
PASS webGLArray is array
PASS webGLArray[0] is array[0]
PASS webGLArray[1] is array[1]
PASS webGLArray[0] is 0
PASS webGLArray[1] is 0
PASS webGLArray[0] is array[0]
PASS webGLArray[1] is array[1]
PASS webGLArray[2] is 88
PASS webGLArray[3] is 99
PASS webGLArray[1] is 88
PASS webGLArray[2] is 99
PASS array[0] is 99
PASS array[1] is 99
PASS webGLArray[3] is 99
PASS webGLArray[4] is 77
PASS array[0] is 99
PASS array[1] is 99
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description("Test all permutations of WebGLArray setters to make sure values don't get truncated");
debug('Regression test for <a href="https://bugs.webkit.org/show_bug.cgi?id=33350">https://bugs.webkit.org/show_bug.cgi?id=33350</a> : <code>WebGLArray subclasses do the wrong conversion in indexSetter</code>');
var webGLArray = null;
var array = null;
function testSetters(typeName, low, high) {
var type = window[typeName];
webGLArray = new type(2);
array = [low, high];
debug("Testing " + typeName);
webGLArray.set(array);
shouldBe("webGLArray", "array");
shouldBe("webGLArray[0]", "array[0]");
shouldBe("webGLArray[1]", "array[1]");
webGLArray[0] = 0;
webGLArray[1] = 0;
shouldBe("webGLArray[0]", "0");
shouldBe("webGLArray[1]", "0");
webGLArray[0] = array[0];
shouldBe("webGLArray[0]", "array[0]");
webGLArray[1] = array[1];
shouldBe("webGLArray[1]", "array[1]");
// Verify set() behaves correctly with shared underlying buffer.
array = [0, 1, 2, 3, 4, 5];
webGLArray = new type(6);
webGLArray.set(array);
array = webGLArray.subarray(2, 4);
array[0] = 88;
array[1] = 99;
shouldBe("webGLArray[2]", "88");
shouldBe("webGLArray[3]", "99");
// pre-overlap
webGLArray.set(array, 1);
shouldBe("webGLArray[1]", "88");
shouldBe("webGLArray[2]", "99");
shouldBe("array[0]", "99");
shouldBe("array[1]", "99");
array[1] = 77;
// post-overlap
webGLArray.set(array, 3);
shouldBe("webGLArray[3]", "99");
shouldBe("webGLArray[4]", "77");
shouldBe("array[0]", "99");
shouldBe("array[1]", "99");
}
testSetters("Int8Array", -128, 127);
testSetters("Uint8Array", 0, 255);
testSetters("Int16Array", -32768, 32767);
testSetters("Uint16Array", 0, 65535);
testSetters("Int32Array", -2147483648, 2147483647);
testSetters("Uint32Array", 0, 4294967295);
testSetters("Float32Array", -2.5, 3.5);
</script>
</body>
</html>
Test transfer of control semantics for ArrayBuffers.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS sanity check
PASS raw ArrayBuffer
PASS sending buffers is sane even if cloning doesn't special-case
PASS send every view
PASS transfer list multiple
PASS transfer neuters unmentioned
PASS raw Int32
PASS raw Uint32
PASS raw Int8
PASS raw Uint8
PASS raw Uint8Clamped
PASS raw Int16
PASS raw Uint16
PASS raw Float32
PASS raw Float64
PASS raw DataView
PASS send view, buffer for Int32
PASS send view, buffer for Uint32
PASS send view, buffer for Int8
PASS send view, buffer for Uint8
PASS send view, buffer for Uint8Clamped
PASS send view, buffer for Int16
PASS send view, buffer for Uint16
PASS send view, buffer for Float32
PASS send view, buffer for Float64
PASS send view, buffer for DataView
PASS send buffer, view for Int32
PASS send buffer, view for Uint32
PASS send buffer, view for Int8
PASS send buffer, view for Uint8
PASS send buffer, view for Uint8Clamped
PASS send buffer, view for Int16
PASS send buffer, view for Uint16
PASS send buffer, view for Float32
PASS send buffer, view for Float64
PASS send buffer, view for DataView
PASS squash unrelated views for Int32
PASS squash unrelated views for Uint32
PASS squash unrelated views for Int8
PASS squash unrelated views for Uint8
PASS squash unrelated views for Uint8Clamped
PASS squash unrelated views for Int16
PASS squash unrelated views for Uint16
PASS squash unrelated views for Float32
PASS squash unrelated views for Float64
PASS squash unrelated views for DataView
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script src="script-tests/arraybuffer-transfer-of-control.js"></script>
</body>
</html>
Test bufferData/bufferSubData with ArrayBuffer input
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Regression test for https://bugs.webkit.org/show_bug.cgi?id=41884 : Implement bufferData and bufferSubData with ArrayBuffer as input
PASS gl is non-null.
PASS array is non-null.
PASS [object WebGLBuffer] is non-null.
PASS getError was expected value: INVALID_OPERATION :
PASS getError was expected value: NO_ERROR :
PASS getError was expected value: INVALID_VALUE :
PASS getError was expected value: INVALID_VALUE :
PASS getError was expected value: NO_ERROR :
PASS getError was expected value: INVALID_VALUE :
PASS getError was expected value: INVALID_VALUE :
PASS getError was expected value: NO_ERROR :
PASS getError was expected value: INVALID_VALUE :
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description("Test bufferData/bufferSubData with ArrayBuffer input");
debug('Regression test for <a href="https://bugs.webkit.org/show_bug.cgi?id=41884">https://bugs.webkit.org/show_bug.cgi?id=41884</a> : <code>Implement bufferData and bufferSubData with ArrayBuffer as input</code>');
if (window.internals)
window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
var gl = create3DContext();
shouldBeNonNull("gl");
var array = new ArrayBuffer(128);
shouldBeNonNull("array");
var buf = gl.createBuffer();
shouldBeNonNull(buf);
gl.bufferData(gl.ARRAY_BUFFER, array, gl.STATIC_DRAW);
glErrorShouldBe(gl, gl.INVALID_OPERATION);
gl.bindBuffer(gl.ARRAY_BUFFER, buf);
glErrorShouldBe(gl, gl.NO_ERROR);
gl.bufferData(gl.ARRAY_BUFFER, -10, gl.STATIC_DRAW);
glErrorShouldBe(gl, gl.INVALID_VALUE);
gl.bufferData(gl.ARRAY_BUFFER, null, gl.STATIC_DRAW);
glErrorShouldBe(gl, gl.INVALID_VALUE);
gl.bufferData(gl.ARRAY_BUFFER, array, gl.STATIC_DRAW);
glErrorShouldBe(gl, gl.NO_ERROR);
array = new ArrayBuffer(64);
gl.bufferSubData(gl.ARRAY_BUFFER, -10, array);
glErrorShouldBe(gl, gl.INVALID_VALUE);
gl.bufferSubData(gl.ARRAY_BUFFER, -10, new Float32Array(8));
glErrorShouldBe(gl, gl.INVALID_VALUE);
gl.bufferSubData(gl.ARRAY_BUFFER, 10, array);
glErrorShouldBe(gl, gl.NO_ERROR);
gl.bufferSubData(gl.ARRAY_BUFFER, 10, null);
glErrorShouldBe(gl, gl.INVALID_VALUE);
</script>
</body>
</html>
Checks that copying canvas results to a WebGL texture functions without error.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS successfullyParsed is true
TEST COMPLETE
PASS Should have rendered red.
PASS Should have rendered blue.
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
<script src="resources/webgl-test-utils.js"> </script>
</head>
<script>
description("Checks that copying canvas results to a WebGL texture functions without error.");
var wtu = WebGLTestUtils;
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
var canvas;
var gl;
var ctx;
function draw()
{
ctx.fillStyle = "rgb(200, 0, 0)";
ctx.fillRect(0, 0, 256, 256);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas2d);
wtu.drawQuad(gl);
wtu.checkCanvasRect(gl, 0, 0, 1, 1, [200, 0, 0, 255], "Should have rendered red.", 1);
ctx.fillStyle = "rgb(0, 0, 200)";
ctx.fillRect(0, 0, 256, 256);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas2d);
ctx.fillStyle = "rgb(200, 0, 0)";
ctx.fillRect(0, 0, 256, 256);
wtu.drawQuad(gl);
wtu.checkCanvasRect(gl, 0, 0, 1, 1, [0, 0, 200, 255], "Should have rendered blue.", 1);
if (window.testRunner)
testRunner.notifyDone();
}
window.onload = function()
{
if (window.initNonKhronosFramework)
window.initNonKhronosFramework(false);
canvas = document.getElementById("webgl-canvas");
gl = create3DContext(canvas);
canvas2d = document.getElementById("canvas-2d");
// Set a size that ensures a hardware-accelerated canvas.
canvas2d.width = 256;
canvas2d.height = 256;
ctx = canvas2d.getContext("2d");
var program = wtu.setupTexturedQuad(gl);
var bufferObjects = wtu.setupUnitQuad(gl);
var texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
gl.uniform1i(gl.getUniformLocation(program, "tex"), 0);
gl.viewport(0, 0, canvas.width, canvas.height);
// Ensure that the compositor has become active.
setTimeout(draw, 0);
}
</script>
<body>
<div id="description"></div>
<div id="console"></div>
<canvas id="webgl-canvas" width="32px" height="32px"></canvas>
<canvas id="canvas-2d" style="transform: translateZ(0);"></canvas>
</body>
</html>
CONSOLE WARNING: line 911: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
This test ensures WebGL implementations allow proper GLES2 shaders compile and improper ones fail.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Canvas.getContext
PASS context exists
Checking various GLSL programs.
PASS [vshader/fshaderWithPrecision]: frament shader with precision compiled and linked
PASS [vshader/fshaderWithDefaultPrecision]: fragment shader with default precision compiled and linked
PASS [vshaderWithDefaultPrecision/fshader]: vertex shader with default precision compiled and linked
PASS [vshader/fshaderWithOutPrecision]: fragment shader without precision should fail
PASS [vshader/fshaderWithInvalidIdentifier]: fragment shader with gl_ identifier should fail
PASS [vshader/fshaderWithGL_ESeq1]: fragment shader that expects GL_ES == 1 should succeed
PASS [vshader/fshaderWithGLSLPreprocessorSymbol]: fragment shader that uses GL_ES preprocessor symbol should succeed
PASS [vshader/fshaderWithVERSION100PreprocessorSymbol]: fragment shader that uses __VERSION__==100 should succeed
PASS [vshader/fshaderWithFragDepth]: fragment shader that uses gl_FragDepth should fail
PASS [vshaderWithClipVertex/fshader]: vertex shader that uses gl_ClipVertex should fail
PASS [vshader/fshaderWithDefineLineContinuation]: fragment shader that uses has line continuation macro should fail
PASS [vshaderWithgl_Color/fshader]: vertex shader that uses gl_Color should fail
PASS [vshaderWithgl_ProjectionMatrix/fshader]: vertex shader that uses gl_ProjectionMatrix should fail
PASS [vshaderWithAttributeArray/fshader]: vertex shader that uses attribute array should fail as per GLSL page 110, appendix A, section 5
PASS [vshaderWithwebgl_/fshader]: vertex shader that uses _webgl identifier should fail
PASS [vshaderWith_webgl_/fshader]: vertex shader that uses _webgl_ identifier should fail
PASS [vshaderWithExplicitIntCast/fshader]: vertex shader that explicit int to float cast should succeed
PASS [vshaderWithImplicitVec3Cast/fshader]: vertex shader that implicit vec3 to vec4 cast should fail
PASS [vshaderWithVersion130/fshader]: vertex shader uses the #version not 100 directive should fail
PASS [vshaderWithVersion120/fshader]: vertex shader uses the #version not 100 directive should fail
PASS [vshaderWithVersion100/fshader]: vertex shader uses the #version 100 directive should succeed
PASS [shaders/implicit/add_int_float.vert/fshader]: implicit cast adding integer to float should fail
PASS [shaders/implicit/add_int_mat2.vert/fshader]: implicit cast adding integer to mat2 should fail
PASS [shaders/implicit/add_int_mat3.vert/fshader]: implicit cast adding integer to mat3 should fail
PASS [shaders/implicit/add_int_mat4.vert/fshader]: implicit cast adding integer to mat4 should fail
PASS [shaders/implicit/add_int_vec2.vert/fshader]: implicit cast adding integer to vec2 should fail
PASS [shaders/implicit/add_int_vec3.vert/fshader]: implicit cast adding integer to vec3 should fail
PASS [shaders/implicit/add_int_vec4.vert/fshader]: implicit cast adding integer to vec4 should fail
PASS [shaders/implicit/add_ivec2_vec2.vert/fshader]: implicit cast adding ivec2 to vec2 should fail
PASS [shaders/implicit/add_ivec3_vec3.vert/fshader]: implicit cast adding ivec3 to vec3 should fail
PASS [shaders/implicit/add_ivec4_vec4.vert/fshader]: implicit cast adding ivec4 to vec4 should fail
PASS [shaders/implicit/assign_int_to_float.vert/fshader]: implicit cast assing int to float should fail
PASS [shaders/implicit/assign_ivec2_to_vec2.vert/fshader]: implicit cast assigning ivec2 to vec2 should fail
PASS [shaders/implicit/assign_ivec3_to_vec3.vert/fshader]: implicit cast assigning ivec3 to vec3 should fail
PASS [shaders/implicit/assign_ivec4_to_vec4.vert/fshader]: implicit cast assigning ivec4 to vec4 should fail
PASS [shaders/implicit/construct_struct.vert/fshader]: implicit cast from int to float in struct initializer should fail
PASS [shaders/implicit/divide_int_float.vert/fshader]: implicit cast of float divided by int should fail
PASS [shaders/implicit/divide_int_mat2.vert/fshader]: implicit cast of mat2 divided by int should fail
PASS [shaders/implicit/divide_int_mat3.vert/fshader]: implicit cast of mat3 divided by int should fail
PASS [shaders/implicit/divide_int_mat4.vert/fshader]: implicit cast of mat4 divided by int should fail
PASS [shaders/implicit/divide_int_vec2.vert/fshader]: implicit cast of vec2 divided by int should fail
PASS [shaders/implicit/divide_int_vec3.vert/fshader]: implicit cast of vec3 divided by int should fail
PASS [shaders/implicit/divide_int_vec4.vert/fshader]: implicit cast of vec4 divided by int should fail
PASS [shaders/implicit/divide_ivec2_vec2.vert/fshader]: implicit cast of vec2 divided by ivec2 should fail
PASS [shaders/implicit/divide_ivec3_vec3.vert/fshader]: implicit cast of vec3 divided by ivec3 should fail
PASS [shaders/implicit/divide_ivec4_vec4.vert/fshader]: implicit cast of vec4 divided by ivec4 should fail
PASS [shaders/implicit/equal_int_float.vert/fshader]: implicit cast of int to float in comparison should fail
PASS [shaders/implicit/equal_ivec2_vec2.vert/fshader]: implicit cast of ivec2 to vec2 in comparison should fail
PASS [shaders/implicit/equal_ivec3_vec3.vert/fshader]: implicit cast of ivec3 to vec3 in comparison should fail
PASS [shaders/implicit/equal_ivec4_vec4.vert/fshader]: implicit cast of ivec4 to vec4 in comparison should fail
PASS [shaders/implicit/function_int_float.vert/fshader]: implicit cast of int to float in function argument should fail
PASS [shaders/implicit/function_ivec2_vec2.vert/fshader]: implicit cast of ivec2 to vec2 in function argument should fail
PASS [shaders/implicit/function_ivec3_vec3.vert/fshader]: implicit cast of ivec3 to vec3 in function argument should fail
PASS [shaders/implicit/function_ivec4_vec4.vert/fshader]: implicit cast of ivec4 to vec4 in function argument should fail
PASS [shaders/implicit/greater_than.vert/fshader]: implicit cast of int to float with greater than should fail
PASS [shaders/implicit/greater_than_equal.vert/fshader]: implicit cast of int to float with greater than or equal to should fail
PASS [shaders/implicit/less_than.vert/fshader]: implicit cast of int to float with less than should fail
PASS [shaders/implicit/less_than_equal.vert/fshader]: implicit cast of int to float with less than or equal to should fail
PASS [shaders/implicit/multiply_int_float.vert/fshader]: implicit cast of int to float in multiply should fail
PASS [shaders/implicit/multiply_int_mat2.vert/fshader]: implicit cast of int to mat2 in multiply should fail
PASS [shaders/implicit/multiply_int_mat3.vert/fshader]: implicit cast of int to mat3 in multiply should fail
PASS [shaders/implicit/multiply_int_mat4.vert/fshader]: implicit cast of int to mat4 in multiply should fail
PASS [shaders/implicit/multiply_int_vec2.vert/fshader]: implicit cast of int to vec2 in multiply should fail
PASS [shaders/implicit/multiply_int_vec3.vert/fshader]: implicit cast of int to vec3 in multiply should fail
PASS [shaders/implicit/multiply_int_vec4.vert/fshader]: implicit cast of int to vec4 in multiply should fail
PASS [shaders/implicit/multiply_ivec2_vec2.vert/fshader]: implicit cast of ivec2 to vec2 in multiply should fail
PASS [shaders/implicit/multiply_ivec3_vec3.vert/fshader]: implicit cast of ivec3 to vec3 in multiply should fail
PASS [shaders/implicit/multiply_ivec4_vec4.vert/fshader]: implicit cast of ivec4 to vec4 in multiply should fail
PASS [shaders/implicit/not_equal_int_float.vert/fshader]: implicit cast of int to float in not equal comparison should fail
PASS [shaders/implicit/not_equal_ivec2_vec2.vert/fshader]: implicit cast of ivec2 to vec2 in not equal comparison should fail
PASS [shaders/implicit/not_equal_ivec3_vec3.vert/fshader]: implicit cast of ivec3 to vec3 in not equal comparison should fail
PASS [shaders/implicit/not_equal_ivec4_vec4.vert/fshader]: implicit cast of ivec4 to vec4 in not equal comparison should fail
PASS [shaders/implicit/subtract_int_float.vert/fshader]: implicit cast of int to float in subtraction should fail
PASS [shaders/implicit/subtract_int_mat2.vert/fshader]: implicit cast of int to mat2 in subtraction should fail
PASS [shaders/implicit/subtract_int_mat3.vert/fshader]: implicit cast of int to mat3 in subtraction should fail
PASS [shaders/implicit/subtract_int_mat4.vert/fshader]: implicit cast of int to mat4 in subtraction should fail
PASS [shaders/implicit/subtract_int_vec2.vert/fshader]: implicit cast of int to vec2 in subtraction should fail
PASS [shaders/implicit/subtract_int_vec3.vert/fshader]: implicit cast of int to vec3 in subtraction should fail
PASS [shaders/implicit/subtract_int_vec4.vert/fshader]: implicit cast of int to vec4 in subtraction should fail
PASS [shaders/implicit/subtract_ivec2_vec2.vert/fshader]: implicit cast of ivec2 to vec2 in subtraction should fail
PASS [shaders/implicit/subtract_ivec3_vec3.vert/fshader]: implicit cast of ivec3 to vec3 in subtraction should fail
PASS [shaders/implicit/subtract_ivec4_vec4.vert/fshader]: implicit cast of ivec4 to vec4 in subtraction should fail
PASS [shaders/implicit/ternary_int_float.vert/fshader]: implicit cast of int to float in ternary expression should fail
PASS [shaders/implicit/ternary_ivec2_vec2.vert/fshader]: implicit cast of ivec2 to vec2 in ternary expression should fail
PASS [shaders/implicit/ternary_ivec3_vec3.vert/fshader]: implicit cast of ivec3 to vec3 in ternary expression should fail
PASS [shaders/implicit/ternary_ivec4_vec4.vert/fshader]: implicit cast of ivec4 to vec4 in ternary expression should fail
PASS [shaders/misc/non-ascii.vert/fshader]: Non ascii data in source should fail
PASS [shaders/misc/non-ascii-comments.vert/fshader]: Non ascii comments in source should succeed
PASS [shaders/reserved/_webgl_field.vert/fshader]: use of reserved _webgl prefix as structure field should fail
PASS [shaders/reserved/_webgl_function.vert/fshader]: use of reserved _webgl prefix as function name should fail
PASS [shaders/reserved/_webgl_struct.vert/fshader]: use of reserved _webgl prefix as structure name should fail
PASS [shaders/reserved/_webgl_variable.vert/fshader]: use of reserved _webgl prefix as structure field should fail
PASS [shaders/reserved/webgl_field.vert/fshader]: use of reserved webgl_ prefix as structure field should fail
PASS [shaders/reserved/webgl_function.vert/fshader]: use of reserved webgl_ prefix as function name should fail
PASS [shaders/reserved/webgl_struct.vert/fshader]: use of reserved webgl_ prefix as structure name should fail
PASS [shaders/reserved/webgl_variable.vert/fshader]: use of reserved webgl_ prefix as variable should fail
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>WebGL GLSL Conformance Tests</title>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
<script src="resources/webgl-test-utils.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script id="vshader" type="text/something-not-javascript">
attribute vec4 vPosition;
void main()
{
gl_Position = vPosition;
}
</script>
<script id="fshader" type="text/something-not-javascript">
precision mediump float;
void main()
{
gl_FragColor = vec4(1.0,0.0,0.0,1.0);
}
</script>
<script id="fshaderWithPrecision" type="text/something-not-javascript">
void main()
{
mediump vec4 color = vec4(1.0,0.0,0.0,1.0);
gl_FragColor = color;
}
</script>
<script id="vshaderWithDefaultPrecision" type="text/something-not-javascript">
precision mediump float;
attribute vec4 vPosition;
void main()
{
gl_Position = vPosition;
}
</script>
<script id="fshaderWithDefaultPrecision" type="text/something-not-javascript">
precision mediump float;
void main()
{
gl_FragColor = vec4(1.0,0.0,0.0,1.0);
}
</script>
<script id="fshaderWithOutPrecision" type="text/something-not-javascript">
uniform vec4 color;
void main()
{
gl_FragColor = color;
}
</script>
<script id="fshaderWithInvalidIdentifier" type="text/something-not-javascript">
precision mediump float;
uniform float gl_foo;
void main()
{
gl_FragColor = vec4(gl_foo,0.0,0.0,1.0);
}
</script>
<script id="fshaderWithGL_ESeq1" type="text/something-not-javascript">
#if GL_ES == 1
precision mediump float;
void main()
{
gl_FragColor = vec4(0.0,0.0,0.0,1.0);
}
#else
foo
#endif
</script>
<script id="fshaderWithGLSLPreprocessorSymbol" type="text/something-not-javascript">
#if defined(GL_ES)
precision mediump float;
void main()
{
gl_FragColor = vec4(0.0,0.0,0.0,1.0);
}
#else
foo
#endif
</script>
<script id="fshaderWithVERSION100PreprocessorSymbol" type="text/something-not-javascript">
#if __VERSION__ == 100
precision mediump float;
void main()
{
gl_FragColor = vec4(0.0,0.0,0.0,1.0);
}
#else
foo
#endif
</script>
<script id="fshaderWithFragDepth" type="text/something-not-javascript">
precision mediump float;
void main()
{
gl_FragColor = vec4(0.0,0.0,0.0,1.0);
gl_FragDepth = 1.0;
}
</script>
<script id="vshaderWithClipVertex" type="text/something-not-javascript">
attribute vec4 vPosition;
void main()
{
gl_Position = vPosition;
gl_ClipVertex = vPosition;
}
</script>
<script id="fshaderWith__Define" type="text/something-not-javascript">
#define __foo 1
precision mediump float;
void main()
{
gl_FragColor = vec4(0.0,0.0,0.0,1.0);
}
</script>
<script id="fshaderWithGL_Define" type="text/something-not-javascript">
#define GL_FOO 1
precision mediump float;
void main()
{
gl_FragColor = vec4(0.0,0.0,0.0,1.0);
}
</script>
<script id="fshaderWithDefineLineContinuation" type="text/something-not-javascript">
#define foo this \
is a test
precision mediump float;
void main()
{
gl_FragColor = vec4(0.0,0.0,0.0,1.0);
}
</script>
<script id="vshaderWithgl_Color" type="text/something-not-javascript">
attribute vec4 vPosition;
void main()
{
gl_Position = gl_Color;
}
</script>
<script id="vshaderWithgl_ProjectionMatrix" type="text/something-not-javascript">
attribute vec4 vPosition;
void main()
{
gl_Position = vPosition * gl_ProjectionMatrix;
}
</script>
<script id="vshaderWithAttributeArray" type="text/something-not-javascript">
attribute vec4 vPosition[2];
void main()
{
gl_Position = vPosition[0] + vPosition[1];
}
</script>
<script id="vshaderWithwebgl_" type="text/something-not-javascript">
attribute vec4 webgl_vPosition;
void main()
{
gl_Position = webgl_vPosition;
}
</script>
<script id="vshaderWith_webgl_" type="text/something-not-javascript">
attribute vec4 _webgl_vPosition;
void main()
{
gl_Position = _webgl_vPosition;
}
</script>
<script id="vshaderWithImplicitVec3Cast" type="text/something-not-javascript">
attribute vec4 vPosition;
void main()
{
highp vec3 k = vec3(1, 2, 3);
gl_Position = k;
}
</script>
<script id="vshaderWithExplicitIntCast" type="text/something-not-javascript">
attribute vec4 vPosition;
void main()
{
int k = 123;
gl_Position = vec4(vPosition.x, vPosition.y, vPosition.z, float(k));
}
</script>
<script id="vshaderWithVersion130" type="text/something-not-javascript">
#version 130
attribute vec4 vPosition;
void main()
{
gl_Position = vPosition;
}
</script>
<script id="vshaderWithVersion120" type="text/something-not-javascript">
#version 120
attribute vec4 vPosition;
void main()
{
gl_Position = vPosition;
}
</script>
<script id="vshaderWithVersion100" type="text/something-not-javascript">
#version 100
attribute vec4 vPosition;
void main()
{
gl_Position = vPosition;
}
</script>
<script id="vshaderWith__FILE__" type="text/something-not-javascript">
__FILE__
</script>
<canvas id="canvas" width="2" height="2"> </canvas>
<script>
description("This test ensures WebGL implementations allow proper GLES2 shaders compile and improper ones fail.");
debug("");
debug("Canvas.getContext");
if (window.internals)
window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
var wtu = WebGLTestUtils;
wtu.loggingOff();
var gl = wtu.create3DContext(document.getElementById("canvas"));
if (!gl) {
testFailed("context does not exist");
} else {
testPassed("context exists");
debug("");
debug("Checking various GLSL programs.");
function log(msg) {
if (window.console && window.console.log) {
//window.console.log(msg);
}
}
var shaderInfo = [
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithPrecision',
fShaderSuccess: true,
linkSuccess: true,
passMsg: 'frament shader with precision compiled and linked'
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithDefaultPrecision',
fShaderSuccess: true,
linkSuccess: true,
passMsg: 'fragment shader with default precision compiled and linked'
},
{ vShaderId: 'vshaderWithDefaultPrecision',
vShaderSuccess: true,
fShaderId: 'fshader',
fShaderSuccess: true,
linkSuccess: true,
passMsg: 'vertex shader with default precision compiled and linked'
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithOutPrecision',
fShaderSuccess: false,
linkSuccess: false,
passMsg: 'fragment shader without precision should fail',
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithInvalidIdentifier',
fShaderSuccess: false,
linkSuccess: false,
passMsg: 'fragment shader with gl_ identifier should fail',
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithGL_ESeq1',
fShaderSuccess: true,
linkSuccess: true,
passMsg: 'fragment shader that expects GL_ES == 1 should succeed',
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithGLSLPreprocessorSymbol',
fShaderSuccess: true,
linkSuccess: true,
passMsg: 'fragment shader that uses GL_ES preprocessor symbol should succeed',
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithVERSION100PreprocessorSymbol',
fShaderSuccess: true,
linkSuccess: true,
passMsg: 'fragment shader that uses __VERSION__==100 should succeed',
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithFragDepth',
fShaderSuccess: false,
linkSuccess: false,
passMsg: 'fragment shader that uses gl_FragDepth should fail',
},
{ vShaderId: 'vshaderWithClipVertex',
vShaderSuccess: false,
fShaderId: 'fshader',
fShaderSuccess: true,
linkSuccess: false,
passMsg: 'vertex shader that uses gl_ClipVertex should fail',
},
//{ vShaderId: 'vshader',
// vShaderSuccess: true,
// fShaderId: 'fshaderWith__Define',
// fShaderSuccess: false,
// linkSuccess: false,
// passMsg: 'fragment shader that uses __ define should fail',
//},
//{ vShaderId: 'vshader',
// vShaderSuccess: true,
// fShaderId: 'fshaderWithGL_Define',
// fShaderSuccess: false,
// linkSuccess: false,
// passMsg: 'fragment shader that uses GL_ define should fail',
//},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithDefineLineContinuation',
fShaderSuccess: false,
linkSuccess: false,
passMsg: 'fragment shader that uses has line continuation macro should fail',
},
{ vShaderId: 'vshaderWithgl_Color',
vShaderSuccess: false,
fShaderId: 'fshader',
fShaderSuccess: true,
linkSuccess: false,
passMsg: 'vertex shader that uses gl_Color should fail',
},
{ vShaderId: 'vshaderWithgl_ProjectionMatrix',
vShaderSuccess: false,
fShaderId: 'fshader',
fShaderSuccess: true,
linkSuccess: false,
passMsg: 'vertex shader that uses gl_ProjectionMatrix should fail',
},
{ vShaderId: 'vshaderWithAttributeArray',
vShaderSuccess: false,
fShaderId: 'fshader',
fShaderSuccess: true,
linkSuccess: false,
passMsg: 'vertex shader that uses attribute array should fail as per GLSL page 110, appendix A, section 5',
},
{ vShaderId: 'vshaderWithwebgl_',
vShaderSuccess: false,
fShaderId: 'fshader',
fShaderSuccess: true,
linkSuccess: false,
passMsg: 'vertex shader that uses _webgl identifier should fail',
},
{ vShaderId: 'vshaderWith_webgl_',
vShaderSuccess: false,
fShaderId: 'fshader',
fShaderSuccess: true,
linkSuccess: false,
passMsg: 'vertex shader that uses _webgl_ identifier should fail',
},
{ vShaderId: 'vshaderWithExplicitIntCast',
vShaderSuccess: true,
fShaderId: 'fshader',
fShaderSuccess: true,
linkSuccess: true,
passMsg: 'vertex shader that explicit int to float cast should succeed',
},
{ vShaderId: 'vshaderWithImplicitVec3Cast',
vShaderSuccess: false,
fShaderId: 'fshader',
fShaderSuccess: true,
linkSuccess: false,
passMsg: 'vertex shader that implicit vec3 to vec4 cast should fail',
},
{ vShaderId: 'vshaderWithVersion130',
vShaderSuccess: false,
fShaderId: 'fshader',
fShaderSuccess: true,
linkSuccess: false,
passMsg: 'vertex shader uses the #version not 100 directive should fail',
},
{ vShaderId: 'vshaderWithVersion120',
vShaderSuccess: false,
fShaderId: 'fshader',
fShaderSuccess: true,
linkSuccess: false,
passMsg: 'vertex shader uses the #version not 100 directive should fail',
},
{ vShaderId: 'vshaderWithVersion100',
vShaderSuccess: true,
fShaderId: 'fshader',
fShaderSuccess: true,
linkSuccess: true,
passMsg: 'vertex shader uses the #version 100 directive should succeed',
},
];
// Read in all the shader source.
for (var ii = 0; ii < shaderInfo.length; ++ii) {
var si = shaderInfo[ii];
si.vShaderSource = document.getElementById(si.vShaderId).text;
si.fShaderSource = document.getElementById(si.fShaderId).text;
}
// Add more tests from external file
var simpleVertShader = document.getElementById('vshader').text;
var simpleFragShader = document.getElementById('fshader').text;
addExternalShaders('shaders/00_shaders.txt');
function addExternalShaders(filename, passMsg) {
var files = wtu.readFileList(filename);
for (var ii = 0; ii < files.length; ++ii) {
var file = files[ii];
var shaderSource = wtu.readFile(file);
var firstLine = shaderSource.split("\n")[0];
var success = undefined;
if (wtu.endsWith(firstLine, " fail") ||
wtu.endsWith(firstLine, " fail.")) {
success = false;
} else if (wtu.endsWith(firstLine, " succeed") ||
wtu.endsWith(firstLine, " succeed.")) {
success = true;
}
if (success === undefined) {
testFailed("bad first line in " + file);
continue;
}
if (!wtu.startsWith(firstLine, "// ")) {
testFailed("bad first line in " + file);
continue;
}
var passMsg = firstLine.substr(3);
if (wtu.endsWith(file, ".vert")) {
shaderInfo.push({
vShaderId: file,
vShaderSource: shaderSource,
vShaderSuccess: success,
fShaderId: 'fshader',
fShaderSource: simpleFragShader,
fShaderSuccess: true,
linkSuccess: success,
passMsg: passMsg,
});
} else if (wtu.endsWith(file, ".frag")) {
shaderInfo.push({
vShaderId: 'vshader',
vShaderSource: simpleVertShader,
vShaderSuccess: true,
fShaderId: file,
fShaderSource: shaderSource,
fShaderSuccess: success,
linkSuccess: success,
passMsg: passMsg,
});
}
}
}
for (var ii = 0; ii < shaderInfo.length; ++ii) {
var info = shaderInfo[ii];
var passMsg = '[' + info.vShaderId + '/' + info.fShaderId + ']: ' +
info.passMsg
log(passMsg);
//debug(info.fShaderId);
var vShader = wtu.loadShader(gl, info.vShaderSource, gl.VERTEX_SHADER);
if (info.vShaderTest) {
if (!info.vShaderTest(vShader)) {
testFailed(passMsg);
continue;
}
}
if ((vShader != null) != info.vShaderSuccess) {
testFailed(passMsg);
continue;
}
var fShader = wtu.loadShader(gl, info.fShaderSource, gl.FRAGMENT_SHADER);
//debug(fShader == null ? "fail" : "succeed");
if ((fShader != null) != info.fShaderSuccess) {
testFailed(passMsg);
continue;
}
if (vShader && fShader) {
var program = gl.createProgram();
gl.attachShader(program, vShader);
gl.attachShader(program, fShader);
gl.linkProgram(program);
var linked = (gl.getProgramParameter(program, gl.LINK_STATUS) != 0);
if (!linked) {
var error = gl.getProgramInfoLog(shader);
log("*** Error linking program '"+program+"':"+error);
}
if (linked != info.linkSuccess) {
testFailed(passMsg);
continue;
}
} else {
if (info.linkSuccess) {
testFailed(passMsg);
continue;
}
}
testPassed(passMsg);
}
}
debug("");
</script>
<script>
</script>
</body>
</html>
uniform float u_floats[4];
void main()
{
float sum = u_floats[0] + u_floats[1] + u_floats[2] + u_floats[3];
gl_Position = vec4(sum, 0.0, 0.0, 1.0);
}
\ No newline at end of file
uniform int u_ints[4];
void main()
{
int sum = u_ints[0] + u_ints[1] + u_ints[2] + u_ints[3];
gl_Position = vec4(sum, 0.0, 0.0, 1.0);
}
\ No newline at end of file
onmessage = function(evt) {
var array = new Uint32Array(1);
var view = new DataView(array.buffer);
view.setUint32(0, 12345678, true);
postMessage(view.getUint32(0, true));
}
window.jsTestIsAsync = true;
description('Test passing ArrayBuffers and ArrayBufferViews in messages.');
window.testsComplete = 0;
function classCompare(testName, got, sent) {
var classString = Object.prototype.toString;
var gotClass = classString.call(got);
var sentClass = classString.call(sent);
if (gotClass !== sentClass) {
testFailed(testName + ": class " + sentClass + " became " + gotClass);
return false;
} else {
testPassed(testName + ": classes are " + sentClass);
return true;
}
}
function bufferCompare(testName, got, sent) {
if (!classCompare(testName, got, sent)) {
return false;
}
if (got.byteLength !== sent.byteLength) {
testFailed(testName + ": expected byteLength " + sent.byteLength + " bytes, got " + got.byteLength);
return false;
} else {
testPassed(testName + ": buffer lengths are " + sent.byteLength);
}
var gotReader = new Uint8Array(got);
var sentReader = new Uint8Array(sent);
for (var i = 0; i < sent.byteLength; ++i) {
if (gotReader[i] !== sentReader[i]) {
testFailed(testName + ": buffers differ starting at byte " + i);
return false;
}
}
testPassed(testName + ": buffers have the same contents");
return true;
}
function viewCompare(testName, got, sent) {
if (!classCompare(testName, got, sent)) {
return false;
}
if (!bufferCompare(testName, got.buffer, sent.buffer)) {
return false;
}
if (got.byteOffset !== sent.byteOffset) {
testFailed(testName + ": offset " + sent.byteOffset + " became " + got.byteOffset);
return false;
} else {
testPassed(testName + ": offset is " + sent.byteOffset);
}
if (got.byteLength !== sent.byteLength) {
testFailed(testName + ": length " + sent.byteLength + " became " + got.byteLength);
return false;
} else {
testPassed(testName + ": length is " + sent.byteLength);
}
return true;
}
function typedArrayCompare(testName, got, sent) {
if (!viewCompare(testName, got, sent)) {
return false;
}
if (got.BYTES_PER_ELEMENT !== sent.BYTES_PER_ELEMENT) {
// Sanity checking.
testFailed(testName + ": expected BYTES_PER_ELEMENT " + sent.BYTES_PER_ELEMENT + ", saw " + got.BYTES_PER_ELEMENT);
return false;
}
return true;
}
function dataViewCompare(testName, got, sent) {
return viewCompare(testName, got, sent);
}
function dataViewCompare2(testName, got, sent) {
for (var i = 0; i < 2; ++i) {
if (!dataViewCompare(testName, got[i], sent[i])) {
return false;
}
}
if (got[0].buffer !== got[1].buffer) {
testFailed(testName + ": expected the same ArrayBuffer for both views");
return false;
}
return true;
}
function dataViewCompare3(testName, got, sent) {
for (var i = 0; i < 3; i += 2) {
if (!dataViewCompare(testName, got[i], sent[i])) {
return false;
}
}
if (got[1].x !== sent[1].x || got[1].y !== sent[1].y) {
testFailed(testName + ": {x:1, y:1} was not transferred properly");
return false;
}
if (got[0].buffer !== got[2].buffer) {
testFailed(testName + ": expected the same ArrayBuffer for both views");
return false;
}
return false;
}
function createBuffer(length) {
var buffer = new ArrayBuffer(length);
var view = new Uint8Array(buffer);
for (var i = 0; i < length; ++i) {
view[i] = i + 1;
}
return buffer;
}
function createTypedArray(typedArrayType, length) {
var view = new typedArrayType(length);
for (var i = 0; i < length; ++i) {
view[i] = i + 1;
}
return view;
}
function createTypedArrayOverBuffer(typedArrayType, typedArrayElementSize, length, subStart, subLength) {
var buffer = new ArrayBuffer(length * typedArrayElementSize);
if (subStart === undefined) {
subStart = 0;
subLength = length;
}
return new typedArrayType(buffer, subStart * typedArrayElementSize, subLength);
}
var basicBufferTypes = [
["Int32", Int32Array, 4],
["Uint32", Uint32Array, 4],
["Int8", Int8Array, 1],
["Uint8", Uint8Array, 1],
["Uint8Clamped", Uint8ClampedArray, 1],
["Int16", Int16Array, 2],
["Uint16", Uint16Array, 2],
["Float32", Float32Array, 4],
["Float64", Float64Array, 8]
];
var arrayBuffer1 = createBuffer(1);
var testList = [
['ArrayBuffer0', new ArrayBuffer(0), bufferCompare],
['ArrayBuffer1', createBuffer(1), bufferCompare],
['ArrayBuffer128', createBuffer(128), bufferCompare],
['DataView0', new DataView(new ArrayBuffer(0)), dataViewCompare],
['DataView1', new DataView(createBuffer(1)), dataViewCompare],
['DataView1-dup', [new DataView(arrayBuffer1), new DataView(arrayBuffer1)], dataViewCompare2],
['DataView1-dup2', [new DataView(arrayBuffer1), {x:1, y:1}, new DataView(arrayBuffer1)], dataViewCompare3],
['DataView128', new DataView(createBuffer(128)), dataViewCompare],
['DataView1_offset_at_end', new DataView(createBuffer(1), 1, 0), dataViewCompare],
['DataView128_offset_at_end', new DataView(createBuffer(128), 128, 0), dataViewCompare],
['DataView128_offset_slice_length_0', new DataView(createBuffer(128), 64, 0), dataViewCompare],
['DataView128_offset_slice_length_1', new DataView(createBuffer(128), 64, 1), dataViewCompare],
['DataView128_offset_slice_length_16', new DataView(createBuffer(128), 64, 16), dataViewCompare],
['DataView128_offset_slice_unaligned', new DataView(createBuffer(128), 63, 15), dataViewCompare]
];
testList = testList.concat(basicBufferTypes.map(function(t)
{return [t[0] + "_0", createTypedArray(t[1], 0), typedArrayCompare];}));
testList = testList.concat(basicBufferTypes.map(function(t)
{return [t[0] + "_1", createTypedArray(t[1], 1), typedArrayCompare];}));
testList = testList.concat(basicBufferTypes.map(function(t)
{return [t[0] + "_128", createTypedArray(t[1], 128), typedArrayCompare];}));
testList = testList.concat(basicBufferTypes.map(function(t)
{return [t[0] + "_0_buffer", createTypedArrayOverBuffer(t[1], t[2], 0), typedArrayCompare];}));
testList = testList.concat(basicBufferTypes.map(function(t)
{return [t[0] + "_1_buffer", createTypedArrayOverBuffer(t[1], t[2], 1), typedArrayCompare];}));
testList = testList.concat(basicBufferTypes.map(function(t)
{return [t[0] + "_128_buffer", createTypedArrayOverBuffer(t[1], t[2], 128), typedArrayCompare];}));
testList = testList.concat(basicBufferTypes.map(function(t)
{return [t[0] + "_1_buffer_offset_at_end", createTypedArrayOverBuffer(t[1], t[2], 1, 1, 0), typedArrayCompare];}));
testList = testList.concat(basicBufferTypes.map(function(t)
{return [t[0] + "_128_buffer_offset_at_end", createTypedArrayOverBuffer(t[1], t[2], 128, 128, 0), typedArrayCompare];}));
testList = testList.concat(basicBufferTypes.map(function(t)
{return [t[0] + "_128_buffer_offset_slice_length_0", createTypedArrayOverBuffer(t[1], t[2], 128, 64, 0), typedArrayCompare];}));
testList = testList.concat(basicBufferTypes.map(function(t)
{return [t[0] + "_128_buffer_offset_slice_length_1", createTypedArrayOverBuffer(t[1], t[2], 128, 64, 1), typedArrayCompare];}));
testList = testList.concat(basicBufferTypes.map(function(t)
{return [t[0] + "_128_buffer_offset_slice_length_16", createTypedArrayOverBuffer(t[1], t[2], 128, 64, 16), typedArrayCompare];}));
function doneTest() {
if (++window.testsComplete == testList.length) {
finishJSTest();
}
}
function windowHandleMessage(e) {
var currentTest = testList[e.data.testNum];
var expectedResult = currentTest[1];
try {
currentTest[2](currentTest[0], e.data.testData, expectedResult);
} catch(e) {
testFailed(currentTest[0] + ": unexpected exception " + e);
}
doneTest();
}
window.addEventListener('message', windowHandleMessage);
for (var t = 0; t < testList.length; ++t) {
var currentTest = testList[t];
var message = {testNum: t, testData: currentTest[1]};
try {
window.postMessage(message, '*');
} catch(e) {
testFailed(currentTest[0], ": unexpected postMessage exception " + e);
doneTest();
}
}
window.jsTestIsAsync = true;
description('Test transfer of control semantics for ArrayBuffers.');
window.testsComplete = 0;
var arraySize = 40;
var arrayOffset = 8;
var arrayEffectiveSize = arraySize - arrayOffset;
var basicBufferTypes =
[
["Int32", Int32Array, 4],
["Uint32", Uint32Array, 4],
["Int8", Int8Array, 1],
["Uint8", Uint8Array, 1],
["Uint8Clamped", Uint8ClampedArray, 1],
["Int16", Int16Array, 2],
["Uint16", Uint16Array, 2],
["Float32", Float32Array, 4],
["Float64", Float64Array, 8]
];
var allBufferTypes =
[
["Int32", Int32Array, 4],
["Uint32", Uint32Array, 4],
["Int8", Int8Array, 1],
["Uint8", Uint8Array, 1],
["Uint8Clamped", Uint8ClampedArray, 1],
["Int16", Int16Array, 2],
["Uint16", Uint16Array, 2],
["Float32", Float32Array, 4],
["Float64", Float64Array, 8],
["DataView", DataView, 1]
];
function isTypedArray(view)
{
for (var i = 0; i < basicBufferTypes.length; ++i) {
var bufferType = basicBufferTypes[i];
if (view instanceof bufferType[1]) {
return true;
}
}
return false;
}
function isDataView(view)
{
return (view instanceof DataView);
}
function isArrayBuffer(buffer)
{
return (buffer instanceof ArrayBuffer);
}
function isDataCloneError(e)
{
return (e.name === "DataCloneError");
}
function assertBufferClosed(testName, buffer)
{
if (buffer === null) {
return true;
}
if (!isArrayBuffer(buffer)) {
testFailed(testName + ": not an array buffer (" + buffer + ")");
return false;
}
if (buffer.byteLength !== 0 || !(buffer.byteLength === 0)) {
testFailed(testName + ": ArrayBuffer byteLength !== 0");
return false;
}
return true;
}
function assertViewClosed(testName, view)
{
if (isTypedArray(view) || isDataView(view)) {
if (view.buffer !== null && !assertBufferClosed(testName, view.buffer))
return false;
if (view.byteOffset !== 0 || !(view.byteOffset === 0)) {
testFailed(testName + ": view byteOffset !== 0");
return false;
}
if (view.byteLength !== 0 || !(view.byteLength === 0)) {
testFailed(testName + ": view byteLength !== 0");
return false;
}
if (!isDataView(view)) {
if (view.length !== 0 || !(view.length === 0)) {
testFailed(testName + ": TypedArray length !== 0");
return false;
}
try {
var v = view[0];
if (v !== undefined) {
testFailed(testName + ": index get on a closed view did not return undefined.");
return false;
}
} catch(xn) {
testFailed(testName + ": index get on a closed view threw an exception: " + xn);
return false;
}
try {
view[0] = 42;
var v = view[0];
if (v !== undefined) {
testFailed(testName + ": index set then get on a closed view did not return undefined.");
return false;
}
} catch(xn) {
testFailed(testName + ": index set then get on a closed view threw an exception: " + xn);
return false;
}
try {
view.get(0);
testFailed(testName + ": get on a closed view succeeded");
return false;
} catch (xn) { }
try {
view.set([0], 1);
testFailed(testName + ": set on a closed view succeeded");
return false;
} catch (xn) { }
} else {
try {
view.getInt8(0);
testFailed(testName + ": get on a closed view succeeded");
return false;
} catch (xn) { }
try {
view.setInt8(0, 1);
testFailed(testName + ": set on a closed view succeeded");
return false;
} catch (xn) { }
}
} else {
testFailed(testName + " not a view (" + view + ")");
return false;
}
return true;
}
function createBuffer(length)
{
var buffer = new ArrayBuffer(length);
var view = new Uint8Array(buffer);
for (var i = 0; i < length; ++i) {
view[i] = i + 1;
}
return buffer;
}
function checkBuffer(testName, buffer, length)
{
if (!isArrayBuffer(buffer)) {
testFailed(testName + ": buffer is not an ArrayBuffer");
return false;
}
if (buffer.byteLength !== length) {
testFailed(testName + ": buffer is the wrong length");
return false;
}
var view = new Uint8Array(buffer);
for (var i = 0; i < length; ++i) {
if (view[i] !== i + 1) {
testFailed(testName + ": buffer contains the wrong data");
return false;
}
}
return true;
}
function createView(viewType, bytesPerElement)
{
if (viewType === DataView) {
var view = new Uint8Array(arraySize);
for (var i = arrayOffset; i < arraySize; ++i) {
view[i] = i - arrayOffset + 1;
}
return new DataView(view.buffer, arrayOffset, arrayEffectiveSize);
} else {
var view = new viewType(new ArrayBuffer(arraySize), arrayOffset, arrayEffectiveSize / bytesPerElement);
for (var i = 0; i < arrayEffectiveSize / bytesPerElement; ++i) {
view[i] = i + 1;
}
return view;
}
}
function createEveryView(buffer)
{
return allBufferTypes.map(function (bufferType) {
return new bufferType[1](buffer, arrayOffset, arrayEffectiveSize / bufferType[2]);
});
}
function checkView(testName, typedArrayType, view)
{
if (!(view instanceof typedArrayType)) {
testFailed(testName + ": " + view + " not an instance of " + typedArrayType);
return false;
}
if (view.buffer.byteLength !== arraySize ||
(!(view instanceof DataView) && view.length !== arrayEffectiveSize / view.BYTES_PER_ELEMENT)) {
testFailed(testName + ": view has the wrong length (" + view.length + ")");
return false;
}
if (view.byteOffset !== arrayOffset) {
testFailed(testName + ": view has wrong byte offset");
}
var max = arrayEffectiveSize;
if (!(view instanceof DataView)) {
max = max / view.BYTES_PER_ELEMENT;
}
for (var i = 0; i < max; ++i) {
if (view instanceof DataView) {
if (view.getInt8(i) !== i + 1) {
testFailed(testName + ": view contains the wrong data");
return false;
}
} else {
if (view[i] !== i + 1) {
testFailed(testName + ": view contains the wrong data");
return false;
}
}
}
return true;
}
function checkEmptyArray(testName, array)
{
if (array === null || array === undefined) {
testFailed(testName + ": port list is null or undefined");
return false;
}
if (array.length !== 0) {
testFailed(testName + ": port list is not zero-length");
return false;
}
return true;
}
function wrapSend(testName, message, xfer)
{
try {
window.postMessage(message, '*', xfer);
} catch (e) {
testFailed(testName + ": could not postMessage: " + e);
doneTest();
return false;
}
return true;
}
function wrapFailSend(testName, message, xfer)
{
try {
window.postMessage(message, '*', xfer);
} catch (e) {
if (!isDataCloneError(e)) {
testFailed(testName + ": expected postMessage to throw DataCloneError but it didn't.");
return false;
}
return true;
}
testFailed(testName + ": expected postMessage to fail but it didn't.");
return false;
}
var testList = [{
name: "sanity check",
send: function (name) { wrapSend(name, [], []); },
test: function (name, e) { return true; }
}, {
name: "raw ArrayBuffer",
send: function (name) {
var buffer = createBuffer(3);
wrapSend(name, buffer, [buffer]);
assertBufferClosed(name, buffer);
wrapFailSend(name, buffer, [buffer]);
wrapFailSend(name, buffer, []);
},
test: function (name, e) { return checkBuffer(name, e.data, 3) && checkEmptyArray(name, e.ports); }
}, {
name: "sending buffers is sane even if cloning doesn't special-case",
send: function(name) {
var view = createView(Int32Array, 4);
var buffer = view.buffer;
wrapSend(name, [view, buffer], [buffer]);
assertBufferClosed(name, buffer);
assertViewClosed(name, view);
},
test: function (name, e) {
if (e.data[0].buffer !== e.data[1]) {
testFailed("View and buffer were not linked.");
return false;
}
return true;
}
}, {
name: "send every view",
send: function(name) {
var buffer = createBuffer(arraySize);
var views = createEveryView(buffer);
wrapSend(name, views, [buffer]);
assertBufferClosed(name, buffer);
wrapFailSend(name, views, [buffer]);
wrapFailSend(name, views, []);
},
test: function (name, e) {
if (e.data.length !== allBufferTypes.length) {
testFailed(name + ": not every view was sent.");
}
for (var v = 0; v < e.data.length; ++v) {
var view = e.data[v];
if (view.buffer !== e.data[0].buffer) {
testFailed(name + ": not every view pointed to the correct buffer.");
return false;
}
}
return true;
}
}, {
name: "transfer list multiple",
send: function(name) {
var buffer0 = createBuffer(arraySize);
wrapFailSend(name, { buffer : buffer0 }, [buffer0, buffer0]);
var buffer = createBuffer(arraySize);
wrapSend(name, { buffer : buffer }, [buffer]);
assertBufferClosed(name, buffer);
wrapFailSend(name, [buffer], [buffer]);
wrapFailSend(name, [], [buffer]);
var buffer2 = createBuffer(arraySize);
wrapFailSend(name, [], [buffer2, buffer]);
checkBuffer(name, buffer2, arraySize);
wrapFailSend(name, [], [buffer, buffer2]);
checkBuffer(name, buffer2, arraySize);
wrapFailSend(name, [buffer2], [buffer2, buffer]);
checkBuffer(name, buffer2, arraySize);
},
test: function (name, e) {
return checkBuffer(name, e.data.buffer, arraySize);
}
}, {
name: "transfer neuters unmentioned",
send: function (name) {
var buffer = createBuffer(arraySize);
wrapSend(name, [], [buffer]);
assertBufferClosed(name, buffer);
},
test : function (name, e) {
return e.data.length == 0;
}
}];
testList = testList.concat(allBufferTypes.map(function(bufferType) { return {
name: "raw " + bufferType[0],
send: function (name) {
var view = createView(bufferType[1], bufferType[2]);
wrapSend(name, view, [view.buffer]);
assertViewClosed(name, view);
assertBufferClosed(name, view.buffer);
wrapFailSend(name, view, [view.buffer]);
wrapFailSend(name, view, []);
},
test: function (name, e) {
return checkView(name, bufferType[1], e.data) && checkEmptyArray(name, e.ports);
}
}}));
function viewAndBuffer(viewFirst, bufferType) {
return {
name: (viewFirst ? "send view, buffer for " : "send buffer, view for ") + bufferType[0],
send: function (name) {
var view = createView(bufferType[1], bufferType[2]);
var buffer = view.buffer;
wrapSend(name, viewFirst ? [view, buffer] : [buffer, view], [buffer]);
assertViewClosed(name, view);
assertBufferClosed(name, buffer);
wrapFailSend(name, view, [buffer]);
wrapFailSend(name, view, []);
wrapFailSend(name, buffer, [buffer]);
wrapFailSend(name, buffer, []);
wrapFailSend(name, [view, buffer], [buffer]);
wrapFailSend(name, [buffer, view], [buffer]);
wrapFailSend(name, [view, buffer], []);
wrapFailSend(name, [buffer, view], []);
},
test: function (name, e) {
var view = e.data[viewFirst ? 0 : 1];
var buffer = e.data[viewFirst ? 1 : 0];
if (buffer !== view.buffer) {
testFailed(name + " buffer not shared");
return false;
}
return checkView(name, bufferType[1], view) && checkEmptyArray(name, e.ports);
}
}
};
function squashUnrelatedViews(bufferType) {
return {
name: "squash unrelated views for " + bufferType[0],
send: function(name) {
var view = createView(bufferType[1], bufferType[2]);
var views = createEveryView(view.buffer);
var buffer = view.buffer;
wrapSend(name, view, [view.buffer]);
assertViewClosed(name, view);
assertBufferClosed(name, view.buffer);
for (var v = 0; v < views.length; ++v) {
assertViewClosed(name + "(view " + v + ")", views[v]);
}
wrapFailSend(name, views, [buffer]);
},
test: function (name, e) { return checkView(name, bufferType[1], e.data) && checkEmptyArray(name, e.ports); }
}
}
testList = testList.concat(allBufferTypes.map(function(bufferType) { return viewAndBuffer(true, bufferType); }));
testList = testList.concat(allBufferTypes.map(function(bufferType) { return viewAndBuffer(false, bufferType); }));
testList = testList.concat(allBufferTypes.map(function(bufferType) { return squashUnrelatedViews(bufferType); }));
function doneTest() {
if (++window.testsComplete == testList.length) {
finishJSTest();
}
else {
var t = testList[window.testsComplete];
try {
t.send(t.name);
} catch(e) {
testFailed(t.name + ": on send: " + e);
doneTest();
}
}
}
function windowHandleMessage(event) {
var currentTest = testList[window.testsComplete];
if (currentTest.alreadyHit) {
testFailed(currentTest.name + ": windowHandleMessage hit more than once.");
return false;
}
currentTest.alreadyHit = true;
try {
if (currentTest.test(currentTest.name, event)) {
testPassed(currentTest.name);
}
} catch(e) {
testFailed(currentTest.name + ": on receive: " + e + ". event.data = " + event.data);
}
doneTest();
}
window.addEventListener('message', windowHandleMessage);
window.testsComplete = -1;
doneTest();
successfullyParsed = true;
description("Test of texImage2d and texSubImage2d");
if (window.internals)
window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
var context = create3DContext();
var image = document.createElement("img");
var video = document.createElement("video");
var canvas2d = document.createElement("canvas");
var context2d = canvas2d.getContext("2d");
var imageData = context2d.createImageData(64, 64);
var array = new Uint8Array([ 0, 0, 0, 255, 255, 255, 255, 255, 255, 255, 255, 255, 0, 0, 0, 255 ]);
shouldThrow("context.texImage2D(context.TEXTURE_2D)");
shouldBeUndefined("context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 64, 64, 0, context.RGBA, context.UNSIGNED_BYTE, null)");
shouldThrow("context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 0, context.RGBA, context.UNSIGNED_BYTE, 0)");
shouldThrow("context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 0, context.RGBA, context.UNSIGNED_BYTE, 0, 0)");
shouldBeUndefined("context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 2, 2, 0, context.RGBA, context.UNSIGNED_BYTE, array)");
shouldBeUndefined("context.pixelStorei(context.UNPACK_FLIP_Y_WEBGL, true)");
shouldBeUndefined("context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, context.RGBA, context.UNSIGNED_BYTE, imageData)");
shouldBeUndefined("context.pixelStorei(context.UNPACK_FLIP_Y_WEBGL, false)");
shouldBeUndefined("context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, context.RGBA, context.UNSIGNED_BYTE, image)");
shouldBeUndefined("context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, context.RGBA, context.UNSIGNED_BYTE, canvas2d)");
shouldBeUndefined("context.pixelStorei(context.UNPACK_FLIP_Y_WEBGL, true)");
shouldBeUndefined("context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, context.RGBA, context.UNSIGNED_BYTE, video)");
shouldThrow("context.texSubImage2D(context.TEXTURE_2D)");
shouldBeUndefined("context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, 0, 0, context.RGBA, context.UNSIGNED_BYTE, null)");
shouldThrow("context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, 0, 0, context.RGBA, context.UNSIGNED_BYTE, 0)");
shouldThrow("context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, 0, context.UNSIGNED_BYTE, 0)");
shouldBeUndefined("context.pixelStorei(context.UNPACK_FLIP_Y_WEBGL, false)");
shouldBeUndefined("context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, context.RGBA, context.UNSIGNED_BYTE, imageData)");
shouldBeUndefined("context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, context.RGBA, context.UNSIGNED_BYTE, image)");
shouldBeUndefined("context.pixelStorei(context.UNPACK_FLIP_Y_WEBGL, true)");
shouldBeUndefined("context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, context.RGBA, context.UNSIGNED_BYTE, canvas2d)");
shouldBeUndefined("context.pixelStorei(context.UNPACK_FLIP_Y_WEBGL, false)");
shouldBeUndefined("context.pixelStorei(context.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true)");
shouldBeUndefined("context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, context.RGBA, context.UNSIGNED_BYTE, video)");
implicit/00_shaders.txt
misc/00_shaders.txt
reserved/00_shaders.txt
add_int_float.vert
add_int_mat2.vert
add_int_mat3.vert
add_int_mat4.vert
add_int_vec2.vert
add_int_vec3.vert
add_int_vec4.vert
add_ivec2_vec2.vert
add_ivec3_vec3.vert
add_ivec4_vec4.vert
assign_int_to_float.vert
assign_ivec2_to_vec2.vert
assign_ivec3_to_vec3.vert
assign_ivec4_to_vec4.vert
construct_struct.vert
divide_int_float.vert
divide_int_mat2.vert
divide_int_mat3.vert
divide_int_mat4.vert
divide_int_vec2.vert
divide_int_vec3.vert
divide_int_vec4.vert
divide_ivec2_vec2.vert
divide_ivec3_vec3.vert
divide_ivec4_vec4.vert
equal_int_float.vert
equal_ivec2_vec2.vert
equal_ivec3_vec3.vert
equal_ivec4_vec4.vert
function_int_float.vert
function_ivec2_vec2.vert
function_ivec3_vec3.vert
function_ivec4_vec4.vert
greater_than.vert
greater_than_equal.vert
less_than.vert
less_than_equal.vert
multiply_int_float.vert
multiply_int_mat2.vert
multiply_int_mat3.vert
multiply_int_mat4.vert
multiply_int_vec2.vert
multiply_int_vec3.vert
multiply_int_vec4.vert
multiply_ivec2_vec2.vert
multiply_ivec3_vec3.vert
multiply_ivec4_vec4.vert
not_equal_int_float.vert
not_equal_ivec2_vec2.vert
not_equal_ivec3_vec3.vert
not_equal_ivec4_vec4.vert
subtract_int_float.vert
subtract_int_mat2.vert
subtract_int_mat3.vert
subtract_int_mat4.vert
subtract_int_vec2.vert
subtract_int_vec3.vert
subtract_int_vec4.vert
subtract_ivec2_vec2.vert
subtract_ivec3_vec3.vert
subtract_ivec4_vec4.vert
ternary_int_float.vert
ternary_ivec2_vec2.vert
ternary_ivec3_vec3.vert
ternary_ivec4_vec4.vert
// implicit cast adding integer to float should fail
void main()
{
float f = 1.0 + 1;
}
// implicit cast adding integer to mat2 should fail
void main()
{
mat2 f = mat2(1.0) + 1;
}
// implicit cast adding integer to mat3 should fail
void main()
{
mat3 f = mat3(1.0) + 1;
}
// implicit cast adding integer to mat4 should fail
void main()
{
mat4 f = mat4(1.0) + 1;
}
// implicit cast adding integer to vec2 should fail
void main()
{
vec2 f = vec2(1.0, 2.0) + 1;
}
// implicit cast adding integer to vec3 should fail
void main()
{
vec3 f = vec3(1.0, 2.0, 3.0) + 1;
}
// implicit cast adding integer to vec4 should fail
void main()
{
vec4 f = vec4(1.0, 2.0, 3.0, 4.0) + 1;
}
// implicit cast adding ivec2 to vec2 should fail
void main()
{
vec2 f = vec2(1.0, 2.0) + ivec2(1, 2);
}
// implicit cast adding ivec3 to vec3 should fail
void main()
{
vec3 f = vec3(1.0, 2.0, 3.0) + ivec3(1, 2, 3);
}
// implicit cast adding ivec4 to vec4 should fail
void main()
{
vec4 f = vec4(1.0, 2.0, 3.0, 4.0) + ivec4(1, 2, 3, 4);
}
// implicit cast assing int to float should fail
void main()
{
float f = -123;
}
// implicit cast assigning ivec2 to vec2 should fail
void main()
{
vec2 f = ivec2(1, 2);
}
// implicit cast assigning ivec3 to vec3 should fail
void main()
{
vec3 f = ivec3(1, 2, 3);
}
// implicit cast assigning ivec4 to vec4 should fail
void main()
{
vec4 f = ivec4(1, 2, 3, 4);
}
// implicit cast from int to float in struct initializer should fail
struct Foo {
float bar;
};
void main() {
Foo foo = Foo(1);
}
// implicit cast of float divided by int should fail
void main()
{
float f = 1.0 / 1;
}
// implicit cast of mat2 divided by int should fail
void main()
{
mat2 f = mat2(1.0) / 1;
}
// implicit cast of mat3 divided by int should fail
void main()
{
mat3 f = mat3(1.0) / 1;
}
// implicit cast of mat4 divided by int should fail
void main()
{
mat4 f = mat4(1.0) / 1;
}
// implicit cast of vec2 divided by int should fail
void main()
{
vec2 f = vec2(1.0, 2.0) / 1;
}
// implicit cast of vec3 divided by int should fail
void main()
{
vec3 f = vec3(1.0, 2.0, 3.0) / 1;
}
// implicit cast of vec4 divided by int should fail
void main()
{
vec4 f = vec4(1.0, 2.0, 3.0, 4.0) / 1;
}
// implicit cast of vec2 divided by ivec2 should fail
void main()
{
vec2 f = vec2(1.0, 2.0) / ivec2(1, 2);
}
// implicit cast of vec3 divided by ivec3 should fail
void main()
{
vec3 f = vec3(1.0, 2.0, 3.0) / ivec3(1, 2, 3);
}
// implicit cast of vec4 divided by ivec4 should fail
void main()
{
vec4 f = vec4(1.0, 2.0, 3.0, 4.0) / ivec4(1, 2, 3, 4);
}
// implicit cast of int to float in comparison should fail
void main()
{
bool b = 1.0 == 1;
}
// implicit cast of ivec2 to vec2 in comparison should fail
void main()
{
bool b = vec2(1.0, 2.0) == ivec2(1, 2);
}
// implicit cast of ivec3 to vec3 in comparison should fail
void main()
{
bool b = vec3(1.0, 2.0, 3.0) == ivec3(1, 2, 3);
}
// implicit cast of ivec4 to vec4 in comparison should fail
void main()
{
bool b = vec4(1.0, 2.0, 3.0, 4.0) == ivec4(1, 2, 3, 4);
}
// implicit cast of int to float in function argument should fail
float foo(float f) {
return f;
}
void main() {
float f = foo(1);
}
// implicit cast of ivec2 to vec2 in function argument should fail
vec2 foo(vec2 f) {
return f;
}
void main() {
vec2 f = foo(ivec2(1, 2));
}
// implicit cast of ivec3 to vec3 in function argument should fail
vec3 foo(vec3 f) {
return f;
}
void main() {
vec3 f = foo(ivec3(1, 2, 3));
}
// implicit cast of ivec4 to vec4 in function argument should fail
vec4 foo(vec4 f) {
return f;
}
void main() {
vec4 f = foo(ivec4(1, 2, 3, 4));
}
// implicit cast of int to float with greater than should fail
void main()
{
bool b = 1.0 > 1;
}
// implicit cast of int to float with greater than or equal to should fail
void main()
{
bool b = 1.0 >= 1;
}
// implicit cast of int to float with less than should fail
void main()
{
bool b = 1.0 < 1;
}
// implicit cast of int to float with less than or equal to should fail
void main()
{
bool b = 1.0 <= 1;
}
// implicit cast of int to float in multiply should fail
void main()
{
float f = 1.0 * 1;
}
// implicit cast of int to mat2 in multiply should fail
void main()
{
mat2 f = mat2(1.0) * 1;
}
// implicit cast of int to mat3 in multiply should fail
void main()
{
mat3 f = mat3(1.0) * 1;
}
// implicit cast of int to mat4 in multiply should fail
void main()
{
mat4 f = mat4(1.0) * 1;
}
// implicit cast of int to vec2 in multiply should fail
void main()
{
vec2 f = vec2(1.0, 2.0) * 1;
}
// implicit cast of int to vec3 in multiply should fail
void main()
{
vec3 f = vec3(1.0, 2.0, 3.0) * 1;
}
// implicit cast of int to vec4 in multiply should fail
void main()
{
vec4 f = vec4(1.0, 2.0, 3.0, 4.0) * 1;
}
// implicit cast of ivec2 to vec2 in multiply should fail
void main()
{
vec2 f = vec2(1.0, 2.0) * ivec2(1, 2);
}
// implicit cast of ivec3 to vec3 in multiply should fail
void main()
{
vec3 f = vec3(1.0, 2.0, 3.0) * ivec3(1, 2, 3);
}
// implicit cast of ivec4 to vec4 in multiply should fail
void main()
{
vec4 f = vec4(1.0, 2.0, 3.0, 4.0) * ivec4(1, 2, 3, 4);
}
// implicit cast of int to float in not equal comparison should fail
void main()
{
bool b = 1.0 != 1;
}
// implicit cast of ivec2 to vec2 in not equal comparison should fail
void main()
{
bool b = vec2(1.0, 2.0) != ivec2(1, 2);
}
// implicit cast of ivec3 to vec3 in not equal comparison should fail
void main()
{
bool b = vec3(1.0, 2.0, 3.0) != ivec3(1, 2, 3);
}
// implicit cast of ivec4 to vec4 in not equal comparison should fail
void main()
{
bool b = vec4(1.0, 2.0, 3.0, 4.0) != ivec4(1, 2, 3, 4);
}
// implicit cast of int to float in subtraction should fail
void main()
{
float f = 1.0 - 1;
}
// implicit cast of int to mat2 in subtraction should fail
void main()
{
mat2 f = mat2(1.0) - 1;
}
// implicit cast of int to mat3 in subtraction should fail
void main()
{
mat3 f = mat3(1.0) - 1;
}
// implicit cast of int to mat4 in subtraction should fail
void main()
{
mat4 f = mat4(1.0) - 1;
}
// implicit cast of int to vec2 in subtraction should fail
void main()
{
vec2 f = vec2(1.0, 2.0) - 1;
}
// implicit cast of int to vec3 in subtraction should fail
void main()
{
vec3 f = vec3(1.0, 2.0, 3.0) - 1;
}
// implicit cast of int to vec4 in subtraction should fail
void main()
{
vec4 f = vec4(1.0, 2.0, 3.0, 4.0) - 1;
}
// implicit cast of ivec2 to vec2 in subtraction should fail
void main()
{
vec2 f = vec2(1.0, 2.0) - ivec2(1, 2);
}
// implicit cast of ivec3 to vec3 in subtraction should fail
void main()
{
vec3 f = vec3(1.0, 2.0, 3.0) - ivec3(1, 2, 3);
}
// implicit cast of ivec4 to vec4 in subtraction should fail
void main()
{
vec4 f = vec4(1.0, 2.0, 3.0, 4.0) - ivec4(1, 2, 3, 4);
}
// implicit cast of int to float in ternary expression should fail
void main()
{
float f = true ? 1.0 : 1;
}
// implicit cast of ivec2 to vec2 in ternary expression should fail
void main()
{
vec2 f = true ? vec2(1.0, 2.0) : ivec2(1, 2);
}
// implicit cast of ivec3 to vec3 in ternary expression should fail
void main()
{
vec3 f = true ? vec3(1.0, 2.0, 3.0) : ivec3(1, 2, 3);
}
// implicit cast of ivec4 to vec4 in ternary expression should fail
void main()
{
vec4 f = true ? vec4(1.0, 2.0, 3.0, 4.0) : ivec4(1, 2, 3, 4);
}
// Non ascii comments in source should succeed
// これはASCIIではないです。
// This Is Not ASCII
/*
* This Is Not ASCII
*/
void main() {
gl_Position = vec4(1,1,1,1);
}
// Non ascii data in source should fail
// See GLSL ES Spec 1.0.17 section 3.1 and 3.2
// これはASCIIではないです。
// This Is Not ASCII
uniform mat4 NotASCII;
void main() {
gl_Position = vec4(1,1,1,1);
}
_webgl_field.vert
_webgl_function.vert
_webgl_struct.vert
_webgl_variable.vert
webgl_field.vert
webgl_function.vert
webgl_struct.vert
webgl_variable.vert
// use of reserved _webgl prefix as structure field should fail
struct Foo {
int _webgl_bar;
};
void main() {
Foo foo = Foo(1);
}
// use of reserved _webgl prefix as function name should fail
vec4 _webgl_foo() {
return vec4(1.0);
}
void main() {
gl_Position = _webgl_foo();
}
// use of reserved _webgl prefix as structure name should fail
struct _webgl_Foo {
int bar;
};
void main() {
_webgl_Foo foo = _webgl_Foo(1);
}
// use of reserved _webgl prefix as structure field should fail
void main() {
vec4 _webgl_foo;
}
// use of reserved webgl_ prefix as structure field should fail
struct Foo {
int webgl_bar;
};
void main() {
Foo foo = Foo(1);
}
// use of reserved webgl_ prefix as function name should fail
vec4 webgl_foo() {
return vec4(1.0);
}
void main() {
gl_Position = webgl_foo();
}
// use of reserved webgl_ prefix as structure name should fail
struct webgl_Foo {
int bar;
};
void main() {
webgl_Foo foo = webgl_Foo(1);
}
// use of reserved webgl_ prefix as variable should fail
void main() {
vec4 webgl_foo;
}
<!DOCTYPE html>
<html>
<head>
<title>texImage2D ImageData Test</title>
<script src="resources/webgl-test.js"> </script>
<script id="vshader" type="x-shader/x-vertex">
attribute vec3 vPosition;
attribute vec2 vTexCoord0;
varying vec2 texCoord;
void main()
{
gl_Position = vec4(vPosition.x, vPosition.y, vPosition.z, 1.0);
texCoord = vTexCoord0;
}
</script>
<script id="fshader" type="x-shader/x-fragment">
#ifdef GL_ES
precision highp float;
#endif
uniform sampler2D tex;
varying vec2 texCoord;
void main()
{
gl_FragColor = texture2D(tex, texCoord);
}
</script>
<script>
function fail(x,y, buf, shouldBe)
{
var i = (y*64+x) * 4;
var reason = "pixel at ("+x+","+y+") is ("+buf[i]+","+buf[i+1]+","+buf[i+2]+","+buf[i+3]+"), should be "+shouldBe;
document.getElementById("results").innerHTML = "Test <span style='color:red'>FAILED</span> "+reason;
}
function pass()
{
document.getElementById("results").innerHTML = "Test <span style='color:green'>PASSED</span>";
}
function checkGLError()
{
var error = gl.getError();
if (error != gl.NO_ERROR) {
var str = "GL Error: " + error;
document.body.appendChild(document.createTextNode(str));
throw str;
}
}
function init()
{
if (window.testRunner) {
testRunner.overridePreference("WebKitWebGLEnabled", "1");
testRunner.dumpAsText();
}
// Set up a canvas to get image data from
var canvas2d = document.getElementById("texcanvas");
var context2d = canvas2d.getContext("2d");
context2d.fillStyle = 'red';
context2d.fillRect(0,0,64,64);
gl = initWebGL("example", "vshader", "fshader", [ "vPosition", "vTexCoord0"], [ 1, 0, 1, 1 ], 100);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
var vertexObject = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
var vertices = new Float32Array([
-1, 1, 0,
-1, -1, 0,
1, 1, 0,
1, -1, 0,
1, 1, 0,
-1, -1, 0]);
var texCoords = new Float32Array([
0, 1,
0, 0,
1, 1,
1, 0,
1, 1,
0, 0]);
g_texCoordOffset = vertices.byteLength;
gl.bufferData(gl.ARRAY_BUFFER, g_texCoordOffset + texCoords.byteLength, gl.STATIC_DRAW);
gl.bufferSubData(gl.ARRAY_BUFFER, 0, vertices);
gl.bufferSubData(gl.ARRAY_BUFFER, g_texCoordOffset, texCoords);
gl.enableVertexAttribArray(0);
gl.vertexAttribPointer(0, 3, gl.FLOAT, gl.FALSE, 0, 0);
gl.enableVertexAttribArray(1);
gl.vertexAttribPointer(1, 2, gl.FLOAT, gl.FALSE, 0, g_texCoordOffset);
// Create a texture from the canvas's image data
var tex = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, tex);
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, context2d.getImageData(0, 0, 64, 64));
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
g_textureLoc = gl.getUniformLocation(gl.program, "tex");
gl.uniform1i(g_textureLoc, 0);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
gl.drawArrays(gl.TRIANGLES, 0, 6);
checkGLError();
// Test several locations
// Each line should be all red
var buf = new Uint8Array(64 * 64 * 4);
gl.readPixels(0, 0, 64, 64, gl.RGBA, gl.UNSIGNED_BYTE, buf);
var offset15 = 3840; // (15*64) * 4
var offset40 = 10240; // (40*64) * 4
var offset63 = 16128; // (63*64) * 4
for (var i = 0; i < 64; ++i) {
var test0 = (buf[i*4] != 255 || buf[i*4+1] != 0 || buf[i*4+2] != 0 || buf[i*4+3] != 255);
var test15 = (buf[offset15+i*4] != 255 || buf[offset15+i*4+1] != 0 || buf[offset15+i*4+2] != 0 || buf[offset15+i*4+3] != 255);
var test40 = (buf[offset40+i*4] != 255 || buf[offset40+i*4+1] != 0 || buf[offset40+i*4+2] != 0 || buf[offset40+i*4+3] != 255);
var test63 = (buf[offset63+i*4] != 255 || buf[offset63+i*4+1] != 0 || buf[offset63+i*4+2] != 0 || buf[offset63+i*4+3] != 255);
if (test0) {
fail(i, 0, buf, "(255,0,0,255)");
return;
}
if (test15) {
fail(i, 15, buf, "(255,0,0,255)");
return;
}
if (test40) {
fail(i, 40, buf, "(255,0,0,255)");
return;
}
if (test63) {
fail(i, 63, buf, "(255,0,0,255)");
return;
}
}
pass();
}
</script>
</head>
<body onload="init()">
<canvas id="texcanvas" width="64px" height="64px"></canvas>
<canvas id="example" width="64px" height="64px">
There is supposed to be an example drawing here, but it's not important.
</canvas>
<div id="results">Test <span style="color:red">FAILED</span></div>
</body>
</html>
Test of texImage2d and texSubImage2d
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS context.texImage2D(context.TEXTURE_2D) threw exception TypeError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': 6 arguments required, but only 1 present..
PASS context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 64, 64, 0, context.RGBA, context.UNSIGNED_BYTE, null) is undefined.
PASS context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 0, context.RGBA, context.UNSIGNED_BYTE, 0) threw exception TypeError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': Valid arities are: [6, 9], but 7 arguments provided..
PASS context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 0, context.RGBA, context.UNSIGNED_BYTE, 0, 0) threw exception TypeError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': Valid arities are: [6, 9], but 8 arguments provided..
PASS context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, 2, 2, 0, context.RGBA, context.UNSIGNED_BYTE, array) is undefined.
PASS context.pixelStorei(context.UNPACK_FLIP_Y_WEBGL, true) is undefined.
PASS context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, context.RGBA, context.UNSIGNED_BYTE, imageData) is undefined.
PASS context.pixelStorei(context.UNPACK_FLIP_Y_WEBGL, false) is undefined.
PASS context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, context.RGBA, context.UNSIGNED_BYTE, image) is undefined.
PASS context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, context.RGBA, context.UNSIGNED_BYTE, canvas2d) is undefined.
PASS context.pixelStorei(context.UNPACK_FLIP_Y_WEBGL, true) is undefined.
PASS context.texImage2D(context.TEXTURE_2D, 0, context.RGBA, context.RGBA, context.UNSIGNED_BYTE, video) is undefined.
PASS context.texSubImage2D(context.TEXTURE_2D) threw exception TypeError: Failed to execute 'texSubImage2D' on 'WebGLRenderingContext': 7 arguments required, but only 1 present..
PASS context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, 0, 0, context.RGBA, context.UNSIGNED_BYTE, null) is undefined.
PASS context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, 0, 0, context.RGBA, context.UNSIGNED_BYTE, 0) threw exception TypeError: Failed to execute 'texSubImage2D' on 'WebGLRenderingContext': parameter 9 is not of type 'ArrayBufferView'..
PASS context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, 0, context.UNSIGNED_BYTE, 0) threw exception TypeError: Failed to execute 'texSubImage2D' on 'WebGLRenderingContext': No function was found that matched the signature provided..
PASS context.pixelStorei(context.UNPACK_FLIP_Y_WEBGL, false) is undefined.
PASS context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, context.RGBA, context.UNSIGNED_BYTE, imageData) is undefined.
PASS context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, context.RGBA, context.UNSIGNED_BYTE, image) is undefined.
PASS context.pixelStorei(context.UNPACK_FLIP_Y_WEBGL, true) is undefined.
PASS context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, context.RGBA, context.UNSIGNED_BYTE, canvas2d) is undefined.
PASS context.pixelStorei(context.UNPACK_FLIP_Y_WEBGL, false) is undefined.
PASS context.pixelStorei(context.UNPACK_PREMULTIPLY_ALPHA_WEBGL, true) is undefined.
PASS context.texSubImage2D(context.TEXTURE_2D, 0, 10, 20, context.RGBA, context.UNSIGNED_BYTE, video) is undefined.
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script src="script-tests/texImageTest.js"></script>
</body>
</html>
CONSOLE WARNING: line 288: Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
Verifies that the array conversion code for WebGLRenderingContext.uniform* does not crash.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description("Verifies that the array conversion code for WebGLRenderingContext.uniform* does not crash.");
array = [ ];
for (var i = 0; i < 1 << 15; ++i)
array[i] = 0x0c0c0c0c;
array.length = 0x80000000;
context = create3DContext();
intProgram = loadProgram(context, "resources/intArrayUniformShader2.vert", "resources/noopUniformShader.frag");
floatProgram = loadProgram(context, "resources/floatArrayUniformShader.vert", "resources/noopUniformShader.frag");
intLocation = context.getUniformLocation(intProgram, "u_ints");
floatLocation = context.getUniformLocation(floatProgram, "u_floats");
context.useProgram(intProgram);
try {
context.uniform4iv(intLocation, array);
} catch (e) { }
context.useProgram(floatProgram);
try {
context.uniform4fv(floatLocation, array);
} catch (e) { }
</script>
</body>
</html>
Verifies that out-of-range parameters for creation, slicing and setting of WebGL arrays are caught
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Construction of Int8Array with null buffer should not throw exception
PASS Construction of Int8Array with out-of-range values threw exception
PASS Construction of Int8Array with negative out-of-range values threw exception
Testing subarray of Int8Array
PASS array.length is 32 / typeSize
PASS array.subarray(4, 0x3FFFFFFF).length is (32 / typeSize) - 4
PASS array.subarray(4, -2147483648).length is 0
PASS Setting Int8Array from array with out-of-range offset was caught
PASS Setting Int8Array from fake array with invalid length was caught
PASS Setting Int8Array from Int8Array with out-of-range offset was caught
PASS Construction of Uint8Array with null buffer should not throw exception
PASS Construction of Uint8Array with out-of-range values threw exception
PASS Construction of Uint8Array with negative out-of-range values threw exception
Testing subarray of Uint8Array
PASS array.length is 32 / typeSize
PASS array.subarray(4, 0x3FFFFFFF).length is (32 / typeSize) - 4
PASS array.subarray(4, -2147483648).length is 0
PASS Setting Uint8Array from array with out-of-range offset was caught
PASS Setting Uint8Array from fake array with invalid length was caught
PASS Setting Uint8Array from Uint8Array with out-of-range offset was caught
PASS Construction of Int16Array with null buffer should not throw exception
PASS Construction of Int16Array with out-of-range values threw exception
PASS Construction of Int16Array with negative out-of-range values threw exception
Testing subarray of Int16Array
PASS array.length is 32 / typeSize
PASS array.subarray(4, 0x3FFFFFFF).length is (32 / typeSize) - 4
PASS array.subarray(4, -2147483648).length is 0
PASS Setting Int16Array from array with out-of-range offset was caught
PASS Setting Int16Array from fake array with invalid length was caught
PASS Setting Int16Array from Int16Array with out-of-range offset was caught
PASS Construction of Uint16Array with null buffer should not throw exception
PASS Construction of Uint16Array with out-of-range values threw exception
PASS Construction of Uint16Array with negative out-of-range values threw exception
Testing subarray of Uint16Array
PASS array.length is 32 / typeSize
PASS array.subarray(4, 0x3FFFFFFF).length is (32 / typeSize) - 4
PASS array.subarray(4, -2147483648).length is 0
PASS Setting Uint16Array from array with out-of-range offset was caught
PASS Setting Uint16Array from fake array with invalid length was caught
PASS Setting Uint16Array from Uint16Array with out-of-range offset was caught
PASS Construction of Int32Array with null buffer should not throw exception
PASS Construction of Int32Array with out-of-range values threw exception
PASS Construction of Int32Array with negative out-of-range values threw exception
Testing subarray of Int32Array
PASS array.length is 32 / typeSize
PASS array.subarray(4, 0x3FFFFFFF).length is (32 / typeSize) - 4
PASS array.subarray(4, -2147483648).length is 0
PASS Setting Int32Array from array with out-of-range offset was caught
PASS Setting Int32Array from fake array with invalid length was caught
PASS Setting Int32Array from Int32Array with out-of-range offset was caught
PASS Construction of Uint32Array with null buffer should not throw exception
PASS Construction of Uint32Array with out-of-range values threw exception
PASS Construction of Uint32Array with negative out-of-range values threw exception
Testing subarray of Uint32Array
PASS array.length is 32 / typeSize
PASS array.subarray(4, 0x3FFFFFFF).length is (32 / typeSize) - 4
PASS array.subarray(4, -2147483648).length is 0
PASS Setting Uint32Array from array with out-of-range offset was caught
PASS Setting Uint32Array from fake array with invalid length was caught
PASS Setting Uint32Array from Uint32Array with out-of-range offset was caught
PASS Construction of Float32Array with null buffer should not throw exception
PASS Construction of Float32Array with out-of-range values threw exception
PASS Construction of Float32Array with negative out-of-range values threw exception
Testing subarray of Float32Array
PASS array.length is 32 / typeSize
PASS array.subarray(4, 0x3FFFFFFF).length is (32 / typeSize) - 4
PASS array.subarray(4, -2147483648).length is 0
PASS Setting Float32Array from array with out-of-range offset was caught
PASS Setting Float32Array from fake array with invalid length was caught
PASS Setting Float32Array from Float32Array with out-of-range offset was caught
PASS isNaN(floats[0]) is true
PASS successfullyParsed is true
TEST COMPLETE
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description("Verifies that out-of-range parameters for creation, slicing and setting of WebGL arrays are caught");
function testConstructionWithNullBuffer(type, name) {
var array;
try {
array = new type(null, 0, 0);
testPassed("Construction of " + name + " with null buffer should not throw exception");
} catch (e) {
testFailed("Construction of " + name + " with null buffer threw exception");
}
}
function testConstructionWithOutOfRangeValues(type, name) {
var buffer = new ArrayBuffer(4);
var array;
try {
array = new type(buffer, 4, 0x3FFFFFFF);
testFailed("Construction of " + name + " with out-of-range values should throw exception");
} catch (e) {
testPassed("Construction of " + name + " with out-of-range values threw exception");
}
}
function testConstructionWithNegativeOutOfRangeValues(type, name) {
var buffer = new ArrayBuffer(4);
var array;
try {
array = new type(buffer, 4, -2147483648);
testFailed("Construction of " + name + " with negative out-of-range values should throw exception");
} catch (e) {
testPassed("Construction of " + name + " with negative out-of-range values threw exception");
}
}
// These need to be global for shouldBe to see them
var array;
var typeSize;
function testSubarrayWithOutOfRangeValues(type, name, sz) {
debug("Testing subarray of " + name);
try {
var buffer = new ArrayBuffer(32);
array = new type(buffer);
typeSize = sz;
shouldBe("array.length", "32 / typeSize");
try {
shouldBe("array.subarray(4, 0x3FFFFFFF).length", "(32 / typeSize) - 4");
shouldBe("array.subarray(4, -2147483648).length", "0");
} catch (e) {
testFailed("Subarray of " + name + " threw exception");
}
} catch (e) {
testFailed("Exception: " + e);
}
}
function testSettingFromArrayWithOutOfRangeOffset(type, name) {
var webglArray = new type(32);
var array = [];
for (var i = 0; i < 16; i++) {
array.push(i);
}
try {
webglArray.set(array, 0x7FFFFFF8);
testFailed("Setting " + name + " from array with out-of-range offset was not caught");
} catch (e) {
testPassed("Setting " + name + " from array with out-of-range offset was caught");
}
}
function testSettingFromFakeArrayWithOutOfRangeLength(type, name) {
var webglArray = new type(32);
var array = {};
array.length = 0x80000000;
try {
webglArray.set(array, 8);
testFailed("Setting " + name + " from fake array with invalid length was not caught");
} catch (e) {
testPassed("Setting " + name + " from fake array with invalid length was caught");
}
}
function testSettingFromWebGLArrayWithOutOfRangeOffset(type, name) {
var webglArray = new type(32);
var srcArray = new type(16);
for (var i = 0; i < 16; i++) {
srcArray[i] = i;
}
try {
webglArray.set(srcArray, 0x7FFFFFF8);
testFailed("Setting " + name + " from " + name + " with out-of-range offset was not caught");
} catch (e) {
testPassed("Setting " + name + " from " + name + " with out-of-range offset was caught");
}
}
var typeNames = [ "Int8Array",
"Uint8Array",
"Int16Array",
"Uint16Array",
"Int32Array",
"Uint32Array",
"Float32Array" ];
var typeSizes = [ 1, 1, 2, 2, 4, 4, 4 ];
for (var i = 0; i < typeNames.length; i++) {
var name = typeNames[i];
var type = window[name];
if (!type) {
testFailed("Could not find array type " + name);
} else {
testConstructionWithNullBuffer(type, name);
testConstructionWithOutOfRangeValues(type, name);
testConstructionWithNegativeOutOfRangeValues(type, name);
testSubarrayWithOutOfRangeValues(type, name, typeSizes[i]);
testSettingFromArrayWithOutOfRangeOffset(type, name);
testSettingFromFakeArrayWithOutOfRangeLength(type, name);
testSettingFromWebGLArrayWithOutOfRangeOffset(type, name);
}
}
buffer = new ArrayBuffer(40);
ints = new Int32Array(buffer, 0, 10);
floats = new Float32Array(buffer, 0, 10);
// Plant a NaN into the buffer
ints[0]=-0x7ffff;
// Read the NaN out as a float
shouldBeTrue("isNaN(floats[0])");
</script>
</body>
</html>
Test loading a large texture using texImage2D
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Image width and height: 3900, 3900
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Loading a large texture using texImage2D</title>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
</head>
<body>
<canvas id="canvas" width="64" height="64"></canvas>
<div id="description"></div>
<div id="console"></div>
<script>
var successfullyParsed = false;
function init()
{
if (window.initNonKhronosFramework)
window.initNonKhronosFramework(true);
if (window.internals)
window.internals.settings.setWebGLErrorsToConsoleEnabled(false);
description('Test loading a large texture using texImage2D');
runTest();
}
function andPixels(pixels32) {
var pixelsAnd = 0xffffffff;
for (var i = 0; i < pixels32.length; ++i) {
pixelsAnd &= pixels32[i];
}
return pixelsAnd;
}
function runTest() {
var width = 3900;
var height = 3900;
var canvas = document.getElementById('canvas');
var gl = canvas.getContext('webgl');
gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, gl.NONE);
var texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture);
var image = new Image();
image.onerror = function (e) {
testFailed('Image failed to load');
}
image.onload = function () {
debug('Image width and height: ' + image.width + ', ' + image.height);
if (image.width !== width || image.height !== height) {
testFailed('Image did not have expected dimensions.');
return;
}
var pixels = new ArrayBuffer(width * height * 4);
var pixels8 = new Uint8Array(pixels);
var pixels32 = new Uint32Array(pixels);
if (width > gl.getParameter(gl.MAX_TEXTURE_SIZE) ||
width > gl.getParameter(gl.MAX_RENDERBUFFER_SIZE)) {
// The image is allowed to be too big to be used as a texture.
finishJSTest();
return;
}
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image);
if (gl.getError() != gl.NO_ERROR) {
// Loading the texture is allowed to fail due to resource constraints.
finishJSTest();
return;
}
var fb = gl.createFramebuffer();
gl.bindFramebuffer(gl.FRAMEBUFFER, fb);
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);
gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, pixels8);
// The image is filled with white, ignore last bit of each subpixel to account for decoding rounding differences.
if ((andPixels(pixels32) & 0xfefefefe) !== (0xfefefefe | 0)) {
testFailed('Texture was not loaded correctly.');
}
finishJSTest();
}
image.src = 'resources/white3900x3900.jpg';
}
init();
</script>
</body>
</html>
This test checks to ensure that a webgl context can be created with the 'webgl' context ID
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS context exists
PASS successfullyParsed is true
TEST COMPLETE
<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/js-test.js"></script>
<script src="resources/webgl-test.js"></script>
</head>
<body>
<canvas id="c"></canvas>
<script>
description("This test checks to ensure that a webgl context can be created with the 'webgl' context ID");
var c = document.getElementById("c");
var gl = c.getContext("webgl");
if (!gl)
testFailed("context does not exist");
else
testPassed("context exists");
</script>
</body>
</html>
\ No newline at end of file
<html>
<head>
<script>
function log(message)
{
document.getElementById('console').appendChild(document.createTextNode(message + "\n"));
}
function runTest()
{
log("Test DataView in worker.");
var worker = new Worker("resources/worker-data-view-test.js");
worker.onmessage = function(event) {
log(event.data);
if (window.testRunner)
testRunner.notifyDone();
};
worker.postMessage("start");
}
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
</script>
</head>
<body onload="runTest()">
<pre id='console'></pre>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment