4 ** Copyright (c) 2013 The Khronos Group Inc.
6 ** Permission is hereby granted, free of charge, to any person obtaining a
7 ** copy of this software and/or associated documentation files (the
8 ** "Materials"), to deal in the Materials without restriction, including
9 ** without limitation the rights to use, copy, modify, merge, publish,
10 ** distribute, sublicense, and/or sell copies of the Materials, and to
11 ** permit persons to whom the Materials are furnished to do so, subject to
12 ** the following conditions:
14 ** The above copyright notice and this permission notice shall be included
15 ** in all copies or substantial portions of the Materials.
17 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
31 <meta charset="utf-8">
32 <title>Driver bug - Comparing loop index against uniform in a fragment shader should work</title>
33 <link rel="stylesheet" href="../../../resources/js-test-style.css"/>
34 <script src="../../../resources/js-test-pre.js"></script>
35 <script src="../../resources/webgl-test-utils.js"></script>
38 <canvas id="canvas" width="256" height="256"> </canvas>
39 <div id="description"></div>
40 <div id="console"></div>
41 <script id="vshader" type="x-shader/x-vertex">
42 attribute vec3 aPosition;
45 gl_Position = vec4(aPosition, 1);
48 <script id="fshader" type="x-shader/x-fragment">
49 precision mediump float;
54 for (int i = 0; i < 5; ++i) {
59 gl_FragColor = vec4(1.0 - a, a, 0.0, 1.0);
62 <script type="text/javascript">
64 description("Comparing loop index to an uniform in a fragment shader should work.");
66 var wtu = WebGLTestUtils;
68 var gl = wtu.create3DContext("canvas");
70 testFailed("context does not exist");
73 wtu.setupUnitQuad(gl);
74 var program = wtu.setupProgram(gl, ["vshader", "fshader"], ["aPosition"], undefined, true);
75 var uniformLoc = gl.getUniformLocation(program, 'uCount');
76 gl.uniform1i(uniformLoc, 5);
78 wtu.checkCanvasRect(gl, 0, 0, 256, 256, [0, 255, 0, 255]);
82 var successfullyParsed = true;