1/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
5 *
6 * The source for this IDL is found at https://www.khronos.org/registry/webgl/specs/latest/2.0
7 * This IDL depends on WebGLRenderingContext.webidl
8 */
9
10typedef long long GLint64;
11typedef unsigned long long GLuint64;
12
13[Pref="webgl.enable-webgl2"]
14interface WebGLSampler {
15};
16
17[Pref="webgl.enable-webgl2"]
18interface WebGLSync {
19};
20
21[Pref="webgl.enable-webgl2"]
22interface WebGLTransformFeedback {
23};
24
25typedef (Uint32Array or sequence<GLuint>) Uint32List;
26
27// WebGL2 spec has this as an empty interface that pulls in everything
28// via WebGL2RenderingContextBase.
29[Exposed=(Window,Worker),
30 Pref="webgl.enable-webgl2"]
31interface WebGL2RenderingContext
32{
33};
34
35interface mixin WebGL2RenderingContextBase
36{
37    const GLenum READ_BUFFER                                   = 0x0C02;
38    const GLenum UNPACK_ROW_LENGTH                             = 0x0CF2;
39    const GLenum UNPACK_SKIP_ROWS                              = 0x0CF3;
40    const GLenum UNPACK_SKIP_PIXELS                            = 0x0CF4;
41    const GLenum PACK_ROW_LENGTH                               = 0x0D02;
42    const GLenum PACK_SKIP_ROWS                                = 0x0D03;
43    const GLenum PACK_SKIP_PIXELS                              = 0x0D04;
44    const GLenum COLOR                                         = 0x1800;
45    const GLenum DEPTH                                         = 0x1801;
46    const GLenum STENCIL                                       = 0x1802;
47    const GLenum RED                                           = 0x1903;
48    const GLenum RGB8                                          = 0x8051;
49    const GLenum RGBA8                                         = 0x8058;
50    const GLenum RGB10_A2                                      = 0x8059;
51    const GLenum TEXTURE_BINDING_3D                            = 0x806A;
52    const GLenum UNPACK_SKIP_IMAGES                            = 0x806D;
53    const GLenum UNPACK_IMAGE_HEIGHT                           = 0x806E;
54    const GLenum TEXTURE_3D                                    = 0x806F;
55    const GLenum TEXTURE_WRAP_R                                = 0x8072;
56    const GLenum MAX_3D_TEXTURE_SIZE                           = 0x8073;
57    const GLenum UNSIGNED_INT_2_10_10_10_REV                   = 0x8368;
58    const GLenum MAX_ELEMENTS_VERTICES                         = 0x80E8;
59    const GLenum MAX_ELEMENTS_INDICES                          = 0x80E9;
60    const GLenum TEXTURE_MIN_LOD                               = 0x813A;
61    const GLenum TEXTURE_MAX_LOD                               = 0x813B;
62    const GLenum TEXTURE_BASE_LEVEL                            = 0x813C;
63    const GLenum TEXTURE_MAX_LEVEL                             = 0x813D;
64    const GLenum MIN                                           = 0x8007;
65    const GLenum MAX                                           = 0x8008;
66    const GLenum DEPTH_COMPONENT24                             = 0x81A6;
67    const GLenum MAX_TEXTURE_LOD_BIAS                          = 0x84FD;
68    const GLenum TEXTURE_COMPARE_MODE                          = 0x884C;
69    const GLenum TEXTURE_COMPARE_FUNC                          = 0x884D;
70    const GLenum CURRENT_QUERY                                 = 0x8865;
71    const GLenum QUERY_RESULT                                  = 0x8866;
72    const GLenum QUERY_RESULT_AVAILABLE                        = 0x8867;
73    const GLenum STREAM_READ                                   = 0x88E1;
74    const GLenum STREAM_COPY                                   = 0x88E2;
75    const GLenum STATIC_READ                                   = 0x88E5;
76    const GLenum STATIC_COPY                                   = 0x88E6;
77    const GLenum DYNAMIC_READ                                  = 0x88E9;
78    const GLenum DYNAMIC_COPY                                  = 0x88EA;
79    const GLenum MAX_DRAW_BUFFERS                              = 0x8824;
80    const GLenum DRAW_BUFFER0                                  = 0x8825;
81    const GLenum DRAW_BUFFER1                                  = 0x8826;
82    const GLenum DRAW_BUFFER2                                  = 0x8827;
83    const GLenum DRAW_BUFFER3                                  = 0x8828;
84    const GLenum DRAW_BUFFER4                                  = 0x8829;
85    const GLenum DRAW_BUFFER5                                  = 0x882A;
86    const GLenum DRAW_BUFFER6                                  = 0x882B;
87    const GLenum DRAW_BUFFER7                                  = 0x882C;
88    const GLenum DRAW_BUFFER8                                  = 0x882D;
89    const GLenum DRAW_BUFFER9                                  = 0x882E;
90    const GLenum DRAW_BUFFER10                                 = 0x882F;
91    const GLenum DRAW_BUFFER11                                 = 0x8830;
92    const GLenum DRAW_BUFFER12                                 = 0x8831;
93    const GLenum DRAW_BUFFER13                                 = 0x8832;
94    const GLenum DRAW_BUFFER14                                 = 0x8833;
95    const GLenum DRAW_BUFFER15                                 = 0x8834;
96    const GLenum MAX_FRAGMENT_UNIFORM_COMPONENTS               = 0x8B49;
97    const GLenum MAX_VERTEX_UNIFORM_COMPONENTS                 = 0x8B4A;
98    const GLenum SAMPLER_3D                                    = 0x8B5F;
99    const GLenum SAMPLER_2D_SHADOW                             = 0x8B62;
100    const GLenum FRAGMENT_SHADER_DERIVATIVE_HINT               = 0x8B8B;
101    const GLenum PIXEL_PACK_BUFFER                             = 0x88EB;
102    const GLenum PIXEL_UNPACK_BUFFER                           = 0x88EC;
103    const GLenum PIXEL_PACK_BUFFER_BINDING                     = 0x88ED;
104    const GLenum PIXEL_UNPACK_BUFFER_BINDING                   = 0x88EF;
105    const GLenum FLOAT_MAT2x3                                  = 0x8B65;
106    const GLenum FLOAT_MAT2x4                                  = 0x8B66;
107    const GLenum FLOAT_MAT3x2                                  = 0x8B67;
108    const GLenum FLOAT_MAT3x4                                  = 0x8B68;
109    const GLenum FLOAT_MAT4x2                                  = 0x8B69;
110    const GLenum FLOAT_MAT4x3                                  = 0x8B6A;
111    const GLenum SRGB                                          = 0x8C40;
112    const GLenum SRGB8                                         = 0x8C41;
113    const GLenum SRGB8_ALPHA8                                  = 0x8C43;
114    const GLenum COMPARE_REF_TO_TEXTURE                        = 0x884E;
115    const GLenum RGBA32F                                       = 0x8814;
116    const GLenum RGB32F                                        = 0x8815;
117    const GLenum RGBA16F                                       = 0x881A;
118    const GLenum RGB16F                                        = 0x881B;
119    const GLenum VERTEX_ATTRIB_ARRAY_INTEGER                   = 0x88FD;
120    const GLenum MAX_ARRAY_TEXTURE_LAYERS                      = 0x88FF;
121    const GLenum MIN_PROGRAM_TEXEL_OFFSET                      = 0x8904;
122    const GLenum MAX_PROGRAM_TEXEL_OFFSET                      = 0x8905;
123    const GLenum MAX_VARYING_COMPONENTS                        = 0x8B4B;
124    const GLenum TEXTURE_2D_ARRAY                              = 0x8C1A;
125    const GLenum TEXTURE_BINDING_2D_ARRAY                      = 0x8C1D;
126    const GLenum R11F_G11F_B10F                                = 0x8C3A;
127    const GLenum UNSIGNED_INT_10F_11F_11F_REV                  = 0x8C3B;
128    const GLenum RGB9_E5                                       = 0x8C3D;
129    const GLenum UNSIGNED_INT_5_9_9_9_REV                      = 0x8C3E;
130    const GLenum TRANSFORM_FEEDBACK_BUFFER_MODE                = 0x8C7F;
131    const GLenum MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS    = 0x8C80;
132    const GLenum TRANSFORM_FEEDBACK_VARYINGS                   = 0x8C83;
133    const GLenum TRANSFORM_FEEDBACK_BUFFER_START               = 0x8C84;
134    const GLenum TRANSFORM_FEEDBACK_BUFFER_SIZE                = 0x8C85;
135    const GLenum TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN         = 0x8C88;
136    const GLenum RASTERIZER_DISCARD                            = 0x8C89;
137    const GLenum MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 0x8C8A;
138    const GLenum MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS       = 0x8C8B;
139    const GLenum INTERLEAVED_ATTRIBS                           = 0x8C8C;
140    const GLenum SEPARATE_ATTRIBS                              = 0x8C8D;
141    const GLenum TRANSFORM_FEEDBACK_BUFFER                     = 0x8C8E;
142    const GLenum TRANSFORM_FEEDBACK_BUFFER_BINDING             = 0x8C8F;
143    const GLenum RGBA32UI                                      = 0x8D70;
144    const GLenum RGB32UI                                       = 0x8D71;
145    const GLenum RGBA16UI                                      = 0x8D76;
146    const GLenum RGB16UI                                       = 0x8D77;
147    const GLenum RGBA8UI                                       = 0x8D7C;
148    const GLenum RGB8UI                                        = 0x8D7D;
149    const GLenum RGBA32I                                       = 0x8D82;
150    const GLenum RGB32I                                        = 0x8D83;
151    const GLenum RGBA16I                                       = 0x8D88;
152    const GLenum RGB16I                                        = 0x8D89;
153    const GLenum RGBA8I                                        = 0x8D8E;
154    const GLenum RGB8I                                         = 0x8D8F;
155    const GLenum RED_INTEGER                                   = 0x8D94;
156    const GLenum RGB_INTEGER                                   = 0x8D98;
157    const GLenum RGBA_INTEGER                                  = 0x8D99;
158    const GLenum SAMPLER_2D_ARRAY                              = 0x8DC1;
159    const GLenum SAMPLER_2D_ARRAY_SHADOW                       = 0x8DC4;
160    const GLenum SAMPLER_CUBE_SHADOW                           = 0x8DC5;
161    const GLenum UNSIGNED_INT_VEC2                             = 0x8DC6;
162    const GLenum UNSIGNED_INT_VEC3                             = 0x8DC7;
163    const GLenum UNSIGNED_INT_VEC4                             = 0x8DC8;
164    const GLenum INT_SAMPLER_2D                                = 0x8DCA;
165    const GLenum INT_SAMPLER_3D                                = 0x8DCB;
166    const GLenum INT_SAMPLER_CUBE                              = 0x8DCC;
167    const GLenum INT_SAMPLER_2D_ARRAY                          = 0x8DCF;
168    const GLenum UNSIGNED_INT_SAMPLER_2D                       = 0x8DD2;
169    const GLenum UNSIGNED_INT_SAMPLER_3D                       = 0x8DD3;
170    const GLenum UNSIGNED_INT_SAMPLER_CUBE                     = 0x8DD4;
171    const GLenum UNSIGNED_INT_SAMPLER_2D_ARRAY                 = 0x8DD7;
172    const GLenum DEPTH_COMPONENT32F                            = 0x8CAC;
173    const GLenum DEPTH32F_STENCIL8                             = 0x8CAD;
174    const GLenum FLOAT_32_UNSIGNED_INT_24_8_REV                = 0x8DAD;
175    const GLenum FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING         = 0x8210;
176    const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE         = 0x8211;
177    const GLenum FRAMEBUFFER_ATTACHMENT_RED_SIZE               = 0x8212;
178    const GLenum FRAMEBUFFER_ATTACHMENT_GREEN_SIZE             = 0x8213;
179    const GLenum FRAMEBUFFER_ATTACHMENT_BLUE_SIZE              = 0x8214;
180    const GLenum FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE             = 0x8215;
181    const GLenum FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE             = 0x8216;
182    const GLenum FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE           = 0x8217;
183    const GLenum FRAMEBUFFER_DEFAULT                           = 0x8218;
184    const GLenum UNSIGNED_INT_24_8                             = 0x84FA;
185    const GLenum DEPTH24_STENCIL8                              = 0x88F0;
186    const GLenum UNSIGNED_NORMALIZED                           = 0x8C17;
187    const GLenum DRAW_FRAMEBUFFER_BINDING                      = 0x8CA6; /* Same as FRAMEBUFFER_BINDING */
188    const GLenum READ_FRAMEBUFFER                              = 0x8CA8;
189    const GLenum DRAW_FRAMEBUFFER                              = 0x8CA9;
190    const GLenum READ_FRAMEBUFFER_BINDING                      = 0x8CAA;
191    const GLenum RENDERBUFFER_SAMPLES                          = 0x8CAB;
192    const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER          = 0x8CD4;
193    const GLenum MAX_COLOR_ATTACHMENTS                         = 0x8CDF;
194    const GLenum COLOR_ATTACHMENT1                             = 0x8CE1;
195    const GLenum COLOR_ATTACHMENT2                             = 0x8CE2;
196    const GLenum COLOR_ATTACHMENT3                             = 0x8CE3;
197    const GLenum COLOR_ATTACHMENT4                             = 0x8CE4;
198    const GLenum COLOR_ATTACHMENT5                             = 0x8CE5;
199    const GLenum COLOR_ATTACHMENT6                             = 0x8CE6;
200    const GLenum COLOR_ATTACHMENT7                             = 0x8CE7;
201    const GLenum COLOR_ATTACHMENT8                             = 0x8CE8;
202    const GLenum COLOR_ATTACHMENT9                             = 0x8CE9;
203    const GLenum COLOR_ATTACHMENT10                            = 0x8CEA;
204    const GLenum COLOR_ATTACHMENT11                            = 0x8CEB;
205    const GLenum COLOR_ATTACHMENT12                            = 0x8CEC;
206    const GLenum COLOR_ATTACHMENT13                            = 0x8CED;
207    const GLenum COLOR_ATTACHMENT14                            = 0x8CEE;
208    const GLenum COLOR_ATTACHMENT15                            = 0x8CEF;
209    const GLenum FRAMEBUFFER_INCOMPLETE_MULTISAMPLE            = 0x8D56;
210    const GLenum MAX_SAMPLES                                   = 0x8D57;
211    const GLenum HALF_FLOAT                                    = 0x140B;
212    const GLenum RG                                            = 0x8227;
213    const GLenum RG_INTEGER                                    = 0x8228;
214    const GLenum R8                                            = 0x8229;
215    const GLenum RG8                                           = 0x822B;
216    const GLenum R16F                                          = 0x822D;
217    const GLenum R32F                                          = 0x822E;
218    const GLenum RG16F                                         = 0x822F;
219    const GLenum RG32F                                         = 0x8230;
220    const GLenum R8I                                           = 0x8231;
221    const GLenum R8UI                                          = 0x8232;
222    const GLenum R16I                                          = 0x8233;
223    const GLenum R16UI                                         = 0x8234;
224    const GLenum R32I                                          = 0x8235;
225    const GLenum R32UI                                         = 0x8236;
226    const GLenum RG8I                                          = 0x8237;
227    const GLenum RG8UI                                         = 0x8238;
228    const GLenum RG16I                                         = 0x8239;
229    const GLenum RG16UI                                        = 0x823A;
230    const GLenum RG32I                                         = 0x823B;
231    const GLenum RG32UI                                        = 0x823C;
232    const GLenum VERTEX_ARRAY_BINDING                          = 0x85B5;
233    const GLenum R8_SNORM                                      = 0x8F94;
234    const GLenum RG8_SNORM                                     = 0x8F95;
235    const GLenum RGB8_SNORM                                    = 0x8F96;
236    const GLenum RGBA8_SNORM                                   = 0x8F97;
237    const GLenum SIGNED_NORMALIZED                             = 0x8F9C;
238    const GLenum COPY_READ_BUFFER                              = 0x8F36;
239    const GLenum COPY_WRITE_BUFFER                             = 0x8F37;
240    const GLenum COPY_READ_BUFFER_BINDING                      = 0x8F36; /* Same as COPY_READ_BUFFER */
241    const GLenum COPY_WRITE_BUFFER_BINDING                     = 0x8F37; /* Same as COPY_WRITE_BUFFER */
242    const GLenum UNIFORM_BUFFER                                = 0x8A11;
243    const GLenum UNIFORM_BUFFER_BINDING                        = 0x8A28;
244    const GLenum UNIFORM_BUFFER_START                          = 0x8A29;
245    const GLenum UNIFORM_BUFFER_SIZE                           = 0x8A2A;
246    const GLenum MAX_VERTEX_UNIFORM_BLOCKS                     = 0x8A2B;
247    const GLenum MAX_FRAGMENT_UNIFORM_BLOCKS                   = 0x8A2D;
248    const GLenum MAX_COMBINED_UNIFORM_BLOCKS                   = 0x8A2E;
249    const GLenum MAX_UNIFORM_BUFFER_BINDINGS                   = 0x8A2F;
250    const GLenum MAX_UNIFORM_BLOCK_SIZE                        = 0x8A30;
251    const GLenum MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS        = 0x8A31;
252    const GLenum MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS      = 0x8A33;
253    const GLenum UNIFORM_BUFFER_OFFSET_ALIGNMENT               = 0x8A34;
254    const GLenum ACTIVE_UNIFORM_BLOCKS                         = 0x8A36;
255    const GLenum UNIFORM_TYPE                                  = 0x8A37;
256    const GLenum UNIFORM_SIZE                                  = 0x8A38;
257    const GLenum UNIFORM_BLOCK_INDEX                           = 0x8A3A;
258    const GLenum UNIFORM_OFFSET                                = 0x8A3B;
259    const GLenum UNIFORM_ARRAY_STRIDE                          = 0x8A3C;
260    const GLenum UNIFORM_MATRIX_STRIDE                         = 0x8A3D;
261    const GLenum UNIFORM_IS_ROW_MAJOR                          = 0x8A3E;
262    const GLenum UNIFORM_BLOCK_BINDING                         = 0x8A3F;
263    const GLenum UNIFORM_BLOCK_DATA_SIZE                       = 0x8A40;
264    const GLenum UNIFORM_BLOCK_ACTIVE_UNIFORMS                 = 0x8A42;
265    const GLenum UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES          = 0x8A43;
266    const GLenum UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER     = 0x8A44;
267    const GLenum UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER   = 0x8A46;
268    const GLenum INVALID_INDEX                                 = 0xFFFFFFFF;
269    const GLenum MAX_VERTEX_OUTPUT_COMPONENTS                  = 0x9122;
270    const GLenum MAX_FRAGMENT_INPUT_COMPONENTS                 = 0x9125;
271    const GLenum MAX_SERVER_WAIT_TIMEOUT                       = 0x9111;
272    const GLenum OBJECT_TYPE                                   = 0x9112;
273    const GLenum SYNC_CONDITION                                = 0x9113;
274    const GLenum SYNC_STATUS                                   = 0x9114;
275    const GLenum SYNC_FLAGS                                    = 0x9115;
276    const GLenum SYNC_FENCE                                    = 0x9116;
277    const GLenum SYNC_GPU_COMMANDS_COMPLETE                    = 0x9117;
278    const GLenum UNSIGNALED                                    = 0x9118;
279    const GLenum SIGNALED                                      = 0x9119;
280    const GLenum ALREADY_SIGNALED                              = 0x911A;
281    const GLenum TIMEOUT_EXPIRED                               = 0x911B;
282    const GLenum CONDITION_SATISFIED                           = 0x911C;
283    [NeedsWindowsUndef]
284    const GLenum WAIT_FAILED                                   = 0x911D;
285    const GLenum SYNC_FLUSH_COMMANDS_BIT                       = 0x00000001;
286    const GLenum VERTEX_ATTRIB_ARRAY_DIVISOR                   = 0x88FE;
287    const GLenum ANY_SAMPLES_PASSED                            = 0x8C2F;
288    const GLenum ANY_SAMPLES_PASSED_CONSERVATIVE               = 0x8D6A;
289    const GLenum SAMPLER_BINDING                               = 0x8919;
290    const GLenum RGB10_A2UI                                    = 0x906F;
291    const GLenum INT_2_10_10_10_REV                            = 0x8D9F;
292    const GLenum TRANSFORM_FEEDBACK                            = 0x8E22;
293    const GLenum TRANSFORM_FEEDBACK_PAUSED                     = 0x8E23;
294    const GLenum TRANSFORM_FEEDBACK_ACTIVE                     = 0x8E24;
295    const GLenum TRANSFORM_FEEDBACK_BINDING                    = 0x8E25;
296    const GLenum TEXTURE_IMMUTABLE_FORMAT                      = 0x912F;
297    const GLenum MAX_ELEMENT_INDEX                             = 0x8D6B;
298    const GLenum TEXTURE_IMMUTABLE_LEVELS                      = 0x82DF;
299
300    const GLint64 TIMEOUT_IGNORED                              = -1;
301
302    /* WebGL-specific enums */
303    const GLenum MAX_CLIENT_WAIT_TIMEOUT_WEBGL                 = 0x9247;
304
305    /* Buffer objects */
306    // WebGL1:
307    void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
308    void bufferData(GLenum target, ArrayBuffer? srcData, GLenum usage);
309    void bufferData(GLenum target, ArrayBufferView srcData, GLenum usage);
310    void bufferSubData(GLenum target, GLintptr offset, ArrayBuffer srcData);
311    void bufferSubData(GLenum target, GLintptr offset, ArrayBufferView srcData);
312    // WebGL2:
313    void bufferData(GLenum target, ArrayBufferView srcData, GLenum usage,
314                    GLuint srcOffset, optional GLuint length = 0);
315    void bufferSubData(GLenum target, GLintptr dstByteOffset, ArrayBufferView srcData,
316                       GLuint srcOffset, optional GLuint length = 0);
317
318    void copyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset,
319                           GLintptr writeOffset, GLsizeiptr size);
320    // MapBufferRange, in particular its read-only and write-only modes,
321    // can not be exposed safely to JavaScript. GetBufferSubData
322    // replaces it for the purpose of fetching data back from the GPU.
323    void getBufferSubData(GLenum target, GLintptr srcByteOffset, ArrayBufferView dstData,
324                          optional GLuint dstOffset = 0, optional GLuint length = 0);
325
326    /* Framebuffer objects */
327    void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0,
328                         GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
329    void framebufferTextureLayer(GLenum target, GLenum attachment, WebGLTexture? texture, GLint level,
330                                 GLint layer);
331
332    [Throws]
333    void invalidateFramebuffer(GLenum target, sequence<GLenum> attachments);
334
335    [Throws]
336    void invalidateSubFramebuffer(GLenum target, sequence<GLenum> attachments,
337                                  GLint x, GLint y, GLsizei width, GLsizei height);
338
339    void readBuffer(GLenum src);
340
341    /* Renderbuffer objects */
342    [Throws]
343    any getInternalformatParameter(GLenum target, GLenum internalformat, GLenum pname);
344    void renderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat,
345                                        GLsizei width, GLsizei height);
346
347    /* Texture objects */
348    void texStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width,
349                      GLsizei height);
350    void texStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width,
351                      GLsizei height, GLsizei depth);
352
353    // WebGL1 legacy entrypoints:
354    [Throws] // Another overhead throws.
355    void texImage2D(GLenum target, GLint level, GLint internalformat,
356                    GLsizei width, GLsizei height, GLint border, GLenum format,
357                    GLenum type, ArrayBufferView? pixels);
358    [Throws]
359    void texImage2D(GLenum target, GLint level, GLint internalformat,
360                    GLenum format, GLenum type, HTMLCanvasElement source); // May throw DOMException
361    [Throws]
362    void texImage2D(GLenum target, GLint level, GLint internalformat,
363                    GLenum format, GLenum type, HTMLImageElement source); // May throw DOMException
364    [Throws]
365    void texImage2D(GLenum target, GLint level, GLint internalformat,
366                    GLenum format, GLenum type, HTMLVideoElement source); // May throw DOMException
367    [Throws] // Another overhead throws.
368    void texImage2D(GLenum target, GLint level, GLint internalformat,
369                    GLenum format, GLenum type, ImageBitmap source);
370    [Throws] // Another overhead throws.
371    void texImage2D(GLenum target, GLint level, GLint internalformat,
372                    GLenum format, GLenum type, ImageData source);
373
374    [Throws] // Another overhead throws.
375    void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
376                       GLsizei width, GLsizei height,
377                       GLenum format, GLenum type, ArrayBufferView? pixels);
378    [Throws]
379    void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
380                       GLenum format, GLenum type, HTMLCanvasElement source); // May throw DOMException
381    [Throws]
382    void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
383                       GLenum format, GLenum type, HTMLImageElement source); // May throw DOMException
384    [Throws]
385    void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
386                       GLenum format, GLenum type, HTMLVideoElement source); // May throw DOMException
387    [Throws] // Another overhead throws.
388    void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
389                       GLenum format, GLenum type, ImageBitmap source);
390    [Throws] // Another overhead throws.
391    void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
392                       GLenum format, GLenum type, ImageData source);
393
394    // WebGL2 entrypoints:
395    [Throws] // Another overhead throws.
396    void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
397                    GLint border, GLenum format, GLenum type, GLintptr pboOffset);
398    [Throws]
399    void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
400                    GLint border, GLenum format, GLenum type,
401                    HTMLCanvasElement source); // May throw DOMException
402    [Throws]
403    void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
404                    GLint border, GLenum format, GLenum type,
405                    HTMLImageElement source); // May throw DOMException
406    [Throws]
407    void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
408                    GLint border, GLenum format, GLenum type,
409                    HTMLVideoElement source); // May throw DOMException
410    [Throws] // Another overhead throws.
411    void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
412                    GLint border, GLenum format, GLenum type,
413                    ImageBitmap source);
414    [Throws] // Another overhead throws.
415    void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
416                    GLint border, GLenum format, GLenum type,
417                    ImageData source);
418    [Throws] // Another overhead throws.
419    void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
420                    GLint border, GLenum format, GLenum type, ArrayBufferView srcData,
421                    GLuint srcOffset);
422
423    [Throws] // Another overhead throws.
424    void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
425                    GLsizei depth, GLint border, GLenum format, GLenum type, GLintptr pboOffset);
426    [Throws]
427    void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
428                    GLsizei depth, GLint border, GLenum format, GLenum type,
429                    HTMLCanvasElement source); // May throw DOMException
430    [Throws]
431    void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
432                    GLsizei depth, GLint border, GLenum format, GLenum type,
433                    HTMLImageElement source); // May throw DOMException
434    [Throws]
435    void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
436                    GLsizei depth, GLint border, GLenum format, GLenum type,
437                    HTMLVideoElement source); // May throw DOMException
438    [Throws] // Another overhead throws.
439    void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
440                    GLsizei depth, GLint border, GLenum format, GLenum type,
441                    ImageBitmap source);
442    [Throws] // Another overhead throws.
443    void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
444                    GLsizei depth, GLint border, GLenum format, GLenum type,
445                    ImageData source);
446    [Throws] // Another overhead throws.
447    void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
448                    GLsizei depth, GLint border, GLenum format, GLenum type, ArrayBufferView? srcData);
449    [Throws] // Another overhead throws.
450    void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
451                    GLsizei depth, GLint border, GLenum format, GLenum type, ArrayBufferView srcData,
452                    GLuint srcOffset);
453
454    [Throws] // Another overhead throws.
455    void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
456                       GLsizei height, GLenum format, GLenum type, GLintptr pboOffset);
457    [Throws]
458    void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
459                       GLsizei height, GLenum format, GLenum type,
460                       HTMLCanvasElement source); // May throw DOMException
461    [Throws]
462    void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
463                       GLsizei height, GLenum format, GLenum type,
464                       HTMLImageElement source); // May throw DOMException
465    [Throws]
466    void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
467                       GLsizei height, GLenum format, GLenum type,
468                       HTMLVideoElement source); // May throw DOMException
469    [Throws] // Another overhead throws.
470    void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
471                       GLsizei height, GLenum format, GLenum type,
472                       ImageBitmap source);
473    [Throws] // Another overhead throws.
474    void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
475                       GLsizei height, GLenum format, GLenum type,
476                       ImageData source);
477    [Throws] // Another overhead throws.
478    void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
479                       GLsizei height, GLenum format, GLenum type, ArrayBufferView srcData,
480                       GLuint srcOffset);
481
482    [Throws] // Another overhead throws.
483    void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
484                       GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
485                       GLintptr pboOffset);
486    [Throws]
487    void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
488                       GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
489                       HTMLCanvasElement source); // May throw DOMException
490    [Throws]
491    void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
492                       GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
493                       HTMLImageElement source); // May throw DOMException
494    [Throws]
495    void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
496                       GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
497                       HTMLVideoElement source); // May throw DOMException
498    [Throws] // Another overhead throws.
499    void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
500                       GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
501                       ImageBitmap source);
502    [Throws] // Another overhead throws.
503    void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
504                       GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
505                       ImageData source);
506    [Throws] // Another overhead throws.
507    void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
508                       GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
509                       ArrayBufferView? srcData, optional GLuint srcOffset = 0);
510
511    void copyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
512                           GLint x, GLint y, GLsizei width, GLsizei height);
513
514    void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width,
515                              GLsizei height, GLint border, GLsizei imageSize,  GLintptr offset);
516    void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width,
517                              GLsizei height, GLint border, ArrayBufferView srcData,
518                              optional GLuint srcOffset = 0, optional GLuint srcLengthOverride = 0);
519
520    void compressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width,
521                              GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLintptr offset);
522    void compressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width,
523                              GLsizei height, GLsizei depth, GLint border, ArrayBufferView srcData,
524                              optional GLuint srcOffset = 0, optional GLuint srcLengthOverride = 0);
525
526    void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
527                                 GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLintptr offset);
528    void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
529                                 GLsizei width, GLsizei height, GLenum format,
530                                 ArrayBufferView srcData,
531                                 optional GLuint srcOffset = 0,
532                                 optional GLuint srcLengthOverride = 0);
533
534    void compressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
535                                 GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
536                                 GLenum format, GLsizei imageSize, GLintptr offset);
537    void compressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
538                                 GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
539                                 GLenum format, ArrayBufferView srcData,
540                                 optional GLuint srcOffset = 0,
541                                 optional GLuint srcLengthOverride = 0);
542
543    /* Programs and shaders */
544    [WebGLHandlesContextLoss] GLint getFragDataLocation(WebGLProgram program, DOMString name);
545
546    /* Uniforms */
547    void uniform1ui(WebGLUniformLocation? location, GLuint v0);
548    void uniform2ui(WebGLUniformLocation? location, GLuint v0, GLuint v1);
549    void uniform3ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2);
550    void uniform4ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
551
552    void uniform1fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0,
553                    optional GLuint srcLength = 0);
554    void uniform2fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0,
555                    optional GLuint srcLength = 0);
556    void uniform3fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0,
557                    optional GLuint srcLength = 0);
558    void uniform4fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0,
559                    optional GLuint srcLength = 0);
560
561    void uniform1iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0,
562                    optional GLuint srcLength = 0);
563    void uniform2iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0,
564                    optional GLuint srcLength = 0);
565    void uniform3iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0,
566                    optional GLuint srcLength = 0);
567    void uniform4iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0,
568                    optional GLuint srcLength = 0);
569
570    void uniform1uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0,
571                    optional GLuint srcLength = 0);
572    void uniform2uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0,
573                    optional GLuint srcLength = 0);
574    void uniform3uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0,
575                    optional GLuint srcLength = 0);
576    void uniform4uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0,
577                    optional GLuint srcLength = 0);
578
579    void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
580                          optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
581    void uniformMatrix3x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
582                            optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
583    void uniformMatrix4x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
584                            optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
585
586    void uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
587                            optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
588    void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
589                          optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
590    void uniformMatrix4x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
591                            optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
592
593    void uniformMatrix2x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
594                            optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
595    void uniformMatrix3x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
596                            optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
597    void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
598                          optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
599
600    /* Vertex attribs */
601    void vertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
602    void vertexAttribI4iv(GLuint index, Int32List values);
603    void vertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
604    void vertexAttribI4uiv(GLuint index, Uint32List values);
605    void vertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
606
607    /* Writing to the drawing buffer */
608    void vertexAttribDivisor(GLuint index, GLuint divisor);
609    void drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
610    void drawElementsInstanced(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei instanceCount);
611    void drawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLintptr offset);
612
613    /* Reading back pixels */
614    // WebGL1:
615    [Throws, NeedsCallerType] // Throws on readback in a write-only context.
616    void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
617                    ArrayBufferView? dstData);
618    // WebGL2:
619    [Throws, NeedsCallerType] // Throws on readback in a write-only context.
620    void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
621                    GLintptr offset);
622    [Throws, NeedsCallerType] // Throws on readback in a write-only context.
623    void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
624                    ArrayBufferView dstData, GLuint dstOffset);
625
626    /* Multiple Render Targets */
627    void drawBuffers(sequence<GLenum> buffers);
628
629    void clearBufferfv(GLenum buffer, GLint drawbuffer, Float32List values,
630                       optional GLuint srcOffset = 0);
631    void clearBufferiv(GLenum buffer, GLint drawbuffer, Int32List values,
632                       optional GLuint srcOffset = 0);
633    void clearBufferuiv(GLenum buffer, GLint drawbuffer, Uint32List values,
634                        optional GLuint srcOffset = 0);
635
636    void clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
637
638    /* Query Objects */
639    WebGLQuery? createQuery();
640    void deleteQuery(WebGLQuery? query);
641    [WebGLHandlesContextLoss] GLboolean isQuery(WebGLQuery? query);
642    void beginQuery(GLenum target, WebGLQuery query);
643    void endQuery(GLenum target);
644    any getQuery(GLenum target, GLenum pname);
645    any getQueryParameter(WebGLQuery query, GLenum pname);
646
647    /* Sampler Objects */
648    WebGLSampler? createSampler();
649    void deleteSampler(WebGLSampler? sampler);
650    [WebGLHandlesContextLoss] GLboolean isSampler(WebGLSampler? sampler);
651    void bindSampler(GLuint unit, WebGLSampler? sampler);
652    void samplerParameteri(WebGLSampler sampler, GLenum pname, GLint param);
653    void samplerParameterf(WebGLSampler sampler, GLenum pname, GLfloat param);
654    any getSamplerParameter(WebGLSampler sampler, GLenum pname);
655
656    /* Sync objects */
657    WebGLSync? fenceSync(GLenum condition, GLbitfield flags);
658    [WebGLHandlesContextLoss] GLboolean isSync(WebGLSync? sync);
659    void deleteSync(WebGLSync? sync);
660    GLenum clientWaitSync(WebGLSync sync, GLbitfield flags, GLuint64 timeout);
661    void waitSync(WebGLSync sync, GLbitfield flags, GLint64 timeout);
662    any getSyncParameter(WebGLSync sync, GLenum pname);
663
664    /* Transform Feedback */
665    WebGLTransformFeedback? createTransformFeedback();
666    void deleteTransformFeedback(WebGLTransformFeedback? tf);
667    [WebGLHandlesContextLoss] GLboolean isTransformFeedback(WebGLTransformFeedback? tf);
668    void bindTransformFeedback(GLenum target, WebGLTransformFeedback? tf);
669    void beginTransformFeedback(GLenum primitiveMode);
670    void endTransformFeedback();
671    void transformFeedbackVaryings(WebGLProgram program, sequence<DOMString> varyings, GLenum bufferMode);
672    [NewObject]
673    WebGLActiveInfo? getTransformFeedbackVarying(WebGLProgram program, GLuint index);
674    void pauseTransformFeedback();
675    void resumeTransformFeedback();
676
677    /* Uniform Buffer Objects and Transform Feedback Buffers */
678    void bindBufferBase(GLenum target, GLuint index, WebGLBuffer? buffer);
679    void bindBufferRange(GLenum target, GLuint index, WebGLBuffer? buffer, GLintptr offset, GLsizeiptr size);
680    [Throws] // GetOrCreateDOMReflector can fail.
681    any getIndexedParameter(GLenum target, GLuint index);
682    sequence<GLuint>? getUniformIndices(WebGLProgram program, sequence<DOMString> uniformNames);
683    any getActiveUniforms(WebGLProgram program, sequence<GLuint> uniformIndices, GLenum pname);
684    GLuint getUniformBlockIndex(WebGLProgram program, DOMString uniformBlockName);
685    [Throws] // Creating a Uint32Array can fail.
686    any getActiveUniformBlockParameter(WebGLProgram program, GLuint uniformBlockIndex, GLenum pname);
687    DOMString? getActiveUniformBlockName(WebGLProgram program, GLuint uniformBlockIndex);
688    void uniformBlockBinding(WebGLProgram program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
689
690    /* Vertex Array Objects */
691    WebGLVertexArrayObject? createVertexArray();
692    void deleteVertexArray(WebGLVertexArrayObject? vertexArray);
693    [WebGLHandlesContextLoss] GLboolean isVertexArray(WebGLVertexArrayObject? vertexArray);
694    void bindVertexArray(WebGLVertexArrayObject? array);
695};
696
697WebGL2RenderingContextBase includes WebGLRenderingContextBase;
698WebGL2RenderingContext includes WebGL2RenderingContextBase;
699
700[NoInterfaceObject]
701interface EXT_color_buffer_float {
702};
703