summaryrefslogtreecommitdiffstats
path: root/dom/canvas/test/webgl-mochitest/ensure-exts/test_common.html
blob: 153161d93028e66d571a48e12dd598e20aabca4f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!DOCTYPE HTML>
<html>
  <head>
    <meta charset='utf-8'/>
    <script src='/tests/SimpleTest/SimpleTest.js'></script>
    <link rel='stylesheet' href='/tests/SimpleTest/test.css'>
    <script src='ensure-ext.js'></script>
  </head>
  <body>
    <script>

'use strict';

var ENSURE = 'ENSURE'; // Works on all test machines.
var FORBID = 'FORBID'; // Should not work on any test machine.
var MACHINE_SPECIFIC = 'MACHINE_SPECIFIC';

var defaultExts = [
    // Ratified
    ['ANGLE_instanced_arrays'        , [MACHINE_SPECIFIC, FORBID          ]],
    ['EXT_blend_minmax'              , [MACHINE_SPECIFIC, FORBID          ]],
    ['EXT_disjoint_timer_query'      , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
    ['EXT_frag_depth'                , [MACHINE_SPECIFIC, FORBID          ]],
    ['EXT_shader_texture_lod'        , [MACHINE_SPECIFIC, FORBID          ]],
    ['EXT_texture_filter_anisotropic', [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
    ['OES_element_index_uint'        , [ENSURE          , FORBID          ]],
    ['OES_standard_derivatives'      , [MACHINE_SPECIFIC, FORBID          ]],
    ['OES_texture_float'             , [ENSURE          , FORBID          ]],
    ['OES_texture_float_linear'      , [ENSURE          , ENSURE          ]],
    ['OES_texture_half_float'        , [ENSURE          , FORBID          ]],
    ['OES_texture_half_float_linear' , [ENSURE          , FORBID          ]],
    ['OES_vertex_array_object'       , [ENSURE          , FORBID          ]],
    ['WEBGL_compressed_texture_s3tc' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
//  ['WEBGL_debug_renderer_info'     , [FORBID          , FORBID          ]], // Complicated!
    ['WEBGL_debug_shaders'           , [FORBID          , FORBID          ]],
    ['WEBGL_depth_texture'           , [MACHINE_SPECIFIC, FORBID          ]],
    ['WEBGL_draw_buffers'            , [MACHINE_SPECIFIC, FORBID          ]],
    ['WEBGL_lose_context'            , [ENSURE          , ENSURE          ]],

    // Community Approved
    ['EXT_color_buffer_float'        , [FORBID          , ENSURE          ]],
    ['EXT_color_buffer_half_float'   , [MACHINE_SPECIFIC, FORBID          ]],
    ['EXT_sRGB'                      , [MACHINE_SPECIFIC, FORBID          ]],
    ['WEBGL_color_buffer_float'      , [MACHINE_SPECIFIC, FORBID          ]],
    ['WEBGL_compressed_texture_atc'  , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
    ['WEBGL_compressed_texture_etc1' , [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
    ['WEBGL_compressed_texture_pvrtc', [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
];

var draftExts = [
    ['WEBGL_compressed_texture_es3', [MACHINE_SPECIFIC, MACHINE_SPECIFIC]],
];

var nonImplementedExts = [
    'OES_fbo_render_mipmap',
    'WEBGL_compressed_texture_astc',
    'WEBGL_security_sensitive_resources',
    'WEBGL_shared_resources',
];

////////////////////

function TestExtFor(contextType, extName, status) {
    switch (status) {
    case ENSURE:
        EnsureExtFor(contextType, extName);
        break;

    case FORBID:
        EnsureExtFor(contextType, extName, false);
        break;

    case MACHINE_SPECIFIC:
        break;
    }
}

function TestExt(extName, statusArr) {
    TestExtFor('webgl', extName, statusArr[0]);
    TestExtFor('webgl2', extName, statusArr[1]);
}

////////////////////

defaultExts.forEach(function(x) {
    var extName = x[0];
    var statusArr = x[1];
    TestExt(extName, statusArr);
});

nonImplementedExts.forEach(function(extName) {
    EnsureExt(extName, false);
});

draftExts.forEach(function(x) {
    var extName = x[0];
    EnsureExt(extName, false);
});

Lastly_WithDraftExtsEnabled(function() {
    draftExts.forEach(function(x) {
        var extName = x[0];
        var statusArr = x[1];
        TestExt(extName, statusArr);
    });
});

    </script>
  </body>
</html>