Bug 713276 - Upgrade WebGL conformance test suite to r16456, follow-up - no review

follow-up: forgot to hg add some files and reenable the shader-precision-format test
This commit is contained in:
Benoit Jacob 2012-01-10 08:47:39 -05:00
parent 157d7987b6
commit d9083fa079
4 changed files with 156 additions and 1 deletions

View File

@ -0,0 +1,2 @@
glsl-mat4-to-mat3.html

View File

@ -0,0 +1,70 @@
<!--
Copyright (c) 2011 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>GLSL mat4 to mat3 test</title>
<link rel="stylesheet" href="../../../resources/js-test-style.css"/>
<link rel="stylesheet" href="../../resources/glsl-feature-tests.css"/>
<script src="../../../resources/js-test-pre.js"></script>
<script src="../../resources/webgl-test.js"> </script>
<script src="../../resources/webgl-test-utils.js"> </script>
<script src="../../resources/glsl-generator.js"> </script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script id="shader_emu" type="something-not-js">
mat3 mat3_emu(mat4 m4) {
return mat3(
m4[0][0], m4[0][1], m4[0][2],
m4[1][0], m4[1][1], m4[1][2],
m4[2][0], m4[2][1], m4[2][2]);
}
</script>
<script id="shader_test" type="something-not-js">
mat4 m4 = mat4($(input), $(input).yzwx, $(input).zwxy, $(input).wxyz);
mat3 m3 = $(conversion)(m4);
vec3 c;
if ($(input).y < 0.33) {
c = m3[0];
} else if ($(input).y > 0.66) {
c = m3[1];
} else {
c = m3[2];
}
$(output) = vec4(c, 1);
</script>
<script>
// See resources glsl-generator runBasicTest for how this works
var wtu = WebGLTestUtils;
GLSLGenerator.runBasicTest({
gridRes: 8,
tests: [
{
name: "mat4 to mat3",
reference: {
shader: wtu.getScript("shader_test"),
subs: {
emu: wtu.getScript("shader_emu"),
conversion: "mat3_emu"
}
},
test: {
shader: wtu.getScript("shader_test"),
subs: {
conversion: "mat3"
},
}
}
]
});
successfullyParsed = true;
</script>
</body>
</html>

View File

@ -5,7 +5,7 @@ invalid-passed-params.html
is-object.html
null-object-behaviour.html
object-deletion-behaviour.html
#shader-precision-format.html
shader-precision-format.html
type-conversion-test.html
uninitialized-test.html
webgl-specific.html

View File

@ -0,0 +1,83 @@
<!--
Copyright (c) 2011 Mozilla Foundation. 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 shader precision format test.</title>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../resources/js-test-pre.js"></script>
<script src="../resources/webgl-test.js"> </script>
<script src="../resources/webgl-test-utils.js"> </script>
</head>
<body>
<canvas id="canvas" width="2" height="2" style="width: 40px; height: 40px;"></canvas>
<div id="description"></div>
<div id="console"></div>
<script>
var wtu = WebGLTestUtils;
description(document.title);
debug("Tests that WebGLShaderPrecisionFormat class and getShaderPrecisionFormat work.");
debug("");
var gl = create3DContext(document.getElementById("canvas"));
function verifyShaderPrecisionFormat(shadertype, precisiontype) {
shouldBeTrue('gl.getShaderPrecisionFormat(' + shadertype + ', ' +
precisiontype + ') instanceof WebGLShaderPrecisionFormat');
}
if (gl.getShaderPrecisionFormat == null || typeof gl.getShaderPrecisionFormat != 'function') {
debug("getShaderPrecisionFormat() function not found.");
} else {
debug("");
debug("Test that getShaderPrecisionFormat returns a WebGLShaderPrecisionFormat object.");
debug("");
verifyShaderPrecisionFormat('gl.VERTEX_SHADER', 'gl.LOW_FLOAT');
verifyShaderPrecisionFormat('gl.VERTEX_SHADER', 'gl.MEDIUM_FLOAT');
verifyShaderPrecisionFormat('gl.VERTEX_SHADER', 'gl.HIGH_FLOAT');
verifyShaderPrecisionFormat('gl.VERTEX_SHADER', 'gl.LOW_INT');
verifyShaderPrecisionFormat('gl.VERTEX_SHADER', 'gl.MEDIUM_INT');
verifyShaderPrecisionFormat('gl.VERTEX_SHADER', 'gl.HIGH_INT');
verifyShaderPrecisionFormat('gl.FRAGMENT_SHADER', 'gl.LOW_FLOAT');
verifyShaderPrecisionFormat('gl.FRAGMENT_SHADER', 'gl.MEDIUM_FLOAT');
verifyShaderPrecisionFormat('gl.FRAGMENT_SHADER', 'gl.HIGH_FLOAT');
verifyShaderPrecisionFormat('gl.FRAGMENT_SHADER', 'gl.LOW_INT');
verifyShaderPrecisionFormat('gl.FRAGMENT_SHADER', 'gl.MEDIUM_INT');
verifyShaderPrecisionFormat('gl.FRAGMENT_SHADER', 'gl.HIGH_INT');
debug("");
debug("Test that getShaderPrecisionFormat throws an error with invalid parameters.");
debug("");
shouldGenerateGLError(gl, gl.INVALID_ENUM, 'gl.getShaderPrecisionFormat(gl.HIGH_INT, gl.VERTEX_SHADER)');
debug("");
debug("Test that WebGLShaderPrecisionFormat values are sensible.");
debug("");
var shaderPrecisionFormat = gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.LOW_FLOAT);
shouldBeTrue('shaderPrecisionFormat.rangeMin >= 0 && shaderPrecisionFormat.rangeMin <= 128');
shouldBeTrue('shaderPrecisionFormat.rangeMax >= 0 && shaderPrecisionFormat.rangeMax <= 128');
shouldBeTrue('shaderPrecisionFormat.precision >= 0 && shaderPrecisionFormat.precision <= 128');
debug("");
debug("Test that getShaderPrecisionFormat returns the same thing every call.");
debug("");
var shaderPrecisionFormat2 = gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.LOW_FLOAT);
shouldBeTrue('shaderPrecisionFormat.rangeMin == shaderPrecisionFormat2.rangeMin');
shouldBeTrue('shaderPrecisionFormat.rangeMax == shaderPrecisionFormat2.rangeMax');
shouldBeTrue('shaderPrecisionFormat.precision == shaderPrecisionFormat2.precision');
}
finishTest();
</script>
</body>
</html>