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

Side by Side Diff: conformance/context/constants.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>
3 <head>
4 <meta charset="utf-8">
5 <!--
6 Copyright (c) 2011 Ilmari Heikkinen. All rights reserved.
7 Use of this source code is governed by a BSD-style license that can be
8 found in the LICENSE file.
9 -->
10 <title>WebGL Constants Test</title>
11 <link rel="stylesheet" href="../../resources/js-test-style.css"/>
12 <script src="../../resources/desktop-gl-constants.js" type="text/javascript"></s cript>
13 <script src="../../resources/js-test-pre.js"></script>
14 <script src="../resources/webgl-test.js"></script>
15 </head>
16 <body>
17 <div id="description"></div>
18 <div id="console"></div>
19 <canvas id="canvas" style="width: 50px; height: 50px;"> </canvas>
20 <script>
21 description("This test ensures that the WebGL context has all the constants in t he specification.");
22
23 var constants = {
24 /* ClearBufferMask */
25 DEPTH_BUFFER_BIT : 0x00000100,
26 STENCIL_BUFFER_BIT : 0x00000400,
27 COLOR_BUFFER_BIT : 0x00004000,
28
29 /* BeginMode */
30 POINTS : 0x0000,
31 LINES : 0x0001,
32 LINE_LOOP : 0x0002,
33 LINE_STRIP : 0x0003,
34 TRIANGLES : 0x0004,
35 TRIANGLE_STRIP : 0x0005,
36 TRIANGLE_FAN : 0x0006,
37
38 /* AlphaFunction (not supported in ES20) */
39 /* NEVER */
40 /* LESS */
41 /* EQUAL */
42 /* LEQUAL */
43 /* GREATER */
44 /* NOTEQUAL */
45 /* GEQUAL */
46 /* ALWAYS */
47
48 /* BlendingFactorDest */
49 ZERO : 0,
50 ONE : 1,
51 SRC_COLOR : 0x0300,
52 ONE_MINUS_SRC_COLOR : 0x0301,
53 SRC_ALPHA : 0x0302,
54 ONE_MINUS_SRC_ALPHA : 0x0303,
55 DST_ALPHA : 0x0304,
56 ONE_MINUS_DST_ALPHA : 0x0305,
57
58 /* BlendingFactorSrc */
59 /* ZERO */
60 /* ONE */
61 DST_COLOR : 0x0306,
62 ONE_MINUS_DST_COLOR : 0x0307,
63 SRC_ALPHA_SATURATE : 0x0308,
64 /* SRC_ALPHA */
65 /* ONE_MINUS_SRC_ALPHA */
66 /* DST_ALPHA */
67 /* ONE_MINUS_DST_ALPHA */
68
69 /* BlendEquationSeparate */
70 FUNC_ADD : 0x8006,
71 BLEND_EQUATION : 0x8009,
72 BLEND_EQUATION_RGB : 0x8009, /* same as BLEND_EQUATION */
73 BLEND_EQUATION_ALPHA : 0x883D,
74
75 /* BlendSubtract */
76 FUNC_SUBTRACT : 0x800A,
77 FUNC_REVERSE_SUBTRACT : 0x800B,
78
79 /* Separate Blend Functions */
80 BLEND_DST_RGB : 0x80C8,
81 BLEND_SRC_RGB : 0x80C9,
82 BLEND_DST_ALPHA : 0x80CA,
83 BLEND_SRC_ALPHA : 0x80CB,
84 CONSTANT_COLOR : 0x8001,
85 ONE_MINUS_CONSTANT_COLOR : 0x8002,
86 CONSTANT_ALPHA : 0x8003,
87 ONE_MINUS_CONSTANT_ALPHA : 0x8004,
88 BLEND_COLOR : 0x8005,
89
90 /* Buffer Objects */
91 ARRAY_BUFFER : 0x8892,
92 ELEMENT_ARRAY_BUFFER : 0x8893,
93 ARRAY_BUFFER_BINDING : 0x8894,
94 ELEMENT_ARRAY_BUFFER_BINDING : 0x8895,
95
96 STREAM_DRAW : 0x88E0,
97 STATIC_DRAW : 0x88E4,
98 DYNAMIC_DRAW : 0x88E8,
99
100 BUFFER_SIZE : 0x8764,
101 BUFFER_USAGE : 0x8765,
102
103 CURRENT_VERTEX_ATTRIB : 0x8626,
104
105 /* CullFaceMode */
106 FRONT : 0x0404,
107 BACK : 0x0405,
108 FRONT_AND_BACK : 0x0408,
109
110 /* DepthFunction */
111 /* NEVER */
112 /* LESS */
113 /* EQUAL */
114 /* LEQUAL */
115 /* GREATER */
116 /* NOTEQUAL */
117 /* GEQUAL */
118 /* ALWAYS */
119
120 /* EnableCap */
121 /* TEXTURE_2D */
122 CULL_FACE : 0x0B44,
123 BLEND : 0x0BE2,
124 DITHER : 0x0BD0,
125 STENCIL_TEST : 0x0B90,
126 DEPTH_TEST : 0x0B71,
127 SCISSOR_TEST : 0x0C11,
128 POLYGON_OFFSET_FILL : 0x8037,
129 SAMPLE_ALPHA_TO_COVERAGE : 0x809E,
130 SAMPLE_COVERAGE : 0x80A0,
131
132 /* ErrorCode */
133 NO_ERROR : 0,
134 INVALID_ENUM : 0x0500,
135 INVALID_VALUE : 0x0501,
136 INVALID_OPERATION : 0x0502,
137 OUT_OF_MEMORY : 0x0505,
138
139 /* FrontFaceDirection */
140 CW : 0x0900,
141 CCW : 0x0901,
142
143 /* GetPName */
144 LINE_WIDTH : 0x0B21,
145 ALIASED_POINT_SIZE_RANGE : 0x846D,
146 ALIASED_LINE_WIDTH_RANGE : 0x846E,
147 CULL_FACE_MODE : 0x0B45,
148 FRONT_FACE : 0x0B46,
149 DEPTH_RANGE : 0x0B70,
150 DEPTH_WRITEMASK : 0x0B72,
151 DEPTH_CLEAR_VALUE : 0x0B73,
152 DEPTH_FUNC : 0x0B74,
153 STENCIL_CLEAR_VALUE : 0x0B91,
154 STENCIL_FUNC : 0x0B92,
155 STENCIL_FAIL : 0x0B94,
156 STENCIL_PASS_DEPTH_FAIL : 0x0B95,
157 STENCIL_PASS_DEPTH_PASS : 0x0B96,
158 STENCIL_REF : 0x0B97,
159 STENCIL_VALUE_MASK : 0x0B93,
160 STENCIL_WRITEMASK : 0x0B98,
161 STENCIL_BACK_FUNC : 0x8800,
162 STENCIL_BACK_FAIL : 0x8801,
163 STENCIL_BACK_PASS_DEPTH_FAIL : 0x8802,
164 STENCIL_BACK_PASS_DEPTH_PASS : 0x8803,
165 STENCIL_BACK_REF : 0x8CA3,
166 STENCIL_BACK_VALUE_MASK : 0x8CA4,
167 STENCIL_BACK_WRITEMASK : 0x8CA5,
168 VIEWPORT : 0x0BA2,
169 SCISSOR_BOX : 0x0C10,
170 /* SCISSOR_TEST */
171 COLOR_CLEAR_VALUE : 0x0C22,
172 COLOR_WRITEMASK : 0x0C23,
173 UNPACK_ALIGNMENT : 0x0CF5,
174 PACK_ALIGNMENT : 0x0D05,
175 MAX_TEXTURE_SIZE : 0x0D33,
176 MAX_VIEWPORT_DIMS : 0x0D3A,
177 SUBPIXEL_BITS : 0x0D50,
178 RED_BITS : 0x0D52,
179 GREEN_BITS : 0x0D53,
180 BLUE_BITS : 0x0D54,
181 ALPHA_BITS : 0x0D55,
182 DEPTH_BITS : 0x0D56,
183 STENCIL_BITS : 0x0D57,
184 POLYGON_OFFSET_UNITS : 0x2A00,
185 /* POLYGON_OFFSET_FILL */
186 POLYGON_OFFSET_FACTOR : 0x8038,
187 TEXTURE_BINDING_2D : 0x8069,
188 SAMPLE_BUFFERS : 0x80A8,
189 SAMPLES : 0x80A9,
190 SAMPLE_COVERAGE_VALUE : 0x80AA,
191 SAMPLE_COVERAGE_INVERT : 0x80AB,
192
193 /* GetTextureParameter */
194 /* TEXTURE_MAG_FILTER */
195 /* TEXTURE_MIN_FILTER */
196 /* TEXTURE_WRAP_S */
197 /* TEXTURE_WRAP_T */
198
199 NUM_COMPRESSED_TEXTURE_FORMATS : 0x86A2,
200 COMPRESSED_TEXTURE_FORMATS : 0x86A3,
201
202 /* HintMode */
203 DONT_CARE : 0x1100,
204 FASTEST : 0x1101,
205 NICEST : 0x1102,
206
207 /* HintTarget */
208 GENERATE_MIPMAP_HINT : 0x8192,
209
210 /* DataType */
211 BYTE : 0x1400,
212 UNSIGNED_BYTE : 0x1401,
213 SHORT : 0x1402,
214 UNSIGNED_SHORT : 0x1403,
215 INT : 0x1404,
216 UNSIGNED_INT : 0x1405,
217 FLOAT : 0x1406,
218
219 /* PixelFormat */
220 DEPTH_COMPONENT : 0x1902,
221 ALPHA : 0x1906,
222 RGB : 0x1907,
223 RGBA : 0x1908,
224 LUMINANCE : 0x1909,
225 LUMINANCE_ALPHA : 0x190A,
226
227 /* PixelType */
228 /* UNSIGNED_BYTE */
229 UNSIGNED_SHORT_4_4_4_4 : 0x8033,
230 UNSIGNED_SHORT_5_5_5_1 : 0x8034,
231 UNSIGNED_SHORT_5_6_5 : 0x8363,
232
233 /* Shaders */
234 FRAGMENT_SHADER : 0x8B30,
235 VERTEX_SHADER : 0x8B31,
236 MAX_VERTEX_ATTRIBS : 0x8869,
237 MAX_VERTEX_UNIFORM_VECTORS : 0x8DFB,
238 MAX_VARYING_VECTORS : 0x8DFC,
239 MAX_COMBINED_TEXTURE_IMAGE_UNITS : 0x8B4D,
240 MAX_VERTEX_TEXTURE_IMAGE_UNITS : 0x8B4C,
241 MAX_TEXTURE_IMAGE_UNITS : 0x8872,
242 MAX_FRAGMENT_UNIFORM_VECTORS : 0x8DFD,
243 SHADER_TYPE : 0x8B4F,
244 DELETE_STATUS : 0x8B80,
245 LINK_STATUS : 0x8B82,
246 VALIDATE_STATUS : 0x8B83,
247 ATTACHED_SHADERS : 0x8B85,
248 ACTIVE_UNIFORMS : 0x8B86,
249 ACTIVE_ATTRIBUTES : 0x8B89,
250 SHADING_LANGUAGE_VERSION : 0x8B8C,
251 CURRENT_PROGRAM : 0x8B8D,
252
253 /* StencilFunction */
254 NEVER : 0x0200,
255 LESS : 0x0201,
256 EQUAL : 0x0202,
257 LEQUAL : 0x0203,
258 GREATER : 0x0204,
259 NOTEQUAL : 0x0205,
260 GEQUAL : 0x0206,
261 ALWAYS : 0x0207,
262
263 /* StencilOp */
264 /* ZERO */
265 KEEP : 0x1E00,
266 REPLACE : 0x1E01,
267 INCR : 0x1E02,
268 DECR : 0x1E03,
269 INVERT : 0x150A,
270 INCR_WRAP : 0x8507,
271 DECR_WRAP : 0x8508,
272
273 /* StringName */
274 VENDOR : 0x1F00,
275 RENDERER : 0x1F01,
276 VERSION : 0x1F02,
277
278 /* TextureMagFilter */
279 NEAREST : 0x2600,
280 LINEAR : 0x2601,
281
282 /* TextureMinFilter */
283 /* NEAREST */
284 /* LINEAR */
285 NEAREST_MIPMAP_NEAREST : 0x2700,
286 LINEAR_MIPMAP_NEAREST : 0x2701,
287 NEAREST_MIPMAP_LINEAR : 0x2702,
288 LINEAR_MIPMAP_LINEAR : 0x2703,
289
290 /* TextureParameterName */
291 TEXTURE_MAG_FILTER : 0x2800,
292 TEXTURE_MIN_FILTER : 0x2801,
293 TEXTURE_WRAP_S : 0x2802,
294 TEXTURE_WRAP_T : 0x2803,
295
296 /* TextureTarget */
297 TEXTURE_2D : 0x0DE1,
298 TEXTURE : 0x1702,
299
300 TEXTURE_CUBE_MAP : 0x8513,
301 TEXTURE_BINDING_CUBE_MAP : 0x8514,
302 TEXTURE_CUBE_MAP_POSITIVE_X : 0x8515,
303 TEXTURE_CUBE_MAP_NEGATIVE_X : 0x8516,
304 TEXTURE_CUBE_MAP_POSITIVE_Y : 0x8517,
305 TEXTURE_CUBE_MAP_NEGATIVE_Y : 0x8518,
306 TEXTURE_CUBE_MAP_POSITIVE_Z : 0x8519,
307 TEXTURE_CUBE_MAP_NEGATIVE_Z : 0x851A,
308 MAX_CUBE_MAP_TEXTURE_SIZE : 0x851C,
309
310 /* TextureUnit */
311 TEXTURE0 : 0x84C0,
312 TEXTURE1 : 0x84C1,
313 TEXTURE2 : 0x84C2,
314 TEXTURE3 : 0x84C3,
315 TEXTURE4 : 0x84C4,
316 TEXTURE5 : 0x84C5,
317 TEXTURE6 : 0x84C6,
318 TEXTURE7 : 0x84C7,
319 TEXTURE8 : 0x84C8,
320 TEXTURE9 : 0x84C9,
321 TEXTURE10 : 0x84CA,
322 TEXTURE11 : 0x84CB,
323 TEXTURE12 : 0x84CC,
324 TEXTURE13 : 0x84CD,
325 TEXTURE14 : 0x84CE,
326 TEXTURE15 : 0x84CF,
327 TEXTURE16 : 0x84D0,
328 TEXTURE17 : 0x84D1,
329 TEXTURE18 : 0x84D2,
330 TEXTURE19 : 0x84D3,
331 TEXTURE20 : 0x84D4,
332 TEXTURE21 : 0x84D5,
333 TEXTURE22 : 0x84D6,
334 TEXTURE23 : 0x84D7,
335 TEXTURE24 : 0x84D8,
336 TEXTURE25 : 0x84D9,
337 TEXTURE26 : 0x84DA,
338 TEXTURE27 : 0x84DB,
339 TEXTURE28 : 0x84DC,
340 TEXTURE29 : 0x84DD,
341 TEXTURE30 : 0x84DE,
342 TEXTURE31 : 0x84DF,
343 ACTIVE_TEXTURE : 0x84E0,
344
345 /* TextureWrapMode */
346 REPEAT : 0x2901,
347 CLAMP_TO_EDGE : 0x812F,
348 MIRRORED_REPEAT : 0x8370,
349
350 /* Uniform Types */
351 FLOAT_VEC2 : 0x8B50,
352 FLOAT_VEC3 : 0x8B51,
353 FLOAT_VEC4 : 0x8B52,
354 INT_VEC2 : 0x8B53,
355 INT_VEC3 : 0x8B54,
356 INT_VEC4 : 0x8B55,
357 BOOL : 0x8B56,
358 BOOL_VEC2 : 0x8B57,
359 BOOL_VEC3 : 0x8B58,
360 BOOL_VEC4 : 0x8B59,
361 FLOAT_MAT2 : 0x8B5A,
362 FLOAT_MAT3 : 0x8B5B,
363 FLOAT_MAT4 : 0x8B5C,
364 SAMPLER_2D : 0x8B5E,
365 SAMPLER_CUBE : 0x8B60,
366
367 /* Vertex Arrays */
368 VERTEX_ATTRIB_ARRAY_ENABLED : 0x8622,
369 VERTEX_ATTRIB_ARRAY_SIZE : 0x8623,
370 VERTEX_ATTRIB_ARRAY_STRIDE : 0x8624,
371 VERTEX_ATTRIB_ARRAY_TYPE : 0x8625,
372 VERTEX_ATTRIB_ARRAY_NORMALIZED : 0x886A,
373 VERTEX_ATTRIB_ARRAY_POINTER : 0x8645,
374 VERTEX_ATTRIB_ARRAY_BUFFER_BINDING : 0x889F,
375
376 /* Shader Source */
377 COMPILE_STATUS : 0x8B81,
378 SHADER_COMPILER : 0x8DFA,
379
380 /* Shader Precision-Specified Types */
381 LOW_FLOAT : 0x8DF0,
382 MEDIUM_FLOAT : 0x8DF1,
383 HIGH_FLOAT : 0x8DF2,
384 LOW_INT : 0x8DF3,
385 MEDIUM_INT : 0x8DF4,
386 HIGH_INT : 0x8DF5,
387
388 /* Framebuffer Object. */
389 FRAMEBUFFER : 0x8D40,
390 RENDERBUFFER : 0x8D41,
391
392 RGBA4 : 0x8056,
393 RGB5_A1 : 0x8057,
394 RGB565 : 0x8D62,
395 DEPTH_COMPONENT16 : 0x81A5,
396 STENCIL_INDEX : 0x1901,
397 STENCIL_INDEX8 : 0x8D48,
398 DEPTH_STENCIL : 0x84F9,
399
400 RENDERBUFFER_WIDTH : 0x8D42,
401 RENDERBUFFER_HEIGHT : 0x8D43,
402 RENDERBUFFER_INTERNAL_FORMAT : 0x8D44,
403 RENDERBUFFER_RED_SIZE : 0x8D50,
404 RENDERBUFFER_GREEN_SIZE : 0x8D51,
405 RENDERBUFFER_BLUE_SIZE : 0x8D52,
406 RENDERBUFFER_ALPHA_SIZE : 0x8D53,
407 RENDERBUFFER_DEPTH_SIZE : 0x8D54,
408 RENDERBUFFER_STENCIL_SIZE : 0x8D55,
409
410 FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE : 0x8CD0,
411 FRAMEBUFFER_ATTACHMENT_OBJECT_NAME : 0x8CD1,
412 FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL : 0x8CD2,
413 FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE : 0x8CD3,
414
415 COLOR_ATTACHMENT0 : 0x8CE0,
416 DEPTH_ATTACHMENT : 0x8D00,
417 STENCIL_ATTACHMENT : 0x8D20,
418 DEPTH_STENCIL_ATTACHMENT : 0x821A,
419
420 NONE : 0,
421
422 FRAMEBUFFER_COMPLETE : 0x8CD5,
423 FRAMEBUFFER_INCOMPLETE_ATTACHMENT : 0x8CD6,
424 FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT : 0x8CD7,
425 FRAMEBUFFER_INCOMPLETE_DIMENSIONS : 0x8CD9,
426 FRAMEBUFFER_UNSUPPORTED : 0x8CDD,
427
428 FRAMEBUFFER_BINDING : 0x8CA6,
429 RENDERBUFFER_BINDING : 0x8CA7,
430 MAX_RENDERBUFFER_SIZE : 0x84E8,
431
432 INVALID_FRAMEBUFFER_OPERATION : 0x0506,
433
434 /* WebGL-specific enums */
435 UNPACK_FLIP_Y_WEBGL : 0x9240,
436 UNPACK_PREMULTIPLY_ALPHA_WEBGL : 0x9241,
437 CONTEXT_LOST_WEBGL : 0x9242,
438 UNPACK_COLORSPACE_CONVERSION_WEBGL : 0x9243,
439 BROWSER_DEFAULT_WEBGL : 0x9244
440 };
441
442 function assertProperty(v, p) {
443 if (v[p] == null) {
444 testFailed("Property does not exist: " + p)
445 return false;
446 } else {
447 return true;
448 }
449 }
450
451 function assertMsg_(bool, msg) {
452 if (!bool) // show only failures to avoid spamming result list
453 assertMsg(bool, msg);
454 return bool;
455 }
456
457 debug("");
458 debug("Canvas.getContext");
459
460 var canvas = document.getElementById("canvas");
461 var gl = create3DContext(canvas);
462 var passed = true;
463 for (var i in constants) {
464 var r = assertProperty(gl, i) && assertMsg_(gl[i] == constants[i], "Property " +i+" value test "+gl[i]+" == "+constants[i]);
465 passed = passed && r;
466 }
467 if (passed) {
468 testPassed("All WebGL constants found to have correct values.");
469 }
470 var extended = false;
471 for (var i in gl) {
472 if (i.match(/^[^a-z]/) && constants[i] == null) {
473 if (!extended) {
474 extended = true;
475 debug("Also found the following extra constants:");
476 }
477 debug(i);
478 }
479 }
480
481 debug("");
482 successfullyParsed = true;
483 </script>
484 <script src="../../resources/js-test-post.js"></script>
485
486 </body>
487 </html>
OLDNEW
« no previous file with comments | « conformance/context/00_test_list.txt ('k') | conformance/context/context-attributes-alpha-depth-stencil-antialias.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698