diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /dom/canvas/test/webgl-conf/checkout/conformance/glsl/samplers | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/canvas/test/webgl-conf/checkout/conformance/glsl/samplers')
5 files changed, 554 insertions, 0 deletions
diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/samplers/00_test_list.txt b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/samplers/00_test_list.txt new file mode 100644 index 000000000..c0f612d81 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/samplers/00_test_list.txt @@ -0,0 +1,4 @@ +glsl-function-texture2d-bias.html +glsl-function-texture2dlod.html +glsl-function-texture2dproj.html +--min-version 1.0.3 glsl-function-texture2dprojlod.html diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/samplers/glsl-function-texture2d-bias.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/samplers/glsl-function-texture2d-bias.html new file mode 100644 index 000000000..da197eb15 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/samplers/glsl-function-texture2d-bias.html @@ -0,0 +1,122 @@ +<!-- + +/* +** Copyright (c) 2012 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +--> + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>WebGL texture2D GLSL conformance test.</title> +<link rel="stylesheet" href="../../../resources/js-test-style.css"/> +<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/> +<script src="../../../js/js-test-pre.js"></script> +<script src="../../../js/webgl-test-utils.js"> </script> +</head> +<body> +<canvas id="example" width="256" height="256" style="width: 16px; height: 16px;"></canvas> +<div id="description"></div> +<div id="console"></div> +<script id="vshader2d" type="x-shader/x-vertex"> +attribute vec4 vPosition; +attribute vec2 texCoord0; +varying vec2 texCoord; +void main() { + gl_Position = vPosition; + texCoord = texCoord0; +} +</script> +<script id="fshader2d" type="x-shader/x-fragment"> +precision mediump float; +uniform sampler2D tex; +uniform float bias; +varying vec2 texCoord; +void main() { + gl_FragData[0] = texture2D(tex, texCoord, bias); +} +</script> +<script> +"use strict"; +description("tests GLSL texture2D function with bias"); + +var wtu = WebGLTestUtils; +var canvas = document.getElementById("example"); + +shouldBe("canvas.width", "256"); +shouldBe("canvas.height", "256"); + +var gl = wtu.create3DContext(canvas); +var program = wtu.setupProgram( + gl, ['vshader2d', 'fshader2d'], ['vPosition', 'texCoord0'], [0, 1]); +wtu.setupUnitQuad(gl, 0, 1); + +var colors = [ + {name: 'red', color:[255, 0, 0, 255]}, + {name: 'green', color:[0, 255, 0, 255]}, + {name: 'blue', color:[0, 0, 255, 255]}, + {name: 'yellow', color:[255, 255, 0, 255]}, + {name: 'magenta', color:[255, 0, 255, 255]}, + {name: 'cyan', color:[0, 255, 255, 255]}, + {name: 'pink', color:[255, 128, 128, 255]}, + {name: 'gray', color:[128, 128, 128, 255]}, + {name: 'light green', color:[128, 255, 128, 255]}, +]; + +shouldBe("colors.length", "9"); + +var tex = gl.createTexture(); +gl.bindTexture(gl.TEXTURE_2D, tex); +gl.texParameteri( + gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_NEAREST); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT); + +for (var ii = 0; ii < colors.length; ++ii) { + var color = colors[ii]; + var size = Math.pow(2, colors.length - ii - 1); + wtu.fillTexture(gl, tex, size, size, color.color, ii); +} + +var loc = gl.getUniformLocation(program, "bias"); + +for (var ii = 0; ii < colors.length; ++ii) { + gl.uniform1f(loc, ii); + var color = colors[ii]; + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas( + gl, color.color, + "256x256 texture drawn to 256x256 dest with bias = " + ii + + " should be " + color.name); +} +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors."); + +var successfullyParsed = true; + +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/samplers/glsl-function-texture2dlod.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/samplers/glsl-function-texture2dlod.html new file mode 100644 index 000000000..2f1a8f95f --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/samplers/glsl-function-texture2dlod.html @@ -0,0 +1,130 @@ +<!-- + +/* +** Copyright (c) 2012 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +--> + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>WebGL texture2D GLSL conformance test.</title> +<link rel="stylesheet" href="../../../resources/js-test-style.css"/> +<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/> +<script src="../../../js/js-test-pre.js"></script> +<script src="../../../js/webgl-test-utils.js"> </script> +</head> +<body> +<canvas id="example" width="256" height="256" style="width: 16px; height: 16px;"></canvas> +<div id="description"></div> +<div id="console"></div> +<script id="vshader2d" type="x-shader/x-vertex"> +attribute vec4 vPosition; +attribute vec2 texCoord0; +varying vec4 color; +uniform sampler2D tex; +uniform float lod; +void main() { + gl_Position = vPosition; + color = texture2DLod(tex, texCoord0, lod); +} +</script> +<script id="fshader2d" type="x-shader/x-fragment"> +precision mediump float; +varying vec4 color; +void main() { + gl_FragData[0] = color; +} +</script> +<script> +"use strict"; +description("tests GLSL texture2DLod function"); + +var wtu = WebGLTestUtils; +var canvas = document.getElementById("example"); + +shouldBe("canvas.width", "256"); +shouldBe("canvas.height", "256"); + +var colors = [ + {name: 'red', color:[255, 0, 0, 255]}, + {name: 'green', color:[0, 255, 0, 255]}, + {name: 'blue', color:[0, 0, 255, 255]}, + {name: 'yellow', color:[255, 255, 0, 255]}, + {name: 'magenta', color:[255, 0, 255, 255]}, + {name: 'cyan', color:[0, 255, 255, 255]}, + {name: 'pink', color:[255, 128, 128, 255]}, + {name: 'gray', color:[128, 128, 128, 255]}, + {name: 'light green', color:[128, 255, 128, 255]}, +]; + +var gl = wtu.create3DContext(canvas); +if (gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS) > 0) { + runTest(); +} else { + testPassed("MAX_VERTEX_TEXTURE_IMAGE_UNITS == 0, this is okay."); +} + +function runTest() { + var program = wtu.setupProgram( + gl, ['vshader2d', 'fshader2d'], ['vPosition', 'texCoord0'], [0, 1]); + wtu.setupUnitQuad(gl, 0, 1); + + shouldBe("colors.length", "9"); + + var tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tex); + gl.texParameteri( + gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST_MIPMAP_LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT); + + for (var ii = 0; ii < colors.length; ++ii) { + var color = colors[ii]; + var size = Math.pow(2, colors.length - ii - 1); + wtu.fillTexture(gl, tex, size, size, color.color, ii); + } + + var loc = gl.getUniformLocation(program, "lod"); + + for (var ii = 0; ii < colors.length; ++ii) { + gl.uniform1f(loc, ii); + var color = colors[ii]; + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas( + gl, color.color, + "256x256 texture drawn to 256x256 dest with lod = " + ii + + " should be " + color.name); + } + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors."); +} + +var successfullyParsed = true; + +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/samplers/glsl-function-texture2dproj.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/samplers/glsl-function-texture2dproj.html new file mode 100644 index 000000000..6d5c81cb7 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/samplers/glsl-function-texture2dproj.html @@ -0,0 +1,137 @@ +<!-- + +/* +** Copyright (c) 2012 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +--> + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>WebGL texture2D GLSL conformance test.</title> +<link rel="stylesheet" href="../../../resources/js-test-style.css"/> +<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/> +<script src="../../../js/js-test-pre.js"></script> +<script src="../../../js/webgl-test-utils.js"> </script> +</head> +<body> +<canvas id="example" width="32" height="32"></canvas> +<div id="description"></div> +<div id="console"></div> +<script id="vshader0" type="x-shader/x-vertex"> +attribute vec4 vPosition; +attribute vec2 texCoord0; +varying vec2 texCoord; +void main() { + gl_Position = vPosition; + texCoord = texCoord0; +} +</script> +<script id="fshader0" type="x-shader/x-fragment"> +precision mediump float; +uniform sampler2D tex; +uniform float divisor; +varying vec2 texCoord; +void main() { + gl_FragData[0] = texture2DProj(tex, vec3(texCoord, divisor)); +} +</script> +<script id="vshader1" type="x-shader/x-vertex"> +attribute vec4 vPosition; +attribute vec2 texCoord0; +varying vec2 texCoord; +void main() { + gl_Position = vPosition; + texCoord = texCoord0; +} +</script> +<script id="fshader1" type="x-shader/x-fragment"> +precision mediump float; +uniform sampler2D tex; +uniform float divisor; +varying vec2 texCoord; +void main() { + gl_FragData[0] = texture2DProj(tex, vec4(texCoord, 123.0, divisor)); +} +</script> +<script> +"use strict"; +description("tests GLSL texture2DProj function with"); + +var wtu = WebGLTestUtils; +var gl = wtu.create3DContext("example", {antialias: false}); + +wtu.setupUnitQuad(gl, 0, 1); +var tex = gl.createTexture(); +gl.bindTexture(gl.TEXTURE_2D, tex); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT); +gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT); + +var c = document.createElement("canvas"); +c.width = 16; +c.height = 16; +var ctx = c.getContext("2d"); +ctx.fillStyle = "rgb(0,255,0)"; +ctx.fillRect(0, 0, 16, 16); +ctx.fillStyle = "rgb(0,0,255)"; +ctx.fillRect(0, 0, 8, 8); +ctx.fillRect(8, 8, 8, 8); + +gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c); + +for (var ss = 0; ss < 2; ++ss) { + debug(""); + debug(ss ? "testing vec4 version" : "testing vec3 version"); + var program = wtu.setupProgram( + gl, ['vshader' + ss, 'fshader' + ss], + ['vPosition', 'texCoord0'], [0, 1]); + gl.useProgram(program); + var loc = gl.getUniformLocation(program, "divisor"); + + for (var ii = 0; ii < 3; ++ii) { + var denominator = Math.pow(2, ii); + gl.uniform1f(loc, 1 / denominator); + wtu.clearAndDrawUnitQuad(gl); + var size = 16 / denominator; + for (var yy = 0; yy < 32; yy += size) { + for (var xx = 0; xx < 32; xx += size) { + var odd = (xx / size + yy / size) % 2; + var color = odd ? [0, 255, 0, 255] : [0, 0, 255, 255]; + var msg = "" + xx + ", " + yy + ", " + size + ", " + size + " should be " + (odd ? "green" : "blue"); + wtu.checkCanvasRect(gl, xx, yy, size, size, color, msg); + } + } + } +} +wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors."); + +var successfullyParsed = true; + +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> diff --git a/dom/canvas/test/webgl-conf/checkout/conformance/glsl/samplers/glsl-function-texture2dprojlod.html b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/samplers/glsl-function-texture2dprojlod.html new file mode 100644 index 000000000..388ec09a1 --- /dev/null +++ b/dom/canvas/test/webgl-conf/checkout/conformance/glsl/samplers/glsl-function-texture2dprojlod.html @@ -0,0 +1,161 @@ +<!-- + +/* +** Copyright (c) 2014 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +--> + +<!DOCTYPE html> +<html> +<head> +<meta charset="utf-8"> +<title>WebGL texture2D GLSL conformance test.</title> +<link rel="stylesheet" href="../../../resources/js-test-style.css"/> +<link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/> +<script src="../../../js/js-test-pre.js"></script> +<script src="../../../js/webgl-test-utils.js"> </script> +</head> +<body> +<canvas id="example" width="256" height="256" style="width: 16px; height: 16px;"></canvas> +<div id="description"></div> +<div id="console"></div> +<script id="vshader2d0" type="x-shader/x-vertex"> +attribute vec4 vPosition; +varying vec4 color; +uniform sampler2D tex; +uniform float divisor; +uniform float lod; +void main() { + gl_Position = vPosition; + color = texture2DProjLod(tex, vec3(0.75 * divisor, 0.25 * divisor, divisor), lod); +} +</script> +<script id="vshader2d1" type="x-shader/x-vertex"> +attribute vec4 vPosition; +varying vec4 color; +uniform sampler2D tex; +uniform float divisor; +uniform float lod; +void main() { + gl_Position = vPosition; + color = texture2DProjLod(tex, vec4(0.75 * divisor, 0.25 * divisor, 123.0, divisor), lod); +} +</script> +<script id="fshader2d" type="x-shader/x-fragment"> +precision mediump float; +varying vec4 color; +void main() { + gl_FragData[0] = color; +} +</script> +<script> +"use strict"; +description("tests GLSL texture2DProjLod function"); + +var wtu = WebGLTestUtils; +var canvas = document.getElementById("example"); + +shouldBe("canvas.width", "256"); +shouldBe("canvas.height", "256"); + +var colors = [ + {name: 'red', color:[255, 0, 0, 255]}, + {name: 'green', color:[0, 255, 0, 255]}, + {name: 'blue', color:[0, 0, 255, 255]}, + {name: 'yellow', color:[255, 255, 0, 255]}, + {name: 'magenta', color:[255, 0, 255, 255]}, + {name: 'cyan', color:[0, 255, 255, 255]}, + {name: 'pink', color:[255, 128, 128, 255]}, + {name: 'gray', color:[128, 128, 128, 255]}, + {name: 'light green', color:[128, 255, 128, 255]}, +]; + +var gl = wtu.create3DContext(canvas); +if (gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS) > 0) { + runTest(); +} else { + testPassed("MAX_VERTEX_TEXTURE_IMAGE_UNITS == 0, this is okay."); +} + +function runTest() { + shouldBe("colors.length", "9"); + for (var ss = 0; ss < 2; ++ss) { + debug(""); + debug(ss ? "testing vec4 version" : "testing vec3 version"); + var program = wtu.setupProgram( + gl, ['vshader2d' + ss, 'fshader2d'], ['vPosition', 'texCoord0'], [0, 1]); + wtu.setupUnitQuad(gl, 0, 1); + + var tex = gl.createTexture(); + gl.bindTexture(gl.TEXTURE_2D, tex); + gl.texParameteri( + gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST_MIPMAP_NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.REPEAT); + gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.REPEAT); + + // Fill the top right quadrant of each texture level with one of the colors + for (var ii = 0; ii < colors.length; ++ii) { + var color = colors[ii]; + var size = Math.pow(2, colors.length - ii - 1); + + var c = document.createElement("canvas"); + c.width = size; + c.height = size; + var ctx = c.getContext("2d"); + ctx.fillStyle = "rgb(0,0,0)"; + ctx.fillRect(0, 0, size, size); + ctx.fillStyle = "rgb(" + color.color[0] + "," + color.color[1] + "," + color.color[2] + ")"; + ctx.fillRect(size / 2, 0, size / 2, size / 2); + + gl.texImage2D(gl.TEXTURE_2D, ii, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, c); + } + + var lodLoc = gl.getUniformLocation(program, "lod"); + var divLoc = gl.getUniformLocation(program, "divisor"); + + for (var div = 1; div < 4; ++div) { + for (var ii = 0; ii < colors.length - 1; ++ii) { + gl.uniform1f(lodLoc, ii); + gl.uniform1f(divLoc, div); + var lodColor = colors[ii]; + var size = Math.pow(2, colors.length - ii - 1); + wtu.clearAndDrawUnitQuad(gl); + wtu.checkCanvas( + gl, lodColor.color, + "sampling with lod = " + ii + + " divider = " + div + + " should be " + lodColor.name); + } + } + } + wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors."); +} + +var successfullyParsed = true; + +</script> +<script src="../../../js/js-test-post.js"></script> + +</body> +</html> |