diff options
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 6 | ||||
-rw-r--r-- | components/script/dom/webgl2renderingcontext.rs | 242 | ||||
-rw-r--r-- | components/script/dom/webglrenderingcontext.rs | 423 | ||||
-rw-r--r-- | components/script/dom/webidls/WebGLRenderingContext.webidl | 116 |
4 files changed, 411 insertions, 376 deletions
diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 24054de8e95..6e0632fe97d 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -418,11 +418,15 @@ class CGMethodCall(CGThing): template = info.template declType = info.declType + argName = "arg%d" % distinguishingIndex + testCode = instantiateJSToNativeConversionTemplate( template, {"val": distinguishingArg}, declType, - "arg%d" % distinguishingIndex) + argName) + if type_needs_auto_root(type): + testCode.append(CGGeneric("auto_root!(in(cx) let %s = %s);" % (argName, argName))) # Indent by 4, since we need to indent further than our "do" statement caseBody.append(CGIndenter(testCode, 4)) diff --git a/components/script/dom/webgl2renderingcontext.rs b/components/script/dom/webgl2renderingcontext.rs index 698be5fb25b..e0ae2e22585 100644 --- a/components/script/dom/webgl2renderingcontext.rs +++ b/components/script/dom/webgl2renderingcontext.rs @@ -32,7 +32,7 @@ use euclid::Size2D; use js::jsapi::{JSContext, JSObject}; use js::jsval::JSVal; use js::rust::CustomAutoRooterGuard; -use js::typedarray::ArrayBufferView; +use js::typedarray::{ArrayBufferView, Float32Array, Int32Array}; use offscreen_gl_context::GLContextAttributes; use script_layout_interface::HTMLCanvasDataSource; use std::ptr::NonNull; @@ -597,161 +597,197 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext { /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 fn Uniform1f(&self, - uniform: Option<&WebGLUniformLocation>, + location: Option<&WebGLUniformLocation>, val: f32) { - self.base.Uniform1f(uniform, val) + self.base.Uniform1f(location, val) } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 fn Uniform1i(&self, - uniform: Option<&WebGLUniformLocation>, + location: Option<&WebGLUniformLocation>, val: i32) { - self.base.Uniform1i(uniform, val) + self.base.Uniform1i(location, val) } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 - #[allow(unsafe_code)] - unsafe fn Uniform1iv(&self, - cx: *mut JSContext, - uniform: Option<&WebGLUniformLocation>, - data: *mut JSObject) -> Fallible<()> { - self.base.Uniform1iv(cx, uniform, data) + fn Uniform1iv(&self, + location: Option<&WebGLUniformLocation>, + v: CustomAutoRooterGuard<Int32Array>) { + self.base.Uniform1iv(location, v) + } + + fn Uniform1iv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<i32>) { + self.base.Uniform1iv_(location, v); } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 - #[allow(unsafe_code)] - unsafe fn Uniform1fv(&self, - cx: *mut JSContext, - uniform: Option<&WebGLUniformLocation>, - data: *mut JSObject) -> Fallible<()> { - self.base.Uniform1fv(cx, uniform, data) + fn Uniform1fv(&self, + location: Option<&WebGLUniformLocation>, + v: CustomAutoRooterGuard<Float32Array>) { + self.base.Uniform1fv(location, v); + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn Uniform1fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) { + self.base.Uniform1fv_(location, v); } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 fn Uniform2f(&self, - uniform: Option<&WebGLUniformLocation>, + location: Option<&WebGLUniformLocation>, x: f32, y: f32) { - self.base.Uniform2f(uniform, x, y) + self.base.Uniform2f(location, x, y) } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 - #[allow(unsafe_code)] - unsafe fn Uniform2fv(&self, - cx: *mut JSContext, - uniform: Option<&WebGLUniformLocation>, - data: *mut JSObject) -> Fallible<()> { - self.base.Uniform2fv(cx, uniform, data) + fn Uniform2fv(&self, + location: Option<&WebGLUniformLocation>, + v: CustomAutoRooterGuard<Float32Array>) { + self.base.Uniform2fv(location, v) + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn Uniform2fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) { + self.base.Uniform2fv_(location, v); } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 fn Uniform2i(&self, - uniform: Option<&WebGLUniformLocation>, + location: Option<&WebGLUniformLocation>, x: i32, y: i32) { - self.base.Uniform2i(uniform, x, y) + self.base.Uniform2i(location, x, y) } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 - #[allow(unsafe_code)] - unsafe fn Uniform2iv(&self, - cx: *mut JSContext, - uniform: Option<&WebGLUniformLocation>, - data: *mut JSObject) -> Fallible<()> { - self.base.Uniform2iv(cx, uniform, data) + fn Uniform2iv(&self, + location: Option<&WebGLUniformLocation>, + v: CustomAutoRooterGuard<Int32Array>) { + self.base.Uniform2iv(location, v) + } + + /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn Uniform2iv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<i32>) { + self.base.Uniform2iv_(location, v); } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 fn Uniform3f(&self, - uniform: Option<&WebGLUniformLocation>, + location: Option<&WebGLUniformLocation>, x: f32, y: f32, z: f32) { - self.base.Uniform3f(uniform, x, y, z) + self.base.Uniform3f(location, x, y, z) } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 - #[allow(unsafe_code)] - unsafe fn Uniform3fv(&self, - cx: *mut JSContext, - uniform: Option<&WebGLUniformLocation>, - data: *mut JSObject) -> Fallible<()> { - self.base.Uniform3fv(cx, uniform, data) + fn Uniform3fv(&self, + location: Option<&WebGLUniformLocation>, + v: CustomAutoRooterGuard<Float32Array>) { + self.base.Uniform3fv(location, v) + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn Uniform3fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) { + self.base.Uniform3fv_(location, v); } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 fn Uniform3i(&self, - uniform: Option<&WebGLUniformLocation>, + location: Option<&WebGLUniformLocation>, x: i32, y: i32, z: i32) { - self.base.Uniform3i(uniform, x, y, z) + self.base.Uniform3i(location, x, y, z) } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 - #[allow(unsafe_code)] - unsafe fn Uniform3iv(&self, - cx: *mut JSContext, - uniform: Option<&WebGLUniformLocation>, - data: *mut JSObject) -> Fallible<()> { - self.base.Uniform3iv(cx, uniform, data) + fn Uniform3iv(&self, + location: Option<&WebGLUniformLocation>, + v: CustomAutoRooterGuard<Int32Array>) { + self.base.Uniform3iv(location, v) + } + + /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn Uniform3iv_(&self, + location: Option<&WebGLUniformLocation>, + v: Vec<i32>) { + self.base.Uniform3iv_(location, v) } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 fn Uniform4i(&self, - uniform: Option<&WebGLUniformLocation>, + location: Option<&WebGLUniformLocation>, x: i32, y: i32, z: i32, w: i32) { - self.base.Uniform4i(uniform, x, y, z, w) + self.base.Uniform4i(location, x, y, z, w) } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 - #[allow(unsafe_code)] - unsafe fn Uniform4iv(&self, - cx: *mut JSContext, - uniform: Option<&WebGLUniformLocation>, - data: *mut JSObject) -> Fallible<()> { - self.base.Uniform4iv(cx, uniform, data) + fn Uniform4iv(&self, + location: Option<&WebGLUniformLocation>, + v: CustomAutoRooterGuard<Int32Array>) { + self.base.Uniform4iv(location, v) + } + + /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn Uniform4iv_(&self, + location: Option<&WebGLUniformLocation>, + v: Vec<i32>) { + self.base.Uniform4iv_(location, v) } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 fn Uniform4f(&self, - uniform: Option<&WebGLUniformLocation>, + location: Option<&WebGLUniformLocation>, x: f32, y: f32, z: f32, w: f32) { - self.base.Uniform4f(uniform, x, y, z, w) + self.base.Uniform4f(location, x, y, z, w) } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 - #[allow(unsafe_code)] - unsafe fn Uniform4fv(&self, - cx: *mut JSContext, - uniform: Option<&WebGLUniformLocation>, - data: *mut JSObject) -> Fallible<()> { - self.base.Uniform4fv(cx, uniform, data) + fn Uniform4fv(&self, + location: Option<&WebGLUniformLocation>, + v: CustomAutoRooterGuard<Float32Array>) { + self.base.Uniform4fv(location, v) + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn Uniform4fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) { + self.base.Uniform4fv_(location, v); } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 - #[allow(unsafe_code)] - unsafe fn UniformMatrix2fv(&self, - cx: *mut JSContext, - uniform: Option<&WebGLUniformLocation>, + fn UniformMatrix2fv(&self, + location: Option<&WebGLUniformLocation>, transpose: bool, - data: *mut JSObject) -> Fallible<()> { - self.base.UniformMatrix2fv(cx, uniform, transpose, data) + v: CustomAutoRooterGuard<Float32Array>) { + self.base.UniformMatrix2fv(location, transpose, v) } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 - #[allow(unsafe_code)] - unsafe fn UniformMatrix3fv(&self, - cx: *mut JSContext, - uniform: Option<&WebGLUniformLocation>, + fn UniformMatrix2fv_(&self, location: Option<&WebGLUniformLocation>, transpose: bool, value: Vec<f32>) { + self.base.UniformMatrix2fv_(location, transpose, value); + } + + /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn UniformMatrix3fv(&self, + location: Option<&WebGLUniformLocation>, transpose: bool, - data: *mut JSObject) -> Fallible<()> { - self.base.UniformMatrix3fv(cx, uniform, transpose, data) + v: CustomAutoRooterGuard<Float32Array>) { + self.base.UniformMatrix3fv(location, transpose, v) } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 - #[allow(unsafe_code)] - unsafe fn UniformMatrix4fv(&self, - cx: *mut JSContext, - uniform: Option<&WebGLUniformLocation>, + fn UniformMatrix3fv_(&self, location: Option<&WebGLUniformLocation>, transpose: bool, value: Vec<f32>) { + self.base.UniformMatrix3fv_(location, transpose, value); + } + + /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn UniformMatrix4fv(&self, + location: Option<&WebGLUniformLocation>, transpose: bool, - data: *mut JSObject) -> Fallible<()> { - self.base.UniformMatrix4fv(cx, uniform, transpose, data) + v: CustomAutoRooterGuard<Float32Array>) { + self.base.UniformMatrix4fv(location, transpose, v) + } + + /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn UniformMatrix4fv_(&self, location: Option<&WebGLUniformLocation>, transpose: bool, value: Vec<f32>) { + self.base.UniformMatrix4fv_(location, transpose, value); } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9 @@ -770,9 +806,13 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext { } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 - #[allow(unsafe_code)] - unsafe fn VertexAttrib1fv(&self, cx: *mut JSContext, indx: u32, data: *mut JSObject) -> Fallible<()> { - self.base.VertexAttrib1fv(cx, indx, data) + fn VertexAttrib1fv(&self, indx: u32, v: CustomAutoRooterGuard<Float32Array>) { + self.base.VertexAttrib1fv(indx, v) + } + + /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn VertexAttrib1fv_(&self, indx: u32, v: Vec<f32>) { + self.base.VertexAttrib1fv_(indx, v) } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 @@ -781,9 +821,13 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext { } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 - #[allow(unsafe_code)] - unsafe fn VertexAttrib2fv(&self, cx: *mut JSContext, indx: u32, data: *mut JSObject) -> Fallible<()> { - self.base.VertexAttrib2fv(cx, indx, data) + fn VertexAttrib2fv(&self, indx: u32, v: CustomAutoRooterGuard<Float32Array>) { + self.base.VertexAttrib2fv(indx, v) + } + + /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn VertexAttrib2fv_(&self, indx: u32, v: Vec<f32>) { + self.base.VertexAttrib2fv_(indx, v) } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 @@ -792,9 +836,13 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext { } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 - #[allow(unsafe_code)] - unsafe fn VertexAttrib3fv(&self, cx: *mut JSContext, indx: u32, data: *mut JSObject) -> Fallible<()> { - self.base.VertexAttrib3fv(cx, indx, data) + fn VertexAttrib3fv(&self, indx: u32, v: CustomAutoRooterGuard<Float32Array>) { + self.base.VertexAttrib3fv(indx, v) + } + + /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn VertexAttrib3fv_(&self, indx: u32, v: Vec<f32>) { + self.base.VertexAttrib3fv_(indx, v) } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 @@ -803,9 +851,13 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext { } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 - #[allow(unsafe_code)] - unsafe fn VertexAttrib4fv(&self, cx: *mut JSContext, indx: u32, data: *mut JSObject) -> Fallible<()> { - self.base.VertexAttrib4fv(cx, indx, data) + fn VertexAttrib4fv(&self, indx: u32, v: CustomAutoRooterGuard<Float32Array>) { + self.base.VertexAttrib4fv(indx, v) + } + + /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn VertexAttrib4fv_(&self, indx: u32, v: Vec<f32>) { + self.base.VertexAttrib4fv_(indx, v) } /// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 5ce6efd03a3..8725e515861 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -47,10 +47,9 @@ use dom_struct::dom_struct; use euclid::Size2D; use fnv::FnvHashMap; use half::f16; -use js::conversions::ConversionBehavior; use js::jsapi::{JSContext, JSObject, Type}; use js::jsval::{BooleanValue, DoubleValue, Int32Value, JSVal, NullValue, UndefinedValue}; -use js::typedarray::{ArrayBufferView, TypedArray, TypedArrayElement, Float32, Int32}; +use js::typedarray::{ArrayBufferView, TypedArray, TypedArrayElement, Float32Array, Int32Array}; use js::rust::CustomAutoRooterGuard; use net_traits::image::base::PixelFormat; use net_traits::image_cache::ImageResponse; @@ -1160,38 +1159,6 @@ impl Drop for WebGLRenderingContext { } } -// FIXME: After [1] lands and the relevant Servo and codegen PR too, we should -// convert all our raw JSObject pointers to proper types. -// -// [1]: https://github.com/servo/rust-mozjs/pull/304 -#[allow(unsafe_code)] -unsafe fn typed_array_or_sequence_to_vec<T>(cx: *mut JSContext, - sequence_or_abv: *mut JSObject, - config: <T::Element as FromJSValConvertible>::Config) - -> Result<Vec<T::Element>, Error> - where T: TypedArrayElement, - T::Element: FromJSValConvertible + Clone, - <T::Element as FromJSValConvertible>::Config: Clone, -{ - // TODO(servo/rust-mozjs#330): replace this with a macro that supports generic types. - let typed_array: Option<TypedArray<T, *mut JSObject>> = - TypedArray::from(sequence_or_abv).ok(); - if let Some(mut typed_array) = typed_array { - return Ok(typed_array.as_slice().to_vec()); - } - assert!(!sequence_or_abv.is_null()); - rooted!(in(cx) let mut val = UndefinedValue()); - sequence_or_abv.to_jsval(cx, val.handle_mut()); - - match Vec::<T::Element>::from_jsval(cx, val.handle(), config) { - Ok(ConversionResult::Success(v)) => Ok(v), - Ok(ConversionResult::Failure(error)) => Err(Error::Type(error.into_owned())), - // FIXME: What to do here? Generated code only aborts the execution of - // the script. - Err(err) => panic!("unexpected conversion error: {:?}", err), - } -} - #[allow(unsafe_code)] unsafe fn fallible_array_buffer_view_to_vec(cx: *mut JSContext, abv: *mut JSObject) -> Result<Vec<u8>, Error> { @@ -2802,279 +2769,302 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 fn Uniform1f(&self, - uniform: Option<&WebGLUniformLocation>, + location: Option<&WebGLUniformLocation>, val: f32) { - if self.validate_uniform_parameters(uniform, UniformSetterType::Float, &[val]) { - self.send_command(WebGLCommand::Uniform1f(uniform.unwrap().id(), val)) + if self.validate_uniform_parameters(location, UniformSetterType::Float, &[val]) { + self.send_command(WebGLCommand::Uniform1f(location.unwrap().id(), val)) } } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 fn Uniform1i(&self, - uniform: Option<&WebGLUniformLocation>, + location: Option<&WebGLUniformLocation>, val: i32) { - if self.validate_uniform_parameters(uniform, UniformSetterType::Int, &[val]) { - self.send_command(WebGLCommand::Uniform1i(uniform.unwrap().id(), val)) + if self.validate_uniform_parameters(location, UniformSetterType::Int, &[val]) { + self.send_command(WebGLCommand::Uniform1i(location.unwrap().id(), val)) } } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 #[allow(unsafe_code)] - unsafe fn Uniform1iv(&self, - cx: *mut JSContext, - uniform: Option<&WebGLUniformLocation>, - data: *mut JSObject) -> Fallible<()> { - assert!(!data.is_null()); - let data_vec = typed_array_or_sequence_to_vec::<Int32>(cx, data, ConversionBehavior::Default)?; + fn Uniform1iv(&self, + location: Option<&WebGLUniformLocation>, + mut v: CustomAutoRooterGuard<Int32Array>) { + let data_vec = unsafe { v.as_slice().to_vec() }; - if self.validate_uniform_parameters(uniform, UniformSetterType::Int, &data_vec) { - self.send_command(WebGLCommand::Uniform1iv(uniform.unwrap().id(), data_vec)) - } + self.Uniform1iv_(location, data_vec); + } - Ok(()) + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn Uniform1iv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<i32>) { + if self.validate_uniform_parameters(location, UniformSetterType::Int, &v) { + self.send_command(WebGLCommand::Uniform1iv(location.unwrap().id(), v)) + } } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 #[allow(unsafe_code)] - unsafe fn Uniform1fv(&self, - cx: *mut JSContext, - uniform: Option<&WebGLUniformLocation>, - data: *mut JSObject) -> Fallible<()> { - assert!(!data.is_null()); - let data_vec = typed_array_or_sequence_to_vec::<Float32>(cx, data, ())?; + fn Uniform1fv(&self, + location: Option<&WebGLUniformLocation>, + mut v: CustomAutoRooterGuard<Float32Array>) { + let data_vec = unsafe { v.as_slice().to_vec() }; - if self.validate_uniform_parameters(uniform, UniformSetterType::Float, &data_vec) { - self.send_command(WebGLCommand::Uniform1fv(uniform.unwrap().id(), data_vec)); - } + self.Uniform1fv_(location, data_vec); + } - Ok(()) + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn Uniform1fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) { + if self.validate_uniform_parameters(location, UniformSetterType::Float, &v) { + self.send_command(WebGLCommand::Uniform1fv(location.unwrap().id(), v)); + } } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 fn Uniform2f(&self, - uniform: Option<&WebGLUniformLocation>, + location: Option<&WebGLUniformLocation>, x: f32, y: f32) { - if self.validate_uniform_parameters(uniform, UniformSetterType::FloatVec2, &[x, y]) { - self.send_command(WebGLCommand::Uniform2f(uniform.unwrap().id(), x, y)); + if self.validate_uniform_parameters(location, UniformSetterType::FloatVec2, &[x, y]) { + self.send_command(WebGLCommand::Uniform2f(location.unwrap().id(), x, y)); } } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 #[allow(unsafe_code)] - unsafe fn Uniform2fv(&self, - cx: *mut JSContext, - uniform: Option<&WebGLUniformLocation>, - data: *mut JSObject) -> Fallible<()> { - assert!(!data.is_null()); - let data_vec = typed_array_or_sequence_to_vec::<Float32>(cx, data, ())?; - - if self.validate_uniform_parameters(uniform, + fn Uniform2fv(&self, + location: Option<&WebGLUniformLocation>, + mut v: CustomAutoRooterGuard<Float32Array>) { + let data_vec = unsafe { v.as_slice().to_vec() }; + + self.Uniform2fv_(location, data_vec); + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn Uniform2fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) { + if self.validate_uniform_parameters(location, UniformSetterType::FloatVec2, - &data_vec) { - self.send_command(WebGLCommand::Uniform2fv(uniform.unwrap().id(), data_vec)); + &v) { + self.send_command(WebGLCommand::Uniform2fv(location.unwrap().id(), v)); } - - Ok(()) } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 fn Uniform2i(&self, - uniform: Option<&WebGLUniformLocation>, + location: Option<&WebGLUniformLocation>, x: i32, y: i32) { - if self.validate_uniform_parameters(uniform, + if self.validate_uniform_parameters(location, UniformSetterType::IntVec2, &[x, y]) { - self.send_command(WebGLCommand::Uniform2i(uniform.unwrap().id(), x, y)); + self.send_command(WebGLCommand::Uniform2i(location.unwrap().id(), x, y)); } } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 #[allow(unsafe_code)] - unsafe fn Uniform2iv(&self, - cx: *mut JSContext, - uniform: Option<&WebGLUniformLocation>, - data: *mut JSObject) -> Fallible<()> { - assert!(!data.is_null()); - let data_vec = typed_array_or_sequence_to_vec::<Int32>(cx, data, ConversionBehavior::Default)?; - - if self.validate_uniform_parameters(uniform, + fn Uniform2iv(&self, + location: Option<&WebGLUniformLocation>, + mut v: CustomAutoRooterGuard<Int32Array>) { + let data_vec = unsafe { v.as_slice().to_vec() }; + + self.Uniform2iv_(location, data_vec); + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn Uniform2iv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<i32>) { + if self.validate_uniform_parameters(location, UniformSetterType::IntVec2, - &data_vec) { - self.send_command(WebGLCommand::Uniform2iv(uniform.unwrap().id(), data_vec)); + &v) { + self.send_command(WebGLCommand::Uniform2iv(location.unwrap().id(), v)); } - - Ok(()) } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 fn Uniform3f(&self, - uniform: Option<&WebGLUniformLocation>, + location: Option<&WebGLUniformLocation>, x: f32, y: f32, z: f32) { - if self.validate_uniform_parameters(uniform, + if self.validate_uniform_parameters(location, UniformSetterType::FloatVec3, &[x, y, z]) { - self.send_command(WebGLCommand::Uniform3f(uniform.unwrap().id(), x, y, z)); + self.send_command(WebGLCommand::Uniform3f(location.unwrap().id(), x, y, z)); } } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 #[allow(unsafe_code)] - unsafe fn Uniform3fv(&self, - cx: *mut JSContext, - uniform: Option<&WebGLUniformLocation>, - data: *mut JSObject) -> Fallible<()> { - assert!(!data.is_null()); - let data_vec = typed_array_or_sequence_to_vec::<Float32>(cx, data, ())?; - - if self.validate_uniform_parameters(uniform, + fn Uniform3fv(&self, + location: Option<&WebGLUniformLocation>, + mut v: CustomAutoRooterGuard<Float32Array>) { + let data_vec = unsafe { v.as_slice().to_vec() }; + + self.Uniform3fv_(location, data_vec); + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn Uniform3fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) { + if self.validate_uniform_parameters(location, UniformSetterType::FloatVec3, - &data_vec) { - self.send_command(WebGLCommand::Uniform3fv(uniform.unwrap().id(), data_vec)) + &v) { + self.send_command(WebGLCommand::Uniform3fv(location.unwrap().id(), v)) } - - Ok(()) } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 fn Uniform3i(&self, - uniform: Option<&WebGLUniformLocation>, + location: Option<&WebGLUniformLocation>, x: i32, y: i32, z: i32) { - if self.validate_uniform_parameters(uniform, + if self.validate_uniform_parameters(location, UniformSetterType::IntVec3, &[x, y, z]) { - self.send_command(WebGLCommand::Uniform3i(uniform.unwrap().id(), x, y, z)) + self.send_command(WebGLCommand::Uniform3i(location.unwrap().id(), x, y, z)) } } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 #[allow(unsafe_code)] - unsafe fn Uniform3iv(&self, - cx: *mut JSContext, - uniform: Option<&WebGLUniformLocation>, - data: *mut JSObject) -> Fallible<()> { - assert!(!data.is_null()); - let data_vec = typed_array_or_sequence_to_vec::<Int32>(cx, data, ConversionBehavior::Default)?; - - if self.validate_uniform_parameters(uniform, + fn Uniform3iv(&self, + location: Option<&WebGLUniformLocation>, + mut v: CustomAutoRooterGuard<Int32Array>) { + let data_vec = unsafe { v.as_slice().to_vec() }; + + self.Uniform3iv_(location, data_vec); + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn Uniform3iv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<i32>) { + if self.validate_uniform_parameters(location, UniformSetterType::IntVec3, - &data_vec) { - self.send_command(WebGLCommand::Uniform3iv(uniform.unwrap().id(), data_vec)) + &v) { + self.send_command(WebGLCommand::Uniform3iv(location.unwrap().id(), v)) } - - Ok(()) } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 fn Uniform4i(&self, - uniform: Option<&WebGLUniformLocation>, + location: Option<&WebGLUniformLocation>, x: i32, y: i32, z: i32, w: i32) { - if self.validate_uniform_parameters(uniform, + if self.validate_uniform_parameters(location, UniformSetterType::IntVec4, &[x, y, z, w]) { - self.send_command(WebGLCommand::Uniform4i(uniform.unwrap().id(), x, y, z, w)) + self.send_command(WebGLCommand::Uniform4i(location.unwrap().id(), x, y, z, w)) } } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 #[allow(unsafe_code)] - unsafe fn Uniform4iv(&self, - cx: *mut JSContext, - uniform: Option<&WebGLUniformLocation>, - data: *mut JSObject) -> Fallible<()> { - assert!(!data.is_null()); - let data_vec = typed_array_or_sequence_to_vec::<Int32>(cx, data, ConversionBehavior::Default)?; - - if self.validate_uniform_parameters(uniform, + fn Uniform4iv(&self, + location: Option<&WebGLUniformLocation>, + mut v: CustomAutoRooterGuard<Int32Array>) { + let data_vec = unsafe { v.as_slice().to_vec() }; + + self.Uniform4iv_(location, data_vec); + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn Uniform4iv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<i32>) { + if self.validate_uniform_parameters(location, UniformSetterType::IntVec4, - &data_vec) { - self.send_command(WebGLCommand::Uniform4iv(uniform.unwrap().id(), data_vec)) + &v) { + self.send_command(WebGLCommand::Uniform4iv(location.unwrap().id(), v)) } - - Ok(()) } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 fn Uniform4f(&self, - uniform: Option<&WebGLUniformLocation>, + location: Option<&WebGLUniformLocation>, x: f32, y: f32, z: f32, w: f32) { - if self.validate_uniform_parameters(uniform, + if self.validate_uniform_parameters(location, UniformSetterType::FloatVec4, &[x, y, z, w]) { - self.send_command(WebGLCommand::Uniform4f(uniform.unwrap().id(), x, y, z, w)) + self.send_command(WebGLCommand::Uniform4f(location.unwrap().id(), x, y, z, w)) } } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 #[allow(unsafe_code)] - unsafe fn Uniform4fv(&self, - cx: *mut JSContext, - uniform: Option<&WebGLUniformLocation>, - data: *mut JSObject) -> Fallible<()> { - assert!(!data.is_null()); - let data_vec = typed_array_or_sequence_to_vec::<Float32>(cx, data, ())?; - - if self.validate_uniform_parameters(uniform, + fn Uniform4fv(&self, + location: Option<&WebGLUniformLocation>, + mut v: CustomAutoRooterGuard<Float32Array>) { + let data_vec = unsafe { v.as_slice().to_vec() }; + + self.Uniform4fv_(location, data_vec); + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn Uniform4fv_(&self, location: Option<&WebGLUniformLocation>, v: Vec<f32>) { + if self.validate_uniform_parameters(location, UniformSetterType::FloatVec4, - &data_vec) { - self.send_command(WebGLCommand::Uniform4fv(uniform.unwrap().id(), data_vec)) + &v) { + self.send_command(WebGLCommand::Uniform4fv(location.unwrap().id(), v)) } - - Ok(()) } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 #[allow(unsafe_code)] - unsafe fn UniformMatrix2fv(&self, - cx: *mut JSContext, - uniform: Option<&WebGLUniformLocation>, + fn UniformMatrix2fv(&self, + location: Option<&WebGLUniformLocation>, transpose: bool, - data: *mut JSObject) -> Fallible<()> { - assert!(!data.is_null()); - let data_vec = typed_array_or_sequence_to_vec::<Float32>(cx, data, ())?; - if self.validate_uniform_parameters(uniform, + mut v: CustomAutoRooterGuard<Float32Array>) { + let data_vec = unsafe { v.as_slice().to_vec() }; + + self.UniformMatrix2fv_(location, transpose, data_vec); + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn UniformMatrix2fv_(&self, + location: Option<&WebGLUniformLocation>, + transpose: bool, + value: Vec<f32>) { + if self.validate_uniform_parameters(location, UniformSetterType::FloatMat2, - &data_vec) { - self.send_command(WebGLCommand::UniformMatrix2fv(uniform.unwrap().id(), transpose, data_vec)); + &value) { + self.send_command(WebGLCommand::UniformMatrix2fv(location.unwrap().id(), transpose, value)); } - - Ok(()) } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 #[allow(unsafe_code)] - unsafe fn UniformMatrix3fv(&self, - cx: *mut JSContext, - uniform: Option<&WebGLUniformLocation>, + fn UniformMatrix3fv(&self, + location: Option<&WebGLUniformLocation>, transpose: bool, - data: *mut JSObject) -> Fallible<()> { - assert!(!data.is_null()); - let data_vec = typed_array_or_sequence_to_vec::<Float32>(cx, data, ())?; - if self.validate_uniform_parameters(uniform, + mut v: CustomAutoRooterGuard<Float32Array>) { + let data_vec = unsafe { v.as_slice().to_vec() }; + + self.UniformMatrix3fv_(location, transpose, data_vec); + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn UniformMatrix3fv_(&self, + location: Option<&WebGLUniformLocation>, + transpose: bool, + value: Vec<f32>) { + if self.validate_uniform_parameters(location, UniformSetterType::FloatMat3, - &data_vec) { - self.send_command(WebGLCommand::UniformMatrix3fv(uniform.unwrap().id(), transpose, data_vec)); + &value) { + self.send_command(WebGLCommand::UniformMatrix3fv(location.unwrap().id(), transpose, value)); } - - Ok(()) } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 #[allow(unsafe_code)] - unsafe fn UniformMatrix4fv(&self, - cx: *mut JSContext, - uniform: Option<&WebGLUniformLocation>, + fn UniformMatrix4fv(&self, + location: Option<&WebGLUniformLocation>, transpose: bool, - data: *mut JSObject) -> Fallible<()> { - assert!(!data.is_null()); - let data_vec = typed_array_or_sequence_to_vec::<Float32>(cx, data, ())?; - if self.validate_uniform_parameters(uniform, + mut v: CustomAutoRooterGuard<Float32Array>) { + let data_vec = unsafe { v.as_slice().to_vec() }; + + self.UniformMatrix4fv_(location, transpose, data_vec); + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn UniformMatrix4fv_(&self, + location: Option<&WebGLUniformLocation>, + transpose: bool, + value: Vec<f32>) { + if self.validate_uniform_parameters(location, UniformSetterType::FloatMat4, - &data_vec) { - self.send_command(WebGLCommand::UniformMatrix4fv(uniform.unwrap().id(), transpose, data_vec)); + &value) { + self.send_command(WebGLCommand::UniformMatrix4fv(location.unwrap().id(), transpose, value)); } - - Ok(()) } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9 @@ -3101,14 +3091,19 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 #[allow(unsafe_code)] - unsafe fn VertexAttrib1fv(&self, cx: *mut JSContext, indx: u32, data: *mut JSObject) -> Fallible<()> { - assert!(!data.is_null()); - let data_vec = typed_array_or_sequence_to_vec::<Float32>(cx, data, ())?; + fn VertexAttrib1fv(&self, indx: u32, mut v: CustomAutoRooterGuard<Float32Array>) { + let data_vec = unsafe { v.as_slice().to_vec() }; + if data_vec.len() < 1 { - return Ok(self.webgl_error(InvalidOperation)); + return self.webgl_error(InvalidOperation); } - self.vertex_attrib(indx, data_vec[0], 0f32, 0f32, 1f32); - Ok(()) + + self.VertexAttrib1fv_(indx, data_vec); + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn VertexAttrib1fv_(&self, indx: u32, values: Vec<f32>) { + self.vertex_attrib(indx, values[0], 0f32, 0f32, 1f32); } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 @@ -3118,14 +3113,19 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 #[allow(unsafe_code)] - unsafe fn VertexAttrib2fv(&self, cx: *mut JSContext, indx: u32, data: *mut JSObject) -> Fallible<()> { - assert!(!data.is_null()); - let data_vec = typed_array_or_sequence_to_vec::<Float32>(cx, data, ())?; + fn VertexAttrib2fv(&self, indx: u32, mut v: CustomAutoRooterGuard<Float32Array>) { + let data_vec = unsafe { v.as_slice().to_vec() }; + if data_vec.len() < 2 { - return Ok(self.webgl_error(InvalidOperation)); + return self.webgl_error(InvalidOperation); } - self.vertex_attrib(indx, data_vec[0], data_vec[1], 0f32, 1f32); - Ok(()) + + self.VertexAttrib2fv_(indx, data_vec); + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn VertexAttrib2fv_(&self, indx: u32, values: Vec<f32>) { + self.vertex_attrib(indx, values[0], values[1], 0f32, 1f32); } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 @@ -3135,14 +3135,19 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 #[allow(unsafe_code)] - unsafe fn VertexAttrib3fv(&self, cx: *mut JSContext, indx: u32, data: *mut JSObject) -> Fallible<()> { - assert!(!data.is_null()); - let data_vec = typed_array_or_sequence_to_vec::<Float32>(cx, data, ())?; + fn VertexAttrib3fv(&self, indx: u32, mut v: CustomAutoRooterGuard<Float32Array>) { + let data_vec = unsafe { v.as_slice().to_vec() }; + if data_vec.len() < 3 { - return Ok(self.webgl_error(InvalidOperation)); + return self.webgl_error(InvalidOperation); } - self.vertex_attrib(indx, data_vec[0], data_vec[1], data_vec[2], 1f32); - Ok(()) + + self.VertexAttrib3fv_(indx, data_vec); + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn VertexAttrib3fv_(&self, indx: u32, values: Vec<f32>) { + self.vertex_attrib(indx, values[0], values[1], values[2], 1f32); } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 @@ -3152,15 +3157,19 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext { // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 #[allow(unsafe_code)] - unsafe fn VertexAttrib4fv(&self, cx: *mut JSContext, indx: u32, data: *mut JSObject) -> Fallible<()> { - assert!(!data.is_null()); - let data_vec = typed_array_or_sequence_to_vec::<Float32>(cx, data, ())?; + fn VertexAttrib4fv(&self, indx: u32, mut v: CustomAutoRooterGuard<Float32Array>) { + let data_vec = unsafe { v.as_slice().to_vec() }; + if data_vec.len() < 4 { - return Ok(self.webgl_error(InvalidOperation)); + return self.webgl_error(InvalidOperation); } - self.vertex_attrib(indx, data_vec[0], data_vec[1], data_vec[2], data_vec[3]); - Ok(()) + self.VertexAttrib4fv_(indx, data_vec); + } + + // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 + fn VertexAttrib4fv_(&self, indx: u32, values: Vec<f32>) { + self.vertex_attrib(indx, values[0], values[1], values[2], values[3]); } // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10 diff --git a/components/script/dom/webidls/WebGLRenderingContext.webidl b/components/script/dom/webidls/WebGLRenderingContext.webidl index b65582af929..9921adf2504 100644 --- a/components/script/dom/webidls/WebGLRenderingContext.webidl +++ b/components/script/dom/webidls/WebGLRenderingContext.webidl @@ -648,98 +648,68 @@ interface WebGLRenderingContextBase GLenum format, GLenum type, TexImageSource source); // May throw DOMException void uniform1f(WebGLUniformLocation? location, GLfloat x); - //void uniform1fv(WebGLUniformLocation? location, Float32Array v); - //void uniform1fv(WebGLUniformLocation? location, sequence<GLfloat> v); - [Throws] - void uniform1fv(WebGLUniformLocation? location, object v); + void uniform1fv(WebGLUniformLocation? location, Float32Array v); + void uniform1fv(WebGLUniformLocation? location, sequence<GLfloat> v); + void uniform1i(WebGLUniformLocation? location, GLint x); - //void uniform1iv(WebGLUniformLocation? location, Int32Array v); - //void uniform1iv(WebGLUniformLocation? location, sequence<long> v); - [Throws] - void uniform1iv(WebGLUniformLocation? location, object v); + void uniform1iv(WebGLUniformLocation? location, Int32Array v); + void uniform1iv(WebGLUniformLocation? location, sequence<long> v); + void uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y); - //void uniform2fv(WebGLUniformLocation? location, Float32Array v); - //void uniform2fv(WebGLUniformLocation? location, sequence<GLfloat> v); - [Throws] - void uniform2fv(WebGLUniformLocation? location, object v); - //void uniform2i(WebGLUniformLocation? location, GLint x, GLint y); + void uniform2fv(WebGLUniformLocation? location, Float32Array v); + void uniform2fv(WebGLUniformLocation? location, sequence<GLfloat> v); + void uniform2i(WebGLUniformLocation? location, GLint x, GLint y); - //void uniform2iv(WebGLUniformLocation? location, Int32Array v); - //void uniform2iv(WebGLUniformLocation? location, sequence<long> v); - [Throws] - void uniform2iv(WebGLUniformLocation? location, object v); + void uniform2iv(WebGLUniformLocation? location, Int32Array v); + void uniform2iv(WebGLUniformLocation? location, sequence<long> v); + void uniform3f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z); - [Throws] - void uniform3fv(WebGLUniformLocation? location, object v); - //void uniform3fv(WebGLUniformLocation? location, Float32Array v); - //void uniform3fv(WebGLUniformLocation? location, sequence<GLfloat> v); + void uniform3fv(WebGLUniformLocation? location, Float32Array v); + void uniform3fv(WebGLUniformLocation? location, sequence<GLfloat> v); + void uniform3i(WebGLUniformLocation? location, GLint x, GLint y, GLint z); - //void uniform3iv(WebGLUniformLocation? location, Int32Array v); - //void uniform3iv(WebGLUniformLocation? location, sequence<long> v); - [Throws] - void uniform3iv(WebGLUniformLocation? location, object v); + void uniform3iv(WebGLUniformLocation? location, Int32Array v); + void uniform3iv(WebGLUniformLocation? location, sequence<long> v); + void uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - // FIXME(dmarcos) The function below is the original function in the webIdl: - //void uniform4fv(WebGLUniformLocation? location, Float32Array v); - // The Code genearator doesn't handle typed arrays, so we use object - // instead, and handle the type error ourselves. - [Throws] - void uniform4fv(WebGLUniformLocation? location, object v); - //void uniform4fv(WebGLUniformLocation? location, sequence<GLfloat> v); + void uniform4fv(WebGLUniformLocation? location, Float32Array v); + void uniform4fv(WebGLUniformLocation? location, sequence<GLfloat> v); + 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 - [Throws] - void uniform4iv(WebGLUniformLocation? location, object v); + void uniform4iv(WebGLUniformLocation? location, Int32Array v); + void uniform4iv(WebGLUniformLocation? location, sequence<long> v); - //void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, - // Float32Array value); - //void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, - // sequence<GLfloat> value); - [Throws] void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, - object v); - //void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, - // Float32Array value); - //void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, - // sequence<GLfloat> value); - [Throws] + Float32Array value); + void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, + sequence<GLfloat> value); void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, - object v); - //void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, - // Float32Array value); - //void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, - // sequence<GLfloat> value); - [Throws] + Float32Array value); + void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, + sequence<GLfloat> value); + void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, + Float32Array value); void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, - object v); + sequence<GLfloat> value); void useProgram(WebGLProgram? program); void validateProgram(WebGLProgram program); - // FIXME(dmarcos) - // The code generator doesn't handle Float32Array so we're using 'object' void vertexAttrib1f(GLuint indx, GLfloat x); - //void vertexAttrib1fv(GLuint indx, Float32Array values); - [Throws] - void vertexAttrib1fv(GLuint indx, object values); - //void vertexAttrib1fv(GLuint indx, sequence<GLfloat> values); + void vertexAttrib1fv(GLuint indx, Float32Array values); + void vertexAttrib1fv(GLuint indx, sequence<GLfloat> values); + void vertexAttrib2f(GLuint indx, GLfloat x, GLfloat y); - //void vertexAttrib2fv(GLuint indx, Float32Array values); - [Throws] - void vertexAttrib2fv(GLuint indx, object values); - //void vertexAttrib2fv(GLuint indx, sequence<GLfloat> values); + void vertexAttrib2fv(GLuint indx, Float32Array values); + void vertexAttrib2fv(GLuint indx, sequence<GLfloat> values); + void vertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z); - //void vertexAttrib3fv(GLuint indx, Float32Array values); - [Throws] - void vertexAttrib3fv(GLuint indx, object values); - //void vertexAttrib3fv(GLuint indx, sequence<GLfloat> values); + void vertexAttrib3fv(GLuint indx, Float32Array values); + void vertexAttrib3fv(GLuint indx, sequence<GLfloat> values); + void vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); - //void vertexAttrib4fv(GLuint indx, Float32Array values); - [Throws] - void vertexAttrib4fv(GLuint indx, object values); - //void vertexAttrib4fv(GLuint indx, sequence<GLfloat> values); + void vertexAttrib4fv(GLuint indx, Float32Array values); + void vertexAttrib4fv(GLuint indx, sequence<GLfloat> values); void vertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset); |