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_depth_clamp' , [MACHINE_SPECIFIC
, MACHINE_SPECIFIC
]],
44 ['EXT_disjoint_timer_query' , [MACHINE_SPECIFIC
, MACHINE_SPECIFIC
]],
45 ['EXT_float_blend' , [MACHINE_SPECIFIC
, MACHINE_SPECIFIC
]],
46 ['EXT_sRGB' , [MACHINE_SPECIFIC
, FORBID
]],
47 ['EXT_texture_compression_bptc' , [MACHINE_SPECIFIC
, MACHINE_SPECIFIC
]],
48 ['EXT_texture_compression_rgtc' , [MACHINE_SPECIFIC
, MACHINE_SPECIFIC
]],
49 ['OES_draw_buffers_indexed' , [FORBID
, MACHINE_SPECIFIC
]],
50 ['OVR_multiview2' , [FORBID
, MACHINE_SPECIFIC
]],
51 ['WEBGL_color_buffer_float' , [MACHINE_SPECIFIC
, FORBID
]],
52 ['WEBGL_compressed_texture_astc' , [MACHINE_SPECIFIC
, MACHINE_SPECIFIC
]],
53 ['WEBGL_compressed_texture_atc' , [MACHINE_SPECIFIC
, MACHINE_SPECIFIC
]],
54 ['WEBGL_compressed_texture_etc' , [MACHINE_SPECIFIC
, MACHINE_SPECIFIC
]],
55 ['WEBGL_compressed_texture_etc1' , [MACHINE_SPECIFIC
, MACHINE_SPECIFIC
]],
56 ['WEBGL_compressed_texture_pvrtc' , [MACHINE_SPECIFIC
, MACHINE_SPECIFIC
]],
57 ['WEBGL_compressed_texture_s3tc_srgb', [MACHINE_SPECIFIC
, MACHINE_SPECIFIC
]],
58 ['WEBGL_provoking_vertex' , [MACHINE_SPECIFIC
, MACHINE_SPECIFIC
]],
62 ['EXT_texture_norm16' , [FORBID
, MACHINE_SPECIFIC
]],
63 ['WEBGL_explicit_present' , [ENSURE
, ENSURE
]],
67 // Ensure that we never see any extensions that we haven't listed above!
70 const expectedExts
= (defaultExts
.concat(draftExts
)).map(x
=> x
[0]);
72 ['webgl', 'webgl2'].forEach( contextType
=> {
73 const c
= document
.createElement('canvas');
74 const gl
= c
.getContext(contextType
);
77 const actualExts
= gl
.getSupportedExtensions();
78 actualExts
.forEach(actualExt
=> {
79 ok(expectedExts
.includes(actualExt
), 'Unexpected ext: ' + actualExt
);
86 function TestExtFor(contextType
, extName
, status
) {
89 EnsureExtFor(contextType
, extName
);
93 EnsureExtFor(contextType
, extName
, false);
96 case MACHINE_SPECIFIC
:
101 function TestExt(extName
, statusArr
) {
102 TestExtFor('webgl', extName
, statusArr
[0]);
103 TestExtFor('webgl2', extName
, statusArr
[1]);
108 defaultExts
.forEach(function(x
) {
110 var statusArr
= x
[1];
111 TestExt(extName
, statusArr
);
114 draftExts
.forEach(function(x
) {
116 EnsureExt(extName
, false);
119 Lastly_WithDraftExtsEnabled(function() {
120 draftExts
.forEach(function(x
) {
122 var statusArr
= x
[1];
123 TestExt(extName
, statusArr
);