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