mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 696844 - Upgrade WebGL conformance test suite to r15892 - no review
This is just syncing us with the upstreal WebGL conformance tests from https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/tests/conformance/ Also reenabling the quickCheckAPI tests, updating the list of failing tests (only one part of quickCheckAPI added to the list) and added 3 lines of code to ignore empty lines in the lists of failing tests to get a correct count.
This commit is contained in:
parent
e38e839b2b
commit
604edc0665
@ -1,4 +1,4 @@
|
||||
This is a local copy of the WebGL conformance suite, SVN revision 15815
|
||||
This is a local copy of the WebGL conformance suite, SVN revision 15892
|
||||
|
||||
The canonical location for this testsuite is:
|
||||
|
||||
|
@ -28,6 +28,7 @@ GLSLGenerator.runFeatureTest({
|
||||
" return value - divisor * floor(value / divisor);",
|
||||
"}"].join("\n"),
|
||||
gridRes: 8,
|
||||
tolerance: 1,
|
||||
tests: [
|
||||
["$(output) = vec4(",
|
||||
" $(func)($(input).x * 6.0 - 3.0, 1.5) / 1.5,",
|
||||
|
@ -19,7 +19,6 @@ found in the LICENSE file.
|
||||
<div id="description"></div>
|
||||
<div id="console"></div>
|
||||
<script>
|
||||
|
||||
GLSLGenerator.runFeatureTest({
|
||||
feature: "normalize",
|
||||
args: "$(type) value",
|
||||
@ -29,6 +28,7 @@ GLSLGenerator.runFeatureTest({
|
||||
" return value / length(value);",
|
||||
"}"].join("\n"),
|
||||
gridRes: 8,
|
||||
tolerance: 1,
|
||||
tests: [
|
||||
["$(output) = vec4(",
|
||||
" $(func)(",
|
||||
|
@ -6,6 +6,8 @@ non-ascii.vert.html
|
||||
shader-with-256-character-identifier.frag.html
|
||||
shader-with-257-character-identifier.frag.html
|
||||
shader-with-_webgl-identifier.vert.html
|
||||
shader-with-arbitrary-indexing.frag.html
|
||||
shader-with-arbitrary-indexing.vert.html
|
||||
shader-with-attrib-array.vert.html
|
||||
shader-with-clipvertex.vert.html
|
||||
shader-with-default-precision.frag.html
|
||||
@ -29,12 +31,14 @@ shader-with-invalid-identifier.frag.html
|
||||
shader-with-ivec2-return-value.frag.html
|
||||
shader-with-ivec3-return-value.frag.html
|
||||
shader-with-ivec4-return-value.frag.html
|
||||
shader-with-limited-indexing.frag.html
|
||||
shader-with-line-directive.html
|
||||
shader-with-long-line.html
|
||||
shader-with-non-ascii-error.frag.html
|
||||
shader-with-precision.frag.html
|
||||
shader-with-quoted-error.frag.html
|
||||
shader-with-undefined-preprocessor-symbol.frag.html
|
||||
shader-with-uniform-in-loop-condition.vert.html
|
||||
shader-with-vec2-return-value.frag.html
|
||||
shader-with-vec3-return-value.frag.html
|
||||
shader-with-vec4-return-value.frag.html
|
||||
|
@ -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>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="fragmentShader" type="text/something-not-javascript">
|
||||
// fragment shader with arbitrary indexing expression should fail
|
||||
// http://www.khronos.org/registry/webgl/specs/latest/#SUPPORTED_GLSL_CONSTRUCTS
|
||||
precision mediump float;
|
||||
|
||||
uniform vec4 u_colors[8];
|
||||
varying float a_index;
|
||||
|
||||
void main()
|
||||
{
|
||||
int index = int(floor(a_index));
|
||||
gl_FragColor = u_colors[index];
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
GLSLConformanceTester.runTest();
|
||||
successfullyParsed = true;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -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">
|
||||
// vertex shader with arbitrary indexing expression should succeed
|
||||
// http://www.khronos.org/registry/webgl/specs/latest/#SUPPORTED_GLSL_CONSTRUCTS
|
||||
uniform mat4 u_matrices[8];
|
||||
attribute vec4 a_vertex;
|
||||
attribute float a_index;
|
||||
|
||||
void main()
|
||||
{
|
||||
int index = int(floor(a_index));
|
||||
gl_Position = u_matrices[index] * a_vertex;
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
GLSLConformanceTester.runTest();
|
||||
successfullyParsed = true;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -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>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">
|
||||
// vertex shader should succeed
|
||||
attribute vec4 a_weights;
|
||||
varying vec4 v_weights;
|
||||
|
||||
void main() {
|
||||
v_weights = a_weights;
|
||||
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
</script>
|
||||
<script id="fragmentShader" type="text/something-not-javascript">
|
||||
// fragment shader with appropriately limited indexing expression should succeed
|
||||
// http://www.khronos.org/registry/webgl/specs/latest/#SUPPORTED_GLSL_CONSTRUCTS
|
||||
precision mediump float;
|
||||
|
||||
uniform vec4 u_colors[8];
|
||||
varying vec4 v_weights;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 color = vec4(0.0, 0.0, 0.0, 0.0);
|
||||
for (int i = 0; i < 4; i++) {
|
||||
color += u_colors[i] * v_weights[i];
|
||||
}
|
||||
gl_FragColor = color;
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
GLSLConformanceTester.runTest();
|
||||
successfullyParsed = true;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -0,0 +1,39 @@
|
||||
<!--
|
||||
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">
|
||||
// vertex shader with uniform variable in loop condition should fail
|
||||
// http://www.khronos.org/registry/webgl/specs/latest/#SUPPORTED_GLSL_CONSTRUCTS
|
||||
uniform int u_numIterations;
|
||||
attribute vec4 a_position;
|
||||
|
||||
void main()
|
||||
{
|
||||
float count = 0.0;
|
||||
for (int i = 0; i < u_numIterations; i++) {
|
||||
count += 1.0;
|
||||
}
|
||||
gl_Position = a_position + vec4(count, count, count, count);
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
GLSLConformanceTester.runTest();
|
||||
successfullyParsed = true;
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,10 +1,16 @@
|
||||
conformance/constants.html
|
||||
conformance/getContext.html
|
||||
conformance/methods.html
|
||||
#this test causes whichever comes after to intermittently time out.
|
||||
#forcing a GC run doesn't solve this issue. Could be something about using a random amount of memory that
|
||||
#can be too high, causing e.g. swapping.
|
||||
#conformance/quickCheckAPI.html
|
||||
conformance/quickCheckAPI-A.html
|
||||
conformance/quickCheckAPI-B1.html
|
||||
conformance/quickCheckAPI-B2.html
|
||||
conformance/quickCheckAPI-B3.html
|
||||
conformance/quickCheckAPI-B4.html
|
||||
conformance/quickCheckAPI-C.html
|
||||
conformance/quickCheckAPI-D_G.html
|
||||
conformance/quickCheckAPI-G_I.html
|
||||
conformance/quickCheckAPI-L_S.html
|
||||
conformance/quickCheckAPI-S_V.html
|
||||
conformance/webGLArrays.html
|
||||
functions/bindBuffer.html
|
||||
functions/bindBufferBadArgs.html
|
||||
|
@ -0,0 +1,63 @@
|
||||
// ArgGenerators contains argument generators for WebGL functions.
|
||||
// The argument generators are used for running random tests against the WebGL
|
||||
// functions.
|
||||
//
|
||||
// ArgGenerators is an object consisting of functionName : argGen -properties.
|
||||
//
|
||||
// functionName is a WebGL context function name and the argGen is an argument
|
||||
// generator object that encapsulates the requirements to run
|
||||
// randomly generated tests on the WebGL function.
|
||||
//
|
||||
// An argGen object has the following methods:
|
||||
// - setup -- set up state for testing the GL function, returns values
|
||||
// that need cleanup in teardown. Run once before entering a
|
||||
// test loop.
|
||||
// - teardown -- do cleanup on setup's return values after testing is complete
|
||||
// - generate -- generate a valid set of random arguments for the GL function
|
||||
// - returnValueCleanup -- do cleanup on value returned by the tested GL function
|
||||
// - cleanup -- do cleanup on generated arguments from generate
|
||||
// - checkArgValidity -- check if passed args are valid. Has a call signature
|
||||
// that matches generate's return value. Returns true
|
||||
// if args are valid, false if not.
|
||||
//
|
||||
// Example test loop that demonstrates how the function args and return
|
||||
// values flow together:
|
||||
//
|
||||
// var setupArgs = argGen.setup();
|
||||
// for (var i=0; i<numberOfTests; i++) {
|
||||
// var generatedArgs = argGen.generate.apply(argGen, setupArgs);
|
||||
// var validArgs = argGen.checkArgValidity.apply(argGen, generatedArgs);
|
||||
// var rv = call the GL function with generatedArgs;
|
||||
// argGen.returnValueCleanup(rv);
|
||||
// argGen.cleanup.apply(argGen, generatedArgs);
|
||||
// }
|
||||
// argGen.teardown.apply(argGen, setupArgs);
|
||||
//
|
||||
ArgGenerators = {
|
||||
|
||||
// GL functions in alphabetical order
|
||||
|
||||
// A
|
||||
|
||||
activeTexture : {
|
||||
generate : function() { return [textureUnit.random()]; },
|
||||
checkArgValidity : function(t) { return textureUnit.has(t); },
|
||||
teardown : function() { GL.activeTexture(GL.TEXTURE0); }
|
||||
},
|
||||
attachShader : {
|
||||
generate : function() {
|
||||
var p = GL.createProgram();
|
||||
var sh = GL.createShader(shaderType.random());
|
||||
return [p, sh];
|
||||
},
|
||||
checkArgValidity : function(p, sh) {
|
||||
return GL.isProgram(p) && GL.isShader(sh) && !GL.getAttachedShaders(p).has(sh);
|
||||
},
|
||||
cleanup : function(p, sh) {
|
||||
try {GL.detachShader(p,sh);} catch(e) {}
|
||||
try {GL.deleteProgram(p);} catch(e) {}
|
||||
try {GL.deleteShader(sh);} catch(e) {}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
@ -0,0 +1,55 @@
|
||||
// ArgGenerators contains argument generators for WebGL functions.
|
||||
// The argument generators are used for running random tests against the WebGL
|
||||
// functions.
|
||||
//
|
||||
// ArgGenerators is an object consisting of functionName : argGen -properties.
|
||||
//
|
||||
// functionName is a WebGL context function name and the argGen is an argument
|
||||
// generator object that encapsulates the requirements to run
|
||||
// randomly generated tests on the WebGL function.
|
||||
//
|
||||
// An argGen object has the following methods:
|
||||
// - setup -- set up state for testing the GL function, returns values
|
||||
// that need cleanup in teardown. Run once before entering a
|
||||
// test loop.
|
||||
// - teardown -- do cleanup on setup's return values after testing is complete
|
||||
// - generate -- generate a valid set of random arguments for the GL function
|
||||
// - returnValueCleanup -- do cleanup on value returned by the tested GL function
|
||||
// - cleanup -- do cleanup on generated arguments from generate
|
||||
// - checkArgValidity -- check if passed args are valid. Has a call signature
|
||||
// that matches generate's return value. Returns true
|
||||
// if args are valid, false if not.
|
||||
//
|
||||
// Example test loop that demonstrates how the function args and return
|
||||
// values flow together:
|
||||
//
|
||||
// var setupArgs = argGen.setup();
|
||||
// for (var i=0; i<numberOfTests; i++) {
|
||||
// var generatedArgs = argGen.generate.apply(argGen, setupArgs);
|
||||
// var validArgs = argGen.checkArgValidity.apply(argGen, generatedArgs);
|
||||
// var rv = call the GL function with generatedArgs;
|
||||
// argGen.returnValueCleanup(rv);
|
||||
// argGen.cleanup.apply(argGen, generatedArgs);
|
||||
// }
|
||||
// argGen.teardown.apply(argGen, setupArgs);
|
||||
//
|
||||
ArgGenerators = {
|
||||
|
||||
// GL functions in alphabetical order
|
||||
|
||||
// B-1
|
||||
|
||||
bindAttribLocation : {
|
||||
generate : function() {
|
||||
var program = GL.createProgram();
|
||||
return [program, randomVertexAttribute(), randomName()];
|
||||
},
|
||||
checkArgValidity : function(program, index, name) {
|
||||
return GL.isProgram(program) && isVertexAttribute(index) && isValidName(name);
|
||||
},
|
||||
cleanup : function(program, index, name) {
|
||||
try { GL.deleteProgram(program); } catch(e) {}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
@ -0,0 +1,148 @@
|
||||
// ArgGenerators contains argument generators for WebGL functions.
|
||||
// The argument generators are used for running random tests against the WebGL
|
||||
// functions.
|
||||
//
|
||||
// ArgGenerators is an object consisting of functionName : argGen -properties.
|
||||
//
|
||||
// functionName is a WebGL context function name and the argGen is an argument
|
||||
// generator object that encapsulates the requirements to run
|
||||
// randomly generated tests on the WebGL function.
|
||||
//
|
||||
// An argGen object has the following methods:
|
||||
// - setup -- set up state for testing the GL function, returns values
|
||||
// that need cleanup in teardown. Run once before entering a
|
||||
// test loop.
|
||||
// - teardown -- do cleanup on setup's return values after testing is complete
|
||||
// - generate -- generate a valid set of random arguments for the GL function
|
||||
// - returnValueCleanup -- do cleanup on value returned by the tested GL function
|
||||
// - cleanup -- do cleanup on generated arguments from generate
|
||||
// - checkArgValidity -- check if passed args are valid. Has a call signature
|
||||
// that matches generate's return value. Returns true
|
||||
// if args are valid, false if not.
|
||||
//
|
||||
// Example test loop that demonstrates how the function args and return
|
||||
// values flow together:
|
||||
//
|
||||
// var setupArgs = argGen.setup();
|
||||
// for (var i=0; i<numberOfTests; i++) {
|
||||
// var generatedArgs = argGen.generate.apply(argGen, setupArgs);
|
||||
// var validArgs = argGen.checkArgValidity.apply(argGen, generatedArgs);
|
||||
// var rv = call the GL function with generatedArgs;
|
||||
// argGen.returnValueCleanup(rv);
|
||||
// argGen.cleanup.apply(argGen, generatedArgs);
|
||||
// }
|
||||
// argGen.teardown.apply(argGen, setupArgs);
|
||||
//
|
||||
ArgGenerators = {
|
||||
|
||||
// GL functions in alphabetical order
|
||||
|
||||
// B-2
|
||||
|
||||
bindBuffer : {
|
||||
generate : function(buf) {
|
||||
return [bufferTarget.random(), GL.createBuffer()];
|
||||
},
|
||||
checkArgValidity : function(target, buf) {
|
||||
if (!bufferTarget.has(target))
|
||||
return false;
|
||||
GL.bindBuffer(target, buf);
|
||||
return GL.isBuffer(buf);
|
||||
},
|
||||
cleanup : function(t, buf, m) {
|
||||
GL.deleteBuffer(buf);
|
||||
}
|
||||
},
|
||||
bindFramebuffer : {
|
||||
generate : function() {
|
||||
return [GL.FRAMEBUFFER, Math.random() > 0.5 ? null : GL.createFramebuffer()];
|
||||
},
|
||||
checkArgValidity : function(target, fbo) {
|
||||
if (target != GL.FRAMEBUFFER)
|
||||
return false;
|
||||
if (fbo != null)
|
||||
GL.bindFramebuffer(target, fbo);
|
||||
return (fbo == null || GL.isFramebuffer(fbo));
|
||||
},
|
||||
cleanup : function(target, fbo) {
|
||||
GL.bindFramebuffer(target, null);
|
||||
if (fbo)
|
||||
GL.deleteFramebuffer(fbo);
|
||||
}
|
||||
},
|
||||
bindRenderbuffer : {
|
||||
generate : function() {
|
||||
return [GL.RENDERBUFFER, Math.random() > 0.5 ? null : GL.createRenderbuffer()];
|
||||
},
|
||||
checkArgValidity : function(target, rbo) {
|
||||
if (target != GL.RENDERBUFFER)
|
||||
return false;
|
||||
if (rbo != null)
|
||||
GL.bindRenderbuffer(target, rbo);
|
||||
return (rbo == null || GL.isRenderbuffer(rbo));
|
||||
},
|
||||
cleanup : function(target, rbo) {
|
||||
GL.bindRenderbuffer(target, null);
|
||||
if (rbo)
|
||||
GL.deleteRenderbuffer(rbo);
|
||||
}
|
||||
},
|
||||
bindTexture : {
|
||||
generate : function() {
|
||||
return [bindTextureTarget.random(), Math.random() > 0.5 ? null : GL.createTexture()];
|
||||
},
|
||||
checkArgValidity : function(target, o) {
|
||||
if (!bindTextureTarget.has(target))
|
||||
return false;
|
||||
if (o != null)
|
||||
GL.bindTexture(target, o);
|
||||
return (o == null || GL.isTexture(o));
|
||||
},
|
||||
cleanup : function(target, o) {
|
||||
GL.bindTexture(target, null);
|
||||
if (o)
|
||||
GL.deleteTexture(o);
|
||||
}
|
||||
},
|
||||
blendColor : {
|
||||
generate : function() { return randomColor(); },
|
||||
teardown : function() { GL.blendColor(0,0,0,0); }
|
||||
},
|
||||
blendEquation : {
|
||||
generate : function() { return [blendEquationMode.random()]; },
|
||||
checkArgValidity : function(o) { return blendEquationMode.has(o); },
|
||||
teardown : function() { GL.blendEquation(GL.FUNC_ADD); }
|
||||
},
|
||||
blendEquationSeparate : {
|
||||
generate : function() {
|
||||
return [blendEquationMode.random(), blendEquationMode.random()];
|
||||
},
|
||||
checkArgValidity : function(o,p) {
|
||||
return blendEquationMode.has(o) && blendEquationMode.has(p);
|
||||
},
|
||||
teardown : function() { GL.blendEquationSeparate(GL.FUNC_ADD, GL.FUNC_ADD); }
|
||||
},
|
||||
blendFunc : {
|
||||
generate : function() {
|
||||
return [blendFuncSfactor.random(), blendFuncDfactor.random()];
|
||||
},
|
||||
checkArgValidity : function(s,d) {
|
||||
return blendFuncSfactor.has(s) && blendFuncDfactor.has(d);
|
||||
},
|
||||
teardown : function() { GL.blendFunc(GL.ONE, GL.ZERO); }
|
||||
},
|
||||
blendFuncSeparate : {
|
||||
generate : function() {
|
||||
return [blendFuncSfactor.random(), blendFuncDfactor.random(),
|
||||
blendFuncSfactor.random(), blendFuncDfactor.random()];
|
||||
},
|
||||
checkArgValidity : function(s,d,as,ad) {
|
||||
return blendFuncSfactor.has(s) && blendFuncDfactor.has(d) &&
|
||||
blendFuncSfactor.has(as) && blendFuncDfactor.has(ad) ;
|
||||
},
|
||||
teardown : function() {
|
||||
GL.blendFuncSeparate(GL.ONE, GL.ZERO, GL.ONE, GL.ZERO);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
@ -0,0 +1,62 @@
|
||||
// ArgGenerators contains argument generators for WebGL functions.
|
||||
// The argument generators are used for running random tests against the WebGL
|
||||
// functions.
|
||||
//
|
||||
// ArgGenerators is an object consisting of functionName : argGen -properties.
|
||||
//
|
||||
// functionName is a WebGL context function name and the argGen is an argument
|
||||
// generator object that encapsulates the requirements to run
|
||||
// randomly generated tests on the WebGL function.
|
||||
//
|
||||
// An argGen object has the following methods:
|
||||
// - setup -- set up state for testing the GL function, returns values
|
||||
// that need cleanup in teardown. Run once before entering a
|
||||
// test loop.
|
||||
// - teardown -- do cleanup on setup's return values after testing is complete
|
||||
// - generate -- generate a valid set of random arguments for the GL function
|
||||
// - returnValueCleanup -- do cleanup on value returned by the tested GL function
|
||||
// - cleanup -- do cleanup on generated arguments from generate
|
||||
// - checkArgValidity -- check if passed args are valid. Has a call signature
|
||||
// that matches generate's return value. Returns true
|
||||
// if args are valid, false if not.
|
||||
//
|
||||
// Example test loop that demonstrates how the function args and return
|
||||
// values flow together:
|
||||
//
|
||||
// var setupArgs = argGen.setup();
|
||||
// for (var i=0; i<numberOfTests; i++) {
|
||||
// var generatedArgs = argGen.generate.apply(argGen, setupArgs);
|
||||
// var validArgs = argGen.checkArgValidity.apply(argGen, generatedArgs);
|
||||
// var rv = call the GL function with generatedArgs;
|
||||
// argGen.returnValueCleanup(rv);
|
||||
// argGen.cleanup.apply(argGen, generatedArgs);
|
||||
// }
|
||||
// argGen.teardown.apply(argGen, setupArgs);
|
||||
//
|
||||
ArgGenerators = {
|
||||
|
||||
// GL functions in alphabetical order
|
||||
|
||||
// B-3
|
||||
|
||||
bufferData : {
|
||||
setup : function() {
|
||||
var buf = GL.createBuffer();
|
||||
var ebuf = GL.createBuffer();
|
||||
GL.bindBuffer(GL.ARRAY_BUFFER, buf);
|
||||
GL.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, ebuf);
|
||||
return [buf, ebuf];
|
||||
},
|
||||
generate : function(buf, ebuf) {
|
||||
return [bufferTarget.random(), randomBufferData(), bufferMode.random()];
|
||||
},
|
||||
checkArgValidity : function(target, bufData, mode) {
|
||||
return bufferTarget.has(target) && isBufferData(bufData) && bufferMode.has(mode);
|
||||
},
|
||||
teardown : function(buf, ebuf) {
|
||||
GL.deleteBuffer(buf);
|
||||
GL.deleteBuffer(ebuf);
|
||||
},
|
||||
}
|
||||
|
||||
};
|
@ -0,0 +1,65 @@
|
||||
// ArgGenerators contains argument generators for WebGL functions.
|
||||
// The argument generators are used for running random tests against the WebGL
|
||||
// functions.
|
||||
//
|
||||
// ArgGenerators is an object consisting of functionName : argGen -properties.
|
||||
//
|
||||
// functionName is a WebGL context function name and the argGen is an argument
|
||||
// generator object that encapsulates the requirements to run
|
||||
// randomly generated tests on the WebGL function.
|
||||
//
|
||||
// An argGen object has the following methods:
|
||||
// - setup -- set up state for testing the GL function, returns values
|
||||
// that need cleanup in teardown. Run once before entering a
|
||||
// test loop.
|
||||
// - teardown -- do cleanup on setup's return values after testing is complete
|
||||
// - generate -- generate a valid set of random arguments for the GL function
|
||||
// - returnValueCleanup -- do cleanup on value returned by the tested GL function
|
||||
// - cleanup -- do cleanup on generated arguments from generate
|
||||
// - checkArgValidity -- check if passed args are valid. Has a call signature
|
||||
// that matches generate's return value. Returns true
|
||||
// if args are valid, false if not.
|
||||
//
|
||||
// Example test loop that demonstrates how the function args and return
|
||||
// values flow together:
|
||||
//
|
||||
// var setupArgs = argGen.setup();
|
||||
// for (var i=0; i<numberOfTests; i++) {
|
||||
// var generatedArgs = argGen.generate.apply(argGen, setupArgs);
|
||||
// var validArgs = argGen.checkArgValidity.apply(argGen, generatedArgs);
|
||||
// var rv = call the GL function with generatedArgs;
|
||||
// argGen.returnValueCleanup(rv);
|
||||
// argGen.cleanup.apply(argGen, generatedArgs);
|
||||
// }
|
||||
// argGen.teardown.apply(argGen, setupArgs);
|
||||
//
|
||||
ArgGenerators = {
|
||||
|
||||
// GL functions in alphabetical order
|
||||
|
||||
// B-4
|
||||
|
||||
bufferSubData : {
|
||||
setup : function() {
|
||||
var buf = GL.createBuffer();
|
||||
var ebuf = GL.createBuffer();
|
||||
GL.bindBuffer(GL.ARRAY_BUFFER, buf);
|
||||
GL.bufferData(GL.ARRAY_BUFFER, 256, GL.STATIC_DRAW);
|
||||
GL.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, ebuf);
|
||||
GL.bufferData(GL.ELEMENT_ARRAY_BUFFER, 256, GL.STATIC_DRAW);
|
||||
return [buf, ebuf];
|
||||
},
|
||||
generate : function(buf, ebuf) {
|
||||
var d = randomBufferSubData(256);
|
||||
return [bufferTarget.random(), d.offset, d.data];
|
||||
},
|
||||
checkArgValidity : function(target, offset, data) {
|
||||
return bufferTarget.has(target) && offset >= 0 && data.byteLength >= 0 && offset + data.byteLength <= 256;
|
||||
},
|
||||
teardown : function(buf, ebuf) {
|
||||
GL.deleteBuffer(buf);
|
||||
GL.deleteBuffer(ebuf);
|
||||
},
|
||||
}
|
||||
|
||||
};
|
@ -0,0 +1,113 @@
|
||||
// ArgGenerators contains argument generators for WebGL functions.
|
||||
// The argument generators are used for running random tests against the WebGL
|
||||
// functions.
|
||||
//
|
||||
// ArgGenerators is an object consisting of functionName : argGen -properties.
|
||||
//
|
||||
// functionName is a WebGL context function name and the argGen is an argument
|
||||
// generator object that encapsulates the requirements to run
|
||||
// randomly generated tests on the WebGL function.
|
||||
//
|
||||
// An argGen object has the following methods:
|
||||
// - setup -- set up state for testing the GL function, returns values
|
||||
// that need cleanup in teardown. Run once before entering a
|
||||
// test loop.
|
||||
// - teardown -- do cleanup on setup's return values after testing is complete
|
||||
// - generate -- generate a valid set of random arguments for the GL function
|
||||
// - returnValueCleanup -- do cleanup on value returned by the tested GL function
|
||||
// - cleanup -- do cleanup on generated arguments from generate
|
||||
// - checkArgValidity -- check if passed args are valid. Has a call signature
|
||||
// that matches generate's return value. Returns true
|
||||
// if args are valid, false if not.
|
||||
//
|
||||
// Example test loop that demonstrates how the function args and return
|
||||
// values flow together:
|
||||
//
|
||||
// var setupArgs = argGen.setup();
|
||||
// for (var i=0; i<numberOfTests; i++) {
|
||||
// var generatedArgs = argGen.generate.apply(argGen, setupArgs);
|
||||
// var validArgs = argGen.checkArgValidity.apply(argGen, generatedArgs);
|
||||
// var rv = call the GL function with generatedArgs;
|
||||
// argGen.returnValueCleanup(rv);
|
||||
// argGen.cleanup.apply(argGen, generatedArgs);
|
||||
// }
|
||||
// argGen.teardown.apply(argGen, setupArgs);
|
||||
//
|
||||
ArgGenerators = {
|
||||
|
||||
// GL functions in alphabetical order
|
||||
|
||||
// C
|
||||
|
||||
checkFramebufferStatus : {
|
||||
generate : function() {
|
||||
return [Math.random() > 0.5 ? null : GL.createFramebuffer()];
|
||||
},
|
||||
checkArgValidity : function(fbo) {
|
||||
if (fbo != null)
|
||||
GL.bindFramebuffer(GL.FRAMEBUFFER, fbo);
|
||||
return fbo == null || GL.isFramebuffer(fbo);
|
||||
},
|
||||
cleanup : function(fbo){
|
||||
GL.bindFramebuffer(GL.FRAMEBUFFER, null);
|
||||
if (fbo != null)
|
||||
try{ GL.deleteFramebuffer(fbo); } catch(e) {}
|
||||
}
|
||||
},
|
||||
clear : {
|
||||
generate : function() { return [clearMask.random()]; },
|
||||
checkArgValidity : function(mask) { return clearMask.has(mask); }
|
||||
},
|
||||
clearColor : {
|
||||
generate : function() { return randomColor(); },
|
||||
teardown : function() { GL.clearColor(0,0,0,0); }
|
||||
},
|
||||
clearDepth : {
|
||||
generate : function() { return [Math.random()]; },
|
||||
teardown : function() { GL.clearDepth(1); }
|
||||
},
|
||||
clearStencil : {
|
||||
generate : function() { return [randomStencil()]; },
|
||||
teardown : function() { GL.clearStencil(0); }
|
||||
},
|
||||
colorMask : {
|
||||
generate : function() {
|
||||
return [randomBool(), randomBool(), randomBool(), randomBool()];
|
||||
},
|
||||
teardown : function() { GL.colorMask(true, true, true, true); }
|
||||
},
|
||||
compileShader : {}, // FIXME
|
||||
copyTexImage2D : {}, // FIXME
|
||||
copyTexSubImage2D : {}, // FIXME
|
||||
createBuffer : {
|
||||
generate : function() { return []; },
|
||||
returnValueCleanup : function(o) { GL.deleteBuffer(o); }
|
||||
},
|
||||
createFramebuffer : {
|
||||
generate : function() { return []; },
|
||||
returnValueCleanup : function(o) { GL.deleteFramebuffer(o); }
|
||||
},
|
||||
createProgram : {
|
||||
generate : function() { return []; },
|
||||
returnValueCleanup : function(o) { GL.deleteProgram(o); }
|
||||
},
|
||||
createRenderbuffer : {
|
||||
generate : function() { return []; },
|
||||
returnValueCleanup : function(o) { GL.deleteRenderbuffer(o); }
|
||||
},
|
||||
createShader : {
|
||||
generate : function() { return [shaderType.random()]; },
|
||||
checkArgValidity : function(t) { return shaderType.has(t); },
|
||||
returnValueCleanup : function(o) { GL.deleteShader(o); }
|
||||
},
|
||||
createTexture : {
|
||||
generate : function() { return []; },
|
||||
returnValueCleanup : function(o) { GL.deleteTexture(o); }
|
||||
},
|
||||
cullFace : {
|
||||
generate : function() { return [cullFace.random()]; },
|
||||
checkArgValidity : function(f) { return cullFace.has(f); },
|
||||
teardown : function() { GL.cullFace(GL.BACK); }
|
||||
}
|
||||
|
||||
};
|
@ -0,0 +1,229 @@
|
||||
// ArgGenerators contains argument generators for WebGL functions.
|
||||
// The argument generators are used for running random tests against the WebGL
|
||||
// functions.
|
||||
//
|
||||
// ArgGenerators is an object consisting of functionName : argGen -properties.
|
||||
//
|
||||
// functionName is a WebGL context function name and the argGen is an argument
|
||||
// generator object that encapsulates the requirements to run
|
||||
// randomly generated tests on the WebGL function.
|
||||
//
|
||||
// An argGen object has the following methods:
|
||||
// - setup -- set up state for testing the GL function, returns values
|
||||
// that need cleanup in teardown. Run once before entering a
|
||||
// test loop.
|
||||
// - teardown -- do cleanup on setup's return values after testing is complete
|
||||
// - generate -- generate a valid set of random arguments for the GL function
|
||||
// - returnValueCleanup -- do cleanup on value returned by the tested GL function
|
||||
// - cleanup -- do cleanup on generated arguments from generate
|
||||
// - checkArgValidity -- check if passed args are valid. Has a call signature
|
||||
// that matches generate's return value. Returns true
|
||||
// if args are valid, false if not.
|
||||
//
|
||||
// Example test loop that demonstrates how the function args and return
|
||||
// values flow together:
|
||||
//
|
||||
// var setupArgs = argGen.setup();
|
||||
// for (var i=0; i<numberOfTests; i++) {
|
||||
// var generatedArgs = argGen.generate.apply(argGen, setupArgs);
|
||||
// var validArgs = argGen.checkArgValidity.apply(argGen, generatedArgs);
|
||||
// var rv = call the GL function with generatedArgs;
|
||||
// argGen.returnValueCleanup(rv);
|
||||
// argGen.cleanup.apply(argGen, generatedArgs);
|
||||
// }
|
||||
// argGen.teardown.apply(argGen, setupArgs);
|
||||
//
|
||||
ArgGenerators = {
|
||||
|
||||
// GL functions in alphabetical order
|
||||
|
||||
// D
|
||||
|
||||
deleteBuffer : {
|
||||
generate : function() { return [GL.createBuffer()]; },
|
||||
checkArgValidity : function(o) {
|
||||
GL.bindBuffer(GL.ARRAY_BUFFER, o);
|
||||
return GL.isBuffer(o);
|
||||
},
|
||||
cleanup : function(o) {
|
||||
GL.bindBuffer(GL.ARRAY_BUFFER, null);
|
||||
try { GL.deleteBuffer(o); } catch(e) {}
|
||||
}
|
||||
},
|
||||
deleteFramebuffer : {
|
||||
generate : function() { return [GL.createFramebuffer()]; },
|
||||
checkArgValidity : function(o) {
|
||||
GL.bindFramebuffer(GL.FRAMEBUFFER, o);
|
||||
return GL.isFramebuffer(o);
|
||||
},
|
||||
cleanup : function(o) {
|
||||
GL.bindFramebuffer(GL.FRAMEBUFFER, null);
|
||||
try { GL.deleteFramebuffer(o); } catch(e) {}
|
||||
}
|
||||
},
|
||||
deleteProgram : {
|
||||
generate : function() { return [GL.createProgram()]; },
|
||||
checkArgValidity : function(o) { return GL.isProgram(o); },
|
||||
cleanup : function(o) { try { GL.deleteProgram(o); } catch(e) {} }
|
||||
},
|
||||
deleteRenderbuffer : {
|
||||
generate : function() { return [GL.createRenderbuffer()]; },
|
||||
checkArgValidity : function(o) {
|
||||
GL.bindRenderbuffer(GL.RENDERBUFFER, o);
|
||||
return GL.isRenderbuffer(o);
|
||||
},
|
||||
cleanup : function(o) {
|
||||
GL.bindRenderbuffer(GL.RENDERBUFFER, null);
|
||||
try { GL.deleteRenderbuffer(o); } catch(e) {}
|
||||
}
|
||||
},
|
||||
deleteShader : {
|
||||
generate : function() { return [GL.createShader(shaderType.random())]; },
|
||||
checkArgValidity : function(o) { return GL.isShader(o); },
|
||||
cleanup : function(o) { try { GL.deleteShader(o); } catch(e) {} }
|
||||
},
|
||||
deleteTexture : {
|
||||
generate : function() { return [GL.createTexture()]; },
|
||||
checkArgValidity : function(o) {
|
||||
GL.bindTexture(GL.TEXTURE_2D, o);
|
||||
return GL.isTexture(o);
|
||||
},
|
||||
cleanup : function(o) {
|
||||
GL.bindTexture(GL.TEXTURE_2D, null);
|
||||
try { GL.deleteTexture(o); } catch(e) {}
|
||||
}
|
||||
},
|
||||
depthFunc : {
|
||||
generate : function() { return [depthFuncFunc.random()]; },
|
||||
checkArgValidity : function(f) { return depthFuncFunc.has(f); },
|
||||
teardown : function() { GL.depthFunc(GL.LESS); }
|
||||
},
|
||||
depthMask : {
|
||||
generate : function() { return [randomBool()]; },
|
||||
teardown : function() { GL.depthFunc(GL.TRUE); }
|
||||
},
|
||||
depthRange : {
|
||||
generate : function() { return [Math.random(), Math.random()]; },
|
||||
teardown : function() { GL.depthRange(0, 1); }
|
||||
},
|
||||
detachShader : {
|
||||
generate : function() {
|
||||
var p = GL.createProgram();
|
||||
var sh = GL.createShader(shaderType.random());
|
||||
GL.attachShader(p, sh);
|
||||
return [p, sh];
|
||||
},
|
||||
checkArgValidity : function(p, sh) {
|
||||
return GL.isProgram(p) && GL.isShader(sh) && GL.getAttachedShaders(p).has(sh);
|
||||
},
|
||||
cleanup : function(p, sh) {
|
||||
try {GL.deleteProgram(p);} catch(e) {}
|
||||
try {GL.deleteShader(sh);} catch(e) {}
|
||||
}
|
||||
},
|
||||
disable : {
|
||||
generate : function() { return [enableCap.random()]; },
|
||||
checkArgValidity : function(c) { return enableCap.has(c); },
|
||||
cleanup : function(c) { if (c == GL.DITHER) GL.enable(c); }
|
||||
},
|
||||
disableVertexAttribArray : {
|
||||
generate : function() { return [randomVertexAttribute()]; },
|
||||
checkArgValidity : function(v) { return isVertexAttribute(v); }
|
||||
},
|
||||
drawArrays : {}, // FIXME
|
||||
drawElements : {}, // FIXME
|
||||
|
||||
// E
|
||||
|
||||
enable : {
|
||||
generate : function() { return [enableCap.random()]; },
|
||||
checkArgValidity : function(c) { return enableCap.has(c); },
|
||||
cleanup : function(c) { if (c != GL.DITHER) GL.disable(c); }
|
||||
},
|
||||
enableVertexAttribArray : {
|
||||
generate : function() { return [randomVertexAttribute()]; },
|
||||
checkArgValidity : function(v) { return isVertexAttribute(castToInt(v)); },
|
||||
cleanup : function(v) { GL.disableVertexAttribArray(v); }
|
||||
},
|
||||
|
||||
// F
|
||||
|
||||
finish : {
|
||||
generate : function() { return []; }
|
||||
},
|
||||
flush : {
|
||||
generate : function() { return []; }
|
||||
},
|
||||
framebufferRenderbuffer : {}, // FIXME
|
||||
framebufferTexture2D : {}, // FIXME
|
||||
frontFace : {
|
||||
generate : function() { return [frontFaceMode.random()]; },
|
||||
checkArgValidity : function(c) { return frontFaceMode.has(c); },
|
||||
cleanup : function(c) { GL.frontFace(GL.CCW); }
|
||||
},
|
||||
|
||||
// G-1
|
||||
|
||||
generateMipmap : {
|
||||
setup : function() {
|
||||
var tex = GL.createTexture();
|
||||
var tex2 = GL.createTexture();
|
||||
GL.bindTexture(GL.TEXTURE_2D, tex);
|
||||
GL.bindTexture(GL.TEXTURE_CUBE_MAP, tex2);
|
||||
var pix = new Uint8Array(16*16*4);
|
||||
GL.texImage2D(GL.TEXTURE_2D, 0, GL.RGBA, 16, 16, 0, GL.RGBA, GL.UNSIGNED_BYTE, pix);
|
||||
GL.texImage2D(GL.TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL.RGBA, 16, 16, 0, GL.RGBA, GL.UNSIGNED_BYTE, pix);
|
||||
GL.texImage2D(GL.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL.RGBA, 16, 16, 0, GL.RGBA, GL.UNSIGNED_BYTE, pix);
|
||||
GL.texImage2D(GL.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL.RGBA, 16, 16, 0, GL.RGBA, GL.UNSIGNED_BYTE, pix);
|
||||
GL.texImage2D(GL.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL.RGBA, 16, 16, 0, GL.RGBA, GL.UNSIGNED_BYTE, pix);
|
||||
GL.texImage2D(GL.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL.RGBA, 16, 16, 0, GL.RGBA, GL.UNSIGNED_BYTE, pix);
|
||||
GL.texImage2D(GL.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL.RGBA, 16, 16, 0, GL.RGBA, GL.UNSIGNED_BYTE, pix);
|
||||
},
|
||||
generate : function() { return [bindTextureTarget.random()]; },
|
||||
checkArgValidity : function(t) { return bindTextureTarget.has(t); },
|
||||
teardown : function(tex, tex2) {
|
||||
GL.bindTexture(GL.TEXTURE_2D, null);
|
||||
GL.bindTexture(GL.TEXTURE_CUBE_MAP, null);
|
||||
GL.deleteTexture(tex);
|
||||
GL.deleteTexture(tex2);
|
||||
}
|
||||
},
|
||||
getActiveAttrib : {
|
||||
/* FIXME the queried attrib needs to be an active one
|
||||
generate : function() {
|
||||
var program = GL.createProgram();
|
||||
return [program, randomVertexAttribute()];
|
||||
},
|
||||
checkArgValidity : function(program, index) {
|
||||
return GL.isProgram(program) && isVertexAttribute(index);
|
||||
},
|
||||
cleanup : function(program, index) {
|
||||
GL.deleteProgram(program);
|
||||
}
|
||||
*/
|
||||
},
|
||||
getActiveUniform : {}, // FIXME
|
||||
getAttachedShaders : {
|
||||
setup : function() {
|
||||
var program = GL.createProgram();
|
||||
var s1 = GL.createShader(GL.VERTEX_SHADER);
|
||||
var s2 = GL.createShader(GL.FRAGMENT_SHADER);
|
||||
GL.attachShader(program, s1);
|
||||
GL.attachShader(program, s2);
|
||||
return [program, s1, s2];
|
||||
},
|
||||
generate : function(program, s1, s2) {
|
||||
return [program]
|
||||
},
|
||||
checkArgValidity : function(program) {
|
||||
return GL.isProgram(program);
|
||||
},
|
||||
teardown : function(program, s1, s2) {
|
||||
GL.deleteProgram(program);
|
||||
GL.deleteShader(s1);
|
||||
GL.deleteShader(s2);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -0,0 +1,118 @@
|
||||
// ArgGenerators contains argument generators for WebGL functions.
|
||||
// The argument generators are used for running random tests against the WebGL
|
||||
// functions.
|
||||
//
|
||||
// ArgGenerators is an object consisting of functionName : argGen -properties.
|
||||
//
|
||||
// functionName is a WebGL context function name and the argGen is an argument
|
||||
// generator object that encapsulates the requirements to run
|
||||
// randomly generated tests on the WebGL function.
|
||||
//
|
||||
// An argGen object has the following methods:
|
||||
// - setup -- set up state for testing the GL function, returns values
|
||||
// that need cleanup in teardown. Run once before entering a
|
||||
// test loop.
|
||||
// - teardown -- do cleanup on setup's return values after testing is complete
|
||||
// - generate -- generate a valid set of random arguments for the GL function
|
||||
// - returnValueCleanup -- do cleanup on value returned by the tested GL function
|
||||
// - cleanup -- do cleanup on generated arguments from generate
|
||||
// - checkArgValidity -- check if passed args are valid. Has a call signature
|
||||
// that matches generate's return value. Returns true
|
||||
// if args are valid, false if not.
|
||||
//
|
||||
// Example test loop that demonstrates how the function args and return
|
||||
// values flow together:
|
||||
//
|
||||
// var setupArgs = argGen.setup();
|
||||
// for (var i=0; i<numberOfTests; i++) {
|
||||
// var generatedArgs = argGen.generate.apply(argGen, setupArgs);
|
||||
// var validArgs = argGen.checkArgValidity.apply(argGen, generatedArgs);
|
||||
// var rv = call the GL function with generatedArgs;
|
||||
// argGen.returnValueCleanup(rv);
|
||||
// argGen.cleanup.apply(argGen, generatedArgs);
|
||||
// }
|
||||
// argGen.teardown.apply(argGen, setupArgs);
|
||||
//
|
||||
ArgGenerators = {
|
||||
|
||||
// GL functions in alphabetical order
|
||||
|
||||
// G-2
|
||||
|
||||
getAttribLocation : {
|
||||
generate : function() {
|
||||
var program = GL.createProgram();
|
||||
var name = randomName();
|
||||
GL.bindAttribLocation(program, randomVertexAttribute(), name);
|
||||
return [program, name];
|
||||
},
|
||||
checkArgValidity : function(program, name) {
|
||||
return GL.isProgram(program) && isValidName(name);
|
||||
},
|
||||
cleanup : function(program, name) {
|
||||
try { GL.deleteProgram(program); } catch(e) {}
|
||||
}
|
||||
},/*
|
||||
getParameter : {
|
||||
generate : function() { return [getParameterPname.random()]; },
|
||||
checkArgValidity : function(p) { return getParameterPname.has(p); }
|
||||
},
|
||||
getBufferParameter : {}, // FIXME
|
||||
getError : {
|
||||
generate : function() { return []; }
|
||||
},
|
||||
getFramebufferAttachmentParameter : {}, // FIXME
|
||||
getProgramParameter : {}, // FIXME
|
||||
getProgramInfoLog : {}, // FIXME
|
||||
getRenderbufferParameter : {}, // FIXME
|
||||
getShaderParameter : {}, // FIXME
|
||||
getShaderInfoLog : {}, // FIXME
|
||||
getShaderSource : {}, // FIXME
|
||||
getTexParameter : {}, // FIXME
|
||||
getUniform : {}, // FIXME
|
||||
getUniformLocation : {}, // FIXME
|
||||
getVertexAttrib : {}, // FIXME
|
||||
getVertexAttribOffset : {}, // FIXME
|
||||
|
||||
// H
|
||||
|
||||
hint : {
|
||||
generate : function() { return [GL.GENERATE_MIPMAP_HINT, mipmapHint.random()]; },
|
||||
checkValidArgs : function(h, m) {
|
||||
return h == GL.GENERATE_MIPMAP_HINT && mipmapHint.has(m);
|
||||
},
|
||||
teardown : function(){ GL.hint(GL.GENERATE_MIPMAP_HINT, GL.DONT_CARE); }
|
||||
},
|
||||
|
||||
// I
|
||||
|
||||
isBuffer : {
|
||||
generate : function() { return [GL.createBuffer()]; },
|
||||
cleanup : function(o) { try { GL.deleteBuffer(o); } catch(e) {} }
|
||||
},
|
||||
isEnabled : {
|
||||
generate : function() { return [enableCap.random()]; },
|
||||
checkArgValidity : function(c) { return enableCap.has(c); }
|
||||
},
|
||||
isFramebuffer : {
|
||||
generate : function() { return [GL.createFramebuffer()]; },
|
||||
cleanup : function(o) { try { GL.deleteFramebuffer(o); } catch(e) {} }
|
||||
},
|
||||
isProgram : {
|
||||
generate : function() { return [GL.createProgram()]; },
|
||||
cleanup : function(o) { try { GL.deleteProgram(o); } catch(e) {} }
|
||||
},
|
||||
isRenderbuffer : {
|
||||
generate : function() { return [GL.createRenderbuffer()]; },
|
||||
cleanup : function(o) { try { GL.deleteRenderbuffer(o); } catch(e) {} }
|
||||
},
|
||||
isShader : {
|
||||
generate : function() { return [GL.createShader(shaderType.random())]; },
|
||||
cleanup : function(o) { try { GL.deleteShader(o); } catch(e) {} }
|
||||
},
|
||||
isTexture : {
|
||||
generate : function() { return [GL.createTexture()]; },
|
||||
cleanup : function(o) { try { GL.deleteTexture(o); } catch(e) {} }
|
||||
}*/
|
||||
|
||||
};
|
@ -0,0 +1,116 @@
|
||||
// ArgGenerators contains argument generators for WebGL functions.
|
||||
// The argument generators are used for running random tests against the WebGL
|
||||
// functions.
|
||||
//
|
||||
// ArgGenerators is an object consisting of functionName : argGen -properties.
|
||||
//
|
||||
// functionName is a WebGL context function name and the argGen is an argument
|
||||
// generator object that encapsulates the requirements to run
|
||||
// randomly generated tests on the WebGL function.
|
||||
//
|
||||
// An argGen object has the following methods:
|
||||
// - setup -- set up state for testing the GL function, returns values
|
||||
// that need cleanup in teardown. Run once before entering a
|
||||
// test loop.
|
||||
// - teardown -- do cleanup on setup's return values after testing is complete
|
||||
// - generate -- generate a valid set of random arguments for the GL function
|
||||
// - returnValueCleanup -- do cleanup on value returned by the tested GL function
|
||||
// - cleanup -- do cleanup on generated arguments from generate
|
||||
// - checkArgValidity -- check if passed args are valid. Has a call signature
|
||||
// that matches generate's return value. Returns true
|
||||
// if args are valid, false if not.
|
||||
//
|
||||
// Example test loop that demonstrates how the function args and return
|
||||
// values flow together:
|
||||
//
|
||||
// var setupArgs = argGen.setup();
|
||||
// for (var i=0; i<numberOfTests; i++) {
|
||||
// var generatedArgs = argGen.generate.apply(argGen, setupArgs);
|
||||
// var validArgs = argGen.checkArgValidity.apply(argGen, generatedArgs);
|
||||
// var rv = call the GL function with generatedArgs;
|
||||
// argGen.returnValueCleanup(rv);
|
||||
// argGen.cleanup.apply(argGen, generatedArgs);
|
||||
// }
|
||||
// argGen.teardown.apply(argGen, setupArgs);
|
||||
//
|
||||
ArgGenerators = {
|
||||
|
||||
// GL functions in alphabetical order
|
||||
|
||||
// L
|
||||
|
||||
lineWidth : {
|
||||
generate : function() { return [randomLineWidth()]; },
|
||||
teardown : function() { GL.lineWidth(1); }
|
||||
},
|
||||
linkProgram : {}, // FIXME
|
||||
|
||||
// P
|
||||
pixelStorei : {
|
||||
generate : function() {
|
||||
return [pixelStoreiPname.random(), pixelStoreiParam.random()];
|
||||
},
|
||||
checkArgValidity : function(pname, param) {
|
||||
return pixelStoreiPname.has(pname) && pixelStoreiParam.has(param);
|
||||
},
|
||||
teardown : function() {
|
||||
GL.pixelStorei(GL.PACK_ALIGNMENT, 4);
|
||||
GL.pixelStorei(GL.UNPACK_ALIGNMENT, 4);
|
||||
}
|
||||
},
|
||||
polygonOffset : {
|
||||
generate : function() { return [randomFloat(), randomFloat()]; },
|
||||
teardown : function() { GL.polygonOffset(0,0); }
|
||||
},
|
||||
|
||||
// R
|
||||
|
||||
readPixels : {}, // FIXME
|
||||
renderbufferStorage : {}, // FIXME
|
||||
|
||||
// S-1
|
||||
|
||||
sampleCoverage : {
|
||||
generate : function() { return [randomFloatFromRange(0,1), randomBool()] },
|
||||
teardown : function() { GL.sampleCoverage(1, false); }
|
||||
},
|
||||
scissor : {
|
||||
generate : function() {
|
||||
return [randomInt(3000)-1500, randomInt(3000)-1500, randomIntFromRange(0,3000), randomIntFromRange(0,3000)];
|
||||
},
|
||||
checkArgValidity : function(x,y,w,h) {
|
||||
return castToInt(w) >= 0 && castToInt(h) >= 0;
|
||||
},
|
||||
teardown : function() {
|
||||
GL.scissor(0,0,GL.canvas.width, GL.canvas.height);
|
||||
}
|
||||
},
|
||||
shaderSource : {}, // FIXME
|
||||
stencilFunc : {
|
||||
generate : function(){
|
||||
return [stencilFuncFunc.random(), randomInt(MaxStencilValue), randomInt(0xffffffff)];
|
||||
},
|
||||
checkArgValidity : function(func, ref, mask) {
|
||||
return stencilFuncFunc.has(func) && castToInt(ref) >= 0 && castToInt(ref) < MaxStencilValue;
|
||||
},
|
||||
teardown : function() {
|
||||
GL.stencilFunc(GL.ALWAYS, 0, 0xffffffff);
|
||||
}
|
||||
},
|
||||
stencilFuncSeparate : {
|
||||
generate : function(){
|
||||
return [cullFace.random(), stencilFuncFunc.random(), randomInt(MaxStencilValue), randomInt(0xffffffff)];
|
||||
},
|
||||
checkArgValidity : function(face, func, ref, mask) {
|
||||
return cullFace.has(face) && stencilFuncFunc.has(func) && castToInt(ref) >= 0 && castToInt(ref) < MaxStencilValue;
|
||||
},
|
||||
teardown : function() {
|
||||
GL.stencilFunc(GL.ALWAYS, 0, 0xffffffff);
|
||||
}
|
||||
},
|
||||
stencilMask : {
|
||||
generate : function() { return [randomInt(0xffffffff)]; },
|
||||
teardown : function() { GL.stencilMask(0xffffffff); }
|
||||
}
|
||||
|
||||
};
|
@ -0,0 +1,206 @@
|
||||
// ArgGenerators contains argument generators for WebGL functions.
|
||||
// The argument generators are used for running random tests against the WebGL
|
||||
// functions.
|
||||
//
|
||||
// ArgGenerators is an object consisting of functionName : argGen -properties.
|
||||
//
|
||||
// functionName is a WebGL context function name and the argGen is an argument
|
||||
// generator object that encapsulates the requirements to run
|
||||
// randomly generated tests on the WebGL function.
|
||||
//
|
||||
// An argGen object has the following methods:
|
||||
// - setup -- set up state for testing the GL function, returns values
|
||||
// that need cleanup in teardown. Run once before entering a
|
||||
// test loop.
|
||||
// - teardown -- do cleanup on setup's return values after testing is complete
|
||||
// - generate -- generate a valid set of random arguments for the GL function
|
||||
// - returnValueCleanup -- do cleanup on value returned by the tested GL function
|
||||
// - cleanup -- do cleanup on generated arguments from generate
|
||||
// - checkArgValidity -- check if passed args are valid. Has a call signature
|
||||
// that matches generate's return value. Returns true
|
||||
// if args are valid, false if not.
|
||||
//
|
||||
// Example test loop that demonstrates how the function args and return
|
||||
// values flow together:
|
||||
//
|
||||
// var setupArgs = argGen.setup();
|
||||
// for (var i=0; i<numberOfTests; i++) {
|
||||
// var generatedArgs = argGen.generate.apply(argGen, setupArgs);
|
||||
// var validArgs = argGen.checkArgValidity.apply(argGen, generatedArgs);
|
||||
// var rv = call the GL function with generatedArgs;
|
||||
// argGen.returnValueCleanup(rv);
|
||||
// argGen.cleanup.apply(argGen, generatedArgs);
|
||||
// }
|
||||
// argGen.teardown.apply(argGen, setupArgs);
|
||||
//
|
||||
ArgGenerators = {
|
||||
|
||||
// GL functions in alphabetical order
|
||||
|
||||
// S-2
|
||||
|
||||
stencilMaskSeparate : {
|
||||
generate : function() { return [cullFace.random(), randomInt(0xffffffff)]; },
|
||||
checkArgValidity : function(face, mask) {
|
||||
return cullFace.has(face);
|
||||
},
|
||||
teardown : function() { GL.stencilMask(0xffffffff); }
|
||||
},
|
||||
stencilOp : {
|
||||
generate : function() {
|
||||
return [stencilOp.random(), stencilOp.random(), stencilOp.random()];
|
||||
},
|
||||
checkArgValidity : function(sfail, dpfail, dppass) {
|
||||
return stencilOp.has(sfail) && stencilOp.has(dpfail) && stencilOp.has(dppass);
|
||||
},
|
||||
teardown : function() { GL.stencilOp(GL.KEEP, GL.KEEP, GL.KEEP); }
|
||||
},
|
||||
stencilOpSeparate : {
|
||||
generate : function() {
|
||||
return [cullFace.random(), stencilOp.random(), stencilOp.random(), stencilOp.random()];
|
||||
},
|
||||
checkArgValidity : function(face, sfail, dpfail, dppass) {
|
||||
return cullFace.has(face) && stencilOp.has(sfail) &&
|
||||
stencilOp.has(dpfail) && stencilOp.has(dppass);
|
||||
},
|
||||
teardown : function() { GL.stencilOp(GL.KEEP, GL.KEEP, GL.KEEP); }
|
||||
},
|
||||
|
||||
// T
|
||||
texImage2D : {
|
||||
noAlreadyTriedCheck : true, // Object.toSource is very slow here
|
||||
setup : function() {
|
||||
var tex = GL.createTexture();
|
||||
var tex2 = GL.createTexture();
|
||||
GL.bindTexture(GL.TEXTURE_2D, tex);
|
||||
GL.bindTexture(GL.TEXTURE_CUBE_MAP, tex2);
|
||||
return [tex, tex2];
|
||||
},
|
||||
generate : function() {
|
||||
var format = texImageFormat.random();
|
||||
if (Math.random() < 0.5) {
|
||||
var img = randomImage(16,16);
|
||||
var a = [ texImageTarget.random(), 0, format, format, GL.UNSIGNED_BYTE, img ];
|
||||
return a;
|
||||
} else {
|
||||
var pix = null;
|
||||
if (Math.random > 0.5) {
|
||||
pix = new Uint8Array(16*16*4);
|
||||
}
|
||||
return [
|
||||
texImageTarget.random(), 0,
|
||||
format, 16, 16, 0,
|
||||
format, GL.UNSIGNED_BYTE, pix
|
||||
];
|
||||
}
|
||||
},
|
||||
checkArgValidity : function(target, level, internalformat, width, height, border, format, type, data) {
|
||||
// or : function(target, level, internalformat, format, type, image)
|
||||
if (!texImageTarget.has(target) || castToInt(level) < 0)
|
||||
return false;
|
||||
if (arguments.length <= 6) {
|
||||
var xformat = width;
|
||||
var xtype = height;
|
||||
var ximage = border;
|
||||
if ((ximage instanceof HTMLImageElement ||
|
||||
ximage instanceof HTMLVideoElement ||
|
||||
ximage instanceof HTMLCanvasElement ||
|
||||
ximage instanceof ImageData) &&
|
||||
texImageInternalFormat.has(internalformat) &&
|
||||
texImageFormat.has(xformat) &&
|
||||
texImageType.has(xtype) &&
|
||||
internalformat == xformat)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
var w = castToInt(width), h = castToInt(height), b = castToInt(border);
|
||||
return texImageInternalFormat.has(internalformat) && w >= 0 && h >= 0 &&
|
||||
b == 0 && (data == null || data.byteLength == w*h*4) &&
|
||||
texImageFormat.has(format) && texImageType.has(type)
|
||||
&& internalformat == format;
|
||||
},
|
||||
teardown : function(tex, tex2) {
|
||||
GL.bindTexture(GL.TEXTURE_2D, null);
|
||||
GL.bindTexture(GL.TEXTURE_CUBE_MAP, null);
|
||||
GL.deleteTexture(tex);
|
||||
GL.deleteTexture(tex2);
|
||||
}
|
||||
},
|
||||
texParameterf : {
|
||||
generate : function() {
|
||||
var pname = texParameterPname.random();
|
||||
var param = texParameterParam[pname].random();
|
||||
return [bindTextureTarget.random(), pname, param];
|
||||
},
|
||||
checkArgValidity : function(target, pname, param) {
|
||||
if (!bindTextureTarget.has(target))
|
||||
return false;
|
||||
if (!texParameterPname.has(pname))
|
||||
return false;
|
||||
return texParameterParam[pname].has(param);
|
||||
}
|
||||
},
|
||||
texParameteri : {
|
||||
generate : function() {
|
||||
var pname = texParameterPname.random();
|
||||
var param = texParameterParam[pname].random();
|
||||
return [bindTextureTarget.random(), pname, param];
|
||||
},
|
||||
checkArgValidity : function(target, pname, param) {
|
||||
if (!bindTextureTarget.has(target))
|
||||
return false;
|
||||
if (!texParameterPname.has(pname))
|
||||
return false;
|
||||
return texParameterParam[pname].has(param);
|
||||
}
|
||||
},
|
||||
texSubImage2D : {}, // FIXME
|
||||
|
||||
// U
|
||||
|
||||
uniform1f : {}, // FIXME
|
||||
uniform1fv : {}, // FIXME
|
||||
uniform1i : {}, // FIXME
|
||||
uniform1iv : {}, // FIXME
|
||||
uniform2f : {}, // FIXME
|
||||
uniform2fv : {}, // FIXME
|
||||
uniform2i : {}, // FIXME
|
||||
uniform2iv : {}, // FIXME
|
||||
uniform3f : {}, // FIXME
|
||||
uniform3fv : {}, // FIXME
|
||||
uniform3i : {}, // FIXME
|
||||
uniform3iv : {}, // FIXME
|
||||
uniform4f : {}, // FIXME
|
||||
uniform4fv : {}, // FIXME
|
||||
uniform4i : {}, // FIXME
|
||||
uniform4iv : {}, // FIXME
|
||||
uniformMatrix2fv : {}, // FIXME
|
||||
uniformMatrix3fv : {}, // FIXME
|
||||
uniformMatrix4fv : {}, // FIXME
|
||||
useProgram : {}, // FIXME
|
||||
|
||||
// V
|
||||
|
||||
validateProgram : {}, // FIXME
|
||||
vertexAttrib1f : {}, // FIXME
|
||||
vertexAttrib1fv : {}, // FIXME
|
||||
vertexAttrib2f : {}, // FIXME
|
||||
vertexAttrib2fv : {}, // FIXME
|
||||
vertexAttrib3f : {}, // FIXME
|
||||
vertexAttrib3fv : {}, // FIXME
|
||||
vertexAttrib4f : {}, // FIXME
|
||||
vertexAttrib4fv : {}, // FIXME
|
||||
vertexAttribPointer : {}, // FIXME
|
||||
viewport : {
|
||||
generate : function() {
|
||||
return [randomInt(3000)-1500, randomInt(3000)-1500, randomIntFromRange(0,3000), randomIntFromRange(0,3000)];
|
||||
},
|
||||
checkArgValidity : function(x,y,w,h) {
|
||||
return castToInt(w) >= 0 && castToInt(h) >= 0;
|
||||
},
|
||||
teardown : function() {
|
||||
GL.viewport(0,0,GL.canvas.width, GL.canvas.height);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="../unit.css" />
|
||||
<script type="application/x-javascript" src="../unit.js"></script>
|
||||
<script type="application/x-javascript" src="../util.js"></script>
|
||||
<script type="application/x-javascript" src="quickCheckAPI.js"></script>
|
||||
<script type="application/x-javascript" src="argGenerators-A.js"></script>
|
||||
|
||||
<script type="application/x-javascript">
|
||||
|
||||
// Test that all GL functions specified in ArgGenerators work
|
||||
// when called with randomly generated valid arguments
|
||||
Tests.testValidArgs = function() {
|
||||
var randomTestCount = 100;
|
||||
for (var name in ArgGenerators) {
|
||||
try {
|
||||
if (!GL[name])
|
||||
throw (new Error(name + " is missing from the WebGL context"));
|
||||
var argGen = ArgGenerators[name];
|
||||
var alreadyTriedArgs = {};
|
||||
if (!argGen.generate) continue;
|
||||
// test each GL function with randomTestCount randomly generated valid args
|
||||
argGeneratorTestRunner(argGen, function(args, gen, setupVars) {
|
||||
if (!gen.noAlreadyTriedCheck) {
|
||||
var src = Object.toSource(args);
|
||||
if (alreadyTriedArgs[src])
|
||||
return true;
|
||||
|
||||
alreadyTriedArgs[src] = true;
|
||||
}
|
||||
var ok = false;
|
||||
// if we have an validity checker, assert that the generated args are valid
|
||||
if (gen.checkArgValidity)
|
||||
assert("Valid args: "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
gen.checkArgValidity.apply(gen, args));
|
||||
var rv;
|
||||
// assert that GL function works when called with valid args
|
||||
assertOk("This should work: "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
function(){rv = GL[name].apply(GL, args); ok = true;});
|
||||
// if we need to cleanup the return value, do it here
|
||||
// e.g. calling gl.deleteBuffer(rv) after testing gl.createBuffer() above
|
||||
if (gen.returnValueCleanup)
|
||||
assertOk("Cleaning up return value after "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
function() { gen.returnValueCleanup(rv); });
|
||||
return ok;
|
||||
}, argGen.testCount || randomTestCount);
|
||||
} catch(e) {
|
||||
testFailed(name, e.name, formatError(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style>canvas{position:absolute;}</style>
|
||||
</head><body>
|
||||
</body></html>
|
@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="../unit.css" />
|
||||
<script type="application/x-javascript" src="../unit.js"></script>
|
||||
<script type="application/x-javascript" src="../util.js"></script>
|
||||
<script type="application/x-javascript" src="quickCheckAPI.js"></script>
|
||||
<script type="application/x-javascript" src="argGenerators-B1.js"></script>
|
||||
|
||||
<script type="application/x-javascript">
|
||||
|
||||
// Test that all GL functions specified in ArgGenerators work
|
||||
// when called with randomly generated valid arguments
|
||||
Tests.testValidArgs = function() {
|
||||
var randomTestCount = 100;
|
||||
for (var name in ArgGenerators) {
|
||||
try {
|
||||
if (!GL[name])
|
||||
throw (new Error(name + " is missing from the WebGL context"));
|
||||
var argGen = ArgGenerators[name];
|
||||
var alreadyTriedArgs = {};
|
||||
if (!argGen.generate) continue;
|
||||
// test each GL function with randomTestCount randomly generated valid args
|
||||
argGeneratorTestRunner(argGen, function(args, gen, setupVars) {
|
||||
if (!gen.noAlreadyTriedCheck) {
|
||||
var src = Object.toSource(args);
|
||||
if (alreadyTriedArgs[src])
|
||||
return true;
|
||||
|
||||
alreadyTriedArgs[src] = true;
|
||||
}
|
||||
var ok = false;
|
||||
// if we have an validity checker, assert that the generated args are valid
|
||||
if (gen.checkArgValidity)
|
||||
assert("Valid args: "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
gen.checkArgValidity.apply(gen, args));
|
||||
var rv;
|
||||
// assert that GL function works when called with valid args
|
||||
assertOk("This should work: "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
function(){rv = GL[name].apply(GL, args); ok = true;});
|
||||
// if we need to cleanup the return value, do it here
|
||||
// e.g. calling gl.deleteBuffer(rv) after testing gl.createBuffer() above
|
||||
if (gen.returnValueCleanup)
|
||||
assertOk("Cleaning up return value after "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
function() { gen.returnValueCleanup(rv); });
|
||||
return ok;
|
||||
}, argGen.testCount || randomTestCount);
|
||||
} catch(e) {
|
||||
testFailed(name, e.name, formatError(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style>canvas{position:absolute;}</style>
|
||||
</head><body>
|
||||
</body></html>
|
@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="../unit.css" />
|
||||
<script type="application/x-javascript" src="../unit.js"></script>
|
||||
<script type="application/x-javascript" src="../util.js"></script>
|
||||
<script type="application/x-javascript" src="quickCheckAPI.js"></script>
|
||||
<script type="application/x-javascript" src="argGenerators-B2.js"></script>
|
||||
|
||||
<script type="application/x-javascript">
|
||||
|
||||
// Test that all GL functions specified in ArgGenerators work
|
||||
// when called with randomly generated valid arguments
|
||||
Tests.testValidArgs = function() {
|
||||
var randomTestCount = 100;
|
||||
for (var name in ArgGenerators) {
|
||||
try {
|
||||
if (!GL[name])
|
||||
throw (new Error(name + " is missing from the WebGL context"));
|
||||
var argGen = ArgGenerators[name];
|
||||
var alreadyTriedArgs = {};
|
||||
if (!argGen.generate) continue;
|
||||
// test each GL function with randomTestCount randomly generated valid args
|
||||
argGeneratorTestRunner(argGen, function(args, gen, setupVars) {
|
||||
if (!gen.noAlreadyTriedCheck) {
|
||||
var src = Object.toSource(args);
|
||||
if (alreadyTriedArgs[src])
|
||||
return true;
|
||||
|
||||
alreadyTriedArgs[src] = true;
|
||||
}
|
||||
var ok = false;
|
||||
// if we have an validity checker, assert that the generated args are valid
|
||||
if (gen.checkArgValidity)
|
||||
assert("Valid args: "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
gen.checkArgValidity.apply(gen, args));
|
||||
var rv;
|
||||
// assert that GL function works when called with valid args
|
||||
assertOk("This should work: "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
function(){rv = GL[name].apply(GL, args); ok = true;});
|
||||
// if we need to cleanup the return value, do it here
|
||||
// e.g. calling gl.deleteBuffer(rv) after testing gl.createBuffer() above
|
||||
if (gen.returnValueCleanup)
|
||||
assertOk("Cleaning up return value after "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
function() { gen.returnValueCleanup(rv); });
|
||||
return ok;
|
||||
}, argGen.testCount || randomTestCount);
|
||||
} catch(e) {
|
||||
testFailed(name, e.name, formatError(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style>canvas{position:absolute;}</style>
|
||||
</head><body>
|
||||
</body></html>
|
@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="../unit.css" />
|
||||
<script type="application/x-javascript" src="../unit.js"></script>
|
||||
<script type="application/x-javascript" src="../util.js"></script>
|
||||
<script type="application/x-javascript" src="quickCheckAPI.js"></script>
|
||||
<script type="application/x-javascript" src="argGenerators-B3.js"></script>
|
||||
|
||||
<script type="application/x-javascript">
|
||||
|
||||
// Test that all GL functions specified in ArgGenerators work
|
||||
// when called with randomly generated valid arguments
|
||||
Tests.testValidArgs = function() {
|
||||
var randomTestCount = 100;
|
||||
for (var name in ArgGenerators) {
|
||||
try {
|
||||
if (!GL[name])
|
||||
throw (new Error(name + " is missing from the WebGL context"));
|
||||
var argGen = ArgGenerators[name];
|
||||
var alreadyTriedArgs = {};
|
||||
if (!argGen.generate) continue;
|
||||
// test each GL function with randomTestCount randomly generated valid args
|
||||
argGeneratorTestRunner(argGen, function(args, gen, setupVars) {
|
||||
if (!gen.noAlreadyTriedCheck) {
|
||||
var src = Object.toSource(args);
|
||||
if (alreadyTriedArgs[src])
|
||||
return true;
|
||||
|
||||
alreadyTriedArgs[src] = true;
|
||||
}
|
||||
var ok = false;
|
||||
// if we have an validity checker, assert that the generated args are valid
|
||||
if (gen.checkArgValidity)
|
||||
assert("Valid args: "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
gen.checkArgValidity.apply(gen, args));
|
||||
var rv;
|
||||
// assert that GL function works when called with valid args
|
||||
assertOk("This should work: "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
function(){rv = GL[name].apply(GL, args); ok = true;});
|
||||
// if we need to cleanup the return value, do it here
|
||||
// e.g. calling gl.deleteBuffer(rv) after testing gl.createBuffer() above
|
||||
if (gen.returnValueCleanup)
|
||||
assertOk("Cleaning up return value after "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
function() { gen.returnValueCleanup(rv); });
|
||||
return ok;
|
||||
}, argGen.testCount || randomTestCount);
|
||||
} catch(e) {
|
||||
testFailed(name, e.name, formatError(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style>canvas{position:absolute;}</style>
|
||||
</head><body>
|
||||
</body></html>
|
@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="../unit.css" />
|
||||
<script type="application/x-javascript" src="../unit.js"></script>
|
||||
<script type="application/x-javascript" src="../util.js"></script>
|
||||
<script type="application/x-javascript" src="quickCheckAPI.js"></script>
|
||||
<script type="application/x-javascript" src="argGenerators-B4.js"></script>
|
||||
|
||||
<script type="application/x-javascript">
|
||||
|
||||
// Test that all GL functions specified in ArgGenerators work
|
||||
// when called with randomly generated valid arguments
|
||||
Tests.testValidArgs = function() {
|
||||
var randomTestCount = 100;
|
||||
for (var name in ArgGenerators) {
|
||||
try {
|
||||
if (!GL[name])
|
||||
throw (new Error(name + " is missing from the WebGL context"));
|
||||
var argGen = ArgGenerators[name];
|
||||
var alreadyTriedArgs = {};
|
||||
if (!argGen.generate) continue;
|
||||
// test each GL function with randomTestCount randomly generated valid args
|
||||
argGeneratorTestRunner(argGen, function(args, gen, setupVars) {
|
||||
if (!gen.noAlreadyTriedCheck) {
|
||||
var src = Object.toSource(args);
|
||||
if (alreadyTriedArgs[src])
|
||||
return true;
|
||||
|
||||
alreadyTriedArgs[src] = true;
|
||||
}
|
||||
var ok = false;
|
||||
// if we have an validity checker, assert that the generated args are valid
|
||||
if (gen.checkArgValidity)
|
||||
assert("Valid args: "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
gen.checkArgValidity.apply(gen, args));
|
||||
var rv;
|
||||
// assert that GL function works when called with valid args
|
||||
assertOk("This should work: "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
function(){rv = GL[name].apply(GL, args); ok = true;});
|
||||
// if we need to cleanup the return value, do it here
|
||||
// e.g. calling gl.deleteBuffer(rv) after testing gl.createBuffer() above
|
||||
if (gen.returnValueCleanup)
|
||||
assertOk("Cleaning up return value after "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
function() { gen.returnValueCleanup(rv); });
|
||||
return ok;
|
||||
}, argGen.testCount || randomTestCount);
|
||||
} catch(e) {
|
||||
testFailed(name, e.name, formatError(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style>canvas{position:absolute;}</style>
|
||||
</head><body>
|
||||
</body></html>
|
@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="../unit.css" />
|
||||
<script type="application/x-javascript" src="../unit.js"></script>
|
||||
<script type="application/x-javascript" src="../util.js"></script>
|
||||
<script type="application/x-javascript" src="quickCheckAPI.js"></script>
|
||||
<script type="application/x-javascript" src="argGenerators-C.js"></script>
|
||||
|
||||
<script type="application/x-javascript">
|
||||
|
||||
// Test that all GL functions specified in ArgGenerators work
|
||||
// when called with randomly generated valid arguments
|
||||
Tests.testValidArgs = function() {
|
||||
var randomTestCount = 100;
|
||||
for (var name in ArgGenerators) {
|
||||
try {
|
||||
if (!GL[name])
|
||||
throw (new Error(name + " is missing from the WebGL context"));
|
||||
var argGen = ArgGenerators[name];
|
||||
var alreadyTriedArgs = {};
|
||||
if (!argGen.generate) continue;
|
||||
// test each GL function with randomTestCount randomly generated valid args
|
||||
argGeneratorTestRunner(argGen, function(args, gen, setupVars) {
|
||||
if (!gen.noAlreadyTriedCheck) {
|
||||
var src = Object.toSource(args);
|
||||
if (alreadyTriedArgs[src])
|
||||
return true;
|
||||
|
||||
alreadyTriedArgs[src] = true;
|
||||
}
|
||||
var ok = false;
|
||||
// if we have an validity checker, assert that the generated args are valid
|
||||
if (gen.checkArgValidity)
|
||||
assert("Valid args: "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
gen.checkArgValidity.apply(gen, args));
|
||||
var rv;
|
||||
// assert that GL function works when called with valid args
|
||||
assertOk("This should work: "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
function(){rv = GL[name].apply(GL, args); ok = true;});
|
||||
// if we need to cleanup the return value, do it here
|
||||
// e.g. calling gl.deleteBuffer(rv) after testing gl.createBuffer() above
|
||||
if (gen.returnValueCleanup)
|
||||
assertOk("Cleaning up return value after "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
function() { gen.returnValueCleanup(rv); });
|
||||
return ok;
|
||||
}, argGen.testCount || randomTestCount);
|
||||
} catch(e) {
|
||||
testFailed(name, e.name, formatError(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style>canvas{position:absolute;}</style>
|
||||
</head><body>
|
||||
</body></html>
|
@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="../unit.css" />
|
||||
<script type="application/x-javascript" src="../unit.js"></script>
|
||||
<script type="application/x-javascript" src="../util.js"></script>
|
||||
<script type="application/x-javascript" src="quickCheckAPI.js"></script>
|
||||
<script type="application/x-javascript" src="argGenerators-D_G.js"></script>
|
||||
|
||||
<script type="application/x-javascript">
|
||||
|
||||
// Test that all GL functions specified in ArgGenerators work
|
||||
// when called with randomly generated valid arguments
|
||||
Tests.testValidArgs = function() {
|
||||
var randomTestCount = 100;
|
||||
for (var name in ArgGenerators) {
|
||||
try {
|
||||
if (!GL[name])
|
||||
throw (new Error(name + " is missing from the WebGL context"));
|
||||
var argGen = ArgGenerators[name];
|
||||
var alreadyTriedArgs = {};
|
||||
if (!argGen.generate) continue;
|
||||
// test each GL function with randomTestCount randomly generated valid args
|
||||
argGeneratorTestRunner(argGen, function(args, gen, setupVars) {
|
||||
if (!gen.noAlreadyTriedCheck) {
|
||||
var src = Object.toSource(args);
|
||||
if (alreadyTriedArgs[src])
|
||||
return true;
|
||||
|
||||
alreadyTriedArgs[src] = true;
|
||||
}
|
||||
var ok = false;
|
||||
// if we have an validity checker, assert that the generated args are valid
|
||||
if (gen.checkArgValidity)
|
||||
assert("Valid args: "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
gen.checkArgValidity.apply(gen, args));
|
||||
var rv;
|
||||
// assert that GL function works when called with valid args
|
||||
assertOk("This should work: "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
function(){rv = GL[name].apply(GL, args); ok = true;});
|
||||
// if we need to cleanup the return value, do it here
|
||||
// e.g. calling gl.deleteBuffer(rv) after testing gl.createBuffer() above
|
||||
if (gen.returnValueCleanup)
|
||||
assertOk("Cleaning up return value after "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
function() { gen.returnValueCleanup(rv); });
|
||||
return ok;
|
||||
}, argGen.testCount || randomTestCount);
|
||||
} catch(e) {
|
||||
testFailed(name, e.name, formatError(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style>canvas{position:absolute;}</style>
|
||||
</head><body>
|
||||
</body></html>
|
@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="../unit.css" />
|
||||
<script type="application/x-javascript" src="../unit.js"></script>
|
||||
<script type="application/x-javascript" src="../util.js"></script>
|
||||
<script type="application/x-javascript" src="quickCheckAPI.js"></script>
|
||||
<script type="application/x-javascript" src="argGenerators-G_I.js"></script>
|
||||
|
||||
<script type="application/x-javascript">
|
||||
|
||||
// Test that all GL functions specified in ArgGenerators work
|
||||
// when called with randomly generated valid arguments
|
||||
Tests.testValidArgs = function() {
|
||||
var randomTestCount = 100;
|
||||
for (var name in ArgGenerators) {
|
||||
try {
|
||||
if (!GL[name])
|
||||
throw (new Error(name + " is missing from the WebGL context"));
|
||||
var argGen = ArgGenerators[name];
|
||||
var alreadyTriedArgs = {};
|
||||
if (!argGen.generate) continue;
|
||||
// test each GL function with randomTestCount randomly generated valid args
|
||||
argGeneratorTestRunner(argGen, function(args, gen, setupVars) {
|
||||
if (!gen.noAlreadyTriedCheck) {
|
||||
var src = Object.toSource(args);
|
||||
if (alreadyTriedArgs[src])
|
||||
return true;
|
||||
|
||||
alreadyTriedArgs[src] = true;
|
||||
}
|
||||
var ok = false;
|
||||
// if we have an validity checker, assert that the generated args are valid
|
||||
if (gen.checkArgValidity)
|
||||
assert("Valid args: "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
gen.checkArgValidity.apply(gen, args));
|
||||
var rv;
|
||||
// assert that GL function works when called with valid args
|
||||
assertOk("This should work: "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
function(){rv = GL[name].apply(GL, args); ok = true;});
|
||||
// if we need to cleanup the return value, do it here
|
||||
// e.g. calling gl.deleteBuffer(rv) after testing gl.createBuffer() above
|
||||
if (gen.returnValueCleanup)
|
||||
assertOk("Cleaning up return value after "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
function() { gen.returnValueCleanup(rv); });
|
||||
return ok;
|
||||
}, argGen.testCount || randomTestCount);
|
||||
} catch(e) {
|
||||
testFailed(name, e.name, formatError(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style>canvas{position:absolute;}</style>
|
||||
</head><body>
|
||||
</body></html>
|
@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="../unit.css" />
|
||||
<script type="application/x-javascript" src="../unit.js"></script>
|
||||
<script type="application/x-javascript" src="../util.js"></script>
|
||||
<script type="application/x-javascript" src="quickCheckAPI.js"></script>
|
||||
<script type="application/x-javascript" src="argGenerators-L_S.js"></script>
|
||||
|
||||
<script type="application/x-javascript">
|
||||
|
||||
// Test that all GL functions specified in ArgGenerators work
|
||||
// when called with randomly generated valid arguments
|
||||
Tests.testValidArgs = function() {
|
||||
var randomTestCount = 100;
|
||||
for (var name in ArgGenerators) {
|
||||
try {
|
||||
if (!GL[name])
|
||||
throw (new Error(name + " is missing from the WebGL context"));
|
||||
var argGen = ArgGenerators[name];
|
||||
var alreadyTriedArgs = {};
|
||||
if (!argGen.generate) continue;
|
||||
// test each GL function with randomTestCount randomly generated valid args
|
||||
argGeneratorTestRunner(argGen, function(args, gen, setupVars) {
|
||||
if (!gen.noAlreadyTriedCheck) {
|
||||
var src = Object.toSource(args);
|
||||
if (alreadyTriedArgs[src])
|
||||
return true;
|
||||
|
||||
alreadyTriedArgs[src] = true;
|
||||
}
|
||||
var ok = false;
|
||||
// if we have an validity checker, assert that the generated args are valid
|
||||
if (gen.checkArgValidity)
|
||||
assert("Valid args: "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
gen.checkArgValidity.apply(gen, args));
|
||||
var rv;
|
||||
// assert that GL function works when called with valid args
|
||||
assertOk("This should work: "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
function(){rv = GL[name].apply(GL, args); ok = true;});
|
||||
// if we need to cleanup the return value, do it here
|
||||
// e.g. calling gl.deleteBuffer(rv) after testing gl.createBuffer() above
|
||||
if (gen.returnValueCleanup)
|
||||
assertOk("Cleaning up return value after "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
function() { gen.returnValueCleanup(rv); });
|
||||
return ok;
|
||||
}, argGen.testCount || randomTestCount);
|
||||
} catch(e) {
|
||||
testFailed(name, e.name, formatError(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style>canvas{position:absolute;}</style>
|
||||
</head><body>
|
||||
</body></html>
|
@ -0,0 +1,57 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="../unit.css" />
|
||||
<script type="application/x-javascript" src="../unit.js"></script>
|
||||
<script type="application/x-javascript" src="../util.js"></script>
|
||||
<script type="application/x-javascript" src="quickCheckAPI.js"></script>
|
||||
<script type="application/x-javascript" src="argGenerators-S_V.js"></script>
|
||||
|
||||
<script type="application/x-javascript">
|
||||
|
||||
// Test that all GL functions specified in ArgGenerators work
|
||||
// when called with randomly generated valid arguments
|
||||
Tests.testValidArgs = function() {
|
||||
var randomTestCount = 100;
|
||||
for (var name in ArgGenerators) {
|
||||
try {
|
||||
if (!GL[name])
|
||||
throw (new Error(name + " is missing from the WebGL context"));
|
||||
var argGen = ArgGenerators[name];
|
||||
var alreadyTriedArgs = {};
|
||||
if (!argGen.generate) continue;
|
||||
// test each GL function with randomTestCount randomly generated valid args
|
||||
argGeneratorTestRunner(argGen, function(args, gen, setupVars) {
|
||||
if (!gen.noAlreadyTriedCheck) {
|
||||
var src = Object.toSource(args);
|
||||
if (alreadyTriedArgs[src])
|
||||
return true;
|
||||
|
||||
alreadyTriedArgs[src] = true;
|
||||
}
|
||||
var ok = false;
|
||||
// if we have an validity checker, assert that the generated args are valid
|
||||
if (gen.checkArgValidity)
|
||||
assert("Valid args: "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
gen.checkArgValidity.apply(gen, args));
|
||||
var rv;
|
||||
// assert that GL function works when called with valid args
|
||||
assertOk("This should work: "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
function(){rv = GL[name].apply(GL, args); ok = true;});
|
||||
// if we need to cleanup the return value, do it here
|
||||
// e.g. calling gl.deleteBuffer(rv) after testing gl.createBuffer() above
|
||||
if (gen.returnValueCleanup)
|
||||
assertOk("Cleaning up return value after "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
function() { gen.returnValueCleanup(rv); });
|
||||
return ok;
|
||||
}, argGen.testCount || randomTestCount);
|
||||
} catch(e) {
|
||||
testFailed(name, e.name, formatError(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style>canvas{position:absolute;}</style>
|
||||
</head><body>
|
||||
</body></html>
|
@ -1,56 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<meta charset="utf-8">
|
||||
<link rel="stylesheet" type="text/css" href="../unit.css" />
|
||||
<script type="application/x-javascript" src="../unit.js"></script>
|
||||
<script type="application/x-javascript" src="../util.js"></script>
|
||||
<script type="application/x-javascript" src="quickCheckAPI.js"></script>
|
||||
|
||||
<script type="application/x-javascript">
|
||||
|
||||
// Test that all GL functions specified in ArgGenerators work
|
||||
// when called with randomly generated valid arguments
|
||||
Tests.testValidArgs = function() {
|
||||
var randomTestCount = 100;
|
||||
for (var name in ArgGenerators) {
|
||||
try {
|
||||
if (!GL[name])
|
||||
throw (new Error(name + " is missing from the WebGL context"));
|
||||
var argGen = ArgGenerators[name];
|
||||
var alreadyTriedArgs = {};
|
||||
if (!argGen.generate) continue;
|
||||
// test each GL function with randomTestCount randomly generated valid args
|
||||
argGeneratorTestRunner(argGen, function(args, gen, setupVars) {
|
||||
if (!gen.noAlreadyTriedCheck) {
|
||||
var src = Object.toSource(args);
|
||||
if (alreadyTriedArgs[src])
|
||||
return true;
|
||||
|
||||
alreadyTriedArgs[src] = true;
|
||||
}
|
||||
var ok = false;
|
||||
// if we have an validity checker, assert that the generated args are valid
|
||||
if (gen.checkArgValidity)
|
||||
assert("Valid args: "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
gen.checkArgValidity.apply(gen, args));
|
||||
var rv;
|
||||
// assert that GL function works when called with valid args
|
||||
assertOk("This should work: "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
function(){rv = GL[name].apply(GL, args); ok = true;});
|
||||
// if we need to cleanup the return value, do it here
|
||||
// e.g. calling gl.deleteBuffer(rv) after testing gl.createBuffer() above
|
||||
if (gen.returnValueCleanup)
|
||||
assertOk("Cleaning up return value after "+name+"("+args.map(function(a){return Object.toSource(a)}).join(",")+")",
|
||||
function() { gen.returnValueCleanup(rv); });
|
||||
return ok;
|
||||
}, argGen.testCount || randomTestCount);
|
||||
} catch(e) {
|
||||
testFailed(name, e.name, formatError(e));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style>canvas{position:absolute;}</style>
|
||||
</head><body>
|
||||
</body></html>
|
@ -347,806 +347,6 @@ randomImage = function(w,h) {
|
||||
return img
|
||||
};
|
||||
|
||||
// ArgGenerators contains argument generators for WebGL functions.
|
||||
// The argument generators are used for running random tests against the WebGL
|
||||
// functions.
|
||||
//
|
||||
// ArgGenerators is an object consisting of functionName : argGen -properties.
|
||||
//
|
||||
// functionName is a WebGL context function name and the argGen is an argument
|
||||
// generator object that encapsulates the requirements to run
|
||||
// randomly generated tests on the WebGL function.
|
||||
//
|
||||
// An argGen object has the following methods:
|
||||
// - setup -- set up state for testing the GL function, returns values
|
||||
// that need cleanup in teardown. Run once before entering a
|
||||
// test loop.
|
||||
// - teardown -- do cleanup on setup's return values after testing is complete
|
||||
// - generate -- generate a valid set of random arguments for the GL function
|
||||
// - returnValueCleanup -- do cleanup on value returned by the tested GL function
|
||||
// - cleanup -- do cleanup on generated arguments from generate
|
||||
// - checkArgValidity -- check if passed args are valid. Has a call signature
|
||||
// that matches generate's return value. Returns true
|
||||
// if args are valid, false if not.
|
||||
//
|
||||
// Example test loop that demonstrates how the function args and return
|
||||
// values flow together:
|
||||
//
|
||||
// var setupArgs = argGen.setup();
|
||||
// for (var i=0; i<numberOfTests; i++) {
|
||||
// var generatedArgs = argGen.generate.apply(argGen, setupArgs);
|
||||
// var validArgs = argGen.checkArgValidity.apply(argGen, generatedArgs);
|
||||
// var rv = call the GL function with generatedArgs;
|
||||
// argGen.returnValueCleanup(rv);
|
||||
// argGen.cleanup.apply(argGen, generatedArgs);
|
||||
// }
|
||||
// argGen.teardown.apply(argGen, setupArgs);
|
||||
//
|
||||
ArgGenerators = {
|
||||
|
||||
// GL functions in alphabetical order
|
||||
|
||||
// A
|
||||
|
||||
activeTexture : {
|
||||
generate : function() { return [textureUnit.random()]; },
|
||||
checkArgValidity : function(t) { return textureUnit.has(t); },
|
||||
teardown : function() { GL.activeTexture(GL.TEXTURE0); }
|
||||
},
|
||||
attachShader : {
|
||||
generate : function() {
|
||||
var p = GL.createProgram();
|
||||
var sh = GL.createShader(shaderType.random());
|
||||
return [p, sh];
|
||||
},
|
||||
checkArgValidity : function(p, sh) {
|
||||
return GL.isProgram(p) && GL.isShader(sh) && !GL.getAttachedShaders(p).has(sh);
|
||||
},
|
||||
cleanup : function(p, sh) {
|
||||
try {GL.detachShader(p,sh);} catch(e) {}
|
||||
try {GL.deleteProgram(p);} catch(e) {}
|
||||
try {GL.deleteShader(sh);} catch(e) {}
|
||||
}
|
||||
},
|
||||
|
||||
// B
|
||||
|
||||
bindAttribLocation : {
|
||||
generate : function() {
|
||||
var program = GL.createProgram();
|
||||
return [program, randomVertexAttribute(), randomName()];
|
||||
},
|
||||
checkArgValidity : function(program, index, name) {
|
||||
return GL.isProgram(program) && isVertexAttribute(index) && isValidName(name);
|
||||
},
|
||||
cleanup : function(program, index, name) {
|
||||
try { GL.deleteProgram(program); } catch(e) {}
|
||||
}
|
||||
},
|
||||
bindBuffer : {
|
||||
generate : function(buf) {
|
||||
return [bufferTarget.random(), GL.createBuffer()];
|
||||
},
|
||||
checkArgValidity : function(target, buf) {
|
||||
if (!bufferTarget.has(target))
|
||||
return false;
|
||||
GL.bindBuffer(target, buf);
|
||||
return GL.isBuffer(buf);
|
||||
},
|
||||
cleanup : function(t, buf, m) {
|
||||
GL.deleteBuffer(buf);
|
||||
}
|
||||
},
|
||||
bindFramebuffer : {
|
||||
generate : function() {
|
||||
return [GL.FRAMEBUFFER, Math.random() > 0.5 ? null : GL.createFramebuffer()];
|
||||
},
|
||||
checkArgValidity : function(target, fbo) {
|
||||
if (target != GL.FRAMEBUFFER)
|
||||
return false;
|
||||
if (fbo != null)
|
||||
GL.bindFramebuffer(target, fbo);
|
||||
return (fbo == null || GL.isFramebuffer(fbo));
|
||||
},
|
||||
cleanup : function(target, fbo) {
|
||||
GL.bindFramebuffer(target, null);
|
||||
if (fbo)
|
||||
GL.deleteFramebuffer(fbo);
|
||||
}
|
||||
},
|
||||
bindRenderbuffer : {
|
||||
generate : function() {
|
||||
return [GL.RENDERBUFFER, Math.random() > 0.5 ? null : GL.createRenderbuffer()];
|
||||
},
|
||||
checkArgValidity : function(target, rbo) {
|
||||
if (target != GL.RENDERBUFFER)
|
||||
return false;
|
||||
if (rbo != null)
|
||||
GL.bindRenderbuffer(target, rbo);
|
||||
return (rbo == null || GL.isRenderbuffer(rbo));
|
||||
},
|
||||
cleanup : function(target, rbo) {
|
||||
GL.bindRenderbuffer(target, null);
|
||||
if (rbo)
|
||||
GL.deleteRenderbuffer(rbo);
|
||||
}
|
||||
},
|
||||
bindTexture : {
|
||||
generate : function() {
|
||||
return [bindTextureTarget.random(), Math.random() > 0.5 ? null : GL.createTexture()];
|
||||
},
|
||||
checkArgValidity : function(target, o) {
|
||||
if (!bindTextureTarget.has(target))
|
||||
return false;
|
||||
if (o != null)
|
||||
GL.bindTexture(target, o);
|
||||
return (o == null || GL.isTexture(o));
|
||||
},
|
||||
cleanup : function(target, o) {
|
||||
GL.bindTexture(target, null);
|
||||
if (o)
|
||||
GL.deleteTexture(o);
|
||||
}
|
||||
},
|
||||
blendColor : {
|
||||
generate : function() { return randomColor(); },
|
||||
teardown : function() { GL.blendColor(0,0,0,0); }
|
||||
},
|
||||
blendEquation : {
|
||||
generate : function() { return [blendEquationMode.random()]; },
|
||||
checkArgValidity : function(o) { return blendEquationMode.has(o); },
|
||||
teardown : function() { GL.blendEquation(GL.FUNC_ADD); }
|
||||
},
|
||||
blendEquationSeparate : {
|
||||
generate : function() {
|
||||
return [blendEquationMode.random(), blendEquationMode.random()];
|
||||
},
|
||||
checkArgValidity : function(o,p) {
|
||||
return blendEquationMode.has(o) && blendEquationMode.has(p);
|
||||
},
|
||||
teardown : function() { GL.blendEquationSeparate(GL.FUNC_ADD, GL.FUNC_ADD); }
|
||||
},
|
||||
blendFunc : {
|
||||
generate : function() {
|
||||
return [blendFuncSfactor.random(), blendFuncDfactor.random()];
|
||||
},
|
||||
checkArgValidity : function(s,d) {
|
||||
return blendFuncSfactor.has(s) && blendFuncDfactor.has(d);
|
||||
},
|
||||
teardown : function() { GL.blendFunc(GL.ONE, GL.ZERO); }
|
||||
},
|
||||
blendFuncSeparate : {
|
||||
generate : function() {
|
||||
return [blendFuncSfactor.random(), blendFuncDfactor.random(),
|
||||
blendFuncSfactor.random(), blendFuncDfactor.random()];
|
||||
},
|
||||
checkArgValidity : function(s,d,as,ad) {
|
||||
return blendFuncSfactor.has(s) && blendFuncDfactor.has(d) &&
|
||||
blendFuncSfactor.has(as) && blendFuncDfactor.has(ad) ;
|
||||
},
|
||||
teardown : function() {
|
||||
GL.blendFuncSeparate(GL.ONE, GL.ZERO, GL.ONE, GL.ZERO);
|
||||
}
|
||||
},
|
||||
bufferData : {
|
||||
setup : function() {
|
||||
var buf = GL.createBuffer();
|
||||
var ebuf = GL.createBuffer();
|
||||
GL.bindBuffer(GL.ARRAY_BUFFER, buf);
|
||||
GL.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, ebuf);
|
||||
return [buf, ebuf];
|
||||
},
|
||||
generate : function(buf, ebuf) {
|
||||
return [bufferTarget.random(), randomBufferData(), bufferMode.random()];
|
||||
},
|
||||
checkArgValidity : function(target, bufData, mode) {
|
||||
return bufferTarget.has(target) && isBufferData(bufData) && bufferMode.has(mode);
|
||||
},
|
||||
teardown : function(buf, ebuf) {
|
||||
GL.deleteBuffer(buf);
|
||||
GL.deleteBuffer(ebuf);
|
||||
},
|
||||
},
|
||||
bufferSubData : {
|
||||
setup : function() {
|
||||
var buf = GL.createBuffer();
|
||||
var ebuf = GL.createBuffer();
|
||||
GL.bindBuffer(GL.ARRAY_BUFFER, buf);
|
||||
GL.bufferData(GL.ARRAY_BUFFER, 256, GL.STATIC_DRAW);
|
||||
GL.bindBuffer(GL.ELEMENT_ARRAY_BUFFER, ebuf);
|
||||
GL.bufferData(GL.ELEMENT_ARRAY_BUFFER, 256, GL.STATIC_DRAW);
|
||||
return [buf, ebuf];
|
||||
},
|
||||
generate : function(buf, ebuf) {
|
||||
var d = randomBufferSubData(256);
|
||||
return [bufferTarget.random(), d.offset, d.data];
|
||||
},
|
||||
checkArgValidity : function(target, offset, data) {
|
||||
return bufferTarget.has(target) && offset >= 0 && data.byteLength >= 0 && offset + data.byteLength <= 256;
|
||||
},
|
||||
teardown : function(buf, ebuf) {
|
||||
GL.deleteBuffer(buf);
|
||||
GL.deleteBuffer(ebuf);
|
||||
},
|
||||
},
|
||||
|
||||
// C
|
||||
|
||||
checkFramebufferStatus : {
|
||||
generate : function() {
|
||||
return [Math.random() > 0.5 ? null : GL.createFramebuffer()];
|
||||
},
|
||||
checkArgValidity : function(fbo) {
|
||||
if (fbo != null)
|
||||
GL.bindFramebuffer(GL.FRAMEBUFFER, fbo);
|
||||
return fbo == null || GL.isFramebuffer(fbo);
|
||||
},
|
||||
cleanup : function(fbo){
|
||||
GL.bindFramebuffer(GL.FRAMEBUFFER, null);
|
||||
if (fbo != null)
|
||||
try{ GL.deleteFramebuffer(fbo); } catch(e) {}
|
||||
}
|
||||
},
|
||||
clear : {
|
||||
generate : function() { return [clearMask.random()]; },
|
||||
checkArgValidity : function(mask) { return clearMask.has(mask); }
|
||||
},
|
||||
clearColor : {
|
||||
generate : function() { return randomColor(); },
|
||||
teardown : function() { GL.clearColor(0,0,0,0); }
|
||||
},
|
||||
clearDepth : {
|
||||
generate : function() { return [Math.random()]; },
|
||||
teardown : function() { GL.clearDepth(1); }
|
||||
},
|
||||
clearStencil : {
|
||||
generate : function() { return [randomStencil()]; },
|
||||
teardown : function() { GL.clearStencil(0); }
|
||||
},
|
||||
colorMask : {
|
||||
generate : function() {
|
||||
return [randomBool(), randomBool(), randomBool(), randomBool()];
|
||||
},
|
||||
teardown : function() { GL.colorMask(true, true, true, true); }
|
||||
},
|
||||
compileShader : {}, // FIXME
|
||||
copyTexImage2D : {}, // FIXME
|
||||
copyTexSubImage2D : {}, // FIXME
|
||||
createBuffer : {
|
||||
generate : function() { return []; },
|
||||
returnValueCleanup : function(o) { GL.deleteBuffer(o); }
|
||||
},
|
||||
createFramebuffer : {
|
||||
generate : function() { return []; },
|
||||
returnValueCleanup : function(o) { GL.deleteFramebuffer(o); }
|
||||
},
|
||||
createProgram : {
|
||||
generate : function() { return []; },
|
||||
returnValueCleanup : function(o) { GL.deleteProgram(o); }
|
||||
},
|
||||
createRenderbuffer : {
|
||||
generate : function() { return []; },
|
||||
returnValueCleanup : function(o) { GL.deleteRenderbuffer(o); }
|
||||
},
|
||||
createShader : {
|
||||
generate : function() { return [shaderType.random()]; },
|
||||
checkArgValidity : function(t) { return shaderType.has(t); },
|
||||
returnValueCleanup : function(o) { GL.deleteShader(o); }
|
||||
},
|
||||
createTexture : {
|
||||
generate : function() { return []; },
|
||||
returnValueCleanup : function(o) { GL.deleteTexture(o); }
|
||||
},
|
||||
cullFace : {
|
||||
generate : function() { return [cullFace.random()]; },
|
||||
checkArgValidity : function(f) { return cullFace.has(f); },
|
||||
teardown : function() { GL.cullFace(GL.BACK); }
|
||||
},
|
||||
|
||||
// D
|
||||
|
||||
deleteBuffer : {
|
||||
generate : function() { return [GL.createBuffer()]; },
|
||||
checkArgValidity : function(o) {
|
||||
GL.bindBuffer(GL.ARRAY_BUFFER, o);
|
||||
return GL.isBuffer(o);
|
||||
},
|
||||
cleanup : function(o) {
|
||||
GL.bindBuffer(GL.ARRAY_BUFFER, null);
|
||||
try { GL.deleteBuffer(o); } catch(e) {}
|
||||
}
|
||||
},
|
||||
deleteFramebuffer : {
|
||||
generate : function() { return [GL.createFramebuffer()]; },
|
||||
checkArgValidity : function(o) {
|
||||
GL.bindFramebuffer(GL.FRAMEBUFFER, o);
|
||||
return GL.isFramebuffer(o);
|
||||
},
|
||||
cleanup : function(o) {
|
||||
GL.bindFramebuffer(GL.FRAMEBUFFER, null);
|
||||
try { GL.deleteFramebuffer(o); } catch(e) {}
|
||||
}
|
||||
},
|
||||
deleteProgram : {
|
||||
generate : function() { return [GL.createProgram()]; },
|
||||
checkArgValidity : function(o) { return GL.isProgram(o); },
|
||||
cleanup : function(o) { try { GL.deleteProgram(o); } catch(e) {} }
|
||||
},
|
||||
deleteRenderbuffer : {
|
||||
generate : function() { return [GL.createRenderbuffer()]; },
|
||||
checkArgValidity : function(o) {
|
||||
GL.bindRenderbuffer(GL.RENDERBUFFER, o);
|
||||
return GL.isRenderbuffer(o);
|
||||
},
|
||||
cleanup : function(o) {
|
||||
GL.bindRenderbuffer(GL.RENDERBUFFER, null);
|
||||
try { GL.deleteRenderbuffer(o); } catch(e) {}
|
||||
}
|
||||
},
|
||||
deleteShader : {
|
||||
generate : function() { return [GL.createShader(shaderType.random())]; },
|
||||
checkArgValidity : function(o) { return GL.isShader(o); },
|
||||
cleanup : function(o) { try { GL.deleteShader(o); } catch(e) {} }
|
||||
},
|
||||
deleteTexture : {
|
||||
generate : function() { return [GL.createTexture()]; },
|
||||
checkArgValidity : function(o) {
|
||||
GL.bindTexture(GL.TEXTURE_2D, o);
|
||||
return GL.isTexture(o);
|
||||
},
|
||||
cleanup : function(o) {
|
||||
GL.bindTexture(GL.TEXTURE_2D, null);
|
||||
try { GL.deleteTexture(o); } catch(e) {}
|
||||
}
|
||||
},
|
||||
depthFunc : {
|
||||
generate : function() { return [depthFuncFunc.random()]; },
|
||||
checkArgValidity : function(f) { return depthFuncFunc.has(f); },
|
||||
teardown : function() { GL.depthFunc(GL.LESS); }
|
||||
},
|
||||
depthMask : {
|
||||
generate : function() { return [randomBool()]; },
|
||||
teardown : function() { GL.depthFunc(GL.TRUE); }
|
||||
},
|
||||
depthRange : {
|
||||
generate : function() { return [Math.random(), Math.random()]; },
|
||||
teardown : function() { GL.depthRange(0, 1); }
|
||||
},
|
||||
detachShader : {
|
||||
generate : function() {
|
||||
var p = GL.createProgram();
|
||||
var sh = GL.createShader(shaderType.random());
|
||||
GL.attachShader(p, sh);
|
||||
return [p, sh];
|
||||
},
|
||||
checkArgValidity : function(p, sh) {
|
||||
return GL.isProgram(p) && GL.isShader(sh) && GL.getAttachedShaders(p).has(sh);
|
||||
},
|
||||
cleanup : function(p, sh) {
|
||||
try {GL.deleteProgram(p);} catch(e) {}
|
||||
try {GL.deleteShader(sh);} catch(e) {}
|
||||
}
|
||||
},
|
||||
disable : {
|
||||
generate : function() { return [enableCap.random()]; },
|
||||
checkArgValidity : function(c) { return enableCap.has(c); },
|
||||
cleanup : function(c) { if (c == GL.DITHER) GL.enable(c); }
|
||||
},
|
||||
disableVertexAttribArray : {
|
||||
generate : function() { return [randomVertexAttribute()]; },
|
||||
checkArgValidity : function(v) { return isVertexAttribute(v); }
|
||||
},
|
||||
drawArrays : {}, // FIXME
|
||||
drawElements : {}, // FIXME
|
||||
|
||||
// E
|
||||
|
||||
enable : {
|
||||
generate : function() { return [enableCap.random()]; },
|
||||
checkArgValidity : function(c) { return enableCap.has(c); },
|
||||
cleanup : function(c) { if (c != GL.DITHER) GL.disable(c); }
|
||||
},
|
||||
enableVertexAttribArray : {
|
||||
generate : function() { return [randomVertexAttribute()]; },
|
||||
checkArgValidity : function(v) { return isVertexAttribute(castToInt(v)); },
|
||||
cleanup : function(v) { GL.disableVertexAttribArray(v); }
|
||||
},
|
||||
|
||||
// F
|
||||
|
||||
finish : {
|
||||
generate : function() { return []; }
|
||||
},
|
||||
flush : {
|
||||
generate : function() { return []; }
|
||||
},
|
||||
framebufferRenderbuffer : {}, // FIXME
|
||||
framebufferTexture2D : {}, // FIXME
|
||||
frontFace : {
|
||||
generate : function() { return [frontFaceMode.random()]; },
|
||||
checkArgValidity : function(c) { return frontFaceMode.has(c); },
|
||||
cleanup : function(c) { GL.frontFace(GL.CCW); }
|
||||
},
|
||||
|
||||
// G
|
||||
|
||||
generateMipmap : {
|
||||
setup : function() {
|
||||
var tex = GL.createTexture();
|
||||
var tex2 = GL.createTexture();
|
||||
GL.bindTexture(GL.TEXTURE_2D, tex);
|
||||
GL.bindTexture(GL.TEXTURE_CUBE_MAP, tex2);
|
||||
var pix = new Uint8Array(16*16*4);
|
||||
GL.texImage2D(GL.TEXTURE_2D, 0, GL.RGBA, 16, 16, 0, GL.RGBA, GL.UNSIGNED_BYTE, pix);
|
||||
GL.texImage2D(GL.TEXTURE_CUBE_MAP_POSITIVE_X, 0, GL.RGBA, 16, 16, 0, GL.RGBA, GL.UNSIGNED_BYTE, pix);
|
||||
GL.texImage2D(GL.TEXTURE_CUBE_MAP_NEGATIVE_X, 0, GL.RGBA, 16, 16, 0, GL.RGBA, GL.UNSIGNED_BYTE, pix);
|
||||
GL.texImage2D(GL.TEXTURE_CUBE_MAP_POSITIVE_Y, 0, GL.RGBA, 16, 16, 0, GL.RGBA, GL.UNSIGNED_BYTE, pix);
|
||||
GL.texImage2D(GL.TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL.RGBA, 16, 16, 0, GL.RGBA, GL.UNSIGNED_BYTE, pix);
|
||||
GL.texImage2D(GL.TEXTURE_CUBE_MAP_POSITIVE_Z, 0, GL.RGBA, 16, 16, 0, GL.RGBA, GL.UNSIGNED_BYTE, pix);
|
||||
GL.texImage2D(GL.TEXTURE_CUBE_MAP_NEGATIVE_Z, 0, GL.RGBA, 16, 16, 0, GL.RGBA, GL.UNSIGNED_BYTE, pix);
|
||||
},
|
||||
generate : function() { return [bindTextureTarget.random()]; },
|
||||
checkArgValidity : function(t) { return bindTextureTarget.has(t); },
|
||||
teardown : function(tex, tex2) {
|
||||
GL.bindTexture(GL.TEXTURE_2D, null);
|
||||
GL.bindTexture(GL.TEXTURE_CUBE_MAP, null);
|
||||
GL.deleteTexture(tex);
|
||||
GL.deleteTexture(tex2);
|
||||
}
|
||||
},
|
||||
getActiveAttrib : {
|
||||
/* FIXME the queried attrib needs to be an active one
|
||||
generate : function() {
|
||||
var program = GL.createProgram();
|
||||
return [program, randomVertexAttribute()];
|
||||
},
|
||||
checkArgValidity : function(program, index) {
|
||||
return GL.isProgram(program) && isVertexAttribute(index);
|
||||
},
|
||||
cleanup : function(program, index) {
|
||||
GL.deleteProgram(program);
|
||||
}
|
||||
*/
|
||||
},
|
||||
getActiveUniform : {}, // FIXME
|
||||
getAttachedShaders : {
|
||||
setup : function() {
|
||||
var program = GL.createProgram();
|
||||
var s1 = GL.createShader(GL.VERTEX_SHADER);
|
||||
var s2 = GL.createShader(GL.FRAGMENT_SHADER);
|
||||
GL.attachShader(program, s1);
|
||||
GL.attachShader(program, s2);
|
||||
return [program, s1, s2];
|
||||
},
|
||||
generate : function(program, s1, s2) {
|
||||
return [program]
|
||||
},
|
||||
checkArgValidity : function(program) {
|
||||
return GL.isProgram(program);
|
||||
},
|
||||
teardown : function(program, s1, s2) {
|
||||
GL.deleteProgram(program);
|
||||
GL.deleteShader(s1);
|
||||
GL.deleteShader(s2);
|
||||
}
|
||||
},
|
||||
getAttribLocation : {
|
||||
generate : function() {
|
||||
var program = GL.createProgram();
|
||||
var name = randomName();
|
||||
GL.bindAttribLocation(program, randomVertexAttribute(), name);
|
||||
return [program, name];
|
||||
},
|
||||
checkArgValidity : function(program, name) {
|
||||
return GL.isProgram(program) && isValidName(name);
|
||||
},
|
||||
cleanup : function(program, name) {
|
||||
try { GL.deleteProgram(program); } catch(e) {}
|
||||
}
|
||||
},
|
||||
getParameter : {
|
||||
generate : function() { return [getParameterPname.random()]; },
|
||||
checkArgValidity : function(p) { return getParameterPname.has(p); }
|
||||
},
|
||||
getBufferParameter : {}, // FIXME
|
||||
getError : {
|
||||
generate : function() { return []; }
|
||||
},
|
||||
getFramebufferAttachmentParameter : {}, // FIXME
|
||||
getProgramParameter : {}, // FIXME
|
||||
getProgramInfoLog : {}, // FIXME
|
||||
getRenderbufferParameter : {}, // FIXME
|
||||
getShaderParameter : {}, // FIXME
|
||||
getShaderInfoLog : {}, // FIXME
|
||||
getShaderSource : {}, // FIXME
|
||||
getTexParameter : {}, // FIXME
|
||||
getUniform : {}, // FIXME
|
||||
getUniformLocation : {}, // FIXME
|
||||
getVertexAttrib : {}, // FIXME
|
||||
getVertexAttribOffset : {}, // FIXME
|
||||
|
||||
// H
|
||||
|
||||
hint : {
|
||||
generate : function() { return [GL.GENERATE_MIPMAP_HINT, mipmapHint.random()]; },
|
||||
checkValidArgs : function(h, m) {
|
||||
return h == GL.GENERATE_MIPMAP_HINT && mipmapHint.has(m);
|
||||
},
|
||||
teardown : function(){ GL.hint(GL.GENERATE_MIPMAP_HINT, GL.DONT_CARE); }
|
||||
},
|
||||
|
||||
// I
|
||||
|
||||
isBuffer : {
|
||||
generate : function() { return [GL.createBuffer()]; },
|
||||
cleanup : function(o) { try { GL.deleteBuffer(o); } catch(e) {} }
|
||||
},
|
||||
isEnabled : {
|
||||
generate : function() { return [enableCap.random()]; },
|
||||
checkArgValidity : function(c) { return enableCap.has(c); }
|
||||
},
|
||||
isFramebuffer : {
|
||||
generate : function() { return [GL.createFramebuffer()]; },
|
||||
cleanup : function(o) { try { GL.deleteFramebuffer(o); } catch(e) {} }
|
||||
},
|
||||
isProgram : {
|
||||
generate : function() { return [GL.createProgram()]; },
|
||||
cleanup : function(o) { try { GL.deleteProgram(o); } catch(e) {} }
|
||||
},
|
||||
isRenderbuffer : {
|
||||
generate : function() { return [GL.createRenderbuffer()]; },
|
||||
cleanup : function(o) { try { GL.deleteRenderbuffer(o); } catch(e) {} }
|
||||
},
|
||||
isShader : {
|
||||
generate : function() { return [GL.createShader(shaderType.random())]; },
|
||||
cleanup : function(o) { try { GL.deleteShader(o); } catch(e) {} }
|
||||
},
|
||||
isTexture : {
|
||||
generate : function() { return [GL.createTexture()]; },
|
||||
cleanup : function(o) { try { GL.deleteTexture(o); } catch(e) {} }
|
||||
},
|
||||
|
||||
// L
|
||||
|
||||
lineWidth : {
|
||||
generate : function() { return [randomLineWidth()]; },
|
||||
teardown : function() { GL.lineWidth(1); }
|
||||
},
|
||||
linkProgram : {}, // FIXME
|
||||
|
||||
// P
|
||||
pixelStorei : {
|
||||
generate : function() {
|
||||
return [pixelStoreiPname.random(), pixelStoreiParam.random()];
|
||||
},
|
||||
checkArgValidity : function(pname, param) {
|
||||
return pixelStoreiPname.has(pname) && pixelStoreiParam.has(param);
|
||||
},
|
||||
teardown : function() {
|
||||
GL.pixelStorei(GL.PACK_ALIGNMENT, 4);
|
||||
GL.pixelStorei(GL.UNPACK_ALIGNMENT, 4);
|
||||
}
|
||||
},
|
||||
polygonOffset : {
|
||||
generate : function() { return [randomFloat(), randomFloat()]; },
|
||||
teardown : function() { GL.polygonOffset(0,0); }
|
||||
},
|
||||
|
||||
// R
|
||||
|
||||
readPixels : {}, // FIXME
|
||||
renderbufferStorage : {}, // FIXME
|
||||
|
||||
// S
|
||||
|
||||
sampleCoverage : {
|
||||
generate : function() { return [randomFloatFromRange(0,1), randomBool()] },
|
||||
teardown : function() { GL.sampleCoverage(1, false); }
|
||||
},
|
||||
scissor : {
|
||||
generate : function() {
|
||||
return [randomInt(3000)-1500, randomInt(3000)-1500, randomIntFromRange(0,3000), randomIntFromRange(0,3000)];
|
||||
},
|
||||
checkArgValidity : function(x,y,w,h) {
|
||||
return castToInt(w) >= 0 && castToInt(h) >= 0;
|
||||
},
|
||||
teardown : function() {
|
||||
GL.scissor(0,0,GL.canvas.width, GL.canvas.height);
|
||||
}
|
||||
},
|
||||
shaderSource : {}, // FIXME
|
||||
stencilFunc : {
|
||||
generate : function(){
|
||||
return [stencilFuncFunc.random(), randomInt(MaxStencilValue), randomInt(0xffffffff)];
|
||||
},
|
||||
checkArgValidity : function(func, ref, mask) {
|
||||
return stencilFuncFunc.has(func) && castToInt(ref) >= 0 && castToInt(ref) < MaxStencilValue;
|
||||
},
|
||||
teardown : function() {
|
||||
GL.stencilFunc(GL.ALWAYS, 0, 0xffffffff);
|
||||
}
|
||||
},
|
||||
stencilFuncSeparate : {
|
||||
generate : function(){
|
||||
return [cullFace.random(), stencilFuncFunc.random(), randomInt(MaxStencilValue), randomInt(0xffffffff)];
|
||||
},
|
||||
checkArgValidity : function(face, func, ref, mask) {
|
||||
return cullFace.has(face) && stencilFuncFunc.has(func) && castToInt(ref) >= 0 && castToInt(ref) < MaxStencilValue;
|
||||
},
|
||||
teardown : function() {
|
||||
GL.stencilFunc(GL.ALWAYS, 0, 0xffffffff);
|
||||
}
|
||||
},
|
||||
stencilMask : {
|
||||
generate : function() { return [randomInt(0xffffffff)]; },
|
||||
teardown : function() { GL.stencilMask(0xffffffff); }
|
||||
},
|
||||
stencilMaskSeparate : {
|
||||
generate : function() { return [cullFace.random(), randomInt(0xffffffff)]; },
|
||||
checkArgValidity : function(face, mask) {
|
||||
return cullFace.has(face);
|
||||
},
|
||||
teardown : function() { GL.stencilMask(0xffffffff); }
|
||||
},
|
||||
stencilOp : {
|
||||
generate : function() {
|
||||
return [stencilOp.random(), stencilOp.random(), stencilOp.random()];
|
||||
},
|
||||
checkArgValidity : function(sfail, dpfail, dppass) {
|
||||
return stencilOp.has(sfail) && stencilOp.has(dpfail) && stencilOp.has(dppass);
|
||||
},
|
||||
teardown : function() { GL.stencilOp(GL.KEEP, GL.KEEP, GL.KEEP); }
|
||||
},
|
||||
stencilOpSeparate : {
|
||||
generate : function() {
|
||||
return [cullFace.random(), stencilOp.random(), stencilOp.random(), stencilOp.random()];
|
||||
},
|
||||
checkArgValidity : function(face, sfail, dpfail, dppass) {
|
||||
return cullFace.has(face) && stencilOp.has(sfail) &&
|
||||
stencilOp.has(dpfail) && stencilOp.has(dppass);
|
||||
},
|
||||
teardown : function() { GL.stencilOp(GL.KEEP, GL.KEEP, GL.KEEP); }
|
||||
},
|
||||
|
||||
// T
|
||||
texImage2D : {
|
||||
noAlreadyTriedCheck : true, // Object.toSource is very slow here
|
||||
setup : function() {
|
||||
var tex = GL.createTexture();
|
||||
var tex2 = GL.createTexture();
|
||||
GL.bindTexture(GL.TEXTURE_2D, tex);
|
||||
GL.bindTexture(GL.TEXTURE_CUBE_MAP, tex2);
|
||||
return [tex, tex2];
|
||||
},
|
||||
generate : function() {
|
||||
var format = texImageFormat.random();
|
||||
if (Math.random() < 0.5) {
|
||||
var img = randomImage(16,16);
|
||||
var a = [ texImageTarget.random(), 0, format, format, GL.UNSIGNED_BYTE, img ];
|
||||
return a;
|
||||
} else {
|
||||
var pix = null;
|
||||
if (Math.random > 0.5) {
|
||||
pix = new Uint8Array(16*16*4);
|
||||
}
|
||||
return [
|
||||
texImageTarget.random(), 0,
|
||||
format, 16, 16, 0,
|
||||
format, GL.UNSIGNED_BYTE, pix
|
||||
];
|
||||
}
|
||||
},
|
||||
checkArgValidity : function(target, level, internalformat, width, height, border, format, type, data) {
|
||||
// or : function(target, level, internalformat, format, type, image)
|
||||
if (!texImageTarget.has(target) || castToInt(level) < 0)
|
||||
return false;
|
||||
if (arguments.length <= 6) {
|
||||
var xformat = width;
|
||||
var xtype = height;
|
||||
var ximage = border;
|
||||
if ((ximage instanceof HTMLImageElement ||
|
||||
ximage instanceof HTMLVideoElement ||
|
||||
ximage instanceof HTMLCanvasElement ||
|
||||
ximage instanceof ImageData) &&
|
||||
texImageInternalFormat.has(internalformat) &&
|
||||
texImageFormat.has(xformat) &&
|
||||
texImageType.has(xtype) &&
|
||||
internalformat == xformat)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
var w = castToInt(width), h = castToInt(height), b = castToInt(border);
|
||||
return texImageInternalFormat.has(internalformat) && w >= 0 && h >= 0 &&
|
||||
b == 0 && (data == null || data.byteLength == w*h*4) &&
|
||||
texImageFormat.has(format) && texImageType.has(type)
|
||||
&& internalformat == format;
|
||||
},
|
||||
teardown : function(tex, tex2) {
|
||||
GL.bindTexture(GL.TEXTURE_2D, null);
|
||||
GL.bindTexture(GL.TEXTURE_CUBE_MAP, null);
|
||||
GL.deleteTexture(tex);
|
||||
GL.deleteTexture(tex2);
|
||||
}
|
||||
},
|
||||
texParameterf : {
|
||||
generate : function() {
|
||||
var pname = texParameterPname.random();
|
||||
var param = texParameterParam[pname].random();
|
||||
return [bindTextureTarget.random(), pname, param];
|
||||
},
|
||||
checkArgValidity : function(target, pname, param) {
|
||||
if (!bindTextureTarget.has(target))
|
||||
return false;
|
||||
if (!texParameterPname.has(pname))
|
||||
return false;
|
||||
return texParameterParam[pname].has(param);
|
||||
}
|
||||
},
|
||||
texParameteri : {
|
||||
generate : function() {
|
||||
var pname = texParameterPname.random();
|
||||
var param = texParameterParam[pname].random();
|
||||
return [bindTextureTarget.random(), pname, param];
|
||||
},
|
||||
checkArgValidity : function(target, pname, param) {
|
||||
if (!bindTextureTarget.has(target))
|
||||
return false;
|
||||
if (!texParameterPname.has(pname))
|
||||
return false;
|
||||
return texParameterParam[pname].has(param);
|
||||
}
|
||||
},
|
||||
texSubImage2D : {}, // FIXME
|
||||
|
||||
// U
|
||||
|
||||
uniform1f : {}, // FIXME
|
||||
uniform1fv : {}, // FIXME
|
||||
uniform1i : {}, // FIXME
|
||||
uniform1iv : {}, // FIXME
|
||||
uniform2f : {}, // FIXME
|
||||
uniform2fv : {}, // FIXME
|
||||
uniform2i : {}, // FIXME
|
||||
uniform2iv : {}, // FIXME
|
||||
uniform3f : {}, // FIXME
|
||||
uniform3fv : {}, // FIXME
|
||||
uniform3i : {}, // FIXME
|
||||
uniform3iv : {}, // FIXME
|
||||
uniform4f : {}, // FIXME
|
||||
uniform4fv : {}, // FIXME
|
||||
uniform4i : {}, // FIXME
|
||||
uniform4iv : {}, // FIXME
|
||||
uniformMatrix2fv : {}, // FIXME
|
||||
uniformMatrix3fv : {}, // FIXME
|
||||
uniformMatrix4fv : {}, // FIXME
|
||||
useProgram : {}, // FIXME
|
||||
|
||||
// V
|
||||
|
||||
validateProgram : {}, // FIXME
|
||||
vertexAttrib1f : {}, // FIXME
|
||||
vertexAttrib1fv : {}, // FIXME
|
||||
vertexAttrib2f : {}, // FIXME
|
||||
vertexAttrib2fv : {}, // FIXME
|
||||
vertexAttrib3f : {}, // FIXME
|
||||
vertexAttrib3fv : {}, // FIXME
|
||||
vertexAttrib4f : {}, // FIXME
|
||||
vertexAttrib4fv : {}, // FIXME
|
||||
vertexAttribPointer : {}, // FIXME
|
||||
viewport : {
|
||||
generate : function() {
|
||||
return [randomInt(3000)-1500, randomInt(3000)-1500, randomIntFromRange(0,3000), randomIntFromRange(0,3000)];
|
||||
},
|
||||
checkArgValidity : function(x,y,w,h) {
|
||||
return castToInt(w) >= 0 && castToInt(h) >= 0;
|
||||
},
|
||||
teardown : function() {
|
||||
GL.viewport(0,0,GL.canvas.width, GL.canvas.height);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
mutateArgs = function(args) {
|
||||
var mutateCount = randomIntFromRange(1, args.length);
|
||||
var newArgs = Array.from(args);
|
||||
|
@ -399,7 +399,8 @@ var checkCanvasRect = function(gl, x, y, width, height, color, msg, errorRange)
|
||||
for (j = 1; j < color.length; ++j) {
|
||||
was += "," + buf[offset + j];
|
||||
}
|
||||
debug('expected: ' + color + ' was ' + was);
|
||||
debug('at (' + (i % width) + ', ' + Math.floor(i / width) +
|
||||
') expected: ' + color + ' was ' + was);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -182,8 +182,8 @@ function createProgram(gl, vshaders, fshaders, attribs)
|
||||
}
|
||||
|
||||
if (attribs) {
|
||||
for (var i in attribs) {
|
||||
gl.bindAttribLocation(prog, parseInt(i), attribs[i]);
|
||||
for (var i = 0; i < attribs.length; ++i) {
|
||||
gl.bindAttribLocation(prog, i, attribs[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,14 +18,13 @@ found in the LICENSE file.
|
||||
<div id="description"></div>
|
||||
<div id="console"></div>
|
||||
<script id="vshader" type="x-shader/x-vertex">
|
||||
uniform vec4 uOffset;
|
||||
uniform vec4 uMult;
|
||||
attribute vec4 vPosition;
|
||||
attribute vec2 texCoord0;
|
||||
varying vec2 texCoord;
|
||||
void main()
|
||||
{
|
||||
gl_Position = vPosition * uMult + uOffset;
|
||||
gl_Position = vPosition * uMult;
|
||||
texCoord = texCoord0;
|
||||
}
|
||||
</script>
|
||||
@ -41,6 +40,7 @@ void main()
|
||||
</script>
|
||||
<script>
|
||||
var canvas;
|
||||
var wtu = WebGLTestUtils;
|
||||
function init()
|
||||
{
|
||||
if (window.initNonKhronosFramework) {
|
||||
@ -50,7 +50,6 @@ function init()
|
||||
debug("Checks mip issues");
|
||||
debug("");
|
||||
|
||||
var wtu = WebGLTestUtils;
|
||||
canvas = document.getElementById("example");
|
||||
shouldBe("canvas.width", "2");
|
||||
shouldBe("canvas.height", "2");
|
||||
@ -66,106 +65,189 @@ function init()
|
||||
gl.disable(gl.DEPTH_TEST);
|
||||
gl.disable(gl.BLEND);
|
||||
|
||||
var blue = [0, 0, 255, 255];
|
||||
var red = [255, 0, 0, 255];
|
||||
var green = [0, 255, 0, 255];
|
||||
var lightGreen = [128, 255, 192, 255];
|
||||
var black = [0, 0, 0, 255];
|
||||
var colors = {
|
||||
blue: [0, 0, 255, 255],
|
||||
red: [255, 0, 0, 255],
|
||||
green: [0, 255, 0, 255],
|
||||
cyan: [128, 255, 255, 255],
|
||||
black: [0, 0, 0, 255]
|
||||
};
|
||||
|
||||
var tex = gl.createTexture();
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
// 16x16 texture no mips
|
||||
fillLevel(0, 16, lightGreen);
|
||||
debug("mips: lightGreen(16x16), undef, undef, undef, undef");
|
||||
var mips = [
|
||||
];
|
||||
|
||||
var texLoc = gl.getUniformLocation(program, "tex");
|
||||
gl.uniform1i(texLoc, 0);
|
||||
var offLoc = gl.getUniformLocation(program, "uOffset");
|
||||
var multLoc = gl.getUniformLocation(program, "uMult");
|
||||
|
||||
gl.uniform4f(offLoc, 0, 0, 0, 0);
|
||||
// ----------------------------------------------------
|
||||
var tex = createTexture();
|
||||
gl.uniform4f(multLoc, 1, 1, 1, 1);
|
||||
|
||||
wtu.drawQuad(gl);
|
||||
wtu.checkCanvas(gl, black,
|
||||
"texture that is missing mips when " +
|
||||
"TEXTURE_MIN_FILTER not NEAREST or LINEAR should draw with black");
|
||||
gl.bindTexture(gl.TEXTURE_2D, tex);
|
||||
// 16x16 texture no mips
|
||||
fillLevel(tex, 0, 16, 'cyan');
|
||||
|
||||
gl.generateMipmap(gl.TEXTURE_2D);
|
||||
debug("mips: lightGreen(16x16), lightGreen(8x8), lightGreen(4x4), lightGreen(2x2), lightGreen(1x1)");
|
||||
check('black',
|
||||
"texture that is missing mips when TEXTURE_MIN_FILTER not NEAREST or LINEAR");
|
||||
|
||||
wtu.drawQuad(gl);
|
||||
wtu.checkCanvas(gl, lightGreen,
|
||||
"texture that has all mips when should draw with light green");
|
||||
generateMipmap();
|
||||
|
||||
check('cyan', "texture that has all mips");
|
||||
|
||||
// Fill in the bottom 2 mips with a different color.
|
||||
fillLevel(4, 1, green);
|
||||
fillLevel(3, 2, green);
|
||||
debug("mips: lightGreen(16x16), lightGreen(8x8), lightGreen(4x4), green(2x2), green(1x1)");
|
||||
fillLevel(tex, 4, 1, 'green');
|
||||
fillLevel(tex, 3, 2, 'green');
|
||||
|
||||
// Choose the nearest mip
|
||||
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST);
|
||||
texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST);
|
||||
|
||||
wtu.drawQuad(gl);
|
||||
wtu.checkCanvas(gl, green,
|
||||
"texture that is only using the smallest 2 mips should draw with green");
|
||||
check('green', "texture that is only using the smallest 2 mips");
|
||||
|
||||
gl.uniform4f(multLoc, 16, 16, 1, 1);
|
||||
|
||||
wtu.drawQuad(gl);
|
||||
wtu.checkCanvas(gl, lightGreen,
|
||||
"texture that is using only the largest 2 mips should draw with light green");
|
||||
check('cyan', "texture that is using only the largest 2 mips");
|
||||
|
||||
// Set the top level
|
||||
fillLevel(0, 1, red);
|
||||
debug("mips: red(1x1), lightGreen(8x8-unused), lightGreen(4x4-unused), lightGreen(2x2-unused), lightGreen(1x1-unused)");
|
||||
wtu.drawQuad(gl);
|
||||
wtu.checkCanvas(gl, red,
|
||||
"texture that is only using the top level even though other levels are defined " +
|
||||
"should draw with red");
|
||||
fillLevel(tex, 0, 1, 'red');
|
||||
check('red',
|
||||
"texture that is only using the top level even though other levels are defined");
|
||||
|
||||
// Set the top 2 levels using generateMipmap
|
||||
fillLevel(0, 2, blue);
|
||||
debug("mips: blue(2x2), lightGreen(8x8-unused), lightGreen(4x4-unused), lightGreen(2x2-unused), lightGreen(1x1-unused)");
|
||||
gl.generateMipmap(gl.TEXTURE_2D);
|
||||
debug("mips: blue(2x2), blue(1x1), lightGreen(4x4-unused), lightGreen(2x2-unused), lightGreen(1x1-unused)");
|
||||
|
||||
wtu.drawQuad(gl);
|
||||
wtu.checkCanvas(gl, blue,
|
||||
"texture that is only using the top 2 levels even though other levels are defined " +
|
||||
"should draw with blue");
|
||||
fillLevel(tex, 0, 2, 'blue');
|
||||
generateMipmap();
|
||||
|
||||
check('blue',
|
||||
"texture that is only using the top 2 levels even though other levels are defined");
|
||||
|
||||
// Set the top 2 levels back to sizes that end up using levels 2, 3, and 4 again.
|
||||
fillLevel(0, 16, blue);
|
||||
debug("mips: blue(16x16), blue(1x1), lightGreen(4x4-unused), lightGreen(2x2-unused), lightGreen(1x1-unused)");
|
||||
fillLevel(1, 8, blue);
|
||||
debug("mips: blue(16x16), blue(8x8), lightGreen(4x4), lightGreen(2x2), lightGreen(1x1)");
|
||||
wtu.drawQuad(gl);
|
||||
wtu.checkCanvas(gl, blue,
|
||||
"texture that is only using the largest 2 mips should draw with blue");
|
||||
fillLevel(tex, 0, 16, 'blue');
|
||||
fillLevel(tex, 1, 8, 'blue');
|
||||
check('blue', "texture that is only using the largest 2 mips");
|
||||
gl.uniform4f(multLoc, 1, 1, 1, 1);
|
||||
wtu.drawQuad(gl);
|
||||
wtu.checkCanvas(gl, green,
|
||||
"texture that is only using the smalles 2 mips should draw with green");
|
||||
check('green', "texture that is only using the smallest 2 mips");
|
||||
|
||||
// ----------------------------------------------------
|
||||
var tex = createTexture();
|
||||
gl.uniform4f(multLoc, 1, 1, 1, 1);
|
||||
fillLevel(tex, 0, 8, 'cyan');
|
||||
generateMipmap();
|
||||
check('cyan', "texture that has 3 mips");
|
||||
|
||||
fillLevel(tex, 0, 16, 'blue');
|
||||
texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
||||
check('blue', "texture that is only using top mips");
|
||||
|
||||
fillLevel(tex, 0, 8, 'red');
|
||||
texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST);
|
||||
check('cyan', "texture that is only using smallest mips");
|
||||
|
||||
gl.uniform4f(multLoc, 16, 16, 1, 1);
|
||||
check('red', "texture that is using only the largest mip");
|
||||
|
||||
// ----------------------------------------------------
|
||||
var tex = createTexture();
|
||||
gl.uniform4f(multLoc, 1, 1, 1, 1);
|
||||
fillLevel(tex, 2, 1, 'green');
|
||||
fillLevel(tex, 1, 2, 'green');
|
||||
fillLevel(tex, 0, 4, 'green');
|
||||
check('green', "texture that was built smallest mip first");
|
||||
|
||||
// ----------------------------------------------------
|
||||
var tex = createTexture();
|
||||
gl.uniform4f(multLoc, 1, 1, 1, 1);
|
||||
fillLevel(tex, 0, 16, 'red');
|
||||
generateMipmap();
|
||||
check('red', "texture with 1 genmipmaps");
|
||||
fillLevel(tex, 0, 16, 'blue');
|
||||
generateMipmap();
|
||||
fillLevel(tex, 0, 16, 'green');
|
||||
generateMipmap();
|
||||
check('green', "texture with 2 genmipmaps");
|
||||
|
||||
// ----------------------------------------------------
|
||||
glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors.");
|
||||
}
|
||||
|
||||
function fillLevel(level, size, color) {
|
||||
var numPixels = size * size;
|
||||
var pixels = new Uint8Array(numPixels * 4);
|
||||
for (var jj = 0; jj < numPixels; ++jj) {
|
||||
var off = jj * 4;
|
||||
pixels[off + 0] = color[0];
|
||||
pixels[off + 1] = color[1];
|
||||
pixels[off + 2] = color[2];
|
||||
pixels[off + 3] = color[3];
|
||||
function createTexture() {
|
||||
debug("<hr/>gl.createTexture()");
|
||||
mips = [];
|
||||
makeDivMipChain();
|
||||
return gl.createTexture();
|
||||
}
|
||||
|
||||
function texParameteri(target, pname, value) {
|
||||
debug("gl.texParameteri(" +
|
||||
wtu.glEnumToString(gl, target) + ", " +
|
||||
wtu.glEnumToString(gl, pname) + ", " +
|
||||
wtu.glEnumToString(gl, value) + ")")
|
||||
gl.texParameteri(target, pname, value);
|
||||
}
|
||||
|
||||
function generateMipmap() {
|
||||
debug("gl.genreateMipmap(gl.TEXTURE_2D)");
|
||||
gl.generateMipmap(gl.TEXTURE_2D);
|
||||
var mip0 = mips[0];
|
||||
var size = mip0.size;
|
||||
var level = 1;
|
||||
for(;;) {
|
||||
size = Math.floor(size / 2);
|
||||
if (!size) {
|
||||
break;
|
||||
}
|
||||
setMipData(level, size, mip0.color);
|
||||
++level;
|
||||
}
|
||||
makeDivMipChain();
|
||||
}
|
||||
|
||||
function check(color, msg) {
|
||||
wtu.drawQuad(gl);
|
||||
wtu.checkCanvas(gl, colors[color], msg + " should draw with " + color);
|
||||
}
|
||||
|
||||
function fillLevel(tex, level, size, color) {
|
||||
setMipData(level, size, color);
|
||||
debug("gl.texImage2D(gl.TEXTURE_2D, " + level + ", gl.RGBA, " + size + ", " + size +
|
||||
", 0, gl.RGBA, gl.UNSIGNED_BYTE, " + color + ");");
|
||||
wtu.fillTexture(gl, tex, size, size, colors[color], level);
|
||||
makeDivMipChain();
|
||||
}
|
||||
|
||||
function setMipData(level, size, color) {
|
||||
mips[level] = {
|
||||
size: size,
|
||||
color: color
|
||||
};
|
||||
}
|
||||
|
||||
function makeDivMipChain(color) {
|
||||
var html = [
|
||||
'<div style="height: 68px; margin-top: 5px">',
|
||||
'<div style="float:left;">mips: </div>'];
|
||||
for (var ii = 0; ii < 5; ++ii) {
|
||||
var mip = mips[ii];
|
||||
if (mip) {
|
||||
html.push(makeDivSquare(mip.size, mip.color));
|
||||
} else {
|
||||
html.push(makeDivSquare(16, undefined));
|
||||
}
|
||||
}
|
||||
html.push("</div>");
|
||||
debug(html.join(""));
|
||||
}
|
||||
|
||||
function makeDivSquare(size, color) {
|
||||
size *= 4;
|
||||
var c = color ? colors[color] : [255,255,255];
|
||||
var border = color ? 'solid' : 'dashed';
|
||||
return '<div style="float:left; width: ' + size + 'px; height: ' + size +
|
||||
'px; background-color: ' + rgb(c) +
|
||||
'; border: 1px ' + border + ' black; margin-right: 3px;"></div>';
|
||||
}
|
||||
|
||||
function rgb(c) {
|
||||
return 'rgb(' + c[0] + ',' + c[1] + ',' + c[2] +')';
|
||||
}
|
||||
gl.texImage2D(
|
||||
gl.TEXTURE_2D, level, gl.RGBA, size, size, 0, gl.RGBA, gl.UNSIGNED_BYTE,
|
||||
pixels);
|
||||
}
|
||||
|
||||
init();
|
||||
@ -173,7 +255,6 @@ successfullyParsed = true;
|
||||
</script>
|
||||
|
||||
<script src="../../resources/js-test-post.js"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
@ -8,6 +8,7 @@ conformance/reading/read-pixels-test.html
|
||||
conformance/renderbuffers/framebuffer-object-attachment.html
|
||||
conformance/textures/texture-mips.html
|
||||
conformance/uniforms/gl-uniform-bool.html
|
||||
conformance/more/conformance/quickCheckAPI-S_V.html
|
||||
conformance/more/functions/copyTexImage2D.html
|
||||
conformance/more/functions/copyTexSubImage2D.html
|
||||
conformance/more/functions/uniformfArrayLen1.html
|
||||
|
@ -12,6 +12,7 @@ conformance/state/gl-object-get-calls.html
|
||||
conformance/textures/tex-input-validation.html
|
||||
conformance/textures/texture-mips.html
|
||||
conformance/textures/texture-npot.html
|
||||
conformance/more/conformance/quickCheckAPI-S_V.html
|
||||
conformance/more/functions/copyTexImage2D.html
|
||||
conformance/more/functions/copyTexSubImage2D.html
|
||||
conformance/more/functions/uniformfBadArgs.html
|
||||
|
@ -10,6 +10,7 @@ conformance/glsl/misc/shader-with-long-line.html
|
||||
conformance/glsl/variables/gl-frontfacing.html
|
||||
conformance/reading/read-pixels-test.html
|
||||
conformance/renderbuffers/framebuffer-object-attachment.html
|
||||
conformance/more/conformance/quickCheckAPI-S_V.html
|
||||
conformance/more/functions/copyTexImage2D.html
|
||||
conformance/more/functions/copyTexSubImage2D.html
|
||||
conformance/more/functions/uniformfArrayLen1.html
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -364,6 +364,13 @@ function start() {
|
||||
.replace(/\r/g, '') // convert to unix line breaks
|
||||
.split('\n');
|
||||
|
||||
// remove empty filenames
|
||||
var indexOfEmptyFilename = testsExpectedToFail.indexOf("");
|
||||
while(indexOfEmptyFilename != -1) {
|
||||
testsExpectedToFail.splice(indexOfEmptyFilename, 1);
|
||||
indexOfEmptyFilename = testsExpectedToFail.indexOf("");
|
||||
}
|
||||
|
||||
if (kIsWindows && !kIsWindowsVistaOrHigher)
|
||||
testsExpectedToFail.push('conformance/textures/texture-mips.html');
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user