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