aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Utrilla <adrianutrilla@gmail.com>2016-04-05 23:03:53 +0200
committerAdrian Utrilla <adrianutrilla@gmail.com>2016-04-06 13:12:44 +0200
commit36522ba9c3885b13029900af352b5dc35e4a682d (patch)
tree8d5eeb7e3ad3d5c634cc617eb37079e9c6f28ae0
parent4ff131e14e99c56283381fe3eb3b893fa4b91237 (diff)
downloadservo-36522ba9c3885b13029900af352b5dc35e4a682d.tar.gz
servo-36522ba9c3885b13029900af352b5dc35e4a682d.zip
Added Uniform2fv
-rw-r--r--components/script/dom/webglrenderingcontext.rs21
-rw-r--r--components/script/dom/webidls/WebGLRenderingContext.webidl1
2 files changed, 22 insertions, 0 deletions
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index 942e2b48388..185615302c6 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -1060,6 +1060,27 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
+ fn Uniform2fv(&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::<f32>(data) {
+ if data.len() < 2 {
+ return self.webgl_error(InvalidOperation);
+ }
+
+ self.Uniform2f(uniform, data[0], data[1]);
+ } else {
+ self.webgl_error(InvalidValue);
+ }
+ }
+
+ // 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) {
diff --git a/components/script/dom/webidls/WebGLRenderingContext.webidl b/components/script/dom/webidls/WebGLRenderingContext.webidl
index bba97a621e5..1ef0f4219f6 100644
--- a/components/script/dom/webidls/WebGLRenderingContext.webidl
+++ b/components/script/dom/webidls/WebGLRenderingContext.webidl
@@ -654,6 +654,7 @@ interface WebGLRenderingContextBase
void uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y);
//void uniform2fv(WebGLUniformLocation? location, Float32Array v);
//void uniform2fv(WebGLUniformLocation? location, sequence<GLfloat> v);
+ void uniform2fv(WebGLUniformLocation? location, optional object v);
//void uniform2i(WebGLUniformLocation? location, GLint x, GLint y);
//void uniform2iv(WebGLUniformLocation? location, Int32Array v);
//void uniform2iv(WebGLUniformLocation? location, sequence<long> v);