From b48e0f2ba9c06757cac5a4d3795e9356e4828db8 Mon Sep 17 00:00:00 2001 From: Adrian Utrilla Date: Tue, 5 Apr 2016 22:56:18 +0200 Subject: [PATCH] Added Uniform1iv --- .../script/dom/webglrenderingcontext.rs | 21 +++++++++++++++++++ .../dom/webidls/WebGLRenderingContext.webidl | 3 ++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index d9942016425..942e2b48388 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -1008,6 +1008,27 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { .unwrap() } + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn Uniform1iv(&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::(data) { + if data.len() < 1 { + return self.webgl_error(InvalidOperation); + } + + self.Uniform1i(uniform, data[0]); + } else { + self.webgl_error(InvalidValue); + } + } + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 fn Uniform1fv(&self, uniform: Option<&WebGLUniformLocation>, diff --git a/components/script/dom/webidls/WebGLRenderingContext.webidl b/components/script/dom/webidls/WebGLRenderingContext.webidl index 9e4a1d1aea0..e520f5b5927 100644 --- a/components/script/dom/webidls/WebGLRenderingContext.webidl +++ b/components/script/dom/webidls/WebGLRenderingContext.webidl @@ -650,7 +650,8 @@ interface WebGLRenderingContextBase void uniform1i(WebGLUniformLocation? location, GLint x); //void uniform1iv(WebGLUniformLocation? location, Int32Array v); //void uniform1iv(WebGLUniformLocation? location, sequence v); - void uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y); + void uniform1iv(WebGLUniformLocation? location, optional object v); + //void uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y); //void uniform2fv(WebGLUniformLocation? location, Float32Array v); //void uniform2fv(WebGLUniformLocation? location, sequence v); //void uniform2i(WebGLUniformLocation? location, GLint x, GLint y);