diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 90e622be6c2..e8d06f1858a 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -2108,6 +2108,66 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { Ok(()) } + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + #[allow(unsafe_code)] + fn UniformMatrix2fv(&self, + cx: *mut JSContext, + uniform: Option<&WebGLUniformLocation>, + transpose: bool, + data: *mut JSObject) -> Fallible<()> { + assert!(!data.is_null()); + let data_vec = try!(unsafe { typed_array_or_sequence_to_vec::(cx, data, ()) }); + if self.validate_uniform_parameters(uniform, + UniformSetterType::FloatMat2, + &data_vec) { + self.ipc_renderer + .send(CanvasMsg::WebGL(WebGLCommand::UniformMatrix2fv(uniform.unwrap().id(), transpose, data_vec))) + .unwrap() + } + + Ok(()) + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + #[allow(unsafe_code)] + fn UniformMatrix3fv(&self, + cx: *mut JSContext, + uniform: Option<&WebGLUniformLocation>, + transpose: bool, + data: *mut JSObject) -> Fallible<()> { + assert!(!data.is_null()); + let data_vec = try!(unsafe { typed_array_or_sequence_to_vec::(cx, data, ()) }); + if self.validate_uniform_parameters(uniform, + UniformSetterType::FloatMat3, + &data_vec) { + self.ipc_renderer + .send(CanvasMsg::WebGL(WebGLCommand::UniformMatrix3fv(uniform.unwrap().id(), transpose, data_vec))) + .unwrap() + } + + Ok(()) + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + #[allow(unsafe_code)] + fn UniformMatrix4fv(&self, + cx: *mut JSContext, + uniform: Option<&WebGLUniformLocation>, + transpose: bool, + data: *mut JSObject) -> Fallible<()> { + assert!(!data.is_null()); + let data_vec = try!(unsafe { typed_array_or_sequence_to_vec::(cx, data, ()) }); + if self.validate_uniform_parameters(uniform, + UniformSetterType::FloatMat4, + &data_vec) { + self.ipc_renderer + .send(CanvasMsg::WebGL(WebGLCommand::UniformMatrix4fv(uniform.unwrap().id(), transpose, data_vec))) + .unwrap() + } + + Ok(()) + } + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9 fn UseProgram(&self, program: Option<&WebGLProgram>) { if let Some(program) = program { @@ -2480,6 +2540,9 @@ pub enum UniformSetterType { FloatVec2, FloatVec3, FloatVec4, + FloatMat2, + FloatMat3, + FloatMat4, } impl UniformSetterType { @@ -2493,6 +2556,9 @@ impl UniformSetterType { UniformSetterType::FloatVec2 => 2, UniformSetterType::FloatVec3 => 3, UniformSetterType::FloatVec4 => 4, + UniformSetterType::FloatMat2 => 4, + UniformSetterType::FloatMat3 => 9, + UniformSetterType::FloatMat4 => 16, } } @@ -2525,6 +2591,9 @@ impl UniformSetterType { UniformSetterType::FloatVec2 => constants::FLOAT_VEC2, UniformSetterType::FloatVec3 => constants::FLOAT_VEC3, UniformSetterType::FloatVec4 => constants::FLOAT_VEC4, + UniformSetterType::FloatMat2 => constants::FLOAT_MAT2, + UniformSetterType::FloatMat3 => constants::FLOAT_MAT3, + UniformSetterType::FloatMat4 => constants::FLOAT_MAT4, } } } diff --git a/components/script/dom/webidls/WebGLRenderingContext.webidl b/components/script/dom/webidls/WebGLRenderingContext.webidl index 86aca7e5a32..114c0673698 100644 --- a/components/script/dom/webidls/WebGLRenderingContext.webidl +++ b/components/script/dom/webidls/WebGLRenderingContext.webidl @@ -713,14 +713,23 @@ interface WebGLRenderingContextBase // Float32Array value); //void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, // sequence value); + [Throws] + void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, + object v); //void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, // Float32Array value); //void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, // sequence value); + [Throws] + void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, + object v); //void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, // Float32Array value); //void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, // sequence value); + [Throws] + void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, + object v); void useProgram(WebGLProgram? program); void validateProgram(WebGLProgram? program); diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/functions/uniformMatrix.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/functions/uniformMatrix.html.ini deleted file mode 100644 index eab660cbcd9..00000000000 --- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/functions/uniformMatrix.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[uniformMatrix.html] - type: testharness - [WebGL test #0: testUniformf] - expected: FAIL - diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/functions/uniformMatrixBadArgs.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/functions/uniformMatrixBadArgs.html.ini index a9c34e61d2d..41408c4132b 100644 --- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/functions/uniformMatrixBadArgs.html.ini +++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/more/functions/uniformMatrixBadArgs.html.ini @@ -1,5 +1,3 @@ [uniformMatrixBadArgs.html] type: testharness - [WebGL test #0: testUniformf] - expected: FAIL - + expected: CRASH diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/rendering/many-draw-calls.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/rendering/many-draw-calls.html.ini index 93fa55590cd..0b56e40edb0 100644 --- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/rendering/many-draw-calls.html.ini +++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/rendering/many-draw-calls.html.ini @@ -1,6 +1,5 @@ [many-draw-calls.html] type: testharness - expected: ERROR [WebGL test #0: failed to create test program] expected: FAIL diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texparameter-test.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texparameter-test.html.ini index e353d843a3c..d16debb3d11 100644 --- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texparameter-test.html.ini +++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texparameter-test.html.ini @@ -1,6 +1,5 @@ [texparameter-test.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-active-bind-2.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-active-bind-2.html.ini index 55491726102..3aa92e97021 100644 --- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-active-bind-2.html.ini +++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-active-bind-2.html.ini @@ -1,6 +1,5 @@ [texture-active-bind-2.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-active-bind.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-active-bind.html.ini index 69b846cda72..f9bf354eb2a 100644 --- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-active-bind.html.ini +++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-active-bind.html.ini @@ -1,6 +1,5 @@ [texture-active-bind.html] type: testharness - expected: ERROR [WebGL test #4: 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-size-cube-maps.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-size-cube-maps.html.ini index 3b37ed29353..a30cc53d41c 100644 --- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-size-cube-maps.html.ini +++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-size-cube-maps.html.ini @@ -1,3 +1,74 @@ [texture-size-cube-maps.html] type: testharness - expected: ERROR + [WebGL test #7: at (0, 1) expected: 0,255,255,255 was 255,255,0,255] + expected: FAIL + + [WebGL test #8: at (0, 0) expected: 0,255,255,255 was 0,0,255,255] + expected: FAIL + + [WebGL test #10: at (0, 0) expected: 255,0,255,255 was 255,255,0,255] + expected: FAIL + + [WebGL test #13: at (0, 1) expected: 255,0,255,255 was 0,0,255,255] + expected: FAIL + + [WebGL test #14: at (0, 0) expected: 255,255,0,255 was 255,0,0,255] + expected: FAIL + + [WebGL test #17: at (0, 1) expected: 0,0,255,255 was 255,0,0,255] + expected: FAIL + + [WebGL test #25: at (0, 1) expected: 255,0,255,255 was 0,255,255,255] + expected: FAIL + + [WebGL test #26: at (0, 0) expected: 255,0,255,255 was 255,255,0,255] + expected: FAIL + + [WebGL test #28: at (0, 0) expected: 255,0,0,255 was 0,255,255,255] + expected: FAIL + + [WebGL test #31: at (0, 1) expected: 255,0,0,255 was 255,255,0,255] + expected: FAIL + + [WebGL test #32: at (0, 0) expected: 0,255,255,255 was 0,255,0,255] + expected: FAIL + + [WebGL test #35: at (0, 1) expected: 255,255,0,255 was 0,255,0,255] + expected: FAIL + + [WebGL test #44: at (0, 1) expected: 255,0,0,255 was 255,0,255,255] + expected: FAIL + + [WebGL test #45: at (0, 0) expected: 255,0,0,255 was 0,255,255,255] + expected: FAIL + + [WebGL test #47: at (0, 0) expected: 0,255,0,255 was 255,0,255,255] + expected: FAIL + + [WebGL test #50: at (0, 1) expected: 0,255,0,255 was 0,255,255,255] + expected: FAIL + + [WebGL test #51: at (0, 0) expected: 255,0,255,255 was 0,0,255,255] + expected: FAIL + + [WebGL test #54: at (0, 1) expected: 0,255,255,255 was 0,0,255,255] + expected: FAIL + + [WebGL test #62: at (0, 1) expected: 0,255,0,255 was 255,0,0,255] + expected: FAIL + + [WebGL test #63: at (0, 0) expected: 0,255,0,255 was 255,0,255,255] + expected: FAIL + + [WebGL test #65: at (0, 0) expected: 0,0,255,255 was 255,0,0,255] + expected: FAIL + + [WebGL test #68: at (0, 1) expected: 0,0,255,255 was 255,0,255,255] + expected: FAIL + + [WebGL test #69: at (0, 0) expected: 255,0,0,255 was 255,255,0,255] + expected: FAIL + + [WebGL test #72: at (0, 1) expected: 255,0,255,255 was 255,255,0,255] + expected: FAIL + diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-sub-image-cube-maps.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-sub-image-cube-maps.html.ini index 356359e97ae..d7ebca198b2 100644 --- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-sub-image-cube-maps.html.ini +++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/textures/texture-sub-image-cube-maps.html.ini @@ -1,6 +1,5 @@ [texture-sub-image-cube-maps.html] type: testharness - expected: ERROR [WebGL test #0: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).] expected: FAIL @@ -10,3 +9,114 @@ [WebGL test #1: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).] expected: FAIL + [WebGL test #1: at (0, 0) expected: 255,0,0,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #2: at (0, 0) expected: 0,255,0,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #3: at (0, 0) expected: 0,0,255,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #4: at (0, 0) expected: 255,255,0,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #5: at (0, 0) expected: 0,255,255,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #6: at (0, 0) expected: 255,0,255,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #7: at (0, 0) expected: 255,255,0,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #8: at (0, 2) expected: 0,255,255,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #9: at (0, 0) expected: 0,255,255,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #10: at (0, 2) expected: 0,0,255,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #11: at (0, 0) expected: 255,0,255,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #12: at (0, 2) expected: 255,255,0,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #13: at (0, 0) expected: 0,0,255,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #14: at (0, 2) expected: 255,0,255,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #15: at (0, 0) expected: 255,255,0,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #16: at (0, 2) expected: 255,0,0,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #17: at (0, 0) expected: 255,0,0,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #18: at (0, 2) expected: 0,0,255,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #19: unexpected gl error: INVALID_VALUE] + expected: FAIL + + [WebGL test #20: at (0, 0) expected: 0,255,0,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #21: at (0, 0) expected: 0,0,255,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #22: at (0, 0) expected: 255,255,0,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #23: at (0, 0) expected: 0,255,255,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #24: at (0, 0) expected: 255,0,255,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #25: at (0, 0) expected: 255,0,0,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #26: at (0, 0) expected: 0,255,255,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #27: at (0, 2) expected: 255,0,255,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #28: at (0, 0) expected: 255,0,255,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #29: at (0, 2) expected: 255,255,0,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #30: at (0, 0) expected: 255,0,0,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #31: at (0, 2) expected: 0,255,255,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #32: at (0, 0) expected: 255,255,0,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #33: at (0, 2) expected: 255,0,0,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #34: at (0, 0) expected: 0,255,255,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #35: at (0, 2) expected: 0,255,0,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #36: at (0, 0) expected: 0,255,0,255 was 0,0,0,0] + expected: FAIL + + [WebGL test #37: at (0, 2) expected: 255,255,0,255 was 0,0,0,0] + expected: FAIL + diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/uniforms/gl-uniformmatrix4fv.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/uniforms/gl-uniformmatrix4fv.html.ini index b955597a622..ca20e06a6ee 100644 --- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/uniforms/gl-uniformmatrix4fv.html.ini +++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/uniforms/gl-uniformmatrix4fv.html.ini @@ -4,9 +4,3 @@ [WebGL test #0: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).] expected: FAIL - [WebGL test #0: Unable to fetch WebGL rendering context for Canvas] - expected: FAIL - - [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/uniforms/null-uniform-location.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/uniforms/null-uniform-location.html.ini deleted file mode 100644 index 2183438b55f..00000000000 --- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/uniforms/null-uniform-location.html.ini +++ /dev/null @@ -1,47 +0,0 @@ -[null-uniform-location.html] - type: testharness - [WebGL test #6: callUniformFunction('uniform1i') should be undefined. Threw exception TypeError: func is undefined] - expected: FAIL - - [WebGL test #8: callUniformFunction('uniform1iv') should be undefined. Threw exception TypeError: func is undefined] - expected: FAIL - - [WebGL test #10: callUniformFunction('uniform2f') should be undefined. Threw exception TypeError: func is undefined] - expected: FAIL - - [WebGL test #12: callUniformFunction('uniform2fv') should be undefined. Threw exception TypeError: func is undefined] - expected: FAIL - - [WebGL test #14: callUniformFunction('uniform2i') should be undefined. Threw exception TypeError: func is undefined] - expected: FAIL - - [WebGL test #16: callUniformFunction('uniform2iv') should be undefined. Threw exception TypeError: func is undefined] - expected: FAIL - - [WebGL test #18: callUniformFunction('uniform3f') should be undefined. Threw exception TypeError: func is undefined] - expected: FAIL - - [WebGL test #20: callUniformFunction('uniform3fv') should be undefined. Threw exception TypeError: func is undefined] - expected: FAIL - - [WebGL test #22: callUniformFunction('uniform3i') should be undefined. Threw exception TypeError: func is undefined] - expected: FAIL - - [WebGL test #24: callUniformFunction('uniform3iv') should be undefined. Threw exception TypeError: func is undefined] - expected: FAIL - - [WebGL test #30: callUniformFunction('uniform4i') should be undefined. Threw exception TypeError: func is undefined] - expected: FAIL - - [WebGL test #32: callUniformFunction('uniform4iv') should be undefined. Threw exception TypeError: func is undefined] - expected: FAIL - - [WebGL test #34: callUniformFunction('uniformMatrix2fv') should be undefined. Threw exception TypeError: func is undefined] - expected: FAIL - - [WebGL test #36: callUniformFunction('uniformMatrix3fv') should be undefined. Threw exception TypeError: func is undefined] - expected: FAIL - - [WebGL test #38: callUniformFunction('uniformMatrix4fv') should be undefined. Threw exception TypeError: func is undefined] - expected: FAIL - diff --git a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/uniforms/uniform-location.html.ini b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/uniforms/uniform-location.html.ini index 25f129ccc2b..21de226cc01 100644 --- a/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/uniforms/uniform-location.html.ini +++ b/tests/wpt/metadata/webgl/conformance-1.0.3/conformance/uniforms/uniform-location.html.ini @@ -1,14 +1,5 @@ [uniform-location.html] type: testharness - [WebGL test #1: contextA.uniformMatrix4fv(locationA, false, mat) threw exception TypeError: contextA.uniformMatrix4fv is not a function] - expected: FAIL - - [WebGL test #3: contextA.uniformMatrix4fv(locationA, false, mat) threw exception TypeError: contextA.uniformMatrix4fv is not a function] - expected: FAIL - - [WebGL test #4: contextA.uniformMatrix4fv(null, false, mat) threw exception TypeError: contextA.uniformMatrix4fv is not a function] - expected: FAIL - [WebGL test #9: contextA.getUniform(programS, locationSx) should be 333. Threw exception TypeError: contextA.getUniform is not a function] expected: FAIL @@ -18,27 +9,9 @@ [WebGL test #11: contextA.getUniform(programS, locationArray1) should be 5. Threw exception TypeError: contextA.getUniform is not a function] expected: FAIL - [WebGL test #13: getError expected: NO_ERROR. Was INVALID_VALUE : after evaluating: contextA.uniform4fv(locationVec4, vec)] - expected: FAIL - [WebGL test #14: contextA.getUniform(programV, locationVec4) should be 1,2,3,4. Threw exception TypeError: contextA.getUniform is not a function] expected: FAIL - [WebGL test #17: contextA.uniformMatrix4fv(locationA, false, mat) threw exception TypeError: contextA.uniformMatrix4fv is not a function] - expected: FAIL - - [WebGL test #19: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).] - expected: FAIL - - [WebGL test #7: getError expected: NO_ERROR. Was INVALID_OPERATION : after evaluating: contextA.uniform1f(locationArray0, 4.0)] - expected: FAIL - - [WebGL test #8: getError expected: NO_ERROR. Was INVALID_OPERATION : after evaluating: contextA.uniform1f(locationArray1, 5.0)] - expected: FAIL - - [WebGL test #13: getError expected: NO_ERROR. Was INVALID_OPERATION : after evaluating: contextA.uniform4fv(locationVec4, vec)] - expected: FAIL - [WebGL test #20: getError expected: INVALID_OPERATION. Was NO_ERROR : after evaluating: contextA.uniform1i(locationSx, 3)] expected: FAIL