Added Uniform4iv and Uniform4i

This commit is contained in:
Adrian Utrilla 2016-04-02 19:46:39 +02:00
parent 7f4929d52d
commit bd1448ab56
5 changed files with 47 additions and 4 deletions

View file

@ -960,6 +960,47 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
self.Uniform1f(uniform, data[0]);
}
// 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>,

View file

@ -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);

View file

@ -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)",

2
ports/cef/Cargo.lock generated
View file

@ -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)",

2
ports/gonk/Cargo.lock generated
View file

@ -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)",