Skip to content

Commit

Permalink
Added Uniform2fv
Browse files Browse the repository at this point in the history
  • Loading branch information
autrilla committed Apr 6, 2016
1 parent 4ff131e commit 36522ba
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions components/script/dom/webglrenderingcontext.rs
Expand Up @@ -1059,6 +1059,27 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
.unwrap()
}

// 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>,
Expand Down
1 change: 1 addition & 0 deletions components/script/dom/webidls/WebGLRenderingContext.webidl
Expand Up @@ -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);
Expand Down

0 comments on commit 36522ba

Please sign in to comment.