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.
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;
20 gl_Position = a_position;
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];
29 gl_FragColor = u_nameCollision[
0] + u_nameCollision2[
0] + u_name[
0];
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];
38 gl_FragColor = u_nameCollision2[
0] + u_nameCollision[
0] + u_name[
0];
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];
47 gl_FragColor = u_nameCollision[
0] + u_name[
0] + u_nameCollision2[
0];
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];
56 gl_FragColor = u_nameCollision2[
0] + u_name[
0] + u_nameCollision[
0];
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];
65 gl_FragColor = u_name[
0] + u_nameCollision[
0] + u_nameCollision2[
0];
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];
74 gl_FragColor = u_name[
0] + u_nameCollision2[
0] + u_nameCollision[
0];
79 <canvas id=
"canvas" width=
"50" height=
"50"></canvas>
80 <div id=
"description"></div>
81 <div id=
"console"></div>
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;
106 <script src=
"../../../js/js-test-post.js"></script>