From 8a0ca2efba71446a7e49d8bd832de2117fa44a7d Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 16 Sep 2016 22:51:37 +0100 Subject: [PATCH] webgl: Add support for checkFramebufferStatus(). For now it's returning the default UNSUPPORTED on user FBOs. object-deletion-behaviour.html starts running a bunch more subtets. --- .../script/dom/webglrenderingcontext.rs | 17 +++++ .../dom/webidls/WebGLRenderingContext.webidl | 2 +- .../buffers/index-validation.html.ini | 3 - .../conformance/context/methods.html.ini | 3 - .../misc/object-deletion-behaviour.html.ini | 64 ++++++++++++++++++- .../more/conformance/quickCheckAPI-C.html.ini | 5 -- 6 files changed, 81 insertions(+), 13 deletions(-) delete mode 100644 tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/conformance/quickCheckAPI-C.html.ini diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 1926bdf8a8d..c93e80d805e 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -2552,6 +2552,23 @@ 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, + } + } } pub trait LayoutCanvasWebGLRenderingContextHelpers { diff --git a/components/script/dom/webidls/WebGLRenderingContext.webidl b/components/script/dom/webidls/WebGLRenderingContext.webidl index 1eb85fc236d..06bd03a9fd7 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); 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/methods.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/context/methods.html.ini index 6cec6740f90..a498d1b39a5 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 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..9bb30e50880 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 @@ -73,3 +72,66 @@ [WebGL test #51: getError expected: NO_ERROR. Was INVALID_OPERATION : after evaluating: gl.bindTexture(gl.TEXTURE_2D, t)] expected: FAIL + [WebGL test #87: gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 16) threw exception TypeError: gl.renderbufferStorage is not a function] + expected: FAIL + + [WebGL test #89: gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, rbo) threw exception TypeError: gl.framebufferRenderbuffer is not a function] + expected: FAIL + + [WebGL test #94: 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 #98: gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 16) threw exception TypeError: gl.renderbufferStorage is not a function] + expected: FAIL + + [WebGL test #100: gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, rbo) threw exception TypeError: gl.framebufferRenderbuffer is not a function] + expected: FAIL + + [WebGL test #104: 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 #113: gl.getParameter(gl.ARRAY_BUFFER_BINDING) should be null. Was [object WebGLBuffer\].] + expected: FAIL + + [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 #171: gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 16, 16) threw exception TypeError: gl.renderbufferStorage is not a function] + expected: FAIL + + [WebGL test #172: gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.RENDERBUFFER, rbo) threw exception TypeError: gl.framebufferRenderbuffer is not a function] + expected: FAIL + + [WebGL test #161: getError expected: NO_ERROR. Was INVALID_OPERATION : after evaluating: gl.bindFramebuffer(gl.FRAMEBUFFER, fbo)] + 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 -