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,120 @@ |
+<!-- |
+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 texture2D GLSL conformance 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="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-vertex"> |
+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-vertex"> |
+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 canvas = document.getElementById("example"); |
+ |
+var gl = wtu.create3DContext(canvas, {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, |
+ [wtu.loadShaderFromScript(gl, 'vshader' + ss, gl.VERTEX_SHADER), |
+ wtu.loadShaderFromScript(gl, 'fshader' + ss, gl.FRAGMENT_SHADER)], |
+ ['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 |