diff options
-rw-r--r-- | components/script/dom/webglrenderingcontext.rs | 41 | ||||
-rw-r--r-- | components/script/dom/webidls/WebGLRenderingContext.webidl | 4 | ||||
-rw-r--r-- | components/servo/Cargo.lock | 2 | ||||
-rw-r--r-- | ports/cef/Cargo.lock | 2 | ||||
-rw-r--r-- | ports/gonk/Cargo.lock | 2 |
5 files changed, 47 insertions, 4 deletions
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index e614b7afc6f..3bc032420c3 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -961,6 +961,47 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn Uniform4i(&self, + uniform: Option<&WebGLUniformLocation>, + x: i32, y: i32, z: i32, w: i32) { + let uniform = match uniform { + Some(uniform) => uniform, + None => return, + }; + + match self.current_program.get() { + Some(ref program) if program.id() == uniform.program_id() => {}, + _ => return self.webgl_error(InvalidOperation), + }; + + self.ipc_renderer + .send(CanvasMsg::WebGL(WebGLCommand::Uniform4i(uniform.id(), x, y, z, w))) + .unwrap() + } + + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn Uniform4iv(&self, + _cx: *mut JSContext, + uniform: Option<&WebGLUniformLocation>, + data: Option<*mut JSObject>) { + let data = match data { + Some(data) => data, + None => return self.webgl_error(InvalidValue), + }; + + if let Some(data) = array_buffer_view_to_vec_checked::<i32>(data) { + if data.len() < 4 { + return self.webgl_error(InvalidOperation); + } + + self.Uniform4i(uniform, data[0], data[1], data[2], data[3]); + } else { + self.webgl_error(InvalidValue); + } + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 fn Uniform4f(&self, uniform: Option<&WebGLUniformLocation>, x: f32, y: f32, z: f32, w: f32) { diff --git a/components/script/dom/webidls/WebGLRenderingContext.webidl b/components/script/dom/webidls/WebGLRenderingContext.webidl index ea49e38d4bd..a348cb3d552 100644 --- a/components/script/dom/webidls/WebGLRenderingContext.webidl +++ b/components/script/dom/webidls/WebGLRenderingContext.webidl @@ -669,9 +669,11 @@ interface WebGLRenderingContextBase // in the meantime void uniform4fv(WebGLUniformLocation? location, optional object v); //void uniform4fv(WebGLUniformLocation? location, sequence<GLfloat> v); - //void uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w); + void uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w); //void uniform4iv(WebGLUniformLocation? location, Int32Array v); //void uniform4iv(WebGLUniformLocation? location, sequence<long> v); + // See FIXME above + void uniform4iv(WebGLUniformLocation? location, optional object v); //void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, // Float32Array value); diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index fc36769ea0f..c9058bde9cb 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -2341,7 +2341,7 @@ dependencies = [ [[package]] name = "webrender_traits" version = "0.1.0" -source = "git+https://github.com/servo/webrender_traits#a588d3190bfc7a58a694c5541f763f88b02531c2" +source = "git+https://github.com/servo/webrender_traits#c578452dc34d5a0bf431b8e4e50438d359ade75a" dependencies = [ "app_units 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index cd447b68a3a..25107b78752 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -2209,7 +2209,7 @@ dependencies = [ [[package]] name = "webrender_traits" version = "0.1.0" -source = "git+https://github.com/servo/webrender_traits#a588d3190bfc7a58a694c5541f763f88b02531c2" +source = "git+https://github.com/servo/webrender_traits#c578452dc34d5a0bf431b8e4e50438d359ade75a" dependencies = [ "app_units 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/ports/gonk/Cargo.lock b/ports/gonk/Cargo.lock index c26ed50b438..8810ce60fa4 100644 --- a/ports/gonk/Cargo.lock +++ b/ports/gonk/Cargo.lock @@ -2158,7 +2158,7 @@ dependencies = [ [[package]] name = "webrender_traits" version = "0.1.0" -source = "git+https://github.com/servo/webrender_traits#a588d3190bfc7a58a694c5541f763f88b02531c2" +source = "git+https://github.com/servo/webrender_traits#c578452dc34d5a0bf431b8e4e50438d359ade75a" dependencies = [ "app_units 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)", "core-graphics 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", |