Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Side by Side Diff: third_party/webgl/sdk/tests/conformance/glsl/variables/gl-frontfacing.html

Issue 9373009: Check in webgl conformance tests r16844 from khronos. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 <!--
2 Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 Use of this source code is governed by a BSD-style license that can be
4 found in the LICENSE file.
5 -->
6 <!DOCTYPE html>
7 <html>
8 <head>
9 <meta charset="utf-8">
10 <title>gl-fragcoord Test</title>
11 <link rel="stylesheet" href="../../../resources/js-test-style.css"/>
12 <script src="../../../resources/js-test-pre.js"></script>
13 <script src="../../resources/webgl-test.js"> </script>
14 <script src="../../resources/webgl-test-utils.js"> </script>
15 </head>
16 <body>
17 <canvas id="example" width="32" height="32">
18 </canvas>
19 <div id="description"></div>
20 <div id="console"></div>
21 <script id="vshader" type="x-shader/x-vertex">
22 attribute vec4 vPosition;
23 void main()
24 {
25 gl_Position = vPosition;
26 }
27 </script>
28
29 <script id="fshader" type="x-shader/x-fragment">
30 precision mediump float;
31 void main()
32 {
33 gl_FragColor = vec4(
34 gl_FrontFacing ? 1.0 : 0.0,
35 gl_FrontFacing ? 0.0 : 1.0,
36 0,
37 1);
38 }
39 </script>
40
41 <script>
42 function init()
43 {
44 if (window.initNonKhronosFramework) {
45 window.initNonKhronosFramework(false);
46 }
47
48 description("tests gl_FrontFacing");
49
50 wtu = WebGLTestUtils;
51 gl = initWebGL("example", "vshader", "fshader", [ "vPosition"], [ 0, 0, 0, 1 ], 1);
52
53 var gridRes = 4;
54 wtu.setupQuad(gl, gridRes, 0, true);
55
56 gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
57 gl.drawElements(gl.TRIANGLES, gridRes * gridRes * 6, gl.UNSIGNED_SHORT, 0) ;
58 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "no errors from draw");
59
60 var step = 32 / gridRes;
61 var halfStep = step / 2;
62 var quarterStep = halfStep / 2;
63 for (var xx = 0; xx < 32; xx += step) {
64 for (var yy = 0; yy < 32; yy += step) {
65 for (var ii = 0; ii < 2; ++ii) {
66 var color = [
67 ii == 0 ? 255 : 0,
68 ii == 0 ? 0 : 255,
69 0
70 ];
71 var msg = "should be " + color;
72 wtu.checkCanvasRect(
73 gl,
74 xx + quarterStep + halfStep * ii,
75 yy + quarterStep + halfStep * ii,
76 1, 1, color, msg, 4);
77 }
78 }
79 }
80 }
81
82 init();
83 successfullyParsed = true;
84 </script>
85 <script src="../../../resources/js-test-post.js"></script>
86
87 </body>
88 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698