summaryrefslogtreecommitdiffstats
path: root/dom/canvas/test/webgl-conf/checkout/conformance2/state/gl-get-calls.html
blob: 6f0991a9d24d7fe493fcf5aea9faa28c96e3dae0 (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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
<!--
Copyright (c) 2019 The Khronos Group Inc.
Use of this source code is governed by an MIT-style license that can be
found in the LICENSE.txt file.
-->

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>WebGL gl calls Conformance Tests</title>
<link rel="stylesheet" href="../../resources/js-test-style.css"/>
<script src="../../js/js-test-pre.js"></script>
<script src="../../js/webgl-test-utils.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<canvas id="canvas" width="2" height="2"> </canvas>
<script>
"use strict";
description("This test ensures getParameter is working correct with WebGL 2 pnames");

debug("");
debug("Canvas.getContext");

var minimumRequiredStencilMask = 0;
var wtu = WebGLTestUtils;
var context = wtu.create3DContext("canvas", null, 2);
if (!context)
    testFailed("context does not exist");
else {
    testPassed("context exists");

    debug("");
    debug("Context contains getError");
    if ("getError" in context)
      testPassed("context contains getError");
    else
      testFailed("context does not contains getError");

    debug("");
    debug("Check default values");

    shouldBe('context.getParameter(context.COPY_READ_BUFFER_BINDING)', 'null');
    shouldBe('context.getParameter(context.COPY_WRITE_BUFFER_BINDING)', 'null');
    shouldBe('context.getParameter(context.DRAW_BUFFER0)', 'context.BACK');
    shouldBe('context.getParameter(context.DRAW_FRAMEBUFFER_BINDING)', 'null');
    shouldBe('context.getParameter(context.FRAGMENT_SHADER_DERIVATIVE_HINT)', 'context.DONT_CARE');
    shouldBe('context.getParameter(context.PACK_ROW_LENGTH)', '0');
    shouldBe('context.getParameter(context.PACK_SKIP_PIXELS)', '0');
    shouldBe('context.getParameter(context.PACK_SKIP_ROWS)', '0');
    shouldBe('context.getParameter(context.PIXEL_PACK_BUFFER_BINDING)', 'null');

    shouldBe('context.getParameter(context.PIXEL_UNPACK_BUFFER_BINDING)', 'null');
    shouldBe('context.getParameter(context.RASTERIZER_DISCARD)', 'false');
    shouldBe('context.getParameter(context.READ_BUFFER)', 'context.BACK');
    shouldBe('context.getParameter(context.READ_FRAMEBUFFER_BINDING)', 'null');
    shouldBe('context.getParameter(context.SAMPLE_ALPHA_TO_COVERAGE)', 'false');
    shouldBe('context.getParameter(context.SAMPLE_COVERAGE)', 'false');
    shouldBe('context.getParameter(context.SAMPLER_BINDING)', 'null');
    shouldBe('context.getParameter(context.TEXTURE_BINDING_2D_ARRAY)', 'null');
    shouldBe('context.getParameter(context.TEXTURE_BINDING_3D)', 'null');
    shouldBe('context.getParameter(context.TRANSFORM_FEEDBACK_ACTIVE)', 'false');
    shouldBe('context.getParameter(context.TRANSFORM_FEEDBACK_BINDING)', 'null');
    shouldBe('context.getParameter(context.TRANSFORM_FEEDBACK_BUFFER_BINDING)', 'null');
    shouldBe('context.getParameter(context.TRANSFORM_FEEDBACK_PAUSED)', 'false');
    shouldBe('context.getParameter(context.UNIFORM_BUFFER_BINDING)', 'null');

    shouldBe('context.getParameter(context.UNPACK_IMAGE_HEIGHT)', '0');
    shouldBe('context.getParameter(context.UNPACK_ROW_LENGTH)', '0');
    shouldBe('context.getParameter(context.UNPACK_SKIP_IMAGES)', '0');
    shouldBe('context.getParameter(context.UNPACK_SKIP_PIXELS)', '0');
    shouldBe('context.getParameter(context.UNPACK_SKIP_ROWS)', '0');
    shouldBe('context.getParameter(context.VERTEX_ARRAY_BINDING)', 'null');

    debug("");
    debug("Check minimum values");

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_3D_TEXTURE_SIZE)', '256');
    shouldBeType('context.getParameter(context.MAX_3D_TEXTURE_SIZE)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_ARRAY_TEXTURE_LAYERS)', '256');
    shouldBeType('context.getParameter(context.MAX_ARRAY_TEXTURE_LAYERS)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_CLIENT_WAIT_TIMEOUT_WEBGL)', '0');
    shouldBeType('context.getParameter(context.MAX_CLIENT_WAIT_TIMEOUT_WEBGL)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_COLOR_ATTACHMENTS)', '4');
    shouldBeType('context.getParameter(context.MAX_COLOR_ATTACHMENTS)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_COMBINED_UNIFORM_BLOCKS)', '24');
    shouldBeType('context.getParameter(context.MAX_COMBINED_UNIFORM_BLOCKS)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_DRAW_BUFFERS)', '4');
    shouldBeType('context.getParameter(context.MAX_DRAW_BUFFERS)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_ELEMENT_INDEX)', '16777215'); // 2^24 - 1
    shouldBeType('context.getParameter(context.MAX_ELEMENT_INDEX)', 'Number');

    shouldBeType('context.getParameter(context.MAX_ELEMENTS_INDICES)', 'Number');
    shouldBeType('context.getParameter(context.MAX_ELEMENTS_VERTICES)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_FRAGMENT_INPUT_COMPONENTS)', '60');
    shouldBeType('context.getParameter(context.MAX_FRAGMENT_INPUT_COMPONENTS)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_FRAGMENT_UNIFORM_BLOCKS)', '12');
    shouldBeType('context.getParameter(context.MAX_FRAGMENT_INPUT_COMPONENTS)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_FRAGMENT_UNIFORM_COMPONENTS)', '896');
    shouldBeType('context.getParameter(context.MAX_FRAGMENT_UNIFORM_COMPONENTS)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_PROGRAM_TEXEL_OFFSET)', '7');
    shouldBeType('context.getParameter(context.MAX_PROGRAM_TEXEL_OFFSET)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_SAMPLES)', '4');
    shouldBeType('context.getParameter(context.MAX_PROGRAM_TEXEL_OFFSET)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_SERVER_WAIT_TIMEOUT)', '0');
    shouldBeType('context.getParameter(context.MAX_SERVER_WAIT_TIMEOUT)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_TEXTURE_LOD_BIAS)', '2.0');
    shouldBeType('context.getParameter(context.MAX_TEXTURE_LOD_BIAS)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS)', '64');
    shouldBeType('context.getParameter(context.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS)', '4');
    shouldBeType('context.getParameter(context.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS)', '4');
    shouldBeType('context.getParameter(context.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_UNIFORM_BLOCK_SIZE)', '16384');
    shouldBeType('context.getParameter(context.MAX_UNIFORM_BLOCK_SIZE)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_UNIFORM_BUFFER_BINDINGS)', '24');
    shouldBeType('context.getParameter(context.MAX_UNIFORM_BUFFER_BINDINGS)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_VARYING_COMPONENTS)', '60');
    shouldBeType('context.getParameter(context.MAX_VARYING_COMPONENTS)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_VERTEX_OUTPUT_COMPONENTS)', '64');
    shouldBeType('context.getParameter(context.MAX_VERTEX_OUTPUT_COMPONENTS)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_VERTEX_UNIFORM_BLOCKS)', '12');
    shouldBeType('context.getParameter(context.MAX_VERTEX_UNIFORM_BLOCKS)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_VERTEX_UNIFORM_COMPONENTS)', '1024');
    shouldBeType('context.getParameter(context.MAX_VERTEX_UNIFORM_COMPONENTS)', 'Number');

    shouldBeLessThanOrEqual('context.getParameter(context.MIN_PROGRAM_TEXEL_OFFSET)', '-8');
    shouldBeType('context.getParameter(context.MIN_PROGRAM_TEXEL_OFFSET)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.UNIFORM_BUFFER_OFFSET_ALIGNMENT)', '1');
    shouldBeType('context.getParameter(context.UNIFORM_BUFFER_OFFSET_ALIGNMENT)', 'Number');

    var minCombinedFragmentUniformComponents = context.getParameter(context.MAX_FRAGMENT_UNIFORM_BLOCKS) * context.getParameter(context.MAX_UNIFORM_BLOCK_SIZE) / 4 + context.getParameter(context.MAX_FRAGMENT_UNIFORM_COMPONENTS);
    var minCombinedVertexUniformComponents = context.getParameter(context.MAX_VERTEX_UNIFORM_BLOCKS) * context.getParameter(context.MAX_UNIFORM_BLOCK_SIZE) / 4 + context.getParameter(context.MAX_VERTEX_UNIFORM_COMPONENTS);

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS)', minCombinedFragmentUniformComponents + '');
    shouldBeType('context.getParameter(context.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS)', 'Number');

    shouldBeGreaterThanOrEqual('context.getParameter(context.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS)', minCombinedVertexUniformComponents + '');
    shouldBeType('context.getParameter(context.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS)', 'Number');

    shouldBe('context.getError()', 'context.NO_ERROR');
}

debug("");
var successfullyParsed = true;

</script>
<script src="../../js/js-test-post.js"></script>

</body>
</html>