diff --git a/components/canvas/webgl_thread.rs b/components/canvas/webgl_thread.rs index abdda3c812a..f39d9745a91 100644 --- a/components/canvas/webgl_thread.rs +++ b/components/canvas/webgl_thread.rs @@ -885,6 +885,13 @@ impl WebGLImpl { } sender.send(value[0]).unwrap() } + WebGLCommand::GetParameterInt2(param, ref sender) => { + let mut value = [0; 2]; + unsafe { + ctx.gl().get_integer_v(param as u32, &mut value); + } + sender.send(value).unwrap() + } WebGLCommand::GetParameterInt4(param, ref sender) => { let mut value = [0; 4]; unsafe { diff --git a/components/canvas_traits/webgl.rs b/components/canvas_traits/webgl.rs index 6446c0c18d8..041e175c2b7 100644 --- a/components/canvas_traits/webgl.rs +++ b/components/canvas_traits/webgl.rs @@ -268,6 +268,7 @@ pub enum WebGLCommand { GetParameterBool(ParameterBool, WebGLSender), GetParameterBool4(ParameterBool4, WebGLSender<[bool; 4]>), GetParameterInt(ParameterInt, WebGLSender), + GetParameterInt2(ParameterInt2, WebGLSender<[i32; 2]>), GetParameterInt4(ParameterInt4, WebGLSender<[i32; 4]>), GetParameterFloat(ParameterFloat, WebGLSender), GetParameterFloat2(ParameterFloat2, WebGLSender<[f32; 2]>), @@ -522,6 +523,9 @@ parameters! { SubpixelBits = gl::SUBPIXEL_BITS, UnpackAlignment = gl::UNPACK_ALIGNMENT, }), + Int2(ParameterInt2 { + MaxViewportDims = gl::MAX_VIEWPORT_DIMS, + }), Int4(ParameterInt4 { ScissorBox = gl::SCISSOR_BOX, Viewport = gl::VIEWPORT, diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 7e5346c64ab..24085bf4610 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -1423,6 +1423,17 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { self.send_command(WebGLCommand::GetParameterInt(param, sender)); Int32Value(receiver.recv().unwrap()) } + Parameter::Int2(param) => { + let (sender, receiver) = webgl_channel().unwrap(); + self.send_command(WebGLCommand::GetParameterInt2(param, sender)); + rooted!(in(cx) let mut rval = ptr::null_mut::()); + let _ = Int32Array::create( + cx, + CreateWith::Slice(&receiver.recv().unwrap()), + rval.handle_mut(), + ).unwrap(); + ObjectValue(rval.get()) + } Parameter::Int4(param) => { let (sender, receiver) = webgl_channel().unwrap(); self.send_command(WebGLCommand::GetParameterInt4(param, sender)); diff --git a/tests/wpt/mozilla/meta/webgl/conformance-1.0.3/conformance/canvas/drawingbuffer-static-canvas-test.html.ini b/tests/wpt/mozilla/meta/webgl/conformance-1.0.3/conformance/canvas/drawingbuffer-static-canvas-test.html.ini index d17a5872378..461534c9e19 100644 --- a/tests/wpt/mozilla/meta/webgl/conformance-1.0.3/conformance/canvas/drawingbuffer-static-canvas-test.html.ini +++ b/tests/wpt/mozilla/meta/webgl/conformance-1.0.3/conformance/canvas/drawingbuffer-static-canvas-test.html.ini @@ -1,12 +1,4 @@ [drawingbuffer-static-canvas-test.html] type: testharness - expected: ERROR - [WebGL test #5: maxSize[0\] > 0 should be true. Threw exception TypeError: maxSize is null] - expected: FAIL - - [WebGL test #6: maxSize[1\] > 0 should be true. Threw exception TypeError: maxSize is null] - expected: FAIL - - [WebGL test #7: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).] - expected: FAIL + expected: CRASH diff --git a/tests/wpt/mozilla/meta/webgl/conformance-1.0.3/conformance/canvas/drawingbuffer-test.html.ini b/tests/wpt/mozilla/meta/webgl/conformance-1.0.3/conformance/canvas/drawingbuffer-test.html.ini index 2fd2b75c155..f6cf3ae8bee 100644 --- a/tests/wpt/mozilla/meta/webgl/conformance-1.0.3/conformance/canvas/drawingbuffer-test.html.ini +++ b/tests/wpt/mozilla/meta/webgl/conformance-1.0.3/conformance/canvas/drawingbuffer-test.html.ini @@ -1,6 +1,4 @@ [drawingbuffer-test.html] type: testharness - expected: ERROR - [WebGL test #3: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).] - expected: FAIL + expected: CRASH 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 8a0c270141d..7c659f812ad 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 @@ -3,15 +3,6 @@ [WebGL test #20: context.getParameter(context.COMPRESSED_TEXTURE_FORMATS) is not an instance of Uint32Array] expected: FAIL - [WebGL test #99: context.getParameter(context.MAX_VIEWPORT_DIMS)[0\] >= window.screen.width should be true. Threw exception TypeError: context.getParameter(...) is null] - expected: FAIL - - [WebGL test #100: context.getParameter(context.MAX_VIEWPORT_DIMS)[1\] >= window.screen.height should be true. Threw exception TypeError: context.getParameter(...) is null] - expected: FAIL - - [WebGL test #101: context.getParameter(context.MAX_VIEWPORT_DIMS) is not an instance of Int32Array] - expected: FAIL - [WebGL test #310: context.getError() should be 0. Was 1280.] expected: FAIL