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