aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-06-13 15:05:08 -0600
committerbors-servo <metajack+bors@gmail.com>2015-06-13 15:05:08 -0600
commitceaca2e2885be89d47553090a45cf9048812e3b4 (patch)
tree6071ae4d75bd72dba63f9d899b5e928da62b6b91
parentcfcd8589d06935f83b903f76477ea03e4d4652d0 (diff)
parenteb502bdbb8b368f28cd06df44701aafb1b2d499a (diff)
downloadservo-ceaca2e2885be89d47553090a45cf9048812e3b4.tar.gz
servo-ceaca2e2885be89d47553090a45cf9048812e3b4.zip
Auto merge of #6357 - ecoal95:more-webgl, r=pcwalton
See the commit descriptions for more details. Blocked on https://github.com/servo/gleam/pull/24 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6357) <!-- Reviewable:end -->
-rw-r--r--components/canvas/webgl_paint_task.rs203
-rw-r--r--components/canvas_traits/lib.rs6
-rw-r--r--components/script/dom/mod.rs2
-rw-r--r--components/script/dom/webglactiveinfo.rs49
-rw-r--r--components/script/dom/webglrenderingcontext.rs31
-rw-r--r--components/script/dom/webglshaderprecisionformat.rs53
-rw-r--r--components/script/dom/webidls/WebGLActiveInfo.webidl10
-rw-r--r--components/script/dom/webidls/WebGLRenderingContext.webidl587
-rw-r--r--components/script/dom/webidls/WebGLShaderPrecisionFormat.webidl10
-rw-r--r--components/servo/Cargo.lock2
-rw-r--r--ports/cef/Cargo.lock2
-rw-r--r--ports/gonk/Cargo.lock2
-rw-r--r--tests/ref/basic.list5
-rw-r--r--tests/ref/webgl-context/draw_arrays_simple.html70
-rw-r--r--tests/ref/webgl-context/draw_arrays_simple_ref.html16
-rw-r--r--tests/wpt/mozilla/tests/mozilla/interfaces.html2
16 files changed, 688 insertions, 362 deletions
diff --git a/components/canvas/webgl_paint_task.rs b/components/canvas/webgl_paint_task.rs
index 758aa751b84..8f8b82c908b 100644
--- a/components/canvas/webgl_paint_task.rs
+++ b/components/canvas/webgl_paint_task.rs
@@ -47,46 +47,90 @@ impl WebGLPaintTask {
pub fn handle_webgl_message(&self, message: CanvasWebGLMsg) {
match message {
- CanvasWebGLMsg::GetContextAttributes(sender) => self.get_context_attributes(sender),
- CanvasWebGLMsg::AttachShader(program_id, shader_id) => self.attach_shader(program_id, shader_id),
- CanvasWebGLMsg::BufferData(buffer_type, data, usage) => self.buffer_data(buffer_type, data, usage),
- CanvasWebGLMsg::Clear(mask) => self.clear(mask),
- CanvasWebGLMsg::ClearColor(r, g, b, a) => self.clear_color(r, g, b, a),
- CanvasWebGLMsg::DrawArrays(mode, first, count) => self.draw_arrays(mode, first, count),
- CanvasWebGLMsg::EnableVertexAttribArray(attrib_id) => self.enable_vertex_attrib_array(attrib_id),
+ CanvasWebGLMsg::GetContextAttributes(sender) =>
+ self.get_context_attributes(sender),
+ CanvasWebGLMsg::ActiveTexture(target) =>
+ self.active_texture(target),
+ CanvasWebGLMsg::BlendColor(r, g, b, a) =>
+ self.blend_color(r, g, b, a),
+ CanvasWebGLMsg::BlendEquation(mode) =>
+ self.blend_equation(mode),
+ CanvasWebGLMsg::BlendEquationSeparate(mode_rgb, mode_alpha) =>
+ self.blend_equation_separate(mode_rgb, mode_alpha),
+ CanvasWebGLMsg::BlendFunc(src, dest) =>
+ self.blend_func(src, dest),
+ CanvasWebGLMsg::BlendFuncSeparate(src_rgb, dest_rgb, src_alpha, dest_alpha) =>
+ self.blend_func_separate(src_rgb, dest_rgb, src_alpha, dest_alpha),
+ CanvasWebGLMsg::AttachShader(program_id, shader_id) =>
+ self.attach_shader(program_id, shader_id),
+ CanvasWebGLMsg::BufferData(buffer_type, data, usage) =>
+ self.buffer_data(buffer_type, data, usage),
+ CanvasWebGLMsg::Clear(mask) =>
+ self.clear(mask),
+ CanvasWebGLMsg::ClearColor(r, g, b, a) =>
+ self.clear_color(r, g, b, a),
+ CanvasWebGLMsg::DrawArrays(mode, first, count) =>
+ self.draw_arrays(mode, first, count),
+ CanvasWebGLMsg::EnableVertexAttribArray(attrib_id) =>
+ self.enable_vertex_attrib_array(attrib_id),
CanvasWebGLMsg::GetAttribLocation(program_id, name, chan) =>
self.get_attrib_location(program_id, name, chan),
- CanvasWebGLMsg::GetShaderInfoLog(shader_id, chan) => self.get_shader_info_log(shader_id, chan),
+ CanvasWebGLMsg::GetShaderInfoLog(shader_id, chan) =>
+ self.get_shader_info_log(shader_id, chan),
CanvasWebGLMsg::GetShaderParameter(shader_id, param_id, chan) =>
self.get_shader_parameter(shader_id, param_id, chan),
CanvasWebGLMsg::GetUniformLocation(program_id, name, chan) =>
self.get_uniform_location(program_id, name, chan),
- CanvasWebGLMsg::CompileShader(shader_id) => self.compile_shader(shader_id),
- CanvasWebGLMsg::CreateBuffer(chan) => self.create_buffer(chan),
- CanvasWebGLMsg::CreateFramebuffer(chan) => self.create_framebuffer(chan),
- CanvasWebGLMsg::CreateRenderbuffer(chan) => self.create_renderbuffer(chan),
- CanvasWebGLMsg::CreateTexture(chan) => self.create_texture(chan),
- CanvasWebGLMsg::CreateProgram(chan) => self.create_program(chan),
- CanvasWebGLMsg::CreateShader(shader_type, chan) => self.create_shader(shader_type, chan),
- CanvasWebGLMsg::DeleteBuffer(id) => self.delete_buffer(id),
- CanvasWebGLMsg::DeleteFramebuffer(id) => self.delete_framebuffer(id),
- CanvasWebGLMsg::DeleteRenderbuffer(id) => self.delete_renderbuffer(id),
- CanvasWebGLMsg::DeleteTexture(id) => self.delete_texture(id),
- CanvasWebGLMsg::DeleteProgram(id) => self.delete_program(id),
- CanvasWebGLMsg::DeleteShader(id) => self.delete_shader(id),
- CanvasWebGLMsg::BindBuffer(target, id) => self.bind_buffer(target, id),
- CanvasWebGLMsg::BindFramebuffer(target, id) => self.bind_framebuffer(target, id),
- CanvasWebGLMsg::BindRenderbuffer(target, id) => self.bind_renderbuffer(target, id),
- CanvasWebGLMsg::BindTexture(target, id) => self.bind_texture(target, id),
- CanvasWebGLMsg::LinkProgram(program_id) => self.link_program(program_id),
- CanvasWebGLMsg::ShaderSource(shader_id, source) => self.shader_source(shader_id, source),
- CanvasWebGLMsg::Uniform4fv(uniform_id, data) => self.uniform_4fv(uniform_id, data),
- CanvasWebGLMsg::UseProgram(program_id) => self.use_program(program_id),
+ CanvasWebGLMsg::CompileShader(shader_id) =>
+ self.compile_shader(shader_id),
+ CanvasWebGLMsg::CreateBuffer(chan) =>
+ self.create_buffer(chan),
+ CanvasWebGLMsg::CreateFramebuffer(chan) =>
+ self.create_framebuffer(chan),
+ CanvasWebGLMsg::CreateRenderbuffer(chan) =>
+ self.create_renderbuffer(chan),
+ CanvasWebGLMsg::CreateTexture(chan) =>
+ self.create_texture(chan),
+ CanvasWebGLMsg::CreateProgram(chan) =>
+ self.create_program(chan),
+ CanvasWebGLMsg::CreateShader(shader_type, chan) =>
+ self.create_shader(shader_type, chan),
+ CanvasWebGLMsg::DeleteBuffer(id) =>
+ self.delete_buffer(id),
+ CanvasWebGLMsg::DeleteFramebuffer(id) =>
+ self.delete_framebuffer(id),
+ CanvasWebGLMsg::DeleteRenderbuffer(id) =>
+ self.delete_renderbuffer(id),
+ CanvasWebGLMsg::DeleteTexture(id) =>
+ self.delete_texture(id),
+ CanvasWebGLMsg::DeleteProgram(id) =>
+ self.delete_program(id),
+ CanvasWebGLMsg::DeleteShader(id) =>
+ self.delete_shader(id),
+ CanvasWebGLMsg::BindBuffer(target, id) =>
+ self.bind_buffer(target, id),
+ CanvasWebGLMsg::BindFramebuffer(target, id) =>
+ self.bind_framebuffer(target, id),
+ CanvasWebGLMsg::BindRenderbuffer(target, id) =>
+ self.bind_renderbuffer(target, id),
+ CanvasWebGLMsg::BindTexture(target, id) =>
+ self.bind_texture(target, id),
+ CanvasWebGLMsg::LinkProgram(program_id) =>
+ self.link_program(program_id),
+ CanvasWebGLMsg::ShaderSource(shader_id, source) =>
+ self.shader_source(shader_id, source),
+ CanvasWebGLMsg::Uniform4fv(uniform_id, data) =>
+ self.uniform_4fv(uniform_id, data),
+ CanvasWebGLMsg::UseProgram(program_id) =>
+ self.use_program(program_id),
CanvasWebGLMsg::VertexAttribPointer2f(attrib_id, size, normalized, stride, offset) =>
self.vertex_attrib_pointer_f32(attrib_id, size, normalized, stride, offset),
- CanvasWebGLMsg::Viewport(x, y, width, height) => self.viewport(x, y, width, height),
- CanvasWebGLMsg::DrawingBufferWidth(sender) => self.send_drawing_buffer_width(sender),
- CanvasWebGLMsg::DrawingBufferHeight(sender) => self.send_drawing_buffer_height(sender),
+ CanvasWebGLMsg::Viewport(x, y, width, height) =>
+ self.viewport(x, y, width, height),
+ CanvasWebGLMsg::DrawingBufferWidth(sender) =>
+ self.send_drawing_buffer_width(sender),
+ CanvasWebGLMsg::DrawingBufferHeight(sender) =>
+ self.send_drawing_buffer_height(sender),
}
}
@@ -117,30 +161,74 @@ impl WebGLPaintTask {
Ok(chan)
}
+ #[inline]
fn get_context_attributes(&self, sender: Sender<GLContextAttributes>) {
sender.send(*self.gl_context.borrow_attributes()).unwrap()
}
+ #[inline]
fn send_drawing_buffer_width(&self, sender: Sender<i32>) {
sender.send(self.size.width).unwrap()
}
+ #[inline]
fn send_drawing_buffer_height(&self, sender: Sender<i32>) {
sender.send(self.size.height).unwrap()
}
+ #[inline]
+ fn active_texture(&self, texture: u32) {
+ gl::active_texture(texture);
+ }
+
+ #[inline]
+ fn blend_color(&self, r: f32, g: f32, b: f32, a: f32) {
+ gl::blend_color(r, g, b, a);
+ }
+
+ #[inline]
+ fn blend_equation(&self, mode: u32) {
+ gl::blend_equation(mode);
+ }
+
+ #[inline]
+ fn blend_equation_separate(&self, mode_rgb: u32, mode_alpha: u32) {
+ gl::blend_equation_separate(mode_rgb, mode_alpha);
+ }
+
+ #[inline]
+ fn blend_func(&self, src_factor: u32, dest_factor: u32) {
+ gl::blend_func(src_factor, dest_factor);
+ }
+
+ #[inline]
+ fn blend_func_separate(&self,
+ src_rgb_factor: u32,
+ dest_rgb_factor: u32,
+ src_alpha_factor: u32,
+ dest_alpha_factor: u32) {
+ gl::blend_func_separate(src_rgb_factor,
+ dest_rgb_factor,
+ src_alpha_factor,
+ dest_alpha_factor);
+ }
+
+ #[inline]
fn attach_shader(&self, program_id: u32, shader_id: u32) {
gl::attach_shader(program_id, shader_id);
}
+ #[inline]
fn buffer_data(&self, buffer_type: u32, data: Vec<f32>, usage: u32) {
gl::buffer_data(buffer_type, &data, usage);
}
+ #[inline]
fn clear(&self, mask: u32) {
gl::clear(mask);
}
+ #[inline]
fn clear_color(&self, r: f32, g: f32, b: f32, a: f32) {
gl::clear_color(r, g, b, a);
}
@@ -258,14 +346,17 @@ impl WebGLPaintTask {
// TODO(ecoal95): This is not spec-compliant, we must check
// the version of GLSL used. This functionality should probably
// be in the WebGLShader object
+ #[inline]
fn compile_shader(&self, shader_id: u32) {
gl::compile_shader(shader_id);
}
+ #[inline]
fn draw_arrays(&self, mode: u32, first: i32, count: i32) {
gl::draw_arrays(mode, first, count);
}
+ #[inline]
fn enable_vertex_attrib_array(&self, attrib_id: u32) {
gl::enable_vertex_attrib_array(attrib_id);
}
@@ -296,10 +387,37 @@ impl WebGLPaintTask {
chan.send(location).unwrap();
}
+ #[inline]
fn link_program(&self, program_id: u32) {
gl::link_program(program_id);
}
+ #[inline]
+ fn shader_source(&self, shader_id: u32, source: String) {
+ gl::shader_source(shader_id, &[source.as_bytes()]);
+ }
+
+ #[inline]
+ fn uniform_4fv(&self, uniform_id: i32, data: Vec<f32>) {
+ gl::uniform_4f(uniform_id, data[0], data[1], data[2], data[3]);
+ }
+
+ #[inline]
+ fn use_program(&self, program_id: u32) {
+ gl::use_program(program_id);
+ }
+
+ #[inline]
+ fn vertex_attrib_pointer_f32(&self, attrib_id: u32, size: i32,
+ normalized: bool, stride: i32, offset: i64) {
+ gl::vertex_attrib_pointer_f32(attrib_id, size, normalized, stride, offset as u32);
+ }
+
+ #[inline]
+ fn viewport(&self, x: i32, y: i32, width: i32, height: i32) {
+ gl::viewport(x, y, width, height);
+ }
+
fn send_pixel_contents(&mut self, chan: Sender<Vec<u8>>) {
// FIXME(#5652, dmarcos) Instead of a readback strategy we have
// to layerize the canvas
@@ -330,27 +448,6 @@ impl WebGLPaintTask {
unimplemented!()
}
- fn shader_source(&self, shader_id: u32, source: String) {
- gl::shader_source(shader_id, &[source.as_bytes()]);
- }
-
- fn uniform_4fv(&self, uniform_id: i32, data: Vec<f32>) {
- gl::uniform_4f(uniform_id, data[0], data[1], data[2], data[3]);
- }
-
- fn use_program(&self, program_id: u32) {
- gl::use_program(program_id);
- }
-
- fn vertex_attrib_pointer_f32(&self, attrib_id: u32, size: i32,
- normalized: bool, stride: i32, offset: i64) {
- gl::vertex_attrib_pointer_f32(attrib_id, size, normalized, stride, offset as u32);
- }
-
- fn viewport(&self, x: i32, y: i32, width: i32, height: i32) {
- gl::viewport(x, y, width, height);
- }
-
fn recreate(&mut self, size: Size2D<i32>) -> Result<(), &'static str> {
if size.width > self.original_context_size.width ||
size.height > self.original_context_size.height {
diff --git a/components/canvas_traits/lib.rs b/components/canvas_traits/lib.rs
index 7da9dc7d8af..3c556b65782 100644
--- a/components/canvas_traits/lib.rs
+++ b/components/canvas_traits/lib.rs
@@ -77,6 +77,12 @@ pub enum Canvas2dMsg {
#[derive(Clone)]
pub enum CanvasWebGLMsg {
GetContextAttributes(Sender<GLContextAttributes>),
+ ActiveTexture(u32),
+ BlendColor(f32, f32, f32, f32),
+ BlendEquation(u32),
+ BlendEquationSeparate(u32, u32),
+ BlendFunc(u32, u32),
+ BlendFuncSeparate(u32, u32, u32, u32),
AttachShader(u32, u32),
BufferData(u32, Vec<f32>, u32),
Clear(u32),
diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs
index c108186947a..813e7a09145 100644
--- a/components/script/dom/mod.rs
+++ b/components/script/dom/mod.rs
@@ -335,6 +335,8 @@ pub mod webgluniformlocation;
pub mod webgltexture;
pub mod webglframebuffer;
pub mod webglrenderbuffer;
+pub mod webglactiveinfo;
+pub mod webglshaderprecisionformat;
pub mod websocket;
pub mod window;
pub mod worker;
diff --git a/components/script/dom/webglactiveinfo.rs b/components/script/dom/webglactiveinfo.rs
new file mode 100644
index 00000000000..8edcb2bf806
--- /dev/null
+++ b/components/script/dom/webglactiveinfo.rs
@@ -0,0 +1,49 @@
+/* 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/1.0/webgl.idl
+use dom::bindings::codegen::Bindings::WebGLActiveInfoBinding;
+use dom::bindings::codegen::Bindings::WebGLActiveInfoBinding::WebGLActiveInfoMethods;
+use dom::bindings::global::GlobalRef;
+use dom::bindings::js::{Temporary, JSRef};
+use dom::bindings::utils::{Reflector,reflect_dom_object};
+use util::str::DOMString;
+
+#[dom_struct]
+pub struct WebGLActiveInfo {
+ reflector_: Reflector,
+ size: i32,
+ // NOTE: `ty` stands for `type`, which is a reserved keyword
+ ty: u32,
+ name: String,
+}
+
+impl WebGLActiveInfo {
+ fn new_inherited(size: i32, ty: u32, name: String) -> WebGLActiveInfo {
+ WebGLActiveInfo {
+ reflector_: Reflector::new(),
+ size: size,
+ ty: ty,
+ name: name,
+ }
+ }
+
+ pub fn new(global: GlobalRef, size: i32, ty: u32, name: String) -> Temporary<WebGLActiveInfo> {
+ reflect_dom_object(box WebGLActiveInfo::new_inherited(size, ty, name), global, WebGLActiveInfoBinding::Wrap)
+ }
+}
+
+impl<'a> WebGLActiveInfoMethods for JSRef<'a, WebGLActiveInfo> {
+ fn Size(self) -> i32 {
+ self.size
+ }
+
+ fn Type(self) -> u32 {
+ self.ty
+ }
+
+ fn Name(self) -> DOMString {
+ self.name.clone()
+ }
+}
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index 8e5e23cb3c6..1ce9561d90a 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -138,6 +138,37 @@ impl<'a> WebGLRenderingContextMethods for JSRef<'a, WebGLRenderingContext> {
0 as *mut JSObject
}
+ // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn ActiveTexture(self, texture: u32) {
+ self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::ActiveTexture(texture))).unwrap();
+ }
+
+ // 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.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::BlendColor(r, g, b, a))).unwrap();
+ }
+
+ // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn BlendEquation(self, mode: u32) {
+ self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::BlendEquation(mode))).unwrap();
+ }
+
+ // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn BlendEquationSeparate(self, mode_rgb: u32, mode_alpha: u32) {
+ self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::BlendEquationSeparate(mode_rgb, mode_alpha))).unwrap();
+ }
+
+ // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3
+ fn BlendFunc(self, src_factor: u32, dest_factor: u32) {
+ self.renderer.send(CanvasMsg::WebGL(CanvasWebGLMsg::BlendFunc(src_factor, dest_factor))).unwrap();
+ }
+
+ // 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.renderer.send(
+ CanvasMsg::WebGL(CanvasWebGLMsg::BlendFuncSeparate(src_rgb, dest_rgb, src_alpha, dest_alpha))).unwrap();
+ }
+
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
fn AttachShader(self, program: Option<JSRef<WebGLProgram>>, shader: Option<JSRef<WebGLShader>>) {
let program_id = match program {
diff --git a/components/script/dom/webglshaderprecisionformat.rs b/components/script/dom/webglshaderprecisionformat.rs
new file mode 100644
index 00000000000..368d57358f6
--- /dev/null
+++ b/components/script/dom/webglshaderprecisionformat.rs
@@ -0,0 +1,53 @@
+/* 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/1.0/webgl.idl
+use dom::bindings::codegen::Bindings::WebGLShaderPrecisionFormatBinding;
+use dom::bindings::codegen::Bindings::WebGLShaderPrecisionFormatBinding::WebGLShaderPrecisionFormatMethods;
+use dom::bindings::global::GlobalRef;
+use dom::bindings::js::{Temporary, JSRef};
+use dom::bindings::utils::{Reflector,reflect_dom_object};
+
+#[dom_struct]
+pub struct WebGLShaderPrecisionFormat {
+ reflector_: Reflector,
+ range_min: i32,
+ range_max: i32,
+ precision: i32,
+}
+
+impl WebGLShaderPrecisionFormat {
+ fn new_inherited(range_min: i32, range_max: i32, precision: i32) -> WebGLShaderPrecisionFormat {
+ WebGLShaderPrecisionFormat {
+ reflector_: Reflector::new(),
+ range_min: range_min,
+ range_max: range_max,
+ precision: precision,
+ }
+ }
+
+ pub fn new(global: GlobalRef,
+ range_min: i32,
+ range_max: i32,
+ precision: i32) -> Temporary<WebGLShaderPrecisionFormat> {
+ reflect_dom_object(
+ box WebGLShaderPrecisionFormat::new_inherited(range_min, range_max, precision),
+ global,
+ WebGLShaderPrecisionFormatBinding::Wrap)
+ }
+}
+
+impl<'a> WebGLShaderPrecisionFormatMethods for JSRef<'a, WebGLShaderPrecisionFormat> {
+ fn RangeMin(self) -> i32 {
+ self.range_min
+ }
+
+ fn RangeMax(self) -> i32 {
+ self.range_max
+ }
+
+ fn Precision(self) -> i32 {
+ self.precision
+ }
+}
diff --git a/components/script/dom/webidls/WebGLActiveInfo.webidl b/components/script/dom/webidls/WebGLActiveInfo.webidl
new file mode 100644
index 00000000000..8b4d63ea0b7
--- /dev/null
+++ b/components/script/dom/webidls/WebGLActiveInfo.webidl
@@ -0,0 +1,10 @@
+//
+// WebGL IDL definitions scraped from the Khronos specification:
+// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.7
+//
+
+interface WebGLActiveInfo {
+ readonly attribute GLint size;
+ readonly attribute GLenum type;
+ readonly attribute DOMString name;
+};
diff --git a/components/script/dom/webidls/WebGLRenderingContext.webidl b/components/script/dom/webidls/WebGLRenderingContext.webidl
index 2dbd5f284a9..d3865c91c4a 100644
--- a/components/script/dom/webidls/WebGLRenderingContext.webidl
+++ b/components/script/dom/webidls/WebGLRenderingContext.webidl
@@ -33,27 +33,6 @@ dictionary WebGLContextAttributes {
GLboolean failIfMajorPerformanceCaveat = false;
};
-//interface WebGLFramebuffer : WebGLObject {
-//};
-
-//interface WebGLRenderbuffer : WebGLObject {
-//};
-
-//interface WebGLTexture : WebGLObject {
-//};
-
-//interface WebGLActiveInfo {
-// readonly attribute GLint size;
-// readonly attribute GLenum type;
-// readonly attribute DOMString name;
-//};
-
-//interface WebGLShaderPrecisionFormat {
-// readonly attribute GLint rangeMin;
-// readonly attribute GLint rangeMax;
-// readonly attribute GLint precision;
-//};
-
[NoInterfaceObject]
interface WebGLRenderingContextBase
{
@@ -83,46 +62,46 @@ interface WebGLRenderingContextBase
/* ALWAYS */
/* BlendingFactorDest */
- //const GLenum ZERO = 0;
- //const GLenum ONE = 1;
- //const GLenum SRC_COLOR = 0x0300;
- //const GLenum ONE_MINUS_SRC_COLOR = 0x0301;
- //const GLenum SRC_ALPHA = 0x0302;
- //const GLenum ONE_MINUS_SRC_ALPHA = 0x0303;
- //const GLenum DST_ALPHA = 0x0304;
- //const GLenum ONE_MINUS_DST_ALPHA = 0x0305;
+ const GLenum ZERO = 0;
+ const GLenum ONE = 1;
+ const GLenum SRC_COLOR = 0x0300;
+ const GLenum ONE_MINUS_SRC_COLOR = 0x0301;
+ const GLenum SRC_ALPHA = 0x0302;
+ const GLenum ONE_MINUS_SRC_ALPHA = 0x0303;
+ const GLenum DST_ALPHA = 0x0304;
+ const GLenum ONE_MINUS_DST_ALPHA = 0x0305;
/* BlendingFactorSrc */
/* ZERO */
/* ONE */
- //const GLenum DST_COLOR = 0x0306;
- //const GLenum ONE_MINUS_DST_COLOR = 0x0307;
- //const GLenum SRC_ALPHA_SATURATE = 0x0308;
+ const GLenum DST_COLOR = 0x0306;
+ const GLenum ONE_MINUS_DST_COLOR = 0x0307;
+ const GLenum SRC_ALPHA_SATURATE = 0x0308;
/* SRC_ALPHA */
/* ONE_MINUS_SRC_ALPHA */
/* DST_ALPHA */
/* ONE_MINUS_DST_ALPHA */
/* BlendEquationSeparate */
- //const GLenum FUNC_ADD = 0x8006;
- //const GLenum BLEND_EQUATION = 0x8009;
- //const GLenum BLEND_EQUATION_RGB = 0x8009; /* same as BLEND_EQUATION */
- //const GLenum BLEND_EQUATION_ALPHA = 0x883D;
+ const GLenum FUNC_ADD = 0x8006;
+ const GLenum BLEND_EQUATION = 0x8009;
+ const GLenum BLEND_EQUATION_RGB = 0x8009; /* same as BLEND_EQUATION */
+ const GLenum BLEND_EQUATION_ALPHA = 0x883D;
/* BlendSubtract */
- //const GLenum FUNC_SUBTRACT = 0x800A;
- //const GLenum FUNC_REVERSE_SUBTRACT = 0x800B;
+ const GLenum FUNC_SUBTRACT = 0x800A;
+ const GLenum FUNC_REVERSE_SUBTRACT = 0x800B;
/* Separate Blend Functions */
- //const GLenum BLEND_DST_RGB = 0x80C8;
- //const GLenum BLEND_SRC_RGB = 0x80C9;
- //const GLenum BLEND_DST_ALPHA = 0x80CA;
- //const GLenum BLEND_SRC_ALPHA = 0x80CB;
- //const GLenum CONSTANT_COLOR = 0x8001;
- //const GLenum ONE_MINUS_CONSTANT_COLOR = 0x8002;
- //const GLenum CONSTANT_ALPHA = 0x8003;
- //const GLenum ONE_MINUS_CONSTANT_ALPHA = 0x8004;
- //const GLenum BLEND_COLOR = 0x8005;
+ const GLenum BLEND_DST_RGB = 0x80C8;
+ const GLenum BLEND_SRC_RGB = 0x80C9;
+ const GLenum BLEND_DST_ALPHA = 0x80CA;
+ const GLenum BLEND_SRC_ALPHA = 0x80CB;
+ const GLenum CONSTANT_COLOR = 0x8001;
+ const GLenum ONE_MINUS_CONSTANT_COLOR = 0x8002;
+ const GLenum CONSTANT_ALPHA = 0x8003;
+ const GLenum ONE_MINUS_CONSTANT_ALPHA = 0x8004;
+ const GLenum BLEND_COLOR = 0x8005;
/* Buffer Objects */
const GLenum ARRAY_BUFFER = 0x8892;
@@ -134,15 +113,15 @@ interface WebGLRenderingContextBase
const GLenum STATIC_DRAW = 0x88E4;
const GLenum DYNAMIC_DRAW = 0x88E8;
- //const GLenum BUFFER_SIZE = 0x8764;
- //const GLenum BUFFER_USAGE = 0x8765;
+ const GLenum BUFFER_SIZE = 0x8764;
+ const GLenum BUFFER_USAGE = 0x8765;
- //const GLenum CURRENT_VERTEX_ATTRIB = 0x8626;
+ const GLenum CURRENT_VERTEX_ATTRIB = 0x8626;
/* CullFaceMode */
- //const GLenum FRONT = 0x0404;
- //const GLenum BACK = 0x0405;
- //const GLenum FRONT_AND_BACK = 0x0408;
+ const GLenum FRONT = 0x0404;
+ const GLenum BACK = 0x0405;
+ const GLenum FRONT_AND_BACK = 0x0408;
/* DepthFunction */
/* NEVER */
@@ -156,76 +135,76 @@ interface WebGLRenderingContextBase
/* EnableCap */
/* TEXTURE_2D */
- //const GLenum CULL_FACE = 0x0B44;
- //const GLenum BLEND = 0x0BE2;
- //const GLenum DITHER = 0x0BD0;
- //const GLenum STENCIL_TEST = 0x0B90;
- //const GLenum DEPTH_TEST = 0x0B71;
- //const GLenum SCISSOR_TEST = 0x0C11;
- //const GLenum POLYGON_OFFSET_FILL = 0x8037;
- //const GLenum SAMPLE_ALPHA_TO_COVERAGE = 0x809E;
- //const GLenum SAMPLE_COVERAGE = 0x80A0;
+ const GLenum CULL_FACE = 0x0B44;
+ const GLenum BLEND = 0x0BE2;
+ const GLenum DITHER = 0x0BD0;
+ const GLenum STENCIL_TEST = 0x0B90;
+ const GLenum DEPTH_TEST = 0x0B71;
+ const GLenum SCISSOR_TEST = 0x0C11;
+ const GLenum POLYGON_OFFSET_FILL = 0x8037;
+ const GLenum SAMPLE_ALPHA_TO_COVERAGE = 0x809E;
+ const GLenum SAMPLE_COVERAGE = 0x80A0;
/* ErrorCode */
- //const GLenum NO_ERROR = 0;
- //const GLenum INVALID_ENUM = 0x0500;
- //const GLenum INVALID_VALUE = 0x0501;
- //const GLenum INVALID_OPERATION = 0x0502;
- //const GLenum OUT_OF_MEMORY = 0x0505;
+ const GLenum NO_ERROR = 0;
+ const GLenum INVALID_ENUM = 0x0500;
+ const GLenum INVALID_VALUE = 0x0501;
+ const GLenum INVALID_OPERATION = 0x0502;
+ const GLenum OUT_OF_MEMORY = 0x0505;
/* FrontFaceDirection */
- //const GLenum CW = 0x0900;
- //const GLenum CCW = 0x0901;
+ const GLenum CW = 0x0900;
+ const GLenum CCW = 0x0901;
/* GetPName */
- //const GLenum LINE_WIDTH = 0x0B21;
- //const GLenum ALIASED_POINT_SIZE_RANGE = 0x846D;
- //const GLenum ALIASED_LINE_WIDTH_RANGE = 0x846E;
- //const GLenum CULL_FACE_MODE = 0x0B45;
- //const GLenum FRONT_FACE = 0x0B46;
- //const GLenum DEPTH_RANGE = 0x0B70;
- //const GLenum DEPTH_WRITEMASK = 0x0B72;
- //const GLenum DEPTH_CLEAR_VALUE = 0x0B73;
- //const GLenum DEPTH_FUNC = 0x0B74;
- //const GLenum STENCIL_CLEAR_VALUE = 0x0B91;
- //const GLenum STENCIL_FUNC = 0x0B92;
- //const GLenum STENCIL_FAIL = 0x0B94;
- //const GLenum STENCIL_PASS_DEPTH_FAIL = 0x0B95;
- //const GLenum STENCIL_PASS_DEPTH_PASS = 0x0B96;
- //const GLenum STENCIL_REF = 0x0B97;
- //const GLenum STENCIL_VALUE_MASK = 0x0B93;
- //const GLenum STENCIL_WRITEMASK = 0x0B98;
- //const GLenum STENCIL_BACK_FUNC = 0x8800;
- //const GLenum STENCIL_BACK_FAIL = 0x8801;
- //const GLenum STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802;
- //const GLenum STENCIL_BACK_PASS_DEPTH_PASS = 0x8803;
- //const GLenum STENCIL_BACK_REF = 0x8CA3;
- //const GLenum STENCIL_BACK_VALUE_MASK = 0x8CA4;
- //const GLenum STENCIL_BACK_WRITEMASK = 0x8CA5;
- //const GLenum VIEWPORT = 0x0BA2;
- //const GLenum SCISSOR_BOX = 0x0C10;
+ const GLenum LINE_WIDTH = 0x0B21;
+ const GLenum ALIASED_POINT_SIZE_RANGE = 0x846D;
+ const GLenum ALIASED_LINE_WIDTH_RANGE = 0x846E;
+ const GLenum CULL_FACE_MODE = 0x0B45;
+ const GLenum FRONT_FACE = 0x0B46;
+ const GLenum DEPTH_RANGE = 0x0B70;
+ const GLenum DEPTH_WRITEMASK = 0x0B72;
+ const GLenum DEPTH_CLEAR_VALUE = 0x0B73;
+ const GLenum DEPTH_FUNC = 0x0B74;
+ const GLenum STENCIL_CLEAR_VALUE = 0x0B91;
+ const GLenum STENCIL_FUNC = 0x0B92;
+ const GLenum STENCIL_FAIL = 0x0B94;
+ const GLenum STENCIL_PASS_DEPTH_FAIL = 0x0B95;
+ const GLenum STENCIL_PASS_DEPTH_PASS = 0x0B96;
+ const GLenum STENCIL_REF = 0x0B97;
+ const GLenum STENCIL_VALUE_MASK = 0x0B93;
+ const GLenum STENCIL_WRITEMASK = 0x0B98;
+ const GLenum STENCIL_BACK_FUNC = 0x8800;
+ const GLenum STENCIL_BACK_FAIL = 0x8801;
+ const GLenum STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802;
+ const GLenum STENCIL_BACK_PASS_DEPTH_PASS = 0x8803;
+ const GLenum STENCIL_BACK_REF = 0x8CA3;
+ const GLenum STENCIL_BACK_VALUE_MASK = 0x8CA4;
+ const GLenum STENCIL_BACK_WRITEMASK = 0x8CA5;
+ const GLenum VIEWPORT = 0x0BA2;
+ const GLenum SCISSOR_BOX = 0x0C10;
/* SCISSOR_TEST */
- //const GLenum COLOR_CLEAR_VALUE = 0x0C22;
- //const GLenum COLOR_WRITEMASK = 0x0C23;
- //const GLenum UNPACK_ALIGNMENT = 0x0CF5;
- //const GLenum PACK_ALIGNMENT = 0x0D05;
- //const GLenum MAX_TEXTURE_SIZE = 0x0D33;
- //const GLenum MAX_VIEWPORT_DIMS = 0x0D3A;
- //const GLenum SUBPIXEL_BITS = 0x0D50;
- //const GLenum RED_BITS = 0x0D52;
- //const GLenum GREEN_BITS = 0x0D53;
- //const GLenum BLUE_BITS = 0x0D54;
- //const GLenum ALPHA_BITS = 0x0D55;
- //const GLenum DEPTH_BITS = 0x0D56;
- //const GLenum STENCIL_BITS = 0x0D57;
- //const GLenum POLYGON_OFFSET_UNITS = 0x2A00;
+ const GLenum COLOR_CLEAR_VALUE = 0x0C22;
+ const GLenum COLOR_WRITEMASK = 0x0C23;
+ const GLenum UNPACK_ALIGNMENT = 0x0CF5;
+ const GLenum PACK_ALIGNMENT = 0x0D05;
+ const GLenum MAX_TEXTURE_SIZE = 0x0D33;
+ const GLenum MAX_VIEWPORT_DIMS = 0x0D3A;
+ const GLenum SUBPIXEL_BITS = 0x0D50;
+ const GLenum RED_BITS = 0x0D52;
+ const GLenum GREEN_BITS = 0x0D53;
+ const GLenum BLUE_BITS = 0x0D54;
+ const GLenum ALPHA_BITS = 0x0D55;
+ const GLenum DEPTH_BITS = 0x0D56;
+ const GLenum STENCIL_BITS = 0x0D57;
+ const GLenum POLYGON_OFFSET_UNITS = 0x2A00;
/* POLYGON_OFFSET_FILL */
- //const GLenum POLYGON_OFFSET_FACTOR = 0x8038;
- //const GLenum TEXTURE_BINDING_2D = 0x8069;
- //const GLenum SAMPLE_BUFFERS = 0x80A8;
- //const GLenum SAMPLES = 0x80A9;
- //const GLenum SAMPLE_COVERAGE_VALUE = 0x80AA;
- //const GLenum SAMPLE_COVERAGE_INVERT = 0x80AB;
+ const GLenum POLYGON_OFFSET_FACTOR = 0x8038;
+ const GLenum TEXTURE_BINDING_2D = 0x8069;
+ const GLenum SAMPLE_BUFFERS = 0x80A8;
+ const GLenum SAMPLES = 0x80A9;
+ const GLenum SAMPLE_COVERAGE_VALUE = 0x80AA;
+ const GLenum SAMPLE_COVERAGE_INVERT = 0x80AB;
/* GetTextureParameter */
/* TEXTURE_MAG_FILTER */
@@ -233,15 +212,15 @@ interface WebGLRenderingContextBase
/* TEXTURE_WRAP_S */
/* TEXTURE_WRAP_T */
- //const GLenum COMPRESSED_TEXTURE_FORMATS = 0x86A3;
+ const GLenum COMPRESSED_TEXTURE_FORMATS = 0x86A3;
/* HintMode */
- //const GLenum DONT_CARE = 0x1100;
- //const GLenum FASTEST = 0x1101;
- //const GLenum NICEST = 0x1102;
+ const GLenum DONT_CARE = 0x1100;
+ const GLenum FASTEST = 0x1101;
+ const GLenum NICEST = 0x1102;
/* HintTarget */
- //const GLenum GENERATE_MIPMAP_HINT = 0x8192;
+ const GLenum GENERATE_MIPMAP_HINT = 0x8192;
/* DataType */
const GLenum BYTE = 0x1400;
@@ -253,58 +232,58 @@ interface WebGLRenderingContextBase
const GLenum FLOAT = 0x1406;
/* PixelFormat */
- //const GLenum DEPTH_COMPONENT = 0x1902;
- //const GLenum ALPHA = 0x1906;
- //const GLenum RGB = 0x1907;
- //const GLenum RGBA = 0x1908;
- //const GLenum LUMINANCE = 0x1909;
- //const GLenum LUMINANCE_ALPHA = 0x190A;
+ const GLenum DEPTH_COMPONENT = 0x1902;
+ const GLenum ALPHA = 0x1906;
+ const GLenum RGB = 0x1907;
+ const GLenum RGBA = 0x1908;
+ const GLenum LUMINANCE = 0x1909;
+ const GLenum LUMINANCE_ALPHA = 0x190A;
/* PixelType */
/* UNSIGNED_BYTE */
- //const GLenum UNSIGNED_SHORT_4_4_4_4 = 0x8033;
- //const GLenum UNSIGNED_SHORT_5_5_5_1 = 0x8034;
- //const GLenum UNSIGNED_SHORT_5_6_5 = 0x8363;
+ const GLenum UNSIGNED_SHORT_4_4_4_4 = 0x8033;
+ const GLenum UNSIGNED_SHORT_5_5_5_1 = 0x8034;
+ const GLenum UNSIGNED_SHORT_5_6_5 = 0x8363;
/* Shaders */
const GLenum FRAGMENT_SHADER = 0x8B30;
const GLenum VERTEX_SHADER = 0x8B31;
- //const GLenum MAX_VERTEX_ATTRIBS = 0x8869;
- //const GLenum MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB;
- //const GLenum MAX_VARYING_VECTORS = 0x8DFC;
- //const GLenum MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D;
- //const GLenum MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C;
- //const GLenum MAX_TEXTURE_IMAGE_UNITS = 0x8872;
- //const GLenum MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD;
- //const GLenum SHADER_TYPE = 0x8B4F;
- //const GLenum DELETE_STATUS = 0x8B80;
- //const GLenum LINK_STATUS = 0x8B82;
- //const GLenum VALIDATE_STATUS = 0x8B83;
- //const GLenum ATTACHED_SHADERS = 0x8B85;
- //const GLenum ACTIVE_UNIFORMS = 0x8B86;
- //const GLenum ACTIVE_ATTRIBUTES = 0x8B89;
- //const GLenum SHADING_LANGUAGE_VERSION = 0x8B8C;
- //const GLenum CURRENT_PROGRAM = 0x8B8D;
+ const GLenum MAX_VERTEX_ATTRIBS = 0x8869;
+ const GLenum MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB;
+ const GLenum MAX_VARYING_VECTORS = 0x8DFC;
+ const GLenum MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D;
+ const GLenum MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C;
+ const GLenum MAX_TEXTURE_IMAGE_UNITS = 0x8872;
+ const GLenum MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD;
+ const GLenum SHADER_TYPE = 0x8B4F;
+ const GLenum DELETE_STATUS = 0x8B80;
+ const GLenum LINK_STATUS = 0x8B82;
+ const GLenum VALIDATE_STATUS = 0x8B83;
+ const GLenum ATTACHED_SHADERS = 0x8B85;
+ const GLenum ACTIVE_UNIFORMS = 0x8B86;
+ const GLenum ACTIVE_ATTRIBUTES = 0x8B89;
+ const GLenum SHADING_LANGUAGE_VERSION = 0x8B8C;
+ const GLenum CURRENT_PROGRAM = 0x8B8D;
/* StencilFunction */
- //const GLenum NEVER = 0x0200;
- //const GLenum LESS = 0x0201;
- //const GLenum EQUAL = 0x0202;
- //const GLenum LEQUAL = 0x0203;
- //const GLenum GREATER = 0x0204;
- //const GLenum NOTEQUAL = 0x0205;
- //const GLenum GEQUAL = 0x0206;
- //const GLenum ALWAYS = 0x0207;
+ const GLenum NEVER = 0x0200;
+ const GLenum LESS = 0x0201;
+ const GLenum EQUAL = 0x0202;
+ const GLenum LEQUAL = 0x0203;
+ const GLenum GREATER = 0x0204;
+ const GLenum NOTEQUAL = 0x0205;
+ const GLenum GEQUAL = 0x0206;
+ const GLenum ALWAYS = 0x0207;
/* StencilOp */
/* ZERO */
- //const GLenum KEEP = 0x1E00;
- //const GLenum REPLACE = 0x1E01;
- //const GLenum INCR = 0x1E02;
- //const GLenum DECR = 0x1E03;
- //const GLenum INVERT = 0x150A;
- //const GLenum INCR_WRAP = 0x8507;
- //const GLenum DECR_WRAP = 0x8508;
+ const GLenum KEEP = 0x1E00;
+ const GLenum REPLACE = 0x1E01;
+ const GLenum INCR = 0x1E02;
+ const GLenum DECR = 0x1E03;
+ const GLenum INVERT = 0x150A;
+ const GLenum INCR_WRAP = 0x8507;
+ const GLenum DECR_WRAP = 0x8508;
/* StringName */
const GLenum VENDOR = 0x1F00;
@@ -312,170 +291,170 @@ interface WebGLRenderingContextBase
const GLenum VERSION = 0x1F02;
/* TextureMagFilter */
- //const GLenum NEAREST = 0x2600;
- //const GLenum LINEAR = 0x2601;
+ const GLenum NEAREST = 0x2600;
+ const GLenum LINEAR = 0x2601;
/* TextureMinFilter */
/* NEAREST */
/* LINEAR */
- //const GLenum NEAREST_MIPMAP_NEAREST = 0x2700;
- //const GLenum LINEAR_MIPMAP_NEAREST = 0x2701;
- //const GLenum NEAREST_MIPMAP_LINEAR = 0x2702;
- //const GLenum LINEAR_MIPMAP_LINEAR = 0x2703;
+ const GLenum NEAREST_MIPMAP_NEAREST = 0x2700;
+ const GLenum LINEAR_MIPMAP_NEAREST = 0x2701;
+ const GLenum NEAREST_MIPMAP_LINEAR = 0x2702;
+ const GLenum LINEAR_MIPMAP_LINEAR = 0x2703;
/* TextureParameterName */
- //const GLenum TEXTURE_MAG_FILTER = 0x2800;
- //const GLenum TEXTURE_MIN_FILTER = 0x2801;
- //const GLenum TEXTURE_WRAP_S = 0x2802;
- //const GLenum TEXTURE_WRAP_T = 0x2803;
+ const GLenum TEXTURE_MAG_FILTER = 0x2800;
+ const GLenum TEXTURE_MIN_FILTER = 0x2801;
+ const GLenum TEXTURE_WRAP_S = 0x2802;
+ const GLenum TEXTURE_WRAP_T = 0x2803;
/* TextureTarget */
- //const GLenum TEXTURE_2D = 0x0DE1;
- //const GLenum TEXTURE = 0x1702;
-
- //const GLenum TEXTURE_CUBE_MAP = 0x8513;
- //const GLenum TEXTURE_BINDING_CUBE_MAP = 0x8514;
- //const GLenum TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515;
- //const GLenum TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516;
- //const GLenum TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517;
- //const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518;
- //const GLenum TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519;
- //const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A;
- //const GLenum MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C;
+ const GLenum TEXTURE_2D = 0x0DE1;
+ const GLenum TEXTURE = 0x1702;
+
+ const GLenum TEXTURE_CUBE_MAP = 0x8513;
+ const GLenum TEXTURE_BINDING_CUBE_MAP = 0x8514;
+ const GLenum TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515;
+ const GLenum TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516;
+ const GLenum TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517;
+ const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518;
+ const GLenum TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519;
+ const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A;
+ const GLenum MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C;
/* TextureUnit */
- //const GLenum TEXTURE0 = 0x84C0;
- //const GLenum TEXTURE1 = 0x84C1;
- //const GLenum TEXTURE2 = 0x84C2;
- //const GLenum TEXTURE3 = 0x84C3;
- //const GLenum TEXTURE4 = 0x84C4;
- //const GLenum TEXTURE5 = 0x84C5;
- //const GLenum TEXTURE6 = 0x84C6;
- //const GLenum TEXTURE7 = 0x84C7;
- //const GLenum TEXTURE8 = 0x84C8;
- //const GLenum TEXTURE9 = 0x84C9;
- //const GLenum TEXTURE10 = 0x84CA;
- //const GLenum TEXTURE11 = 0x84CB;
- //const GLenum TEXTURE12 = 0x84CC;
- //const GLenum TEXTURE13 = 0x84CD;
- //const GLenum TEXTURE14 = 0x84CE;
- //const GLenum TEXTURE15 = 0x84CF;
- //const GLenum TEXTURE16 = 0x84D0;
- //const GLenum TEXTURE17 = 0x84D1;
- //const GLenum TEXTURE18 = 0x84D2;
- //const GLenum TEXTURE19 = 0x84D3;
- //const GLenum TEXTURE20 = 0x84D4;
- //const GLenum TEXTURE21 = 0x84D5;
- //const GLenum TEXTURE22 = 0x84D6;
- //const GLenum TEXTURE23 = 0x84D7;
- //const GLenum TEXTURE24 = 0x84D8;
- //const GLenum TEXTURE25 = 0x84D9;
- //const GLenum TEXTURE26 = 0x84DA;
- //const GLenum TEXTURE27 = 0x84DB;
- //const GLenum TEXTURE28 = 0x84DC;
- //const GLenum TEXTURE29 = 0x84DD;
- //const GLenum TEXTURE30 = 0x84DE;
- //const GLenum TEXTURE31 = 0x84DF;
- //const GLenum ACTIVE_TEXTURE = 0x84E0;
+ const GLenum TEXTURE0 = 0x84C0;
+ const GLenum TEXTURE1 = 0x84C1;
+ const GLenum TEXTURE2 = 0x84C2;
+ const GLenum TEXTURE3 = 0x84C3;
+ const GLenum TEXTURE4 = 0x84C4;
+ const GLenum TEXTURE5 = 0x84C5;
+ const GLenum TEXTURE6 = 0x84C6;
+ const GLenum TEXTURE7 = 0x84C7;
+ const GLenum TEXTURE8 = 0x84C8;
+ const GLenum TEXTURE9 = 0x84C9;
+ const GLenum TEXTURE10 = 0x84CA;
+ const GLenum TEXTURE11 = 0x84CB;
+ const GLenum TEXTURE12 = 0x84CC;
+ const GLenum TEXTURE13 = 0x84CD;
+ const GLenum TEXTURE14 = 0x84CE;
+ const GLenum TEXTURE15 = 0x84CF;
+ const GLenum TEXTURE16 = 0x84D0;
+ const GLenum TEXTURE17 = 0x84D1;
+ const GLenum TEXTURE18 = 0x84D2;
+ const GLenum TEXTURE19 = 0x84D3;
+ const GLenum TEXTURE20 = 0x84D4;
+ const GLenum TEXTURE21 = 0x84D5;
+ const GLenum TEXTURE22 = 0x84D6;
+ const GLenum TEXTURE23 = 0x84D7;
+ const GLenum TEXTURE24 = 0x84D8;
+ const GLenum TEXTURE25 = 0x84D9;
+ const GLenum TEXTURE26 = 0x84DA;
+ const GLenum TEXTURE27 = 0x84DB;
+ const GLenum TEXTURE28 = 0x84DC;
+ const GLenum TEXTURE29 = 0x84DD;
+ const GLenum TEXTURE30 = 0x84DE;
+ const GLenum TEXTURE31 = 0x84DF;
+ const GLenum ACTIVE_TEXTURE = 0x84E0;
/* TextureWrapMode */
- //const GLenum REPEAT = 0x2901;
- //const GLenum CLAMP_TO_EDGE = 0x812F;
- //const GLenum MIRRORED_REPEAT = 0x8370;
+ const GLenum REPEAT = 0x2901;
+ const GLenum CLAMP_TO_EDGE = 0x812F;
+ const GLenum MIRRORED_REPEAT = 0x8370;
/* Uniform Types */
- //const GLenum FLOAT_VEC2 = 0x8B50;
- //const GLenum FLOAT_VEC3 = 0x8B51;
- //const GLenum FLOAT_VEC4 = 0x8B52;
- //const GLenum INT_VEC2 = 0x8B53;
- //const GLenum INT_VEC3 = 0x8B54;
- //const GLenum INT_VEC4 = 0x8B55;
- //const GLenum BOOL = 0x8B56;
- //const GLenum BOOL_VEC2 = 0x8B57;
- //const GLenum BOOL_VEC3 = 0x8B58;
- //const GLenum BOOL_VEC4 = 0x8B59;
- //const GLenum FLOAT_MAT2 = 0x8B5A;
- //const GLenum FLOAT_MAT3 = 0x8B5B;
- //const GLenum FLOAT_MAT4 = 0x8B5C;
- //const GLenum SAMPLER_2D = 0x8B5E;
- //const GLenum SAMPLER_CUBE = 0x8B60;
+ const GLenum FLOAT_VEC2 = 0x8B50;
+ const GLenum FLOAT_VEC3 = 0x8B51;
+ const GLenum FLOAT_VEC4 = 0x8B52;
+ const GLenum INT_VEC2 = 0x8B53;
+ const GLenum INT_VEC3 = 0x8B54;
+ const GLenum INT_VEC4 = 0x8B55;
+ const GLenum BOOL = 0x8B56;
+ const GLenum BOOL_VEC2 = 0x8B57;
+ const GLenum BOOL_VEC3 = 0x8B58;
+ const GLenum BOOL_VEC4 = 0x8B59;
+ const GLenum FLOAT_MAT2 = 0x8B5A;
+ const GLenum FLOAT_MAT3 = 0x8B5B;
+ const GLenum FLOAT_MAT4 = 0x8B5C;
+ const GLenum SAMPLER_2D = 0x8B5E;
+ const GLenum SAMPLER_CUBE = 0x8B60;
/* Vertex Arrays */
- //const GLenum VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622;
- //const GLenum VERTEX_ATTRIB_ARRAY_SIZE = 0x8623;
- //const GLenum VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624;
- //const GLenum VERTEX_ATTRIB_ARRAY_TYPE = 0x8625;
- //const GLenum VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A;
- //const GLenum VERTEX_ATTRIB_ARRAY_POINTER = 0x8645;
- //const GLenum VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F;
+ const GLenum VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622;
+ const GLenum VERTEX_ATTRIB_ARRAY_SIZE = 0x8623;
+ const GLenum VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624;
+ const GLenum VERTEX_ATTRIB_ARRAY_TYPE = 0x8625;
+ const GLenum VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A;
+ const GLenum VERTEX_ATTRIB_ARRAY_POINTER = 0x8645;
+ const GLenum VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F;
/* Read Format */
- //const GLenum IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A;
- //const GLenum IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B;
+ const GLenum IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A;
+ const GLenum IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B;
/* Shader Source */
const GLenum COMPILE_STATUS = 0x8B81;
/* Shader Precision-Specified Types */
- //const GLenum LOW_FLOAT = 0x8DF0;
- //const GLenum MEDIUM_FLOAT = 0x8DF1;
- //const GLenum HIGH_FLOAT = 0x8DF2;
- //const GLenum LOW_INT = 0x8DF3;
- //const GLenum MEDIUM_INT = 0x8DF4;
- //const GLenum HIGH_INT = 0x8DF5;
+ const GLenum LOW_FLOAT = 0x8DF0;
+ const GLenum MEDIUM_FLOAT = 0x8DF1;
+ const GLenum HIGH_FLOAT = 0x8DF2;
+ const GLenum LOW_INT = 0x8DF3;
+ const GLenum MEDIUM_INT = 0x8DF4;
+ const GLenum HIGH_INT = 0x8DF5;
/* Framebuffer Object. */
- //const GLenum FRAMEBUFFER = 0x8D40;
- //const GLenum RENDERBUFFER = 0x8D41;
-
- //const GLenum RGBA4 = 0x8056;
- //const GLenum RGB5_A1 = 0x8057;
- //const GLenum RGB565 = 0x8D62;
- //const GLenum DEPTH_COMPONENT16 = 0x81A5;
- //const GLenum STENCIL_INDEX = 0x1901;
- //const GLenum STENCIL_INDEX8 = 0x8D48;
- //const GLenum DEPTH_STENCIL = 0x84F9;
-
- //const GLenum RENDERBUFFER_WIDTH = 0x8D42;
- //const GLenum RENDERBUFFER_HEIGHT = 0x8D43;
- //const GLenum RENDERBUFFER_INTERNAL_FORMAT = 0x8D44;
- //const GLenum RENDERBUFFER_RED_SIZE = 0x8D50;
- //const GLenum RENDERBUFFER_GREEN_SIZE = 0x8D51;
- //const GLenum RENDERBUFFER_BLUE_SIZE = 0x8D52;
- //const GLenum RENDERBUFFER_ALPHA_SIZE = 0x8D53;
- //const GLenum RENDERBUFFER_DEPTH_SIZE = 0x8D54;
- //const GLenum RENDERBUFFER_STENCIL_SIZE = 0x8D55;
-
- //const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0;
- //const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1;
- //const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2;
- //const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3;
-
- //const GLenum COLOR_ATTACHMENT0 = 0x8CE0;
- //const GLenum DEPTH_ATTACHMENT = 0x8D00;
- //const GLenum STENCIL_ATTACHMENT = 0x8D20;
- //const GLenum DEPTH_STENCIL_ATTACHMENT = 0x821A;
-
- //const GLenum NONE = 0;
-
- //const GLenum FRAMEBUFFER_COMPLETE = 0x8CD5;
- //const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6;
- //const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7;
- //const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9;
- //const GLenum FRAMEBUFFER_UNSUPPORTED = 0x8CDD;
-
- //const GLenum FRAMEBUFFER_BINDING = 0x8CA6;
- //const GLenum RENDERBUFFER_BINDING = 0x8CA7;
- //const GLenum MAX_RENDERBUFFER_SIZE = 0x84E8;
-
- //const GLenum INVALID_FRAMEBUFFER_OPERATION = 0x0506;
+ const GLenum FRAMEBUFFER = 0x8D40;
+ const GLenum RENDERBUFFER = 0x8D41;
+
+ const GLenum RGBA4 = 0x8056;
+ const GLenum RGB5_A1 = 0x8057;
+ const GLenum RGB565 = 0x8D62;
+ const GLenum DEPTH_COMPONENT16 = 0x81A5;
+ const GLenum STENCIL_INDEX = 0x1901;
+ const GLenum STENCIL_INDEX8 = 0x8D48;
+ const GLenum DEPTH_STENCIL = 0x84F9;
+
+ const GLenum RENDERBUFFER_WIDTH = 0x8D42;
+ const GLenum RENDERBUFFER_HEIGHT = 0x8D43;
+ const GLenum RENDERBUFFER_INTERNAL_FORMAT = 0x8D44;
+ const GLenum RENDERBUFFER_RED_SIZE = 0x8D50;
+ const GLenum RENDERBUFFER_GREEN_SIZE = 0x8D51;
+ const GLenum RENDERBUFFER_BLUE_SIZE = 0x8D52;
+ const GLenum RENDERBUFFER_ALPHA_SIZE = 0x8D53;
+ const GLenum RENDERBUFFER_DEPTH_SIZE = 0x8D54;
+ const GLenum RENDERBUFFER_STENCIL_SIZE = 0x8D55;
+
+ const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0;
+ const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1;
+ const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2;
+ const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3;
+
+ const GLenum COLOR_ATTACHMENT0 = 0x8CE0;
+ const GLenum DEPTH_ATTACHMENT = 0x8D00;
+ const GLenum STENCIL_ATTACHMENT = 0x8D20;
+ const GLenum DEPTH_STENCIL_ATTACHMENT = 0x821A;
+
+ const GLenum NONE = 0;
+
+ const GLenum FRAMEBUFFER_COMPLETE = 0x8CD5;
+ const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6;
+ const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7;
+ const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9;
+ const GLenum FRAMEBUFFER_UNSUPPORTED = 0x8CDD;
+
+ const GLenum FRAMEBUFFER_BINDING = 0x8CA6;
+ const GLenum RENDERBUFFER_BINDING = 0x8CA7;
+ const GLenum MAX_RENDERBUFFER_SIZE = 0x84E8;
+
+ const GLenum INVALID_FRAMEBUFFER_OPERATION = 0x0506;
/* WebGL-specific enums */
- //const GLenum UNPACK_FLIP_Y_WEBGL = 0x9240;
- //const GLenum UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241;
- //const GLenum CONTEXT_LOST_WEBGL = 0x9242;
- //const GLenum UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243;
- //const GLenum BROWSER_DEFAULT_WEBGL = 0x9244;
+ const GLenum UNPACK_FLIP_Y_WEBGL = 0x9240;
+ const GLenum UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241;
+ const GLenum CONTEXT_LOST_WEBGL = 0x9242;
+ const GLenum UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243;
+ const GLenum BROWSER_DEFAULT_WEBGL = 0x9244;
readonly attribute HTMLCanvasElement canvas;
readonly attribute GLsizei drawingBufferWidth;
@@ -487,19 +466,19 @@ interface WebGLRenderingContextBase
//sequence<DOMString>? getSupportedExtensions();
object? getExtension(DOMString name);
- //void activeTexture(GLenum texture);
+ void activeTexture(GLenum texture);
void attachShader(WebGLProgram? program, WebGLShader? shader);
//void bindAttribLocation(WebGLProgram? program, GLuint index, DOMString name);
void bindBuffer(GLenum target, WebGLBuffer? buffer);
void bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer);
void bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer);
void bindTexture(GLenum target, WebGLTexture? texture);
- //void blendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
- //void blendEquation(GLenum mode);
- //void blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
- //void blendFunc(GLenum sfactor, GLenum dfactor);
- //void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB,
- // GLenum srcAlpha, GLenum dstAlpha);
+ void blendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
+ void blendEquation(GLenum mode);
+ void blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
+ void blendFunc(GLenum sfactor, GLenum dfactor);
+ void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB,
+ GLenum srcAlpha, GLenum dstAlpha);
// typedef (ArrayBuffer or ArrayBufferView) BufferDataSource;
//void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
diff --git a/components/script/dom/webidls/WebGLShaderPrecisionFormat.webidl b/components/script/dom/webidls/WebGLShaderPrecisionFormat.webidl
new file mode 100644
index 00000000000..acbbeeceea1
--- /dev/null
+++ b/components/script/dom/webidls/WebGLShaderPrecisionFormat.webidl
@@ -0,0 +1,10 @@
+//
+// WebGL IDL definitions scraped from the Khronos specification:
+// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.7
+//
+
+interface WebGLShaderPrecisionFormat {
+ readonly attribute GLint rangeMin;
+ readonly attribute GLint rangeMax;
+ readonly attribute GLint precision;
+};
diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock
index 97bb9efa9ca..a0dd6de2832 100644
--- a/components/servo/Cargo.lock
+++ b/components/servo/Cargo.lock
@@ -465,7 +465,7 @@ dependencies = [
[[package]]
name = "gleam"
version = "0.0.1"
-source = "git+https://github.com/servo/gleam#98f889861aa1c8dee088ac751ab03ca639715bbe"
+source = "git+https://github.com/servo/gleam#0108e2a6c7ca4dc471bfb94ba1ed368335e4da28"
dependencies = [
"gl_common 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gl_generator 0.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock
index f523c48e27b..28a52b9cd53 100644
--- a/ports/cef/Cargo.lock
+++ b/ports/cef/Cargo.lock
@@ -457,7 +457,7 @@ dependencies = [
[[package]]
name = "gleam"
version = "0.0.1"
-source = "git+https://github.com/servo/gleam#98f889861aa1c8dee088ac751ab03ca639715bbe"
+source = "git+https://github.com/servo/gleam#0108e2a6c7ca4dc471bfb94ba1ed368335e4da28"
dependencies = [
"gl_common 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gl_generator 0.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock
index 2f0f944e2d8..b8de2289913 100644
--- a/ports/gonk/Cargo.lock
+++ b/ports/gonk/Cargo.lock
@@ -436,7 +436,7 @@ dependencies = [
[[package]]
name = "gleam"
version = "0.0.1"
-source = "git+https://github.com/servo/gleam#98f889861aa1c8dee088ac751ab03ca639715bbe"
+source = "git+https://github.com/servo/gleam#0108e2a6c7ca4dc471bfb94ba1ed368335e4da28"
dependencies = [
"gl_common 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gl_generator 0.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
diff --git a/tests/ref/basic.list b/tests/ref/basic.list
index 152bd0525f8..8ba1b36542f 100644
--- a/tests/ref/basic.list
+++ b/tests/ref/basic.list
@@ -334,7 +334,8 @@ resolution=600x800 == viewport_percentage_vw_vh.html viewport_percentage_vw_vh_b
experimental == viewport_rule.html viewport_rule_ref.html
== visibility_hidden.html visibility_hidden_ref.html
-flaky_cpu == webgl-context/clearcolor.html webgl-context/clearcolor_ref.html
+== webgl-context/clearcolor.html webgl-context/clearcolor_ref.html
+== webgl-context/draw_arrays_simple.html webgl-context/draw_arrays_simple_ref.html
== whitespace_nowrap_a.html whitespace_nowrap_ref.html
== whitespace_pre.html whitespace_pre_ref.html
@@ -343,5 +344,5 @@ flaky_cpu == webgl-context/clearcolor.html webgl-context/clearcolor_ref.html
== word_spacing_a.html word_spacing_ref.html
-# This file is must be sorted alphabetically.
+# This file must be sorted alphabetically.
# Please run `./mach test-tidy` to check your changes.
diff --git a/tests/ref/webgl-context/draw_arrays_simple.html b/tests/ref/webgl-context/draw_arrays_simple.html
new file mode 100644
index 00000000000..b006143491d
--- /dev/null
+++ b/tests/ref/webgl-context/draw_arrays_simple.html
@@ -0,0 +1,70 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>WebGL drawArrays test</title>
+<!--
+ This test should generate a 256x256 green square
+ on a 512x512 canvas
+-->
+<style>
+ html, body { margin: 0 }
+</style>
+<canvas id="c" width="512" height="512"></canvas>
+<script id="vertex_shader" type="x-shader/x-vertex">
+attribute vec2 a_position;
+
+void main() {
+ gl_Position = vec4(a_position, 0, 1);
+}
+</script>
+
+<script id="fragment_shader" type="x-shader/x-fragment">
+void main() {
+ gl_FragColor = vec4(0, 1, 0, 1); // green
+}
+</script>
+<script>
+ var gl = document.getElementById('c').getContext('webgl');
+
+ // Clear white
+ gl.clearColor(1, 1, 1, 1);
+ gl.clear(gl.COLOR_BUFFER_BIT);
+
+ // Create the program
+ var vertex_shader = gl.createShader(gl.VERTEX_SHADER),
+ fragment_shader = gl.createShader(gl.FRAGMENT_SHADER),
+ program = gl.createProgram();
+
+ gl.shaderSource(vertex_shader,
+ document.getElementById('vertex_shader').textContent);
+ gl.shaderSource(fragment_shader,
+ document.getElementById('fragment_shader').textContent);
+ gl.compileShader(vertex_shader);
+ gl.compileShader(fragment_shader);
+ gl.attachShader(program, vertex_shader);
+ gl.attachShader(program, fragment_shader);
+ gl.linkProgram(program);
+ gl.useProgram(program);
+
+ // Get the position from the fragment shader
+ var position = gl.getAttribLocation(program, "a_position");
+
+ // Square as two triangles
+ var square_data = new Float32Array([
+ -0.5, 0.5, // top left
+ 0.5, 0.5, // top right
+ -0.5, -0.5, // bottom left
+ -0.5, -0.5, // bottom left
+ 0.5, 0.5, // top right
+ 0.5, -0.5 // bottom right
+ ]);
+
+ // Create a buffer for the square with the square
+ // vertex data
+ var square_buffer = gl.createBuffer();
+ gl.bindBuffer(gl.ARRAY_BUFFER, square_buffer);
+ gl.bufferData(gl.ARRAY_BUFFER, square_data, gl.STATIC_DRAW);
+
+ gl.enableVertexAttribArray(position);
+ gl.vertexAttribPointer(position, 2, gl.FLOAT, false, 0, 0);
+ gl.drawArrays(gl.TRIANGLES, 0, square_data.length);
+</script>
diff --git a/tests/ref/webgl-context/draw_arrays_simple_ref.html b/tests/ref/webgl-context/draw_arrays_simple_ref.html
new file mode 100644
index 00000000000..975dc649337
--- /dev/null
+++ b/tests/ref/webgl-context/draw_arrays_simple_ref.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>WebGL drawArrays test</title>
+<style>
+ html, body { margin: 0 }
+ div {
+ position: absolute;
+ left: 128px;
+ top: 128px;
+ width: 256px;
+ height: 256px;
+ /* Totally green */
+ background-color: rgb(0, 255, 0);
+ }
+</style>
+<div></div>
diff --git a/tests/wpt/mozilla/tests/mozilla/interfaces.html b/tests/wpt/mozilla/tests/mozilla/interfaces.html
index 659c821f88d..e93ee2fe46a 100644
--- a/tests/wpt/mozilla/tests/mozilla/interfaces.html
+++ b/tests/wpt/mozilla/tests/mozilla/interfaces.html
@@ -187,6 +187,8 @@ var interfaceNamesInGlobalScope = [
"WebGLProgram",
"WebGLShader",
"WebGLObject",
+ "WebGLActiveInfo",
+ "WebGLShaderPrecisionFormat",
"WebSocket",
"Window",
"Worker",