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>
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';
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
]],
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
]],
60 ['EXT_texture_norm16' , [FORBID
, MACHINE_SPECIFIC
]],
61 ['WEBGL_explicit_present' , [ENSURE
, ENSURE
]],
65 // Ensure that we never see any extensions that we haven't listed above!
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
);
75 const actualExts
= gl
.getSupportedExtensions();
76 actualExts
.forEach(actualExt
=> {
77 ok(expectedExts
.includes(actualExt
), 'Unexpected ext: ' + actualExt
);
84 function TestExtFor(contextType
, extName
, status
) {
87 EnsureExtFor(contextType
, extName
);
91 EnsureExtFor(contextType
, extName
, false);
94 case MACHINE_SPECIFIC
:
99 function TestExt(extName
, statusArr
) {
100 TestExtFor('webgl', extName
, statusArr
[0]);
101 TestExtFor('webgl2', extName
, statusArr
[1]);
106 defaultExts
.forEach(function(x
) {
108 var statusArr
= x
[1];
109 TestExt(extName
, statusArr
);
112 draftExts
.forEach(function(x
) {
114 EnsureExt(extName
, false);
117 Lastly_WithDraftExtsEnabled(function() {
118 draftExts
.forEach(function(x
) {
120 var statusArr
= x
[1];
121 TestExt(extName
, statusArr
);