1// GENERATED CONTENT - DO NOT EDIT
2// Content was automatically extracted by Reffy into webref
3// (https://github.com/w3c/webref)
4// Source: WebGL Specification (https://www.khronos.org/registry/webgl/specs/latest/1.0/)
5
6typedef unsigned long  GLenum;
7typedef boolean        GLboolean;
8typedef unsigned long  GLbitfield;
9typedef byte           GLbyte;         /* 'byte' should be a signed 8 bit type. */
10typedef short          GLshort;
11typedef long           GLint;
12typedef long           GLsizei;
13typedef long long      GLintptr;
14typedef long long      GLsizeiptr;
15// Ideally the typedef below would use 'unsigned byte', but that doesn't currently exist in Web IDL.
16typedef octet          GLubyte;        /* 'octet' should be an unsigned 8 bit type. */
17typedef unsigned short GLushort;
18typedef unsigned long  GLuint;
19typedef unrestricted float GLfloat;
20typedef unrestricted float GLclampf;
21
22// The power preference settings are documented in the WebGLContextAttributes
23// section of the specification.
24enum WebGLPowerPreference { "default", "low-power", "high-performance" };
25
26dictionary WebGLContextAttributes {
27    boolean alpha = true;
28    boolean depth = true;
29    boolean stencil = false;
30    boolean antialias = true;
31    boolean premultipliedAlpha = true;
32    boolean preserveDrawingBuffer = false;
33    WebGLPowerPreference powerPreference = "default";
34    boolean failIfMajorPerformanceCaveat = false;
35    boolean desynchronized = false;
36};
37
38[Exposed=(Window,Worker)]
39interface WebGLObject {
40};
41
42[Exposed=(Window,Worker)]
43interface WebGLBuffer : WebGLObject {
44};
45
46[Exposed=(Window,Worker)]
47interface WebGLFramebuffer : WebGLObject {
48};
49
50[Exposed=(Window,Worker)]
51interface WebGLProgram : WebGLObject {
52};
53
54[Exposed=(Window,Worker)]
55interface WebGLRenderbuffer : WebGLObject {
56};
57
58[Exposed=(Window,Worker)]
59interface WebGLShader : WebGLObject {
60};
61
62[Exposed=(Window,Worker)]
63interface WebGLTexture : WebGLObject {
64};
65
66[Exposed=(Window,Worker)]
67interface WebGLUniformLocation {
68};
69
70[Exposed=(Window,Worker)]
71interface WebGLActiveInfo {
72    readonly attribute GLint size;
73    readonly attribute GLenum type;
74    readonly attribute DOMString name;
75};
76
77[Exposed=(Window,Worker)]
78interface WebGLShaderPrecisionFormat {
79    readonly attribute GLint rangeMin;
80    readonly attribute GLint rangeMax;
81    readonly attribute GLint precision;
82};
83
84typedef (ImageBitmap or
85         ImageData or
86         HTMLImageElement or
87         HTMLCanvasElement or
88         HTMLVideoElement or
89         OffscreenCanvas or
90         VideoFrame) TexImageSource;
91
92typedef ([AllowShared] Float32Array or sequence<GLfloat>) Float32List;
93typedef ([AllowShared] Int32Array or sequence<GLint>) Int32List;
94
95interface mixin WebGLRenderingContextBase
96{
97
98    /* ClearBufferMask */
99    const GLenum DEPTH_BUFFER_BIT               = 0x00000100;
100    const GLenum STENCIL_BUFFER_BIT             = 0x00000400;
101    const GLenum COLOR_BUFFER_BIT               = 0x00004000;
102
103    /* BeginMode */
104    const GLenum POINTS                         = 0x0000;
105    const GLenum LINES                          = 0x0001;
106    const GLenum LINE_LOOP                      = 0x0002;
107    const GLenum LINE_STRIP                     = 0x0003;
108    const GLenum TRIANGLES                      = 0x0004;
109    const GLenum TRIANGLE_STRIP                 = 0x0005;
110    const GLenum TRIANGLE_FAN                   = 0x0006;
111
112    /* AlphaFunction (not supported in ES20) */
113    /*      NEVER */
114    /*      LESS */
115    /*      EQUAL */
116    /*      LEQUAL */
117    /*      GREATER */
118    /*      NOTEQUAL */
119    /*      GEQUAL */
120    /*      ALWAYS */
121
122    /* BlendingFactorDest */
123    const GLenum ZERO                           = 0;
124    const GLenum ONE                            = 1;
125    const GLenum SRC_COLOR                      = 0x0300;
126    const GLenum ONE_MINUS_SRC_COLOR            = 0x0301;
127    const GLenum SRC_ALPHA                      = 0x0302;
128    const GLenum ONE_MINUS_SRC_ALPHA            = 0x0303;
129    const GLenum DST_ALPHA                      = 0x0304;
130    const GLenum ONE_MINUS_DST_ALPHA            = 0x0305;
131
132    /* BlendingFactorSrc */
133    /*      ZERO */
134    /*      ONE */
135    const GLenum DST_COLOR                      = 0x0306;
136    const GLenum ONE_MINUS_DST_COLOR            = 0x0307;
137    const GLenum SRC_ALPHA_SATURATE             = 0x0308;
138    /*      SRC_ALPHA */
139    /*      ONE_MINUS_SRC_ALPHA */
140    /*      DST_ALPHA */
141    /*      ONE_MINUS_DST_ALPHA */
142
143    /* BlendEquationSeparate */
144    const GLenum FUNC_ADD                       = 0x8006;
145    const GLenum BLEND_EQUATION                 = 0x8009;
146    const GLenum BLEND_EQUATION_RGB             = 0x8009;   /* same as BLEND_EQUATION */
147    const GLenum BLEND_EQUATION_ALPHA           = 0x883D;
148
149    /* BlendSubtract */
150    const GLenum FUNC_SUBTRACT                  = 0x800A;
151    const GLenum FUNC_REVERSE_SUBTRACT          = 0x800B;
152
153    /* Separate Blend Functions */
154    const GLenum BLEND_DST_RGB                  = 0x80C8;
155    const GLenum BLEND_SRC_RGB                  = 0x80C9;
156    const GLenum BLEND_DST_ALPHA                = 0x80CA;
157    const GLenum BLEND_SRC_ALPHA                = 0x80CB;
158    const GLenum CONSTANT_COLOR                 = 0x8001;
159    const GLenum ONE_MINUS_CONSTANT_COLOR       = 0x8002;
160    const GLenum CONSTANT_ALPHA                 = 0x8003;
161    const GLenum ONE_MINUS_CONSTANT_ALPHA       = 0x8004;
162    const GLenum BLEND_COLOR                    = 0x8005;
163
164    /* Buffer Objects */
165    const GLenum ARRAY_BUFFER                   = 0x8892;
166    const GLenum ELEMENT_ARRAY_BUFFER           = 0x8893;
167    const GLenum ARRAY_BUFFER_BINDING           = 0x8894;
168    const GLenum ELEMENT_ARRAY_BUFFER_BINDING   = 0x8895;
169
170    const GLenum STREAM_DRAW                    = 0x88E0;
171    const GLenum STATIC_DRAW                    = 0x88E4;
172    const GLenum DYNAMIC_DRAW                   = 0x88E8;
173
174    const GLenum BUFFER_SIZE                    = 0x8764;
175    const GLenum BUFFER_USAGE                   = 0x8765;
176
177    const GLenum CURRENT_VERTEX_ATTRIB          = 0x8626;
178
179    /* CullFaceMode */
180    const GLenum FRONT                          = 0x0404;
181    const GLenum BACK                           = 0x0405;
182    const GLenum FRONT_AND_BACK                 = 0x0408;
183
184    /* DepthFunction */
185    /*      NEVER */
186    /*      LESS */
187    /*      EQUAL */
188    /*      LEQUAL */
189    /*      GREATER */
190    /*      NOTEQUAL */
191    /*      GEQUAL */
192    /*      ALWAYS */
193
194    /* EnableCap */
195    /* TEXTURE_2D */
196    const GLenum CULL_FACE                      = 0x0B44;
197    const GLenum BLEND                          = 0x0BE2;
198    const GLenum DITHER                         = 0x0BD0;
199    const GLenum STENCIL_TEST                   = 0x0B90;
200    const GLenum DEPTH_TEST                     = 0x0B71;
201    const GLenum SCISSOR_TEST                   = 0x0C11;
202    const GLenum POLYGON_OFFSET_FILL            = 0x8037;
203    const GLenum SAMPLE_ALPHA_TO_COVERAGE       = 0x809E;
204    const GLenum SAMPLE_COVERAGE                = 0x80A0;
205
206    /* ErrorCode */
207    const GLenum NO_ERROR                       = 0;
208    const GLenum INVALID_ENUM                   = 0x0500;
209    const GLenum INVALID_VALUE                  = 0x0501;
210    const GLenum INVALID_OPERATION              = 0x0502;
211    const GLenum OUT_OF_MEMORY                  = 0x0505;
212
213    /* FrontFaceDirection */
214    const GLenum CW                             = 0x0900;
215    const GLenum CCW                            = 0x0901;
216
217    /* GetPName */
218    const GLenum LINE_WIDTH                     = 0x0B21;
219    const GLenum ALIASED_POINT_SIZE_RANGE       = 0x846D;
220    const GLenum ALIASED_LINE_WIDTH_RANGE       = 0x846E;
221    const GLenum CULL_FACE_MODE                 = 0x0B45;
222    const GLenum FRONT_FACE                     = 0x0B46;
223    const GLenum DEPTH_RANGE                    = 0x0B70;
224    const GLenum DEPTH_WRITEMASK                = 0x0B72;
225    const GLenum DEPTH_CLEAR_VALUE              = 0x0B73;
226    const GLenum DEPTH_FUNC                     = 0x0B74;
227    const GLenum STENCIL_CLEAR_VALUE            = 0x0B91;
228    const GLenum STENCIL_FUNC                   = 0x0B92;
229    const GLenum STENCIL_FAIL                   = 0x0B94;
230    const GLenum STENCIL_PASS_DEPTH_FAIL        = 0x0B95;
231    const GLenum STENCIL_PASS_DEPTH_PASS        = 0x0B96;
232    const GLenum STENCIL_REF                    = 0x0B97;
233    const GLenum STENCIL_VALUE_MASK             = 0x0B93;
234    const GLenum STENCIL_WRITEMASK              = 0x0B98;
235    const GLenum STENCIL_BACK_FUNC              = 0x8800;
236    const GLenum STENCIL_BACK_FAIL              = 0x8801;
237    const GLenum STENCIL_BACK_PASS_DEPTH_FAIL   = 0x8802;
238    const GLenum STENCIL_BACK_PASS_DEPTH_PASS   = 0x8803;
239    const GLenum STENCIL_BACK_REF               = 0x8CA3;
240    const GLenum STENCIL_BACK_VALUE_MASK        = 0x8CA4;
241    const GLenum STENCIL_BACK_WRITEMASK         = 0x8CA5;
242    const GLenum VIEWPORT                       = 0x0BA2;
243    const GLenum SCISSOR_BOX                    = 0x0C10;
244    /*      SCISSOR_TEST */
245    const GLenum COLOR_CLEAR_VALUE              = 0x0C22;
246    const GLenum COLOR_WRITEMASK                = 0x0C23;
247    const GLenum UNPACK_ALIGNMENT               = 0x0CF5;
248    const GLenum PACK_ALIGNMENT                 = 0x0D05;
249    const GLenum MAX_TEXTURE_SIZE               = 0x0D33;
250    const GLenum MAX_VIEWPORT_DIMS              = 0x0D3A;
251    const GLenum SUBPIXEL_BITS                  = 0x0D50;
252    const GLenum RED_BITS                       = 0x0D52;
253    const GLenum GREEN_BITS                     = 0x0D53;
254    const GLenum BLUE_BITS                      = 0x0D54;
255    const GLenum ALPHA_BITS                     = 0x0D55;
256    const GLenum DEPTH_BITS                     = 0x0D56;
257    const GLenum STENCIL_BITS                   = 0x0D57;
258    const GLenum POLYGON_OFFSET_UNITS           = 0x2A00;
259    /*      POLYGON_OFFSET_FILL */
260    const GLenum POLYGON_OFFSET_FACTOR          = 0x8038;
261    const GLenum TEXTURE_BINDING_2D             = 0x8069;
262    const GLenum SAMPLE_BUFFERS                 = 0x80A8;
263    const GLenum SAMPLES                        = 0x80A9;
264    const GLenum SAMPLE_COVERAGE_VALUE          = 0x80AA;
265    const GLenum SAMPLE_COVERAGE_INVERT         = 0x80AB;
266
267    /* GetTextureParameter */
268    /*      TEXTURE_MAG_FILTER */
269    /*      TEXTURE_MIN_FILTER */
270    /*      TEXTURE_WRAP_S */
271    /*      TEXTURE_WRAP_T */
272
273    const GLenum COMPRESSED_TEXTURE_FORMATS     = 0x86A3;
274
275    /* HintMode */
276    const GLenum DONT_CARE                      = 0x1100;
277    const GLenum FASTEST                        = 0x1101;
278    const GLenum NICEST                         = 0x1102;
279
280    /* HintTarget */
281    const GLenum GENERATE_MIPMAP_HINT            = 0x8192;
282
283    /* DataType */
284    const GLenum BYTE                           = 0x1400;
285    const GLenum UNSIGNED_BYTE                  = 0x1401;
286    const GLenum SHORT                          = 0x1402;
287    const GLenum UNSIGNED_SHORT                 = 0x1403;
288    const GLenum INT                            = 0x1404;
289    const GLenum UNSIGNED_INT                   = 0x1405;
290    const GLenum FLOAT                          = 0x1406;
291
292    /* PixelFormat */
293    const GLenum DEPTH_COMPONENT                = 0x1902;
294    const GLenum ALPHA                          = 0x1906;
295    const GLenum RGB                            = 0x1907;
296    const GLenum RGBA                           = 0x1908;
297    const GLenum LUMINANCE                      = 0x1909;
298    const GLenum LUMINANCE_ALPHA                = 0x190A;
299
300    /* PixelType */
301    /*      UNSIGNED_BYTE */
302    const GLenum UNSIGNED_SHORT_4_4_4_4         = 0x8033;
303    const GLenum UNSIGNED_SHORT_5_5_5_1         = 0x8034;
304    const GLenum UNSIGNED_SHORT_5_6_5           = 0x8363;
305
306    /* Shaders */
307    const GLenum FRAGMENT_SHADER                  = 0x8B30;
308    const GLenum VERTEX_SHADER                    = 0x8B31;
309    const GLenum MAX_VERTEX_ATTRIBS               = 0x8869;
310    const GLenum MAX_VERTEX_UNIFORM_VECTORS       = 0x8DFB;
311    const GLenum MAX_VARYING_VECTORS              = 0x8DFC;
312    const GLenum MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D;
313    const GLenum MAX_VERTEX_TEXTURE_IMAGE_UNITS   = 0x8B4C;
314    const GLenum MAX_TEXTURE_IMAGE_UNITS          = 0x8872;
315    const GLenum MAX_FRAGMENT_UNIFORM_VECTORS     = 0x8DFD;
316    const GLenum SHADER_TYPE                      = 0x8B4F;
317    const GLenum DELETE_STATUS                    = 0x8B80;
318    const GLenum LINK_STATUS                      = 0x8B82;
319    const GLenum VALIDATE_STATUS                  = 0x8B83;
320    const GLenum ATTACHED_SHADERS                 = 0x8B85;
321    const GLenum ACTIVE_UNIFORMS                  = 0x8B86;
322    const GLenum ACTIVE_ATTRIBUTES                = 0x8B89;
323    const GLenum SHADING_LANGUAGE_VERSION         = 0x8B8C;
324    const GLenum CURRENT_PROGRAM                  = 0x8B8D;
325
326    /* StencilFunction */
327    const GLenum NEVER                          = 0x0200;
328    const GLenum LESS                           = 0x0201;
329    const GLenum EQUAL                          = 0x0202;
330    const GLenum LEQUAL                         = 0x0203;
331    const GLenum GREATER                        = 0x0204;
332    const GLenum NOTEQUAL                       = 0x0205;
333    const GLenum GEQUAL                         = 0x0206;
334    const GLenum ALWAYS                         = 0x0207;
335
336    /* StencilOp */
337    /*      ZERO */
338    const GLenum KEEP                           = 0x1E00;
339    const GLenum REPLACE                        = 0x1E01;
340    const GLenum INCR                           = 0x1E02;
341    const GLenum DECR                           = 0x1E03;
342    const GLenum INVERT                         = 0x150A;
343    const GLenum INCR_WRAP                      = 0x8507;
344    const GLenum DECR_WRAP                      = 0x8508;
345
346    /* StringName */
347    const GLenum VENDOR                         = 0x1F00;
348    const GLenum RENDERER                       = 0x1F01;
349    const GLenum VERSION                        = 0x1F02;
350
351    /* TextureMagFilter */
352    const GLenum NEAREST                        = 0x2600;
353    const GLenum LINEAR                         = 0x2601;
354
355    /* TextureMinFilter */
356    /*      NEAREST */
357    /*      LINEAR */
358    const GLenum NEAREST_MIPMAP_NEAREST         = 0x2700;
359    const GLenum LINEAR_MIPMAP_NEAREST          = 0x2701;
360    const GLenum NEAREST_MIPMAP_LINEAR          = 0x2702;
361    const GLenum LINEAR_MIPMAP_LINEAR           = 0x2703;
362
363    /* TextureParameterName */
364    const GLenum TEXTURE_MAG_FILTER             = 0x2800;
365    const GLenum TEXTURE_MIN_FILTER             = 0x2801;
366    const GLenum TEXTURE_WRAP_S                 = 0x2802;
367    const GLenum TEXTURE_WRAP_T                 = 0x2803;
368
369    /* TextureTarget */
370    const GLenum TEXTURE_2D                     = 0x0DE1;
371    const GLenum TEXTURE                        = 0x1702;
372
373    const GLenum TEXTURE_CUBE_MAP               = 0x8513;
374    const GLenum TEXTURE_BINDING_CUBE_MAP       = 0x8514;
375    const GLenum TEXTURE_CUBE_MAP_POSITIVE_X    = 0x8515;
376    const GLenum TEXTURE_CUBE_MAP_NEGATIVE_X    = 0x8516;
377    const GLenum TEXTURE_CUBE_MAP_POSITIVE_Y    = 0x8517;
378    const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Y    = 0x8518;
379    const GLenum TEXTURE_CUBE_MAP_POSITIVE_Z    = 0x8519;
380    const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Z    = 0x851A;
381    const GLenum MAX_CUBE_MAP_TEXTURE_SIZE      = 0x851C;
382
383    /* TextureUnit */
384    const GLenum TEXTURE0                       = 0x84C0;
385    const GLenum TEXTURE1                       = 0x84C1;
386    const GLenum TEXTURE2                       = 0x84C2;
387    const GLenum TEXTURE3                       = 0x84C3;
388    const GLenum TEXTURE4                       = 0x84C4;
389    const GLenum TEXTURE5                       = 0x84C5;
390    const GLenum TEXTURE6                       = 0x84C6;
391    const GLenum TEXTURE7                       = 0x84C7;
392    const GLenum TEXTURE8                       = 0x84C8;
393    const GLenum TEXTURE9                       = 0x84C9;
394    const GLenum TEXTURE10                      = 0x84CA;
395    const GLenum TEXTURE11                      = 0x84CB;
396    const GLenum TEXTURE12                      = 0x84CC;
397    const GLenum TEXTURE13                      = 0x84CD;
398    const GLenum TEXTURE14                      = 0x84CE;
399    const GLenum TEXTURE15                      = 0x84CF;
400    const GLenum TEXTURE16                      = 0x84D0;
401    const GLenum TEXTURE17                      = 0x84D1;
402    const GLenum TEXTURE18                      = 0x84D2;
403    const GLenum TEXTURE19                      = 0x84D3;
404    const GLenum TEXTURE20                      = 0x84D4;
405    const GLenum TEXTURE21                      = 0x84D5;
406    const GLenum TEXTURE22                      = 0x84D6;
407    const GLenum TEXTURE23                      = 0x84D7;
408    const GLenum TEXTURE24                      = 0x84D8;
409    const GLenum TEXTURE25                      = 0x84D9;
410    const GLenum TEXTURE26                      = 0x84DA;
411    const GLenum TEXTURE27                      = 0x84DB;
412    const GLenum TEXTURE28                      = 0x84DC;
413    const GLenum TEXTURE29                      = 0x84DD;
414    const GLenum TEXTURE30                      = 0x84DE;
415    const GLenum TEXTURE31                      = 0x84DF;
416    const GLenum ACTIVE_TEXTURE                 = 0x84E0;
417
418    /* TextureWrapMode */
419    const GLenum REPEAT                         = 0x2901;
420    const GLenum CLAMP_TO_EDGE                  = 0x812F;
421    const GLenum MIRRORED_REPEAT                = 0x8370;
422
423    /* Uniform Types */
424    const GLenum FLOAT_VEC2                     = 0x8B50;
425    const GLenum FLOAT_VEC3                     = 0x8B51;
426    const GLenum FLOAT_VEC4                     = 0x8B52;
427    const GLenum INT_VEC2                       = 0x8B53;
428    const GLenum INT_VEC3                       = 0x8B54;
429    const GLenum INT_VEC4                       = 0x8B55;
430    const GLenum BOOL                           = 0x8B56;
431    const GLenum BOOL_VEC2                      = 0x8B57;
432    const GLenum BOOL_VEC3                      = 0x8B58;
433    const GLenum BOOL_VEC4                      = 0x8B59;
434    const GLenum FLOAT_MAT2                     = 0x8B5A;
435    const GLenum FLOAT_MAT3                     = 0x8B5B;
436    const GLenum FLOAT_MAT4                     = 0x8B5C;
437    const GLenum SAMPLER_2D                     = 0x8B5E;
438    const GLenum SAMPLER_CUBE                   = 0x8B60;
439
440    /* Vertex Arrays */
441    const GLenum VERTEX_ATTRIB_ARRAY_ENABLED        = 0x8622;
442    const GLenum VERTEX_ATTRIB_ARRAY_SIZE           = 0x8623;
443    const GLenum VERTEX_ATTRIB_ARRAY_STRIDE         = 0x8624;
444    const GLenum VERTEX_ATTRIB_ARRAY_TYPE           = 0x8625;
445    const GLenum VERTEX_ATTRIB_ARRAY_NORMALIZED     = 0x886A;
446    const GLenum VERTEX_ATTRIB_ARRAY_POINTER        = 0x8645;
447    const GLenum VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F;
448
449    /* Read Format */
450    const GLenum IMPLEMENTATION_COLOR_READ_TYPE   = 0x8B9A;
451    const GLenum IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B;
452
453    /* Shader Source */
454    const GLenum COMPILE_STATUS                 = 0x8B81;
455
456    /* Shader Precision-Specified Types */
457    const GLenum LOW_FLOAT                      = 0x8DF0;
458    const GLenum MEDIUM_FLOAT                   = 0x8DF1;
459    const GLenum HIGH_FLOAT                     = 0x8DF2;
460    const GLenum LOW_INT                        = 0x8DF3;
461    const GLenum MEDIUM_INT                     = 0x8DF4;
462    const GLenum HIGH_INT                       = 0x8DF5;
463
464    /* Framebuffer Object. */
465    const GLenum FRAMEBUFFER                    = 0x8D40;
466    const GLenum RENDERBUFFER                   = 0x8D41;
467
468    const GLenum RGBA4                          = 0x8056;
469    const GLenum RGB5_A1                        = 0x8057;
470    const GLenum RGB565                         = 0x8D62;
471    const GLenum DEPTH_COMPONENT16              = 0x81A5;
472    const GLenum STENCIL_INDEX8                 = 0x8D48;
473    const GLenum DEPTH_STENCIL                  = 0x84F9;
474
475    const GLenum RENDERBUFFER_WIDTH             = 0x8D42;
476    const GLenum RENDERBUFFER_HEIGHT            = 0x8D43;
477    const GLenum RENDERBUFFER_INTERNAL_FORMAT   = 0x8D44;
478    const GLenum RENDERBUFFER_RED_SIZE          = 0x8D50;
479    const GLenum RENDERBUFFER_GREEN_SIZE        = 0x8D51;
480    const GLenum RENDERBUFFER_BLUE_SIZE         = 0x8D52;
481    const GLenum RENDERBUFFER_ALPHA_SIZE        = 0x8D53;
482    const GLenum RENDERBUFFER_DEPTH_SIZE        = 0x8D54;
483    const GLenum RENDERBUFFER_STENCIL_SIZE      = 0x8D55;
484
485    const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE           = 0x8CD0;
486    const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_NAME           = 0x8CD1;
487    const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL         = 0x8CD2;
488    const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3;
489
490    const GLenum COLOR_ATTACHMENT0              = 0x8CE0;
491    const GLenum DEPTH_ATTACHMENT               = 0x8D00;
492    const GLenum STENCIL_ATTACHMENT             = 0x8D20;
493    const GLenum DEPTH_STENCIL_ATTACHMENT       = 0x821A;
494
495    const GLenum NONE                           = 0;
496
497    const GLenum FRAMEBUFFER_COMPLETE                      = 0x8CD5;
498    const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT         = 0x8CD6;
499    const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7;
500    const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS         = 0x8CD9;
501    const GLenum FRAMEBUFFER_UNSUPPORTED                   = 0x8CDD;
502
503    const GLenum FRAMEBUFFER_BINDING            = 0x8CA6;
504    const GLenum RENDERBUFFER_BINDING           = 0x8CA7;
505    const GLenum MAX_RENDERBUFFER_SIZE          = 0x84E8;
506
507    const GLenum INVALID_FRAMEBUFFER_OPERATION  = 0x0506;
508
509    /* WebGL-specific enums */
510    const GLenum UNPACK_FLIP_Y_WEBGL            = 0x9240;
511    const GLenum UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241;
512    const GLenum CONTEXT_LOST_WEBGL             = 0x9242;
513    const GLenum UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243;
514    const GLenum BROWSER_DEFAULT_WEBGL          = 0x9244;
515
516    readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;
517    readonly attribute GLsizei drawingBufferWidth;
518    readonly attribute GLsizei drawingBufferHeight;
519
520    [WebGLHandlesContextLoss] WebGLContextAttributes? getContextAttributes();
521    [WebGLHandlesContextLoss] boolean isContextLost();
522
523    sequence<DOMString>? getSupportedExtensions();
524    object? getExtension(DOMString name);
525
526    undefined activeTexture(GLenum texture);
527    undefined attachShader(WebGLProgram program, WebGLShader shader);
528    undefined bindAttribLocation(WebGLProgram program, GLuint index, DOMString name);
529    undefined bindBuffer(GLenum target, WebGLBuffer? buffer);
530    undefined bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer);
531    undefined bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer);
532    undefined bindTexture(GLenum target, WebGLTexture? texture);
533    undefined blendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
534    undefined blendEquation(GLenum mode);
535    undefined blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
536    undefined blendFunc(GLenum sfactor, GLenum dfactor);
537    undefined blendFuncSeparate(GLenum srcRGB, GLenum dstRGB,
538                                GLenum srcAlpha, GLenum dstAlpha);
539
540    [WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target);
541    undefined clear(GLbitfield mask);
542    undefined clearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
543    undefined clearDepth(GLclampf depth);
544    undefined clearStencil(GLint s);
545    undefined colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
546    undefined compileShader(WebGLShader shader);
547
548    undefined copyTexImage2D(GLenum target, GLint level, GLenum internalformat,
549                             GLint x, GLint y, GLsizei width, GLsizei height,
550                             GLint border);
551    undefined copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
552                                GLint x, GLint y, GLsizei width, GLsizei height);
553
554    WebGLBuffer? createBuffer();
555    WebGLFramebuffer? createFramebuffer();
556    WebGLProgram? createProgram();
557    WebGLRenderbuffer? createRenderbuffer();
558    WebGLShader? createShader(GLenum type);
559    WebGLTexture? createTexture();
560
561    undefined cullFace(GLenum mode);
562
563    undefined deleteBuffer(WebGLBuffer? buffer);
564    undefined deleteFramebuffer(WebGLFramebuffer? framebuffer);
565    undefined deleteProgram(WebGLProgram? program);
566    undefined deleteRenderbuffer(WebGLRenderbuffer? renderbuffer);
567    undefined deleteShader(WebGLShader? shader);
568    undefined deleteTexture(WebGLTexture? texture);
569
570    undefined depthFunc(GLenum func);
571    undefined depthMask(GLboolean flag);
572    undefined depthRange(GLclampf zNear, GLclampf zFar);
573    undefined detachShader(WebGLProgram program, WebGLShader shader);
574    undefined disable(GLenum cap);
575    undefined disableVertexAttribArray(GLuint index);
576    undefined drawArrays(GLenum mode, GLint first, GLsizei count);
577    undefined drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset);
578
579    undefined enable(GLenum cap);
580    undefined enableVertexAttribArray(GLuint index);
581    undefined finish();
582    undefined flush();
583    undefined framebufferRenderbuffer(GLenum target, GLenum attachment,
584                                      GLenum renderbuffertarget,
585                                      WebGLRenderbuffer? renderbuffer);
586    undefined framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget,
587                                   WebGLTexture? texture, GLint level);
588    undefined frontFace(GLenum mode);
589
590    undefined generateMipmap(GLenum target);
591
592    WebGLActiveInfo? getActiveAttrib(WebGLProgram program, GLuint index);
593    WebGLActiveInfo? getActiveUniform(WebGLProgram program, GLuint index);
594    sequence<WebGLShader>? getAttachedShaders(WebGLProgram program);
595
596    [WebGLHandlesContextLoss] GLint getAttribLocation(WebGLProgram program, DOMString name);
597
598    any getBufferParameter(GLenum target, GLenum pname);
599    any getParameter(GLenum pname);
600
601    [WebGLHandlesContextLoss] GLenum getError();
602
603    any getFramebufferAttachmentParameter(GLenum target, GLenum attachment,
604                                          GLenum pname);
605    any getProgramParameter(WebGLProgram program, GLenum pname);
606    DOMString? getProgramInfoLog(WebGLProgram program);
607    any getRenderbufferParameter(GLenum target, GLenum pname);
608    any getShaderParameter(WebGLShader shader, GLenum pname);
609    WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype);
610    DOMString? getShaderInfoLog(WebGLShader shader);
611
612    DOMString? getShaderSource(WebGLShader shader);
613
614    any getTexParameter(GLenum target, GLenum pname);
615
616    any getUniform(WebGLProgram program, WebGLUniformLocation location);
617
618    WebGLUniformLocation? getUniformLocation(WebGLProgram program, DOMString name);
619
620    any getVertexAttrib(GLuint index, GLenum pname);
621
622    [WebGLHandlesContextLoss] GLintptr getVertexAttribOffset(GLuint index, GLenum pname);
623
624    undefined hint(GLenum target, GLenum mode);
625    [WebGLHandlesContextLoss] GLboolean isBuffer(WebGLBuffer? buffer);
626    [WebGLHandlesContextLoss] GLboolean isEnabled(GLenum cap);
627    [WebGLHandlesContextLoss] GLboolean isFramebuffer(WebGLFramebuffer? framebuffer);
628    [WebGLHandlesContextLoss] GLboolean isProgram(WebGLProgram? program);
629    [WebGLHandlesContextLoss] GLboolean isRenderbuffer(WebGLRenderbuffer? renderbuffer);
630    [WebGLHandlesContextLoss] GLboolean isShader(WebGLShader? shader);
631    [WebGLHandlesContextLoss] GLboolean isTexture(WebGLTexture? texture);
632    undefined lineWidth(GLfloat width);
633    undefined linkProgram(WebGLProgram program);
634    undefined pixelStorei(GLenum pname, GLint param);
635    undefined polygonOffset(GLfloat factor, GLfloat units);
636
637    undefined renderbufferStorage(GLenum target, GLenum internalformat,
638                                  GLsizei width, GLsizei height);
639    undefined sampleCoverage(GLclampf value, GLboolean invert);
640    undefined scissor(GLint x, GLint y, GLsizei width, GLsizei height);
641
642    undefined shaderSource(WebGLShader shader, DOMString source);
643
644    undefined stencilFunc(GLenum func, GLint ref, GLuint mask);
645    undefined stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
646    undefined stencilMask(GLuint mask);
647    undefined stencilMaskSeparate(GLenum face, GLuint mask);
648    undefined stencilOp(GLenum fail, GLenum zfail, GLenum zpass);
649    undefined stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
650
651    undefined texParameterf(GLenum target, GLenum pname, GLfloat param);
652    undefined texParameteri(GLenum target, GLenum pname, GLint param);
653
654    undefined uniform1f(WebGLUniformLocation? location, GLfloat x);
655    undefined uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y);
656    undefined uniform3f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z);
657    undefined uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
658
659    undefined uniform1i(WebGLUniformLocation? location, GLint x);
660    undefined uniform2i(WebGLUniformLocation? location, GLint x, GLint y);
661    undefined uniform3i(WebGLUniformLocation? location, GLint x, GLint y, GLint z);
662    undefined uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w);
663
664    undefined useProgram(WebGLProgram? program);
665    undefined validateProgram(WebGLProgram program);
666
667    undefined vertexAttrib1f(GLuint index, GLfloat x);
668    undefined vertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
669    undefined vertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
670    undefined vertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
671
672    undefined vertexAttrib1fv(GLuint index, Float32List values);
673    undefined vertexAttrib2fv(GLuint index, Float32List values);
674    undefined vertexAttrib3fv(GLuint index, Float32List values);
675    undefined vertexAttrib4fv(GLuint index, Float32List values);
676
677    undefined vertexAttribPointer(GLuint index, GLint size, GLenum type,
678                                  GLboolean normalized, GLsizei stride, GLintptr offset);
679
680    undefined viewport(GLint x, GLint y, GLsizei width, GLsizei height);
681};
682
683interface mixin WebGLRenderingContextOverloads
684{
685    undefined bufferData(GLenum target, GLsizeiptr size, GLenum usage);
686    undefined bufferData(GLenum target, [AllowShared] BufferSource? data, GLenum usage);
687    undefined bufferSubData(GLenum target, GLintptr offset, [AllowShared] BufferSource data);
688
689    undefined compressedTexImage2D(GLenum target, GLint level, GLenum internalformat,
690                                   GLsizei width, GLsizei height, GLint border,
691                                   [AllowShared] ArrayBufferView data);
692    undefined compressedTexSubImage2D(GLenum target, GLint level,
693                                      GLint xoffset, GLint yoffset,
694                                      GLsizei width, GLsizei height, GLenum format,
695                                      [AllowShared] ArrayBufferView data);
696
697    undefined readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
698                         GLenum format, GLenum type, [AllowShared] ArrayBufferView? pixels);
699
700    undefined texImage2D(GLenum target, GLint level, GLint internalformat,
701                         GLsizei width, GLsizei height, GLint border, GLenum format,
702                         GLenum type, [AllowShared] ArrayBufferView? pixels);
703    undefined texImage2D(GLenum target, GLint level, GLint internalformat,
704                         GLenum format, GLenum type, TexImageSource source); // May throw DOMException
705
706    undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
707                            GLsizei width, GLsizei height,
708                            GLenum format, GLenum type, [AllowShared] ArrayBufferView? pixels);
709    undefined texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
710                            GLenum format, GLenum type, TexImageSource source); // May throw DOMException
711
712    undefined uniform1fv(WebGLUniformLocation? location, Float32List v);
713    undefined uniform2fv(WebGLUniformLocation? location, Float32List v);
714    undefined uniform3fv(WebGLUniformLocation? location, Float32List v);
715    undefined uniform4fv(WebGLUniformLocation? location, Float32List v);
716
717    undefined uniform1iv(WebGLUniformLocation? location, Int32List v);
718    undefined uniform2iv(WebGLUniformLocation? location, Int32List v);
719    undefined uniform3iv(WebGLUniformLocation? location, Int32List v);
720    undefined uniform4iv(WebGLUniformLocation? location, Int32List v);
721
722    undefined uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value);
723    undefined uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value);
724    undefined uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value);
725};
726
727[Exposed=(Window,Worker)]
728interface WebGLRenderingContext
729{
730};
731WebGLRenderingContext includes WebGLRenderingContextBase;
732WebGLRenderingContext includes WebGLRenderingContextOverloads;
733
734[Exposed=(Window,Worker)]
735interface WebGLContextEvent : Event {
736    constructor(DOMString type, optional WebGLContextEventInit eventInit = {});
737    readonly attribute DOMString statusMessage;
738};
739
740// EventInit is defined in the DOM4 specification.
741dictionary WebGLContextEventInit : EventInit {
742    DOMString statusMessage = "";
743};
744