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

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

Issue 8342021: Add webgl conformance tests r15841. (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/webgl/sdk/tests/
Patch Set: Created 9 years, 2 months 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
+ LF
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html><head>
3 <meta charset="utf-8">
4 <!--
5 Tests for the OpenGL ES 2.0 HTML Canvas context
6
7 Copyright (C) 2011 Ilmari Heikkinen <ilmari.heikkinen@gmail.com>
8
9 Permission is hereby granted, free of charge, to any person
10 obtaining a copy of this software and associated documentation
11 files (the "Software"), to deal in the Software without
12 restriction, including without limitation the rights to use,
13 copy, modify, merge, publish, distribute, sublicense, and/or sell
14 copies of the Software, and to permit persons to whom the
15 Software is furnished to do so, subject to the following
16 conditions:
17
18 The above copyright notice and this permission notice shall be
19 included in all copies or substantial portions of the Software.
20
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
23 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
24 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
25 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
27 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
28 OTHER DEALINGS IN THE SOFTWARE.
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 = canvas.getContext(GL_CONTEXT_ID);
39 return [gl];
40 }
41
42 Tests.autorun = false;
43 Tests.message = "Caution: might hang your GPU"
44
45 var arr = ['whiletrue', 'loop100M', 'loopComp', 'variable'];
46 arr.forEach(function(e){
47 Tests['test'+e+'vert'] = function(gl) {
48 var sh = new Filter(gl, e+'vert', 'frag');
49 assertOk(function(){
50 sh.apply();
51 });
52 sh.destroy();
53 }
54 Tests['test'+e+'frag'] = function(gl) {
55 var sh = new Filter(gl, 'vert', e+'frag');
56 assertOk(function(){
57 sh.apply();
58 });
59 sh.destroy();
60 }
61 });
62
63 Tests.testMandelbrot = function(gl) {
64 gl.disable(gl.DEPTH_TEST);
65 var sh = new Filter(gl, 'identity-vert', 'mandelbrot-frag');
66 sh.apply(function(s){
67 s.uniform1f('z', 0.15);
68 s.uniform1f('x', -1.25);
69 });
70 for (var i=0; i<256; i++) {
71 sh.apply();
72 }
73 sh.destroy();
74 }
75
76 </script>
77 <script id="identity-vert" type="x-shader/x-vertex">
78
79 attribute vec3 Vertex;
80 attribute vec2 Tex;
81
82 varying vec2 texCoord0;
83 void main()
84 {
85 texCoord0 = vec2(Tex.s, Tex.t);
86 gl_Position = vec4(Vertex, 1.0);
87 }
88 </script>
89 <script id="mandelbrot-frag" type="x-shader/x-fragment">
90 precision mediump float;
91
92 uniform float x,y,z;
93 varying vec2 texCoord0;
94 vec4 iter_z(float cr, float ci) {
95 int i;
96 float nzr, nzi, zr = 0.0, zi = 0.0;
97 vec4 color = vec4(0.0);
98 for (i=0; i<2500; i++) {
99 nzr = zr * zr - zi * zi + cr;
100 nzi = 2.0 * zr * zi + ci;
101 zr = nzr;
102 zi = nzi;
103 }
104 color = vec4(zi);
105 color.a = 1.0;
106 return color;
107 }
108
109 void main()
110 {
111 gl_FragColor = iter_z(x+z*(2.0*texCoord0.s-1.5), y+z*(2.0*texCoord0.t-1. 0));
112 }
113 </script>
114 <script id="whiletruevert" type="x-shader/x-vertex">
115
116
117 attribute vec3 Vertex; attribute vec2 Tex;
118 varying vec2 TexCoord;
119 void main()
120 {
121 float z = 1.0;
122 while(true) { z += 0.1; z *= 0.995; }
123 TexCoord = Tex.st;
124 gl_Position = vec4(Vertex, z);
125 }
126 </script>
127 <script id="loop100Mvert" type="x-shader/x-vertex">
128
129
130 attribute vec3 Vertex; attribute vec2 Tex;
131 varying vec2 TexCoord;
132 void main()
133 {
134 int i;
135 float z = 1.0;
136 for (i = 0; i<1000000000; i++) {
137 z += 0.1; z *= 0.995;
138 }
139 TexCoord = Tex.st;
140 gl_Position = vec4(Vertex, z);
141 }
142 </script>
143 <script id="loopCompvert" type="x-shader/x-vertex">
144
145
146 attribute vec3 Vertex; attribute vec2 Tex;
147 varying vec2 TexCoord;
148 void main()
149 {
150 float z = 1.0;
151 while(z > 0.0) { z += 0.1; z *= 0.995; }
152 TexCoord = Tex.st;
153 gl_Position = vec4(Vertex, z);
154 }
155 </script>
156 <script id="variablevert" type="x-shader/x-vertex">
157
158
159 attribute vec3 Vertex; attribute vec2 Tex;
160 varying vec2 TexCoord;
161
162 void main()
163 {
164 float z = 1.0;
165 while(z > Vertex.z) { z += 0.1; z *= 0.995; }
166 TexCoord = Tex.st;
167 gl_Position = vec4(Vertex, z);
168 }
169 </script>
170 <script id="vert" type="x-shader/x-vertex">
171
172
173 attribute vec3 Vertex; attribute vec2 Tex;
174 varying vec2 TexCoord;
175 void main()
176 {
177 TexCoord = Tex.st;
178 gl_Position = vec4(Vertex, 0.0);
179 }
180 </script>
181
182 <script id="whiletruefrag" type="x-shader/x-fragment">
183
184
185 precision mediump float;
186
187 varying vec2 TexCoord;
188 void main()
189 {
190 float z = 1.0;
191 while(true) { z += 0.1; z *= 0.995; }
192 gl_FragColor = vec4(1.0, TexCoord.s, TexCoord.t, z);
193 }
194 </script>
195 <script id="loop100Mfrag" type="x-shader/x-fragment">
196
197
198 precision mediump float;
199
200 varying vec2 TexCoord;
201 void main()
202 {
203 int i;
204 float z = 1.0;
205 for (i = 0; i<1000000000; i++) {
206 z += 0.1; z *= 0.995;
207 }
208 gl_FragColor = vec4(1.0, TexCoord.s, TexCoord.t, z);
209 }
210 </script>
211 <script id="loopCompfrag" type="x-shader/x-fragment">
212
213
214 precision mediump float;
215
216 varying vec2 TexCoord;
217 void main()
218 {
219 float z = TexCoord.s;
220 while(z > 0.0) { z += 0.1; z *= 0.995; }
221 gl_FragColor = vec4(1.0, TexCoord.s, TexCoord.t, z);
222 }
223 </script>
224 <script id="variablefrag" type="x-shader/x-fragment">
225
226
227 precision mediump float;
228
229 varying vec2 TexCoord;
230 void main()
231 {
232 float z = 1.0;
233 while(z > TexCoord.s) { z += 0.1; z *= 0.995; }
234 gl_FragColor = vec4(1.0, TexCoord.s, TexCoord.t, z);
235 }
236 </script>
237 <script id="frag" type="x-shader/x-fragment">
238
239
240 precision mediump float;
241
242 varying vec2 TexCoord;
243 void main()
244 {
245 gl_FragColor = vec4(1.0, TexCoord.s, TexCoord.t, 1.0);
246 }
247 </script>
248
249
250 <style>canvas{ position:absolute; }</style>
251 </head><body>
252 <canvas id="gl" width="512" height="512"></canvas>
253 </body></html>
OLDNEW
« no previous file with comments | « conformance/more/glsl/arrayOutOfBounds.html ('k') | conformance/more/glsl/uniformOutOfBounds.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698