Bug 694730 - Upgrade WebGL conformance test suite to r15815 - no review

The 1.0.1 release is really close, and upgrading now allows us to give feedback and make sure that all tests are passable.

The canonical URL for this test suite is
  https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/tests/webgl-conformance-tests.html

--HG--
rename : content/canvas/test/webgl/conformance/include.vs => content/canvas/test/webgl/conformance/glsl/misc/include.vs
This commit is contained in:
Benoit Jacob 2011-10-16 21:19:28 -04:00
parent 30dd58b388
commit 6ebd0d5507
317 changed files with 11244 additions and 3927 deletions

View File

@ -1,13 +1,12 @@
This is a local copy of the WebGL conformance suite, SVN revision 15318
This is a local copy of the WebGL conformance suite, SVN revision 15815
The canonical location for this testsuite is:
https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/tests/webgl-conformance-tests.html
https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/tests
All files and directories in this directory, with the exceptions listed below, come from
upstream and should not be modified without corresponding upstream fixes and/or a
patch file in this directory. The exceptions (the Mozilla-specific files) are:
* the crossorigin directory is not from upstream (not easy to share, as it relies on special features of the HTTP server used for our test framework)
* README.mozilla (this file)
* failing_tests_*.txt
* Makefile.in

View File

@ -1,109 +1,17 @@
array-buffer-crash.html
array-buffer-view-crash.html
array-unit-tests.html
bad-arguments-test.html
buffer-bind-test.html
buffer-data-array-buffer.html
buffer-preserve-test.html
buffer-offscreen-test.html
canvas-test.html
canvas-zero-size.html
constants.html
context-attributes-alpha-depth-stencil-antialias.html
context-lost-restored.html
context-lost.html
context-type-test.html
copy-tex-image-and-sub-image-2d.html
draw-arrays-out-of-bounds.html
draw-elements-out-of-bounds.html
drawingbuffer-static-canvas-test.html
drawingbuffer-test.html
error-reporting.html
framebuffer-object-attachment.html
framebuffer-test.html
get-active-test.html
gl-bind-attrib-location-test.html
gl-clear.html
gl-drawelements.html
gl-enable-enum-test.html
gl-enable-vertex-attrib.html
gl-enum-tests.html
gl-fragcoord.html
shaders/00_test_list.txt
gl-get-active-attribute.html
gl-get-active-uniform.html
gl-get-calls.html
gl-geterror.html
gl-getshadersource.html
gl-getstring.html
gl-min-attribs.html
gl-min-textures.html
gl-min-uniforms.html
gl-object-get-calls.html
gl-pixelstorei.html
gl-scissor-test.html
gl-shader-test.html
gl-teximage.html
gl-uniform-arrays.html
gl-uniform-bool.html
gl-uniformmatrix4fv.html
gl-unknown-uniform.html
gl-vertex-attrib-zero-issues.html
gl-vertex-attrib.html
gl-vertexattribpointer.html
gl-vertexattribpointer-offsets.html
#glsl-2types-of-textures-on-same-unit.html
glsl-conformance.html
glsl-long-variable-names.html
incorrect-context-object-behaviour.html
index-validation-copies-indices.html
index-validation-crash-with-buffer-sub-data.html
index-validation-verifies-too-many-indices.html
index-validation-with-resized-buffer.html
index-validation.html
instanceof-test.html
invalid-UTF-16.html
invalid-passed-params.html
is-object.html
methods.html
more-than-65536-points.html
null-object-behaviour.html
null-uniform-location.html
object-deletion-behaviour.html
oes-standard-derivatives.html
oes-texture-float.html
oes-vertex-array-object.html
origin-clean-conformance.html
point-size.html
premultiplyalpha-test.html
program-test.html
read-pixels-pack-alignment.html
read-pixels-test.html
renderbuffer-initialization.html
resource-sharing-test.html
tex-image-and-sub-image-2d-with-array-buffer-view.html
tex-image-and-sub-image-2d-with-canvas.html
tex-image-and-sub-image-2d-with-image-data.html
tex-image-and-sub-image-2d-with-image.html
tex-image-and-sub-image-2d-with-video.html
tex-image-and-uniform-binding-bugs.html
tex-image-with-format-and-type.html
tex-image-with-invalid-data.html
tex-input-validation.html
tex-sub-image-2d-bad-args.html
tex-sub-image-2d.html
texparameter-test.html
texture-active-bind-2.html
texture-active-bind.html
texture-complete.html
texture-formats-test.html
texture-npot.html
texture-npot-video.html
texture-transparent-pixels-initialized.html
triangle.html
type-conversion-test.html
uniform-location.html
uniform-samplers-test.html
uninitialized-test.html
viewport-unchanged-upon-resize.html
webgl-specific.html
attribs/00_test_list.txt
buffers/00_test_list.txt
canvas/00_test_list.txt
context/00_test_list.txt
extensions/00_test_list.txt
glsl/00_test_list.txt
limits/00_test_list.txt
misc/00_test_list.txt
programs/00_test_list.txt
reading/00_test_list.txt
renderbuffers/00_test_list.txt
rendering/00_test_list.txt
state/00_test_list.txt
textures/00_test_list.txt
typedarrays/00_test_list.txt
uniforms/00_test_list.txt

View File

@ -0,0 +1,6 @@
gl-enable-vertex-attrib.html
gl-vertex-attrib-zero-issues.html
gl-vertex-attrib.html
gl-vertexattribpointer-offsets.html
gl-vertexattribpointer.html

View File

@ -8,9 +8,9 @@
<head>
<meta charset="utf-8">
<title>WebGL Enable Vertex Attrib Test</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"> </script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"> </script>
</head>
<body>
<canvas id="example" width="50" height="50">
@ -50,7 +50,7 @@ glErrorShouldBe(gl, gl.INVALID_OPERATION);
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -8,10 +8,10 @@
<head>
<meta charset="utf-8">
<title>WebGL Enable Vertex Attrib Zero Test</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"> </script>
<script src="resources/webgl-test-utils.js"> </script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"> </script>
<script src="../resources/webgl-test-utils.js"> </script>
</head>
<body>
<canvas id="example" width="50" height="50">
@ -88,7 +88,7 @@ wtu.checkCanvas(gl, [0, 0, 0, 0], "canvas should be 0, 0, 0, 0");
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -8,9 +8,9 @@ found in the LICENSE file.
<head>
<meta charset="utf-8">
<title>WebGL vertexAttrib Conformance Tests</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
@ -88,7 +88,7 @@ debug("");
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -28,10 +28,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<head>
<meta charset="utf-8">
<title>Rendering Test</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"> </script>
<script src="resources/webgl-test-utils.js"> </script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"> </script>
<script src="../resources/webgl-test-utils.js"> </script>
</head>
<body>
<canvas id="example" width="50" height="50">
@ -186,7 +186,7 @@ There is supposed to be an example drawing here, but it's not important.
init();
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -8,11 +8,11 @@ found in the LICENSE file.
<head>
<meta charset="utf-8">
<title>WebGL vertexAttribPointer Conformance Tests</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/desktop-gl-constants.js" type="text/javascript"></script>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<script src="resources/webgl-test-utils.js"></script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
<script src="../resources/webgl-test-utils.js"></script>
</head>
<body>
<div id="description"></div>
@ -127,7 +127,7 @@ debug("");
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -0,0 +1,8 @@
buffer-bind-test.html
buffer-data-array-buffer.html
index-validation-copies-indices.html
index-validation-crash-with-buffer-sub-data.html
index-validation-verifies-too-many-indices.html
index-validation-with-resized-buffer.html
index-validation.html

View File

