aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorImanol Fernandez <mortimergoro@gmail.com>2017-10-26 18:04:13 +0200
committerImanol Fernandez <mortimergoro@gmail.com>2017-10-27 12:53:11 +0200
commitddd6c86e992a45d6490b8ec6eb2bf7b3ecce9a03 (patch)
treee037a6f8ff7948f54d9db71224d45d1ea85757e5 /components/script
parentfd4843a40ef7c000bbd747208fcf61267dbf157f (diff)
downloadservo-ddd6c86e992a45d6490b8ec6eb2bf7b3ecce9a03.tar.gz
servo-ddd6c86e992a45d6490b8ec6eb2bf7b3ecce9a03.zip
Kick off WebGL 2.0 implementation
Diffstat (limited to 'components/script')
-rw-r--r--components/script/dom/bindings/trace.rs3
-rw-r--r--components/script/dom/htmlcanvaselement.rs107
-rw-r--r--components/script/dom/mod.rs1
-rw-r--r--components/script/dom/vrdisplay.rs9
-rw-r--r--components/script/dom/webgl2renderingcontext.rs914
-rw-r--r--components/script/dom/webglrenderingcontext.rs33
-rw-r--r--components/script/dom/webglshader.rs19
-rw-r--r--components/script/dom/webidls/HTMLCanvasElement.webidl2
-rw-r--r--components/script/dom/webidls/WebGL2RenderingContext.webidl582
9 files changed, 1618 insertions, 52 deletions
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs
index 6f5dce2ab14..f65fcbeca2f 100644
--- a/components/script/dom/bindings/trace.rs
+++ b/components/script/dom/bindings/trace.rs
@@ -33,7 +33,7 @@ use app_units::Au;
use canvas_traits::canvas::{CanvasGradientStop, LinearGradientStyle, RadialGradientStyle};
use canvas_traits::canvas::{CompositionOrBlending, LineCapStyle, LineJoinStyle, RepetitionStyle};
use canvas_traits::webgl::{WebGLBufferId, WebGLFramebufferId, WebGLProgramId, WebGLRenderbufferId};
-use canvas_traits::webgl::{WebGLChan, WebGLContextShareMode, WebGLError, WebGLPipeline, WebGLMsgSender};
+use canvas_traits::webgl::{WebGLChan, WebGLContextShareMode, WebGLError, WebGLPipeline, WebGLMsgSender, WebGLVersion};
use canvas_traits::webgl::{WebGLReceiver, WebGLSender, WebGLShaderId, WebGLTextureId, WebGLVertexArrayId};
use cssparser::RGBA;
use devtools_traits::{CSSError, TimelineMarkerType, WorkerId};
@@ -411,6 +411,7 @@ unsafe_no_jsmanaged_fields!(WebGLRenderbufferId);
unsafe_no_jsmanaged_fields!(WebGLShaderId);
unsafe_no_jsmanaged_fields!(WebGLTextureId);
unsafe_no_jsmanaged_fields!(WebGLVertexArrayId);
+unsafe_no_jsmanaged_fields!(WebGLVersion);
unsafe_no_jsmanaged_fields!(MediaList);
unsafe_no_jsmanaged_fields!(WebVRGamepadHand);
unsafe_no_jsmanaged_fields!(ScriptToConstellationChan);
diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs
index a44c1fd1fa5..9496670238b 100644
--- a/components/script/dom/htmlcanvaselement.rs
+++ b/components/script/dom/htmlcanvaselement.rs
@@ -4,13 +4,13 @@
use base64;
use canvas_traits::canvas::{CanvasMsg, FromScriptMsg};
+use canvas_traits::webgl::WebGLVersion;
use dom::attr::Attr;
use dom::bindings::cell::DomRefCell;
use dom::bindings::codegen::Bindings::CanvasRenderingContext2DBinding::CanvasRenderingContext2DMethods;
use dom::bindings::codegen::Bindings::HTMLCanvasElementBinding;
-use dom::bindings::codegen::Bindings::HTMLCanvasElementBinding::HTMLCanvasElementMethods;
+use dom::bindings::codegen::Bindings::HTMLCanvasElementBinding::{HTMLCanvasElementMethods, RenderingContext};
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLContextAttributes;
-use dom::bindings::codegen::UnionTypes::CanvasRenderingContext2DOrWebGLRenderingContext;
use dom::bindings::conversions::ConversionResult;
use dom::bindings::error::{Error, Fallible};
use dom::bindings::inheritance::Castable;
@@ -24,6 +24,7 @@ use dom::globalscope::GlobalScope;
use dom::htmlelement::HTMLElement;
use dom::node::{Node, window_from_node};
use dom::virtualmethods::VirtualMethods;
+use dom::webgl2renderingcontext::WebGL2RenderingContext;
use dom::webglrenderingcontext::{LayoutCanvasWebGLRenderingContextHelpers, WebGLRenderingContext};
use dom_struct::dom_struct;
use euclid::Size2D;
@@ -35,6 +36,7 @@ use js::error::throw_type_error;
use js::jsapi::{HandleValue, JSContext};
use offscreen_gl_context::GLContextAttributes;
use script_layout_interface::{HTMLCanvasData, HTMLCanvasDataSource};
+use servo_config::prefs::PREFS;
use std::iter::repeat;
use style::attr::{AttrValue, LengthOrPercentageOrAuto};
@@ -46,6 +48,7 @@ const DEFAULT_HEIGHT: u32 = 150;
pub enum CanvasContext {
Context2d(Dom<CanvasRenderingContext2D>),
WebGL(Dom<WebGLRenderingContext>),
+ WebGL2(Dom<WebGL2RenderingContext>),
}
#[dom_struct]
@@ -79,6 +82,7 @@ impl HTMLCanvasElement {
match *context {
CanvasContext::Context2d(ref context) => context.set_bitmap_dimensions(size),
CanvasContext::WebGL(ref context) => context.recreate(size),
+ CanvasContext::WebGL2(ref context) => context.recreate(size),
}
}
}
@@ -113,6 +117,9 @@ impl LayoutHTMLCanvasElementHelpers for LayoutDom<HTMLCanvasElement> {
Some(&CanvasContext::WebGL(ref context)) => {
context.to_layout().canvas_data_source()
},
+ Some(&CanvasContext::WebGL2(ref context)) => {
+ context.to_layout().canvas_data_source()
+ },
None => {
HTMLCanvasDataSource::Image(None)
}
@@ -165,32 +172,16 @@ impl HTMLCanvasElement {
}
}
- #[allow(unsafe_code)]
- pub fn get_or_init_webgl_context(&self,
- cx: *mut JSContext,
- attrs: Option<HandleValue>) -> Option<DomRoot<WebGLRenderingContext>> {
+ pub fn get_or_init_webgl_context(
+ &self,
+ cx: *mut JSContext,
+ attrs: Option<HandleValue>
+ ) -> Option<DomRoot<WebGLRenderingContext>> {
if self.context.borrow().is_none() {
let window = window_from_node(self);
let size = self.get_size();
-
- let attrs = if let Some(webgl_attributes) = attrs {
- match unsafe {
- WebGLContextAttributes::new(cx, webgl_attributes) } {
- Ok(ConversionResult::Success(ref attrs)) => From::from(attrs),
- Ok(ConversionResult::Failure(ref error)) => {
- unsafe { throw_type_error(cx, &error); }
- return None;
- }
- _ => {
- debug!("Unexpected error on conversion of WebGLContextAttributes");
- return None;
- }
- }
- } else {
- GLContextAttributes::default()
- };
-
- let maybe_ctx = WebGLRenderingContext::new(&window, self, size, attrs);
+ let attrs = Self::get_gl_attributes(cx, attrs)?;
+ let maybe_ctx = WebGLRenderingContext::new(&window, self, WebGLVersion::WebGL1, size, attrs);
*self.context.borrow_mut() = maybe_ctx.map( |ctx| CanvasContext::WebGL(Dom::from_ref(&*ctx)));
}
@@ -202,6 +193,58 @@ impl HTMLCanvasElement {
}
}
+ pub fn get_or_init_webgl2_context(
+ &self,
+ cx: *mut JSContext,
+ attrs: Option<HandleValue>
+ ) -> Option<DomRoot<WebGL2RenderingContext>> {
+ if !PREFS.is_webgl2_enabled() {
+ return None
+ }
+ if self.context.borrow().is_none() {
+ let window = window_from_node(self);
+ let size = self.get_size();
+ let attrs = Self::get_gl_attributes(cx, attrs)?;
+ let maybe_ctx = WebGL2RenderingContext::new(&window, self, size, attrs);
+
+ *self.context.borrow_mut() = maybe_ctx.map( |ctx| CanvasContext::WebGL2(Dom::from_ref(&*ctx)));
+ }
+
+ if let Some(CanvasContext::WebGL2(ref context)) = *self.context.borrow() {
+ Some(DomRoot::from_ref(&*context))
+ } else {
+ None
+ }
+ }
+
+ /// Gets the base WebGLRenderingContext for WebGL or WebGL 2, if exists.
+ pub fn get_base_webgl_context(&self) -> Option<DomRoot<WebGLRenderingContext>> {
+ match *self.context.borrow() {
+ Some(CanvasContext::WebGL(ref context)) => Some(DomRoot::from_ref(&*context)),
+ Some(CanvasContext::WebGL2(ref context)) => Some(context.base_context()),
+ _ => None
+ }
+ }
+
+ #[allow(unsafe_code)]
+ fn get_gl_attributes(cx: *mut JSContext, attrs: Option<HandleValue>) -> Option<GLContextAttributes> {
+ let webgl_attributes = match attrs {
+ Some(attrs) => attrs,
+ None => return Some(GLContextAttributes::default()),
+ };
+ match unsafe { WebGLContextAttributes::new(cx, webgl_attributes) } {
+ Ok(ConversionResult::Success(ref attrs)) => Some(From::from(attrs)),
+ Ok(ConversionResult::Failure(ref error)) => {
+ unsafe { throw_type_error(cx, &error); }
+ None
+ }
+ _ => {
+ debug!("Unexpected error on conversion of WebGLContextAttributes");
+ None
+ }
+ }
+ }
+
pub fn is_valid(&self) -> bool {
self.Height() != 0 && self.Width() != 0
}
@@ -225,6 +268,10 @@ impl HTMLCanvasElement {
// TODO: add a method in WebGLRenderingContext to get the pixels.
return None;
},
+ Some(&CanvasContext::WebGL2(_)) => {
+ // TODO: add a method in WebGL2RenderingContext to get the pixels.
+ return None;
+ },
None => {
repeat(0xffu8).take((size.height as usize) * (size.width as usize) * 4).collect()
}
@@ -253,15 +300,19 @@ impl HTMLCanvasElementMethods for HTMLCanvasElement {
cx: *mut JSContext,
id: DOMString,
attributes: Vec<HandleValue>)
- -> Option<CanvasRenderingContext2DOrWebGLRenderingContext> {
+ -> Option<RenderingContext> {
match &*id {
"2d" => {
self.get_or_init_2d_context()
- .map(CanvasRenderingContext2DOrWebGLRenderingContext::CanvasRenderingContext2D)
+ .map(RenderingContext::CanvasRenderingContext2D)
}
"webgl" | "experimental-webgl" => {
self.get_or_init_webgl_context(cx, attributes.get(0).cloned())
- .map(CanvasRenderingContext2DOrWebGLRenderingContext::WebGLRenderingContext)
+ .map(RenderingContext::WebGLRenderingContext)
+ }
+ "webgl2" | "experimental-webgl2" => {
+ self.get_or_init_webgl2_context(cx, attributes.get(0).cloned())
+ .map(RenderingContext::WebGL2RenderingContext)
}
_ => None
}
diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs
index 6866efd17d0..5ae3f477a06 100644
--- a/components/script/dom/mod.rs
+++ b/components/script/dom/mod.rs
@@ -467,6 +467,7 @@ pub mod vrpose;
pub mod vrstageparameters;
pub mod webgl_extensions;
pub use self::webgl_extensions::ext::*;
+pub mod webgl2renderingcontext;
pub mod webgl_validations;
pub mod webglactiveinfo;
pub mod webglbuffer;
diff --git a/components/script/dom/vrdisplay.rs b/components/script/dom/vrdisplay.rs
index e931b4b7796..72b8e29a15c 100644
--- a/components/script/dom/vrdisplay.rs
+++ b/components/script/dom/vrdisplay.rs
@@ -32,7 +32,6 @@ use dom::vrstageparameters::VRStageParameters;
use dom::webglrenderingcontext::WebGLRenderingContext;
use dom_struct::dom_struct;
use ipc_channel::ipc::{self, IpcSender};
-use js::jsapi::JSContext;
use script_runtime::CommonScriptMsg;
use script_runtime::ScriptThreadEventCategory::WebVREvent;
use std::cell::Cell;
@@ -299,7 +298,7 @@ impl VRDisplayMethods for VRDisplay {
}
// Parse and validate received VRLayer
- let layer = validate_layer(self.global().get_cx(), &layers[0]);
+ let layer = validate_layer(&layers[0]);
let layer_bounds;
let layer_ctx;
@@ -629,10 +628,8 @@ fn parse_bounds(src: &Option<Vec<Finite<f32>>>, dst: &mut [f32; 4]) -> Result<()
}
}
-fn validate_layer(cx: *mut JSContext,
- layer: &VRLayer)
- -> Result<(WebVRLayer, DomRoot<WebGLRenderingContext>), &'static str> {
- let ctx = layer.source.as_ref().map(|ref s| s.get_or_init_webgl_context(cx, None)).unwrap_or(None);
+fn validate_layer(layer: &VRLayer) -> Result<(WebVRLayer, DomRoot<WebGLRenderingContext>), &'static str> {
+ let ctx = layer.source.as_ref().map(|ref s| s.get_base_webgl_context()).unwrap_or(None);
if let Some(ctx) = ctx {
let mut data = WebVRLayer::default();
parse_bounds(&layer.leftBounds, &mut data.left_bounds)?;
diff --git a/components/script/dom/webgl2renderingcontext.rs b/components/script/dom/webgl2renderingcontext.rs
new file mode 100644
index 00000000000..6f2cd362845
--- /dev/null
+++ b/components/script/dom/webgl2renderingcontext.rs
@@ -0,0 +1,914 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/// https://www.khronos.org/registry/webgl/specs/latest/2.0/webgl.idl
+use canvas_traits::webgl::WebGLVersion;
+use dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding;
+use dom::bindings::codegen::Bindings::WebGL2RenderingContextBinding::WebGL2RenderingContextMethods;
+use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLContextAttributes;
+use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods;
+use dom::bindings::codegen::UnionTypes::ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement;
+use dom::bindings::error::Fallible;
+use dom::bindings::nonnull::NonNullJSObjectPtr;
+use dom::bindings::reflector::{reflect_dom_object, Reflector};
+use dom::bindings::root::{Dom, DomRoot, LayoutDom};
+use dom::bindings::str::DOMString;
+use dom::htmlcanvaselement::HTMLCanvasElement;
+use dom::htmliframeelement::HTMLIFrameElement;
+use dom::webglactiveinfo::WebGLActiveInfo;
+use dom::webglbuffer::WebGLBuffer;
+use dom::webglframebuffer::WebGLFramebuffer;
+use dom::webglprogram::WebGLProgram;
+use dom::webglrenderbuffer::WebGLRenderbuffer;
+use dom::webglrenderingcontext::{LayoutCanvasWebGLRenderingContextHelpers, WebGLRenderingContext};
+use dom::webglshader::WebGLShader;
+use dom::webglshaderprecisionformat::WebGLShaderPrecisionFormat;
+use dom::webgltexture::WebGLTexture;
+use dom::webgluniformlocation::WebGLUniformLocation;
+use dom::window::Window;
+use dom_struct::dom_struct;
+use euclid::Size2D;
+use js::jsapi::{JSContext, JSObject};
+use js::jsval::JSVal;
+use offscreen_gl_context::GLContextAttributes;
+use script_layout_interface::HTMLCanvasDataSource;
+
+#[dom_struct]
+pub struct WebGL2RenderingContext {
+ reflector_: Reflector,
+ base: Dom<WebGLRenderingContext>,
+}
+
+impl WebGL2RenderingContext {
+ fn new_inherited(
+ window: &Window,
+ canvas: &HTMLCanvasElement,
+ size: Size2D<i32>,
+ attrs: GLContextAttributes
+ ) -> Option<WebGL2RenderingContext> {
+ let base = WebGLRenderingContext::new(window, canvas, WebGLVersion::WebGL2, size, attrs)?;
+ Some(WebGL2RenderingContext {
+ reflector_: Reflector::new(),
+ base: Dom::from_ref(&*base),
+ })
+ }
+
+ #[allow(unrooted_must_root)]
+ pub fn new(
+ window: &Window,
+ canvas: &HTMLCanvasElement,
+ size: Size2D<i32>,
+ attrs: GLContextAttributes
+ ) -> Option<DomRoot<WebGL2RenderingContext>> {
+ WebGL2RenderingContext::new_inherited(window, canvas, size, attrs).map(|ctx| {
+ reflect_dom_object(Box::new(ctx), window, WebGL2RenderingContextBinding::Wrap)
+ })
+ }
+}
+
+impl WebGL2RenderingContext {
+ pub fn recreate(&self, size: Size2D<i32>) {
+ self.base.recreate(size)
+ }
+
+ pub fn base_context(&self) -> DomRoot<WebGLRenderingContext> {
+ DomRoot::from_ref(&*self.base)
+ }
+}
+
+impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.1
+ fn Canvas(&self) -> DomRoot<HTMLCanvasElement> {
+ self.base.Canvas()
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.11
+ fn Flush(&self) {
+ self.base.Flush()
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.11
+ fn Finish(&self) {
+ self.base.Finish()
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.1
+ fn DrawingBufferWidth(&self) -> i32 {
+ self.base.DrawingBufferWidth()
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.1
+ fn DrawingBufferHeight(&self) -> i32 {
+ self.base.DrawingBufferHeight()
+ }
+
+ #[allow(unsafe_code)]
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
+ unsafe fn GetBufferParameter(&self, _cx: *mut JSContext, target: u32, parameter: u32) -> JSVal {
+ self.base.GetBufferParameter(_cx, target, parameter)
+ }
+
+ #[allow(unsafe_code)]
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ unsafe fn GetParameter(&self, cx: *mut JSContext, parameter: u32) -> JSVal {
+ self.base.GetParameter(cx, parameter)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn GetError(&self) -> u32 {
+ self.base.GetError()
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.2
+ fn GetContextAttributes(&self) -> Option<WebGLContextAttributes> {
+ self.base.GetContextAttributes()
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.14
+ fn GetSupportedExtensions(&self) -> Option<Vec<DOMString>> {
+ self.base.GetSupportedExtensions()
+ }
+
+ #[allow(unsafe_code)]
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.14
+ unsafe fn GetExtension(&self, cx: *mut JSContext, name: DOMString) -> Option<NonNullJSObjectPtr> {
+ self.base.GetExtension(cx, name)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn ActiveTexture(&self, texture: u32) {
+ self.base.ActiveTexture(texture)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn BlendColor(&self, r: f32, g: f32, b: f32, a: f32) {
+ self.base.BlendColor(r, g, b, a)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn BlendEquation(&self, mode: u32) {
+ self.base.BlendEquation(mode)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn BlendEquationSeparate(&self, mode_rgb: u32, mode_alpha: u32) {
+ self.base.BlendEquationSeparate(mode_rgb, mode_alpha)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn BlendFunc(&self, src_factor: u32, dest_factor: u32) {
+ self.base.BlendFunc(src_factor, dest_factor)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn BlendFuncSeparate(&self, src_rgb: u32, dest_rgb: u32, src_alpha: u32, dest_alpha: u32) {
+ self.base.BlendFuncSeparate(src_rgb, dest_rgb, src_alpha, dest_alpha)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ fn AttachShader(&self, program: Option<&WebGLProgram>, shader: Option<&WebGLShader>) {
+ self.base.AttachShader(program, shader)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ fn DetachShader(&self, program: Option<&WebGLProgram>, shader: Option<&WebGLShader>) {
+ self.base.DetachShader(program, shader)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ fn BindAttribLocation(&self, program: Option<&WebGLProgram>,
+ index: u32, name: DOMString) {
+ self.base.BindAttribLocation(program, index, name)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
+ fn BindBuffer(&self, target: u32, buffer: Option<&WebGLBuffer>) {
+ self.base.BindBuffer(target, buffer)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.6
+ fn BindFramebuffer(&self, target: u32, framebuffer: Option<&WebGLFramebuffer>) {
+ self.base.BindFramebuffer(target, framebuffer)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.7
+ fn BindRenderbuffer(&self, target: u32, renderbuffer: Option<&WebGLRenderbuffer>) {
+ self.base.BindRenderbuffer(target, renderbuffer)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
+ fn BindTexture(&self, target: u32, texture: Option<&WebGLTexture>) {
+ self.base.BindTexture(target, texture)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
+ fn GenerateMipmap(&self, target: u32) {
+ self.base.GenerateMipmap(target)
+ }
+
+ #[allow(unsafe_code)]
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
+ unsafe fn BufferData(&self, cx: *mut JSContext, target: u32, data: *mut JSObject, usage: u32) -> Fallible<()> {
+ self.base.BufferData(cx, target, data, usage)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
+ fn BufferData_(&self, target: u32, size: i64, usage: u32) -> Fallible<()> {
+ self.base.BufferData_(target, size, usage)
+ }
+
+ #[allow(unsafe_code)]
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
+ unsafe fn BufferSubData(&self, cx: *mut JSContext, target: u32, offset: i64, data: *mut JSObject) -> Fallible<()> {
+ self.base.BufferSubData(cx, target, offset, data)
+ }
+
+ #[allow(unsafe_code)]
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
+ unsafe fn CompressedTexImage2D(&self, cx: *mut JSContext, target: u32, level: i32, internal_format: u32,
+ width: i32, height: i32, border: i32, pixels: *mut JSObject) -> Fallible<()> {
+ self.base.CompressedTexImage2D(cx, target, level, internal_format, width, height, border, pixels)
+ }
+
+ #[allow(unsafe_code)]
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
+ unsafe fn CompressedTexSubImage2D(&self, cx: *mut JSContext, target: u32, level: i32,
+ xoffset: i32, yoffset: i32, width: i32, height: i32,
+ format: u32, pixels: *mut JSObject) -> Fallible<()> {
+ self.base.CompressedTexSubImage2D(cx, target, level, xoffset, yoffset, width, height, format, pixels)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
+ fn CopyTexImage2D(&self, target: u32, level: i32, internal_format: u32,
+ x: i32, y: i32, width: i32, height: i32, border: i32) {
+ self.base.CopyTexImage2D(target, level, internal_format, x, y, width, height, border)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
+ fn CopyTexSubImage2D(&self, target: u32, level: i32, xoffset: i32, yoffset: i32,
+ x: i32, y: i32, width: i32, height: i32) {
+ self.base.CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.11
+ fn Clear(&self, mask: u32) {
+ self.base.Clear(mask)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn ClearColor(&self, red: f32, green: f32, blue: f32, alpha: f32) {
+ self.base.ClearColor(red, green, blue, alpha)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn ClearDepth(&self, depth: f32) {
+ self.base.ClearDepth(depth)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn ClearStencil(&self, stencil: i32) {
+ self.base.ClearStencil(stencil)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn ColorMask(&self, r: bool, g: bool, b: bool, a: bool) {
+ self.base.ColorMask(r, g, b, a)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn CullFace(&self, mode: u32) {
+ self.base.CullFace(mode)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn FrontFace(&self, mode: u32) {
+ self.base.FrontFace(mode)
+ }
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn DepthFunc(&self, func: u32) {
+ self.base.DepthFunc(func)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn DepthMask(&self, flag: bool) {
+ self.base.DepthMask(flag)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn DepthRange(&self, near: f32, far: f32) {
+ self.base.DepthRange(near, far)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn Enable(&self, cap: u32) {
+ self.base.Enable(cap)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn Disable(&self, cap: u32) {
+ self.base.Disable(cap)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ fn CompileShader(&self, shader: Option<&WebGLShader>) {
+ self.base.CompileShader(shader)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
+ fn CreateBuffer(&self) -> Option<DomRoot<WebGLBuffer>> {
+ self.base.CreateBuffer()
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.6
+ fn CreateFramebuffer(&self) -> Option<DomRoot<WebGLFramebuffer>> {
+ self.base.CreateFramebuffer()
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.7
+ fn CreateRenderbuffer(&self) -> Option<DomRoot<WebGLRenderbuffer>> {
+ self.base.CreateRenderbuffer()
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
+ fn CreateTexture(&self) -> Option<DomRoot<WebGLTexture>> {
+ self.base.CreateTexture()
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ fn CreateProgram(&self) -> Option<DomRoot<WebGLProgram>> {
+ self.base.CreateProgram()
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ fn CreateShader(&self, shader_type: u32) -> Option<DomRoot<WebGLShader>> {
+ self.base.CreateShader(shader_type)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
+ fn DeleteBuffer(&self, buffer: Option<&WebGLBuffer>) {
+ self.base.DeleteBuffer(buffer)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.6
+ fn DeleteFramebuffer(&self, framebuffer: Option<&WebGLFramebuffer>) {
+ self.base.DeleteFramebuffer(framebuffer)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.7
+ fn DeleteRenderbuffer(&self, renderbuffer: Option<&WebGLRenderbuffer>) {
+ self.base.DeleteRenderbuffer(renderbuffer)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
+ fn DeleteTexture(&self, texture: Option<&WebGLTexture>) {
+ self.base.DeleteTexture(texture)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ fn DeleteProgram(&self, program: Option<&WebGLProgram>) {
+ self.base.DeleteProgram(program)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ fn DeleteShader(&self, shader: Option<&WebGLShader>) {
+ self.base.DeleteShader(shader)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.11
+ fn DrawArrays(&self, mode: u32, first: i32, count: i32) {
+ self.base.DrawArrays(mode, first, count)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.11
+ fn DrawElements(&self, mode: u32, count: i32, type_: u32, offset: i64) {
+ self.base.DrawElements(mode, count, type_, offset)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ fn EnableVertexAttribArray(&self, attrib_id: u32) {
+ self.base.EnableVertexAttribArray(attrib_id)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ fn DisableVertexAttribArray(&self, attrib_id: u32) {
+ self.base.DisableVertexAttribArray(attrib_id)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ fn GetActiveUniform(&self, program: Option<&WebGLProgram>, index: u32) -> Option<DomRoot<WebGLActiveInfo>> {
+ self.base.GetActiveUniform(program, index)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ fn GetActiveAttrib(&self, program: Option<&WebGLProgram>, index: u32) -> Option<DomRoot<WebGLActiveInfo>> {
+ self.base.GetActiveAttrib(program, index)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ fn GetAttribLocation(&self, program: Option<&WebGLProgram>, name: DOMString) -> i32 {
+ self.base.GetAttribLocation(program, name)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ fn GetProgramInfoLog(&self, program: Option<&WebGLProgram>) -> Option<DOMString> {
+ self.base.GetProgramInfoLog(program)
+ }
+
+ #[allow(unsafe_code)]
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ unsafe fn GetProgramParameter(&self, cx: *mut JSContext, program: Option<&WebGLProgram>, param_id: u32) -> JSVal {
+ self.base.GetProgramParameter(cx, program, param_id)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ fn GetShaderInfoLog(&self, shader: Option<&WebGLShader>) -> Option<DOMString> {
+ self.base.GetShaderInfoLog(shader)
+ }
+
+ #[allow(unsafe_code)]
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ unsafe fn GetShaderParameter(&self, cx: *mut JSContext, shader: Option<&WebGLShader>, param_id: u32) -> JSVal {
+ self.base.GetShaderParameter(cx, shader, param_id)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ fn GetShaderPrecisionFormat(&self,
+ shader_type: u32,
+ precision_type: u32)
+ -> Option<DomRoot<WebGLShaderPrecisionFormat>> {
+ self.base.GetShaderPrecisionFormat(shader_type, precision_type)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ fn GetUniformLocation(&self,
+ program: Option<&WebGLProgram>,
+ name: DOMString) -> Option<DomRoot<WebGLUniformLocation>> {
+ self.base.GetUniformLocation(program, name)
+ }
+
+ #[allow(unsafe_code)]
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ unsafe fn GetVertexAttrib(&self, cx: *mut JSContext, index: u32, pname: u32) -> JSVal {
+ self.base.GetVertexAttrib(cx, index, pname)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ fn GetVertexAttribOffset(&self, index: u32, pname: u32) -> i64 {
+ self.base.GetVertexAttribOffset(index, pname)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn Hint(&self, target: u32, mode: u32) {
+ self.base.Hint(target, mode)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
+ fn IsBuffer(&self, buffer: Option<&WebGLBuffer>) -> bool {
+ self.base.IsBuffer(buffer)
+ }
+
+ // TODO: We could write this without IPC, recording the calls to `enable` and `disable`.
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn IsEnabled(&self, cap: u32) -> bool {
+ self.base.IsEnabled(cap)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.6
+ fn IsFramebuffer(&self, frame_buffer: Option<&WebGLFramebuffer>) -> bool {
+ self.base.IsFramebuffer(frame_buffer)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ fn IsProgram(&self, program: Option<&WebGLProgram>) -> bool {
+ self.base.IsProgram(program)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.7
+ fn IsRenderbuffer(&self, render_buffer: Option<&WebGLRenderbuffer>) -> bool {
+ self.base.IsRenderbuffer(render_buffer)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ fn IsShader(&self, shader: Option<&WebGLShader>) -> bool {
+ self.base.IsShader(shader)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
+ fn IsTexture(&self, texture: Option<&WebGLTexture>) -> bool {
+ self.base.IsTexture(texture)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn LineWidth(&self, width: f32) {
+ self.base.LineWidth(width)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn PixelStorei(&self, param_name: u32, param_value: i32) {
+ self.base.PixelStorei(param_name, param_value)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn PolygonOffset(&self, factor: f32, units: f32) {
+ self.base.PolygonOffset(factor, units)
+ }
+
+ #[allow(unsafe_code)]
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.12
+ unsafe fn ReadPixels(&self, cx: *mut JSContext, x: i32, y: i32, width: i32, height: i32,
+ format: u32, pixel_type: u32, pixels: *mut JSObject) -> Fallible<()> {
+ self.base.ReadPixels(cx, x, y, width, height, format, pixel_type, pixels)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn SampleCoverage(&self, value: f32, invert: bool) {
+ self.base.SampleCoverage(value, invert)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.4
+ fn Scissor(&self, x: i32, y: i32, width: i32, height: i32) {
+ self.base.Scissor(x, y, width, height)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn StencilFunc(&self, func: u32, ref_: i32, mask: u32) {
+ self.base.StencilFunc(func, ref_, mask)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn StencilFuncSeparate(&self, face: u32, func: u32, ref_: i32, mask: u32) {
+ self.base.StencilFuncSeparate(face, func, ref_, mask)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn StencilMask(&self, mask: u32) {
+ self.base.StencilMask(mask)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn StencilMaskSeparate(&self, face: u32, mask: u32) {
+ self.base.StencilMaskSeparate(face, mask)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn StencilOp(&self, fail: u32, zfail: u32, zpass: u32) {
+ self.base.StencilOp(fail, zfail, zpass)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn StencilOpSeparate(&self, face: u32, fail: u32, zfail: u32, zpass: u32) {
+ self.base.StencilOpSeparate(face, fail, zfail, zpass)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ fn LinkProgram(&self, program: Option<&WebGLProgram>) {
+ self.base.LinkProgram(program)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ fn ShaderSource(&self, shader: Option<&WebGLShader>, source: DOMString) {
+ self.base.ShaderSource(shader, source)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ fn GetShaderSource(&self, shader: Option<&WebGLShader>) -> Option<DOMString> {
+ self.base.GetShaderSource(shader)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ fn Uniform1f(&self,
+ uniform: Option<&WebGLUniformLocation>,
+ val: f32) {
+ self.base.Uniform1f(uniform, val)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ fn Uniform1i(&self,
+ uniform: Option<&WebGLUniformLocation>,
+ val: i32) {
+ self.base.Uniform1i(uniform, val)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ #[allow(unsafe_code)]
+ unsafe fn Uniform1iv(&self,
+ cx: *mut JSContext,
+ uniform: Option<&WebGLUniformLocation>,
+ data: *mut JSObject) -> Fallible<()> {
+ self.base.Uniform1iv(cx, uniform, data)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ #[allow(unsafe_code)]
+ unsafe fn Uniform1fv(&self,
+ cx: *mut JSContext,
+ uniform: Option<&WebGLUniformLocation>,
+ data: *mut JSObject) -> Fallible<()> {
+ self.base.Uniform1fv(cx, uniform, data)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ fn Uniform2f(&self,
+ uniform: Option<&WebGLUniformLocation>,
+ x: f32, y: f32) {
+ self.base.Uniform2f(uniform, x, y)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ #[allow(unsafe_code)]
+ unsafe fn Uniform2fv(&self,
+ cx: *mut JSContext,
+ uniform: Option<&WebGLUniformLocation>,
+ data: *mut JSObject) -> Fallible<()> {
+ self.base.Uniform2fv(cx, uniform, data)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ fn Uniform2i(&self,
+ uniform: Option<&WebGLUniformLocation>,
+ x: i32, y: i32) {
+ self.base.Uniform2i(uniform, x, y)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ #[allow(unsafe_code)]
+ unsafe fn Uniform2iv(&self,
+ cx: *mut JSContext,
+ uniform: Option<&WebGLUniformLocation>,
+ data: *mut JSObject) -> Fallible<()> {
+ self.base.Uniform2iv(cx, uniform, data)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ fn Uniform3f(&self,
+ uniform: Option<&WebGLUniformLocation>,
+ x: f32, y: f32, z: f32) {
+ self.base.Uniform3f(uniform, x, y, z)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ #[allow(unsafe_code)]
+ unsafe fn Uniform3fv(&self,
+ cx: *mut JSContext,
+ uniform: Option<&WebGLUniformLocation>,
+ data: *mut JSObject) -> Fallible<()> {
+ self.base.Uniform3fv(cx, uniform, data)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ fn Uniform3i(&self,
+ uniform: Option<&WebGLUniformLocation>,
+ x: i32, y: i32, z: i32) {
+ self.base.Uniform3i(uniform, x, y, z)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ #[allow(unsafe_code)]
+ unsafe fn Uniform3iv(&self,
+ cx: *mut JSContext,
+ uniform: Option<&WebGLUniformLocation>,
+ data: *mut JSObject) -> Fallible<()> {
+ self.base.Uniform3iv(cx, uniform, data)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ fn Uniform4i(&self,
+ uniform: Option<&WebGLUniformLocation>,
+ x: i32, y: i32, z: i32, w: i32) {
+ self.base.Uniform4i(uniform, x, y, z, w)
+ }
+
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ #[allow(unsafe_code)]
+ unsafe fn Uniform4iv(&self,
+ cx: *mut JSContext,
+ uniform: Option<&WebGLUniformLocation>,
+ data: *mut JSObject) -> Fallible<()> {
+ self.base.Uniform4iv(cx, uniform, data)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ fn Uniform4f(&self,
+ uniform: Option<&WebGLUniformLocation>,
+ x: f32, y: f32, z: f32, w: f32) {
+ self.base.Uniform4f(uniform, x, y, z, w)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ #[allow(unsafe_code)]
+ unsafe fn Uniform4fv(&self,
+ cx: *mut JSContext,
+ uniform: Option<&WebGLUniformLocation>,
+ data: *mut JSObject) -> Fallible<()> {
+ self.base.Uniform4fv(cx, uniform, data)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ #[allow(unsafe_code)]
+ unsafe fn UniformMatrix2fv(&self,
+ cx: *mut JSContext,
+ uniform: Option<&WebGLUniformLocation>,
+ transpose: bool,
+ data: *mut JSObject) -> Fallible<()> {
+ self.base.UniformMatrix2fv(cx, uniform, transpose, data)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ #[allow(unsafe_code)]
+ unsafe fn UniformMatrix3fv(&self,
+ cx: *mut JSContext,
+ uniform: Option<&WebGLUniformLocation>,
+ transpose: bool,
+ data: *mut JSObject) -> Fallible<()> {
+ self.base.UniformMatrix3fv(cx, uniform, transpose, data)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ #[allow(unsafe_code)]
+ unsafe fn UniformMatrix4fv(&self,
+ cx: *mut JSContext,
+ uniform: Option<&WebGLUniformLocation>,
+ transpose: bool,
+ data: *mut JSObject) -> Fallible<()> {
+ self.base.UniformMatrix4fv(cx, uniform, transpose, data)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ fn UseProgram(&self, program: Option<&WebGLProgram>) {
+ self.base.UseProgram(program)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ fn ValidateProgram(&self, program: Option<&WebGLProgram>) {
+ self.base.ValidateProgram(program)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ fn VertexAttrib1f(&self, indx: u32, x: f32) {
+ self.base.VertexAttrib1f(indx, x)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ #[allow(unsafe_code)]
+ unsafe fn VertexAttrib1fv(&self, cx: *mut JSContext, indx: u32, data: *mut JSObject) -> Fallible<()> {
+ self.base.VertexAttrib1fv(cx, indx, data)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ fn VertexAttrib2f(&self, indx: u32, x: f32, y: f32) {
+ self.base.VertexAttrib2f(indx, x, y)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ #[allow(unsafe_code)]
+ unsafe fn VertexAttrib2fv(&self, cx: *mut JSContext, indx: u32, data: *mut JSObject) -> Fallible<()> {
+ self.base.VertexAttrib2fv(cx, indx, data)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ fn VertexAttrib3f(&self, indx: u32, x: f32, y: f32, z: f32) {
+ self.base.VertexAttrib3f(indx, x, y, z)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ #[allow(unsafe_code)]
+ unsafe fn VertexAttrib3fv(&self, cx: *mut JSContext, indx: u32, data: *mut JSObject) -> Fallible<()> {
+ self.base.VertexAttrib3fv(cx, indx, data)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ fn VertexAttrib4f(&self, indx: u32, x: f32, y: f32, z: f32, w: f32) {
+ self.base.VertexAttrib4f(indx, x, y, z, w)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ #[allow(unsafe_code)]
+ unsafe fn VertexAttrib4fv(&self, cx: *mut JSContext, indx: u32, data: *mut JSObject) -> Fallible<()> {
+ self.base.VertexAttrib4fv(cx, indx, data)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ fn VertexAttribPointer(&self, attrib_id: u32, size: i32, data_type: u32,
+ normalized: bool, stride: i32, offset: i64) {
+ self.base.VertexAttribPointer(attrib_id, size, data_type, normalized, stride, offset)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.4
+ fn Viewport(&self, x: i32, y: i32, width: i32, height: i32) {
+ self.base.Viewport(x, y, width, height)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
+ #[allow(unsafe_code)]
+ unsafe fn TexImage2D(&self,
+ cx: *mut JSContext,
+ target: u32,
+ level: i32,
+ internal_format: u32,
+ width: i32,
+ height: i32,
+ border: i32,
+ format: u32,
+ data_type: u32,
+ data_ptr: *mut JSObject) -> Fallible<()> {
+ self.base.TexImage2D(cx, target, level, internal_format, width, height, border, format, data_type, data_ptr)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
+ fn TexImage2D_(&self,
+ target: u32,
+ level: i32,
+ internal_format: u32,
+ format: u32,
+ data_type: u32,
+ source: Option<ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement>) -> Fallible<()> {
+ self.base.TexImage2D_(target, level, internal_format, format, data_type, source)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
+ fn TexImageDOM(&self,
+ target: u32,
+ level: i32,
+ internal_format: u32,
+ width: i32,
+ height: i32,
+ format: u32,
+ data_type: u32,
+ source: &HTMLIFrameElement) -> Fallible<()> {
+ self.base.TexImageDOM(target, level, internal_format, width, height, format, data_type, source)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
+ #[allow(unsafe_code)]
+ unsafe fn TexSubImage2D(&self,
+ cx: *mut JSContext,
+ target: u32,
+ level: i32,
+ xoffset: i32,
+ yoffset: i32,
+ width: i32,
+ height: i32,
+ format: u32,
+ data_type: u32,
+ data_ptr: *mut JSObject) -> Fallible<()> {
+ self.base.TexSubImage2D(cx, target, level, xoffset, yoffset, width, height, format, data_type, data_ptr)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
+ fn TexSubImage2D_(&self,
+ target: u32,
+ level: i32,
+ xoffset: i32,
+ yoffset: i32,
+ format: u32,
+ data_type: u32,
+ source: Option<ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement>)
+ -> Fallible<()> {
+ self.base.TexSubImage2D_(target, level, xoffset, yoffset, format, data_type, source)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
+ fn TexParameterf(&self, target: u32, name: u32, value: f32) {
+ self.base.TexParameterf(target, name, value)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
+ fn TexParameteri(&self, target: u32, name: u32, value: i32) {
+ self.base.TexParameteri(target, name, value)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.6
+ fn CheckFramebufferStatus(&self, target: u32) -> u32 {
+ self.base.CheckFramebufferStatus(target)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.7
+ fn RenderbufferStorage(&self, target: u32, internal_format: u32,
+ width: i32, height: i32) {
+ self.base.RenderbufferStorage(target, internal_format, width, height)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.6
+ fn FramebufferRenderbuffer(&self, target: u32, attachment: u32,
+ renderbuffertarget: u32,
+ rb: Option<&WebGLRenderbuffer>) {
+ self.base.FramebufferRenderbuffer(target, attachment, renderbuffertarget, rb)
+ }
+
+ /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.6
+ fn FramebufferTexture2D(&self, target: u32, attachment: u32,
+ textarget: u32, texture: Option<&WebGLTexture>,
+ level: i32) {
+ self.base.FramebufferTexture2D(target, attachment, textarget, texture, level)
+ }
+}
+
+
+impl LayoutCanvasWebGLRenderingContextHelpers for LayoutDom<WebGL2RenderingContext> {
+ #[allow(unsafe_code)]
+ unsafe fn canvas_data_source(&self) -> HTMLCanvasDataSource {
+ HTMLCanvasDataSource::WebGL((*self.unsafe_get()).base.layout_handle())
+ }
+}
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index 514fac1e492..6a5cd9248db 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -4,7 +4,7 @@
use byteorder::{NativeEndian, ReadBytesExt, WriteBytesExt};
use canvas_traits::canvas::{byte_swap, multiply_u8_pixel};
-use canvas_traits::webgl::{WebGLContextShareMode, WebGLCommand, WebGLError};
+use canvas_traits::webgl::{WebGLContextShareMode, WebGLCommand, WebGLError, WebGLVersion};
use canvas_traits::webgl::{WebGLFramebufferBindingRequest, WebGLMsg, WebGLMsgSender, WebGLParameter, WebVRCommand};
use canvas_traits::webgl::DOMToTextureCommand;
use canvas_traits::webgl::WebGLError::*;
@@ -186,6 +186,7 @@ pub struct WebGLRenderingContext {
#[ignore_malloc_size_of = "Defined in webrender"]
webrender_image: Cell<Option<webrender_api::ImageKey>>,
share_mode: WebGLContextShareMode,
+ webgl_version: WebGLVersion,
#[ignore_malloc_size_of = "Defined in offscreen_gl_context"]
limits: GLLimits,
canvas: Dom<HTMLCanvasElement>,
@@ -211,18 +212,20 @@ pub struct WebGLRenderingContext {
}
impl WebGLRenderingContext {
- fn new_inherited(window: &Window,
- canvas: &HTMLCanvasElement,
- size: Size2D<i32>,
- attrs: GLContextAttributes)
- -> Result<WebGLRenderingContext, String> {
+ pub fn new_inherited(
+ window: &Window,
+ canvas: &HTMLCanvasElement,
+ webgl_version: WebGLVersion,
+ size: Size2D<i32>,
+ attrs: GLContextAttributes
+ ) -> Result<WebGLRenderingContext, String> {
if let Some(true) = PREFS.get("webgl.testing.context_creation_error").as_boolean() {
return Err("WebGL context creation error forced by pref `webgl.testing.context_creation_error`".into());
}
let (sender, receiver) = webgl_channel().unwrap();
let webgl_chan = window.webgl_chan();
- webgl_chan.send(WebGLMsg::CreateContext(size, attrs, sender))
+ webgl_chan.send(WebGLMsg::CreateContext(webgl_version, size, attrs, sender))
.unwrap();
let result = receiver.recv().unwrap();
@@ -232,6 +235,7 @@ impl WebGLRenderingContext {
webgl_sender: ctx_data.sender,
webrender_image: Cell::new(None),
share_mode: ctx_data.share_mode,
+ webgl_version,
limits: ctx_data.limits,
canvas: Dom::from_ref(canvas),
last_error: Cell::new(None),
@@ -254,9 +258,14 @@ impl WebGLRenderingContext {
}
#[allow(unrooted_must_root)]
- pub fn new(window: &Window, canvas: &HTMLCanvasElement, size: Size2D<i32>, attrs: GLContextAttributes)
- -> Option<DomRoot<WebGLRenderingContext>> {
- match WebGLRenderingContext::new_inherited(window, canvas, size, attrs) {
+ pub fn new(
+ window: &Window,
+ canvas: &HTMLCanvasElement,
+ webgl_version: WebGLVersion,
+ size: Size2D<i32>,
+ attrs: GLContextAttributes
+ ) -> Option<DomRoot<WebGLRenderingContext>> {
+ match WebGLRenderingContext::new_inherited(window, canvas, webgl_version, size, attrs) {
Ok(ctx) => Some(reflect_dom_object(Box::new(ctx), window, WebGLRenderingContextBinding::Wrap)),
Err(msg) => {
error!("Couldn't create WebGLRenderingContext: {}", msg);
@@ -1123,7 +1132,7 @@ impl WebGLRenderingContext {
receiver.recv().unwrap()
}
- fn layout_handle(&self) -> webrender_api::ImageKey {
+ pub fn layout_handle(&self) -> webrender_api::ImageKey {
match self.share_mode {
WebGLContextShareMode::SharedTexture => {
// WR using ExternalTexture requires a single update message.
@@ -1905,7 +1914,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
fn CompileShader(&self, shader: Option<&WebGLShader>) {
if let Some(shader) = shader {
- shader.compile(&self.extension_manager)
+ shader.compile(self.webgl_version, &self.extension_manager)
}
}
diff --git a/components/script/dom/webglshader.rs b/components/script/dom/webglshader.rs
index 781db93c8f2..3ce6b93ad77 100644
--- a/components/script/dom/webglshader.rs
+++ b/components/script/dom/webglshader.rs
@@ -5,6 +5,7 @@
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use angle::hl::{BuiltInResources, Output, ShaderValidator};
use canvas_traits::webgl::{webgl_channel, WebGLCommand, WebGLMsgSender, WebGLParameter, WebGLResult, WebGLShaderId};
+use canvas_traits::webgl::WebGLVersion;
use dom::bindings::cell::DomRefCell;
use dom::bindings::codegen::Bindings::WebGLShaderBinding;
use dom::bindings::reflector::reflect_dom_object;
@@ -99,7 +100,7 @@ impl WebGLShader {
}
/// glCompileShader
- pub fn compile(&self, ext: &WebGLExtensions) {
+ pub fn compile(&self, version: WebGLVersion, ext: &WebGLExtensions) {
if self.compilation_status.get() != ShaderCompilationStatus::NotCompiled {
debug!("Compiling already compiled shader {}", self.id);
}
@@ -108,9 +109,19 @@ impl WebGLShader {
let mut params = BuiltInResources::default();
params.FragmentPrecisionHigh = 1;
params.OES_standard_derivatives = ext.is_enabled::<OESStandardDerivatives>() as i32;
- let validator = ShaderValidator::for_webgl(self.gl_type,
- SHADER_OUTPUT_FORMAT,
- &params).unwrap();
+ let validator = match version {
+ WebGLVersion::WebGL1 => {
+ ShaderValidator::for_webgl(self.gl_type,
+ SHADER_OUTPUT_FORMAT,
+ &params).unwrap()
+ },
+ WebGLVersion::WebGL2 => {
+ ShaderValidator::for_webgl2(self.gl_type,
+ SHADER_OUTPUT_FORMAT,
+ &params).unwrap()
+ },
+ };
+
match validator.compile_and_translate(&[source]) {
Ok(translated_source) => {
debug!("Shader translated: {}", translated_source);
diff --git a/components/script/dom/webidls/HTMLCanvasElement.webidl b/components/script/dom/webidls/HTMLCanvasElement.webidl
index ca5a02e7385..f5826c34fd2 100644
--- a/components/script/dom/webidls/HTMLCanvasElement.webidl
+++ b/components/script/dom/webidls/HTMLCanvasElement.webidl
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// https://html.spec.whatwg.org/multipage/#htmlcanvaselement
-typedef (CanvasRenderingContext2D or WebGLRenderingContext) RenderingContext;
+typedef (CanvasRenderingContext2D or WebGLRenderingContext or WebGL2RenderingContext) RenderingContext;
[HTMLConstructor]
interface HTMLCanvasElement : HTMLElement {
diff --git a/components/script/dom/webidls/WebGL2RenderingContext.webidl b/components/script/dom/webidls/WebGL2RenderingContext.webidl
new file mode 100644
index 00000000000..96503770aac
--- /dev/null
+++ b/components/script/dom/webidls/WebGL2RenderingContext.webidl
@@ -0,0 +1,582 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+//
+// WebGL IDL definitions scraped from the Khronos specification:
+// https://www.khronos.org/registry/webgl/specs/latest/
+//
+// This IDL depends on the typed array specification defined at:
+// https://www.khronos.org/registry/typedarray/specs/latest/typedarrays.idl
+
+typedef long long GLint64;
+typedef unsigned long long GLuint64;
+
+
+// interface WebGLQuery : WebGLObject {
+// };
+
+// interface WebGLSampler : WebGLObject {
+// };
+
+// interface WebGLSync : WebGLObject {
+// };
+
+// interface WebGLTransformFeedback : WebGLObject {
+// };
+
+// interface WebGLVertexArrayObject : WebGLObject {
+// };
+
+// typedef ([AllowShared] Uint32Array or sequence<GLuint>) Uint32List;
+
+[NoInterfaceObject]
+interface WebGL2RenderingContextBase
+{
+ const GLenum READ_BUFFER = 0x0C02;
+ const GLenum UNPACK_ROW_LENGTH = 0x0CF2;
+ const GLenum UNPACK_SKIP_ROWS = 0x0CF3;
+ const GLenum UNPACK_SKIP_PIXELS = 0x0CF4;
+ const GLenum PACK_ROW_LENGTH = 0x0D02;
+ const GLenum PACK_SKIP_ROWS = 0x0D03;
+ const GLenum PACK_SKIP_PIXELS = 0x0D04;
+ const GLenum COLOR = 0x1800;
+ const GLenum DEPTH = 0x1801;
+ const GLenum STENCIL = 0x1802;
+ const GLenum RED = 0x1903;
+ const GLenum RGB8 = 0x8051;
+ const GLenum RGBA8 = 0x8058;
+ const GLenum RGB10_A2 = 0x8059;
+ const GLenum TEXTURE_BINDING_3D = 0x806A;
+ const GLenum UNPACK_SKIP_IMAGES = 0x806D;
+ const GLenum UNPACK_IMAGE_HEIGHT = 0x806E;
+ const GLenum TEXTURE_3D = 0x806F;
+ const GLenum TEXTURE_WRAP_R = 0x8072;
+ const GLenum MAX_3D_TEXTURE_SIZE = 0x8073;
+ const GLenum UNSIGNED_INT_2_10_10_10_REV = 0x8368;
+ const GLenum MAX_ELEMENTS_VERTICES = 0x80E8;
+ const GLenum MAX_ELEMENTS_INDICES = 0x80E9;
+ const GLenum TEXTURE_MIN_LOD = 0x813A;
+ const GLenum TEXTURE_MAX_LOD = 0x813B;
+ const GLenum TEXTURE_BASE_LEVEL = 0x813C;
+ const GLenum TEXTURE_MAX_LEVEL = 0x813D;
+ const GLenum MIN = 0x8007;
+ const GLenum MAX = 0x8008;
+ const GLenum DEPTH_COMPONENT24 = 0x81A6;
+ const GLenum MAX_TEXTURE_LOD_BIAS = 0x84FD;
+ const GLenum TEXTURE_COMPARE_MODE = 0x884C;
+ const GLenum TEXTURE_COMPARE_FUNC = 0x884D;
+ const GLenum CURRENT_QUERY = 0x8865;
+ const GLenum QUERY_RESULT = 0x8866;
+ const GLenum QUERY_RESULT_AVAILABLE = 0x8867;
+ const GLenum STREAM_READ = 0x88E1;
+ const GLenum STREAM_COPY = 0x88E2;
+ const GLenum STATIC_READ = 0x88E5;
+ const GLenum STATIC_COPY = 0x88E6;
+ const GLenum DYNAMIC_READ = 0x88E9;
+ const GLenum DYNAMIC_COPY = 0x88EA;
+ const GLenum MAX_DRAW_BUFFERS = 0x8824;
+ const GLenum DRAW_BUFFER0 = 0x8825;
+ const GLenum DRAW_BUFFER1 = 0x8826;
+ const GLenum DRAW_BUFFER2 = 0x8827;
+ const GLenum DRAW_BUFFER3 = 0x8828;
+ const GLenum DRAW_BUFFER4 = 0x8829;
+ const GLenum DRAW_BUFFER5 = 0x882A;
+ const GLenum DRAW_BUFFER6 = 0x882B;
+ const GLenum DRAW_BUFFER7 = 0x882C;
+ const GLenum DRAW_BUFFER8 = 0x882D;
+ const GLenum DRAW_BUFFER9 = 0x882E;
+ const GLenum DRAW_BUFFER10 = 0x882F;
+ const GLenum DRAW_BUFFER11 = 0x8830;
+ const GLenum DRAW_BUFFER12 = 0x8831;
+ const GLenum DRAW_BUFFER13 = 0x8832;
+ const GLenum DRAW_BUFFER14 = 0x8833;
+ const GLenum DRAW_BUFFER15 = 0x8834;
+ const GLenum MAX_FRAGMENT_UNIFORM_COMPONENTS = 0x8B49;
+ const GLenum MAX_VERTEX_UNIFORM_COMPONENTS = 0x8B4A;
+ const GLenum SAMPLER_3D = 0x8B5F;
+ const GLenum SAMPLER_2D_SHADOW = 0x8B62;
+ const GLenum FRAGMENT_SHADER_DERIVATIVE_HINT = 0x8B8B;
+ const GLenum PIXEL_PACK_BUFFER = 0x88EB;
+ const GLenum PIXEL_UNPACK_BUFFER = 0x88EC;
+ const GLenum PIXEL_PACK_BUFFER_BINDING = 0x88ED;
+ const GLenum PIXEL_UNPACK_BUFFER_BINDING = 0x88EF;
+ const GLenum FLOAT_MAT2x3 = 0x8B65;
+ const GLenum FLOAT_MAT2x4 = 0x8B66;
+ const GLenum FLOAT_MAT3x2 = 0x8B67;
+ const GLenum FLOAT_MAT3x4 = 0x8B68;
+ const GLenum FLOAT_MAT4x2 = 0x8B69;
+ const GLenum FLOAT_MAT4x3 = 0x8B6A;
+ const GLenum SRGB = 0x8C40;
+ const GLenum SRGB8 = 0x8C41;
+ const GLenum SRGB8_ALPHA8 = 0x8C43;
+ const GLenum COMPARE_REF_TO_TEXTURE = 0x884E;
+ const GLenum RGBA32F = 0x8814;
+ const GLenum RGB32F = 0x8815;
+ const GLenum RGBA16F = 0x881A;
+ const GLenum RGB16F = 0x881B;
+ const GLenum VERTEX_ATTRIB_ARRAY_INTEGER = 0x88FD;
+ const GLenum MAX_ARRAY_TEXTURE_LAYERS = 0x88FF;
+ const GLenum MIN_PROGRAM_TEXEL_OFFSET = 0x8904;
+ const GLenum MAX_PROGRAM_TEXEL_OFFSET = 0x8905;
+ const GLenum MAX_VARYING_COMPONENTS = 0x8B4B;
+ const GLenum TEXTURE_2D_ARRAY = 0x8C1A;
+ const GLenum TEXTURE_BINDING_2D_ARRAY = 0x8C1D;
+ const GLenum R11F_G11F_B10F = 0x8C3A;
+ const GLenum UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B;
+ const GLenum RGB9_E5 = 0x8C3D;
+ const GLenum UNSIGNED_INT_5_9_9_9_REV = 0x8C3E;
+ const GLenum TRANSFORM_FEEDBACK_BUFFER_MODE = 0x8C7F;
+ const GLenum MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 0x8C80;
+ const GLenum TRANSFORM_FEEDBACK_VARYINGS = 0x8C83;
+ const GLenum TRANSFORM_FEEDBACK_BUFFER_START = 0x8C84;
+ const GLenum TRANSFORM_FEEDBACK_BUFFER_SIZE = 0x8C85;
+ const GLenum TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8C88;
+ const GLenum RASTERIZER_DISCARD = 0x8C89;
+ const GLenum MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 0x8C8A;
+ const GLenum MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 0x8C8B;
+ const GLenum INTERLEAVED_ATTRIBS = 0x8C8C;
+ const GLenum SEPARATE_ATTRIBS = 0x8C8D;
+ const GLenum TRANSFORM_FEEDBACK_BUFFER = 0x8C8E;
+ const GLenum TRANSFORM_FEEDBACK_BUFFER_BINDING = 0x8C8F;
+ const GLenum RGBA32UI = 0x8D70;
+ const GLenum RGB32UI = 0x8D71;
+ const GLenum RGBA16UI = 0x8D76;
+ const GLenum RGB16UI = 0x8D77;
+ const GLenum RGBA8UI = 0x8D7C;
+ const GLenum RGB8UI = 0x8D7D;
+ const GLenum RGBA32I = 0x8D82;
+ const GLenum RGB32I = 0x8D83;
+ const GLenum RGBA16I = 0x8D88;
+ const GLenum RGB16I = 0x8D89;
+ const GLenum RGBA8I = 0x8D8E;
+ const GLenum RGB8I = 0x8D8F;
+ const GLenum RED_INTEGER = 0x8D94;
+ const GLenum RGB_INTEGER = 0x8D98;
+ const GLenum RGBA_INTEGER = 0x8D99;
+ const GLenum SAMPLER_2D_ARRAY = 0x8DC1;
+ const GLenum SAMPLER_2D_ARRAY_SHADOW = 0x8DC4;
+ const GLenum SAMPLER_CUBE_SHADOW = 0x8DC5;
+ const GLenum UNSIGNED_INT_VEC2 = 0x8DC6;
+ const GLenum UNSIGNED_INT_VEC3 = 0x8DC7;
+ const GLenum UNSIGNED_INT_VEC4 = 0x8DC8;
+ const GLenum INT_SAMPLER_2D = 0x8DCA;
+ const GLenum INT_SAMPLER_3D = 0x8DCB;
+ const GLenum INT_SAMPLER_CUBE = 0x8DCC;
+ const GLenum INT_SAMPLER_2D_ARRAY = 0x8DCF;
+ const GLenum UNSIGNED_INT_SAMPLER_2D = 0x8DD2;
+ const GLenum UNSIGNED_INT_SAMPLER_3D = 0x8DD3;
+ const GLenum UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4;
+ const GLenum UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7;
+ const GLenum DEPTH_COMPONENT32F = 0x8CAC;
+ const GLenum DEPTH32F_STENCIL8 = 0x8CAD;
+ const GLenum FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD;
+ const GLenum FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210;
+ const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 0x8211;
+ const GLenum FRAMEBUFFER_ATTACHMENT_RED_SIZE = 0x8212;
+ const GLenum FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 0x8213;
+ const GLenum FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 0x8214;
+ const GLenum FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 0x8215;
+ const GLenum FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 0x8216;
+ const GLenum FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 0x8217;
+ const GLenum FRAMEBUFFER_DEFAULT = 0x8218;
+ // const GLenum DEPTH_STENCIL_ATTACHMENT = 0x821A;
+ // const GLenum DEPTH_STENCIL = 0x84F9;
+ const GLenum UNSIGNED_INT_24_8 = 0x84FA;
+ const GLenum DEPTH24_STENCIL8 = 0x88F0;
+ const GLenum UNSIGNED_NORMALIZED = 0x8C17;
+ const GLenum DRAW_FRAMEBUFFER_BINDING = 0x8CA6; /* Same as FRAMEBUFFER_BINDING */
+ const GLenum READ_FRAMEBUFFER = 0x8CA8;
+ const GLenum DRAW_FRAMEBUFFER = 0x8CA9;
+ const GLenum READ_FRAMEBUFFER_BINDING = 0x8CAA;
+ const GLenum RENDERBUFFER_SAMPLES = 0x8CAB;
+ const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 0x8CD4;
+ const GLenum MAX_COLOR_ATTACHMENTS = 0x8CDF;
+ const GLenum COLOR_ATTACHMENT1 = 0x8CE1;
+ const GLenum COLOR_ATTACHMENT2 = 0x8CE2;
+ const GLenum COLOR_ATTACHMENT3 = 0x8CE3;
+ const GLenum COLOR_ATTACHMENT4 = 0x8CE4;
+ const GLenum COLOR_ATTACHMENT5 = 0x8CE5;
+ const GLenum COLOR_ATTACHMENT6 = 0x8CE6;
+ const GLenum COLOR_ATTACHMENT7 = 0x8CE7;
+ const GLenum COLOR_ATTACHMENT8 = 0x8CE8;
+ const GLenum COLOR_ATTACHMENT9 = 0x8CE9;
+ const GLenum COLOR_ATTACHMENT10 = 0x8CEA;
+ const GLenum COLOR_ATTACHMENT11 = 0x8CEB;
+ const GLenum COLOR_ATTACHMENT12 = 0x8CEC;
+ const GLenum COLOR_ATTACHMENT13 = 0x8CED;
+ const GLenum COLOR_ATTACHMENT14 = 0x8CEE;
+ const GLenum COLOR_ATTACHMENT15 = 0x8CEF;
+ const GLenum FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0x8D56;
+ const GLenum MAX_SAMPLES = 0x8D57;
+ const GLenum HALF_FLOAT = 0x140B;
+ const GLenum RG = 0x8227;
+ const GLenum RG_INTEGER = 0x8228;
+ const GLenum R8 = 0x8229;
+ const GLenum RG8 = 0x822B;
+ const GLenum R16F = 0x822D;
+ const GLenum R32F = 0x822E;
+ const GLenum RG16F = 0x822F;
+ const GLenum RG32F = 0x8230;
+ const GLenum R8I = 0x8231;
+ const GLenum R8UI = 0x8232;
+ const GLenum R16I = 0x8233;
+ const GLenum R16UI = 0x8234;
+ const GLenum R32I = 0x8235;
+ const GLenum R32UI = 0x8236;
+ const GLenum RG8I = 0x8237;
+ const GLenum RG8UI = 0x8238;
+ const GLenum RG16I = 0x8239;
+ const GLenum RG16UI = 0x823A;
+ const GLenum RG32I = 0x823B;
+ const GLenum RG32UI = 0x823C;
+ const GLenum VERTEX_ARRAY_BINDING = 0x85B5;
+ const GLenum R8_SNORM = 0x8F94;
+ const GLenum RG8_SNORM = 0x8F95;
+ const GLenum RGB8_SNORM = 0x8F96;
+ const GLenum RGBA8_SNORM = 0x8F97;
+ const GLenum SIGNED_NORMALIZED = 0x8F9C;
+ const GLenum COPY_READ_BUFFER = 0x8F36;
+ const GLenum COPY_WRITE_BUFFER = 0x8F37;
+ const GLenum COPY_READ_BUFFER_BINDING = 0x8F36; /* Same as COPY_READ_BUFFER */
+ const GLenum COPY_WRITE_BUFFER_BINDING = 0x8F37; /* Same as COPY_WRITE_BUFFER */
+ const GLenum UNIFORM_BUFFER = 0x8A11;
+ const GLenum UNIFORM_BUFFER_BINDING = 0x8A28;
+ const GLenum UNIFORM_BUFFER_START = 0x8A29;
+ const GLenum UNIFORM_BUFFER_SIZE = 0x8A2A;
+ const GLenum MAX_VERTEX_UNIFORM_BLOCKS = 0x8A2B;
+ const GLenum MAX_FRAGMENT_UNIFORM_BLOCKS = 0x8A2D;
+ const GLenum MAX_COMBINED_UNIFORM_BLOCKS = 0x8A2E;
+ const GLenum MAX_UNIFORM_BUFFER_BINDINGS = 0x8A2F;
+ const GLenum MAX_UNIFORM_BLOCK_SIZE = 0x8A30;
+ const GLenum MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 0x8A31;
+ const GLenum MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 0x8A33;
+ const GLenum UNIFORM_BUFFER_OFFSET_ALIGNMENT = 0x8A34;
+ const GLenum ACTIVE_UNIFORM_BLOCKS = 0x8A36;
+ const GLenum UNIFORM_TYPE = 0x8A37;
+ const GLenum UNIFORM_SIZE = 0x8A38;
+ const GLenum UNIFORM_BLOCK_INDEX = 0x8A3A;
+ const GLenum UNIFORM_OFFSET = 0x8A3B;
+ const GLenum UNIFORM_ARRAY_STRIDE = 0x8A3C;
+ const GLenum UNIFORM_MATRIX_STRIDE = 0x8A3D;
+ const GLenum UNIFORM_IS_ROW_MAJOR = 0x8A3E;
+ const GLenum UNIFORM_BLOCK_BINDING = 0x8A3F;
+ const GLenum UNIFORM_BLOCK_DATA_SIZE = 0x8A40;
+ const GLenum UNIFORM_BLOCK_ACTIVE_UNIFORMS = 0x8A42;
+ const GLenum UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 0x8A43;
+ const GLenum UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 0x8A44;
+ const GLenum UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 0x8A46;
+ const GLenum INVALID_INDEX = 0xFFFFFFFF;
+ const GLenum MAX_VERTEX_OUTPUT_COMPONENTS = 0x9122;
+ const GLenum MAX_FRAGMENT_INPUT_COMPONENTS = 0x9125;
+ const GLenum MAX_SERVER_WAIT_TIMEOUT = 0x9111;
+ const GLenum OBJECT_TYPE = 0x9112;
+ const GLenum SYNC_CONDITION = 0x9113;
+ const GLenum SYNC_STATUS = 0x9114;
+ const GLenum SYNC_FLAGS = 0x9115;
+ const GLenum SYNC_FENCE = 0x9116;
+ const GLenum SYNC_GPU_COMMANDS_COMPLETE = 0x9117;
+ const GLenum UNSIGNALED = 0x9118;
+ const GLenum SIGNALED = 0x9119;
+ const GLenum ALREADY_SIGNALED = 0x911A;
+ const GLenum TIMEOUT_EXPIRED = 0x911B;
+ const GLenum CONDITION_SATISFIED = 0x911C;
+ const GLenum WAIT_FAILED = 0x911D;
+ const GLenum SYNC_FLUSH_COMMANDS_BIT = 0x00000001;
+ const GLenum VERTEX_ATTRIB_ARRAY_DIVISOR = 0x88FE;
+ const GLenum ANY_SAMPLES_PASSED = 0x8C2F;
+ const GLenum ANY_SAMPLES_PASSED_CONSERVATIVE = 0x8D6A;
+ const GLenum SAMPLER_BINDING = 0x8919;
+ const GLenum RGB10_A2UI = 0x906F;
+ const GLenum INT_2_10_10_10_REV = 0x8D9F;
+ const GLenum TRANSFORM_FEEDBACK = 0x8E22;
+ const GLenum TRANSFORM_FEEDBACK_PAUSED = 0x8E23;
+ const GLenum TRANSFORM_FEEDBACK_ACTIVE = 0x8E24;
+ const GLenum TRANSFORM_FEEDBACK_BINDING = 0x8E25;
+ const GLenum TEXTURE_IMMUTABLE_FORMAT = 0x912F;
+ const GLenum MAX_ELEMENT_INDEX = 0x8D6B;
+ const GLenum TEXTURE_IMMUTABLE_LEVELS = 0x82DF;
+
+ const GLint64 TIMEOUT_IGNORED = -1;
+
+ /* WebGL-specific enums */
+ const GLenum MAX_CLIENT_WAIT_TIMEOUT_WEBGL = 0x9247;
+
+ /* Buffer objects */
+ // WebGL1:
+ // void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
+ // void bufferData(GLenum target, [AllowShared] BufferSource? srcData, GLenum usage);
+ // void bufferSubData(GLenum target, GLintptr dstByteOffset, [AllowShared] BufferSource srcData);
+ // WebGL2:
+ // void bufferData(GLenum target, [AllowShared] ArrayBufferView srcData, GLenum usage, GLuint srcOffset,
+ // optional GLuint length = 0);
+ // void bufferSubData(GLenum target, GLintptr dstByteOffset, [AllowShared] ArrayBufferView srcData,
+ // GLuint srcOffset, optional GLuint length = 0);
+
+ // void copyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset,
+ // GLintptr writeOffset, GLsizeiptr size);
+ // MapBufferRange, in particular its read-only and write-only modes,
+ // can not be exposed safely to JavaScript. GetBufferSubData
+ // replaces it for the purpose of fetching data back from the GPU.
+ // void getBufferSubData(GLenum target, GLintptr srcByteOffset, [AllowShared] ArrayBufferView dstBuffer,
+ // optional GLuint dstOffset = 0, optional GLuint length = 0);
+
+ /* Framebuffer objects */
+ // void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0,
+ // GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
+ // void framebufferTextureLayer(GLenum target, GLenum attachment, WebGLTexture? texture, GLint level,
+ // GLint layer);
+ // void invalidateFramebuffer(GLenum target, sequence<GLenum> attachments);
+ // void invalidateSubFramebuffer(GLenum target, sequence<GLenum> attachments,
+ // GLint x, GLint y, GLsizei width, GLsizei height);
+ // void readBuffer(GLenum src);
+
+ /* Renderbuffer objects */
+ // any getInternalformatParameter(GLenum target, GLenum internalformat, GLenum pname);
+ // void renderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat,
+ // GLsizei width, GLsizei height);
+
+ /* Texture objects */
+ // void texStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width,
+ // GLsizei height);
+ // void texStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width,
+ // GLsizei height, GLsizei depth);
+
+ // WebGL1 legacy entrypoints:
+ // void texImage2D(GLenum target, GLint level, GLint internalformat,
+ // GLsizei width, GLsizei height, GLint border, GLenum format,
+ // GLenum type, [AllowShared] ArrayBufferView? pixels);
+ // void texImage2D(GLenum target, GLint level, GLint internalformat,
+ // GLenum format, GLenum type, TexImageSource source); // May throw DOMException
+
+ // void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
+ // GLsizei width, GLsizei height,
+ // GLenum format, GLenum type, [AllowShared] ArrayBufferView? pixels);
+ // void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
+ // GLenum format, GLenum type, TexImageSource source); // May throw DOMException
+
+ // WebGL2 entrypoints:
+ // void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
+ // GLint border, GLenum format, GLenum type, GLintptr pboOffset);
+ // void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
+ // GLint border, GLenum format, GLenum type,
+ // TexImageSource source); // May throw DOMException
+ // void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
+ // GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView srcData,
+ // GLuint srcOffset);
+
+ // void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
+ // GLsizei depth, GLint border, GLenum format, GLenum type, GLintptr pboOffset);
+ // void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
+ // GLsizei depth, GLint border, GLenum format, GLenum type,
+ // TexImageSource source); // May throw DOMException
+ // void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
+ // GLsizei depth, GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView? srcData);
+ // void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
+ // GLsizei depth, GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView srcData,
+ // GLuint srcOffset);
+
+ // void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
+ // GLsizei height, GLenum format, GLenum type, GLintptr pboOffset);
+ // void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
+ // GLsizei height, GLenum format, GLenum type,
+ // TexImageSource source); // May throw DOMException
+ // void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
+ // GLsizei height, GLenum format, GLenum type, [AllowShared] ArrayBufferView srcData,
+ // GLuint srcOffset);
+
+ // void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
+ // GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
+ // GLintptr pboOffset);
+ // void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
+ // GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
+ // TexImageSource source); // May throw DOMException
+ // void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
+ // GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
+ // [AllowShared] ArrayBufferView? srcData, optional GLuint srcOffset = 0);
+
+ // void copyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
+ // GLint x, GLint y, GLsizei width, GLsizei height);
+
+ // void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width,
+ // GLsizei height, GLint border, GLsizei imageSize, GLintptr offset);
+ // void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width,
+ // GLsizei height, GLint border, [AllowShared] ArrayBufferView srcData,
+ // optional GLuint srcOffset = 0, optional GLuint srcLengthOverride = 0);
+
+ // void compressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width,
+ // GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLintptr offset);
+ // void compressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width,
+ // GLsizei height, GLsizei depth, GLint border, [AllowShared] ArrayBufferView srcData,
+ // optional GLuint srcOffset = 0, optional GLuint srcLengthOverride = 0);
+
+ // void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
+ // GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLintptr offset);
+ // void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
+ // GLsizei width, GLsizei height, GLenum format,
+ // [AllowShared] ArrayBufferView srcData,
+ // optional GLuint srcOffset = 0,
+ // optional GLuint srcLengthOverride = 0);
+
+ // void compressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
+ // GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+ // GLenum format, GLsizei imageSize, GLintptr offset);
+ // void compressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
+ // GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
+ // GLenum format, [AllowShared] ArrayBufferView srcData,
+ // optional GLuint srcOffset = 0,
+ // optional GLuint srcLengthOverride = 0);
+
+ /* Programs and shaders */
+ // [WebGLHandlesContextLoss] GLint getFragDataLocation(WebGLProgram program, DOMString name);
+
+ /* Uniforms */
+ // void uniform1ui(WebGLUniformLocation? location, GLuint v0);
+ // void uniform2ui(WebGLUniformLocation? location, GLuint v0, GLuint v1);
+ // void uniform3ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2);
+ // void uniform4ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
+
+ // void uniform1fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0,
+ // optional GLuint srcLength = 0);
+ // void uniform2fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0,
+ // optional GLuint srcLength = 0);
+ // void uniform3fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0,
+ // optional GLuint srcLength = 0);
+ // void uniform4fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0,
+ // optional GLuint srcLength = 0);
+
+ // void uniform1iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0,
+ // optional GLuint srcLength = 0);
+ // void uniform2iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0,
+ // optional GLuint srcLength = 0);
+ // void uniform3iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0,
+ // optional GLuint srcLength = 0);
+ // void uniform4iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0,
+ // optional GLuint srcLength = 0);
+
+ // void uniform1uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0,
+ // optional GLuint srcLength = 0);
+ // void uniform2uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0,
+ // optional GLuint srcLength = 0);
+ // void uniform3uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0,
+ // optional GLuint srcLength = 0);
+ // void uniform4uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0,
+ // optional GLuint srcLength = 0);
+
+ // void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
+ // optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
+ // void uniformMatrix3x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
+ // optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
+ // void uniformMatrix4x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
+ // optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
+
+ // void uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
+ // optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
+ // void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
+ // optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
+ // void uniformMatrix4x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
+ // optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
+
+ // void uniformMatrix2x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
+ // optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
+ // void uniformMatrix3x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
+ // optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
+ // void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
+ // optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
+
+ /* Vertex attribs */
+ // void vertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
+ // void vertexAttribI4iv(GLuint index, Int32List values);
+ // void vertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
+ // void vertexAttribI4uiv(GLuint index, Uint32List values);
+ // void vertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
+
+ /* Writing to the drawing buffer */
+ // void vertexAttribDivisor(GLuint index, GLuint divisor);
+ // void drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
+ // void drawElementsInstanced(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei instanceCount);
+ // void drawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLintptr offset);
+
+ /* Reading back pixels */
+ // WebGL1:
+ // void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
+ // [AllowShared] ArrayBufferView? dstData);
+ // WebGL2:
+ // void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
+ // GLintptr offset);
+ // void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
+ // [AllowShared] ArrayBufferView dstData, GLuint dstOffset);
+
+ /* Multiple Render Targets */
+ // void drawBuffers(sequence<GLenum> buffers);
+
+ // void clearBufferfv(GLenum buffer, GLint drawbuffer, Float32List values,
+ // optional GLuint srcOffset = 0);
+ // void clearBufferiv(GLenum buffer, GLint drawbuffer, Int32List values,
+ // optional GLuint srcOffset = 0);
+ // void clearBufferuiv(GLenum buffer, GLint drawbuffer, Uint32List values,
+ // optional GLuint srcOffset = 0);
+
+ // void clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
+
+ /* Query Objects */
+ /*WebGLQuery? createQuery();
+ void deleteQuery(WebGLQuery? query);
+ [WebGLHandlesContextLoss] GLboolean isQuery(WebGLQuery? query);
+ void beginQuery(GLenum target, WebGLQuery query);
+ void endQuery(GLenum target);
+ WebGLQuery? getQuery(GLenum target, GLenum pname);
+ any getQueryParameter(WebGLQuery query, GLenum pname);*/
+
+ /* Sampler Objects */
+ /*WebGLSampler? createSampler();
+ void deleteSampler(WebGLSampler? sampler);
+ [WebGLHandlesContextLoss] GLboolean isSampler(WebGLSampler? sampler);
+ void bindSampler(GLuint unit, WebGLSampler? sampler);
+ void samplerParameteri(WebGLSampler sampler, GLenum pname, GLint param);
+ void samplerParameterf(WebGLSampler sampler, GLenum pname, GLfloat param);
+ any getSamplerParameter(WebGLSampler sampler, GLenum pname);*/
+
+ /* Sync objects */
+ /*WebGLSync? fenceSync(GLenum condition, GLbitfield flags);
+ [WebGLHandlesContextLoss] GLboolean isSync(WebGLSync? sync);
+ void deleteSync(WebGLSync? sync);
+ GLenum clientWaitSync(WebGLSync sync, GLbitfield flags, GLuint64 timeout);
+ void waitSync(WebGLSync sync, GLbitfield flags, GLint64 timeout);
+ any getSyncParameter(WebGLSync sync, GLenum pname);*/
+
+ /* Transform Feedback */
+ /*WebGLTransformFeedback? createTransformFeedback();
+ void deleteTransformFeedback(WebGLTransformFeedback? tf);
+ [WebGLHandlesContextLoss] GLboolean isTransformFeedback(WebGLTransformFeedback? tf);
+ void bindTransformFeedback (GLenum target, WebGLTransformFeedback? tf);
+ void beginTransformFeedback(GLenum primitiveMode);
+ void endTransformFeedback();
+ void transformFeedbackVaryings(WebGLProgram program, sequence<DOMString> varyings, GLenum bufferMode);
+ WebGLActiveInfo? getTransformFeedbackVarying(WebGLProgram program, GLuint index);
+ void pauseTransformFeedback();
+ void resumeTransformFeedback();*/
+
+ /* Uniform Buffer Objects and Transform Feedback Buffers */
+ // void bindBufferBase(GLenum target, GLuint index, WebGLBuffer? buffer);
+ // void bindBufferRange(GLenum target, GLuint index, WebGLBuffer? buffer, GLintptr offset, GLsizeiptr size);
+ // any getIndexedParameter(GLenum target, GLuint index);
+ // sequence<GLuint>? getUniformIndices(WebGLProgram program, sequence<DOMString> uniformNames);
+ // any getActiveUniforms(WebGLProgram program, sequence<GLuint> uniformIndices, GLenum pname);
+ // GLuint getUniformBlockIndex(WebGLProgram program, DOMString uniformBlockName);
+ // any getActiveUniformBlockParameter(WebGLProgram program, GLuint uniformBlockIndex, GLenum pname);
+ // DOMString? getActiveUniformBlockName(WebGLProgram program, GLuint uniformBlockIndex);
+ // void uniformBlockBinding(WebGLProgram program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
+
+ /* Vertex Array Objects */
+ /*WebGLVertexArrayObject? createVertexArray();
+ void deleteVertexArray(WebGLVertexArrayObject? vertexArray);
+ [WebGLHandlesContextLoss] GLboolean isVertexArray(WebGLVertexArrayObject? vertexArray);
+ void bindVertexArray(WebGLVertexArrayObject? array);*/
+};
+WebGL2RenderingContextBase implements WebGLRenderingContextBase;
+
+[Pref="dom.webgl2.enabled"]
+interface WebGL2RenderingContext
+{
+};
+WebGL2RenderingContext implements WebGL2RenderingContextBase;