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 source for this IDL is found at https://www.khronos.org/registry/webgl/specs/latest/2.0 7 * This IDL depends on WebGLRenderingContext.webidl 8 */ 9 10typedef long long GLint64; 11typedef unsigned long long GLuint64; 12 13[Pref="webgl.enable-webgl2", 14 Exposed=Window] 15interface WebGLSampler { 16}; 17 18[Pref="webgl.enable-webgl2", 19 Exposed=Window] 20interface WebGLSync { 21}; 22 23[Pref="webgl.enable-webgl2", 24 Exposed=Window] 25interface WebGLTransformFeedback { 26}; 27 28typedef ([AllowShared] Uint32Array or sequence<GLuint>) Uint32List; 29 30// WebGL2 spec has this as an empty interface that pulls in everything 31// via WebGL2RenderingContextBase. 32[Pref="webgl.enable-webgl2", 33 Exposed=Window] 34interface WebGL2RenderingContext 35{ 36}; 37 38interface mixin WebGL2RenderingContextBase 39{ 40 const GLenum READ_BUFFER = 0x0C02; 41 const GLenum UNPACK_ROW_LENGTH = 0x0CF2; 42 const GLenum UNPACK_SKIP_ROWS = 0x0CF3; 43 const GLenum UNPACK_SKIP_PIXELS = 0x0CF4; 44 const GLenum PACK_ROW_LENGTH = 0x0D02; 45 const GLenum PACK_SKIP_ROWS = 0x0D03; 46 const GLenum PACK_SKIP_PIXELS = 0x0D04; 47 const GLenum COLOR = 0x1800; 48 const GLenum DEPTH = 0x1801; 49 const GLenum STENCIL = 0x1802; 50 const GLenum RED = 0x1903; 51 const GLenum RGB8 = 0x8051; 52 const GLenum RGBA8 = 0x8058; 53 const GLenum RGB10_A2 = 0x8059; 54 const GLenum TEXTURE_BINDING_3D = 0x806A; 55 const GLenum UNPACK_SKIP_IMAGES = 0x806D; 56 const GLenum UNPACK_IMAGE_HEIGHT = 0x806E; 57 const GLenum TEXTURE_3D = 0x806F; 58 const GLenum TEXTURE_WRAP_R = 0x8072; 59 const GLenum MAX_3D_TEXTURE_SIZE = 0x8073; 60 const GLenum UNSIGNED_INT_2_10_10_10_REV = 0x8368; 61 const GLenum MAX_ELEMENTS_VERTICES = 0x80E8; 62 const GLenum MAX_ELEMENTS_INDICES = 0x80E9; 63 const GLenum TEXTURE_MIN_LOD = 0x813A; 64 const GLenum TEXTURE_MAX_LOD = 0x813B; 65 const GLenum TEXTURE_BASE_LEVEL = 0x813C; 66 const GLenum TEXTURE_MAX_LEVEL = 0x813D; 67 const GLenum MIN = 0x8007; 68 const GLenum MAX = 0x8008; 69 const GLenum DEPTH_COMPONENT24 = 0x81A6; 70 const GLenum MAX_TEXTURE_LOD_BIAS = 0x84FD; 71 const GLenum TEXTURE_COMPARE_MODE = 0x884C; 72 const GLenum TEXTURE_COMPARE_FUNC = 0x884D; 73 const GLenum CURRENT_QUERY = 0x8865; 74 const GLenum QUERY_RESULT = 0x8866; 75 const GLenum QUERY_RESULT_AVAILABLE = 0x8867; 76 const GLenum STREAM_READ = 0x88E1; 77 const GLenum STREAM_COPY = 0x88E2; 78 const GLenum STATIC_READ = 0x88E5; 79 const GLenum STATIC_COPY = 0x88E6; 80 const GLenum DYNAMIC_READ = 0x88E9; 81 const GLenum DYNAMIC_COPY = 0x88EA; 82 const GLenum MAX_DRAW_BUFFERS = 0x8824; 83 const GLenum DRAW_BUFFER0 = 0x8825; 84 const GLenum DRAW_BUFFER1 = 0x8826; 85 const GLenum DRAW_BUFFER2 = 0x8827; 86 const GLenum DRAW_BUFFER3 = 0x8828; 87 const GLenum DRAW_BUFFER4 = 0x8829; 88 const GLenum DRAW_BUFFER5 = 0x882A; 89 const GLenum DRAW_BUFFER6 = 0x882B; 90 const GLenum DRAW_BUFFER7 = 0x882C; 91 const GLenum DRAW_BUFFER8 = 0x882D; 92 const GLenum DRAW_BUFFER9 = 0x882E; 93 const GLenum DRAW_BUFFER10 = 0x882F; 94 const GLenum DRAW_BUFFER11 = 0x8830; 95 const GLenum DRAW_BUFFER12 = 0x8831; 96 const GLenum DRAW_BUFFER13 = 0x8832; 97 const GLenum DRAW_BUFFER14 = 0x8833; 98 const GLenum DRAW_BUFFER15 = 0x8834; 99 const GLenum MAX_FRAGMENT_UNIFORM_COMPONENTS = 0x8B49; 100 const GLenum MAX_VERTEX_UNIFORM_COMPONENTS = 0x8B4A; 101 const GLenum SAMPLER_3D = 0x8B5F; 102 const GLenum SAMPLER_2D_SHADOW = 0x8B62; 103 const GLenum FRAGMENT_SHADER_DERIVATIVE_HINT = 0x8B8B; 104 const GLenum PIXEL_PACK_BUFFER = 0x88EB; 105 const GLenum PIXEL_UNPACK_BUFFER = 0x88EC; 106 const GLenum PIXEL_PACK_BUFFER_BINDING = 0x88ED; 107 const GLenum PIXEL_UNPACK_BUFFER_BINDING = 0x88EF; 108 const GLenum FLOAT_MAT2x3 = 0x8B65; 109 const GLenum FLOAT_MAT2x4 = 0x8B66; 110 const GLenum FLOAT_MAT3x2 = 0x8B67; 111 const GLenum FLOAT_MAT3x4 = 0x8B68; 112 const GLenum FLOAT_MAT4x2 = 0x8B69; 113 const GLenum FLOAT_MAT4x3 = 0x8B6A; 114 const GLenum SRGB = 0x8C40; 115 const GLenum SRGB8 = 0x8C41; 116 const GLenum SRGB8_ALPHA8 = 0x8C43; 117 const GLenum COMPARE_REF_TO_TEXTURE = 0x884E; 118 const GLenum RGBA32F = 0x8814; 119 const GLenum RGB32F = 0x8815; 120 const GLenum RGBA16F = 0x881A; 121 const GLenum RGB16F = 0x881B; 122 const GLenum VERTEX_ATTRIB_ARRAY_INTEGER = 0x88FD; 123 const GLenum MAX_ARRAY_TEXTURE_LAYERS = 0x88FF; 124 const GLenum MIN_PROGRAM_TEXEL_OFFSET = 0x8904; 125 const GLenum MAX_PROGRAM_TEXEL_OFFSET = 0x8905; 126 const GLenum MAX_VARYING_COMPONENTS = 0x8B4B; 127 const GLenum TEXTURE_2D_ARRAY = 0x8C1A; 128 const GLenum TEXTURE_BINDING_2D_ARRAY = 0x8C1D; 129 const GLenum R11F_G11F_B10F = 0x8C3A; 130 const GLenum UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B; 131 const GLenum RGB9_E5 = 0x8C3D; 132 const GLenum UNSIGNED_INT_5_9_9_9_REV = 0x8C3E; 133 const GLenum TRANSFORM_FEEDBACK_BUFFER_MODE = 0x8C7F; 134 const GLenum MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 0x8C80; 135 const GLenum TRANSFORM_FEEDBACK_VARYINGS = 0x8C83; 136 const GLenum TRANSFORM_FEEDBACK_BUFFER_START = 0x8C84; 137 const GLenum TRANSFORM_FEEDBACK_BUFFER_SIZE = 0x8C85; 138 const GLenum TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8C88; 139 const GLenum RASTERIZER_DISCARD = 0x8C89; 140 const GLenum MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 0x8C8A; 141 const GLenum MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 0x8C8B; 142 const GLenum INTERLEAVED_ATTRIBS = 0x8C8C; 143 const GLenum SEPARATE_ATTRIBS = 0x8C8D; 144 const GLenum TRANSFORM_FEEDBACK_BUFFER = 0x8C8E; 145 const GLenum TRANSFORM_FEEDBACK_BUFFER_BINDING = 0x8C8F; 146 const GLenum RGBA32UI = 0x8D70; 147 const GLenum RGB32UI = 0x8D71; 148 const GLenum RGBA16UI = 0x8D76; 149 const GLenum RGB16UI = 0x8D77; 150 const GLenum RGBA8UI = 0x8D7C; 151 const GLenum RGB8UI = 0x8D7D; 152 const GLenum RGBA32I = 0x8D82; 153 const GLenum RGB32I = 0x8D83; 154 const GLenum RGBA16I = 0x8D88; 155 const GLenum RGB16I = 0x8D89; 156 const GLenum RGBA8I = 0x8D8E; 157 const GLenum RGB8I = 0x8D8F; 158 const GLenum RED_INTEGER = 0x8D94; 159 const GLenum RGB_INTEGER = 0x8D98; 160 const GLenum RGBA_INTEGER = 0x8D99; 161 const GLenum SAMPLER_2D_ARRAY = 0x8DC1; 162 const GLenum SAMPLER_2D_ARRAY_SHADOW = 0x8DC4; 163 const GLenum SAMPLER_CUBE_SHADOW = 0x8DC5; 164 const GLenum UNSIGNED_INT_VEC2 = 0x8DC6; 165 const GLenum UNSIGNED_INT_VEC3 = 0x8DC7; 166 const GLenum UNSIGNED_INT_VEC4 = 0x8DC8; 167 const GLenum INT_SAMPLER_2D = 0x8DCA; 168 const GLenum INT_SAMPLER_3D = 0x8DCB; 169 const GLenum INT_SAMPLER_CUBE = 0x8DCC; 170 const GLenum INT_SAMPLER_2D_ARRAY = 0x8DCF; 171 const GLenum UNSIGNED_INT_SAMPLER_2D = 0x8DD2; 172 const GLenum UNSIGNED_INT_SAMPLER_3D = 0x8DD3; 173 const GLenum UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4; 174 const GLenum UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7; 175 const GLenum DEPTH_COMPONENT32F = 0x8CAC; 176 const GLenum DEPTH32F_STENCIL8 = 0x8CAD; 177 const GLenum FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD; 178 const GLenum FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210; 179 const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 0x8211; 180 const GLenum FRAMEBUFFER_ATTACHMENT_RED_SIZE = 0x8212; 181 const GLenum FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 0x8213; 182 const GLenum FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 0x8214; 183 const GLenum FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 0x8215; 184 const GLenum FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 0x8216; 185 const GLenum FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 0x8217; 186 const GLenum FRAMEBUFFER_DEFAULT = 0x8218; 187 const GLenum UNSIGNED_INT_24_8 = 0x84FA; 188 const GLenum DEPTH24_STENCIL8 = 0x88F0; 189 const GLenum UNSIGNED_NORMALIZED = 0x8C17; 190 const GLenum DRAW_FRAMEBUFFER_BINDING = 0x8CA6; /* Same as FRAMEBUFFER_BINDING */ 191 const GLenum READ_FRAMEBUFFER = 0x8CA8; 192 const GLenum DRAW_FRAMEBUFFER = 0x8CA9; 193 const GLenum READ_FRAMEBUFFER_BINDING = 0x8CAA; 194 const GLenum RENDERBUFFER_SAMPLES = 0x8CAB; 195 const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 0x8CD4; 196 const GLenum MAX_COLOR_ATTACHMENTS = 0x8CDF; 197 const GLenum COLOR_ATTACHMENT1 = 0x8CE1; 198 const GLenum COLOR_ATTACHMENT2 = 0x8CE2; 199 const GLenum COLOR_ATTACHMENT3 = 0x8CE3; 200 const GLenum COLOR_ATTACHMENT4 = 0x8CE4; 201 const GLenum COLOR_ATTACHMENT5 = 0x8CE5; 202 const GLenum COLOR_ATTACHMENT6 = 0x8CE6; 203 const GLenum COLOR_ATTACHMENT7 = 0x8CE7; 204 const GLenum COLOR_ATTACHMENT8 = 0x8CE8; 205 const GLenum COLOR_ATTACHMENT9 = 0x8CE9; 206 const GLenum COLOR_ATTACHMENT10 = 0x8CEA; 207 const GLenum COLOR_ATTACHMENT11 = 0x8CEB; 208 const GLenum COLOR_ATTACHMENT12 = 0x8CEC; 209 const GLenum COLOR_ATTACHMENT13 = 0x8CED; 210 const GLenum COLOR_ATTACHMENT14 = 0x8CEE; 211 const GLenum COLOR_ATTACHMENT15 = 0x8CEF; 212 const GLenum FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0x8D56; 213 const GLenum MAX_SAMPLES = 0x8D57; 214 const GLenum HALF_FLOAT = 0x140B; 215 const GLenum RG = 0x8227; 216 const GLenum RG_INTEGER = 0x8228; 217 const GLenum R8 = 0x8229; 218 const GLenum RG8 = 0x822B; 219 const GLenum R16F = 0x822D; 220 const GLenum R32F = 0x822E; 221 const GLenum RG16F = 0x822F; 222 const GLenum RG32F = 0x8230; 223 const GLenum R8I = 0x8231; 224 const GLenum R8UI = 0x8232; 225 const GLenum R16I = 0x8233; 226 const GLenum R16UI = 0x8234; 227 const GLenum R32I = 0x8235; 228 const GLenum R32UI = 0x8236; 229 const GLenum RG8I = 0x8237; 230 const GLenum RG8UI = 0x8238; 231 const GLenum RG16I = 0x8239; 232 const GLenum RG16UI = 0x823A; 233 const GLenum RG32I = 0x823B; 234 const GLenum RG32UI = 0x823C; 235 const GLenum VERTEX_ARRAY_BINDING = 0x85B5; 236 const GLenum R8_SNORM = 0x8F94; 237 const GLenum RG8_SNORM = 0x8F95; 238 const GLenum RGB8_SNORM = 0x8F96; 239 const GLenum RGBA8_SNORM = 0x8F97; 240 const GLenum SIGNED_NORMALIZED = 0x8F9C; 241 const GLenum COPY_READ_BUFFER = 0x8F36; 242 const GLenum COPY_WRITE_BUFFER = 0x8F37; 243 const GLenum COPY_READ_BUFFER_BINDING = 0x8F36; /* Same as COPY_READ_BUFFER */ 244 const GLenum COPY_WRITE_BUFFER_BINDING = 0x8F37; /* Same as COPY_WRITE_BUFFER */ 245 const GLenum UNIFORM_BUFFER = 0x8A11; 246 const GLenum UNIFORM_BUFFER_BINDING = 0x8A28; 247 const GLenum UNIFORM_BUFFER_START = 0x8A29; 248 const GLenum UNIFORM_BUFFER_SIZE = 0x8A2A; 249 const GLenum MAX_VERTEX_UNIFORM_BLOCKS = 0x8A2B; 250 const GLenum MAX_FRAGMENT_UNIFORM_BLOCKS = 0x8A2D; 251 const GLenum MAX_COMBINED_UNIFORM_BLOCKS = 0x8A2E; 252 const GLenum MAX_UNIFORM_BUFFER_BINDINGS = 0x8A2F; 253 const GLenum MAX_UNIFORM_BLOCK_SIZE = 0x8A30; 254 const GLenum MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 0x8A31; 255 const GLenum MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 0x8A33; 256 const GLenum UNIFORM_BUFFER_OFFSET_ALIGNMENT = 0x8A34; 257 const GLenum ACTIVE_UNIFORM_BLOCKS = 0x8A36; 258 const GLenum UNIFORM_TYPE = 0x8A37; 259 const GLenum UNIFORM_SIZE = 0x8A38; 260 const GLenum UNIFORM_BLOCK_INDEX = 0x8A3A; 261 const GLenum UNIFORM_OFFSET = 0x8A3B; 262 const GLenum UNIFORM_ARRAY_STRIDE = 0x8A3C; 263 const GLenum UNIFORM_MATRIX_STRIDE = 0x8A3D; 264 const GLenum UNIFORM_IS_ROW_MAJOR = 0x8A3E; 265 const GLenum UNIFORM_BLOCK_BINDING = 0x8A3F; 266 const GLenum UNIFORM_BLOCK_DATA_SIZE = 0x8A40; 267 const GLenum UNIFORM_BLOCK_ACTIVE_UNIFORMS = 0x8A42; 268 const GLenum UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 0x8A43; 269 const GLenum UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 0x8A44; 270 const GLenum UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 0x8A46; 271 const GLenum INVALID_INDEX = 0xFFFFFFFF; 272 const GLenum MAX_VERTEX_OUTPUT_COMPONENTS = 0x9122; 273 const GLenum MAX_FRAGMENT_INPUT_COMPONENTS = 0x9125; 274 const GLenum MAX_SERVER_WAIT_TIMEOUT = 0x9111; 275 const GLenum OBJECT_TYPE = 0x9112; 276 const GLenum SYNC_CONDITION = 0x9113; 277 const GLenum SYNC_STATUS = 0x9114; 278 const GLenum SYNC_FLAGS = 0x9115; 279 const GLenum SYNC_FENCE = 0x9116; 280 const GLenum SYNC_GPU_COMMANDS_COMPLETE = 0x9117; 281 const GLenum UNSIGNALED = 0x9118; 282 const GLenum SIGNALED = 0x9119; 283 const GLenum ALREADY_SIGNALED = 0x911A; 284 const GLenum TIMEOUT_EXPIRED = 0x911B; 285 const GLenum CONDITION_SATISFIED = 0x911C; 286 const GLenum WAIT_FAILED = 0x911D; 287 const GLenum SYNC_FLUSH_COMMANDS_BIT = 0x00000001; 288 const GLenum VERTEX_ATTRIB_ARRAY_DIVISOR = 0x88FE; 289 const GLenum ANY_SAMPLES_PASSED = 0x8C2F; 290 const GLenum ANY_SAMPLES_PASSED_CONSERVATIVE = 0x8D6A; 291 const GLenum SAMPLER_BINDING = 0x8919; 292 const GLenum RGB10_A2UI = 0x906F; 293 const GLenum INT_2_10_10_10_REV = 0x8D9F; 294 const GLenum TRANSFORM_FEEDBACK = 0x8E22; 295 const GLenum TRANSFORM_FEEDBACK_PAUSED = 0x8E23; 296 const GLenum TRANSFORM_FEEDBACK_ACTIVE = 0x8E24; 297 const GLenum TRANSFORM_FEEDBACK_BINDING = 0x8E25; 298 const GLenum TEXTURE_IMMUTABLE_FORMAT = 0x912F; 299 const GLenum MAX_ELEMENT_INDEX = 0x8D6B; 300 const GLenum TEXTURE_IMMUTABLE_LEVELS = 0x82DF; 301 302 const GLint64 TIMEOUT_IGNORED = -1; 303 304 /* WebGL-specific enums */ 305 const GLenum MAX_CLIENT_WAIT_TIMEOUT_WEBGL = 0x9247; 306 307 /* Buffer objects */ 308 // WebGL1: 309 void bufferData(GLenum target, GLsizeiptr size, GLenum usage); 310 void bufferData(GLenum target, [AllowShared] ArrayBuffer? srcData, GLenum usage); 311 void bufferData(GLenum target, [AllowShared] ArrayBufferView srcData, GLenum usage); 312 void bufferSubData(GLenum target, GLintptr offset, [AllowShared] ArrayBuffer srcData); 313 void bufferSubData(GLenum target, GLintptr offset, [AllowShared] ArrayBufferView srcData); 314 // WebGL2: 315 void bufferData(GLenum target, [AllowShared] ArrayBufferView srcData, GLenum usage, 316 GLuint srcOffset, optional GLuint length = 0); 317 void bufferSubData(GLenum target, GLintptr dstByteOffset, [AllowShared] ArrayBufferView srcData, 318 GLuint srcOffset, optional GLuint length = 0); 319 320 void copyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, 321 GLintptr writeOffset, GLsizeiptr size); 322 // MapBufferRange, in particular its read-only and write-only modes, 323 // can not be exposed safely to JavaScript. GetBufferSubData 324 // replaces it for the purpose of fetching data back from the GPU. 325 void getBufferSubData(GLenum target, GLintptr srcByteOffset, [AllowShared] ArrayBufferView dstData, 326 optional GLuint dstOffset = 0, optional GLuint length = 0); 327 328 /* Framebuffer objects */ 329 void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, 330 GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); 331 void framebufferTextureLayer(GLenum target, GLenum attachment, WebGLTexture? texture, GLint level, 332 GLint layer); 333 334 [Throws] 335 void invalidateFramebuffer(GLenum target, sequence<GLenum> attachments); 336 337 [Throws] 338 void invalidateSubFramebuffer(GLenum target, sequence<GLenum> attachments, 339 GLint x, GLint y, GLsizei width, GLsizei height); 340 341 void readBuffer(GLenum src); 342 343 /* Renderbuffer objects */ 344 [Throws] 345 any getInternalformatParameter(GLenum target, GLenum internalformat, GLenum pname); 346 void renderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, 347 GLsizei width, GLsizei height); 348 349 /* Texture objects */ 350 void texStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, 351 GLsizei height); 352 void texStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, 353 GLsizei height, GLsizei depth); 354 355 // WebGL1 legacy entrypoints: 356 [Throws] // Another overhead throws. 357 void texImage2D(GLenum target, GLint level, GLint internalformat, 358 GLsizei width, GLsizei height, GLint border, GLenum format, 359 GLenum type, [AllowShared] ArrayBufferView? pixels); 360 [Throws] 361 void texImage2D(GLenum target, GLint level, GLint internalformat, 362 GLenum format, GLenum type, HTMLCanvasElement source); // May throw DOMException 363 [Throws] 364 void texImage2D(GLenum target, GLint level, GLint internalformat, 365 GLenum format, GLenum type, HTMLImageElement source); // May throw DOMException 366 [Throws] 367 void texImage2D(GLenum target, GLint level, GLint internalformat, 368 GLenum format, GLenum type, HTMLVideoElement source); // May throw DOMException 369 [Throws] // Another overhead throws. 370 void texImage2D(GLenum target, GLint level, GLint internalformat, 371 GLenum format, GLenum type, ImageBitmap source); 372 [Throws] // Another overhead throws. 373 void texImage2D(GLenum target, GLint level, GLint internalformat, 374 GLenum format, GLenum type, ImageData source); 375 376 [Throws] // Another overhead throws. 377 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, 378 GLsizei width, GLsizei height, 379 GLenum format, GLenum type, [AllowShared] ArrayBufferView? pixels); 380 [Throws] 381 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, 382 GLenum format, GLenum type, HTMLCanvasElement source); // May throw DOMException 383 [Throws] 384 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, 385 GLenum format, GLenum type, HTMLImageElement source); // May throw DOMException 386 [Throws] 387 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, 388 GLenum format, GLenum type, HTMLVideoElement source); // May throw DOMException 389 [Throws] // Another overhead throws. 390 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, 391 GLenum format, GLenum type, ImageBitmap source); 392 [Throws] // Another overhead throws. 393 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, 394 GLenum format, GLenum type, ImageData source); 395 396 // WebGL2 entrypoints: 397 [Throws] // Another overhead throws. 398 void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, 399 GLint border, GLenum format, GLenum type, GLintptr pboOffset); 400 [Throws] 401 void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, 402 GLint border, GLenum format, GLenum type, 403 HTMLCanvasElement source); // May throw DOMException 404 [Throws] 405 void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, 406 GLint border, GLenum format, GLenum type, 407 HTMLImageElement source); // May throw DOMException 408 [Throws] 409 void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, 410 GLint border, GLenum format, GLenum type, 411 HTMLVideoElement source); // May throw DOMException 412 [Throws] // Another overhead throws. 413 void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, 414 GLint border, GLenum format, GLenum type, 415 ImageBitmap source); 416 [Throws] // Another overhead throws. 417 void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, 418 GLint border, GLenum format, GLenum type, 419 ImageData source); 420 [Throws] // Another overhead throws. 421 void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, 422 GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView srcData, 423 GLuint srcOffset); 424 425 [Throws] // Another overhead throws. 426 void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, 427 GLsizei depth, GLint border, GLenum format, GLenum type, GLintptr pboOffset); 428 [Throws] 429 void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, 430 GLsizei depth, GLint border, GLenum format, GLenum type, 431 HTMLCanvasElement source); // May throw DOMException 432 [Throws] 433 void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, 434 GLsizei depth, GLint border, GLenum format, GLenum type, 435 HTMLImageElement source); // May throw DOMException 436 [Throws] 437 void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, 438 GLsizei depth, GLint border, GLenum format, GLenum type, 439 HTMLVideoElement source); // May throw DOMException 440 [Throws] // Another overhead throws. 441 void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, 442 GLsizei depth, GLint border, GLenum format, GLenum type, 443 ImageBitmap source); 444 [Throws] // Another overhead throws. 445 void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, 446 GLsizei depth, GLint border, GLenum format, GLenum type, 447 ImageData source); 448 [Throws] // Another overhead throws. 449 void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, 450 GLsizei depth, GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView? srcData); 451 [Throws] // Another overhead throws. 452 void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, 453 GLsizei depth, GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView srcData, 454 GLuint srcOffset); 455 456 [Throws] // Another overhead throws. 457 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, 458 GLsizei height, GLenum format, GLenum type, GLintptr pboOffset); 459 [Throws] 460 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, 461 GLsizei height, GLenum format, GLenum type, 462 HTMLCanvasElement source); // May throw DOMException 463 [Throws] 464 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, 465 GLsizei height, GLenum format, GLenum type, 466 HTMLImageElement source); // May throw DOMException 467 [Throws] 468 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, 469 GLsizei height, GLenum format, GLenum type, 470 HTMLVideoElement source); // May throw DOMException 471 [Throws] // Another overhead throws. 472 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, 473 GLsizei height, GLenum format, GLenum type, 474 ImageBitmap source); 475 [Throws] // Another overhead throws. 476 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, 477 GLsizei height, GLenum format, GLenum type, 478 ImageData source); 479 [Throws] // Another overhead throws. 480 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, 481 GLsizei height, GLenum format, GLenum type, [AllowShared] ArrayBufferView srcData, 482 GLuint srcOffset); 483 484 [Throws] // Another overhead throws. 485 void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, 486 GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, 487 GLintptr pboOffset); 488 [Throws] 489 void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, 490 GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, 491 HTMLCanvasElement source); // May throw DOMException 492 [Throws] 493 void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, 494 GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, 495 HTMLImageElement source); // May throw DOMException 496 [Throws] 497 void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, 498 GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, 499 HTMLVideoElement source); // May throw DOMException 500 [Throws] // Another overhead throws. 501 void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, 502 GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, 503 ImageBitmap source); 504 [Throws] // Another overhead throws. 505 void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, 506 GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, 507 ImageData source); 508 [Throws] // Another overhead throws. 509 void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, 510 GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, 511 [AllowShared] ArrayBufferView? srcData, optional GLuint srcOffset = 0); 512 513 void copyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, 514 GLint x, GLint y, GLsizei width, GLsizei height); 515 516 void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, 517 GLsizei height, GLint border, GLsizei imageSize, GLintptr offset); 518 void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, 519 GLsizei height, GLint border, [AllowShared] ArrayBufferView srcData, 520 optional GLuint srcOffset = 0, optional GLuint srcLengthOverride = 0); 521 522 void compressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, 523 GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLintptr offset); 524 void compressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, 525 GLsizei height, GLsizei depth, GLint border, [AllowShared] ArrayBufferView srcData, 526 optional GLuint srcOffset = 0, optional GLuint srcLengthOverride = 0); 527 528 void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, 529 GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLintptr offset); 530 void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, 531 GLsizei width, GLsizei height, GLenum format, 532 [AllowShared] ArrayBufferView srcData, 533 optional GLuint srcOffset = 0, 534 optional GLuint srcLengthOverride = 0); 535 536 void compressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, 537 GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, 538 GLenum format, GLsizei imageSize, GLintptr offset); 539 void compressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, 540 GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, 541 GLenum format, [AllowShared] ArrayBufferView srcData, 542 optional GLuint srcOffset = 0, 543 optional GLuint srcLengthOverride = 0); 544 545 /* Programs and shaders */ 546 [WebGLHandlesContextLoss] GLint getFragDataLocation(WebGLProgram program, DOMString name); 547 548 /* Uniforms */ 549 void uniform1ui(WebGLUniformLocation? location, GLuint v0); 550 void uniform2ui(WebGLUniformLocation? location, GLuint v0, GLuint v1); 551 void uniform3ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2); 552 void uniform4ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); 553 554 void uniform1fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0, 555 optional GLuint srcLength = 0); 556 void uniform2fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0, 557 optional GLuint srcLength = 0); 558 void uniform3fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0, 559 optional GLuint srcLength = 0); 560 void uniform4fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0, 561 optional GLuint srcLength = 0); 562 563 void uniform1iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0, 564 optional GLuint srcLength = 0); 565 void uniform2iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0, 566 optional GLuint srcLength = 0); 567 void uniform3iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0, 568 optional GLuint srcLength = 0); 569 void uniform4iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0, 570 optional GLuint srcLength = 0); 571 572 void uniform1uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0, 573 optional GLuint srcLength = 0); 574 void uniform2uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0, 575 optional GLuint srcLength = 0); 576 void uniform3uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0, 577 optional GLuint srcLength = 0); 578 void uniform4uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0, 579 optional GLuint srcLength = 0); 580 581 void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, 582 optional GLuint srcOffset = 0, optional GLuint srcLength = 0); 583 void uniformMatrix3x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, 584 optional GLuint srcOffset = 0, optional GLuint srcLength = 0); 585 void uniformMatrix4x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, 586 optional GLuint srcOffset = 0, optional GLuint srcLength = 0); 587 588 void uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, 589 optional GLuint srcOffset = 0, optional GLuint srcLength = 0); 590 void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, 591 optional GLuint srcOffset = 0, optional GLuint srcLength = 0); 592 void uniformMatrix4x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, 593 optional GLuint srcOffset = 0, optional GLuint srcLength = 0); 594 595 void uniformMatrix2x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, 596 optional GLuint srcOffset = 0, optional GLuint srcLength = 0); 597 void uniformMatrix3x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, 598 optional GLuint srcOffset = 0, optional GLuint srcLength = 0); 599 void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data, 600 optional GLuint srcOffset = 0, optional GLuint srcLength = 0); 601 602 /* Vertex attribs */ 603 void vertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w); 604 void vertexAttribI4iv(GLuint index, Int32List values); 605 void vertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); 606 void vertexAttribI4uiv(GLuint index, Uint32List values); 607 void vertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset); 608 609 /* Writing to the drawing buffer */ 610 void vertexAttribDivisor(GLuint index, GLuint divisor); 611 void drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount); 612 void drawElementsInstanced(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei instanceCount); 613 void drawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLintptr offset); 614 615 /* Reading back pixels */ 616 // WebGL1: 617 [Throws, NeedsCallerType] // Throws on readback in a write-only context. 618 void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, 619 [AllowShared] ArrayBufferView? dstData); 620 // WebGL2: 621 [Throws, NeedsCallerType] // Throws on readback in a write-only context. 622 void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, 623 GLintptr offset); 624 [Throws, NeedsCallerType] // Throws on readback in a write-only context. 625 void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, 626 [AllowShared] ArrayBufferView dstData, GLuint dstOffset); 627 628 /* Multiple Render Targets */ 629 void drawBuffers(sequence<GLenum> buffers); 630 631 void clearBufferfv(GLenum buffer, GLint drawbuffer, Float32List values, 632 optional GLuint srcOffset = 0); 633 void clearBufferiv(GLenum buffer, GLint drawbuffer, Int32List values, 634 optional GLuint srcOffset = 0); 635 void clearBufferuiv(GLenum buffer, GLint drawbuffer, Uint32List values, 636 optional GLuint srcOffset = 0); 637 638 void clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); 639 640 /* Query Objects */ 641 WebGLQuery? createQuery(); 642 void deleteQuery(WebGLQuery? query); 643 [WebGLHandlesContextLoss] GLboolean isQuery(WebGLQuery? query); 644 void beginQuery(GLenum target, WebGLQuery query); 645 void endQuery(GLenum target); 646 any getQuery(GLenum target, GLenum pname); 647 any getQueryParameter(WebGLQuery query, GLenum pname); 648 649 /* Sampler Objects */ 650 WebGLSampler? createSampler(); 651 void deleteSampler(WebGLSampler? sampler); 652 [WebGLHandlesContextLoss] GLboolean isSampler(WebGLSampler? sampler); 653 void bindSampler(GLuint unit, WebGLSampler? sampler); 654 void samplerParameteri(WebGLSampler sampler, GLenum pname, GLint param); 655 void samplerParameterf(WebGLSampler sampler, GLenum pname, GLfloat param); 656 any getSamplerParameter(WebGLSampler sampler, GLenum pname); 657 658 /* Sync objects */ 659 WebGLSync? fenceSync(GLenum condition, GLbitfield flags); 660 [WebGLHandlesContextLoss] GLboolean isSync(WebGLSync? sync); 661 void deleteSync(WebGLSync? sync); 662 GLenum clientWaitSync(WebGLSync sync, GLbitfield flags, GLuint64 timeout); 663 void waitSync(WebGLSync sync, GLbitfield flags, GLint64 timeout); 664 any getSyncParameter(WebGLSync sync, GLenum pname); 665 666 /* Transform Feedback */ 667 WebGLTransformFeedback? createTransformFeedback(); 668 void deleteTransformFeedback(WebGLTransformFeedback? tf); 669 [WebGLHandlesContextLoss] GLboolean isTransformFeedback(WebGLTransformFeedback? tf); 670 void bindTransformFeedback(GLenum target, WebGLTransformFeedback? tf); 671 void beginTransformFeedback(GLenum primitiveMode); 672 void endTransformFeedback(); 673 void transformFeedbackVaryings(WebGLProgram program, sequence<DOMString> varyings, GLenum bufferMode); 674 [NewObject] 675 WebGLActiveInfo? getTransformFeedbackVarying(WebGLProgram program, GLuint index); 676 void pauseTransformFeedback(); 677 void resumeTransformFeedback(); 678 679 /* Uniform Buffer Objects and Transform Feedback Buffers */ 680 void bindBufferBase(GLenum target, GLuint index, WebGLBuffer? buffer); 681 void bindBufferRange(GLenum target, GLuint index, WebGLBuffer? buffer, GLintptr offset, GLsizeiptr size); 682 [Throws] // GetOrCreateDOMReflector can fail. 683 any getIndexedParameter(GLenum target, GLuint index); 684 sequence<GLuint>? getUniformIndices(WebGLProgram program, sequence<DOMString> uniformNames); 685 any getActiveUniforms(WebGLProgram program, sequence<GLuint> uniformIndices, GLenum pname); 686 GLuint getUniformBlockIndex(WebGLProgram program, DOMString uniformBlockName); 687 [Throws] // Creating a Uint32Array can fail. 688 any getActiveUniformBlockParameter(WebGLProgram program, GLuint uniformBlockIndex, GLenum pname); 689 DOMString? getActiveUniformBlockName(WebGLProgram program, GLuint uniformBlockIndex); 690 void uniformBlockBinding(WebGLProgram program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); 691 692 /* Vertex Array Objects */ 693 WebGLVertexArrayObject? createVertexArray(); 694 void deleteVertexArray(WebGLVertexArrayObject? vertexArray); 695 [WebGLHandlesContextLoss] GLboolean isVertexArray(WebGLVertexArrayObject? vertexArray); 696 void bindVertexArray(WebGLVertexArrayObject? array); 697}; 698 699WebGL2RenderingContext includes WebGLRenderingContextBase; 700WebGL2RenderingContext includes WebGL2RenderingContextBase; 701 702[LegacyNoInterfaceObject, 703 Exposed=Window] 704interface EXT_color_buffer_float { 705}; 706 707[LegacyNoInterfaceObject, 708 Exposed=Window] 709interface OVR_multiview2 { 710 const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR = 0x9630; 711 const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR = 0x9632; 712 const GLenum MAX_VIEWS_OVR = 0x9631; 713 const GLenum FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR = 0x9633; 714 715 void framebufferTextureMultiviewOVR(GLenum target, GLenum attachment, WebGLTexture? texture, GLint level, GLint baseViewIndex, GLsizei numViews); 716}; 717