@ -8,9 +8,9 @@ found in the LICENSE file.
<head>
<meta charset="utf-8">
<title>WebGL BindBuffer conformance test.</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"> </script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"> </script>
</head>
<body>
<canvas id="example" width="40" height="40" style="width: 40px; height: 40px;"></canvas>
@ -56,7 +56,7 @@ if (!gl) {
debug("");
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -7,9 +7,9 @@ found in the LICENSE file.
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
@ -62,6 +62,6 @@ glErrorShouldBe(gl, gl.NO_ERROR);
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -31,9 +31,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
@ -71,6 +71,6 @@ debug("")
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -7,9 +7,9 @@ found in the LICENSE file.
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
@ -30,6 +30,6 @@ testPassed("bufferSubData, when buffer object was initialized with null, did not
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -7,9 +7,9 @@ found in the LICENSE file.
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
@ -42,6 +42,6 @@ debug("")
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -7,9 +7,9 @@ found in the LICENSE file.
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
</head>
<body>
<canvas id="example" width="1px" height="1px"></canvas>
@ -99,6 +99,6 @@ debug("")
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -31,9 +31,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
@ -135,6 +135,6 @@ shouldBeUndefined('gl.drawElements(gl.TRIANGLES, 3, gl.UNSIGNED_SHORT, 0)');
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -0,0 +1,8 @@
buffer-offscreen-test.html
buffer-preserve-test.html
canvas-test.html
canvas-zero-size.html
drawingbuffer-static-canvas-test.html
drawingbuffer-test.html
viewport-unchanged-upon-resize.html

View File

@ -3,10 +3,10 @@
<head>
<meta charset="utf-8">
<title>WebGL required buffer clear behaviour test</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"> </script>
<script src="resources/webgl-test-utils.js"> </script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"> </script>
<script src="../resources/webgl-test-utils.js"> </script>
<style type="text/css">
body {
height: 3000px;

View File

@ -3,10 +3,10 @@
<head>
<meta charset="utf-8">
<title>WebGL required buffer clear behaviour test</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"> </script>
<script src="resources/webgl-test-utils.js"> </script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"> </script>
<script src="../resources/webgl-test-utils.js"> </script>
<style type="text/css">
body {
height: 3000px;
@ -21,13 +21,21 @@ var wtu = WebGLTestUtils;
function timer() {
if (iter == 0) {
function init(gl) {
gl.clearColor(1, 0, 0, 1);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);
// enable scissor here, before compositing, to make sure it's correctly
// ignored and restored
gl.scissor(0, 10, 10, 10);
gl.enable(gl.SCISSOR_TEST);
}
init(gl1);
} else if (iter == 1) {
// some random hacky stuff to make sure that we get a compositing step
window.scrollBy(0, 10);
window.scrollBy(0, -10);
iter++;
setTimeout(timer, 500);
} else if (iter == 1) {
} else if (iter == 2) {
function clear(gl) {
// scissor was set earlier
gl.clearColor(0, 0, 1, 1);
@ -39,7 +47,11 @@ function timer() {
clear(gl1);
finishTest();
return;
}
iter++;
setTimeout(timer, 500);
}
function go() {
@ -56,18 +68,6 @@ function go() {
shouldBeTrue("gl1 != null");
shouldBeTrue('gl1.getContextAttributes().preserveDrawingBuffer == false');
function init(gl) {
gl.clearColor(1, 0, 0, 1);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT | gl.STENCIL_BUFFER_BIT);
// enable scissor here, before compositing, to make sure it's correctly
// ignored and restored
gl.scissor(0, 10, 10, 10);
gl.enable(gl.SCISSOR_TEST);
}
init(gl1);
setTimeout(timer, 500);
}

View File

@ -8,10 +8,10 @@ found in the LICENSE file.
<head>
<meta charset="utf-8">
<title>WebGL Canvas Conformance Tests</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/desktop-gl-constants.js" type="text/javascript"></script>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>

View File

@ -8,10 +8,10 @@ Use of this source code is governed by a BSD-style license that can be
<head>
<meta charset="utf-8">
<title>Zero Size Canvas Test</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"> </script>
<script src="resources/webgl-test-utils.js"> </script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"> </script>
<script src="../resources/webgl-test-utils.js"> </script>
</head>
<body>
<div id="description"></div>
@ -36,7 +36,7 @@ wtu.drawQuad(gl);
glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup.");
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -0,0 +1,149 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL Canvas Conformance Tests</title>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.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>
<canvas id="canvas" width="50" height="50"> </canvas>
<script id="vshader" type="x-shader/x-vertex">
attribute vec4 vPosition;
void main()
{
gl_Position = vPosition;
}
</script>
<script id="fshader" type="x-shader/x-fragment">
void main()
{
gl_FragColor = vec4(1.0,0.0,0.0,1.0);
}
</script>
<script>
function fail(x,y, buf, shouldBe)
{
var i = (y*50+x) * 4;
var reason = "pixel at ("+x+","+y+") is ("+buf[i]+","+buf[i+1]+","+buf[i+2]+","+buf[i+3]+"), should be "+shouldBe;
testFailed(reason);
}
function pass()
{
testPassed("drawing is correct");
}
function drawTriangleTest(gl)
{
gl.viewport(0, 0, 50, 50);
var vertexObject = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([ 0,0.5,0, -0.5,-0.5,0, 0.5,-0.5,0 ]), gl.STATIC_DRAW);
gl.enableVertexAttribArray(0);
gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
gl.drawArrays(gl.TRIANGLES, 0, 3);
var buf = new Uint8Array(50 * 50 * 4);
gl.readPixels(0, 0, 50, 50, gl.RGBA, gl.UNSIGNED_BYTE, buf);
// Test several locations
// First line should be all black
for (var i = 0; i < 50; ++i) {
if (buf[i*4] != 0 || buf[i*4+1] != 0 || buf[i*4+2] != 0 || buf[i*4+3] != 255) {
fail(i, 0, buf, "(0,0,0,255)");
return;
}
}
// Line 15 should be red for at least 10 red pixels starting 20 pixels in
var offset = (15*50+20) * 4;
for (var i = 0; i < 10; ++i) {
if (buf[offset+i*4] != 255 || buf[offset+i*4+1] != 0 || buf[offset+i*4+2] != 0 || buf[offset+i*4+3] != 255) {
fail(20 + i, 15, buf, "(255,0,0,255)");
return;
}
}
// Last line should be all black
offset = (49*50) * 4;
for (var i = 0; i < 50; ++i) {
if (buf[offset+i*4] != 0 || buf[offset+i*4+1] != 0 || buf[offset+i*4+2] != 0 || buf[offset+i*4+3] != 255) {
fail(i, 49, buf, "(0,0,0,255)");
return;
}
}
}
description("This test ensures WebGL implementations correctly implement drawingbufferWidth/Height with compositing.");
debug("");
var wtu = WebGLTestUtils;
var err;
var maxSize;
var canvas = document.getElementById("canvas");
var gl = wtu.create3DContext(canvas);
if (!gl) {
testFailed("context does not exist");
} else {
testPassed("context exists");
gl.program = createProgram(gl, "vshader", "fshader", ["vPosition"]);
shouldBeNonNull(gl.program);
gl.useProgram(gl.program);
gl.enable(gl.DEPTH_TEST);
gl.disable(gl.BLEND);
gl.clearColor(0, 0, 0, 1);
gl.clearDepth(1);
shouldBe('gl.getError()', 'gl.NO_ERROR');
debug("");
debug("Checking drawingBufferWidth/drawingBufferHeight");
// Check that a canvas with no width or height is 300x150 pixels
shouldBe('gl.drawingBufferWidth', 'canvas.width');
shouldBe('gl.drawingBufferHeight', 'canvas.height');
// Check that changing the canvas size to something too large falls back to reasonable values.
maxSize = gl.getParameter(gl.MAX_VIEWPORT_DIMS);
shouldBeTrue('maxSize[0] > 0');
shouldBeTrue('maxSize[1] > 0');
// debug("MAX_VIEWPORT_DIMS = " + maxSize[0] + "x" + maxSize[1]);
canvas.width = maxSize[0] * 4;
canvas.height = maxSize[1] * 4;
shouldBeTrue('gl.drawingBufferWidth > 0');
shouldBeTrue('gl.drawingBufferHeight > 0');
shouldBeTrue('gl.drawingBufferWidth <= maxSize[0]');
shouldBeTrue('gl.drawingBufferHeight <= maxSize[1]');
shouldBe('gl.getError()', 'gl.NO_ERROR');
debug("");
debug("Checking scaling up then back down to 50/50, drawing still works.");
canvas.width = 50;
canvas.height = 50;
shouldBeTrue('gl.drawingBufferWidth == 50');
shouldBeTrue('gl.drawingBufferHeight == 50');
shouldBe('gl.getError()', 'gl.NO_ERROR');
drawTriangleTest(gl);
shouldBe('gl.getError()', 'gl.NO_ERROR');
}
debug("")
successfullyParsed = true;
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -0,0 +1,148 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL Canvas Conformance Tests</title>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.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="x-shader/x-vertex">
attribute vec4 vPosition;
void main()
{
gl_Position = vPosition;
}
</script>
<script id="fshader" type="x-shader/x-fragment">
void main()
{
gl_FragColor = vec4(1.0,0.0,0.0,1.0);
}
</script>
<script>
function fail(x,y, buf, shouldBe)
{
var i = (y*50+x) * 4;
var reason = "pixel at ("+x+","+y+") is ("+buf[i]+","+buf[i+1]+","+buf[i+2]+","+buf[i+3]+"), should be "+shouldBe;
testFailed(reason);
}
function pass()
{
testPassed("drawing is correct");
}
function drawTriangleTest(gl)
{
gl.viewport(0, 0, 50, 50);
var vertexObject = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([ 0,0.5,0, -0.5,-0.5,0, 0.5,-0.5,0 ]), gl.STATIC_DRAW);
gl.enableVertexAttribArray(0);
gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
gl.drawArrays(gl.TRIANGLES, 0, 3);
var buf = new Uint8Array(50 * 50 * 4);
gl.readPixels(0, 0, 50, 50, gl.RGBA, gl.UNSIGNED_BYTE, buf);
// Test several locations
// First line should be all black
for (var i = 0; i < 50; ++i) {
if (buf[i*4] != 0 || buf[i*4+1] != 0 || buf[i*4+2] != 0 || buf[i*4+3] != 255) {
fail(i, 0, buf, "(0,0,0,255)");
return;
}
}
// Line 15 should be red for at least 10 red pixels starting 20 pixels in
var offset = (15*50+20) * 4;
for (var i = 0; i < 10; ++i) {
if (buf[offset+i*4] != 255 || buf[offset+i*4+1] != 0 || buf[offset+i*4+2] != 0 || buf[offset+i*4+3] != 255) {
fail(20 + i, 15, buf, "(255,0,0,255)");
return;
}
}
// Last line should be all black
offset = (49*50) * 4;
for (var i = 0; i < 50; ++i) {
if (buf[offset+i*4] != 0 || buf[offset+i*4+1] != 0 || buf[offset+i*4+2] != 0 || buf[offset+i*4+3] != 255) {
fail(i, 49, buf, "(0,0,0,255)");
return;
}
}
}
description("This test ensures WebGL implementations correctly implement drawingbufferWidth/Height.");
debug("");
var wtu = WebGLTestUtils;
var err;
var maxSize;
var canvas = document.createElement("canvas");
var gl = create3DContext(canvas);
if (!gl) {
testFailed("context does not exist");
} else {
testPassed("context exists");
gl.program = createProgram(gl, "vshader", "fshader", ["vPosition"]);
shouldBeNonNull(gl.program);
gl.useProgram(gl.program);
gl.enable(gl.DEPTH_TEST);
gl.disable(gl.BLEND);
gl.clearColor(0, 0, 0, 1);
gl.clearDepth(1);
shouldBe('gl.getError()', 'gl.NO_ERROR');
debug("");
debug("Checking drawingBufferWidth/drawingBufferHeight");
// Check that a canvas with no width or height is 300x150 pixels
shouldBe('gl.drawingBufferWidth', 'canvas.width');
shouldBe('gl.drawingBufferHeight', 'canvas.height');
// Check that changing the canvas size to something too large falls back to reasonable values.
maxSize = gl.getParameter(gl.MAX_VIEWPORT_DIMS);
shouldBeTrue('maxSize[0] > 0');
shouldBeTrue('maxSize[1] > 0');
// debug("MAX_VIEWPORT_DIMS = " + maxSize[0] + "x" + maxSize[1]);
canvas.width = maxSize[0] * 4;
canvas.height = maxSize[1] * 4;
shouldBeTrue('gl.drawingBufferWidth > 0');
shouldBeTrue('gl.drawingBufferHeight > 0');
shouldBeTrue('gl.drawingBufferWidth <= maxSize[0]');
shouldBeTrue('gl.drawingBufferHeight <= maxSize[1]');
shouldBe('gl.getError()', 'gl.NO_ERROR');
debug("");
debug("Checking scaling up then back down to 50/50, drawing still works.");
canvas.width = 50;
canvas.height = 50;
shouldBeTrue('gl.drawingBufferWidth == 50');
shouldBeTrue('gl.drawingBufferHeight == 50');
shouldBe('gl.getError()', 'gl.NO_ERROR');
drawTriangleTest(gl);
shouldBe('gl.getError()', 'gl.NO_ERROR');
}
debug("")
successfullyParsed = true;
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -6,9 +6,9 @@ found in the LICENSE file.
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
<script id="vshader" type="x-shader/x-vertex">
attribute vec3 g_Position;
@ -106,7 +106,7 @@ if (passed) {
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -0,0 +1,10 @@
constants.html
context-attributes-alpha-depth-stencil-antialias.html
context-lost-restored.html
context-lost.html
context-type-test.html
incorrect-context-object-behaviour.html
methods.html
premultiplyalpha-test.html
resource-sharing-test.html

View File

@ -8,10 +8,10 @@ Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<title>WebGL Constants Test</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/desktop-gl-constants.js" type="text/javascript"></script>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
@ -481,7 +481,7 @@ for (var i in gl) {
debug("");
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -7,9 +7,9 @@ found in the LICENSE file.
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
<script id="vshader" type="x-shader/x-vertex">
attribute vec3 pos;
attribute vec4 colorIn;

View File

@ -2,10 +2,10 @@
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<script src="resources/webgl-test-utils.js"></script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
<script src="../resources/webgl-test-utils.js"></script>
<script>
var wtu = WebGLTestUtils;
var canvas;
@ -167,7 +167,7 @@ function finish() {
if (window.nonKhronosFrameworkNotifyDone)
window.nonKhronosFrameworkNotifyDone();
};
epilogue.src = "../resources/js-test-post.js";
epilogue.src = "../../resources/js-test-post.js";
document.body.appendChild(epilogue);
}

View File

@ -2,10 +2,10 @@
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<script src="resources/webgl-test-utils.js"></script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
<script src="../resources/webgl-test-utils.js"></script>
<script>
var wtu;
var canvas;
@ -312,7 +312,7 @@ function finish() {
if (window.nonKhronosFrameworkNotifyDone)
window.nonKhronosFrameworkNotifyDone();
};
epilogue.src = "../resources/js-test-post.js";
epilogue.src = "../../resources/js-test-post.js";
document.body.appendChild(epilogue);
}
</script>

View File

@ -8,10 +8,10 @@ found in the LICENSE file.
<head>
<meta charset="utf-8">
<title>WebGL Canvas Conformance Tests</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/desktop-gl-constants.js" type="text/javascript"></script>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
@ -43,7 +43,7 @@ if (!gl) {
debug("");
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -26,9 +26,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
@ -78,6 +78,6 @@ shouldGenerateGLError(contextA, contextA.INVALID_OPERATION, "contextA.getUniform
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -8,10 +8,10 @@ Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<title>WebGL Methods Test</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/desktop-gl-constants.js" type="text/javascript"></script>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
</head>
<body>
<div id="description"></div>
@ -194,7 +194,7 @@ for (var i in gl) {
debug("");
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -8,10 +8,10 @@ found in the LICENSE file.
<head>
<meta charset="utf-8">
<title>Test the WebGL premultipledAlpha context creation flag.</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"> </script>
<script src="resources/webgl-test-utils.js"> </script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.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>
@ -26,7 +26,7 @@ var tests = [
sentColor: [32, 64, 128, 128],
expectedColor: [64, 128, 255, 128],
errorRange: 2,
useToDataURL: true,
imageFormat: "image/png"
},
// If premultipledAlpha is true then
// [texture] [canvas] [texture]
@ -35,7 +35,6 @@ var tests = [
sentColor: [32, 64, 128, 128],
expectedColor: [64, 128, 255, 128],
errorRange: 2,
useToDataURL: false,
},
// If premultipledAlpha is false then
// [texture] [canvas] [dataURL]
@ -44,7 +43,7 @@ var tests = [
sentColor: [255, 192, 128, 1],
expectedColor: [255, 192, 128, 1],
errorRange: 0,
useToDataURL: true,
imageFormat: "image/png"
},
// If premultipledAlpha is false then
// [texture] [canvas] [texture]
@ -53,7 +52,24 @@ var tests = [
sentColor: [255, 192, 128, 1],
expectedColor: [255, 192, 128, 1],
errorRange: 0,
useToDataURL: false,
},
// If premultipledAlpha is false then
// [texture] [canvas] [dataURL]
// 255, 255, 255, 128 -> 255, 255, 255, 128 -> 128, 128, 128, 255
{ creationAttributes: {premultipliedAlpha: false},
sentColor: [255, 255, 255, 128],
expectedColor: [128, 128, 128, 255],
errorRange: 2,
imageFormat: "image/jpeg"
},
// If premultipledAlpha is true then
// [texture] [canvas] [dataURL]
// 128, 128, 128, 128 -> 255, 255, 255, 128 -> 128, 128, 128, 255
{ creationAttributes: {},
sentColor: [128, 128, 128, 128],
expectedColor: [128, 128, 128, 255],
errorRange: 2,
imageFormat: "image/jpeg"
}
];
@ -68,12 +84,15 @@ function doNextTest() {
if (g_count < tests.length) {
var test = tests[g_count++];
canvas = document.createElement("canvas");
// Need to preserve drawing buffer to load it in a callback
test.creationAttributes.preserveDrawingBuffer = true;
gl = wtu.create3DContext(canvas, test.creationAttributes);
var premultipliedAlpha = test.creationAttributes.premultipliedAlpha != false;
debug("")
debug("testing: premultipliedAlpha: " + premultipliedAlpha + " toDataURL: " + test.useToDataURL);
debug("testing: premultipliedAlpha: " + premultipliedAlpha + " imageFormat: " + test.imageFormat);
shouldBe('gl.getContextAttributes().premultipledAlpha', 'premultipledAlpha');
shouldBeTrue('gl.getContextAttributes().preserveDrawingBuffer');
console.log(gl.getContextAttributes());
var program = wtu.setupTexturedQuad(gl);
@ -97,7 +116,7 @@ function doNextTest() {
// gl.pixelStorei(gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, false);
gl.pixelStorei(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, false);
gl.bindTexture(gl.TEXTURE_2D, pngTex);
if (test.useToDataURL) {
if (test.imageFormat) {
// create texture from image
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, this);
} else {
@ -118,13 +137,20 @@ function doNextTest() {
doNextTest();
}
if (test.useToDataURL) {
if (test.imageFormat) {
// Load canvas into string using toDataURL
var png = canvas.toDataURL();
// Load string into the texture
var input = document.createElement("img");
input.onload = loadTexture;
input.src = png;
var imageUrl = canvas.toDataURL(test.imageFormat);
if (test.imageFormat != "image/png" &&
(imageUrl.indexOf("data:image/png,") == 0 ||
imageUrl.indexOf("data:image/png;") == 0)) {
debug("Image format " + test.imageFormat + " not supported; skipping");
setTimeout(doNextTest, 0);
} else {
// Load string into the texture
var input = document.createElement("img");
input.onload = loadTexture;
input.src = imageUrl;
}
} else {
// Load canvas into the texture asynchronously (to prevent unbounded stack consumption)
setTimeout(loadTexture, 0);

View File

@ -8,9 +8,9 @@ found in the LICENSE file.
<head>
<meta charset="utf-8">
<title>WebGL Resource Sharing.</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"> </script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"> </script>
<script src="../../debug/webgl-debug.js"> </script>
</head>
<body>
@ -35,7 +35,7 @@ assertMsg(
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -1,61 +0,0 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL Canvas Conformance Tests</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.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>
<canvas id="canvas" style="width: 50px; height: 50px;"> </canvas>
<script>
description("This test ensures WebGL implementations correctly implement drawingbufferWidth/Height with compositing.");
debug("");
var wtu = WebGLTestUtils;
var err;
var maxSize;
var canvas = document.getElementById("canvas");
var gl = wtu.create3DContext(canvas);
if (!gl) {
testFailed("context does not exist");
} else {
testPassed("context exists");
debug("");
debug("Checking drawingBufferWidth/drawingBufferHeight");
// Check that a canvas with no width or height is 300x150 pixels
shouldBe('gl.drawingBufferWidth', 'canvas.width');
shouldBe('gl.drawingBufferHeight', 'canvas.height');
// Check that changing the canvas size to something too large falls back to reasonable values.
maxSize = gl.getParameter(gl.MAX_VIEWPORT_DIMS);
shouldBeTrue('maxSize[0] > 0');
shouldBeTrue('maxSize[1] > 0');
// debug("MAX_VIEWPORT_DIMS = " + maxSize[0] + "x" + maxSize[1]);
canvas.width = maxSize[0] * 4;
canvas.height = maxSize[1] * 4;
shouldBeTrue('gl.drawingBufferWidth > 0');
shouldBeTrue('gl.drawingBufferHeight > 0');
shouldBeTrue('gl.drawingBufferWidth <= maxSize[0]');
shouldBeTrue('gl.drawingBufferHeight <= maxSize[1]');
shouldBe('gl.getError()', 'gl.NO_ERROR');
}
debug("")
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -1,60 +0,0 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL Canvas Conformance Tests</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.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>
description("This test ensures WebGL implementations correctly implement drawingbufferWidth/Height.");
debug("");
var wtu = WebGLTestUtils;
var err;
var maxSize;
var canvas = document.createElement("canvas");
var gl = wtu.create3DContext(canvas);
if (!gl) {
testFailed("context does not exist");
} else {
testPassed("context exists");
debug("");
debug("Checking drawingBufferWidth/drawingBufferHeight");
// Check that a canvas with no width or height is 300x150 pixels
shouldBe('gl.drawingBufferWidth', 'canvas.width');
shouldBe('gl.drawingBufferHeight', 'canvas.height');
// Check that changing the canvas size to something too large falls back to reasonable values.
maxSize = gl.getParameter(gl.MAX_VIEWPORT_DIMS);
shouldBeTrue('maxSize[0] > 0');
shouldBeTrue('maxSize[1] > 0');
// debug("MAX_VIEWPORT_DIMS = " + maxSize[0] + "x" + maxSize[1]);
canvas.width = maxSize[0] * 4;
canvas.height = maxSize[1] * 4;
shouldBeTrue('gl.drawingBufferWidth > 0');
shouldBeTrue('gl.drawingBufferHeight > 0');
shouldBeTrue('gl.drawingBufferWidth <= maxSize[0]');
shouldBeTrue('gl.drawingBufferHeight <= maxSize[1]');
shouldBe('gl.getError()', 'gl.NO_ERROR');
}
debug("")
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -0,0 +1,6 @@
oes-standard-derivatives.html
oes-texture-float.html
oes-vertex-array-object.html
webgl-debug-renderer-info.html
webgl-debug-shaders.html

View File

@ -8,11 +8,11 @@ found in the LICENSE file.
<head>
<meta charset="utf-8">
<title>WebGL OES_standard_derivatives Conformance Tests</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/desktop-gl-constants.js" type="text/javascript"></script>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<script src="resources/webgl-test-utils.js"></script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
<script src="../resources/webgl-test-utils.js"></script>
</head>
<body>
<div id="description"></div>
@ -112,7 +112,8 @@ if (!gl) {
runHintTestEnabled();
runShaderTests(true);
runOutputTests();
runUniqueObjectTest();
// similar to bug 683216, see the discussion in bug 630672
// runUniqueObjectTest();
}
}
@ -369,7 +370,7 @@ function runUniqueObjectTest()
debug("");
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -8,11 +8,11 @@ found in the LICENSE file.
<head>
<meta charset="utf-8">
<title>WebGL OES_texture_float Conformance Tests</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/desktop-gl-constants.js" type="text/javascript"></script>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<script src="resources/webgl-test-utils.js"></script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
<script src="../resources/webgl-test-utils.js"></script>
</head>
<body>
<div id="description"></div>
@ -220,7 +220,7 @@ function runUniqueObjectTest()
debug("");
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -8,11 +8,15 @@ found in the LICENSE file.
<head>
<meta charset="utf-8">
<title>WebGL OES_vertex_array_object Conformance Tests</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/desktop-gl-constants.js" type="text/javascript"></script>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"></script>
<script src="resources/webgl-test-utils.js"></script>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
<script src="../resources/webgl-test-utils.js"></script>
<!-- comment in the script tag below to test through JS emualation of the extension. -->
<!--
<script src="../../../demos/google/resources/OESVertexArrayObject.js"></script>
-->
</head>
<body>
<div id="description"></div>
@ -36,6 +40,12 @@ if (!gl) {
} else {
testPassed("WebGL context exists");
// Setup emulated OESVertexArrayObject if it has been included.
if (window.setupVertexArrayObject) {
debug("using emuated OES_vertex_array_object");
setupVertexArrayObject(gl);
}
// Run tests with extension disabled
runBindingTestDisabled();
@ -115,9 +125,12 @@ function runBindingTestEnabled() {
} else {
testFailed("gl.getParameter(ext.VERTEX_ARRAY_BINDING_OES) is not expected VAO")
}
ext.deleteVertexArrayOES(vao1);
shouldBeNull("gl.getParameter(ext.VERTEX_ARRAY_BINDING_OES)");
ext.bindVertexArrayOES(vao1);
glErrorShouldBe(gl, gl.INVALID_OPERATION, "binding a deleted vertex array object");
ext.bindVertexArrayOES(null);
shouldBeNull("gl.getParameter(ext.VERTEX_ARRAY_BINDING_OES)");
ext.deleteVertexArrayOES(vao0);
ext.deleteVertexArrayOES(vao1);
}
@ -391,7 +404,7 @@ function runDrawTests() {
debug("");
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -0,0 +1,105 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL WebGL_debug_renderer_info Conformance Tests</title>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
<script src="../resources/webgl-test-utils.js"></script>
</head>
<body>
<div id="description"></div>
<canvas id="canvas" style="width: 1px; height: 1px;"> </canvas>
<div id="console"></div>
<!-- Shaders for testing standard derivatives -->
<script>
description("This test verifies the functionality of the WEBGL_debug_renderer_info extension, if it is available.");
debug("");
var wtu = WebGLTestUtils;
var canvas = document.getElementById("canvas");
var gl = create3DContext(canvas);
var ext = null;
var vao = null;
if (!gl) {
testFailed("WebGL context does not exist");
} else {
testPassed("WebGL context exists");
// Run tests with extension disabled
runTestDisabled();
// Query the extension and store globally so shouldBe can access it
ext = gl.getExtension("WEBGL_debug_renderer_info");
if (!ext) {
testPassed("No WEBGL_debug_renderer_info support -- this is legal");
runSupportedTest(false);
} else {
testPassed("Successfully enabled WEBGL_debug_renderer_info extension");
runSupportedTest(true);
runTestEnabled();
}
}
function runSupportedTest(extensionEnabled) {
var supported = gl.getSupportedExtensions();
if (supported.indexOf("WEBGL_debug_renderer_info") >= 0) {
if (extensionEnabled) {
testPassed("WEBGL_debug_renderer_info listed as supported and getExtension succeeded");
} else {
testFailed("WEBGL_debug_renderer_info listed as supported but getExtension failed");
}
} else {
if (extensionEnabled) {
testFailed("WEBGL_debug_renderer_info not listed as supported but getExtension succeeded");
} else {
testPassed("WEBGL_debug_renderer_info not listed as supported and getExtension failed -- this is legal");
}
}
}
function runTestDisabled() {
debug("Testing enums with extension disabled");
// Use the constants directly as we don't have the extension
var UNMASKED_VENDOR_WEBGL = 0x9245;
gl.getParameter(UNMASKED_VENDOR_WEBGL);
glErrorShouldBe(gl, gl.INVALID_ENUM, "UNMASKED_VENDOR_WEBGL should not be queryable if extension is disabled");
var UNMASKED_RENDERER_WEBGL = 0x9246;
gl.getParameter(UNMASKED_RENDERER_WEBGL);
glErrorShouldBe(gl, gl.INVALID_ENUM, "UNMASKED_RENDERER_WEBGL should not be queryable if extension is disabled");
}
function runTestEnabled() {
debug("Testing enums with extension enabled");
shouldBe("ext.UNMASKED_VENDOR_WEBGL", "0x9245");
gl.getParameter(ext.UNMASKED_VENDOR_WEBGL);
glErrorShouldBe(gl, gl.NO_ERROR, "UNMASKED_VENDOR_WEBGL query should succeed if extension is enable");
shouldBe("ext.UNMASKED_RENDERER_WEBGL", "0x9246");
gl.getParameter(ext.UNMASKED_RENDERER_WEBGL);
glErrorShouldBe(gl, gl.NO_ERROR, "UNMASKED_RENDERER_WEBGL query should succeed if extension is enable");
}
debug("");
successfullyParsed = true;
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -0,0 +1,98 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL WebGL_debug_shaders Conformance Tests</title>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/desktop-gl-constants.js" type="text/javascript"></script>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"></script>
<script src="../resources/webgl-test-utils.js"></script>
</head>
<body>
<div id="description"></div>
<canvas id="canvas" style="width: 1px; height: 1px;"> </canvas>
<div id="console"></div>
<!-- Shaders for testing standard derivatives -->
<script>
description("This test verifies the functionality of the WEBGL_debug_shaders extension, if it is available.");
debug("");
var wtu = WebGLTestUtils;
var canvas = document.getElementById("canvas");
var gl = create3DContext(canvas);
var ext = null;
var shader = null;
if (!gl) {
testFailed("WebGL context does not exist");
} else {
testPassed("WebGL context exists");
// Query the extension and store globally so shouldBe can access it
ext = gl.getExtension("WEBGL_debug_shaders");
if (!ext) {
testPassed("No WEBGL_debug_shaders support -- this is legal");
runSupportedTest(false);
} else {
testPassed("Successfully enabled WEBGL_debug_shaders extension");
runSupportedTest(true);
runTestEnabled();
}
}
function runSupportedTest(extensionEnabled) {
var supported = gl.getSupportedExtensions();
if (supported.indexOf("WEBGL_debug_shaders") >= 0) {
if (extensionEnabled) {
testPassed("WEBGL_debug_shaders listed as supported and getExtension succeeded");
} else {
testFailed("WEBGL_debug_shaders listed as supported but getExtension failed");
}
} else {
if (extensionEnabled) {
testFailed("WEBGL_debug_shaders not listed as supported but getExtension succeeded");
} else {
testPassed("WEBGL_debug_shaders not listed as supported and getExtension failed -- this is legal");
}
}
}
function runTestEnabled() {
debug("Testing function with extension enabled");
var source = "void main() { gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0); }";
shader = gl.createShader(gl.FRAGMENT_SHADER);
// if no source has been defined or compileShader() has not been called,
// getTranslatedShaderSource() should return an empty string.
shouldBeNull("ext.getTranslatedShaderSource(shader)");
gl.shaderSource(shader, source);
shouldBeNull("ext.getTranslatedShaderSource(shader)");
gl.compileShader(shader);
shouldBeTrue("gl.getShaderParameter(shader, gl.COMPILE_STATUS)");
var translatedSource = ext.getTranslatedShaderSource(shader);
glErrorShouldBe(gl, gl.NO_ERROR, "No gl error should occur");
if (translatedSource.length > 0)
testPassed("Successfully called getTranslatedShaderSource()");
else
testFailed("Calling getTranslatedShaderSource() failed");
}
debug("");
successfullyParsed = true;
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -1,947 +0,0 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL GLSL Conformance Tests</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/desktop-gl-constants.js" type="text/javascript"></script>
<script src="../resources/js-test-pre.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="fshaderWithUndefinedPreprocessorSymbol" type="text/something-not-javascript">
#if UNDEFINED_FOO
// according to ES GLSL spec 3.4 undefined symbols should fail.
#else
precision mediump float;
void main()
{
gl_FragColor = vec4(0.0,0.0,0.0,1.0);
}
#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()
{
mediump 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="vshaderWithLineDirective" type="text/something-not-javascript">
#line 123
foo
</script>
<script id="vshaderWith__FILE__" type="text/something-not-javascript">
__FILE__
</script>
<script id="vshaderWithIncludeDirective" type="text/something-not-javascript">
// Sadly I can not force the current path so this could fail beacuse include.vs
// does not exist, not because #include is disallowed.
#include "include.vs"
attribute vec4 vPosition;
void main()
{
gl_Position = vPosition;
}
</script>
<script id="fshaderWithdFdx" type="text/something-not-javascript">
#extension GL_OES_standard_derivatives:enable
precision mediump float;
void main()
{
gl_FragColor = vec4(dFdx(0.5),0.0,0.0,1.0);
}
</script>
<script id="fshaderWithdFdxNoExt" type="text/something-not-javascript">
precision mediump float;
void main()
{
gl_FragColor = vec4(dFdx(0.5),0.0,0.0,1.0);
}
</script>
<script id="fshaderWith256CharacterIdentifier" type="text/something-not-javascript">
precision mediump float;
uniform float a123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345;
void main()
{
gl_FragColor = vec4(a123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345,0.0,0.0,1.0);
}
</script>
<script id="fshaderWith257CharacterIdentifier" type="text/something-not-javascript">
precision mediump float;
uniform float a1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456;
void main()
{
gl_FragColor = vec4(a1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456,0.0,0.0,1.0);
}
</script>
<script id="fshaderWithLongLine" type="text/something-not-javascript">
precision mediump float;
uniform float fooo;
#if defined(someSymbolNotDefined)
#error long
#endif
void main()
{
gl_FragColor = vec4(fooo+fooo+fooo+fooo, fooo+fooo+fooo+fooo, fooo+fooo+fooo+fooo, 1.0);
}
</script>
<script id="fshaderWithErrorDirective" type="text/something-not-javascript">
#error testing123 testing123
void main()
{
gl_FragColor = vec4(0,0,0,0);
}
</script>
<script id="fshaderWithQuotedErrorDirective" type="text/something-not-javascript">
#error "testing123 testing123" // will return INVALID_VALUE. See WebGL 6.18
void main()
{
gl_FragColor = vec4(0,0,0,0);
}
</script>
<script id="fshaderWithNonASCIIErrorDirective" type="text/something-not-javascript">
#error これはASCIIではない // will return INVALID_VALUE. See WebGL 6.18
void main()
{
gl_FragColor = vec4(0,0,0,0);
}
</script>
<script id="fshaderWithFunctionRecursion" type="text/something-not-javascript">
void a();
void b();
void main()
{
a();
}
void a()
{
b();
}
void b()
{
a();
}
</script>
<script id="fshaderWithIntReturnValue" type="text/something-not-javascript">
int functionResult();
void main()
{
int r = functionResult();
gl_FragColor = vec4(r, r, r, r);
}
int functionResult()
{
return 1;
}
</script>
<script id="fshaderWithIVec2ReturnValue" type="text/something-not-javascript">
ivec2 functionResult();
void main()
{
ivec2 r = functionResult();
gl_FragColor = vec4(r.x, r.y, r.x, r.y);
}
ivec2 functionResult()
{
return ivec2(1, 1);
}
</script>
<script id="fshaderWithIVec3ReturnValue" type="text/something-not-javascript">
ivec3 functionResult();
void main()
{
ivec3 r = functionResult();
gl_FragColor = vec4(r.x, r.y, r.z, r.x);
}
ivec3 functionResult()
{
return ivec3(1, 1, 1);
}
</script>
<script id="fshaderWithIVec4ReturnValue" type="text/something-not-javascript">
ivec4 functionResult();
void main()
{
ivec4 r = functionResult();
gl_FragColor = vec4(r.x, r.y, r.z, r.w);
}
ivec4 functionResult()
{
return ivec4(1, 1, 1, 1);
}
</script>
<script id="fshaderWithFloatReturnValue" type="text/something-not-javascript">
precision mediump float;
float functionResult();
void main()
{
float r = functionResult();
gl_FragColor = vec4(r, r, r, r);
}
float functionResult()
{
return 1.0;
}
</script>
<script id="fshaderWithVec2ReturnValue" type="text/something-not-javascript">
precision mediump float;
vec2 functionResult();
void main()
{
vec2 r = functionResult();
gl_FragColor = vec4(r.x, r.y, r.x, r.y);
}
vec2 functionResult()
{
return vec2(1.0, 1.0);
}
</script>
<script id="fshaderWithVec3ReturnValue" type="text/something-not-javascript">
precision mediump float;
vec3 functionResult();
void main()
{
vec3 r = functionResult();
gl_FragColor = vec4(r.x, r.y, r.z, r.x);
}
vec3 functionResult()
{
return vec3(1.0, 1.0, 1.0);
}
</script>
<script id="fshaderWithVec4ReturnValue" type="text/something-not-javascript">
precision mediump float;
vec4 functionResult();
void main()
{
vec4 r = functionResult();
gl_FragColor = vec4(r.x, r.y, r.z, r.w);
}
vec4 functionResult()
{
return vec4(1.0, 1.0, 1.0, 1.0);
}
</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");
var wtu = WebGLTestUtils;
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: 'fshaderWithUndefinedPreprocessorSymbol',
fShaderSuccess: false,
linkSuccess: false,
passMsg: 'fragment shader undefined preprocessor symbol should fail (3.4)',
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithFragDepth',
fShaderSuccess: false,
linkSuccess: false,
passMsg: 'fragment shader that uses gl_FragDepth should fail',
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithdFdx',
fShaderSuccess: false,
linkSuccess: false,
passMsg: 'fragment shader that uses dFdx should fail',
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithdFdxNoExt',
fShaderSuccess: false,
linkSuccess: false,
passMsg: 'fragment shader that uses dFdx without #extension 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',
},
{ vShaderId: 'vshaderWithLineDirective',
vShaderSuccess: false,
vShaderTest: (function() { return wtu.getLastError().indexOf("124") >= 0; }),
fShaderId: 'fshader',
fShaderSuccess: true,
linkSuccess: false,
passMsg: 'vertex shader uses #line directive should report correct line',
},
{ vShaderId: 'vshaderWithIncludeDirective',
vShaderSuccess: false,
fShaderId: 'fshader',
fShaderSuccess: true,
linkSuccess: false,
passMsg: 'vertex shader uses #include should fail',
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWith257CharacterIdentifier',
fShaderSuccess: false,
linkSuccess: false,
passMsg: 'shader that uses 257 character identifier should fail',
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWith256CharacterIdentifier',
fShaderSuccess: true,
linkSuccess: true,
passMsg: 'shader that uses 256 character identifier should succeed',
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithLongLine',
fShaderSuccess: true,
fShaderPrep: function(str) {
function expand(str, re, replacement, count) {
for (var ii = 0; ii < count; ++ii) {
str = str.replace(re, replacement);
}
return str;
}
str = expand(str, new RegExp(" ", 'g'), " ", 12);
var manyZeros = expand("0", new RegExp("0", 'g'), "00", 8).substring(2);
str = expand(str, new RegExp("0", 'g'), manyZeros, 1);
str = expand(str, new RegExp("fooo", 'g'), "fooofooo", 6);
str = expand(str, new RegExp("long", 'g'), "longlong", 6);
//debug("len:" + str.length);
//debug(str);
return str;
},
linkSuccess: true,
passMsg: 'shader that uses long lines should succeed',
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithErrorDirective',
fShaderSuccess: false,
fShaderTest: (function() {
return wtu.getLastError().indexOf("testing123 testing123") >= 0; }),
linkSuccess: false,
passMsg: "error directive returns error user's error message",
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithQuotedErrorDirective',
fShaderSuccess: false,
linkSuccess: false,
passMsg: "error directive using quotes fails",
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithNonASCIIErrorDirective',
fShaderSuccess: false,
linkSuccess: false,
passMsg: "error directive using characters outside of allowed set fails",
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithFunctionRecursion',
fShaderSuccess: false,
linkSuccess: false,
passMsg: "Shaders with recursive function calls should fail",
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithIntReturnValue',
fShaderSuccess: true,
linkSuccess: true,
passMsg: "Shader with int return value from function call should succeed",
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithIVec2ReturnValue',
fShaderSuccess: true,
linkSuccess: true,
passMsg: "Shader with ivec2 return value from function call should succeed",
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithIVec3ReturnValue',
fShaderSuccess: true,
linkSuccess: true,
passMsg: "Shader with ivec3 return value from function call should succeed",
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithIVec4ReturnValue',
fShaderSuccess: true,
linkSuccess: true,
passMsg: "Shader with ivec4 return value from function call should succeed",
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithFloatReturnValue',
fShaderSuccess: true,
linkSuccess: true,
passMsg: "Shader with float return value from function call should succeed",
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithVec2ReturnValue',
fShaderSuccess: true,
linkSuccess: true,
passMsg: "Shader with vec2 return value from function call should succeed",
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithVec3ReturnValue',
fShaderSuccess: true,
linkSuccess: true,
passMsg: "Shader with vec3 return value from function call should succeed",
},
{ vShaderId: 'vshader',
vShaderSuccess: true,
fShaderId: 'fshaderWithVec4ReturnValue',
fShaderSuccess: true,
linkSuccess: true,
passMsg: "Shader with vec4 return value from function call 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;
function addExternalShaders(filename, passMsg) {
var lines = wtu.readFileList(filename);
for (var ii = 0; ii < lines.length; ++ii) {
var info = {
vShaderId: 'vshader',
vShaderSource: simpleVertShader,
vShaderSuccess: true,
fShaderId: 'fshader',
fShaderSource: simpleFragShader,
fShaderSuccess: true,
linkSuccess: true,
};
var line = lines[ii];
var files = line.split(/ +/);
var passMsg = "";
for (var jj = 0; jj < files.length; ++jj) {
var file = files[jj];
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 + ":" + firstLine);
continue;
}
if (!wtu.startsWith(firstLine, "// ")) {
testFailed("bad first line in " + file + ":" + firstLine);
continue;
}
passMsg = passMsg + (passMsg.length ? ", " : "") + firstLine.substr(3);
if (wtu.endsWith(file, ".vert")) {
info.vShaderId = file;
info.vShaderSource = shaderSource;
info.vShaderSuccess = success;
} else if (wtu.endsWith(file, ".frag")) {
info.fShaderId = file;
info.fShaderSource = shaderSource;
info.fShaderSuccess = success;
}
}
info.linkSuccess = info.vShaderSuccess && info.fShaderSuccess;
info.passMsg = passMsg;
shaderInfo.push(info);
}
}
addExternalShaders('shaders/00_shaders.txt');
var vShaderDB = { };
var fShaderDB = { };
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 vSource = info.vShaderPrep ? info.vShaderPrep(info.vShaderSource) :
info.vShaderSource;
// Reuse identical shaders so we test shared shader.
var vShader = vShaderDB[vSource];
if (!vShader) {
vShader = wtu.loadShader(gl, vSource, gl.VERTEX_SHADER);
if (info.vShaderTest) {
if (!info.vShaderTest(vShader)) {
testFailed(passMsg);
continue;
}
}
if ((vShader != null) != info.vShaderSuccess) {
testFailed(passMsg);
continue;
}
// Save the shaders so we test shared shader.
if (vShader) {
vShaderDB[vSource] = vShader;
}
}
var fSource = info.fShaderPrep ? info.fShaderPrep(info.fShaderSource) :
info.fShaderSource;
// Reuse identical shaders so we test shared shader.
var fShader = fShaderDB[fSource];
if (!fShader) {
fShader = wtu.loadShader(gl, fSource, gl.FRAGMENT_SHADER);
if (info.fShaderTest) {
if (!info.fShaderTest(fShader)) {
testFailed(passMsg);
continue;
}
}
//debug(fShader == null ? "fail" : "succeed");
if ((fShader != null) != info.fShaderSuccess) {
testFailed(passMsg);
continue;
}
// Safe the shaders so we test shared shader.
if (fShader) {
fShaderDB[fSource] = fShader;
}
}
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(program);
log("*** Error linking program '"+program+"':"+error);
}
if (linked != info.linkSuccess) {
testFailed(passMsg);
continue;
}
} else {
if (info.linkSuccess) {
testFailed(passMsg);
continue;
}
}
testPassed(passMsg);
}
}
debug("");
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -1,234 +0,0 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
Note: To use this sample pass arguments through the URL.
Arguments:
feature: name of the feature being testing
res: number of subdivisions in quad. default: 2
refvs: relative url to reference vertex shader
default shaders/glsl-features/base.vert
reffs: relative url to reference fragment shader
default shaders/glsl-features/base.frag
testvs: relative url to test vertex shader
default shaders/glsl-features/base.vert
testfs: relative url to test fragment shader
default shaders/glsl-features/base.frag
Example:
glsl-feature.html?feature=abs&refvs=shader/abs-ref.vert&testvs=shader/abs-test.vert
The idea is to provide 2 shaders that should generate the same image. One shader
uses the actual feature you want to test. Another emluates that feature to
provide a reference image.
For example, a test of abs would use "abs" in the test and "v < 0 ? -v : v" in
the reference.
Both shaders are passed a unit square that covers the entire canvas and
texcoords that go from 0.0 to 1.0 over the canvas. A vColor value is also passed
from the vertex shader to the fragment shader to give the vertex shader
a chance to generate something.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL feature Test</title>
<link rel="stylesheet" href="../resources/js-test-style.css"/>
<script src="../resources/js-test-pre.js"></script>
<script src="resources/webgl-test.js"> </script>
<script src="resources/webgl-test-utils.js"> </script>
<style>
canvas {
background-color: white;
background-image: linear-gradient(0, rgba(200, 200, 200, .5) 50%, transparent 50%), linear-gradient(rgba(200, 200, 200, .5) 50%, transparent 50%);
background-size: 8px 8px;
}
</style>
</head>
<body>
<table>
<tr><td>ref</td><td>test</td><td>diff</td></tr>
<tr>
<td><canvas id="canvas1" width="32" height="32"></canvas></td>
<td><canvas id="canvas2" width="32" height="32"></canvas></td>
<td><canvas id="diff" width="32" height="32"></canvas></td>
</tr>
</table>
<div id="description"></div>
<div id="console"></div>
<script>
function init()
{
if (window.initNonKhronosFramework) {
window.initNonKhronosFramework(false);
}
wtu = WebGLTestUtils;
var args = wtu.getUrlArguments();
var feature = args.feature || "**unset**";
var refVS = args.refvs || "shaders/glsl-features/base.vert";
var refFS = args.reffs || "shaders/glsl-features/base.frag";
var testVS = args.testvs || "shaders/glsl-features/base.vert";
var testFS = args.testfs || "shaders/glsl-features/base.frag";
var gridRes = args.res ? parseInt(args.res) : 2;
description("Testing GLSL feature: " + feature);
debug("");
debug("using reference shaders:");
debug(" " + makeLink(refVS));
debug(" " + makeLink(refFS));
debug("");
debug("using test shaders:");
debug(" " + makeLink(testVS));
debug(" " + makeLink(testFS));
debug("");
function makeLink(url) {
return '<a target="_blank" href="' + url + '">' + url + '</a>';
}
var canvas1 = document.getElementById("canvas1");
var canvas2 = document.getElementById("canvas2");
var diff = document.getElementById("diff");
var width = canvas1.width;
var height = canvas1.height;
function draw(canvas, vsURL, fsURL) {
var gl = wtu.create3DContext(canvas);
if (!gl) {
testFailed("context does not exist");
return;
}
var program = wtu.loadProgramFromFile(gl, vsURL, fsURL);
var posLoc = gl.getAttribLocation(program, "aPosition");
var refLoc = gl.getAttribLocation(program, "aTexcoord");
setupQuad(gl, posLoc, refLoc);
gl.useProgram(program);
gl.clearColor(0, 0, 1, 1);
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
gl.drawElements(gl.TRIANGLES, gridRes * gridRes * 6, gl.UNSIGNED_SHORT, 0);
wtu.glErrorShouldBe(gl, gl.NO_ERROR, "no errors from draw");
var img = new Uint8Array(width * height * 4);
gl.readPixels(0, 0, width, height, gl.RGBA, gl.UNSIGNED_BYTE, img);
return img;
}
function setupQuad(gl, positionLocation, texcoordLocation) {
var objects = [];
var vertsAcross = gridRes + 1;
var numVerts = vertsAcross * vertsAcross;
var positions = new Float32Array(numVerts * 3);
var texcoords = new Float32Array(numVerts * 2);
var indices = new Uint16Array(6 * gridRes * gridRes);
var poffset = 0;
var toffset = 0;
for (var yy = 0; yy <= gridRes; ++yy) {
for (var xx = 0; xx <= gridRes; ++xx) {
positions[poffset + 0] = -1 + 2 * xx / gridRes;
positions[poffset + 1] = -1 + 2 * yy / gridRes;
positions[poffset + 2] = 0;
texcoords[toffset + 0] = xx / gridRes;
texcoords[toffset + 1] = yy / gridRes;
poffset += 3;
toffset += 2;
}
}
var tbase = 0;
for (var yy = 0; yy < gridRes; ++yy) {
var index = yy * vertsAcross;
for (var xx = 0; xx < gridRes; ++xx) {
indices[tbase + 0] = index + 0;
indices[tbase + 1] = index + 1;
indices[tbase + 2] = index + vertsAcross;
indices[tbase + 3] = index + vertsAcross;
indices[tbase + 4] = index + 1;
indices[tbase + 5] = index + vertsAcross + 1;
index += 1;
tbase += 6;
}
}
var buf = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, buf);
gl.bufferData(gl.ARRAY_BUFFER, positions, gl.STATIC_DRAW);
gl.enableVertexAttribArray(positionLocation);
gl.vertexAttribPointer(positionLocation, 3, gl.FLOAT, false, 0, 0);
objects.push(buf);
var buf = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, buf);
gl.bufferData(gl.ARRAY_BUFFER, texcoords, gl.STATIC_DRAW);
gl.enableVertexAttribArray(texcoordLocation);
gl.vertexAttribPointer(texcoordLocation, 2, gl.FLOAT, false, 0, 0);
objects.push(buf);
var buf = gl.createBuffer();
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, buf);
gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, indices, gl.STATIC_DRAW);
objects.push(buf);
return objects;
}
var refImage = draw(canvas1, refVS, refFS);
var testImage = draw(canvas2, testVS, testFS);
var ctx = diff.getContext("2d");
var imgData = ctx.getImageData(0, 0, width, height);
var same = true;
for (var yy = 0; yy < height; ++yy) {
for (var xx = 0; xx < width; ++xx) {
var offset = (yy * width + xx) * 4;
var imgOffset = ((height - yy - 1) * width + xx) * 4;
imgData.data[imgOffset + 0] = 0;
imgData.data[imgOffset + 1] = 0;
imgData.data[imgOffset + 2] = 0;
imgData.data[imgOffset + 3] = 255;
if (refImage[offset + 0] != testImage[offset + 0] ||
refImage[offset + 1] != testImage[offset + 1] ||
refImage[offset + 2] != testImage[offset + 2] ||
refImage[offset + 3] != testImage[offset + 3]) {
imgData.data[imgOffset] = 255;
same = false;
}
}
}
if (!same) {
ctx.putImageData(imgData, 0, 0);
testFailed("images are different");
} else {
testPassed("images are the same");
}
}
init();
successfullyParsed = true;
</script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>

View File

@ -0,0 +1,6 @@
functions/00_test_list.txt
implicit/00_test_list.txt
misc/00_test_list.txt
reserved/00_test_list.txt
variables/00_test_list.txt

View File

@ -0,0 +1,36 @@
glsl-function.html
glsl-function-abs.html
glsl-function-acos.html
glsl-function-asin.html
glsl-function-atan.html
glsl-function-atan-xy.html
glsl-function-ceil.html
glsl-function-clamp-float.html
glsl-function-clamp-gentype.html
glsl-function-cos.html
glsl-function-cross.html
glsl-function-distance.html
glsl-function-dot.html
glsl-function-faceforward.html
glsl-function-floor.html
glsl-function-fract.html
glsl-function-length.html
#glsl-function-lessThan.html
glsl-function-max-float.html
glsl-function-max-gentype.html
glsl-function-min-float.html
glsl-function-min-gentype.html
glsl-function-mix-float.html
glsl-function-mix-gentype.html
glsl-function-mod-float.html
glsl-function-mod-gentype.html
glsl-function-normalize.html
glsl-function-reflect.html
#glsl-function-refract.html
glsl-function-sign.html
glsl-function-sin.html
glsl-function-step-float.html
glsl-function-step-gentype.html
glsl-function-smoothstep-float.html
glsl-function-smoothstep-gentype.html

View File

@ -0,0 +1,44 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL abs function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "abs",
testFunc: "$(func)($(arg0))",
emuFunc: ["float $(func)_base(float value) {",
" return value >= 0.0 ? value : -value;",
"}"].join("\n"),
gridRes: 4,
tests: [
["$(output) = vec4(",
" $(func)($(input).x * 2.0 - 1.0),",
" 0.5,",
" 0,",
" 1);"].join("\n"),
"$(output) = vec4(0, $(func)($(input).xy * 2.0 - vec2(1, 1)), 1);",
"$(output) = vec4($(func)($(input).xyz * 2.0 - vec3(1, 1, 1)), 1);",
"$(output) = $(func)($(input) * 2.0 - vec4(1, 1, 1, 1));"
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,73 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL acos function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
var piConstants = [
"const float kPI = 3.14159265358979323846;",
"const float kHalfPI = (kPI * 0.5);",
"const float k2PI = (kPI * 2.0);"
].join("\n");
var asinImplementation = [
"float asin_impl(float v) {",
" return v + (1.0 / 2.0) * pow(v, 3.0) / 3.0 +",
" ((1.0 * 3.0) / (2.0 * 4.0)) * pow(v, 5.0) / 5.0 +",
" ((1.0 * 3.0 * 5.0) / (2.0 * 4.0 * 6.0)) * pow(v, 7.0) / 7.0 +",
" ((1.0 * 3.0 * 5.0 * 7.0) / (2.0 * 4.0 * 6.0 * 8.0)) * pow(v, 9.0) / 9.0;",
"}"
].join("\n");
GLSLGenerator.runFeatureTest({
feature: "acos",
args: "$(type) value",
baseArgs: "value$(field)",
testFunc: "$(func)($(type))",
emuFunc: [
asinImplementation,
"float $(func)_base(float value) {",
" return kHalfPI - asin_impl(value);",
"}"
].join("\n"),
gridRes: 8,
tolerance: 8,
extra: piConstants,
tests: [
["$(output) = vec4(",
" $(func)($(input).x * 0.8) / kPI,",
" $(func)($(input).y * 0.8) / kPI,",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xy * 0.8) / kPI,",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xyz * 0.8) / kPI,",
" 1);"].join("\n"),
["$(output) = ",
" $(func)($(input) * 0.8) / kPI;",
].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,73 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL asin function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
var piConstants = [
"const float kPI = 3.14159265358979323846;",
"const float kHalfPI = (kPI * 0.5);",
"const float k2PI = (kPI * 2.0);"
].join("\n");
var asinImplementation = [
"float asin_impl(float v) {",
" return v + (1.0 / 2.0) * pow(v, 3.0) / 3.0 +",
" ((1.0 * 3.0) / (2.0 * 4.0)) * pow(v, 5.0) / 5.0 +",
" ((1.0 * 3.0 * 5.0) / (2.0 * 4.0 * 6.0)) * pow(v, 7.0) / 7.0 +",
" ((1.0 * 3.0 * 5.0 * 7.0) / (2.0 * 4.0 * 6.0 * 8.0)) * pow(v, 9.0) / 9.0;",
"}"
].join("\n");
GLSLGenerator.runFeatureTest({
feature: "asin",
args: "$(type) value",
baseArgs: "value$(field)",
testFunc: "$(func)($(type))",
emuFunc: [
asinImplementation,
"float $(func)_base(float value) {",
" return asin_impl(value);",
"}"
].join("\n"),
gridRes: 8,
tolerance: 2,
extra: piConstants,
tests: [
["$(output) = vec4(",
" $(func)($(input).x * 0.8) / kPI + 0.5,",
" $(func)($(input).y * 0.8) / kPI + 0.5,",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xy * 0.8) / kPI + 0.5,",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xyz * 0.8) / kPI + 0.5,",
" 1);"].join("\n"),
["$(output) = ",
" $(func)($(input) * 0.8) / kPI + 0.5;",
].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,104 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL atan-xy function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
var piConstants = [
"const float kPI = 3.14159265358979323846;",
"const float kHalfPI = (kPI * 0.5);",
"const float k2PI = (kPI * 2.0);"
].join("\n");
var atanImplementation = [
"const float kEpsilon = 0.0001;",
"",
"float atan_impl(float y, float x) {",
" float atan_value = 0.0;",
" float scale = 1.0;",
" float sign = 1.0;",
"",
" if (x > kEpsilon || abs(y) > kEpsilon) {",
" if (x < 0.0 ^^ y < 0.0) {",
" sign = -1.0;",
" }",
"",
" bool y_gt_x = abs(y) < abs(x);",
" float value = y_gt_x ? abs(y / x) : abs(x / y);",
"",
" // Use Taylors series expansion for atan",
" for(int ii = 1; ii < 8; ii += 2) {",
" atan_value += scale * pow(value, float(ii)) / float(ii);",
" scale = -scale;",
" }",
"",
" atan_value = (y_gt_x) ? sign * atan_value : sign * (kHalfPI - atan_value);",
" }",
"",
" if (x < 0.0) {",
" if (y < 0.0) {",
" atan_value -= kHalfPI;",
" } else if (y > 0.0) {",
" atan_value += kHalfPI;",
" }",
" }",
"",
" return atan_value;",
"}"
].join("\n");
GLSLGenerator.runFeatureTest({
feature: "atan",
args: "$(type) y, $(type) x",
baseArgs: "y$(field), x$(field)",
testFunc: "$(func)($(type), $(type))",
emuFunc: [
atanImplementation,
"float $(func)_base(float y, float x) {",
" return atan_impl(y, x);",
"}"
].join("\n"),
gridRes: 8,
tolerance: 4,
extra: piConstants,
tests: [
["$(output) = vec4(",
" $(func)($(input).x + 0.1, $(input).y) / k2PI + 0.5,",
" 0,",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xy + vec2(0.1, 0.1), $(input).yx) / ",
" k2PI + vec2(0.5, 0.5),",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xyz + vec3(0.1, 0.1, 0.1), $(input).yzx) / ",
" k2PI + vec3(0.5, 0.5, 0.5),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)($(input) + vec4(0.1, 0.1, 0.1, 0.1), $(input).wzyx) / ",
" k2PI + vec4(0.5, 0.5, 0.5, 0.5);",
].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,88 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL atan function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
var piConstants = [
"const float kPI = 3.14159265358979323846;",
"const float kHalfPI = (kPI * 0.5);",
"const float k2PI = (kPI * 2.0);"
].join("\n");
var atanImplementation = [
"float atan_impl(float value) {",
" float atan_value = 0.0;",
" float scale = 1.0;",
" float sign = 1.0;",
"",
" if (value < 0.0) {",
" sign = -1.0;",
" value = -value;",
" }",
"",
" bool value_le_1 = value <= 1.0;",
" value = value_le_1 ? value : 1.0 / value;",
"",
" // Use Taylors series expansion for atan",
" for(int ii = 1; ii < 8; ii += 2) {",
" atan_value += scale * pow(value, float(ii)) / float(ii);",
" scale = -scale;",
" }",
"",
" return value_le_1 ? sign * atan_value : sign * (kHalfPI - atan_value);",
"}",
].join("\n");
GLSLGenerator.runFeatureTest({
feature: "atan",
args: "$(type) value",
baseArgs: "value$(field)",
testFunc: "$(func)($(type))",
emuFunc: [
atanImplementation,
"",
"#define $(func)_base(value) atan_impl(value)"
].join("\n"),
gridRes: 8,
tolerance: 4,
extra: piConstants,
tests: [
["$(output) = vec4(",
" $(func)($(input).x * 8.0 - 4.0) / k2PI + 0.5,",
" 0.5,",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xy * 8.0 - vec2(4, 4)) / k2PI + vec2(0.5, 0.5),",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xyz * 8.0 - vec3(4, 4, 4)) / k2PI + vec3(0.5, 0.5, 0.5),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)($(input) * 8.0 - vec4(4, 4, 4, 4)) / k2PI + vec4(0.5, 0.5, 0.5, 0.5);",
].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,52 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL ceil function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "ceil",
testFunc: "$(func)($(arg0))",
emuFunc: ["float $(func)_base(float value) {",
" float m = mod(value, 1.0);",
" return m != 0.0 ? (value + 1.0 - m) : value;",
"}"].join("\n"),
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)($(input).x * 8.0 - 4.0) / 8.0 + 0.5,",
" $(func)($(input).y * 8.0 - 4.0) / 8.0 + 0.5,",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xy * 8.0 - vec2(4, 4)) / 8.0 + vec2(0.5, 0.5),",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xyz * 8.0 - vec3(4, 4, 4)) / 8.0 + ",
" vec3(0.5, 0.5, 0.5),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)($(input) * 8.0 - vec4(4, 4, 4, 4)) / 8.0 + ",
" vec4(0.5, 0.5, 0.5, 0.5);"].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,55 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL clamp-gentype function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "clamp",
args: "$(type) value, float minValue, float maxValue",
baseArgs: "value$(field), minValue, maxValue",
testFunc: "$(func)($(type), float, float)",
emuFunc: ["float $(func)_base(float value, float minValue, float maxValue) {",
" return min(max(value, minValue), maxValue);",
"}"].join("\n"),
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)($(input).x * 6.0 - 3.0, -1.5, 1.5) / 3.0 + 0.5,",
" $(func)($(input).y * 10.0 - 5.0, -2.5, 2.5) / 5.0 + 0.5,",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xy * vec2(6, 10) - vec2(3, 5), -1.5, 2.0) / ",
" vec2(3.0, 5.0) + vec2(0.5, 0.5),",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xyz * vec3(6, 10, 8) - vec3(3, 5, 4), -1.5, 2.0) / ",
" vec3(3, 5, 4) + vec3(0.5, 0.5, 0.5),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)($(input) * vec4(6, 10, 8, 4) - vec4(3, 5, 4, 2),",
" -1.5, 2.2) / vec4(3, 5, 4, 2) + ",
" vec4(0.5, 0.5, 0.5, 0.5);"].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,58 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL clamp-gentype function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "clamp",
args: "$(type) value, $(type) minValue, $(type) maxValue",
baseArgs: "value$(field), minValue$(field), maxValue$(field)",
testFunc: "$(func)($(type), $(type), $(type))",
emuFunc: ["float $(func)_base(float value, float minValue, float maxValue) {",
" return min(max(value, minValue), maxValue);",
"}"].join("\n"),
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)($(input).x * 6.0 - 3.0, -1.5, 1.5) / 3.0 + 0.5,",
" $(func)($(input).y * 10.0 - 5.0, -2.5, 2.5) / 5.0 + 0.5,",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xy * vec2(6, 10) - vec2(3, 5), ",
" vec2(-1.5, -2.5), vec2(1.5, 2.5)) / ",
" vec2(3.0, 5.0) + vec2(0.5, 0.5),",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xyz * vec3(6, 10, 8) - vec3(3, 5, 4), ",
" vec3(-1.5, -2.5, -2), vec3(1.5, 2.5, 2)) / vec3(3, 5, 4) + ",
" vec3(0.5, 0.5, 0.5),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)($(input) * vec4(6, 10, 8, 4) - vec4(3, 5, 4, 2),",
" vec4(-1.5, -2.5, -2, -1), vec4(1.5, 2.5, 2, 1)) / ",
" vec4(3, 5, 4, 2) + ",
" vec4(0.5, 0.5, 0.5, 0.5);"].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,82 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL cos function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
var piConstants = [
"const float kPI = 3.14159265358979323846;",
"const float kHalfPI = (kPI * 0.5);",
"const float k2PI = (kPI * 2.0);"
].join("\n");
var sinImplementation = [
"",
"float sin_impl(float value) {",
" value = mod(value + k2PI * 10.0, k2PI);", // only positive values for now
" int quad = int(floor(value / kHalfPI));", // figure out which quad
" float p = mod(value, kHalfPI);", // from 0.0 to PI/2
" if (quad == 1 || quad == 3) { p = kHalfPI - p; }", // backward in quads 1,3
" float c = p - ",
" pow(p, 3.0) / (1.0 * 2.0 * 3.0) + ",
" pow(p, 5.0) / (1.0 * 2.0 * 3.0 * 4.0 * 5.0) - ",
" pow(p, 7.0) / (1.0 * 2.0 * 3.0 * 4.0 * 5.0 * 6.0 * 7.0);",
" if (quad == 2 || quad == 3) { c = -c; }",
" return c;",
"}"
].join('\n');
GLSLGenerator.runFeatureTest({
feature: "cos",
args: "$(type) value",
baseArgs: "value$(field)",
testFunc: "$(func)($(type))",
emuFunc: [
sinImplementation,
"float $(func)_base(float value) {",
" return sin_impl(value + kHalfPI);",
"}"
].join("\n"),
gridRes: 8,
tolerance: 2,
extra: piConstants,
tests: [
["$(output) = vec4(",
" $(func)($(input).x * kHalfPI + kHalfPI),",
" $(func)($(input).y * kHalfPI),",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xy * vec2(kPI, k2PI)) * 0.5 + vec2(0.5, 0.5),",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xyz * vec3(kPI, k2PI, 4.0)) * ",
" 0.5 + vec3(0.5, 0.5, 0.5),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)($(input) * vec4(k2PI, 4.0, kHalfPI, kPI)) *",
" 0.5 + vec4(0.5, 0.5, 0.5, 1);",
].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,52 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL cross function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "cross",
args: "$(type) x, $(type) y",
baseArgs: "value$(field)",
testFunc: "$(func)($(type),$(type))",
emuFuncs: [
{ type: "vec3",
code: [
"vec3 $(func)_emu($(args)) {",
" return vec3(",
" x[1] * y[2] - y[1] * x[2],",
" x[2] * y[0] - y[2] * x[0],",
" x[0] * y[1] - y[0] * x[1]);",
"}"].join("\n")
},
],
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)(",
" normalize($(input).xyz - 0.5),",
" normalize($(input).yzw - 0.5)) * 0.5 + 0.5,",
" 1);"].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,87 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL distance function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "distance",
args: "$(type) p1, $(type) p2",
baseArgs: "value$(field)",
testFunc: "$(func)($(type),$(type))",
emuFuncs: [
{ type: "float",
code: [
"float $(func)_emu($(args)) {",
" return abs(p1 - p2);",
"}"].join("\n")
},
{ type: "vec2",
code: [
"float $(func)_emu($(args)) {",
" return length(p1 - p2);",
"}"].join("\n")
},
{ type: "vec3",
code: [
"float $(func)_emu($(args)) {",
" return length(p1 - p2);",
"}"].join("\n")
},
{ type: "vec4",
code: [
"float $(func)_emu($(args)) {",
" return length(p1 - p2);",
"}"].join("\n")
}
],
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)(",
" $(input).x * 8.0 - 4.0,",
" $(input).y * 8.0 - 4.0) / 8.0,",
" 0,",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" 0,",
" $(func)(",
" $(input).xy * 8.0 - 4.0,",
" $(input).wz * 8.0 - 4.0) / 8.0,",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" 0, 0,",
" $(func)(",
" $(input).xyz * 8.0 - 4.0,",
" $(input).yzw * 8.0 - 4.0) / 8.0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)(",
" vec4($(input).xyz, 0) * 8.0 - 4.0,",
" vec4(0, $(input).wzy) * 8.0 - 4.0) / 8.0,",
" 0, 0, 1);",
].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,88 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL dot function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "dot",
args: "$(type) p1, $(type) p2",
baseArgs: "value$(field)",
testFunc: "$(func)($(type),$(type))",
emuFuncs: [
{ type: "float",
code: [
"float $(func)_emu($(args)) {",
" return p1 * p2;",
"}"].join("\n")
},
{ type: "vec2",
code: [
"float $(func)_emu($(args)) {",
" return p1.x * p2.x + p1.y * p2.y;",
"}"].join("\n")
},
{ type: "vec3",
code: [
"float $(func)_emu($(args)) {",
" return p1.x * p2.x + p1.y * p2.y + p1.z * p2.z;",
"}"].join("\n")
},
{ type: "vec4",
code: [
"float $(func)_emu($(args)) {",
" return p1.x * p2.x + p1.y * p2.y + p1.z * p2.z + p1.w * p2.w;",
"}"].join("\n")
}
],
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)(",
" $(input).x * 8.0 - 4.0,",
" $(input).y * 8.0 - 4.0) / 8.0,",
" 0,",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" 0,",
" $(func)(",
" $(input).xy * 8.0 - 4.0,",
" $(input).wz * 8.0 - 4.0) / 8.0,",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" 0, 0,",
" $(func)(",
" $(input).xyz * 8.0 - 4.0,",
" $(input).yzw * 8.0 - 4.0) / 8.0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)(",
" vec4($(input).xyz, 0) * 8.0 - 4.0,",
" vec4(0, $(input).wzy) * 8.0 - 4.0) / 8.0,",
" 0, 0, 1);",
].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,67 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL faceforward function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "faceforward",
args: "$(type) N, $(type) I, $(type) Nref",
baseArgs: "value$(field)",
testFunc: "$(func)($(type),$(type),$(type))",
simpleEmu: [
"$(type) $(func)_emu($(args)) {",
" return dot(Nref, I) < 0.0 ? N : -N;",
"}"].join("\n"),
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)(",
" $(input).x * 2.0 - 1.0,",
" $(input).y * 2.0 - 1.0,",
" $(input).z * 2.0 - 1.0),",
" 0,",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)(",
" $(input).xy * 2.0 - 1.0,",
" $(input).yz * 2.0 - 1.0,",
" $(input).zw * 2.0 - 1.0),",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)(",
" $(input).xyz * 2.0 - 1.0,",
" $(input).yzw * 2.0 - 1.0,",
" $(input).zwx * 2.0 - 1.0),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)(",
" $(input).xyzw * 2.0 - 1.0,",
" $(input).yzwx * 2.0 - 1.0,",
" $(input).zwxy * 2.0 - 1.0);"
].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,51 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL floor function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "floor",
testFunc: "$(func)($(arg0))",
emuFunc: ["float $(func)_base(float value) {",
" return value - mod(value, 1.0);",
"}"].join("\n"),
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)($(input).x * 8.0 - 4.0) / 8.0 + 0.5,",
" $(func)($(input).y * 8.0 - 4.0) / 8.0 + 0.5,",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xy * 8.0 - vec2(4, 4)) / 8.0 + vec2(0.5, 0.5),",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xyz * 8.0 - vec3(4, 4, 4)) / 8.0 + ",
" vec3(0.5, 0.5, 0.5),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)($(input) * 8.0 - vec4(4, 4, 4, 4)) / 8.0 + ",
" vec4(0.5, 0.5, 0.5, 0.5);"].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,49 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL fract function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "fract",
testFunc: "$(func)($(arg0))",
emuFunc: ["float $(func)_base(float value) {",
" return value - floor(value);",
"}"].join("\n"),
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)($(input).x * 4.0 - 2.0),",
" $(func)($(input).y * 4.0 - 2.0),",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xy * 4.0 - vec2(2, 2)),",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xyz * 4.0 - vec3(2, 2, 2)),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)($(input) * 4.0 - vec4(2, 2, 2, 2));"].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,85 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL length function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "length",
args: "$(type) value",
baseArgs: "value$(field)",
testFunc: "$(func)($(type))",
emuFuncs: [
{ type: "float",
code: [
"float $(func)_emu($(args)) {",
" return abs($(baseArgs));",
"}"].join("\n")
},
{ type: "vec2",
code: [
"float $(func)_emu($(args)) {",
" return sqrt(",
" $(baseArgsX) * $(baseArgsX) + ",
" $(baseArgsY) * $(baseArgsY));",
"}"].join("\n")
},
{ type: "vec3",
code: [
"float $(func)_emu($(args)) {",
" return sqrt(",
" $(baseArgsX) * $(baseArgsX) + ",
" $(baseArgsY) * $(baseArgsY) + ",
" $(baseArgsZ) * $(baseArgsZ));",
"}"].join("\n")
},
{ type: "vec4",
code: [
"float $(func)_emu($(args)) {",
" return sqrt(",
" $(baseArgsX) * $(baseArgsX) + ",
" $(baseArgsY) * $(baseArgsY) + ",
" $(baseArgsZ) * $(baseArgsZ) + ",
" $(baseArgsW) * $(baseArgsW));",
"}"].join("\n")
}
],
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)($(input).x * 8.0 - 4.0) / 4.0,",
" $(func)($(input).y * 8.0 - 4.0) / 4.0,",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xy * 8.0 - 4.0) / 4.0,",
" 0, 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xyz * 8.0 - 4.0) / 4.0,",
" 0, 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input) * 8.0 - 4.0) / 4.0, 0, 0, 1);",
].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,51 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL lessThan function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "lessThan",
args: "$(type) x, $(type) y",
bvecTest: true,
baseArgs: "x, y",
testFunc: "$(func)($(type), $(type))",
emuFunc: ["bool $(func) _base(float x, float y) {",
" return x < y;",
"}"].join("\n"),
gridRes: 8,
tests: [
["bvec2 r = bvec2($(func)($(input).xy, $(input).yw));",
"$(output) = vec4(",
" r.x ? 0.2: 0.8,",
" r.y ? 0.2: 0.8,",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xyz * 8.0 - vec3(4, 4, 4)) / 8.0 + ",
" vec3(0.5, 0.5, 0.5),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)($(input) * 8.0 - vec4(4, 4, 4, 4)) / 8.0 + ",
" vec4(0.5, 0.5, 0.5, 0.5);"].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,51 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL max-float function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "max",
args: "$(type) value, float maxValue",
baseArgs: "value$(field), maxValue",
testFunc: "$(func)($(arg0), float)",
emuFunc: ["float $(func)_base(float value, float maxValue) {",
" return value > maxValue ? value : maxValue;",
"}"].join("\n"),
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)($(input).x, 0.5),",
" $(func)($(input).y, 0.5),",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xy, 0.5),",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xyz, 0.5),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)($(input), 0.5);"].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,51 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL max-gentype function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "max",
args: "$(type) value, $(type) maxValue",
baseArgs: "value$(field), maxValue$(field)",
testFunc: "$(func)($(type), $(type))",
emuFunc: ["float $(func)_base(float value, float maxValue) {",
" return value > maxValue ? value : maxValue;",
"}"].join("\n"),
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)($(input).x, 0.5),",
" $(func)($(input).y, 0.5),",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xy, vec2(0.5, 0.5)),",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xyz, vec3(0.5, 0.5, 0.5)),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)($(input), vec4(0.5, 0.5, 0.5, 0.5));"].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,51 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL min-float function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "min",
args: "$(type) value, float divisor",
baseArgs: "value$(field), divisor",
testFunc: "$(func)($(arg0), float)",
emuFunc: ["float $(func)_base(float value, float divisor) {",
" return value < divisor ? value : divisor;",
"}"].join("\n"),
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)($(input).x, 0.5),",
" $(func)($(input).y, 0.5),",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xy, 0.5),",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xyz, 0.5),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)($(input), 0.5);"].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,51 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL min-gentype function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "min",
args: "$(type) value, $(type) minValue",
baseArgs: "value$(field), minValue$(field)",
testFunc: "$(func)($(type), $(type))",
emuFunc: ["float $(func)_base(float value, float minValue) {",
" return value < minValue ? value : minValue;",
"}"].join("\n"),
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)($(input).x, 0.5),",
" $(func)($(input).y, 0.5),",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xy, vec2(0.5, 0.5)),",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xyz, vec3(0.5, 0.5, 0.5)),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)($(input), vec4(0.5, 0.5, 0.5, 0.5));"].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,53 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL mix-float function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "mix",
args: "$(type) startValue, $(type) endValue, float mixValue",
baseArgs: "startValue$(field), endValue$(field), mixValue",
testFunc: "$(func)($(type), $(type), float)",
emuFunc: [
"float $(func)_base(float startValue, float endValue, float mixValue) {",
" return startValue * (1.0 - mixValue) + endValue * mixValue;",
"}"].join("\n"),
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)(1.0, 0.0, $(input).x),",
" ($(func)(-2.0, 3.0, $(input).y) + 2.0) / 5.0,",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)(vec2(1, -2), vec2(0, 2), $(input).z), ",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)(vec3(1, -2, -1), vec3(0, 2, 3), $(input).y),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)(vec4(1, -2, -1, 0.5), vec4(0, 2, 3, 1), $(input).w);"
].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,53 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL mix-gentype function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "mix",
args: "$(type) startValue, $(type) endValue, $(type) mixValue",
baseArgs: "startValue$(field), endValue$(field), mixValue$(field)",
testFunc: "$(func)($(type), $(type), $(type))",
emuFunc: [
"float $(func)_base(float startValue, float endValue, float mixValue) {",
" return startValue * (1.0 - mixValue) + endValue * mixValue;",
"}"].join("\n"),
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)(1.0, 0.0, $(input).x),",
" ($(func)(-2.0, 3.0, $(input).y) + 2.0) / 5.0,",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)(vec2(1, -2), vec2(0, 2), $(input).xy), ",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)(vec3(1, -2, -1), vec3(0, 2, 3), $(input).xyz),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)(vec4(1, -2, -1, 0.5), vec4(0, 2, 3, 1), $(input));"
].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,51 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL mod-float function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "mod",
args: "$(type) value, float divisor",
baseArgs: "value$(field), divisor",
testFunc: "$(func)($(arg0), float)",
emuFunc: ["float $(func)_base(float value, float divisor) {",
" return value - divisor * floor(value / divisor);",
"}"].join("\n"),
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)($(input).x * 6.0 - 3.0, 1.5) / 1.5,",
" $(func)($(input).y * 6.0 - 3.0, 1.5) / 1.5,",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xy * 6.0 - vec2(3, 3), 1.5) / 1.5,",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xyz * 6.0 - vec3(3, 3, 3), 1.5) / 1.5,",
" 1);"].join("\n"),
["$(output) = ",
" $(func)($(input) * 6.0 - vec4(3, 3, 3, 3), 1.5) / 1.5;"].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,54 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL mod-gentype function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "mod",
args: "$(type) value, $(type) divisor",
baseArgs: "value$(field), divisor$(field)",
testFunc: "$(func)($(type), $(type))",
emuFunc: ["float $(func)_base(float value, float divisor) {",
" return value - divisor * floor(value / divisor);",
"}"].join("\n"),
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)($(input).x * 6.0 - 3.0, 1.5) / 1.5,",
" $(func)($(input).y * 10.0 - 5.0, 2.1) / 2.1,",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xy * vec2(6, 10) - vec2(3, 5), ",
" vec2(1.5, 2.1)) / vec2(1.5, 2.1),",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xyz * vec3(6, 10, 8) - vec3(3, 5, 4), ",
" vec3(1.5, 2.1, 3.2)) / vec3(1.5, 2.1, 3.2),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)($(input) * vec4(6, 10, 8, 4) - vec4(3, 5, 4, 2),",
" vec4(1.5, 2.1, 3.2, 1.1)) / vec4(1.5, 2.1, 3.2, 1.1);"].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,58 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL normalize function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "normalize",
args: "$(type) value",
testFunc: "$(func)($(type))",
simpleEmu: [
"$(type) $(func)_emu($(args)) {",
" return value / length(value);",
"}"].join("\n"),
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)(",
" $(input).x * 8.0 - 4.1) * 0.5 + 0.5,",
" 0.5,",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)(",
" $(input).xy * 8.0 - 4.1) * 0.5 + 0.5,",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)(",
" $(input).xyz * 8.0 - 4.1) * 0.5 + 0.5,",
" 1);"].join("\n"),
["$(output) = ",
" $(func)(",
" vec4($(input).xyz, 0) * 8.0 - 4.1) * 0.5 + 0.5 + vec4(0,0,0,0.5);",
].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,62 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL reflect function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "reflect",
args: "$(type) I, $(type) N",
baseArgs: "value$(field)",
testFunc: "$(func)($(type),$(type))",
simpleEmu: [
"$(type) $(func)_emu($(args)) {",
" return I - 2.0 * dot(N, I) * N;",
"}"].join("\n"),
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)(",
" $(input).x * 2.0 - 1.0,",
" $(input).y * 2.0 - 1.0),",
" 0,",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)(",
" $(input).xy * 2.0 - 1.0,",
" $(input).yz * 2.0 - 1.0),",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)(",
" $(input).xyz * 2.0 - 1.0,",
" $(input).yzw * 2.0 - 1.0),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)(",
" $(input).xyzw * 2.0 - 1.0,",
" $(input).yzwx * 2.0 - 1.0);"
].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,71 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL refract function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "refract",
args: "$(type) I, $(type) N, float eta",
baseArgs: "value$(field)",
testFunc: "$(func)($(type),$(type),float)",
simpleEmu: [
"$(type) $(func)_emu($(args)) {",
" float dotNI = dot(N, I);",
" float k = 1.0 - eta * eta * (1.0 - dotNI * dotNI);",
" if (k < 0.0) {",
" return $(type)(0.0);",
" }",
" return eta * I - (eta * dotNI * sqrt(k)) * N;",
"}"].join("\n"),
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)(",
" $(input).x * 2.0 - 1.0,",
" $(input).y * 2.0 - 1.0,",
" $(input).w),",
" 0,",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)(",
" $(input).xy * 2.0 - 1.0,",
" $(input).yz * 2.0 - 1.0,",
" $(input).w),",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)(",
" $(input).xyz * 2.0 - 1.0,",
" $(input).yzw * 2.0 - 1.0,",
" $(input).w),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)(",
" $(input).xyzw * 2.0 - 1.0,",
" $(input).yzwx * 2.0 - 1.0,",
" $(input).w);"
].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,52 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL sign function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "sign",
testFunc: "$(func)($(arg0))",
emuFunc: ["float $(func)_base(float value) {",
" if (value == 0.0) return 0.0;",
" return value > 0.0 ? 1.0 : -1.0;",
"}"].join("\n"),
gridRes: 4,
tests: [
["$(output) = vec4(",
" $(func)($(input).x * 2.0 - 1.0) * 0.5 + 0.5,",
" 0.5,",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xy * 2.0 - vec2(1, 1)) * 0.5 + vec2(0.5, 0.5),",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xyz * 2.0 - vec3(1, 1, 1)) * 0.5 + ",
" vec3(0.5, 0.5, 0.5),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)($(input) * 2.0 - vec4(1, 1, 1, 1)) * 0.5 + ",
" vec4(0.5, 0.5, 0.5, 0.5);"].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,82 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL sin function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
var piConstants = [
"const float kPI = 3.14159265358979323846;",
"const float kHalfPI = (kPI * 0.5);",
"const float k2PI = (kPI * 2.0);"
].join("\n");
var sinImplementation = [
"",
"float sin_impl(float value) {",
" value = mod(value + k2PI * 10.0, k2PI);", // only positive values for now
" int quad = int(floor(value / kHalfPI));", // figure out which quad
" float p = mod(value, kHalfPI);", // from 0.0 to PI/2
" if (quad == 1 || quad == 3) { p = kHalfPI - p; }", // backward in quads 1,3
" float c = p - ",
" pow(p, 3.0) / (1.0 * 2.0 * 3.0) + ",
" pow(p, 5.0) / (1.0 * 2.0 * 3.0 * 4.0 * 5.0) - ",
" pow(p, 7.0) / (1.0 * 2.0 * 3.0 * 4.0 * 5.0 * 6.0 * 7.0);",
" if (quad == 2 || quad == 3) { c = -c; }",
" return c;",
"}"
].join('\n');
GLSLGenerator.runFeatureTest({
feature: "sin",
args: "$(type) value",
baseArgs: "value$(field)",
testFunc: "$(func)($(type))",
emuFunc: [
sinImplementation,
"float $(func)_base(float value) {",
" return sin_impl(value);",
"}"
].join("\n"),
gridRes: 8,
tolerance: 2,
extra: piConstants,
tests: [
["$(output) = vec4(",
" $(func)($(input).x * kHalfPI + kHalfPI),",
" $(func)($(input).y * kHalfPI),",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xy * vec2(kPI, k2PI)) * 0.5 + vec2(0.5, 0.5),",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)($(input).xyz * vec3(kPI, k2PI, 4.0)) * ",
" 0.5 + vec3(0.5, 0.5, 0.5),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)($(input) * vec4(k2PI, 4.0, kHalfPI, kPI)) *",
" 0.5 + vec4(0.5, 0.5, 0.5, 1);",
].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,54 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL smoothstep-gentype function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "smoothstep",
args: "float edge0, float edge1, $(type) value",
baseArgs: "edge0, edge1, value$(field)",
testFunc: "$(func)(float, float, $(type))",
emuFunc: ["float $(func)_base(float edge0, float edge1, float value) {",
" float t = clamp((value - edge0) / (edge1 - edge0), 0.0, 1.0);",
" return t * t * (3.0 - 2.0 * t);",
"}"].join("\n"),
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)(0.3, 0.7, $(input).x),",
" $(func)(0.2, 0.8, $(input).y),",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)(0.4, 0.8, $(input).xy),",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)(0.3, 0.7, $(input).xyz),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)(0.3, 0.9, $(input));"].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,56 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL smoothstep-gentype function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "smoothstep",
args: "$(type) edge0, $(type) edge1, $(type) value",
baseArgs: "edge0$(field), edge1$(field), value$(field)",
testFunc: "$(func)($(type), $(type), $(type))",
emuFunc: ["float $(func)_base(float edge0, float edge1, float value) {",
" float t = clamp((value - edge0) / (edge1 - edge0), 0.0, 1.0);",
" return t * t * (3.0 - 2.0 * t);",
"}"].join("\n"),
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)(0.3, 0.7, $(input).x),",
" $(func)(0.2, 0.8, $(input).y),",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)(vec2(0.4, 0.6), vec2(0.8, 0.9), $(input).xy),",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)(vec3(0.3, 0.5, 0.7), vec3(0.7, 0.9, 1.0), $(input).xyz),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)(vec4(0.3, 0.4, 0.5, 0.2), ",
" vec4(0.7, 0.6, 0.9, 0.8), ",
" $(input));"].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,51 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL step-float function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "step",
args: "float edge, $(type) value",
baseArgs: "edge, value$(field)",
testFunc: "$(func)(float, $(type))",
emuFunc: ["float $(func)_base(float edge, float value) {",
" return value < edge ? 0.0 : 1.0;",
"}"].join("\n"),
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)(0.3, $(input).x),",
" $(func)(0.7, $(input).y),",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)(0.4, $(input).xy),",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)(0.4, $(input).xyz),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)(0.4, $(input));"].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,51 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL step-gentype function test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "step",
args: "$(type) edge, $(type) value",
baseArgs: "edge$(field), value$(field)",
testFunc: "$(func)($(type), $(type))",
emuFunc: ["float $(func)_base(float edge, float value) {",
" return value < edge ? 0.0 : 1.0;",
"}"].join("\n"),
gridRes: 8,
tests: [
["$(output) = vec4(",
" $(func)(0.3, $(input).x),",
" $(func)(0.7, $(input).y),",
" 0,",
" 1);"].join("\n"),
["$(output) = vec4(",
" $(func)(vec2(0.4, 0.6), $(input).xy),",
" 0, 1);"].join("\n"),
["$(output) = vec4(",
" $(func)(vec3(0.3, 0.5, 0.7), $(input).xyz),",
" 1);"].join("\n"),
["$(output) = ",
" $(func)( vec4(0.3, 0.4, 0.5, 0.2), $(input));"].join("\n")
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,38 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL function test test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
GLSLGenerator.runFeatureTest({
feature: "the_GLSL_test_harness",
testFunc: "pass through",
emuFunc: "float $(func)_base(float value) { return 0.0; }",
gridRes: 4,
tests: [
"$(output) = vec4($(input).x, 0, 0, 1);",
"$(output) = vec4(0, $(input).xy, 1);",
"$(output) = vec4($(input).xyz, 1);",
"$(output) = $(input);"
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,65 @@
add_int_float.vert.html
add_int_mat2.vert.html
add_int_mat3.vert.html
add_int_mat4.vert.html
add_int_vec2.vert.html
add_int_vec3.vert.html
add_int_vec4.vert.html
add_ivec2_vec2.vert.html
add_ivec3_vec3.vert.html
add_ivec4_vec4.vert.html
assign_int_to_float.vert.html
assign_ivec2_to_vec2.vert.html
assign_ivec3_to_vec3.vert.html
assign_ivec4_to_vec4.vert.html
construct_struct.vert.html
divide_int_float.vert.html
divide_int_mat2.vert.html
divide_int_mat3.vert.html
divide_int_mat4.vert.html
divide_int_vec2.vert.html
divide_int_vec3.vert.html
divide_int_vec4.vert.html
divide_ivec2_vec2.vert.html
divide_ivec3_vec3.vert.html
divide_ivec4_vec4.vert.html
equal_int_float.vert.html
equal_ivec2_vec2.vert.html
equal_ivec3_vec3.vert.html
equal_ivec4_vec4.vert.html
function_int_float.vert.html
function_ivec2_vec2.vert.html
function_ivec3_vec3.vert.html
function_ivec4_vec4.vert.html
greater_than.vert.html
greater_than_equal.vert.html
less_than.vert.html
less_than_equal.vert.html
multiply_int_float.vert.html
multiply_int_mat2.vert.html
multiply_int_mat3.vert.html
multiply_int_mat4.vert.html
multiply_int_vec2.vert.html
multiply_int_vec3.vert.html
multiply_int_vec4.vert.html
multiply_ivec2_vec2.vert.html
multiply_ivec3_vec3.vert.html
multiply_ivec4_vec4.vert.html
not_equal_int_float.vert.html
not_equal_ivec2_vec2.vert.html
not_equal_ivec3_vec3.vert.html
not_equal_ivec4_vec4.vert.html
subtract_int_float.vert.html
subtract_int_mat2.vert.html
subtract_int_mat3.vert.html
subtract_int_mat4.vert.html
subtract_int_vec2.vert.html
subtract_int_vec3.vert.html
subtract_int_vec4.vert.html
subtract_ivec2_vec2.vert.html
subtract_ivec3_vec3.vert.html
subtract_ivec4_vec4.vert.html
ternary_int_float.vert.html
ternary_ivec2_vec2.vert.html
ternary_ivec3_vec3.vert.html
ternary_ivec4_vec4.vert.html

View File

@ -0,0 +1,34 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL GLSL Conformance Tests</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test-utils.js"></script>
<script src="../../resources/glsl-conformance-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script id="vertexShader" type="text/something-not-javascript">
// implicit cast adding integer to float should fail
void main()
{
float f = 1.0 + 1;
}
</script>
<script>
GLSLConformanceTester.runTest();
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL GLSL Conformance Tests</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test-utils.js"></script>
<script src="../../resources/glsl-conformance-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script id="vertexShader" type="text/something-not-javascript">
// implicit cast adding integer to mat2 should fail
void main()
{
mat2 f = mat2(1.0) + 1;
}
</script>
<script>
GLSLConformanceTester.runTest();
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL GLSL Conformance Tests</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test-utils.js"></script>
<script src="../../resources/glsl-conformance-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script id="vertexShader" type="text/something-not-javascript">
// implicit cast adding integer to mat3 should fail
void main()
{
mat3 f = mat3(1.0) + 1;
}
</script>
<script>
GLSLConformanceTester.runTest();
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL GLSL Conformance Tests</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test-utils.js"></script>
<script src="../../resources/glsl-conformance-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script id="vertexShader" type="text/something-not-javascript">
// implicit cast adding integer to mat4 should fail
void main()
{
mat4 f = mat4(1.0) + 1;
}
</script>
<script>
GLSLConformanceTester.runTest();
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL GLSL Conformance Tests</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test-utils.js"></script>
<script src="../../resources/glsl-conformance-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script id="vertexShader" type="text/something-not-javascript">
// implicit cast adding integer to vec2 should fail
void main()
{
vec2 f = vec2(1.0, 2.0) + 1;
}
</script>
<script>
GLSLConformanceTester.runTest();
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL GLSL Conformance Tests</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test-utils.js"></script>
<script src="../../resources/glsl-conformance-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script id="vertexShader" type="text/something-not-javascript">
// implicit cast adding integer to vec3 should fail
void main()
{
vec3 f = vec3(1.0, 2.0, 3.0) + 1;
}
</script>
<script>
GLSLConformanceTester.runTest();
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL GLSL Conformance Tests</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test-utils.js"></script>
<script src="../../resources/glsl-conformance-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script id="vertexShader" type="text/something-not-javascript">
// implicit cast adding integer to vec4 should fail
void main()
{
vec4 f = vec4(1.0, 2.0, 3.0, 4.0) + 1;
}
</script>
<script>
GLSLConformanceTester.runTest();
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL GLSL Conformance Tests</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test-utils.js"></script>
<script src="../../resources/glsl-conformance-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script id="vertexShader" type="text/something-not-javascript">
// implicit cast adding ivec2 to vec2 should fail
void main()
{
vec2 f = vec2(1.0, 2.0) + ivec2(1, 2);
}
</script>
<script>
GLSLConformanceTester.runTest();
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL GLSL Conformance Tests</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test-utils.js"></script>
<script src="../../resources/glsl-conformance-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script id="vertexShader" type="text/something-not-javascript">
// implicit cast adding ivec3 to vec3 should fail
void main()
{
vec3 f = vec3(1.0, 2.0, 3.0) + ivec3(1, 2, 3);
}
</script>
<script>
GLSLConformanceTester.runTest();
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL GLSL Conformance Tests</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test-utils.js"></script>
<script src="../../resources/glsl-conformance-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script id="vertexShader" type="text/something-not-javascript">
// 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);
}
</script>
<script>
GLSLConformanceTester.runTest();
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL GLSL Conformance Tests</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test-utils.js"></script>
<script src="../../resources/glsl-conformance-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script id="vertexShader" type="text/something-not-javascript">
// implicit cast assing int to float should fail
void main()
{
float f = -123;
}
</script>
<script>
GLSLConformanceTester.runTest();
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL GLSL Conformance Tests</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test-utils.js"></script>
<script src="../../resources/glsl-conformance-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script id="vertexShader" type="text/something-not-javascript">
// implicit cast assigning ivec2 to vec2 should fail
void main()
{
vec2 f = ivec2(1, 2);
}
</script>
<script>
GLSLConformanceTester.runTest();
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL GLSL Conformance Tests</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test-utils.js"></script>
<script src="../../resources/glsl-conformance-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script id="vertexShader" type="text/something-not-javascript">
// implicit cast assigning ivec3 to vec3 should fail
void main()
{
vec3 f = ivec3(1, 2, 3);
}
</script>
<script>
GLSLConformanceTester.runTest();
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL GLSL Conformance Tests</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test-utils.js"></script>
<script src="../../resources/glsl-conformance-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script id="vertexShader" type="text/something-not-javascript">
// implicit cast assigning ivec4 to vec4 should fail
void main()
{
vec4 f = ivec4(1, 2, 3, 4);
}
</script>
<script>
GLSLConformanceTester.runTest();
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,37 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL GLSL Conformance Tests</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test-utils.js"></script>
<script src="../../resources/glsl-conformance-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script id="vertexShader" type="text/something-not-javascript">
// implicit cast from int to float in struct initializer should fail
struct Foo {
float bar;
};
void main() {
Foo foo = Foo(1);
}
</script>
<script>
GLSLConformanceTester.runTest();
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL GLSL Conformance Tests</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test-utils.js"></script>
<script src="../../resources/glsl-conformance-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script id="vertexShader" type="text/something-not-javascript">
// implicit cast of float divided by int should fail
void main()
{
float f = 1.0 / 1;
}
</script>
<script>
GLSLConformanceTester.runTest();
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL GLSL Conformance Tests</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test-utils.js"></script>
<script src="../../resources/glsl-conformance-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script id="vertexShader" type="text/something-not-javascript">
// implicit cast of mat2 divided by int should fail
void main()
{
mat2 f = mat2(1.0) / 1;
}
</script>
<script>
GLSLConformanceTester.runTest();
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -0,0 +1,34 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL GLSL Conformance Tests</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test-utils.js"></script>
<script src="../../resources/glsl-conformance-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script id="vertexShader" type="text/something-not-javascript">
// implicit cast of mat3 divided by int should fail
void main()
{
mat3 f = mat3(1.0) / 1;
}
</script>
<script>
GLSLConformanceTester.runTest();
successfullyParsed = true;
</script>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More