Add support for WebGL2 unsigned uniform operations

This adds support for the WebGL2 `uniform[1234]ui` and `uniform[1234]uiv`
operations.

See: https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.8
This commit is contained in:
Mátyás Mustoha 2020-01-10 11:47:25 +01:00
parent c6192dc286
commit bc914381a8
10 changed files with 643 additions and 134 deletions

4
Cargo.lock generated
View file

@ -5282,9 +5282,9 @@ dependencies = [
[[package]]
name = "sparkle"
version = "0.1.13"
version = "0.1.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6fa44f464f21157d0914646003e33c2c1ed336c11cbac36fa8ae1d5ad291bfc1"
checksum = "5ca7ee308d5e35a3b71728e17250778cf589a92ec56196e84380def310804309"
dependencies = [
"gl_generator 0.13.1",
]

View file

@ -34,7 +34,7 @@ num-traits = "0.2"
raqote = {git = "https://github.com/jrmuizel/raqote", optional = true}
pixels = {path = "../pixels"}
servo_config = {path = "../config"}
sparkle = "0.1.13"
sparkle = "0.1.14"
webrender = {git = "https://github.com/servo/webrender"}
webrender_api = {git = "https://github.com/servo/webrender"}
webrender_traits = {path = "../webrender_traits"}

View file

@ -1308,14 +1308,20 @@ impl WebGLImpl {
WebGLCommand::Uniform1fv(uniform_id, ref v) => gl.uniform_1fv(uniform_id, v),
WebGLCommand::Uniform1i(uniform_id, v) => gl.uniform_1i(uniform_id, v),
WebGLCommand::Uniform1iv(uniform_id, ref v) => gl.uniform_1iv(uniform_id, v),
WebGLCommand::Uniform1ui(uniform_id, v) => gl.uniform_1ui(uniform_id, v),
WebGLCommand::Uniform1uiv(uniform_id, ref v) => gl.uniform_1uiv(uniform_id, v),
WebGLCommand::Uniform2f(uniform_id, x, y) => gl.uniform_2f(uniform_id, x, y),
WebGLCommand::Uniform2fv(uniform_id, ref v) => gl.uniform_2fv(uniform_id, v),
WebGLCommand::Uniform2i(uniform_id, x, y) => gl.uniform_2i(uniform_id, x, y),
WebGLCommand::Uniform2iv(uniform_id, ref v) => gl.uniform_2iv(uniform_id, v),
WebGLCommand::Uniform2ui(uniform_id, x, y) => gl.uniform_2ui(uniform_id, x, y),
WebGLCommand::Uniform2uiv(uniform_id, ref v) => gl.uniform_2uiv(uniform_id, v),
WebGLCommand::Uniform3f(uniform_id, x, y, z) => gl.uniform_3f(uniform_id, x, y, z),
WebGLCommand::Uniform3fv(uniform_id, ref v) => gl.uniform_3fv(uniform_id, v),
WebGLCommand::Uniform3i(uniform_id, x, y, z) => gl.uniform_3i(uniform_id, x, y, z),
WebGLCommand::Uniform3iv(uniform_id, ref v) => gl.uniform_3iv(uniform_id, v),
WebGLCommand::Uniform3ui(uniform_id, x, y, z) => gl.uniform_3ui(uniform_id, x, y, z),
WebGLCommand::Uniform3uiv(uniform_id, ref v) => gl.uniform_3uiv(uniform_id, v),
WebGLCommand::Uniform4f(uniform_id, x, y, z, w) => {
gl.uniform_4f(uniform_id, x, y, z, w)
},
@ -1324,6 +1330,10 @@ impl WebGLImpl {
gl.uniform_4i(uniform_id, x, y, z, w)
},
WebGLCommand::Uniform4iv(uniform_id, ref v) => gl.uniform_4iv(uniform_id, v),
WebGLCommand::Uniform4ui(uniform_id, x, y, z, w) => {
gl.uniform_4ui(uniform_id, x, y, z, w)
},
WebGLCommand::Uniform4uiv(uniform_id, ref v) => gl.uniform_4uiv(uniform_id, v),
WebGLCommand::UniformMatrix2fv(uniform_id, ref v) => {
gl.uniform_matrix_2fv(uniform_id, false, v)
},
@ -1703,6 +1713,34 @@ impl WebGLImpl {
}
sender.send(value).unwrap();
},
WebGLCommand::GetUniformUint(program_id, loc, ref sender) => {
let mut value = [0];
unsafe {
gl.get_uniform_uiv(program_id.get(), loc, &mut value);
}
sender.send(value[0]).unwrap();
},
WebGLCommand::GetUniformUint2(program_id, loc, ref sender) => {
let mut value = [0; 2];
unsafe {
gl.get_uniform_uiv(program_id.get(), loc, &mut value);
}
sender.send(value).unwrap();
},
WebGLCommand::GetUniformUint3(program_id, loc, ref sender) => {
let mut value = [0; 3];
unsafe {
gl.get_uniform_uiv(program_id.get(), loc, &mut value);
}
sender.send(value).unwrap();
},
WebGLCommand::GetUniformUint4(program_id, loc, ref sender) => {
let mut value = [0; 4];
unsafe {
gl.get_uniform_uiv(program_id.get(), loc, &mut value);
}
sender.send(value).unwrap();
},
WebGLCommand::GetUniformFloat(program_id, loc, ref sender) => {
let mut value = [0.];
unsafe {

View file

@ -327,19 +327,27 @@ pub enum WebGLCommand {
Uniform1f(i32, f32),
Uniform1fv(i32, Vec<f32>),
Uniform1i(i32, i32),
Uniform1ui(i32, u32),
Uniform1iv(i32, Vec<i32>),
Uniform1uiv(i32, Vec<u32>),
Uniform2f(i32, f32, f32),
Uniform2fv(i32, Vec<f32>),
Uniform2i(i32, i32, i32),
Uniform2ui(i32, u32, u32),
Uniform2iv(i32, Vec<i32>),
Uniform2uiv(i32, Vec<u32>),
Uniform3f(i32, f32, f32, f32),
Uniform3fv(i32, Vec<f32>),
Uniform3i(i32, i32, i32, i32),
Uniform3ui(i32, u32, u32, u32),
Uniform3iv(i32, Vec<i32>),
Uniform3uiv(i32, Vec<u32>),
Uniform4f(i32, f32, f32, f32, f32),
Uniform4fv(i32, Vec<f32>),
Uniform4i(i32, i32, i32, i32, i32),
Uniform4ui(i32, u32, u32, u32, u32),
Uniform4iv(i32, Vec<i32>),
Uniform4uiv(i32, Vec<u32>),
UniformMatrix2fv(i32, Vec<f32>),
UniformMatrix3fv(i32, Vec<f32>),
UniformMatrix4fv(i32, Vec<f32>),
@ -456,6 +464,10 @@ pub enum WebGLCommand {
GetUniformInt2(WebGLProgramId, i32, WebGLSender<[i32; 2]>),
GetUniformInt3(WebGLProgramId, i32, WebGLSender<[i32; 3]>),
GetUniformInt4(WebGLProgramId, i32, WebGLSender<[i32; 4]>),
GetUniformUint(WebGLProgramId, i32, WebGLSender<u32>),
GetUniformUint2(WebGLProgramId, i32, WebGLSender<[u32; 2]>),
GetUniformUint3(WebGLProgramId, i32, WebGLSender<[u32; 3]>),
GetUniformUint4(WebGLProgramId, i32, WebGLSender<[u32; 4]>),
GetUniformFloat(WebGLProgramId, i32, WebGLSender<f32>),
GetUniformFloat2(WebGLProgramId, i32, WebGLSender<[f32; 2]>),
GetUniformFloat3(WebGLProgramId, i32, WebGLSender<[f32; 3]>),

View file

@ -11,6 +11,7 @@ use crate::dom::bindings::codegen::UnionTypes::ArrayBufferViewOrArrayBuffer;
use crate::dom::bindings::codegen::UnionTypes::Float32ArrayOrUnrestrictedFloatSequence;
use crate::dom::bindings::codegen::UnionTypes::ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement;
use crate::dom::bindings::codegen::UnionTypes::Int32ArrayOrLongSequence;
use crate::dom::bindings::codegen::UnionTypes::Uint32ArrayOrUnsignedLongSequence;
use crate::dom::bindings::error::{ErrorResult, Fallible};
use crate::dom::bindings::reflector::DomObject;
use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
@ -25,7 +26,8 @@ use crate::dom::webglprogram::WebGLProgram;
use crate::dom::webglquery::WebGLQuery;
use crate::dom::webglrenderbuffer::WebGLRenderbuffer;
use crate::dom::webglrenderingcontext::{
LayoutCanvasWebGLRenderingContextHelpers, Size2DExt, WebGLRenderingContext,
uniform_get, uniform_typed, LayoutCanvasWebGLRenderingContextHelpers, Size2DExt,
WebGLRenderingContext,
};
use crate::dom::webglsampler::{WebGLSampler, WebGLSamplerValue};
use crate::dom::webglshader::WebGLShader;
@ -48,7 +50,7 @@ use js::jsapi::{JSObject, Type};
use js::jsval::{BooleanValue, DoubleValue, Int32Value, UInt32Value};
use js::jsval::{JSVal, NullValue, ObjectValue, UndefinedValue};
use js::rust::CustomAutoRooterGuard;
use js::typedarray::{ArrayBufferView, CreateWith, Uint32Array};
use js::typedarray::{ArrayBufferView, CreateWith, Uint32, Uint32Array};
use script_layout_interface::HTMLCanvasDataSource;
use std::cell::Cell;
use std::cmp;
@ -386,6 +388,49 @@ impl WebGL2RenderingContext {
.copy_from_slice(&src[src_start..src_start + src_row_bytes as usize]);
}
}
fn uniform_vec_section(
&self,
vec: Uint32ArrayOrUnsignedLongSequence,
offset: u32,
length: u32,
uniform_size: usize,
uniform_location: &WebGLUniformLocation,
) -> WebGLResult<Vec<u32>> {
let vec = match vec {
Uint32ArrayOrUnsignedLongSequence::Uint32Array(v) => v.to_vec(),
Uint32ArrayOrUnsignedLongSequence::UnsignedLongSequence(v) => v,
};
let offset = offset as usize;
if offset > vec.len() {
return Err(InvalidValue);
}
let length = if length > 0 {
length as usize
} else {
vec.len() - offset
};
if offset + length > vec.len() {
return Err(InvalidValue);
}
let vec = if offset == 0 && length == vec.len() {
vec
} else {
vec[offset..offset + length].to_vec()
};
if vec.len() < uniform_size || vec.len() % uniform_size != 0 {
return Err(InvalidValue);
}
if uniform_location.size().is_none() && vec.len() != uniform_size {
return Err(InvalidOperation);
}
Ok(vec)
}
}
impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
@ -1457,6 +1502,57 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
self.base.Uniform1iv(location, v)
}
// https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.8
fn Uniform1ui(&self, location: Option<&WebGLUniformLocation>, val: u32) {
self.base.with_location(location, |location| {
match location.type_() {
constants::BOOL | constants::UNSIGNED_INT => (),
_ => return Err(InvalidOperation),
}
self.base
.send_command(WebGLCommand::Uniform1ui(location.id(), val));
Ok(())
});
}
// https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.8
fn Uniform1uiv(
&self,
location: Option<&WebGLUniformLocation>,
val: Uint32ArrayOrUnsignedLongSequence,
src_offset: u32,
src_length: u32,
) {
self.base.with_location(location, |location| {
match location.type_() {
constants::BOOL |
constants::UNSIGNED_INT |
constants::SAMPLER_2D |
constants::SAMPLER_CUBE => {},
_ => return Err(InvalidOperation),
}
let val = self.uniform_vec_section(val, src_offset, src_length, 1, location)?;
match location.type_() {
constants::SAMPLER_2D | constants::SAMPLER_CUBE => {
for &v in val
.iter()
.take(cmp::min(location.size().unwrap_or(1) as usize, val.len()))
{
if v >= self.base.limits().max_combined_texture_image_units {
return Err(InvalidValue);
}
}
},
_ => {},
}
self.base
.send_command(WebGLCommand::Uniform1uiv(location.id(), val));
Ok(())
});
}
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn Uniform1fv(
&self,
@ -1490,6 +1586,39 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
self.base.Uniform2iv(location, v)
}
// https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.8
fn Uniform2ui(&self, location: Option<&WebGLUniformLocation>, x: u32, y: u32) {
self.base.with_location(location, |location| {
match location.type_() {
constants::BOOL_VEC2 | constants::UNSIGNED_INT_VEC2 => {},
_ => return Err(InvalidOperation),
}
self.base
.send_command(WebGLCommand::Uniform2ui(location.id(), x, y));
Ok(())
});
}
// https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.8
fn Uniform2uiv(
&self,
location: Option<&WebGLUniformLocation>,
val: Uint32ArrayOrUnsignedLongSequence,
src_offset: u32,
src_length: u32,
) {
self.base.with_location(location, |location| {
match location.type_() {
constants::BOOL_VEC2 | constants::UNSIGNED_INT_VEC2 => {},
_ => return Err(InvalidOperation),
}
let val = self.uniform_vec_section(val, src_offset, src_length, 2, location)?;
self.base
.send_command(WebGLCommand::Uniform2uiv(location.id(), val));
Ok(())
});
}
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn Uniform3f(&self, location: Option<&WebGLUniformLocation>, x: f32, y: f32, z: f32) {
self.base.Uniform3f(location, x, y, z)
@ -1514,6 +1643,39 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
self.base.Uniform3iv(location, v)
}
// https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.8
fn Uniform3ui(&self, location: Option<&WebGLUniformLocation>, x: u32, y: u32, z: u32) {
self.base.with_location(location, |location| {
match location.type_() {
constants::BOOL_VEC3 | constants::UNSIGNED_INT_VEC3 => {},
_ => return Err(InvalidOperation),
}
self.base
.send_command(WebGLCommand::Uniform3ui(location.id(), x, y, z));
Ok(())
});
}
// https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.8
fn Uniform3uiv(
&self,
location: Option<&WebGLUniformLocation>,
val: Uint32ArrayOrUnsignedLongSequence,
src_offset: u32,
src_length: u32,
) {
self.base.with_location(location, |location| {
match location.type_() {
constants::BOOL_VEC3 | constants::UNSIGNED_INT_VEC3 => {},
_ => return Err(InvalidOperation),
}
let val = self.uniform_vec_section(val, src_offset, src_length, 3, location)?;
self.base
.send_command(WebGLCommand::Uniform3uiv(location.id(), val));
Ok(())
});
}
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn Uniform4i(&self, location: Option<&WebGLUniformLocation>, x: i32, y: i32, z: i32, w: i32) {
self.base.Uniform4i(location, x, y, z, w)
@ -1524,6 +1686,39 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
self.base.Uniform4iv(location, v)
}
// https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.8
fn Uniform4ui(&self, location: Option<&WebGLUniformLocation>, x: u32, y: u32, z: u32, w: u32) {
self.base.with_location(location, |location| {
match location.type_() {
constants::BOOL_VEC4 | constants::UNSIGNED_INT_VEC4 => {},
_ => return Err(InvalidOperation),
}
self.base
.send_command(WebGLCommand::Uniform4ui(location.id(), x, y, z, w));
Ok(())
});
}
// https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.8
fn Uniform4uiv(
&self,
location: Option<&WebGLUniformLocation>,
val: Uint32ArrayOrUnsignedLongSequence,
src_offset: u32,
src_length: u32,
) {
self.base.with_location(location, |location| {
match location.type_() {
constants::BOOL_VEC4 | constants::UNSIGNED_INT_VEC4 => {},
_ => return Err(InvalidOperation),
}
let val = self.uniform_vec_section(val, src_offset, src_length, 4, location)?;
self.base
.send_command(WebGLCommand::Uniform4uiv(location.id(), val));
Ok(())
});
}
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn Uniform4f(&self, location: Option<&WebGLUniformLocation>, x: f32, y: f32, z: f32, w: f32) {
self.base.Uniform4f(location, x, y, z, w)
@ -1568,14 +1763,37 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
self.base.UniformMatrix4fv(location, transpose, v)
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
/// https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.8
#[allow(unsafe_code)]
fn GetUniform(
&self,
cx: JSContext,
program: &WebGLProgram,
location: &WebGLUniformLocation,
) -> JSVal {
self.base.GetUniform(cx, program, location)
handle_potential_webgl_error!(
self.base,
self.base.uniform_check_program(program, location),
return NullValue()
);
let triple = (&*self.base, program.id(), location.id());
match location.type_() {
constants::UNSIGNED_INT => {
UInt32Value(uniform_get(triple, WebGLCommand::GetUniformUint))
},
constants::UNSIGNED_INT_VEC2 => unsafe {
uniform_typed::<Uint32>(*cx, &uniform_get(triple, WebGLCommand::GetUniformUint2))
},
constants::UNSIGNED_INT_VEC3 => unsafe {
uniform_typed::<Uint32>(*cx, &uniform_get(triple, WebGLCommand::GetUniformUint3))
},
constants::UNSIGNED_INT_VEC4 => unsafe {
uniform_typed::<Uint32>(*cx, &uniform_get(triple, WebGLCommand::GetUniformUint4))
},
_ => self.base.GetUniform(cx, program, location),
}
}
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9

View file

@ -114,6 +114,27 @@ fn has_invalid_blend_constants(arg1: u32, arg2: u32) -> bool {
}
}
pub fn uniform_get<T, F>(triple: (&WebGLRenderingContext, WebGLProgramId, i32), f: F) -> T
where
F: FnOnce(WebGLProgramId, i32, WebGLSender<T>) -> WebGLCommand,
T: for<'de> Deserialize<'de> + Serialize,
{
let (sender, receiver) = webgl_channel().unwrap();
triple.0.send_command(f(triple.1, triple.2, sender));
receiver.recv().unwrap()
}
#[allow(unsafe_code)]
pub unsafe fn uniform_typed<T>(cx: *mut JSContext, value: &[T::Element]) -> JSVal
where
T: TypedArrayElementCreator,
{
rooted!(in(cx) let mut rval = ptr::null_mut::<JSObject>());
<TypedArray<T, *mut JSObject>>::create(cx, CreateWith::Slice(&value), rval.handle_mut())
.unwrap();
ObjectValue(rval.get())
}
bitflags! {
/// Set of bitflags for texture unpacking (texImage2d, etc...)
#[derive(JSTraceable, MallocSizeOf)]
@ -401,7 +422,7 @@ impl WebGLRenderingContext {
Ok(())
}
fn with_location<F>(&self, location: Option<&WebGLUniformLocation>, f: F)
pub fn with_location<F>(&self, location: Option<&WebGLUniformLocation>, f: F)
where
F: FnOnce(&WebGLUniformLocation) -> WebGLResult<()>,
{
@ -1214,6 +1235,25 @@ impl WebGLRenderingContext {
pub fn current_program(&self) -> Option<DomRoot<WebGLProgram>> {
self.current_program.get()
}
pub fn uniform_check_program(
&self,
program: &WebGLProgram,
location: &WebGLUniformLocation,
) -> WebGLResult<()> {
self.validate_ownership(program)?;
if program.is_deleted() ||
!program.is_linked() ||
self.context_id() != location.context_id() ||
program.id() != location.program_id() ||
program.link_generation() != location.link_generation()
{
return Err(InvalidOperation);
}
Ok(())
}
}
#[cfg(not(feature = "webgl_backtrace"))]
@ -3548,88 +3588,60 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
program: &WebGLProgram,
location: &WebGLUniformLocation,
) -> JSVal {
handle_potential_webgl_error!(self, self.validate_ownership(program), return NullValue());
if program.is_deleted() ||
!program.is_linked() ||
self.context_id() != location.context_id() ||
program.id() != location.program_id() ||
program.link_generation() != location.link_generation()
{
self.webgl_error(InvalidOperation);
return NullValue();
}
fn get<T, F>(triple: (&WebGLRenderingContext, WebGLProgramId, i32), f: F) -> T
where
F: FnOnce(WebGLProgramId, i32, WebGLSender<T>) -> WebGLCommand,
T: for<'de> Deserialize<'de> + Serialize,
{
let (sender, receiver) = webgl_channel().unwrap();
triple.0.send_command(f(triple.1, triple.2, sender));
receiver.recv().unwrap()
}
handle_potential_webgl_error!(
self,
self.uniform_check_program(program, location),
return NullValue()
);
let triple = (self, program.id(), location.id());
unsafe fn typed<T>(cx: *mut JSContext, value: &[T::Element]) -> JSVal
where
T: TypedArrayElementCreator,
{
rooted!(in(cx) let mut rval = ptr::null_mut::<JSObject>());
<TypedArray<T, *mut JSObject>>::create(
cx,
CreateWith::Slice(&value),
rval.handle_mut(),
)
.unwrap();
ObjectValue(rval.get())
}
match location.type_() {
constants::BOOL => BooleanValue(get(triple, WebGLCommand::GetUniformBool)),
constants::BOOL => BooleanValue(uniform_get(triple, WebGLCommand::GetUniformBool)),
constants::BOOL_VEC2 => unsafe {
rooted!(in(*cx) let mut rval = NullValue());
get(triple, WebGLCommand::GetUniformBool2).to_jsval(*cx, rval.handle_mut());
uniform_get(triple, WebGLCommand::GetUniformBool2).to_jsval(*cx, rval.handle_mut());
rval.get()
},
constants::BOOL_VEC3 => unsafe {
rooted!(in(*cx) let mut rval = NullValue());
get(triple, WebGLCommand::GetUniformBool3).to_jsval(*cx, rval.handle_mut());
uniform_get(triple, WebGLCommand::GetUniformBool3).to_jsval(*cx, rval.handle_mut());
rval.get()
},
constants::BOOL_VEC4 => unsafe {
rooted!(in(*cx) let mut rval = NullValue());
get(triple, WebGLCommand::GetUniformBool4).to_jsval(*cx, rval.handle_mut());
uniform_get(triple, WebGLCommand::GetUniformBool4).to_jsval(*cx, rval.handle_mut());
rval.get()
},
constants::INT | constants::SAMPLER_2D | constants::SAMPLER_CUBE => {
Int32Value(get(triple, WebGLCommand::GetUniformInt))
Int32Value(uniform_get(triple, WebGLCommand::GetUniformInt))
},
constants::INT_VEC2 => unsafe {
typed::<Int32>(*cx, &get(triple, WebGLCommand::GetUniformInt2))
uniform_typed::<Int32>(*cx, &uniform_get(triple, WebGLCommand::GetUniformInt2))
},
constants::INT_VEC3 => unsafe {
typed::<Int32>(*cx, &get(triple, WebGLCommand::GetUniformInt3))
uniform_typed::<Int32>(*cx, &uniform_get(triple, WebGLCommand::GetUniformInt3))
},
constants::INT_VEC4 => unsafe {
typed::<Int32>(*cx, &get(triple, WebGLCommand::GetUniformInt4))
uniform_typed::<Int32>(*cx, &uniform_get(triple, WebGLCommand::GetUniformInt4))
},
constants::FLOAT => {
DoubleValue(uniform_get(triple, WebGLCommand::GetUniformFloat) as f64)
},
constants::FLOAT => DoubleValue(get(triple, WebGLCommand::GetUniformFloat) as f64),
constants::FLOAT_VEC2 => unsafe {
typed::<Float32>(*cx, &get(triple, WebGLCommand::GetUniformFloat2))
uniform_typed::<Float32>(*cx, &uniform_get(triple, WebGLCommand::GetUniformFloat2))
},
constants::FLOAT_VEC3 => unsafe {
typed::<Float32>(*cx, &get(triple, WebGLCommand::GetUniformFloat3))
uniform_typed::<Float32>(*cx, &uniform_get(triple, WebGLCommand::GetUniformFloat3))
},
constants::FLOAT_VEC4 | constants::FLOAT_MAT2 => unsafe {
typed::<Float32>(*cx, &get(triple, WebGLCommand::GetUniformFloat4))
uniform_typed::<Float32>(*cx, &uniform_get(triple, WebGLCommand::GetUniformFloat4))
},
constants::FLOAT_MAT3 => unsafe {
typed::<Float32>(*cx, &get(triple, WebGLCommand::GetUniformFloat9))
uniform_typed::<Float32>(*cx, &uniform_get(triple, WebGLCommand::GetUniformFloat9))
},
constants::FLOAT_MAT4 => unsafe {
typed::<Float32>(*cx, &get(triple, WebGLCommand::GetUniformFloat16))
uniform_typed::<Float32>(*cx, &uniform_get(triple, WebGLCommand::GetUniformFloat16))
},
_ => panic!("wrong uniform type"),
}

View file

@ -15,7 +15,7 @@ typedef unsigned long long GLuint64;
// interface WebGLVertexArrayObject : WebGLObject {
// };
// typedef ([AllowShared] Uint32Array or sequence<GLuint>) Uint32List;
typedef (/*[AllowShared]*/ Uint32Array or sequence<GLuint>) Uint32List;
interface mixin WebGL2RenderingContextBase
{
@ -425,10 +425,10 @@ interface mixin WebGL2RenderingContextBase
// [WebGLHandlesContextLoss] GLint getFragDataLocation(WebGLProgram program, DOMString name);
/* Uniforms */
// void uniform1ui(WebGLUniformLocation? location, GLuint v0);
// void uniform2ui(WebGLUniformLocation? location, GLuint v0, GLuint v1);
// void uniform3ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2);
// void uniform4ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
void uniform1ui(WebGLUniformLocation? location, GLuint v0);
void uniform2ui(WebGLUniformLocation? location, GLuint v0, GLuint v1);
void uniform3ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2);
void uniform4ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
// void uniform1fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0,
// optional GLuint srcLength = 0);
@ -448,14 +448,14 @@ interface mixin WebGL2RenderingContextBase
// void uniform4iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0,
// optional GLuint srcLength = 0);
// void uniform1uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0,
// optional GLuint srcLength = 0);
// void uniform2uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0,
// optional GLuint srcLength = 0);
// void uniform3uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0,
// optional GLuint srcLength = 0);
// void uniform4uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0,
// optional GLuint srcLength = 0);
void uniform1uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform2uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform3uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform4uiv(WebGLUniformLocation? location, Uint32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
// void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
// optional GLuint srcOffset = 0, optional GLuint srcLength = 0);

View file

@ -1,26 +1,32 @@
[methods-2.html]
[WebGL test #32: Property either does not exist or is not a function: vertexAttribI4ui]
[WebGL test #33: Property either does not exist or is not a function: getIndexedParameter]
expected: FAIL
[WebGL test #30: Property either does not exist or is not a function: vertexAttribI4i]
[WebGL test #34: Property either does not exist or is not a function: createVertexArray]
expected: FAIL
[WebGL test #28: Property either does not exist or is not a function: uniformMatrix3x4fv]
[WebGL test #36: Property either does not exist or is not a function: isVertexArray]
expected: FAIL
[WebGL test #33: Property either does not exist or is not a function: vertexAttribI4uiv]
[WebGL test #18: Property either does not exist or is not a function: uniformMatrix2x4fv]
expected: FAIL
[WebGL test #45: Property either does not exist or is not a function: bindVertexArray]
[WebGL test #25: Property either does not exist or is not a function: vertexAttribI4uiv]
expected: FAIL
[WebGL test #30: Property either does not exist or is not a function: clearBufferuiv]
expected: FAIL
[WebGL test #26: Property either does not exist or is not a function: vertexAttribIPointer]
expected: FAIL
[WebGL test #2: Property either does not exist or is not a function: framebufferTextureLayer]
expected: FAIL
[WebGL test #15: Property either does not exist or is not a function: getFragDataLocation]
[WebGL test #19: Property either does not exist or is not a function: uniformMatrix4x2fv]
expected: FAIL
[WebGL test #43: Property either does not exist or is not a function: deleteVertexArray]
[WebGL test #15: Property either does not exist or is not a function: getFragDataLocation]
expected: FAIL
[WebGL test #4: Property either does not exist or is not a function: invalidateFramebuffer]
@ -32,40 +38,34 @@
[WebGL test #10: Property either does not exist or is not a function: texStorage3D]
expected: FAIL
[WebGL test #21: Property either does not exist or is not a function: uniform2uiv]
expected: FAIL
[WebGL test #1: Property either does not exist or is not a function: blitFramebuffer]
expected: FAIL
[WebGL test #42: Property either does not exist or is not a function: createVertexArray]
[WebGL test #29: Property either does not exist or is not a function: clearBufferiv]
expected: FAIL
[WebGL test #11: Property either does not exist or is not a function: texSubImage3D]
[WebGL test #17: Property either does not exist or is not a function: uniformMatrix3x2fv]
expected: FAIL
[WebGL test #41: Property either does not exist or is not a function: getIndexedParameter]
expected: FAIL
[WebGL test #40: Property either does not exist or is not a function: clearBufferfi]
expected: FAIL
[WebGL test #25: Property either does not exist or is not a function: uniformMatrix3x2fv]
[WebGL test #37: Property either does not exist or is not a function: bindVertexArray]
expected: FAIL
[WebGL test #3: Property either does not exist or is not a function: getInternalformatParameter]
expected: FAIL
[WebGL test #24: Property either does not exist or is not a function: vertexAttribI4ui]
expected: FAIL
[WebGL test #32: Property either does not exist or is not a function: clearBufferfi]
expected: FAIL
[WebGL test #16: Property either does not exist or is not a function: uniformMatrix2x3fv]
expected: FAIL
[WebGL test #13: Property either does not exist or is not a function: compressedTexImage3D]
expected: FAIL
[WebGL test #27: Property either does not exist or is not a function: uniformMatrix4x2fv]
expected: FAIL
[WebGL test #34: Property either does not exist or is not a function: vertexAttribIPointer]
expected: FAIL
[WebGL test #16: Property either does not exist or is not a function: uniform1ui]
[WebGL test #22: Property either does not exist or is not a function: vertexAttribI4i]
expected: FAIL
[WebGL test #12: Property either does not exist or is not a function: copyTexSubImage3D]
@ -74,66 +74,42 @@
[WebGL test #8: Property either does not exist or is not a function: texImage3D]
expected: FAIL
[WebGL test #18: Property either does not exist or is not a function: uniform3ui]
expected: FAIL
[WebGL test #0: Property either does not exist or is not a function: isContextLost]
expected: FAIL
[WebGL test #36: Property either does not exist or is not a function: drawBuffers]
[WebGL test #31: Property either does not exist or is not a function: clearBufferfv]
expected: FAIL
[WebGL test #19: Property either does not exist or is not a function: uniform4ui]
[WebGL test #28: Property either does not exist or is not a function: drawBuffers]
expected: FAIL
[WebGL test #24: Property either does not exist or is not a function: uniformMatrix2x3fv]
[WebGL test #23: Property either does not exist or is not a function: vertexAttribI4iv]
expected: FAIL
[WebGL test #21: Property either does not exist or is not a function: uniformMatrix4x3fv]
expected: FAIL
[WebGL test #11: Property either does not exist or is not a function: texSubImage3D]
expected: FAIL
[WebGL test #9: Property either does not exist or is not a function: texStorage2D]
expected: FAIL
[WebGL test #29: Property either does not exist or is not a function: uniformMatrix4x3fv]
[WebGL test #27: Property either does not exist or is not a function: drawRangeElements]
expected: FAIL
[WebGL test #17: Property either does not exist or is not a function: uniform2ui]
expected: FAIL
[WebGL test #44: Property either does not exist or is not a function: isVertexArray]
expected: FAIL
[WebGL test #31: Property either does not exist or is not a function: vertexAttribI4iv]
[WebGL test #20: Property either does not exist or is not a function: uniformMatrix3x4fv]
expected: FAIL
[WebGL test #6: Property either does not exist or is not a function: readBuffer]
expected: FAIL
[WebGL test #38: Property either does not exist or is not a function: clearBufferuiv]
expected: FAIL
[WebGL test #23: Property either does not exist or is not a function: uniform4uiv]
expected: FAIL
[WebGL test #39: Property either does not exist or is not a function: clearBufferfv]
expected: FAIL
[WebGL test #35: Property either does not exist or is not a function: drawRangeElements]
expected: FAIL
[WebGL test #22: Property either does not exist or is not a function: uniform3uiv]
[WebGL test #35: Property either does not exist or is not a function: deleteVertexArray]
expected: FAIL
[WebGL test #5: Property either does not exist or is not a function: invalidateSubFramebuffer]
expected: FAIL
[WebGL test #26: Property either does not exist or is not a function: uniformMatrix2x4fv]
expected: FAIL
[WebGL test #14: Property either does not exist or is not a function: compressedTexSubImage3D]
expected: FAIL
[WebGL test #37: Property either does not exist or is not a function: clearBufferiv]
expected: FAIL
[WebGL test #20: Property either does not exist or is not a function: uniform1uiv]
expected: FAIL

View file

@ -1,2 +0,0 @@
[unary-minus-operator-in-dynamic-loop.html]
expected: ERROR

View file

@ -81,3 +81,258 @@
[WebGL test #148: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform1iv with srcOffset + srcLength out-of-bounds]
expected: FAIL
[WebGL test #296: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform2fv with srcOffset out-of-bounds]
expected: FAIL
[WebGL test #752: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform4fv with srcOffset out-of-bounds]
expected: FAIL
[WebGL test #364: value put in (16,15) matches value pulled out (0,16)]
expected: FAIL
[WebGL test #1058: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniformMatrix3fv with srcOffset + srcLength out-of-bounds]
expected: FAIL
[WebGL test #959: getError expected: NO_ERROR. Was INVALID_VALUE : can set an array of uniforms with gl.uniformMatrix2fv with srcOffset = 3 / srcLength = 0]
expected: FAIL
[WebGL test #820: value put in (16,15,14,13) matches value pulled out (0,0,0,16)]
expected: FAIL
[WebGL test #351: getError expected: NO_ERROR. Was INVALID_VALUE : can set an array of uniforms with gl.uniform2iv with srcOffset = 1 / srcLength = 0]
expected: FAIL
[WebGL test #604: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform3iv with array length minus srcOffset not multiple of ivec3]
expected: FAIL
[WebGL test #603: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform3iv with 0 data]
expected: FAIL
[WebGL test #828: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform4iv with srcOffset out-of-bounds]
expected: FAIL
[WebGL test #753: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform4fv with srcLength out-of-bounds]
expected: FAIL
[WebGL test #1135: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniformMatrix4fv with 0 data]
expected: FAIL
[WebGL test #1132: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniformMatrix4fv with srcOffset out-of-bounds]
expected: FAIL
[WebGL test #972: value put in (16,15,14,13) matches value pulled out (0,0,0,16)]
expected: FAIL
[WebGL test #1133: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniformMatrix4fv with srcLength out-of-bounds]
expected: FAIL
[WebGL test #601: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform3iv with srcLength out-of-bounds]
expected: FAIL
[WebGL test #754: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform4fv with srcOffset + srcLength out-of-bounds]
expected: FAIL
[WebGL test #830: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform4iv with srcOffset + srcLength out-of-bounds]
expected: FAIL
[WebGL test #797: getError expected: NO_ERROR. Was INVALID_VALUE : can set an array of uniforms with gl.uniform4iv with srcOffset = 3]
expected: FAIL
[WebGL test #528: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform3fv with array length minus srcOffset not multiple of vec3]
expected: FAIL
[WebGL test #807: getError expected: NO_ERROR. Was INVALID_VALUE : can set an array of uniforms with gl.uniform4iv with srcOffset = 3 / srcLength = 0]
expected: FAIL
[WebGL test #298: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform2fv with srcOffset + srcLength out-of-bounds]
expected: FAIL
[WebGL test #1137: successfullyParsed should be true (of type boolean). Was undefined (of type undefined).]
expected: FAIL
[WebGL test #1111: getError expected: NO_ERROR. Was INVALID_VALUE : can set an array of uniforms with gl.uniformMatrix4fv with srcOffset = 2 / srcLength = 0]
expected: FAIL
[WebGL test #1045: getError expected: NO_ERROR. Was INVALID_VALUE : can set an array of uniforms with gl.uniformMatrix3fv with srcOffset = 3 / srcLength = 9]
expected: FAIL
[WebGL test #375: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform2iv with 0 data]
expected: FAIL
[WebGL test #294: value put in (99,99) matches value pulled out (13,0)]
expected: FAIL
[WebGL test #525: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform3fv with srcLength out-of-bounds]
expected: FAIL
[WebGL test #275: getError expected: NO_ERROR. Was INVALID_VALUE : can set an array of uniforms with gl.uniform2fv with srcOffset = 1 / srcLength = 0]
expected: FAIL
[WebGL test #526: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform3fv with srcOffset + srcLength out-of-bounds]
expected: FAIL
[WebGL test #370: value put in (99,99) matches value pulled out (13,0)]
expected: FAIL
[WebGL test #747: value put in (12,11,10,9) matches value pulled out (15,14,13,12)]
expected: FAIL
[WebGL test #519: value put in (13,12,11) matches value pulled out (14,13,12)]
expected: FAIL
[WebGL test #1056: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniformMatrix3fv with srcOffset out-of-bounds]
expected: FAIL
[WebGL test #522: value put in (99,99,99) matches value pulled out (11,0,0)]
expected: FAIL
[WebGL test #731: getError expected: NO_ERROR. Was INVALID_VALUE : can set an array of uniforms with gl.uniform4fv with srcOffset = 3 / srcLength = 0]
expected: FAIL
[WebGL test #516: value put in (16,15,14) matches value pulled out (0,16,15)]
expected: FAIL
[WebGL test #288: value put in (16,15) matches value pulled out (0,16)]
expected: FAIL
[WebGL test #527: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform3fv with 0 data]
expected: FAIL
[WebGL test #569: getError expected: NO_ERROR. Was INVALID_VALUE : can set an array of uniforms with gl.uniform3iv with srcOffset = 1]
expected: FAIL
[WebGL test #374: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform2iv with srcOffset + srcLength out-of-bounds]
expected: FAIL
[WebGL test #592: value put in (16,15,14) matches value pulled out (0,16,15)]
expected: FAIL
[WebGL test #602: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform3iv with srcOffset + srcLength out-of-bounds]
expected: FAIL
[WebGL test #524: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform3fv with srcOffset out-of-bounds]
expected: FAIL
[WebGL test #600: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform3iv with srcOffset out-of-bounds]
expected: FAIL
[WebGL test #981: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniformMatrix2fv with srcLength out-of-bounds]
expected: FAIL
[WebGL test #721: getError expected: NO_ERROR. Was INVALID_VALUE : can set an array of uniforms with gl.uniform4fv with srcOffset = 3]
expected: FAIL
[WebGL test #299: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform2fv with 0 data]
expected: FAIL
[WebGL test #1101: getError expected: NO_ERROR. Was INVALID_VALUE : can set an array of uniforms with gl.uniformMatrix4fv with srcOffset = 2]
expected: FAIL
[WebGL test #826: value put in (99,99,99,99) matches value pulled out (11,10,9,0)]
expected: FAIL
[WebGL test #300: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform2fv with array length minus srcOffset not multiple of vec2]
expected: FAIL
[WebGL test #750: value put in (99,99,99,99) matches value pulled out (11,10,9,0)]
expected: FAIL
[WebGL test #1121: getError expected: NO_ERROR. Was INVALID_VALUE : can set an array of uniforms with gl.uniformMatrix4fv with srcOffset = 2 / srcLength = 16]
expected: FAIL
[WebGL test #367: value put in (14,13) matches value pulled out (15,14)]
expected: FAIL
[WebGL test #595: value put in (13,12,11) matches value pulled out (14,13,12)]
expected: FAIL
[WebGL test #579: getError expected: NO_ERROR. Was INVALID_VALUE : can set an array of uniforms with gl.uniform3iv with srcOffset = 1 / srcLength = 0]
expected: FAIL
[WebGL test #297: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform2fv with srcLength out-of-bounds]
expected: FAIL
[WebGL test #291: value put in (14,13) matches value pulled out (15,14)]
expected: FAIL
[WebGL test #978: value put in (99,99,99,99) matches value pulled out (11,10,9,0)]
expected: FAIL
[WebGL test #984: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniformMatrix2fv with array length minus srcOffset not multiple of mat2]
expected: FAIL
[WebGL test #980: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniformMatrix2fv with srcOffset out-of-bounds]
expected: FAIL
[WebGL test #829: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform4iv with srcLength out-of-bounds]
expected: FAIL
[WebGL test #1057: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniformMatrix3fv with srcLength out-of-bounds]
expected: FAIL
[WebGL test #823: value put in (12,11,10,9) matches value pulled out (15,14,13,12)]
expected: FAIL
[WebGL test #1035: getError expected: NO_ERROR. Was INVALID_VALUE : can set an array of uniforms with gl.uniformMatrix3fv with srcOffset = 3 / srcLength = 0]
expected: FAIL
[WebGL test #755: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform4fv with 0 data]
expected: FAIL
[WebGL test #832: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform4iv with array length minus srcOffset not multiple of ivec4]
expected: FAIL
[WebGL test #831: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform4iv with 0 data]
expected: FAIL
[WebGL test #744: value put in (16,15,14,13) matches value pulled out (0,0,0,16)]
expected: FAIL
[WebGL test #1025: getError expected: NO_ERROR. Was INVALID_VALUE : can set an array of uniforms with gl.uniformMatrix3fv with srcOffset = 3]
expected: FAIL
[WebGL test #341: getError expected: NO_ERROR. Was INVALID_VALUE : can set an array of uniforms with gl.uniform2iv with srcOffset = 1]
expected: FAIL
[WebGL test #503: getError expected: NO_ERROR. Was INVALID_VALUE : can set an array of uniforms with gl.uniform3fv with srcOffset = 1 / srcLength = 0]
expected: FAIL
[WebGL test #265: getError expected: NO_ERROR. Was INVALID_VALUE : can set an array of uniforms with gl.uniform2fv with srcOffset = 1]
expected: FAIL
[WebGL test #493: getError expected: NO_ERROR. Was INVALID_VALUE : can set an array of uniforms with gl.uniform3fv with srcOffset = 1]
expected: FAIL
[WebGL test #598: value put in (99,99,99) matches value pulled out (11,0,0)]
expected: FAIL
[WebGL test #982: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniformMatrix2fv with srcOffset + srcLength out-of-bounds]
expected: FAIL
[WebGL test #983: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniformMatrix2fv with 0 data]
expected: FAIL
[WebGL test #949: getError expected: NO_ERROR. Was INVALID_VALUE : can set an array of uniforms with gl.uniformMatrix2fv with srcOffset = 3]
expected: FAIL
[WebGL test #756: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform4fv with array length minus srcOffset not multiple of vec4]
expected: FAIL
[WebGL test #1059: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniformMatrix3fv with 0 data]
expected: FAIL
[WebGL test #373: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform2iv with srcLength out-of-bounds]
expected: FAIL
[WebGL test #376: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform2iv with array length minus srcOffset not multiple of ivec2]
expected: FAIL
[WebGL test #975: value put in (12,11,10,9) matches value pulled out (15,14,13,12)]
expected: FAIL
[WebGL test #372: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniform2iv with srcOffset out-of-bounds]
expected: FAIL
[WebGL test #1134: getError expected: INVALID_VALUE. Was NO_ERROR : gl.uniformMatrix4fv with srcOffset + srcLength out-of-bounds]
expected: FAIL