Backed out changeset 7272b7396c78 (bug 1932758) for causing fenix debug failures...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance / limits / gl-min-attribs.html
blob368130306c4a0e9a9f5009f57c4495a5c0613ca4
1 <!--
2 Copyright (c) 2019 The Khronos Group Inc.
3 Use of this source code is governed by an MIT-style license that can be
4 found in the LICENSE.txt file.
5 -->
7 <!DOCTYPE html>
8 <html>
9 <head>
10 <meta charset="utf-8">
11 <title>WebGL the minimum number of attributes are supported.</title>
12 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
13 <script src="../../js/js-test-pre.js"></script>
14 <script src="../../js/webgl-test-utils.js"> </script>
15 </head>
16 <body>
17 <canvas id="example" width="4" height="4" style="width: 40px; height: 30px;"></canvas>
18 <div id="description"></div>
19 <div id="console"></div>
20 <script id="vshader" type="x-shader/x-vertex">
21 attribute vec4 vPosition;
22 attribute vec4 v0;
23 attribute vec4 v1;
24 attribute vec4 v2;
25 attribute vec4 v3;
26 attribute vec4 v4;
27 attribute vec4 v5;
28 attribute vec4 v6;
29 varying vec4 color;
30 void main()
32 gl_Position = vPosition;
33 color = v0 + v1 + v2 + v3 + v4 + v5 + v6;
35 </script>
37 <script id="fshader" type="x-shader/x-fragment">
38 precision mediump float;
39 varying vec4 color;
40 void main()
42 gl_FragColor = color;
44 </script>
45 <script>
46 "use strict";
47 description(document.title);
48 var wtu = WebGLTestUtils;
49 var gl = wtu.create3DContext("example");
50 var program = wtu.setupTexturedQuad(gl);
52 var program = wtu.setupProgram(
53 gl,
54 ['vshader', 'fshader'],
55 ['vPosition', 'v0', 'v1', 'v2', 'v3', 'v4', 'v5', 'v6'],
56 [0, 1, 2, 3, 4, 5, 6, 7]);
58 for (var ii = 0; ii < 7; ++ii) {
59 var v = (ii + 1) / 28;
60 var vertexObject = gl.createBuffer();
61 gl.bindBuffer(gl.ARRAY_BUFFER, vertexObject);
62 gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
63 v, v/2, v/4, v/8,
64 v, v/2, v/4, v/8,
65 v, v/2, v/4, v/8,
66 v, v/2, v/4, v/8,
67 v, v/2, v/4, v/8,
68 v, v/2, v/4, v/8]), gl.STATIC_DRAW);
69 gl.enableVertexAttribArray(ii + 1);
70 gl.vertexAttribPointer(ii + 1, 4, gl.FLOAT, false, 0, 0);
73 wtu.clearAndDrawUnitQuad(gl);
74 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "Should be no errors from setup.");
75 wtu.checkCanvasRect(gl, 0, 0, gl.canvas.width, gl.canvas.height, [255, 127, 64, 32], "Should render 255,127,64,32 (+/-1)", 1);
77 var successfullyParsed = true;
79 </script>
80 </body>
81 <script src="../../js/js-test-post.js"></script>
83 </body>
84 </html>