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