Bug 1918529 - fix some subpixel misalignment issues with gfx.webrender.svg-filter...
[gecko.git] / dom / canvas / test / webgl-conf / checkout / conformance / glsl / misc / shader-with-similar-uniform-array-names.html
blobe96ab4055c7ad09cb434883c0ddcd8bcdee455ff
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>GLSL similar names issue</title>
12 <link rel="stylesheet" href="../../../resources/js-test-style.css"/>
13 <link rel="stylesheet" href="../../../resources/glsl-feature-tests.css"/>
14 <script src="../../../js/js-test-pre.js"></script>
15 <script src="../../../js/webgl-test-utils.js"> </script>
17 <script id="vshader" type="x-shader/x-vertex">
18 attribute vec4 a_position;
19 void main(void) {
20 gl_Position = a_position;
22 </script>
23 <script id="fshader1" type="x-shader/x-fragment">
24 precision mediump float;
25 uniform vec4 u_nameCollision[2];
26 uniform vec4 u_nameCollision2[2];
27 uniform vec4 u_name[2];
28 void main(void) {
29 gl_FragColor = u_nameCollision[0] + u_nameCollision2[0] + u_name[0];
31 </script>
32 <script id="fshader2" type="x-shader/x-fragment">
33 precision mediump float;
34 uniform vec4 u_nameCollision2[2];
35 uniform vec4 u_nameCollision[2];
36 uniform vec4 u_name[2];
37 void main(void) {
38 gl_FragColor = u_nameCollision2[0] + u_nameCollision[0] + u_name[0];
40 </script>
41 <script id="fshader3" type="x-shader/x-fragment">
42 precision mediump float;
43 uniform vec4 u_nameCollision[2];
44 uniform vec4 u_name[2];
45 uniform vec4 u_nameCollision2[2];
46 void main(void) {
47 gl_FragColor = u_nameCollision[0] + u_name[0] + u_nameCollision2[0];
49 </script>
50 <script id="fshader4" type="x-shader/x-fragment">
51 precision mediump float;
52 uniform vec4 u_nameCollision2[2];
53 uniform vec4 u_name[2];
54 uniform vec4 u_nameCollision[2];
55 void main(void) {
56 gl_FragColor = u_nameCollision2[0] + u_name[0] + u_nameCollision[0];
58 </script>
59 <script id="fshader5" type="x-shader/x-fragment">
60 precision mediump float;
61 uniform vec4 u_name[2];
62 uniform vec4 u_nameCollision[2];
63 uniform vec4 u_nameCollision2[2];
64 void main(void) {
65 gl_FragColor = u_name[0] + u_nameCollision[0] + u_nameCollision2[0];
67 </script>
68 <script id="fshader6" type="x-shader/x-fragment">
69 precision mediump float;
70 uniform vec4 u_name[2];
71 uniform vec4 u_nameCollision2[2];
72 uniform vec4 u_nameCollision[2];
73 void main(void) {
74 gl_FragColor = u_name[0] + u_nameCollision2[0] + u_nameCollision[0];
76 </script>
77 </head>
78 <body>
79 <canvas id="canvas" width="50" height="50"></canvas>
80 <div id="description"></div>
81 <div id="console"></div>
82 <script>
83 "use strict";
84 description();
86 var wtu = WebGLTestUtils;
87 var gl = wtu.create3DContext("canvas");
88 wtu.setupUnitQuad(gl);
90 for (var ii = 0; ii < 6; ++ii) {
91 var program = wtu.setupProgram(gl, ["vshader", "fshader" + (ii + 1)], ["a_position"]);
92 var loc1 = gl.getUniformLocation(program, "u_name[0]");
93 var loc2 = gl.getUniformLocation(program, "u_nameCollision[0]");
94 var loc3 = gl.getUniformLocation(program, "u_nameCollision2[0]");
95 gl.uniform4fv(loc1, [1, 0, 0, 0]);
96 gl.uniform4fv(loc2, [0, 1, 0, 0]);
97 gl.uniform4fv(loc3, [0, 0, 0, 1]);
98 wtu.clearAndDrawUnitQuad(gl);
99 wtu.checkCanvas(gl, [255, 255, 0, 255], "Should be yellow");
102 wtu.glErrorShouldBe(gl, gl.NO_ERROR, "there should be no errors");
104 var successfullyParsed = true;
105 </script>
106 <script src="../../../js/js-test-post.js"></script>
107 </body>
108 </html>