aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-10-27 21:39:15 -0500
committerGitHub <noreply@github.com>2016-10-27 21:39:15 -0500
commitfbec79e920c0b0ddeaeeb6c0cc97b20ad85729e0 (patch)
treec3721f70f05a9d6fa9d86292d9b532b0d5c9856f
parentb4a882f81ab9d8128166a49f0514a398ad7a3b7d (diff)
parent71d266052b09c031707139466163a7087f0acc19 (diff)
downloadservo-fbec79e920c0b0ddeaeeb6c0cc97b20ad85729e0.tar.gz
servo-fbec79e920c0b0ddeaeeb6c0cc97b20ad85729e0.zip
Auto merge of #13872 - anholt:webgl-fbo, r=emilio
webgl: Add basic support for framebuffer attachments This is by no means a complete implementation, but I've slowed down on working on it, so I think we should look at what it takes to merge the current code. There are some major features missing, like initializing renderbuffers to 0 (uninitialized memory leak), tracking the attachments' attributes (width/height/format) for parameter requests, and lots of missing glCheckFramebufferStatus() validation. On the other hand, this is enough to run some demos using FBOs. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #13639 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13872) <!-- Reviewable:end -->
-rw-r--r--components/script/dom/webglframebuffer.rs218
-rw-r--r--components/script/dom/webglrenderbuffer.rs29
-rw-r--r--components/script/dom/webglrenderingcontext.rs148
-rw-r--r--components/script/dom/webidls/WebGLRenderingContext.webidl16
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/buffers/index-validation.html.ini3
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/context/incorrect-context-object-behaviour.html.ini6
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/context/methods.html.ini21
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/bad-arguments-test.html.ini12
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/error-reporting.html.ini6
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/invalid-passed-params.html.ini6
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/object-deletion-behaviour.html.ini192
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/uninitialized-test.html.ini4
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/conformance/quickCheckAPI-C.html.ini5
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/functions/isTests.html.ini5
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/renderbuffers/feedback-loop.html.ini4
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/renderbuffers/framebuffer-object-attachment.html.ini2
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/renderbuffers/renderbuffer-initialization.html.ini5
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/rendering/gl-scissor-fbo-test.html.ini1
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/copy-tex-image-2d-formats.html.ini28
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/mipmap-fbo.html.ini1
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-attachment-formats.html.ini7
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-copying-feedback-loops.html.ini7
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-fakeblack.html.ini7
23 files changed, 623 insertions, 110 deletions
diff --git a/components/script/dom/webglframebuffer.rs b/components/script/dom/webglframebuffer.rs
index 22749832389..8e22f17d079 100644
--- a/components/script/dom/webglframebuffer.rs
+++ b/components/script/dom/webglframebuffer.rs
@@ -4,15 +4,27 @@
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use canvas_traits::CanvasMsg;
+use dom::bindings::cell::DOMRefCell;
use dom::bindings::codegen::Bindings::WebGLFramebufferBinding;
use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
-use dom::bindings::js::Root;
+use dom::bindings::js::{HeapGCValue, JS, Root};
use dom::bindings::reflector::reflect_dom_object;
use dom::globalscope::GlobalScope;
use dom::webglobject::WebGLObject;
+use dom::webglrenderbuffer::WebGLRenderbuffer;
+use dom::webgltexture::WebGLTexture;
use ipc_channel::ipc::{self, IpcSender};
use std::cell::Cell;
-use webrender_traits::{WebGLCommand, WebGLFramebufferBindingRequest, WebGLFramebufferId};
+use webrender_traits::{WebGLCommand, WebGLFramebufferBindingRequest, WebGLFramebufferId, WebGLResult, WebGLError};
+
+#[must_root]
+#[derive(JSTraceable, Clone, HeapSizeOf)]
+enum WebGLFramebufferAttachment {
+ Renderbuffer(JS<WebGLRenderbuffer>),
+ Texture(JS<WebGLTexture>),
+}
+
+impl HeapGCValue for WebGLFramebufferAttachment {}
#[dom_struct]
pub struct WebGLFramebuffer {
@@ -21,8 +33,16 @@ pub struct WebGLFramebuffer {
/// target can only be gl::FRAMEBUFFER at the moment
target: Cell<Option<u32>>,
is_deleted: Cell<bool>,
+ status: Cell<u32>,
#[ignore_heap_size_of = "Defined in ipc-channel"]
renderer: IpcSender<CanvasMsg>,
+
+ // The attachment points for textures and renderbuffers on this
+ // FBO.
+ color: DOMRefCell<Option<WebGLFramebufferAttachment>>,
+ depth: DOMRefCell<Option<WebGLFramebufferAttachment>>,
+ stencil: DOMRefCell<Option<WebGLFramebufferAttachment>>,
+ depthstencil: DOMRefCell<Option<WebGLFramebufferAttachment>>,
}
impl WebGLFramebuffer {
@@ -35,6 +55,11 @@ impl WebGLFramebuffer {
target: Cell::new(None),
is_deleted: Cell::new(false),
renderer: renderer,
+ status: Cell::new(constants::FRAMEBUFFER_UNSUPPORTED),
+ color: DOMRefCell::new(None),
+ depth: DOMRefCell::new(None),
+ stencil: DOMRefCell::new(None),
+ depthstencil: DOMRefCell::new(None),
}
}
@@ -64,6 +89,11 @@ impl WebGLFramebuffer {
}
pub fn bind(&self, target: u32) {
+ // Update the framebuffer status on binding. It may have
+ // changed if its attachments were resized or deleted while
+ // we've been unbound.
+ self.update_status();
+
self.target.set(Some(target));
let cmd = WebGLCommand::BindFramebuffer(target, WebGLFramebufferBindingRequest::Explicit(self.id));
self.renderer.send(CanvasMsg::WebGL(cmd)).unwrap();
@@ -80,10 +110,188 @@ impl WebGLFramebuffer {
self.is_deleted.get()
}
+ fn update_status(&self) {
+ let has_c = self.color.borrow().is_some();
+ let has_z = self.depth.borrow().is_some();
+ let has_s = self.stencil.borrow().is_some();
+ let has_zs = self.depthstencil.borrow().is_some();
+
+ // From the WebGL spec, 6.6 ("Framebuffer Object Attachments"):
+ //
+ // "In the WebGL API, it is an error to concurrently attach
+ // renderbuffers to the following combinations of
+ // attachment points:
+ //
+ // DEPTH_ATTACHMENT + DEPTH_STENCIL_ATTACHMENT
+ // STENCIL_ATTACHMENT + DEPTH_STENCIL_ATTACHMENT
+ // DEPTH_ATTACHMENT + STENCIL_ATTACHMENT
+ //
+ // If any of the constraints above are violated, then:
+ //
+ // checkFramebufferStatus must return FRAMEBUFFER_UNSUPPORTED."
+ if (has_zs && (has_z || has_s)) ||
+ (has_z && has_s) {
+ self.status.set(constants::FRAMEBUFFER_UNSUPPORTED);
+ return;
+ }
+
+ if has_c || has_z || has_zs || has_s {
+ self.status.set(constants::FRAMEBUFFER_COMPLETE);
+ } else {
+ self.status.set(constants::FRAMEBUFFER_UNSUPPORTED);
+ }
+ }
+
pub fn check_status(&self) -> u32 {
- // Until we build support for attaching renderbuffers or
- // textures, all user FBOs are incomplete.
- return constants::FRAMEBUFFER_UNSUPPORTED;
+ return self.status.get();
+ }
+
+ pub fn renderbuffer(&self, attachment: u32, rb: Option<&WebGLRenderbuffer>) -> WebGLResult<()> {
+ let binding = match attachment {
+ constants::COLOR_ATTACHMENT0 => &self.color,
+ constants::DEPTH_ATTACHMENT => &self.depth,
+ constants::STENCIL_ATTACHMENT => &self.stencil,
+ constants::DEPTH_STENCIL_ATTACHMENT => &self.depthstencil,
+ _ => return Err(WebGLError::InvalidEnum),
+ };
+
+ let rb_id = match rb {
+ Some(rb) => {
+ *binding.borrow_mut() = Some(WebGLFramebufferAttachment::Renderbuffer(JS::from_ref(rb)));
+ Some(rb.id())
+ }
+
+ _ => {
+ *binding.borrow_mut() = None;
+ None
+ }
+ };
+
+ self.renderer.send(CanvasMsg::WebGL(WebGLCommand::FramebufferRenderbuffer(constants::FRAMEBUFFER,
+ attachment,
+ constants::RENDERBUFFER,
+ rb_id))).unwrap();
+
+ self.update_status();
+ Ok(())
+ }
+
+ pub fn texture2d(&self, attachment: u32, textarget: u32, texture: Option<&WebGLTexture>,
+ level: i32) -> WebGLResult<()> {
+ let binding = match attachment {
+ constants::COLOR_ATTACHMENT0 => &self.color,
+ constants::DEPTH_ATTACHMENT => &self.depth,
+ constants::STENCIL_ATTACHMENT => &self.stencil,
+ constants::DEPTH_STENCIL_ATTACHMENT => &self.depthstencil,
+ _ => return Err(WebGLError::InvalidEnum),
+ };
+
+ let tex_id = match texture {
+ // Note, from the GLES 2.0.25 spec, page 113:
+ // "If texture is zero, then textarget and level are ignored."
+ Some(texture) => {
+ *binding.borrow_mut() = Some(WebGLFramebufferAttachment::Texture(JS::from_ref(texture)));
+
+ // From the GLES 2.0.25 spec, page 113:
+ //
+ // "level specifies the mipmap level of the texture image
+ // to be attached to the framebuffer and must be
+ // 0. Otherwise, INVALID_VALUE is generated."
+ if level != 0 {
+ return Err(WebGLError::InvalidValue);
+ }
+
+ // "If texture is not zero, then texture must either
+ // name an existing texture object with an target of
+ // textarget, or texture must name an existing cube
+ // map texture and textarget must be one of:
+ // TEXTURE_CUBE_MAP_POSITIVE_X,
+ // TEXTURE_CUBE_MAP_POSITIVE_Y,
+ // TEXTURE_CUBE_MAP_POSITIVE_Z,
+ // TEXTURE_CUBE_MAP_NEGATIVE_X,
+ // TEXTURE_CUBE_MAP_NEGATIVE_Y, or
+ // TEXTURE_CUBE_MAP_NEGATIVE_Z. Otherwise,
+ // INVALID_OPERATION is generated."
+ let is_cube = match textarget {
+ constants::TEXTURE_2D => false,
+
+ constants::TEXTURE_CUBE_MAP_POSITIVE_X => true,
+ constants::TEXTURE_CUBE_MAP_POSITIVE_Y => true,
+ constants::TEXTURE_CUBE_MAP_POSITIVE_Z => true,
+ constants::TEXTURE_CUBE_MAP_NEGATIVE_X => true,
+ constants::TEXTURE_CUBE_MAP_NEGATIVE_Y => true,
+ constants::TEXTURE_CUBE_MAP_NEGATIVE_Z => true,
+
+ _ => return Err(WebGLError::InvalidEnum),
+ };
+
+ match texture.target() {
+ Some(constants::TEXTURE_CUBE_MAP) if is_cube => {}
+ Some(_) if !is_cube => {}
+ _ => return Err(WebGLError::InvalidOperation),
+ }
+
+ Some(texture.id())
+ }
+
+ _ => {
+ *binding.borrow_mut() = None;
+ self.update_status();
+ None
+ }
+ };
+
+ self.renderer.send(CanvasMsg::WebGL(WebGLCommand::FramebufferTexture2D(constants::FRAMEBUFFER,
+ attachment,
+ textarget,
+ tex_id,
+ level))).unwrap();
+
+ self.update_status();
+ Ok(())
+ }
+
+ pub fn detach_renderbuffer(&self, rb: &WebGLRenderbuffer) {
+ let attachments = [&self.color,
+ &self.depth,
+ &self.stencil,
+ &self.depthstencil];
+
+ for attachment in &attachments {
+ let matched = {
+ match *attachment.borrow() {
+ Some(WebGLFramebufferAttachment::Renderbuffer(ref att_rb))
+ if rb.id() == att_rb.id() => true,
+ _ => false,
+ }
+ };
+
+ if matched {
+ *attachment.borrow_mut() = None;
+ self.update_status();
+ }
+ }
+ }
+
+ pub fn detach_texture(&self, texture: &WebGLTexture) {
+ let attachments = [&self.color,
+ &self.depth,
+ &self.stencil,
+ &self.depthstencil];
+
+ for attachment in &attachments {
+ let matched = {
+ match *attachment.borrow() {
+ Some(WebGLFramebufferAttachment::Texture(ref att_texture))
+ if texture.id() == att_texture.id() => true,
+ _ => false,
+ }
+ };
+
+ if matched {
+ *attachment.borrow_mut() = None;
+ }
+ }
}
pub fn target(&self) -> Option<u32> {
diff --git a/components/script/dom/webglrenderbuffer.rs b/components/script/dom/webglrenderbuffer.rs
index de4eaa2d2c8..9e3c516cfbd 100644
--- a/components/script/dom/webglrenderbuffer.rs
+++ b/components/script/dom/webglrenderbuffer.rs
@@ -5,13 +5,14 @@
// https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl
use canvas_traits::CanvasMsg;
use dom::bindings::codegen::Bindings::WebGLRenderbufferBinding;
+use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants;
use dom::bindings::js::Root;
use dom::bindings::reflector::reflect_dom_object;
use dom::globalscope::GlobalScope;
use dom::webglobject::WebGLObject;
use ipc_channel::ipc::{self, IpcSender};
use std::cell::Cell;
-use webrender_traits::{WebGLCommand, WebGLRenderbufferId};
+use webrender_traits::{WebGLCommand, WebGLRenderbufferId, WebGLResult, WebGLError};
#[dom_struct]
pub struct WebGLRenderbuffer {
@@ -19,6 +20,7 @@ pub struct WebGLRenderbuffer {
id: WebGLRenderbufferId,
ever_bound: Cell<bool>,
is_deleted: Cell<bool>,
+ internal_format: Cell<Option<u32>>,
#[ignore_heap_size_of = "Defined in ipc-channel"]
renderer: IpcSender<CanvasMsg>,
}
@@ -33,6 +35,7 @@ impl WebGLRenderbuffer {
ever_bound: Cell::new(false),
is_deleted: Cell::new(false),
renderer: renderer,
+ internal_format: Cell::new(None),
}
}
@@ -81,4 +84,28 @@ impl WebGLRenderbuffer {
pub fn ever_bound(&self) -> bool {
self.ever_bound.get()
}
+
+ pub fn storage(&self, internal_format: u32, width: i32, height: i32) -> WebGLResult<()> {
+ // Validate the internal_format, and save it for completeness
+ // validation.
+ match internal_format {
+ constants::RGBA4 |
+ constants::DEPTH_STENCIL |
+ constants::DEPTH_COMPONENT16 |
+ constants::STENCIL_INDEX8 =>
+ self.internal_format.set(Some(internal_format)),
+
+ _ => return Err(WebGLError::InvalidEnum),
+ };
+
+ // FIXME: Check that w/h are < MAX_RENDERBUFFER_SIZE
+
+ // FIXME: Invalidate completeness after the call
+
+ let msg = CanvasMsg::WebGL(WebGLCommand::RenderbufferStorage(constants::RENDERBUFFER,
+ internal_format, width, height));
+ self.renderer.send(msg).unwrap();
+
+ Ok(())
+ }
}
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index abfa10983b0..b67f524825f 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -74,11 +74,17 @@ macro_rules! handle_potential_webgl_error {
//
// and similar text occurs for other object types.
macro_rules! handle_object_deletion {
- ($binding:expr, $object:ident) => {
+ ($self_:expr, $binding:expr, $object:ident, $unbind_command:expr) => {
if let Some(bound_object) = $binding.get() {
if bound_object.id() == $object.id() {
$binding.set(None);
}
+
+ if let Some(command) = $unbind_command {
+ $self_.ipc_renderer
+ .send(CanvasMsg::WebGL(command))
+ .unwrap();
+ }
}
};
}
@@ -804,13 +810,23 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
return self.webgl_error(InvalidOperation);
}
- self.bound_framebuffer.set(framebuffer);
if let Some(framebuffer) = framebuffer {
- framebuffer.bind(target)
+ if framebuffer.is_deleted() {
+ // From the WebGL spec:
+ //
+ // "An attempt to bind a deleted framebuffer will
+ // generate an INVALID_OPERATION error, and the
+ // current binding will remain untouched."
+ return self.webgl_error(InvalidOperation);
+ } else {
+ framebuffer.bind(target);
+ self.bound_framebuffer.set(Some(framebuffer));
+ }
} else {
// Bind the default framebuffer
let cmd = WebGLCommand::BindFramebuffer(target, WebGLFramebufferBindingRequest::Default);
self.ipc_renderer.send(CanvasMsg::WebGL(cmd)).unwrap();
+ self.bound_framebuffer.set(framebuffer);
}
}
@@ -1241,8 +1257,10 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
fn DeleteBuffer(&self, buffer: Option<&WebGLBuffer>) {
if let Some(buffer) = buffer {
- handle_object_deletion!(self.bound_buffer_array, buffer);
- handle_object_deletion!(self.bound_buffer_element_array, buffer);
+ handle_object_deletion!(self, self.bound_buffer_array, buffer,
+ Some(WebGLCommand::BindBuffer(constants::ARRAY_BUFFER, None)));
+ handle_object_deletion!(self, self.bound_buffer_element_array, buffer,
+ Some(WebGLCommand::BindBuffer(constants::ELEMENT_ARRAY_BUFFER, None)));
buffer.delete()
}
}
@@ -1250,7 +1268,9 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.6
fn DeleteFramebuffer(&self, framebuffer: Option<&WebGLFramebuffer>) {
if let Some(framebuffer) = framebuffer {
- handle_object_deletion!(self.bound_framebuffer, framebuffer);
+ handle_object_deletion!(self, self.bound_framebuffer, framebuffer,
+ Some(WebGLCommand::BindFramebuffer(constants::FRAMEBUFFER,
+ WebGLFramebufferBindingRequest::Default)));
framebuffer.delete()
}
}
@@ -1258,7 +1278,22 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.7
fn DeleteRenderbuffer(&self, renderbuffer: Option<&WebGLRenderbuffer>) {
if let Some(renderbuffer) = renderbuffer {
- handle_object_deletion!(self.bound_renderbuffer, renderbuffer);
+ handle_object_deletion!(self, self.bound_renderbuffer, renderbuffer,
+ Some(WebGLCommand::BindRenderbuffer(constants::RENDERBUFFER, None)));
+ // From the GLES 2.0.25 spec, page 113:
+ //
+ // "If a renderbuffer object is deleted while its
+ // image is attached to the currently bound
+ // framebuffer, then it is as if
+ // FramebufferRenderbuffer had been called, with a
+ // renderbuffer of 0, for each attachment point to
+ // which this image was attached in the currently
+ // bound framebuffer."
+ //
+ if let Some(fb) = self.bound_framebuffer.get() {
+ fb.detach_renderbuffer(renderbuffer);
+ }
+
renderbuffer.delete()
}
}
@@ -1266,8 +1301,22 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
fn DeleteTexture(&self, texture: Option<&WebGLTexture>) {
if let Some(texture) = texture {
- handle_object_deletion!(self.bound_texture_2d, texture);
- handle_object_deletion!(self.bound_texture_cube_map, texture);
+ handle_object_deletion!(self, self.bound_texture_2d, texture,
+ Some(WebGLCommand::BindTexture(constants::TEXTURE_2D, None)));
+ handle_object_deletion!(self, self.bound_texture_cube_map, texture,
+ Some(WebGLCommand::BindTexture(constants::TEXTURE_CUBE_MAP, None)));
+
+ // From the GLES 2.0.25 spec, page 113:
+ //
+ // "If a texture object is deleted while its image is
+ // attached to the currently bound framebuffer, then
+ // it is as if FramebufferTexture2D had been called,
+ // with a texture of 0, for each attachment point to
+ // which this image was attached in the currently
+ // bound framebuffer."
+ if let Some(fb) = self.bound_framebuffer.get() {
+ fb.detach_texture(texture);
+ }
texture.delete()
}
}
@@ -1275,7 +1324,10 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
fn DeleteProgram(&self, program: Option<&WebGLProgram>) {
if let Some(program) = program {
- handle_object_deletion!(self.current_program, program);
+ // FIXME: We should call glUseProgram(0), but
+ // WebGLCommand::UseProgram() doesn't take an Option
+ // currently. This is also a problem for useProgram(null)
+ handle_object_deletion!(self, self.current_program, program, None);
program.delete()
}
}
@@ -2526,6 +2578,82 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
fn TexParameteri(&self, target: u32, name: u32, value: i32) {
self.tex_parameter(target, name, TexParameterValue::Int(value))
}
+
+ fn CheckFramebufferStatus(&self, target: u32) -> u32 {
+ // From the GLES 2.0.25 spec, 4.4 ("Framebuffer Objects"):
+ //
+ // "If target is not FRAMEBUFFER, INVALID_ENUM is
+ // generated. If CheckFramebufferStatus generates an
+ // error, 0 is returned."
+ if target != constants::FRAMEBUFFER {
+ self.webgl_error(InvalidEnum);
+ return 0;
+ }
+
+ match self.bound_framebuffer.get() {
+ Some(fb) => return fb.check_status(),
+ None => return constants::FRAMEBUFFER_COMPLETE,
+ }
+ }
+
+ fn RenderbufferStorage(&self, target: u32, internal_format: u32,
+ width: i32, height: i32) {
+ // From the GLES 2.0.25 spec:
+ //
+ // "target must be RENDERBUFFER."
+ if target != constants::RENDERBUFFER {
+ return self.webgl_error(InvalidOperation)
+ }
+
+ // From the GLES 2.0.25 spec:
+ //
+ // "If either width or height is greater than the value of
+ // MAX_RENDERBUFFER_SIZE , the error INVALID_VALUE is
+ // generated."
+ //
+ // and we have to throw out negative-size values as well just
+ // like for TexImage.
+ //
+ // FIXME: Handle max_renderbuffer_size, which doesn't seem to
+ // be in limits.
+ if width < 0 || height < 0 {
+ return self.webgl_error(InvalidValue);
+ }
+
+ match self.bound_renderbuffer.get() {
+ Some(rb) => handle_potential_webgl_error!(self, rb.storage(internal_format, width, height)),
+ None => self.webgl_error(InvalidOperation),
+ };
+
+ // FIXME: We need to clear the renderbuffer before it can be
+ // accessed. See https://github.com/servo/servo/issues/13710
+ }
+
+ fn FramebufferRenderbuffer(&self, target: u32, attachment: u32,
+ renderbuffertarget: u32,
+ rb: Option<&WebGLRenderbuffer>) {
+ if target != constants::FRAMEBUFFER || renderbuffertarget != constants::RENDERBUFFER {
+ return self.webgl_error(InvalidEnum);
+ }
+
+ match self.bound_framebuffer.get() {
+ Some(fb) => handle_potential_webgl_error!(self, fb.renderbuffer(attachment, rb)),
+ None => self.webgl_error(InvalidOperation),
+ };
+ }
+
+ fn FramebufferTexture2D(&self, target: u32, attachment: u32,
+ textarget: u32, texture: Option<&WebGLTexture>,
+ level: i32) {
+ if target != constants::FRAMEBUFFER {
+ return self.webgl_error(InvalidEnum);
+ }
+
+ match self.bound_framebuffer.get() {
+ Some(fb) => handle_potential_webgl_error!(self, fb.texture2d(attachment, textarget, texture, level)),
+ None => self.webgl_error(InvalidOperation),
+ };
+ }
}
pub trait LayoutCanvasWebGLRenderingContextHelpers {
diff --git a/components/script/dom/webidls/WebGLRenderingContext.webidl b/components/script/dom/webidls/WebGLRenderingContext.webidl
index 1eb85fc236d..3f20d89ce96 100644
--- a/components/script/dom/webidls/WebGLRenderingContext.webidl
+++ b/components/script/dom/webidls/WebGLRenderingContext.webidl
@@ -501,7 +501,7 @@ interface WebGLRenderingContextBase
[Throws]
void bufferSubData(GLenum target, GLintptr offset, object? data);
- //[WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target);
+ [WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target);
void clear(GLbitfield mask);
void clearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
void clearDepth(GLclampf depth);
@@ -566,11 +566,11 @@ interface WebGLRenderingContextBase
void enableVertexAttribArray(GLuint index);
void finish();
void flush();
- //void framebufferRenderbuffer(GLenum target, GLenum attachment,
- // GLenum renderbuffertarget,
- // WebGLRenderbuffer? renderbuffer);
- //void framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget,
- // WebGLTexture? texture, GLint level);
+ void framebufferRenderbuffer(GLenum target, GLenum attachment,
+ GLenum renderbuffertarget,
+ WebGLRenderbuffer? renderbuffer);
+ void framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget,
+ WebGLTexture? texture, GLint level);
void frontFace(GLenum mode);
void generateMipmap(GLenum target);
@@ -626,8 +626,8 @@ interface WebGLRenderingContextBase
void readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type, object? pixels);
- //void renderbufferStorage(GLenum target, GLenum internalformat,
- // GLsizei width, GLsizei height);
+ void renderbufferStorage(GLenum target, GLenum internalformat,
+ GLsizei width, GLsizei height);
void sampleCoverage(GLclampf value, GLboolean invert);
void scissor(GLint x, GLint y, GLsizei width, GLsizei height);
diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/buffers/index-validation.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/buffers/index-validation.html.ini
index 4155f944273..a23bc4c3ebb 100644
--- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/buffers/index-validation.html.ini
+++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/buffers/index-validation.html.ini
@@ -1,8 +1,5 @@
[index-validation.html]
type: testharness
- [WebGL test #0: gl.checkFramebufferStatus(gl.FRAMEBUFFER) should be 36053. Threw exception TypeError: gl.checkFramebufferStatus is not a function]
- expected: FAIL
-
[WebGL test #9: getError expected: INVALID_OPERATION. Was NO_ERROR : ]
expected: FAIL
diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/context/incorrect-context-object-behaviour.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/context/incorrect-context-object-behaviour.html.ini
index e23f84f8b5b..fc8454c9dcd 100644
--- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/context/incorrect-context-object-behaviour.html.ini
+++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/context/incorrect-context-object-behaviour.html.ini
@@ -32,12 +32,6 @@
[WebGL test #12: getError expected: INVALID_OPERATION. Was NO_ERROR : after evaluating: contextA.bindTexture(contextA.TEXTURE_2D, textureB)]
expected: FAIL
- [WebGL test #13: contextA.framebufferRenderbuffer(contextA.FRAMEBUFFER, contextA.DEPTH_ATTACHMENT, contextA.RENDERBUFFER, renderBufferB) threw exception TypeError: contextA.framebufferRenderbuffer is not a function]
- expected: FAIL
-
- [WebGL test #14: contextA.framebufferTexture2D(contextA.FRAMEBUFFER, contextA.COLOR_ATTACHMENT0, contextA.TEXTURE_2D, textureB, 0) threw exception TypeError: contextA.framebufferTexture2D is not a function]
- expected: FAIL
-
[WebGL test #15: getError expected: INVALID_OPERATION. Was INVALID_ENUM : after evaluating: contextA.getProgramParameter(programB, 0)]
expected: FAIL
diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/context/methods.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/context/methods.html.ini
index 6cec6740f90..9bdfbe5b6e0 100644
--- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/context/methods.html.ini
+++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/context/methods.html.ini
@@ -2,9 +2,6 @@
type: testharness
expected:
if os == "mac": CRASH
- [WebGL test #0: Property either does not exist or is not a function: checkFramebufferStatus]
- expected: FAIL
-
[WebGL test #1: Property either does not exist or is not a function: copyTexImage2D]
expected: FAIL
@@ -23,12 +20,6 @@
[WebGL test #6: Property either does not exist or is not a function: flush]
expected: FAIL
- [WebGL test #7: Property either does not exist or is not a function: framebufferRenderbuffer]
- expected: FAIL
-
- [WebGL test #8: Property either does not exist or is not a function: framebufferTexture2D]
- expected: FAIL
-
[WebGL test #9: Property either does not exist or is not a function: generateMipmap]
expected: FAIL
@@ -89,9 +80,6 @@
[WebGL test #29: Property either does not exist or is not a function: readPixels]
expected: FAIL
- [WebGL test #30: Property either does not exist or is not a function: renderbufferStorage]
- expected: FAIL
-
[WebGL test #31: Property either does not exist or is not a function: sampleCoverage]
expected: FAIL
@@ -167,12 +155,6 @@
[WebGL test #3: Property either does not exist or is not a function: disableVertexAttribArray]
expected: FAIL
- [WebGL test #4: Property either does not exist or is not a function: framebufferRenderbuffer]
- expected: FAIL
-
- [WebGL test #5: Property either does not exist or is not a function: framebufferTexture2D]
- expected: FAIL
-
[WebGL test #6: Property either does not exist or is not a function: getActiveAttrib]
expected: FAIL
@@ -230,9 +212,6 @@
[WebGL test #25: Property either does not exist or is not a function: readPixels]
expected: FAIL
- [WebGL test #26: Property either does not exist or is not a function: renderbufferStorage]
- expected: FAIL
-
[WebGL test #27: Property either does not exist or is not a function: sampleCoverage]
expected: FAIL
diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/bad-arguments-test.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/bad-arguments-test.html.ini
index 96ffe85122a..814488f2b9a 100644
--- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/bad-arguments-test.html.ini
+++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/bad-arguments-test.html.ini
@@ -6,12 +6,6 @@
[WebGL test #60: context.detachShader(argument, shader) should be undefined. Threw exception TypeError: context.detachShader is not a function]
expected: FAIL
- [WebGL test #68: context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, argument) should be undefined. Threw exception TypeError: context.framebufferRenderbuffer is not a function]
- expected: FAIL
-
- [WebGL test #69: context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, argument, 0) should be undefined. Threw exception TypeError: context.framebufferTexture2D is not a function]
- expected: FAIL
-
[WebGL test #70: context.uniform2fv(argument, new Float32Array([0.0, 0.0\])) should be undefined. Threw exception TypeError: context.uniform2fv is not a function]
expected: FAIL
@@ -36,12 +30,6 @@
[WebGL test #86: context.detachShader(argument, shader) should be undefined. Threw exception TypeError: context.detachShader is not a function]
expected: FAIL
- [WebGL test #94: context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, argument) should be undefined. Threw exception TypeError: context.framebufferRenderbuffer is not a function]
- expected: FAIL
-
- [WebGL test #95: context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, argument, 0) should be undefined. Threw exception TypeError: context.framebufferTexture2D is not a function]
- expected: FAIL
-
[WebGL test #96: context.uniform2fv(argument, new Float32Array([0.0, 0.0\])) should be undefined. Threw exception TypeError: context.uniform2fv is not a function]
expected: FAIL
diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/error-reporting.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/error-reporting.html.ini
index ce51d383e89..da28ac25155 100644
--- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/error-reporting.html.ini
+++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/error-reporting.html.ini
@@ -24,15 +24,9 @@
[WebGL test #11: getError expected: INVALID_VALUE. Was NO_ERROR : ]
expected: FAIL
- [WebGL test #15: context.framebufferRenderbuffer(context.FRAMEBUFFER, context.DEPTH_ATTACHMENT, context.RENDERBUFFER, null) should be undefined. Threw exception TypeError: context.framebufferRenderbuffer is not a function]
- expected: FAIL
-
[WebGL test #16: getError expected: INVALID_OPERATION. Was NO_ERROR : ]
expected: FAIL
- [WebGL test #18: context.framebufferTexture2D(context.FRAMEBUFFER, context.COLOR_ATTACHMENT0, context.TEXTURE_2D, null, 0) should be undefined. Threw exception TypeError: context.framebufferTexture2D is not a function]
- expected: FAIL
-
[WebGL test #19: getError expected: INVALID_OPERATION. Was NO_ERROR : ]
expected: FAIL
diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/invalid-passed-params.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/invalid-passed-params.html.ini
index 7902ca6a6eb..6199e0354ce 100644
--- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/invalid-passed-params.html.ini
+++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/invalid-passed-params.html.ini
@@ -45,12 +45,6 @@
[WebGL test #23: getError expected: NO_ERROR. Was INVALID_VALUE : after evaluating: context.texSubImage2D(context.TEXTURE_2D, 0, 0, 0, 2, 2, context.RGBA, context.UNSIGNED_BYTE, pixels)]
expected: FAIL
- [WebGL test #30: context.renderbufferStorage(context.RENDERBUFFER, context.RGBA4, -2, -2) threw exception TypeError: context.renderbufferStorage is not a function]
- expected: FAIL
-
- [WebGL test #31: context.renderbufferStorage(context.RENDERBUFFER, context.RGBA4, 16, 16) threw exception TypeError: context.renderbufferStorage is not a function]
- expected: FAIL
-
[WebGL test #44: context.getError() should be 1281. Was 0.]
expected: FAIL
diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/object-deletion-behaviour.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/object-deletion-behaviour.html.ini
index 88faa3358a0..8e2be3e1863 100644
--- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/object-deletion-behaviour.html.ini
+++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/object-deletion-behaviour.html.ini
@@ -1,6 +1,5 @@
[object-deletion-behaviour.html]
type: testharness
- expected: ERROR
[WebGL test #9: gl.isShader(vertexShader) should be true. Threw exception TypeError: gl.isShader is not a function]
expected: FAIL
@@ -19,9 +18,6 @@
[WebGL test #21: gl.isShader(fragmentShader) should be false. Threw exception TypeError: gl.isShader is not a function]
expected: FAIL
- [WebGL test #29: gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0) threw exception TypeError: gl.framebufferTexture2D is not a function]
- expected: FAIL
-
[WebGL test #30: gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) should be [object WebGLTexture\]. Threw exception TypeError: gl.getFramebufferAttachmentParameter is not a function]
expected: FAIL
@@ -46,9 +42,6 @@
[WebGL test #45: getError expected: NO_ERROR. Was INVALID_OPERATION : after evaluating: gl.bindTexture(gl.TEXTURE_CUBE_MAP, texCubeMap)]
expected: FAIL
- [WebGL test #69: gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, rbo) threw exception TypeError: gl.framebufferRenderbuffer is not a function]
- expected: FAIL
-
[WebGL test #70: gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) should be [object WebGLRenderbuffer\]. Threw exception TypeError: gl.getFramebufferAttachmentParameter is not a function]
expected: FAIL
@@ -61,15 +54,192 @@
[WebGL test #74: gl.isRenderbuffer(rbo) should be false. Threw exception TypeError: gl.isRenderbuffer is not a function]
expected: FAIL
- [WebGL test #83: gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 16) threw exception TypeError: gl.renderbufferStorage is not a function]
+ [WebGL test #86: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL
- [WebGL test #85: gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, rbo) threw exception TypeError: gl.framebufferRenderbuffer is not a function]
+ [WebGL test #51: getError expected: NO_ERROR. Was INVALID_OPERATION : after evaluating: gl.bindTexture(gl.TEXTURE_2D, t)]
expected: FAIL
- [WebGL test #86: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
+ [WebGL test #113: gl.getParameter(gl.ARRAY_BUFFER_BINDING) should be null. Was [object WebGLBuffer\].]
expected: FAIL
- [WebGL test #51: getError expected: NO_ERROR. Was INVALID_OPERATION : after evaluating: gl.bindTexture(gl.TEXTURE_2D, t)]
+ [WebGL test #122: gl.getParameter(gl.ARRAY_BUFFER_BINDING) should be null. Was [object WebGLBuffer\].]
+ expected: FAIL
+
+ [WebGL test #130: gl.getParameter(gl.ELEMENT_ARRAY_BUFFER_BINDING) should be null. Was [object WebGLBuffer\].]
+ expected: FAIL
+
+ [WebGL test #133: gl.bufferData(gl.ARRAY_BUFFER, 1, gl.STATIC_DRAW) threw exception TypeError: Value is not an object.]
+ expected: FAIL
+
+ [WebGL test #136: gl.bufferData(gl.ARRAY_BUFFER, 1, gl.STATIC_DRAW) threw exception TypeError: Value is not an object.]
+ expected: FAIL
+
+ [WebGL test #147: gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING) should be [object WebGLBuffer\]. Was null.]
+ expected: FAIL
+
+ [WebGL test #148: gl.getVertexAttrib(2, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING) should be [object WebGLBuffer\]. Was null.]
+ expected: FAIL
+
+ [WebGL test #149: gl.getVertexAttrib(3, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING) should be [object WebGLBuffer\]. Was null.]
+ expected: FAIL
+
+ [WebGL test #150: getError expected: NO_ERROR. Was INVALID_ENUM : after evaluating: gl.deleteBuffer(b2);]
+ expected: FAIL
+
+ [WebGL test #151: gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING) should be [object WebGLBuffer\]. Was null.]
+ expected: FAIL
+
+ [WebGL test #154: getError expected: NO_ERROR. Was INVALID_ENUM : after evaluating: gl.deleteBuffer(b1);]
+ expected: FAIL
+
+ [WebGL test #156: getError expected: NO_ERROR. Was INVALID_ENUM : after evaluating: gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)]
+ expected: FAIL
+
+ [WebGL test #161: getError expected: NO_ERROR. Was INVALID_OPERATION : after evaluating: gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)]
+ expected: FAIL
+
+ [WebGL test #114: gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) should be [object WebGLRenderbuffer\]. Threw exception TypeError: gl.getFramebufferAttachmentParameter is not a function]
+ expected: FAIL
+
+ [WebGL test #115: gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) should be [object WebGLRenderbuffer\]. Threw exception TypeError: gl.getFramebufferAttachmentParameter is not a function]
+ expected: FAIL
+
+ [WebGL test #118: gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) should be 0. Threw exception TypeError: gl.getFramebufferAttachmentParameter is not a function]
+ expected: FAIL
+
+ [WebGL test #119: gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.STENCIL_ATTACHMENT, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) should be 0. Threw exception TypeError: gl.getFramebufferAttachmentParameter is not a function]
+ expected: FAIL
+
+ [WebGL test #120: gl.checkFramebufferStatus(gl.FRAMEBUFFER) should be 36053. Was 36061.]
+ expected: FAIL
+
+ [WebGL test #121: gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) should be [object WebGLRenderbuffer\]. Threw exception TypeError: gl.getFramebufferAttachmentParameter is not a function]
+ expected: FAIL
+
+ [WebGL test #145: gl.getParameter(gl.ARRAY_BUFFER_BINDING) should be null. Was [object WebGLBuffer\].]
+ expected: FAIL
+
+ [WebGL test #154: gl.getParameter(gl.ARRAY_BUFFER_BINDING) should be null. Was [object WebGLBuffer\].]
+ expected: FAIL
+
+ [WebGL test #162: gl.getParameter(gl.ELEMENT_ARRAY_BUFFER_BINDING) should be null. Was [object WebGLBuffer\].]
+ expected: FAIL
+
+ [WebGL test #165: gl.bufferData(gl.ARRAY_BUFFER, 1, gl.STATIC_DRAW) threw exception TypeError: Value is not an object.]
+ expected: FAIL
+
+ [WebGL test #168: gl.bufferData(gl.ARRAY_BUFFER, 1, gl.STATIC_DRAW) threw exception TypeError: Value is not an object.]
+ expected: FAIL
+
+ [WebGL test #179: gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING) should be [object WebGLBuffer\]. Was null.]
+ expected: FAIL
+
+ [WebGL test #180: gl.getVertexAttrib(2, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING) should be [object WebGLBuffer\]. Was null.]
+ expected: FAIL
+
+ [WebGL test #181: gl.getVertexAttrib(3, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING) should be [object WebGLBuffer\]. Was null.]
+ expected: FAIL
+
+ [WebGL test #182: getError expected: NO_ERROR. Was INVALID_ENUM : after evaluating: gl.deleteBuffer(b2);]
+ expected: FAIL
+
+ [WebGL test #183: gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING) should be [object WebGLBuffer\]. Was null.]
+ expected: FAIL
+
+ [WebGL test #186: getError expected: NO_ERROR. Was INVALID_ENUM : after evaluating: gl.deleteBuffer(b1);]
+ expected: FAIL
+
+ [WebGL test #188: getError expected: NO_ERROR. Was INVALID_ENUM : after evaluating: gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)]
+ expected: FAIL
+
+ [WebGL test #193: getError expected: NO_ERROR. Was INVALID_OPERATION : after evaluating: gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)]
+ expected: FAIL
+
+ [WebGL test #216: at (0, 0) expected: 255,0,0,255 was 0,0,0,0]
+ expected: FAIL
+
+ [WebGL test #224: at (16, 0) expected: 0,255,0,255 was 0,0,0,0]
+ expected: FAIL
+
+ [WebGL test #227: at (0, 0) expected: 0,255,0,255 was 255,0,0,255]
+ expected: FAIL
+
+ [WebGL test #168: gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) should be [object WebGLRenderbuffer\]. Threw exception TypeError: gl.getFramebufferAttachmentParameter is not a function]
+ expected: FAIL
+
+ [WebGL test #170: gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) threw exception TypeError: gl.getFramebufferAttachmentParameter is not a function]
+ expected: FAIL
+
+ [WebGL test #171: gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) threw exception TypeError: gl.getFramebufferAttachmentParameter is not a function]
+ expected: FAIL
+
+ [WebGL test #187: gl.checkFramebufferStatus(gl.FRAMEBUFFER) should not be 36053.]
+ expected: FAIL
+
+ [WebGL test #196: gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) should be [object WebGLTexture\]. Threw exception TypeError: gl.getFramebufferAttachmentParameter is not a function]
+ expected: FAIL
+
+ [WebGL test #198: gl.getFramebufferAttachmentParameter(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) threw exception TypeError: gl.getFramebufferAttachmentParameter is not a function]
+ expected: FAIL
+
+ [WebGL test #199: gl.checkFramebufferStatus(gl.FRAMEBUFFER) should not be 36053.]
+ expected: FAIL
+
+ [WebGL test #210: gl.getParameter(gl.ARRAY_BUFFER_BINDING) should be null. Was [object WebGLBuffer\].]
+ expected: FAIL
+
+ [WebGL test #219: gl.getParameter(gl.ARRAY_BUFFER_BINDING) should be null. Was [object WebGLBuffer\].]
+ expected: FAIL
+
+ [WebGL test #227: gl.getParameter(gl.ELEMENT_ARRAY_BUFFER_BINDING) should be null. Was [object WebGLBuffer\].]
+ expected: FAIL
+
+ [WebGL test #230: gl.bufferData(gl.ARRAY_BUFFER, 1, gl.STATIC_DRAW) threw exception TypeError: Value is not an object.]
+ expected: FAIL
+
+ [WebGL test #233: gl.bufferData(gl.ARRAY_BUFFER, 1, gl.STATIC_DRAW) threw exception TypeError: Value is not an object.]
+ expected: FAIL
+
+ [WebGL test #244: gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING) should be [object WebGLBuffer\]. Was null.]
+ expected: FAIL
+
+ [WebGL test #245: gl.getVertexAttrib(2, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING) should be [object WebGLBuffer\]. Was null.]
+ expected: FAIL
+
+ [WebGL test #246: gl.getVertexAttrib(3, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING) should be [object WebGLBuffer\]. Was null.]
+ expected: FAIL
+
+ [WebGL test #247: getError expected: NO_ERROR. Was INVALID_ENUM : after evaluating: gl.deleteBuffer(b2);]
+ expected: FAIL
+
+ [WebGL test #248: gl.getVertexAttrib(1, gl.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING) should be [object WebGLBuffer\]. Was null.]
+ expected: FAIL
+
+ [WebGL test #251: getError expected: NO_ERROR. Was INVALID_ENUM : after evaluating: gl.deleteBuffer(b1);]
+ expected: FAIL
+
+ [WebGL test #253: getError expected: NO_ERROR. Was INVALID_ENUM : after evaluating: gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)]
+ expected: FAIL
+
+ [WebGL test #281: at (0, 0) expected: 255,0,0,255 was 0,0,0,0]
+ expected: FAIL
+
+ [WebGL test #289: at (16, 0) expected: 0,255,0,255 was 0,0,0,0]
+ expected: FAIL
+
+ [WebGL test #292: at (0, 0) expected: 0,255,0,255 was 255,0,0,255]
+ expected: FAIL
+
+ [WebGL test #258: getError expected: NO_ERROR. Was INVALID_OPERATION : after evaluating: gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)]
+ expected: FAIL
+
+ [WebGL test #278: at (16, 16) expected: 0,0,0,0 was 9,0,0,0]
+ expected: FAIL
+
+ [WebGL test #281: at (0, 0) expected: 255,0,0,255 was 0,0,0,255]
+ expected: FAIL
+
+ [WebGL test #289: at (16, 0) expected: 0,255,0,255 was 0,0,0,14]
expected: FAIL
diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/uninitialized-test.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/uninitialized-test.html.ini
index a6a8447f2dc..b7ebd19cea0 100644
--- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/uninitialized-test.html.ini
+++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/uninitialized-test.html.ini
@@ -1,6 +1,6 @@
[uninitialized-test.html]
type: testharness
- expected: ERROR
+ disabled: https://github.com/servo/servo/issues/13710
+
[WebGL test #1: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL
-
diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/conformance/quickCheckAPI-C.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/conformance/quickCheckAPI-C.html.ini
deleted file mode 100644
index 6359cc05667..00000000000
--- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/conformance/quickCheckAPI-C.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[quickCheckAPI-C.html]
- type: testharness
- [WebGL test #0: testValidArgs]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/functions/isTests.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/functions/isTests.html.ini
deleted file mode 100644
index 7d7b9a8f4d0..00000000000
--- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/functions/isTests.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[isTests.html]
- type: testharness
- [WebGL test #0: testIs]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/renderbuffers/feedback-loop.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/renderbuffers/feedback-loop.html.ini
index 67298025ed2..76ecfa152bc 100644
--- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/renderbuffers/feedback-loop.html.ini
+++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/renderbuffers/feedback-loop.html.ini
@@ -1,9 +1,11 @@
[feedback-loop.html]
type: testharness
- expected: ERROR
[WebGL test #0: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL
[WebGL test #1: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL
+ [WebGL test #3: getError expected: INVALID_OPERATION. Was NO_ERROR : after draw with invalid feedback loop]
+ expected: FAIL
+
diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/renderbuffers/framebuffer-object-attachment.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/renderbuffers/framebuffer-object-attachment.html.ini
index 1ebc4ac1066..07b83234bcd 100644
--- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/renderbuffers/framebuffer-object-attachment.html.ini
+++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/renderbuffers/framebuffer-object-attachment.html.ini
@@ -1,6 +1,6 @@
[framebuffer-object-attachment.html]
type: testharness
- expected: ERROR
+ expected: CRASH
[WebGL test #1: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL
diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/renderbuffers/renderbuffer-initialization.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/renderbuffers/renderbuffer-initialization.html.ini
index 2d57461b214..890fbb6f19f 100644
--- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/renderbuffers/renderbuffer-initialization.html.ini
+++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/renderbuffers/renderbuffer-initialization.html.ini
@@ -1,9 +1,12 @@
[renderbuffer-initialization.html]
type: testharness
- expected: ERROR
+ disabled: https://github.com/servo/servo/issues/13710
+
[WebGL test #0: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL
[WebGL test #1: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL
+ [WebGL test #2: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
+ expected: FAIL
diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/rendering/gl-scissor-fbo-test.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/rendering/gl-scissor-fbo-test.html.ini
index ad1a5ccb284..c46acd960cd 100644
--- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/rendering/gl-scissor-fbo-test.html.ini
+++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/rendering/gl-scissor-fbo-test.html.ini
@@ -1,6 +1,5 @@
[gl-scissor-fbo-test.html]
type: testharness
- expected: ERROR
[WebGL test #1: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL
diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/copy-tex-image-2d-formats.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/copy-tex-image-2d-formats.html.ini
index a83b26a3250..46c6fe81390 100644
--- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/copy-tex-image-2d-formats.html.ini
+++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/copy-tex-image-2d-formats.html.ini
@@ -1,6 +1,32 @@
[copy-tex-image-2d-formats.html]
type: testharness
- expected: ERROR
[WebGL test #16: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL
+ [WebGL test #16: Creating framebuffer from ALPHA texture succeeded even though it is not a renderable format]
+ expected: FAIL
+
+ [WebGL test #17: Creating framebuffer from LUMINANCE texture succeeded even though it is not a renderable format]
+ expected: FAIL
+
+ [WebGL test #18: Creating framebuffer from LUMINANCE_ALPHA texture succeeded even though it is not a renderable format]
+ expected: FAIL
+
+ [WebGL test #19: getError expected: INVALID_OPERATION. Was NO_ERROR : should not be able to copyTexImage2D ALPHA from RGB]
+ expected: FAIL
+
+ [WebGL test #23: getError expected: INVALID_OPERATION. Was NO_ERROR : should not be able to copyTexImage2D LUMINANCE_ALPHA from RGB]
+ expected: FAIL
+
+ [WebGL test #27: getError expected: INVALID_OPERATION. Was NO_ERROR : should not be able to copyTexImage2D RGBA from RGB]
+ expected: FAIL
+
+ [WebGL test #44: getError expected: INVALID_OPERATION. Was NO_ERROR : should not be able to copyTexImage2D ALPHA from RGB]
+ expected: FAIL
+
+ [WebGL test #48: getError expected: INVALID_OPERATION. Was NO_ERROR : should not be able to copyTexImage2D LUMINANCE_ALPHA from RGB]
+ expected: FAIL
+
+ [WebGL test #52: getError expected: INVALID_OPERATION. Was NO_ERROR : should not be able to copyTexImage2D RGBA from RGB]
+ expected: FAIL
+
diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/mipmap-fbo.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/mipmap-fbo.html.ini
index f32f3f19116..26d0b6d0615 100644
--- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/mipmap-fbo.html.ini
+++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/mipmap-fbo.html.ini
@@ -1,6 +1,5 @@
[mipmap-fbo.html]
type: testharness
- expected: ERROR
[WebGL test #0: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL
diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-attachment-formats.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-attachment-formats.html.ini
index 57049ef8261..6ea96be3e18 100644
--- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-attachment-formats.html.ini
+++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-attachment-formats.html.ini
@@ -1,6 +1,5 @@
[texture-attachment-formats.html]
type: testharness
- expected: ERROR
[WebGL test #1: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL
@@ -10,3 +9,9 @@
[WebGL test #1: context does not exist]
expected: FAIL
+ [WebGL test #14: at (0, 0) expected: 63,63,63,255 was 64,0,0,255]
+ expected: FAIL
+
+ [WebGL test #16: at (0, 0) expected: 63,63,63,63 was 64,0,0,64]
+ expected: FAIL
+
diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-copying-feedback-loops.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-copying-feedback-loops.html.ini
index bf07713d84b..d6cc3560606 100644
--- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-copying-feedback-loops.html.ini
+++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-copying-feedback-loops.html.ini
@@ -1,6 +1,11 @@
[texture-copying-feedback-loops.html]
type: testharness
- expected: ERROR
[WebGL test #0: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL
+ [WebGL test #3: getError expected: INVALID_OPERATION. Was NO_ERROR : after copyTexImage2D to same texture same level, invalid feedback loop]
+ expected: FAIL
+
+ [WebGL test #6: getError expected: INVALID_OPERATION. Was NO_ERROR : after copyTexSubImage2D to same texture same level, invalid feedback loop]
+ expected: FAIL
+
diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-fakeblack.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-fakeblack.html.ini
index 74d50e4841e..977f4e4481f 100644
--- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-fakeblack.html.ini
+++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-fakeblack.html.ini
@@ -1,6 +1,11 @@
[texture-fakeblack.html]
type: testharness
- expected: ERROR
[WebGL test #0: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL
+ [WebGL test #1: at (0, 0) expected: 0,0,0,255 was 255,0,0,255]
+ expected: FAIL
+
+ [WebGL test #3: at (0, 0) expected: 0,0,0,255 was 255,0,0,255]
+ expected: FAIL
+