diff options
Diffstat (limited to 'third_party/WebKit/LayoutTests/fast/canvas/webgl/texture-complete.html')
-rw-r--r-- | third_party/WebKit/LayoutTests/fast/canvas/webgl/texture-complete.html | 128 |
1 files changed, 0 insertions, 128 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/canvas/webgl/texture-complete.html b/third_party/WebKit/LayoutTests/fast/canvas/webgl/texture-complete.html deleted file mode 100644 index d2e41eb..0000000 --- a/third_party/WebKit/LayoutTests/fast/canvas/webgl/texture-complete.html +++ /dev/null @@ -1,128 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" - "http://www.w3.org/TR/html4/loose.dtd"> -<html> -<head> -<title>WebGL "Texture Complete" texture conformance test.</title> -<script src="../../../resources/js-test.js"></script> -<script src="resources/webgl-test.js"> </script> -</head> -<body> -<canvas id="example" width="40" height="40" style="width: 40px; height: 40px;"></canvas> -<canvas id="canvas2d" width="16" height="16" style="width: 40px; height: 40px;"></canvas> -<div id="description"></div> -<div id="console"></div> -<script id="vshader" type="x-shader/x-vertex"> -#ifdef GL_ES -precision highp float; -#endif -attribute vec4 vPosition; -attribute vec2 texCoord0; -varying vec2 texCoord; -void main() -{ - gl_Position = vPosition; - texCoord = texCoord0; -} -</script> - -<script id="fshader" type="x-shader/x-fragment"> -#ifdef GL_ES -precision highp float; -#endif -uniform sampler2D tex; -varying vec2 texCoord; -void main() -{ - gl_FragColor = texture2D(tex, texCoord); -} -</script> - -<script> -function init() -{ - if (window.initNonKhronosFramework) { - window.initNonKhronosFramework(false); - } - - if (window.internals) - window.internals.settings.setWebGLErrorsToConsoleEnabled(false); - - debug("Checks that a texture that is not -texture-complete- does not draw if"+ - " filtering needs mips"); - debug(""); - - var canvas2d = document.getElementById("canvas2d"); - var ctx2d = canvas2d.getContext("2d"); - ctx2d.fillStyle = "rgba(0,192,128,255)"; - ctx2d.fillRect(0, 0, 16, 16); - - gl = initWebGL("example", "vshader", "fshader", [ "vPosition", "texCoord0"], - [ 0, 0, 0, 1 ], 1); - - gl.disable(gl.DEPTH_TEST); - gl.disable(gl.BLEND); - - var vertexObject = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject); - gl.bufferData(gl.ARRAY_BUFFER, - new Float32Array([ -1,1,0, 1,1,0, -1,-1,0, - -1,-1,0, 1,1,0, 1,-1,0 ]), - gl.STATIC_DRAW); - gl.enableVertexAttribArray(0); - gl.vertexAttribPointer(0, 3, gl.FLOAT, false, 0, 0); - - var vertexObject = gl.createBuffer(); - gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject); - gl.bufferData(gl.ARRAY_BUFFER, - new Float32Array([ 0,0, 1,0, 0,1, - 0,1, 1,0, 1,1 ]), - gl.STATIC_DRAW); - gl.enableVertexAttribArray(1); - gl.vertexAttribPointer(1, 2, gl.FLOAT, false, 0, 0); - - var tex = gl.createTexture(); - gl.bindTexture(gl.TEXTURE_2D, tex); - // 16x16 texture no mips - gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, canvas2d); - - var loc = gl.getUniformLocation(gl.program, "tex"); - gl.uniform1i(loc, 0); - - checkBuffer(0,0,0,255, - "texture that is not -texture-complete- when " + - "TEXTURE_MIN_FILTER not NEAREST or LINEAR should draw with 0,0,0,255"); - - function checkBuffer(r, g, b, a, msg) { - gl.clearColor(1,1,1,1); - gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); - gl.drawArrays(gl.TRIANGLES, 0, 6); - gl.flush(); - var buf = new Uint8Array(4 * 4 * 4); - gl.readPixels(0, 0, 4, 4, gl.RGBA, gl.UNSIGNED_BYTE, buf); - for (var i = 0; i < 4 * 4; ++i) { - var offset = i * 4; - if (buf[offset + 0] != r || - buf[offset + 1] != g || - buf[offset + 2] != b || - buf[offset + 3] != a) { - debug('expected: ' + r + ', ' + g + ', ' + b + ', ' + a + - ' was: ' + - buf[offset + 0] + ', ' + - buf[offset + 1] + ', ' + - buf[offset + 2] + ', ' + - buf[offset + 3]); - testFailed(msg); - return; - } - } - testPassed(msg); - } -} - -init(); -</script> - - -</body> -</html> - |