From 5f2d512c12b6158af22502cb09f3543ff015d864 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 5 May 2018 18:25:20 -0700 Subject: [PATCH 1/3] webgl: Drop a silly check for 0 in GetTexParameter. 0 is not among the valid values for a wrap mode or filter, so it won't ever be returned unless the driver is broken, and even if it was a valid value we would want to pass it through. --- components/script/dom/webglrenderingcontext.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index d1383cded5d..17c63a78d48 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -1412,13 +1412,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { let (sender, receiver) = webgl_channel().unwrap(); self.send_command(WebGLCommand::GetTexParameter(target, pname, sender)); - match receiver.recv().unwrap() { - value if value != 0 => Int32Value(value), - _ => { - self.webgl_error(InvalidEnum); - NullValue() - } - } + Int32Value(receiver.recv().unwrap()) } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.3 From 8c052d3593bfce51f787f0f3db4cfe756a6510ed Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 5 May 2018 18:27:57 -0700 Subject: [PATCH 2/3] webgl: Add getParameter(UNPACK_FlIP_Y_WEBGL) support. --- components/script/dom/webglrenderingcontext.rs | 4 ++++ .../conformance-1.0.3/conformance/state/gl-get-calls.html.ini | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 17c63a78d48..c44578bbaf1 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -1326,6 +1326,10 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { "WebGL GLSL ES 1.0".to_jsval(cx, rval.handle_mut()); return rval.get(); } + constants::UNPACK_FLIP_Y_WEBGL => { + let unpack = self.texture_unpacking_settings.get(); + return BooleanValue(unpack.contains(TextureUnpacking::FLIP_Y_AXIS)); + } _ => {} } diff --git a/tests/wpt/mozilla/meta/webgl/conformance-1.0.3/conformance/state/gl-get-calls.html.ini b/tests/wpt/mozilla/meta/webgl/conformance-1.0.3/conformance/state/gl-get-calls.html.ini index 5fb34fccbb5..11484fc0167 100644 --- a/tests/wpt/mozilla/meta/webgl/conformance-1.0.3/conformance/state/gl-get-calls.html.ini +++ b/tests/wpt/mozilla/meta/webgl/conformance-1.0.3/conformance/state/gl-get-calls.html.ini @@ -57,9 +57,6 @@ [WebGL test #47: context.getParameter(context.SCISSOR_TEST) should be false (of type boolean). Was null (of type object).] expected: FAIL - [WebGL test #85: context.getParameter(context.UNPACK_FLIP_Y_WEBGL) should be false (of type boolean). Was null (of type object).] - expected: FAIL - [WebGL test #86: context.getParameter(context.UNPACK_PREMULTIPLY_ALPHA_WEBGL) should be false (of type boolean). Was null (of type object).] expected: FAIL From 471924af626181e513432ab6367f712639adb567 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Sat, 5 May 2018 18:28:25 -0700 Subject: [PATCH 3/3] webgl: Add getParameter(UNPACK_PREMULTIPLY_ALPHA_WEBGL) support. --- components/script/dom/webglrenderingcontext.rs | 4 ++++ .../conformance-1.0.3/conformance/state/gl-get-calls.html.ini | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index c44578bbaf1..32059db6302 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -1330,6 +1330,10 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { let unpack = self.texture_unpacking_settings.get(); return BooleanValue(unpack.contains(TextureUnpacking::FLIP_Y_AXIS)); } + constants::UNPACK_PREMULTIPLY_ALPHA_WEBGL => { + let unpack = self.texture_unpacking_settings.get(); + return BooleanValue(unpack.contains(TextureUnpacking::PREMULTIPLY_ALPHA)); + } _ => {} } diff --git a/tests/wpt/mozilla/meta/webgl/conformance-1.0.3/conformance/state/gl-get-calls.html.ini b/tests/wpt/mozilla/meta/webgl/conformance-1.0.3/conformance/state/gl-get-calls.html.ini index 11484fc0167..87558e7b05a 100644 --- a/tests/wpt/mozilla/meta/webgl/conformance-1.0.3/conformance/state/gl-get-calls.html.ini +++ b/tests/wpt/mozilla/meta/webgl/conformance-1.0.3/conformance/state/gl-get-calls.html.ini @@ -57,9 +57,6 @@ [WebGL test #47: context.getParameter(context.SCISSOR_TEST) should be false (of type boolean). Was null (of type object).] expected: FAIL - [WebGL test #86: context.getParameter(context.UNPACK_PREMULTIPLY_ALPHA_WEBGL) should be false (of type boolean). Was null (of type object).] - expected: FAIL - [WebGL test #88: context.getParameter(context.VIEWPORT) is not an instance of Int32Array] expected: FAIL