Bug 1772999 - Allow OES_draw_buffers_indexed by default. r=gfx-reviewers,jrmuizel
[gecko.git] / dom / canvas / test / webgl-mochitest / ensure-exts / test_common.html
blob9d2fa81897dc9616206da3c25fd8ec8b9cb618af
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <meta charset='utf-8'/>
5 <script src='/tests/SimpleTest/SimpleTest.js'></script>
6 <link rel='stylesheet' href='/tests/SimpleTest/test.css'>
7 <script src='ensure-ext.js'></script>
8 </head>
9 <body>
10 <script>
12 'use strict';
14 var ENSURE = 'ENSURE'; // Works on all test machines.
15 var FORBID = 'FORBID'; // Should not work on any test machine.
16 var MACHINE_SPECIFIC = 'MACHINE_SPECIFIC';
18 var defaultExts = [
19 // Ratified
20 ['ANGLE_instanced_arrays' , [MACHINE_SPECIFIC, FORBID ]],
21 ['EXT_blend_minmax' , [MACHINE_SPECIFIC, FORBID ]],
22 ['EXT_frag_depth' , [MACHINE_SPECIFIC, FORBID ]],
23 ['EXT_shader_texture_lod' , [MACHINE_SPECIFIC, FORBID ]],
24 ['EXT_texture_filter_anisotropic', [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
25 ['OES_element_index_uint' , [ENSURE , FORBID ]],
26 ['OES_fbo_render_mipmap' , [MACHINE_SPECIFIC, FORBID ]],
27 ['OES_standard_derivatives' , [MACHINE_SPECIFIC, FORBID ]],
28 ['OES_texture_float' , [ENSURE , FORBID ]],
29 ['OES_texture_float_linear' , [ENSURE , ENSURE ]],
30 ['OES_texture_half_float' , [ENSURE , FORBID ]],
31 ['OES_texture_half_float_linear' , [ENSURE , FORBID ]],
32 ['OES_vertex_array_object' , [ENSURE , FORBID ]],
33 ['WEBGL_compressed_texture_s3tc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
34 ['WEBGL_debug_renderer_info' , [ENSURE , ENSURE ]],
35 ['WEBGL_debug_shaders' , [ENSURE , ENSURE ]],
36 ['WEBGL_depth_texture' , [MACHINE_SPECIFIC, FORBID ]],
37 ['WEBGL_draw_buffers' , [MACHINE_SPECIFIC, FORBID ]],
38 ['WEBGL_lose_context' , [ENSURE , ENSURE ]],
40 // Community Approved
41 ['EXT_color_buffer_float' , [FORBID , ENSURE ]],
42 ['EXT_color_buffer_half_float' , [MACHINE_SPECIFIC, FORBID ]],
43 ['EXT_disjoint_timer_query' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
44 ['EXT_float_blend' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
45 ['EXT_sRGB' , [MACHINE_SPECIFIC, FORBID ]],
46 ['EXT_texture_compression_bptc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
47 ['EXT_texture_compression_rgtc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
48 ['OES_draw_buffers_indexed' , [FORBID , MACHINE_SPECIFIC]],
49 ['OVR_multiview2' , [FORBID , MACHINE_SPECIFIC]],
50 ['WEBGL_color_buffer_float' , [MACHINE_SPECIFIC, FORBID ]],
51 ['WEBGL_compressed_texture_astc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
52 ['WEBGL_compressed_texture_atc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
53 ['WEBGL_compressed_texture_etc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
54 ['WEBGL_compressed_texture_etc1' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
55 ['WEBGL_compressed_texture_pvrtc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
56 ['WEBGL_compressed_texture_s3tc_srgb', [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
59 var draftExts = [
60 ['EXT_texture_norm16' , [FORBID , MACHINE_SPECIFIC]],
61 ['WEBGL_explicit_present' , [ENSURE , ENSURE ]],
64 ////////////////////
65 // Ensure that we never see any extensions that we haven't listed above!
67 (function() {
68 const expectedExts = (defaultExts.concat(draftExts)).map(x => x[0]);
70 ['webgl', 'webgl2'].forEach( contextType => {
71 const c = document.createElement('canvas');
72 const gl = c.getContext(contextType);
73 if (!gl) return;
75 const actualExts = gl.getSupportedExtensions();
76 actualExts.forEach(actualExt => {
77 ok(expectedExts.includes(actualExt), 'Unexpected ext: ' + actualExt);
78 });
79 });
80 })();
82 ////////////////////
84 function TestExtFor(contextType, extName, status) {
85 switch (status) {
86 case ENSURE:
87 EnsureExtFor(contextType, extName);
88 break;
90 case FORBID:
91 EnsureExtFor(contextType, extName, false);
92 break;
94 case MACHINE_SPECIFIC:
95 break;
99 function TestExt(extName, statusArr) {
100 TestExtFor('webgl', extName, statusArr[0]);
101 TestExtFor('webgl2', extName, statusArr[1]);
104 ////////////////////
106 defaultExts.forEach(function(x) {
107 var extName = x[0];
108 var statusArr = x[1];
109 TestExt(extName, statusArr);
112 draftExts.forEach(function(x) {
113 var extName = x[0];
114 EnsureExt(extName, false);
117 Lastly_WithDraftExtsEnabled(function() {
118 draftExts.forEach(function(x) {
119 var extName = x[0];
120 var statusArr = x[1];
121 TestExt(extName, statusArr);
125 </script>
126 </body>
127 </html>