aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2016-08-28 16:34:39 -0700
committerEric Anholt <eric@anholt.net>2016-08-28 17:18:09 -0700
commit847ab63de63343e767265d2825bbed7869358884 (patch)
treefa9c8d50abbb51c4a88d5b29560594c344a18672
parent1f2346d3b6fa6405df7b4f5be90c4076678875f0 (diff)
downloadservo-847ab63de63343e767265d2825bbed7869358884.tar.gz
servo-847ab63de63343e767265d2825bbed7869358884.zip
webgl: Add isProgram() support.
There's one failure still, where a deleted program should still be considered to be a program until it's unbound. However, I recently made it so that we unbind at delete time, and we may need to partially back that change out.
-rw-r--r--components/script/dom/webglprogram.rs4
-rw-r--r--components/script/dom/webglrenderingcontext.rs5
-rw-r--r--components/script/dom/webidls/WebGLRenderingContext.webidl2
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/is-object.html.ini38
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/object-deletion-behaviour.html.ini5
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/conformance/quickCheckAPI-B1.html.ini5
-rw-r--r--tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/functions/isTestsBadArgs.html.ini38
7 files changed, 11 insertions, 86 deletions
diff --git a/components/script/dom/webglprogram.rs b/components/script/dom/webglprogram.rs
index 543a551ee17..9ac3f4e1ad4 100644
--- a/components/script/dom/webglprogram.rs
+++ b/components/script/dom/webglprogram.rs
@@ -87,6 +87,10 @@ impl WebGLProgram {
}
}
+ pub fn is_deleted(&self) -> bool {
+ self.is_deleted.get()
+ }
+
/// glLinkProgram
pub fn link(&self) {
self.linked.set(false);
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index 7814296c38a..35647a252ab 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -1403,6 +1403,11 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
frame_buffer.map_or(false, |buf| buf.target().is_some() && !buf.is_deleted())
}
+ // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
+ fn IsProgram(&self, program: Option<&WebGLProgram>) -> bool {
+ program.map_or(false, |p| !p.is_deleted())
+ }
+
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.7
fn IsRenderbuffer(&self, render_buffer: Option<&WebGLRenderbuffer>) -> bool {
render_buffer.map_or(false, |buf| buf.ever_bound() && !buf.is_deleted())
diff --git a/components/script/dom/webidls/WebGLRenderingContext.webidl b/components/script/dom/webidls/WebGLRenderingContext.webidl
index eea550a5bc0..e95ce00e5e5 100644
--- a/components/script/dom/webidls/WebGLRenderingContext.webidl
+++ b/components/script/dom/webidls/WebGLRenderingContext.webidl
@@ -605,7 +605,7 @@ interface WebGLRenderingContextBase
[WebGLHandlesContextLoss] GLboolean isBuffer(WebGLBuffer? buffer);
//[WebGLHandlesContextLoss] GLboolean isEnabled(GLenum cap);
[WebGLHandlesContextLoss] GLboolean isFramebuffer(WebGLFramebuffer? framebuffer);
- //[WebGLHandlesContextLoss] GLboolean isProgram(WebGLProgram? program);
+ [WebGLHandlesContextLoss] GLboolean isProgram(WebGLProgram? program);
[WebGLHandlesContextLoss] GLboolean isRenderbuffer(WebGLRenderbuffer? renderbuffer);
[WebGLHandlesContextLoss] GLboolean isShader(WebGLShader? shader);
[WebGLHandlesContextLoss] GLboolean isTexture(WebGLTexture? texture);
diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/is-object.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/is-object.html.ini
deleted file mode 100644
index 382e1687014..00000000000
--- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/misc/is-object.html.ini
+++ /dev/null
@@ -1,38 +0,0 @@
-[is-object.html]
- type: testharness
- [WebGL test #1: gl.isBuffer(buffer) should be false. Threw exception TypeError: gl.isBuffer is not a function]
- expected: FAIL
-
- [WebGL test #3: gl.isBuffer(buffer) should be true. Threw exception TypeError: gl.isBuffer is not a function]
- expected: FAIL
-
- [WebGL test #5: gl.isFramebuffer(framebuffer) should be false. Threw exception TypeError: gl.isFramebuffer is not a function]
- expected: FAIL
-
- [WebGL test #7: gl.isFramebuffer(framebuffer) should be true. Threw exception TypeError: gl.isFramebuffer is not a function]
- expected: FAIL
-
- [WebGL test #9: gl.isRenderbuffer(renderbuffer) should be false. Threw exception TypeError: gl.isRenderbuffer is not a function]
- expected: FAIL
-
- [WebGL test #11: gl.isRenderbuffer(renderbuffer) should be true. Threw exception TypeError: gl.isRenderbuffer is not a function]
- expected: FAIL
-
- [WebGL test #13: gl.isTexture(texture) should be false. Threw exception TypeError: gl.isTexture is not a function]
- expected: FAIL
-
- [WebGL test #15: gl.isTexture(texture) should be true. Threw exception TypeError: gl.isTexture is not a function]
- expected: FAIL
-
- [WebGL test #17: gl.isProgram(program) should be true. Threw exception TypeError: gl.isProgram is not a function]
- expected: FAIL
-
- [WebGL test #19: gl.isProgram(program) should be false. Threw exception TypeError: gl.isProgram is not a function]
- expected: FAIL
-
- [WebGL test #21: gl.isShader(shader) should be true. Threw exception TypeError: gl.isShader is not a function]
- expected: FAIL
-
- [WebGL test #23: gl.isShader(shader) should be false. Threw exception TypeError: gl.isShader is not a function]
- 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 4e4a3963ca9..0d889b67a86 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
@@ -14,10 +14,7 @@
[WebGL test #14: gl.isShader(fragmentShader) should be true. Threw exception TypeError: gl.isShader is not a function]
expected: FAIL
- [WebGL test #17: gl.isProgram(program) should be true. Threw exception TypeError: gl.isProgram is not a function]
- expected: FAIL
-
- [WebGL test #20: gl.isProgram(program) should be false. Threw exception TypeError: gl.isProgram is not a function]
+ [WebGL test #17: gl.isProgram(program) should be true. Was false.]
expected: FAIL
[WebGL test #21: gl.isShader(fragmentShader) should be false. Threw exception TypeError: gl.isShader is not a function]
diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/conformance/quickCheckAPI-B1.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/conformance/quickCheckAPI-B1.html.ini
deleted file mode 100644
index fde34e3d276..00000000000
--- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/conformance/quickCheckAPI-B1.html.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[quickCheckAPI-B1.html]
- type: testharness
- [WebGL test #0: testValidArgs]
- expected: FAIL
-
diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/functions/isTestsBadArgs.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/functions/isTestsBadArgs.html.ini
deleted file mode 100644
index 8f8d8c915ed..00000000000
--- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/functions/isTestsBadArgs.html.ini
+++ /dev/null
@@ -1,38 +0,0 @@
-[isTestsBadArgs.html]
- type: testharness
- [WebGL test #30: gl.isBuffer(null) should be false. Threw exception TypeError: gl.isBuffer is not a function]
- expected: FAIL
-
- [WebGL test #31: gl.isBuffer(undefined) should be false. Threw exception TypeError: gl.isBuffer is not a function]
- expected: FAIL
-
- [WebGL test #32: gl.isFramebuffer(null) should be false. Threw exception TypeError: gl.isFramebuffer is not a function]
- expected: FAIL
-
- [WebGL test #33: gl.isFramebuffer(undefined) should be false. Threw exception TypeError: gl.isFramebuffer is not a function]
- expected: FAIL
-
- [WebGL test #34: gl.isProgram(null) should be false. Threw exception TypeError: gl.isProgram is not a function]
- expected: FAIL
-
- [WebGL test #35: gl.isProgram(undefined) should be false. Threw exception TypeError: gl.isProgram is not a function]
- expected: FAIL
-
- [WebGL test #36: gl.isRenderbuffer(null) should be false. Threw exception TypeError: gl.isRenderbuffer is not a function]
- expected: FAIL
-
- [WebGL test #37: gl.isRenderbuffer(undefined) should be false. Threw exception TypeError: gl.isRenderbuffer is not a function]
- expected: FAIL
-
- [WebGL test #38: gl.isShader(null) should be false. Threw exception TypeError: gl.isShader is not a function]
- expected: FAIL
-
- [WebGL test #39: gl.isShader(undefined) should be false. Threw exception TypeError: gl.isShader is not a function]
- expected: FAIL
-
- [WebGL test #40: gl.isTexture(null) should be false. Threw exception TypeError: gl.isTexture is not a function]
- expected: FAIL
-
- [WebGL test #41: gl.isTexture(undefined) should be false. Threw exception TypeError: gl.isTexture is not a function]
- expected: FAIL
-