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

Side by Side Diff: conformance/more/glsl/arrayOutOfBounds.html

Issue 41503006: Add ToT WebGL conformance tests : part 8 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/webgl/sdk/tests/
Patch Set: Created 7 years, 1 month 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
## -0,0 +1 ##
+LF
\ No newline at end of property
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <meta charset="utf-8">
5 <!--
6
7 /*
8 ** Copyright (c) 2012 The Khronos Group Inc.
9 **
10 ** Permission is hereby granted, free of charge, to any person obtaining a
11 ** copy of this software and/or associated documentation files (the
12 ** "Materials"), to deal in the Materials without restriction, including
13 ** without limitation the rights to use, copy, modify, merge, publish,
14 ** distribute, sublicense, and/or sell copies of the Materials, and to
15 ** permit persons to whom the Materials are furnished to do so, subject to
16 ** the following conditions:
17 **
18 ** The above copyright notice and this permission notice shall be included
19 ** in all copies or substantial portions of the Materials.
20 **
21 ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 ** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
25 ** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
26 ** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
27 ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
28 */
29
30 -->
31 <link rel="stylesheet" type="text/css" href="../unit.css" />
32 <script type="application/x-javascript" src="../unit.js"></script>
33 <script type="application/x-javascript" src="../util.js"></script>
34 <script type="application/x-javascript">
35
36 Tests.startUnit = function () {
37 var canvas = document.getElementById('gl');
38 var gl = getGLContext(canvas);
39 return [gl];
40 }
41
42 Tests.testOk = function(gl) {
43 var sh = new Filter(gl, 'okvert', 'frag');
44 assertOk(function(){sh.apply();});
45 sh.destroy();
46
47 var sh = new Filter(gl, 'vert', 'okfrag');
48 assertOk(function(){sh.apply();});
49 sh.destroy();
50
51 var sh = new Filter(gl, 'vert', 'frag');
52 assertOk(function(){sh.apply();});
53 sh.destroy();
54 }
55
56 var arr = ['cr', 'cw', 'vr', 'vw'];
57 arr.forEach(function(e){
58 if (e == 'cr' || e == 'cw') {
59 Tests['test'+e+'vert'] = function(gl) {
60 var sh = new Filter(gl, e+'vert', 'frag');
61 assertFail(function(){sh.apply();});
62 sh.destroy();
63 }
64 }
65 Tests['test'+e+'frag'] = function(gl) {
66 var sh = new Filter(gl, 'vert', e+'frag');
67 assertFail(function(){sh.apply();});
68 sh.destroy();
69 }
70 });
71
72
73 </script>
74 <script id="okvert" type="x-shader/x-vertex">
75
76
77 attribute vec3 Vertex;
78 attribute vec2 Tex;
79 varying vec2 TexCoord;
80 void main()
81 {
82 TexCoord = Tex;
83 float x[3];
84 x[0] = 1.0;
85 x[1] = 2.0;
86 x[2] = 3.0;
87 gl_Position = vec4(Vertex, x[2]);
88 }
89 </script>
90 <script id="crvert" type="x-shader/x-vertex">
91
92
93 attribute vec3 Vertex;
94 attribute vec2 Tex;
95 varying vec2 TexCoord;
96 void main()
97 {
98 TexCoord = Tex;
99 float x[3];
100 x[0] = 1.0;
101 x[1] = 2.0;
102 x[2] = 3.0;
103 gl_Position = vec4(Vertex, x[4]);
104 }
105 </script>
106 <script id="cwvert" type="x-shader/x-vertex">
107
108
109 attribute vec3 Vertex;
110 attribute vec2 Tex;
111 varying vec2 TexCoord;
112 void main()
113 {
114 TexCoord = Tex;
115 float x[3];
116 x[0] = 1.0;
117 x[1] = 2.0;
118 x[2] = 3.0;
119 x[4] = Vertex.z;
120 gl_Position = vec4(Vertex, x[4]);
121 }
122 </script>
123 <!-- This one can't be required to fail compilation, because vertex shaders must support arbitrary array indexing -->
124 <script id="vrvert" type="x-shader/x-vertex">
125
126
127 attribute vec3 Vertex;
128 attribute vec2 Tex;
129 varying vec2 TexCoord;
130 void main()
131 {
132 TexCoord = Tex;
133 float x[3];
134 x[0] = 1.0;
135 x[1] = 2.0;
136 x[2] = 3.0;
137 int idx = 4 * int(max(1.0, Vertex.x*20.0));
138 gl_Position = vec4(Vertex, x[idx]);
139 }
140 </script>
141 <!-- This one can't be required to fail compilation, because vertex shaders must support arbitrary array indexing -->
142 <script id="vwvert" type="x-shader/x-vertex">
143
144
145 attribute vec3 Vertex;
146 attribute vec2 Tex;
147 varying vec2 TexCoord;
148 void main()
149 {
150 TexCoord = Tex;
151 float x[3];
152 x[0] = 1.0;
153 x[1] = 2.0;
154 x[2] = 3.0;
155 int idx = 4 * int(max(1.0, Vertex.x*20.0));
156 x[idx] = Vertex.z;
157 gl_Position = vec4(Vertex, x[idx]);
158 }
159 </script>
160 <script id="vert" type="x-shader/x-vertex">
161
162
163 attribute vec3 Vertex;
164 attribute vec2 Tex;
165 varying vec2 TexCoord;
166 void main()
167 {
168 TexCoord = Tex;
169 gl_Position = vec4(Vertex, 0.0);
170 }
171 </script>
172
173 <script id="okfrag" type="x-shader/x-fragment">
174
175
176 precision mediump float;
177
178 varying vec2 TexCoord;
179
180 void main()
181 {
182 float x[3];
183 x[0] = 1.0;
184 x[1] = 2.0;
185 x[2] = 3.0;
186 gl_FragColor = vec4(1.0, 0.0, TexCoord.s, x[2]);
187 }
188 </script>
189 <script id="crfrag" type="x-shader/x-fragment">
190
191
192 precision mediump float;
193
194 varying vec2 TexCoord;
195
196 void main()
197 {
198 float x[3];
199 x[0] = 1.0;
200 x[1] = 2.0;
201 x[2] = 3.0;
202 gl_FragColor = vec4(1.0, 0.0, TexCoord.s, x[4]);
203 }
204 </script>
205 <script id="cwfrag" type="x-shader/x-fragment">
206
207
208 precision mediump float;
209
210 varying vec2 TexCoord;
211
212 void main()
213 {
214 float x[3];
215 x[0] = 1.0;
216 x[1] = 2.0;
217 x[2] = 3.0;
218
219 x[4] = 6.0;
220 gl_FragColor = vec4(1.0, 0.0, TexCoord.s, x[4]);
221 }
222 </script>
223 <!-- This one actually fails because of WebGL's restrictions on indexing express ions in fragment shaders -->
224 <script id="vrfrag" type="x-shader/x-fragment">
225
226
227 precision mediump float;
228
229 varying vec2 TexCoord;
230
231 void main()
232 {
233 float x[3];
234 x[0] = 1.0;
235 x[1] = 2.0;
236 x[2] = 3.0;
237
238 int idx = 4 * int(max(1.0, TexCoord.x*20.0));
239 gl_FragColor = vec4(1.0, 0.0, TexCoord.s, x[idx]);
240 }
241 </script>
242 <!-- This one actually fails because of WebGL's restrictions on indexing express ions in fragment shaders -->
243 <script id="vwfrag" type="x-shader/x-fragment">
244
245
246 precision mediump float;
247
248 varying vec2 TexCoord;
249
250 void main()
251 {
252 float x[3];
253 x[0] = 1.0;
254 x[1] = 2.0;
255 x[2] = 3.0;
256
257 int idx = 4 * int(max(1.0, TexCoord.x*20.0));
258 x[idx] = 6.0;
259 gl_FragColor = vec4(1.0, 0.0, TexCoord.s, x[idx]);
260 }
261 </script>
262 <script id="frag" type="x-shader/x-fragment">
263
264
265 precision mediump float;
266
267 varying vec2 TexCoord;
268
269 void main()
270 {
271 gl_FragColor = vec4(1.0, 0.0, TexCoord.s, 1.0);
272 }
273 </script>
274
275
276 <style>canvas{ position:absolute; }</style>
277 </head><body>
278 <canvas id="gl" width="16" height="16"></canvas>
279 </body></html>
OLDNEW
« no previous file with comments | « conformance/more/functions/vertexAttribPointerBadArgs.html ('k') | conformance/more/glsl/longLoops.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698