Index: third_party/webgl/sdk/tests/conformance/glsl/samplers/glsl-function-texture2dproj.html |
=================================================================== |
--- third_party/webgl/sdk/tests/conformance/glsl/samplers/glsl-function-texture2dproj.html (revision 0) |
+++ third_party/webgl/sdk/tests/conformance/glsl/samplers/glsl-function-texture2dproj.html (revision 0) |
@@ -0,0 +1,139 @@ |
+<!-- |
+ |
+/* |
+** 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="../../../resources/js-test-pre.js"></script> |
+<script src="../../resources/webgl-test.js"> </script> |
+<script src="../../resources/webgl-test-utils.js"> </script> |
+</head> |
+<body> |
+<canvas id="example" width="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> |
+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.drawQuad(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); |
+ } |
+ } |
+ } |
+} |
+glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors."); |
+ |
+successfullyParsed = true; |
+ |
+</script> |
+<script src="../../../resources/js-test-post.js"></script> |
+ |
+</body> |
+</html> |
+ |
+ |
Property changes on: third_party/webgl/sdk/tests/conformance/glsl/samplers/glsl-function-texture2dproj.html |
___________________________________________________________________ |
Added: svn:eol-style |
+ LF |