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

Side by Side Diff: conformance/more/glsl/longLoops.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.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