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 origin of this IDL file is
7 * https://www.khronos.org/registry/webgl/specs/latest/webgl.idl
8 *
9 * Copyright © 2012 Khronos Group
10 */
11
12// WebGL IDL definitions scraped from the Khronos specification:
13// https://www.khronos.org/registry/webgl/specs/latest/
14//
15// This IDL depends on the typed array specification defined at:
16// https://www.khronos.org/registry/typedarray/specs/latest/typedarrays.idl
17
18typedef unsigned long  GLenum;
19typedef boolean        GLboolean;
20typedef unsigned long  GLbitfield;
21typedef byte           GLbyte;         /* 'byte' should be a signed 8 bit type. */
22typedef short          GLshort;
23typedef long           GLint;
24typedef long           GLsizei;
25typedef long long      GLintptr;
26typedef long long      GLsizeiptr;
27// Ideally the typedef below would use 'unsigned byte', but that doesn't currently exist in Web IDL.
28typedef octet          GLubyte;        /* 'octet' should be an unsigned 8 bit type. */
29typedef unsigned short GLushort;
30typedef unsigned long  GLuint;
31typedef unrestricted float GLfloat;
32typedef unrestricted float GLclampf;
33typedef unsigned long long GLuint64EXT;
34
35// The power preference settings are documented in the WebGLContextAttributes
36// section of the specification.
37enum WebGLPowerPreference { "default", "low-power", "high-performance" };
38
39dictionary WebGLContextAttributes {
40    // boolean alpha = true;
41    // We deviate from the spec here.
42    // If alpha isn't specified, we rely on a pref ("webgl.default-no-alpha")
43    GLboolean alpha;
44    GLboolean depth = true;
45    GLboolean stencil = false;
46    GLboolean antialias = true;
47    GLboolean premultipliedAlpha = true;
48    GLboolean preserveDrawingBuffer = false;
49    GLboolean failIfMajorPerformanceCaveat = false;
50    WebGLPowerPreference powerPreference = "default";
51};
52
53[Exposed=(Window,Worker),
54 Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"]
55interface WebGLBuffer {
56};
57
58[Exposed=(Window,Worker),
59 Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"]
60interface WebGLFramebuffer {
61};
62
63[Exposed=(Window,Worker),
64 Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"]
65interface WebGLProgram {
66};
67
68[Exposed=(Window,Worker),
69 Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"]
70interface WebGLRenderbuffer {
71};
72
73[Exposed=(Window,Worker),
74 Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"]
75interface WebGLShader {
76};
77
78[Exposed=(Window,Worker),
79 Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"]
80interface WebGLTexture {
81};
82
83[Exposed=(Window,Worker),
84 Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"]
85interface WebGLUniformLocation {
86};
87
88interface WebGLVertexArrayObject {
89};
90
91[Exposed=(Window,Worker),
92 Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"]
93interface WebGLActiveInfo {
94    readonly attribute GLint size;
95    readonly attribute GLenum type;
96    readonly attribute DOMString name;
97};
98
99[Exposed=(Window,Worker),
100 Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"]
101interface WebGLShaderPrecisionFormat {
102    readonly attribute GLint rangeMin;
103    readonly attribute GLint rangeMax;
104    readonly attribute GLint precision;
105};
106
107typedef (Float32Array or sequence<GLfloat>) Float32List;
108typedef (Int32Array or sequence<GLint>) Int32List;
109
110// Shared interface for the things that WebGLRenderingContext and
111// WebGL2RenderingContext have in common.  This doesn't have all the things they
112// have in common, because we don't support splitting multiple overloads of the
113// same method across separate interfaces and pulling them in with "implements".
114interface mixin WebGLRenderingContextBase {
115    /* ClearBufferMask */
116    const GLenum DEPTH_BUFFER_BIT               = 0x00000100;
117    const GLenum STENCIL_BUFFER_BIT             = 0x00000400;
118    const GLenum COLOR_BUFFER_BIT               = 0x00004000;
119
120    /* BeginMode */
121    const GLenum POINTS                         = 0x0000;
122    const GLenum LINES                          = 0x0001;
123    const GLenum LINE_LOOP                      = 0x0002;
124    const GLenum LINE_STRIP                     = 0x0003;
125    const GLenum TRIANGLES                      = 0x0004;
126    const GLenum TRIANGLE_STRIP                 = 0x0005;
127    const GLenum TRIANGLE_FAN                   = 0x0006;
128
129    /* AlphaFunction (not supported in ES20) */
130    /*      NEVER */
131    /*      LESS */
132    /*      EQUAL */
133    /*      LEQUAL */
134    /*      GREATER */
135    /*      NOTEQUAL */
136    /*      GEQUAL */
137    /*      ALWAYS */
138
139    /* BlendingFactorDest */
140    const GLenum ZERO                           = 0;
141    const GLenum ONE                            = 1;
142    const GLenum SRC_COLOR                      = 0x0300;
143    const GLenum ONE_MINUS_SRC_COLOR            = 0x0301;
144    const GLenum SRC_ALPHA                      = 0x0302;
145    const GLenum ONE_MINUS_SRC_ALPHA            = 0x0303;
146    const GLenum DST_ALPHA                      = 0x0304;
147    const GLenum ONE_MINUS_DST_ALPHA            = 0x0305;
148
149    /* BlendingFactorSrc */
150    /*      ZERO */
151    /*      ONE */
152    const GLenum DST_COLOR                      = 0x0306;
153    const GLenum ONE_MINUS_DST_COLOR            = 0x0307;
154    const GLenum SRC_ALPHA_SATURATE             = 0x0308;
155    /*      SRC_ALPHA */
156    /*      ONE_MINUS_SRC_ALPHA */
157    /*      DST_ALPHA */
158    /*      ONE_MINUS_DST_ALPHA */
159
160    /* BlendEquationSeparate */
161    const GLenum FUNC_ADD                       = 0x8006;
162    const GLenum BLEND_EQUATION                 = 0x8009;
163    const GLenum BLEND_EQUATION_RGB             = 0x8009;   /* same as BLEND_EQUATION */
164    const GLenum BLEND_EQUATION_ALPHA           = 0x883D;
165
166    /* BlendSubtract */
167    const GLenum FUNC_SUBTRACT                  = 0x800A;
168    const GLenum FUNC_REVERSE_SUBTRACT          = 0x800B;
169
170    /* Separate Blend Functions */
171    const GLenum BLEND_DST_RGB                  = 0x80C8;
172    const GLenum BLEND_SRC_RGB                  = 0x80C9;
173    const GLenum BLEND_DST_ALPHA                = 0x80CA;
174    const GLenum BLEND_SRC_ALPHA                = 0x80CB;
175    const GLenum CONSTANT_COLOR                 = 0x8001;
176    const GLenum ONE_MINUS_CONSTANT_COLOR       = 0x8002;
177    const GLenum CONSTANT_ALPHA                 = 0x8003;
178    const GLenum ONE_MINUS_CONSTANT_ALPHA       = 0x8004;
179    const GLenum BLEND_COLOR                    = 0x8005;
180
181    /* Buffer Objects */
182    const GLenum ARRAY_BUFFER                   = 0x8892;
183    const GLenum ELEMENT_ARRAY_BUFFER           = 0x8893;
184    const GLenum ARRAY_BUFFER_BINDING           = 0x8894;
185    const GLenum ELEMENT_ARRAY_BUFFER_BINDING   = 0x8895;
186
187    const GLenum STREAM_DRAW                    = 0x88E0;
188    const GLenum STATIC_DRAW                    = 0x88E4;
189    const GLenum DYNAMIC_DRAW                   = 0x88E8;
190
191    const GLenum BUFFER_SIZE                    = 0x8764;
192    const GLenum BUFFER_USAGE                   = 0x8765;
193
194    const GLenum CURRENT_VERTEX_ATTRIB          = 0x8626;
195
196    /* CullFaceMode */
197    const GLenum FRONT                          = 0x0404;
198    const GLenum BACK                           = 0x0405;
199    const GLenum FRONT_AND_BACK                 = 0x0408;
200
201    /* DepthFunction */
202    /*      NEVER */
203    /*      LESS */
204    /*      EQUAL */
205    /*      LEQUAL */
206    /*      GREATER */
207    /*      NOTEQUAL */
208    /*      GEQUAL */
209    /*      ALWAYS */
210
211    /* EnableCap */
212    /* TEXTURE_2D */
213    const GLenum CULL_FACE                      = 0x0B44;
214    const GLenum BLEND                          = 0x0BE2;
215    const GLenum DITHER                         = 0x0BD0;
216    const GLenum STENCIL_TEST                   = 0x0B90;
217    const GLenum DEPTH_TEST                     = 0x0B71;
218    const GLenum SCISSOR_TEST                   = 0x0C11;
219    const GLenum POLYGON_OFFSET_FILL            = 0x8037;
220    const GLenum SAMPLE_ALPHA_TO_COVERAGE       = 0x809E;
221    const GLenum SAMPLE_COVERAGE                = 0x80A0;
222
223    /* ErrorCode */
224    [NeedsWindowsUndef]
225    const GLenum NO_ERROR                       = 0;
226    const GLenum INVALID_ENUM                   = 0x0500;
227    const GLenum INVALID_VALUE                  = 0x0501;
228    const GLenum INVALID_OPERATION              = 0x0502;
229    const GLenum OUT_OF_MEMORY                  = 0x0505;
230
231    /* FrontFaceDirection */
232    const GLenum CW                             = 0x0900;
233    const GLenum CCW                            = 0x0901;
234
235    /* GetPName */
236    const GLenum LINE_WIDTH                     = 0x0B21;
237    const GLenum ALIASED_POINT_SIZE_RANGE       = 0x846D;
238    const GLenum ALIASED_LINE_WIDTH_RANGE       = 0x846E;
239    const GLenum CULL_FACE_MODE                 = 0x0B45;
240    const GLenum FRONT_FACE                     = 0x0B46;
241    const GLenum DEPTH_RANGE                    = 0x0B70;
242    const GLenum DEPTH_WRITEMASK                = 0x0B72;
243    const GLenum DEPTH_CLEAR_VALUE              = 0x0B73;
244    const GLenum DEPTH_FUNC                     = 0x0B74;
245    const GLenum STENCIL_CLEAR_VALUE            = 0x0B91;
246    const GLenum STENCIL_FUNC                   = 0x0B92;
247    const GLenum STENCIL_FAIL                   = 0x0B94;
248    const GLenum STENCIL_PASS_DEPTH_FAIL        = 0x0B95;
249    const GLenum STENCIL_PASS_DEPTH_PASS        = 0x0B96;
250    const GLenum STENCIL_REF                    = 0x0B97;
251    const GLenum STENCIL_VALUE_MASK             = 0x0B93;
252    const GLenum STENCIL_WRITEMASK              = 0x0B98;
253    const GLenum STENCIL_BACK_FUNC              = 0x8800;
254    const GLenum STENCIL_BACK_FAIL              = 0x8801;
255    const GLenum STENCIL_BACK_PASS_DEPTH_FAIL   = 0x8802;
256    const GLenum STENCIL_BACK_PASS_DEPTH_PASS   = 0x8803;
257    const GLenum STENCIL_BACK_REF               = 0x8CA3;
258    const GLenum STENCIL_BACK_VALUE_MASK        = 0x8CA4;
259    const GLenum STENCIL_BACK_WRITEMASK         = 0x8CA5;
260    const GLenum VIEWPORT                       = 0x0BA2;
261    const GLenum SCISSOR_BOX                    = 0x0C10;
262    /*      SCISSOR_TEST */
263    const GLenum COLOR_CLEAR_VALUE              = 0x0C22;
264    const GLenum COLOR_WRITEMASK                = 0x0C23;
265    const GLenum UNPACK_ALIGNMENT               = 0x0CF5;
266    const GLenum PACK_ALIGNMENT                 = 0x0D05;
267    const GLenum MAX_TEXTURE_SIZE               = 0x0D33;
268    const GLenum MAX_VIEWPORT_DIMS              = 0x0D3A;
269    const GLenum SUBPIXEL_BITS                  = 0x0D50;
270    const GLenum RED_BITS                       = 0x0D52;
271    const GLenum GREEN_BITS                     = 0x0D53;
272    const GLenum BLUE_BITS                      = 0x0D54;
273    const GLenum ALPHA_BITS                     = 0x0D55;
274    const GLenum DEPTH_BITS                     = 0x0D56;
275    const GLenum STENCIL_BITS                   = 0x0D57;
276    const GLenum POLYGON_OFFSET_UNITS           = 0x2A00;
277    /*      POLYGON_OFFSET_FILL */
278    const GLenum POLYGON_OFFSET_FACTOR          = 0x8038;
279    const GLenum TEXTURE_BINDING_2D             = 0x8069;
280    const GLenum SAMPLE_BUFFERS                 = 0x80A8;
281    const GLenum SAMPLES                        = 0x80A9;
282    const GLenum SAMPLE_COVERAGE_VALUE          = 0x80AA;
283    const GLenum SAMPLE_COVERAGE_INVERT         = 0x80AB;
284
285    /* GetTextureParameter */
286    /*      TEXTURE_MAG_FILTER */
287    /*      TEXTURE_MIN_FILTER */
288    /*      TEXTURE_WRAP_S */
289    /*      TEXTURE_WRAP_T */
290
291    const GLenum COMPRESSED_TEXTURE_FORMATS     = 0x86A3;
292
293    /* HintMode */
294    const GLenum DONT_CARE                      = 0x1100;
295    const GLenum FASTEST                        = 0x1101;
296    const GLenum NICEST                         = 0x1102;
297
298    /* HintTarget */
299    const GLenum GENERATE_MIPMAP_HINT            = 0x8192;
300
301    /* DataType */
302    const GLenum BYTE                           = 0x1400;
303    const GLenum UNSIGNED_BYTE                  = 0x1401;
304    const GLenum SHORT                          = 0x1402;
305    const GLenum UNSIGNED_SHORT                 = 0x1403;
306    const GLenum INT                            = 0x1404;
307    const GLenum UNSIGNED_INT                   = 0x1405;
308    const GLenum FLOAT                          = 0x1406;
309
310    /* PixelFormat */
311    const GLenum DEPTH_COMPONENT                = 0x1902;
312    const GLenum ALPHA                          = 0x1906;
313    const GLenum RGB                            = 0x1907;
314    const GLenum RGBA                           = 0x1908;
315    const GLenum LUMINANCE                      = 0x1909;
316    const GLenum LUMINANCE_ALPHA                = 0x190A;
317
318    /* PixelType */
319    /*      UNSIGNED_BYTE */
320    const GLenum UNSIGNED_SHORT_4_4_4_4         = 0x8033;
321    const GLenum UNSIGNED_SHORT_5_5_5_1         = 0x8034;
322    const GLenum UNSIGNED_SHORT_5_6_5           = 0x8363;
323
324    /* Shaders */
325    const GLenum FRAGMENT_SHADER                  = 0x8B30;
326    const GLenum VERTEX_SHADER                    = 0x8B31;
327    const GLenum MAX_VERTEX_ATTRIBS               = 0x8869;
328    const GLenum MAX_VERTEX_UNIFORM_VECTORS       = 0x8DFB;
329    const GLenum MAX_VARYING_VECTORS              = 0x8DFC;
330    const GLenum MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D;
331    const GLenum MAX_VERTEX_TEXTURE_IMAGE_UNITS   = 0x8B4C;
332    const GLenum MAX_TEXTURE_IMAGE_UNITS          = 0x8872;
333    const GLenum MAX_FRAGMENT_UNIFORM_VECTORS     = 0x8DFD;
334    const GLenum SHADER_TYPE                      = 0x8B4F;
335    const GLenum DELETE_STATUS                    = 0x8B80;
336    const GLenum LINK_STATUS                      = 0x8B82;
337    const GLenum VALIDATE_STATUS                  = 0x8B83;
338    const GLenum ATTACHED_SHADERS                 = 0x8B85;
339    const GLenum ACTIVE_UNIFORMS                  = 0x8B86;
340    const GLenum ACTIVE_ATTRIBUTES                = 0x8B89;
341    const GLenum SHADING_LANGUAGE_VERSION         = 0x8B8C;
342    const GLenum CURRENT_PROGRAM                  = 0x8B8D;
343
344    /* StencilFunction */
345    const GLenum NEVER                          = 0x0200;
346    const GLenum LESS                           = 0x0201;
347    const GLenum EQUAL                          = 0x0202;
348    const GLenum LEQUAL                         = 0x0203;
349    const GLenum GREATER                        = 0x0204;
350    const GLenum NOTEQUAL                       = 0x0205;
351    const GLenum GEQUAL                         = 0x0206;
352    const GLenum ALWAYS                         = 0x0207;
353
354    /* StencilOp */
355    /*      ZERO */
356    const GLenum KEEP                           = 0x1E00;
357    const GLenum REPLACE                        = 0x1E01;
358    const GLenum INCR                           = 0x1E02;
359    const GLenum DECR                           = 0x1E03;
360    const GLenum INVERT                         = 0x150A;
361    const GLenum INCR_WRAP                      = 0x8507;
362    const GLenum DECR_WRAP                      = 0x8508;
363
364    /* StringName */
365    const GLenum VENDOR                         = 0x1F00;
366    const GLenum RENDERER                       = 0x1F01;
367    const GLenum VERSION                        = 0x1F02;
368
369    /* TextureMagFilter */
370    const GLenum NEAREST                        = 0x2600;
371    const GLenum LINEAR                         = 0x2601;
372
373    /* TextureMinFilter */
374    /*      NEAREST */
375    /*      LINEAR */
376    const GLenum NEAREST_MIPMAP_NEAREST         = 0x2700;
377    const GLenum LINEAR_MIPMAP_NEAREST          = 0x2701;
378    const GLenum NEAREST_MIPMAP_LINEAR          = 0x2702;
379    const GLenum LINEAR_MIPMAP_LINEAR           = 0x2703;
380
381    /* TextureParameterName */
382    const GLenum TEXTURE_MAG_FILTER             = 0x2800;
383    const GLenum TEXTURE_MIN_FILTER             = 0x2801;
384    const GLenum TEXTURE_WRAP_S                 = 0x2802;
385    const GLenum TEXTURE_WRAP_T                 = 0x2803;
386
387    /* TextureTarget */
388    const GLenum TEXTURE_2D                     = 0x0DE1;
389    const GLenum TEXTURE                        = 0x1702;
390
391    const GLenum TEXTURE_CUBE_MAP               = 0x8513;
392    const GLenum TEXTURE_BINDING_CUBE_MAP       = 0x8514;
393    const GLenum TEXTURE_CUBE_MAP_POSITIVE_X    = 0x8515;
394    const GLenum TEXTURE_CUBE_MAP_NEGATIVE_X    = 0x8516;
395    const GLenum TEXTURE_CUBE_MAP_POSITIVE_Y    = 0x8517;
396    const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Y    = 0x8518;
397    const GLenum TEXTURE_CUBE_MAP_POSITIVE_Z    = 0x8519;
398    const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Z    = 0x851A;
399    const GLenum MAX_CUBE_MAP_TEXTURE_SIZE      = 0x851C;
400
401    /* TextureUnit */
402    const GLenum TEXTURE0                       = 0x84C0;
403    const GLenum TEXTURE1                       = 0x84C1;
404    const GLenum TEXTURE2                       = 0x84C2;
405    const GLenum TEXTURE3                       = 0x84C3;
406    const GLenum TEXTURE4                       = 0x84C4;
407    const GLenum TEXTURE5                       = 0x84C5;
408    const GLenum TEXTURE6                       = 0x84C6;
409    const GLenum TEXTURE7                       = 0x84C7;
410    const GLenum TEXTURE8                       = 0x84C8;
411    const GLenum TEXTURE9                       = 0x84C9;
412    const GLenum TEXTURE10                      = 0x84CA;
413    const GLenum TEXTURE11                      = 0x84CB;
414    const GLenum TEXTURE12                      = 0x84CC;
415    const GLenum TEXTURE13                      = 0x84CD;
416    const GLenum TEXTURE14                      = 0x84CE;
417    const GLenum TEXTURE15                      = 0x84CF;
418    const GLenum TEXTURE16                      = 0x84D0;
419    const GLenum TEXTURE17                      = 0x84D1;
420    const GLenum TEXTURE18                      = 0x84D2;
421    const GLenum TEXTURE19                      = 0x84D3;
422    const GLenum TEXTURE20                      = 0x84D4;
423    const GLenum TEXTURE21                      = 0x84D5;
424    const GLenum TEXTURE22                      = 0x84D6;
425    const GLenum TEXTURE23                      = 0x84D7;
426    const GLenum TEXTURE24                      = 0x84D8;
427    const GLenum TEXTURE25                      = 0x84D9;
428    const GLenum TEXTURE26                      = 0x84DA;
429    const GLenum TEXTURE27                      = 0x84DB;
430    const GLenum TEXTURE28                      = 0x84DC;
431    const GLenum TEXTURE29                      = 0x84DD;
432    const GLenum TEXTURE30                      = 0x84DE;
433    const GLenum TEXTURE31                      = 0x84DF;
434    const GLenum ACTIVE_TEXTURE                 = 0x84E0;
435
436    /* TextureWrapMode */
437    const GLenum REPEAT                         = 0x2901;
438    const GLenum CLAMP_TO_EDGE                  = 0x812F;
439    const GLenum MIRRORED_REPEAT                = 0x8370;
440
441    /* Uniform Types */
442    const GLenum FLOAT_VEC2                     = 0x8B50;
443    const GLenum FLOAT_VEC3                     = 0x8B51;
444    const GLenum FLOAT_VEC4                     = 0x8B52;
445    const GLenum INT_VEC2                       = 0x8B53;
446    const GLenum INT_VEC3                       = 0x8B54;
447    const GLenum INT_VEC4                       = 0x8B55;
448    const GLenum BOOL                           = 0x8B56;
449    const GLenum BOOL_VEC2                      = 0x8B57;
450    const GLenum BOOL_VEC3                      = 0x8B58;
451    const GLenum BOOL_VEC4                      = 0x8B59;
452    const GLenum FLOAT_MAT2                     = 0x8B5A;
453    const GLenum FLOAT_MAT3                     = 0x8B5B;
454    const GLenum FLOAT_MAT4                     = 0x8B5C;
455    const GLenum SAMPLER_2D                     = 0x8B5E;
456    const GLenum SAMPLER_CUBE                   = 0x8B60;
457
458    /* Vertex Arrays */
459    const GLenum VERTEX_ATTRIB_ARRAY_ENABLED        = 0x8622;
460    const GLenum VERTEX_ATTRIB_ARRAY_SIZE           = 0x8623;
461    const GLenum VERTEX_ATTRIB_ARRAY_STRIDE         = 0x8624;
462    const GLenum VERTEX_ATTRIB_ARRAY_TYPE           = 0x8625;
463    const GLenum VERTEX_ATTRIB_ARRAY_NORMALIZED     = 0x886A;
464    const GLenum VERTEX_ATTRIB_ARRAY_POINTER        = 0x8645;
465    const GLenum VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F;
466
467    /* Read Format */
468    const GLenum IMPLEMENTATION_COLOR_READ_TYPE   = 0x8B9A;
469    const GLenum IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B;
470
471    /* Shader Source */
472    const GLenum COMPILE_STATUS                 = 0x8B81;
473
474    /* Shader Precision-Specified Types */
475    const GLenum LOW_FLOAT                      = 0x8DF0;
476    const GLenum MEDIUM_FLOAT                   = 0x8DF1;
477    const GLenum HIGH_FLOAT                     = 0x8DF2;
478    const GLenum LOW_INT                        = 0x8DF3;
479    const GLenum MEDIUM_INT                     = 0x8DF4;
480    const GLenum HIGH_INT                       = 0x8DF5;
481
482    /* Framebuffer Object. */
483    const GLenum FRAMEBUFFER                    = 0x8D40;
484    const GLenum RENDERBUFFER                   = 0x8D41;
485
486    const GLenum RGBA4                          = 0x8056;
487    const GLenum RGB5_A1                        = 0x8057;
488    const GLenum RGB565                         = 0x8D62;
489    const GLenum DEPTH_COMPONENT16              = 0x81A5;
490    const GLenum STENCIL_INDEX8                 = 0x8D48;
491    const GLenum DEPTH_STENCIL                  = 0x84F9;
492
493    const GLenum RENDERBUFFER_WIDTH             = 0x8D42;
494    const GLenum RENDERBUFFER_HEIGHT            = 0x8D43;
495    const GLenum RENDERBUFFER_INTERNAL_FORMAT   = 0x8D44;
496    const GLenum RENDERBUFFER_RED_SIZE          = 0x8D50;
497    const GLenum RENDERBUFFER_GREEN_SIZE        = 0x8D51;
498    const GLenum RENDERBUFFER_BLUE_SIZE         = 0x8D52;
499    const GLenum RENDERBUFFER_ALPHA_SIZE        = 0x8D53;
500    const GLenum RENDERBUFFER_DEPTH_SIZE        = 0x8D54;
501    const GLenum RENDERBUFFER_STENCIL_SIZE      = 0x8D55;
502
503    const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE           = 0x8CD0;
504    const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_NAME           = 0x8CD1;
505    const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL         = 0x8CD2;
506    const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3;
507
508    const GLenum COLOR_ATTACHMENT0              = 0x8CE0;
509    const GLenum DEPTH_ATTACHMENT               = 0x8D00;
510    const GLenum STENCIL_ATTACHMENT             = 0x8D20;
511    const GLenum DEPTH_STENCIL_ATTACHMENT       = 0x821A;
512
513    const GLenum NONE                           = 0;
514
515    const GLenum FRAMEBUFFER_COMPLETE                      = 0x8CD5;
516    const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT         = 0x8CD6;
517    const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7;
518    const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS         = 0x8CD9;
519    const GLenum FRAMEBUFFER_UNSUPPORTED                   = 0x8CDD;
520
521    const GLenum FRAMEBUFFER_BINDING            = 0x8CA6;
522    const GLenum RENDERBUFFER_BINDING           = 0x8CA7;
523    const GLenum MAX_RENDERBUFFER_SIZE          = 0x84E8;
524
525    const GLenum INVALID_FRAMEBUFFER_OPERATION  = 0x0506;
526
527    /* WebGL-specific enums */
528    const GLenum UNPACK_FLIP_Y_WEBGL            = 0x9240;
529    const GLenum UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241;
530    const GLenum CONTEXT_LOST_WEBGL             = 0x9242;
531    const GLenum UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243;
532    const GLenum BROWSER_DEFAULT_WEBGL          = 0x9244;
533
534    // The canvas might actually be null in some cases, apparently.
535    readonly attribute (HTMLCanvasElement or OffscreenCanvas)? canvas;
536    readonly attribute GLsizei drawingBufferWidth;
537    readonly attribute GLsizei drawingBufferHeight;
538
539    [WebGLHandlesContextLoss] WebGLContextAttributes? getContextAttributes();
540    [WebGLHandlesContextLoss] boolean isContextLost();
541
542    [NeedsCallerType]
543    sequence<DOMString>? getSupportedExtensions();
544
545    [Throws, NeedsCallerType]
546    object? getExtension(DOMString name);
547
548    undefined activeTexture(GLenum texture);
549    undefined attachShader(WebGLProgram program, WebGLShader shader);
550    undefined bindAttribLocation(WebGLProgram program, GLuint index, DOMString name);
551    undefined bindBuffer(GLenum target, WebGLBuffer? buffer);
552    undefined bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer);
553    undefined bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer);
554    undefined bindTexture(GLenum target, WebGLTexture? texture);
555    undefined blendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
556    undefined blendEquation(GLenum mode);
557    undefined blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
558    undefined blendFunc(GLenum sfactor, GLenum dfactor);
559    undefined blendFuncSeparate(GLenum srcRGB, GLenum dstRGB,
560                           GLenum srcAlpha, GLenum dstAlpha);
561
562    [WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target);
563    undefined clear(GLbitfield mask);
564    undefined clearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
565    undefined clearDepth(GLclampf depth);
566    undefined clearStencil(GLint s);
567    undefined colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
568    undefined compileShader(WebGLShader shader);
569
570    undefined copyTexImage2D(GLenum target, GLint level, GLenum internalformat,
571                        GLint x, GLint y, GLsizei width, GLsizei height,
572                        GLint border);
573    undefined copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
574                           GLint x, GLint y, GLsizei width, GLsizei height);
575
576    WebGLBuffer? createBuffer();
577    WebGLFramebuffer? createFramebuffer();
578    WebGLProgram? createProgram();
579    WebGLRenderbuffer? createRenderbuffer();
580    WebGLShader? createShader(GLenum type);
581    WebGLTexture? createTexture();
582
583    undefined cullFace(GLenum mode);
584
585    undefined deleteBuffer(WebGLBuffer? buffer);
586    undefined deleteFramebuffer(WebGLFramebuffer? framebuffer);
587    undefined deleteProgram(WebGLProgram? program);
588    undefined deleteRenderbuffer(WebGLRenderbuffer? renderbuffer);
589    undefined deleteShader(WebGLShader? shader);
590    undefined deleteTexture(WebGLTexture? texture);
591
592    undefined depthFunc(GLenum func);
593    undefined depthMask(GLboolean flag);
594    undefined depthRange(GLclampf zNear, GLclampf zFar);
595    undefined detachShader(WebGLProgram program, WebGLShader shader);
596    undefined disable(GLenum cap);
597    undefined disableVertexAttribArray(GLuint index);
598    undefined drawArrays(GLenum mode, GLint first, GLsizei count);
599    undefined drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset);
600
601    undefined enable(GLenum cap);
602    undefined enableVertexAttribArray(GLuint index);
603    undefined finish();
604    undefined flush();
605    undefined framebufferRenderbuffer(GLenum target, GLenum attachment,
606                                 GLenum renderbuffertarget,
607                                 WebGLRenderbuffer? renderbuffer);
608    undefined framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget,
609                              WebGLTexture? texture, GLint level);
610    undefined frontFace(GLenum mode);
611
612    undefined generateMipmap(GLenum target);
613
614    [NewObject]
615    WebGLActiveInfo? getActiveAttrib(WebGLProgram program, GLuint index);
616    [NewObject]
617    WebGLActiveInfo? getActiveUniform(WebGLProgram program, GLuint index);
618
619    sequence<WebGLShader>? getAttachedShaders(WebGLProgram program);
620
621    [WebGLHandlesContextLoss] GLint getAttribLocation(WebGLProgram program, DOMString name);
622
623    any getBufferParameter(GLenum target, GLenum pname);
624    [Throws]
625    any getParameter(GLenum pname);
626
627    [WebGLHandlesContextLoss] GLenum getError();
628
629    [Throws]
630    any getFramebufferAttachmentParameter(GLenum target, GLenum attachment,
631                                          GLenum pname);
632    any getProgramParameter(WebGLProgram program, GLenum pname);
633    DOMString? getProgramInfoLog(WebGLProgram program);
634    any getRenderbufferParameter(GLenum target, GLenum pname);
635    any getShaderParameter(WebGLShader shader, GLenum pname);
636
637    [NewObject]
638    WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype);
639
640    DOMString? getShaderInfoLog(WebGLShader shader);
641
642    DOMString? getShaderSource(WebGLShader shader);
643
644    any getTexParameter(GLenum target, GLenum pname);
645
646    any getUniform(WebGLProgram program, WebGLUniformLocation location);
647
648    [NewObject]
649    WebGLUniformLocation? getUniformLocation(WebGLProgram program, DOMString name);
650
651    [Throws]
652    any getVertexAttrib(GLuint index, GLenum pname);
653
654    [WebGLHandlesContextLoss] GLintptr getVertexAttribOffset(GLuint index, GLenum pname);
655
656    undefined hint(GLenum target, GLenum mode);
657    [WebGLHandlesContextLoss] GLboolean isBuffer(WebGLBuffer? buffer);
658    [WebGLHandlesContextLoss] GLboolean isEnabled(GLenum cap);
659    [WebGLHandlesContextLoss] GLboolean isFramebuffer(WebGLFramebuffer? framebuffer);
660    [WebGLHandlesContextLoss] GLboolean isProgram(WebGLProgram? program);
661    [WebGLHandlesContextLoss] GLboolean isRenderbuffer(WebGLRenderbuffer? renderbuffer);
662    [WebGLHandlesContextLoss] GLboolean isShader(WebGLShader? shader);
663    [WebGLHandlesContextLoss] GLboolean isTexture(WebGLTexture? texture);
664    undefined lineWidth(GLfloat width);
665    undefined linkProgram(WebGLProgram program);
666    undefined pixelStorei(GLenum pname, GLint param);
667    undefined polygonOffset(GLfloat factor, GLfloat units);
668
669    undefined renderbufferStorage(GLenum target, GLenum internalformat,
670                             GLsizei width, GLsizei height);
671    undefined sampleCoverage(GLclampf value, GLboolean invert);
672    undefined scissor(GLint x, GLint y, GLsizei width, GLsizei height);
673
674    undefined shaderSource(WebGLShader shader, DOMString source);
675
676    undefined stencilFunc(GLenum func, GLint ref, GLuint mask);
677    undefined stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
678    undefined stencilMask(GLuint mask);
679    undefined stencilMaskSeparate(GLenum face, GLuint mask);
680    undefined stencilOp(GLenum fail, GLenum zfail, GLenum zpass);
681    undefined stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
682
683    undefined texParameterf(GLenum target, GLenum pname, GLfloat param);
684    undefined texParameteri(GLenum target, GLenum pname, GLint param);
685
686    undefined uniform1f(WebGLUniformLocation? location, GLfloat x);
687    undefined uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y);
688    undefined uniform3f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z);
689    undefined uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
690
691    undefined uniform1i(WebGLUniformLocation? location, GLint x);
692    undefined uniform2i(WebGLUniformLocation? location, GLint x, GLint y);
693    undefined uniform3i(WebGLUniformLocation? location, GLint x, GLint y, GLint z);
694    undefined uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w);
695
696    undefined useProgram(WebGLProgram? program);
697    undefined validateProgram(WebGLProgram program);
698
699    undefined vertexAttrib1f(GLuint indx, GLfloat x);
700    undefined vertexAttrib1fv(GLuint indx, Float32List values);
701    undefined vertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
702    undefined vertexAttrib2fv(GLuint indx, Float32List values);
703    undefined vertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
704    undefined vertexAttrib3fv(GLuint indx, Float32List values);
705    undefined vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
706    undefined vertexAttrib4fv(GLuint indx, Float32List values);
707    undefined vertexAttribPointer(GLuint indx, GLint size, GLenum type,
708                             GLboolean normalized, GLsizei stride, GLintptr offset);
709
710    undefined viewport(GLint x, GLint y, GLsizei width, GLsizei height);
711};
712
713[Exposed=(Window,Worker),
714 Func="mozilla::dom::OffscreenCanvas::PrefEnabledOnWorkerThread"]
715interface WebGLRenderingContext {
716    // bufferData has WebGL2 overloads.
717    undefined bufferData(GLenum target, GLsizeiptr size, GLenum usage);
718    undefined bufferData(GLenum target, ArrayBuffer? data, GLenum usage);
719    undefined bufferData(GLenum target, ArrayBufferView data, GLenum usage);
720    // bufferSubData has WebGL2 overloads.
721    undefined bufferSubData(GLenum target, GLintptr offset, ArrayBuffer data);
722    undefined bufferSubData(GLenum target, GLintptr offset, ArrayBufferView data);
723
724    // compressedTexImage2D has WebGL2 overloads.
725    undefined compressedTexImage2D(GLenum target, GLint level, GLenum internalformat,
726                              GLsizei width, GLsizei height, GLint border,
727                              ArrayBufferView data);
728    // compressedTexSubImage2D has WebGL2 overloads.
729    undefined compressedTexSubImage2D(GLenum target, GLint level,
730                                 GLint xoffset, GLint yoffset,
731                                 GLsizei width, GLsizei height, GLenum format,
732                                 ArrayBufferView data);
733
734    // readPixels has WebGL2 overloads.
735    [Throws, NeedsCallerType]
736    undefined readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
737                    GLenum format, GLenum type, ArrayBufferView? pixels);
738
739    // texImage2D has WebGL2 overloads.
740    // Overloads must share [Throws].
741    [Throws] // Can't actually throw.
742    undefined texImage2D(GLenum target, GLint level, GLint internalformat,
743                    GLsizei width, GLsizei height, GLint border, GLenum format,
744                    GLenum type, ArrayBufferView? pixels);
745    [Throws] // Can't actually throw.
746    undefined texImage2D(GLenum target, GLint level, GLint internalformat,
747                    GLenum format, GLenum type, ImageBitmap pixels);
748    [Throws] // Can't actually throw.
749    undefined texImage2D(GLenum target, GLint level, GLint internalformat,
750                    GLenum format, GLenum type, ImageData pixels);
751    [Throws]
752    undefined texImage2D(GLenum target, GLint level, GLint internalformat,
753                    GLenum format, GLenum type, HTMLImageElement image); // May throw DOMException
754    [Throws]
755    undefined texImage2D(GLenum target, GLint level, GLint internalformat,
756                    GLenum format, GLenum type, HTMLCanvasElement canvas); // May throw DOMException
757    [Throws]
758    undefined texImage2D(GLenum target, GLint level, GLint internalformat,
759                    GLenum format, GLenum type, HTMLVideoElement video); // May throw DOMException
760
761    // texSubImage2D has WebGL2 overloads.
762    [Throws] // Can't actually throw.
763    undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
764                       GLsizei width, GLsizei height,
765                       GLenum format, GLenum type, ArrayBufferView? pixels);
766    [Throws] // Can't actually throw.
767    undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
768                       GLenum format, GLenum type, ImageBitmap pixels);
769    [Throws] // Can't actually throw.
770    undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
771                       GLenum format, GLenum type, ImageData pixels);
772    [Throws]
773    undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
774                       GLenum format, GLenum type, HTMLImageElement image); // May throw DOMException
775    [Throws]
776    undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
777                       GLenum format, GLenum type, HTMLCanvasElement canvas); // May throw DOMException
778    [Throws]
779    undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
780                       GLenum format, GLenum type, HTMLVideoElement video); // May throw DOMException
781
782    // uniform*fv have WebGL2 overloads, or rather extensions, that are not
783    // distinguishable from the WebGL1 versions when called with two arguments.
784    undefined uniform1fv(WebGLUniformLocation? location, Float32List data);
785    undefined uniform2fv(WebGLUniformLocation? location, Float32List data);
786    undefined uniform3fv(WebGLUniformLocation? location, Float32List data);
787    undefined uniform4fv(WebGLUniformLocation? location, Float32List data);
788
789    // uniform*iv have WebGL2 overloads, or rather extensions, that are not
790    // distinguishable from the WebGL1 versions when called with two arguments.
791    undefined uniform1iv(WebGLUniformLocation? location, Int32List data);
792    undefined uniform2iv(WebGLUniformLocation? location, Int32List data);
793    undefined uniform3iv(WebGLUniformLocation? location, Int32List data);
794    undefined uniform4iv(WebGLUniformLocation? location, Int32List data);
795
796    // uniformMatrix*fv have WebGL2 overloads, or rather extensions, that are
797    // not distinguishable from the WebGL1 versions when called with two
798    // arguments.
799    undefined uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data);
800    undefined uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data);
801    undefined uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data);
802};
803
804WebGLRenderingContext includes WebGLRenderingContextBase;
805
806// For OffscreenCanvas
807// Reference: https://wiki.whatwg.org/wiki/OffscreenCanvas
808[Exposed=(Window,Worker)]
809partial interface WebGLRenderingContext {
810    [Func="mozilla::dom::DOMPrefs::OffscreenCanvasEnabled"]
811    undefined commit();
812};
813
814////////////////////////////////////////
815// specific extension interfaces
816
817[NoInterfaceObject]
818interface WEBGL_compressed_texture_s3tc
819{
820    const GLenum COMPRESSED_RGB_S3TC_DXT1_EXT  = 0x83F0;
821    const GLenum COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1;
822    const GLenum COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2;
823    const GLenum COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;
824};
825
826[NoInterfaceObject]
827interface WEBGL_compressed_texture_s3tc_srgb {
828    /* Compressed Texture Formats */
829    const GLenum COMPRESSED_SRGB_S3TC_DXT1_EXT        = 0x8C4C;
830    const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT  = 0x8C4D;
831    const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT  = 0x8C4E;
832    const GLenum COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT  = 0x8C4F;
833};
834
835[NoInterfaceObject]
836interface WEBGL_compressed_texture_astc {
837    /* Compressed Texture Format */
838    const GLenum COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0;
839    const GLenum COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93B1;
840    const GLenum COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93B2;
841    const GLenum COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93B3;
842    const GLenum COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93B4;
843    const GLenum COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93B5;
844    const GLenum COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93B6;
845    const GLenum COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93B7;
846    const GLenum COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93B8;
847    const GLenum COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93B9;
848    const GLenum COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93BA;
849    const GLenum COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93BB;
850    const GLenum COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93BC;
851    const GLenum COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93BD;
852
853    const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93D0;
854    const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93D1;
855    const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93D2;
856    const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93D3;
857    const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93D4;
858    const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93D5;
859    const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93D6;
860    const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93D7;
861    const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93D8;
862    const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93D9;
863    const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93DA;
864    const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93DB;
865    const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93DC;
866    const GLenum COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93DD;
867
868    // Profile query support.
869    sequence<DOMString>? getSupportedProfiles();
870};
871
872[NoInterfaceObject]
873interface WEBGL_compressed_texture_atc
874{
875    const GLenum COMPRESSED_RGB_ATC_WEBGL                     = 0x8C92;
876    const GLenum COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL     = 0x8C93;
877    const GLenum COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 0x87EE;
878};
879
880[NoInterfaceObject]
881interface WEBGL_compressed_texture_etc
882{
883    const GLenum COMPRESSED_R11_EAC                                 = 0x9270;
884    const GLenum COMPRESSED_SIGNED_R11_EAC                          = 0x9271;
885    const GLenum COMPRESSED_RG11_EAC                                = 0x9272;
886    const GLenum COMPRESSED_SIGNED_RG11_EAC                         = 0x9273;
887    const GLenum COMPRESSED_RGB8_ETC2                               = 0x9274;
888    const GLenum COMPRESSED_SRGB8_ETC2                              = 0x9275;
889    const GLenum COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2           = 0x9276;
890    const GLenum COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2          = 0x9277;
891    const GLenum COMPRESSED_RGBA8_ETC2_EAC                          = 0x9278;
892    const GLenum COMPRESSED_SRGB8_ALPHA8_ETC2_EAC                   = 0x9279;
893};
894
895[NoInterfaceObject]
896interface WEBGL_compressed_texture_etc1
897{
898    const GLenum COMPRESSED_RGB_ETC1_WEBGL = 0x8D64;
899};
900
901[NoInterfaceObject]
902interface WEBGL_compressed_texture_pvrtc
903{
904    const GLenum COMPRESSED_RGB_PVRTC_4BPPV1_IMG  = 0x8C00;
905    const GLenum COMPRESSED_RGB_PVRTC_2BPPV1_IMG  = 0x8C01;
906    const GLenum COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02;
907    const GLenum COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 0x8C03;
908};
909
910[NoInterfaceObject]
911interface WEBGL_debug_renderer_info
912{
913    const GLenum UNMASKED_VENDOR_WEBGL        = 0x9245;
914    const GLenum UNMASKED_RENDERER_WEBGL      = 0x9246;
915};
916
917[NoInterfaceObject]
918interface WEBGL_debug_shaders
919{
920    DOMString getTranslatedShaderSource(WebGLShader shader);
921};
922
923[NoInterfaceObject]
924interface WEBGL_depth_texture
925{
926    const GLenum UNSIGNED_INT_24_8_WEBGL = 0x84FA;
927};
928
929[NoInterfaceObject]
930interface OES_element_index_uint
931{
932};
933
934[NoInterfaceObject]
935interface EXT_frag_depth
936{
937};
938
939[NoInterfaceObject]
940interface WEBGL_lose_context {
941    undefined loseContext();
942    undefined restoreContext();
943};
944
945[NoInterfaceObject]
946interface EXT_texture_filter_anisotropic
947{
948    const GLenum TEXTURE_MAX_ANISOTROPY_EXT     = 0x84FE;
949    const GLenum MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF;
950};
951
952[NoInterfaceObject]
953interface EXT_sRGB
954{
955    const GLenum SRGB_EXT                                  = 0x8C40;
956    const GLenum SRGB_ALPHA_EXT                            = 0x8C42;
957    const GLenum SRGB8_ALPHA8_EXT                          = 0x8C43;
958    const GLenum FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT = 0x8210;
959};
960
961[NoInterfaceObject]
962interface OES_standard_derivatives {
963    const GLenum FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8B8B;
964};
965
966[NoInterfaceObject]
967interface OES_texture_float
968{
969};
970
971[NoInterfaceObject]
972interface WEBGL_draw_buffers {
973    const GLenum COLOR_ATTACHMENT0_WEBGL     = 0x8CE0;
974    const GLenum COLOR_ATTACHMENT1_WEBGL     = 0x8CE1;
975    const GLenum COLOR_ATTACHMENT2_WEBGL     = 0x8CE2;
976    const GLenum COLOR_ATTACHMENT3_WEBGL     = 0x8CE3;
977    const GLenum COLOR_ATTACHMENT4_WEBGL     = 0x8CE4;
978    const GLenum COLOR_ATTACHMENT5_WEBGL     = 0x8CE5;
979    const GLenum COLOR_ATTACHMENT6_WEBGL     = 0x8CE6;
980    const GLenum COLOR_ATTACHMENT7_WEBGL     = 0x8CE7;
981    const GLenum COLOR_ATTACHMENT8_WEBGL     = 0x8CE8;
982    const GLenum COLOR_ATTACHMENT9_WEBGL     = 0x8CE9;
983    const GLenum COLOR_ATTACHMENT10_WEBGL    = 0x8CEA;
984    const GLenum COLOR_ATTACHMENT11_WEBGL    = 0x8CEB;
985    const GLenum COLOR_ATTACHMENT12_WEBGL    = 0x8CEC;
986    const GLenum COLOR_ATTACHMENT13_WEBGL    = 0x8CED;
987    const GLenum COLOR_ATTACHMENT14_WEBGL    = 0x8CEE;
988    const GLenum COLOR_ATTACHMENT15_WEBGL    = 0x8CEF;
989
990    const GLenum DRAW_BUFFER0_WEBGL          = 0x8825;
991    const GLenum DRAW_BUFFER1_WEBGL          = 0x8826;
992    const GLenum DRAW_BUFFER2_WEBGL          = 0x8827;
993    const GLenum DRAW_BUFFER3_WEBGL          = 0x8828;
994    const GLenum DRAW_BUFFER4_WEBGL          = 0x8829;
995    const GLenum DRAW_BUFFER5_WEBGL          = 0x882A;
996    const GLenum DRAW_BUFFER6_WEBGL          = 0x882B;
997    const GLenum DRAW_BUFFER7_WEBGL          = 0x882C;
998    const GLenum DRAW_BUFFER8_WEBGL          = 0x882D;
999    const GLenum DRAW_BUFFER9_WEBGL          = 0x882E;
1000    const GLenum DRAW_BUFFER10_WEBGL         = 0x882F;
1001    const GLenum DRAW_BUFFER11_WEBGL         = 0x8830;
1002    const GLenum DRAW_BUFFER12_WEBGL         = 0x8831;
1003    const GLenum DRAW_BUFFER13_WEBGL         = 0x8832;
1004    const GLenum DRAW_BUFFER14_WEBGL         = 0x8833;
1005    const GLenum DRAW_BUFFER15_WEBGL         = 0x8834;
1006
1007    const GLenum MAX_COLOR_ATTACHMENTS_WEBGL = 0x8CDF;
1008    const GLenum MAX_DRAW_BUFFERS_WEBGL      = 0x8824;
1009
1010    undefined drawBuffersWEBGL(sequence<GLenum> buffers);
1011};
1012
1013[NoInterfaceObject]
1014interface OES_texture_float_linear
1015{
1016};
1017
1018[NoInterfaceObject]
1019interface EXT_shader_texture_lod
1020{
1021};
1022
1023[NoInterfaceObject]
1024interface OES_texture_half_float
1025{
1026    const GLenum HALF_FLOAT_OES = 0x8D61;
1027};
1028
1029[NoInterfaceObject]
1030interface OES_texture_half_float_linear
1031{
1032};
1033
1034[NoInterfaceObject]
1035interface WEBGL_color_buffer_float
1036{
1037    const GLenum RGBA32F_EXT = 0x8814;
1038    const GLenum RGB32F_EXT = 0x8815;
1039    const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT = 0x8211;
1040    const GLenum UNSIGNED_NORMALIZED_EXT = 0x8C17;
1041};
1042
1043[NoInterfaceObject]
1044interface EXT_color_buffer_half_float
1045{
1046    const GLenum RGBA16F_EXT = 0x881A;
1047    const GLenum RGB16F_EXT = 0x881B;
1048    const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT = 0x8211;
1049    const GLenum UNSIGNED_NORMALIZED_EXT = 0x8C17;
1050};
1051
1052[NoInterfaceObject]
1053interface OES_vertex_array_object {
1054    const GLenum VERTEX_ARRAY_BINDING_OES = 0x85B5;
1055
1056    WebGLVertexArrayObject? createVertexArrayOES();
1057    undefined deleteVertexArrayOES(WebGLVertexArrayObject? arrayObject);
1058    [WebGLHandlesContextLoss] GLboolean isVertexArrayOES(WebGLVertexArrayObject? arrayObject);
1059    undefined bindVertexArrayOES(WebGLVertexArrayObject? arrayObject);
1060};
1061
1062[NoInterfaceObject]
1063interface ANGLE_instanced_arrays {
1064    const GLenum VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE = 0x88FE;
1065
1066    undefined drawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount);
1067    undefined drawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei primcount);
1068    undefined vertexAttribDivisorANGLE(GLuint index, GLuint divisor);
1069};
1070
1071[NoInterfaceObject]
1072interface EXT_blend_minmax {
1073    const GLenum MIN_EXT = 0x8007;
1074    const GLenum MAX_EXT = 0x8008;
1075};
1076
1077interface WebGLQuery {
1078};
1079
1080[NoInterfaceObject]
1081interface EXT_disjoint_timer_query {
1082    const GLenum QUERY_COUNTER_BITS_EXT = 0x8864;
1083    const GLenum CURRENT_QUERY_EXT = 0x8865;
1084    const GLenum QUERY_RESULT_EXT = 0x8866;
1085    const GLenum QUERY_RESULT_AVAILABLE_EXT = 0x8867;
1086    const GLenum TIME_ELAPSED_EXT = 0x88BF;
1087    const GLenum TIMESTAMP_EXT = 0x8E28;
1088    const GLenum GPU_DISJOINT_EXT = 0x8FBB;
1089
1090    WebGLQuery? createQueryEXT();
1091    undefined deleteQueryEXT(WebGLQuery? query);
1092    [WebGLHandlesContextLoss] boolean isQueryEXT(WebGLQuery? query);
1093    undefined beginQueryEXT(GLenum target, WebGLQuery query);
1094    undefined endQueryEXT(GLenum target);
1095    undefined queryCounterEXT(WebGLQuery query, GLenum target);
1096    any getQueryEXT(GLenum target, GLenum pname);
1097    any getQueryObjectEXT(WebGLQuery query, GLenum pname);
1098};
1099
1100[NoInterfaceObject]
1101interface MOZ_debug {
1102    const GLenum EXTENSIONS = 0x1F03;
1103    const GLenum WSI_INFO   = 0x10000;
1104    const GLenum UNPACK_REQUIRE_FASTPATH = 0x10001;
1105
1106    [Throws]
1107    any getParameter(GLenum pname);
1108};
1109