webgl: Update IDL from upstream to avoid overloading issues.

This commit is contained in:
Josh Matthews 2020-04-23 15:21:57 -04:00
parent c1f787be5e
commit 1ce68eb4ea
4 changed files with 596 additions and 479 deletions

View file

@ -18,7 +18,6 @@ use crate::dom::bindings::root::{Dom, DomRoot, LayoutDom, MutNullableDom};
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
use crate::dom::htmlcanvaselement::HTMLCanvasElement;
use crate::dom::htmliframeelement::HTMLIFrameElement;
use crate::dom::webglactiveinfo::WebGLActiveInfo;
use crate::dom::webglbuffer::WebGLBuffer;
use crate::dom::webglframebuffer::{WebGLFramebuffer, WebGLFramebufferAttachmentRoot};
@ -1193,7 +1192,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
}
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
fn BufferData(&self, target: u32, data: Option<ArrayBufferViewOrArrayBuffer>, usage: u32) {
fn BufferData_(&self, target: u32, data: Option<ArrayBufferViewOrArrayBuffer>, usage: u32) {
let usage = handle_potential_webgl_error!(self.base, self.buffer_usage(usage), return);
let bound_buffer =
handle_potential_webgl_error!(self.base, self.bound_buffer(target), return);
@ -1201,7 +1200,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
}
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
fn BufferData_(&self, target: u32, size: i64, usage: u32) {
fn BufferData(&self, target: u32, size: i64, usage: u32) {
let usage = handle_potential_webgl_error!(self.base, self.buffer_usage(usage), return);
let bound_buffer =
handle_potential_webgl_error!(self.base, self.bound_buffer(target), return);
@ -1425,7 +1424,8 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
}
}
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
/// https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.6
#[allow(unsafe_code)]
fn CompressedTexImage2D(
&self,
target: u32,
@ -1435,19 +1435,32 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
height: i32,
border: i32,
pixels: CustomAutoRooterGuard<ArrayBufferView>,
src_offset: u32,
src_length_override: u32,
) {
self.base.CompressedTexImage2D(
let mut data = unsafe { pixels.as_slice() };
let start = src_offset as usize;
let end = (src_offset + src_length_override) as usize;
if start > data.len() || end > data.len() {
self.base.webgl_error(InvalidValue);
return;
}
if src_length_override != 0 {
data = &data[start..end];
}
self.base.compressed_tex_image_2d(
target,
level,
internal_format,
width,
height,
border,
pixels,
data,
)
}
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
#[allow(unsafe_code)]
fn CompressedTexSubImage2D(
&self,
target: u32,
@ -1458,9 +1471,21 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
height: i32,
format: u32,
pixels: CustomAutoRooterGuard<ArrayBufferView>,
src_offset: u32,
src_length_override: u32,
) {
self.base.CompressedTexSubImage2D(
target, level, xoffset, yoffset, width, height, format, pixels,
let mut data = unsafe { pixels.as_slice() };
let start = src_offset as usize;
let end = (src_offset + src_length_override) as usize;
if start > data.len() || end > data.len() {
self.base.webgl_error(InvalidValue);
return;
}
if src_length_override != 0 {
data = &data[start..end];
}
self.base.compressed_tex_sub_image_2d(
target, level, xoffset, yoffset, width, height, format, data,
)
}
@ -2104,7 +2129,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
src_offset: u32,
src_length: u32,
) {
self.base.Uniform1iv(location, v, src_offset, src_length)
self.base.uniform1iv(location, v, src_offset, src_length)
}
// https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.8
@ -2166,7 +2191,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
src_offset: u32,
src_length: u32,
) {
self.base.Uniform1fv(location, v, src_offset, src_length);
self.base.uniform1fv(location, v, src_offset, src_length);
}
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
@ -2182,7 +2207,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
src_offset: u32,
src_length: u32,
) {
self.base.Uniform2fv(location, v, src_offset, src_length);
self.base.uniform2fv(location, v, src_offset, src_length);
}
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
@ -2198,7 +2223,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
src_offset: u32,
src_length: u32,
) {
self.base.Uniform2iv(location, v, src_offset, src_length)
self.base.uniform2iv(location, v, src_offset, src_length)
}
// https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.8
@ -2247,7 +2272,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
src_offset: u32,
src_length: u32,
) {
self.base.Uniform3fv(location, v, src_offset, src_length);
self.base.uniform3fv(location, v, src_offset, src_length);
}
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
@ -2263,7 +2288,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
src_offset: u32,
src_length: u32,
) {
self.base.Uniform3iv(location, v, src_offset, src_length)
self.base.uniform3iv(location, v, src_offset, src_length)
}
// https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.8
@ -2312,7 +2337,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
src_offset: u32,
src_length: u32,
) {
self.base.Uniform4iv(location, v, src_offset, src_length)
self.base.uniform4iv(location, v, src_offset, src_length)
}
// https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.8
@ -2361,7 +2386,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
src_offset: u32,
src_length: u32,
) {
self.base.Uniform4fv(location, v, src_offset, src_length);
self.base.uniform4fv(location, v, src_offset, src_length);
}
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
@ -2374,7 +2399,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
src_length: u32,
) {
self.base
.UniformMatrix2fv(location, transpose, v, src_offset, src_length)
.uniform_matrix_2fv(location, transpose, v, src_offset, src_length)
}
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
@ -2387,7 +2412,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
src_length: u32,
) {
self.base
.UniformMatrix3fv(location, transpose, v, src_offset, src_length)
.uniform_matrix_3fv(location, transpose, v, src_offset, src_length)
}
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
@ -2400,7 +2425,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
src_length: u32,
) {
self.base
.UniformMatrix4fv(location, transpose, v, src_offset, src_length)
.uniform_matrix_4fv(location, transpose, v, src_offset, src_length)
}
/// https://www.khronos.org/registry/webgl/specs/latest/2.0/#3.7.8
@ -2766,7 +2791,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
&self,
target: u32,
level: i32,
internal_format: u32,
internal_format: i32,
width: i32,
height: i32,
border: i32,
@ -2792,7 +2817,7 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
&self,
target: u32,
level: i32,
internal_format: u32,
internal_format: i32,
format: u32,
data_type: u32,
source: ImageDataOrHTMLImageElementOrHTMLCanvasElementOrHTMLVideoElement,
@ -2801,30 +2826,6 @@ impl WebGL2RenderingContextMethods for WebGL2RenderingContext {
.TexImage2D_(target, level, internal_format, format, data_type, source)
}
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
fn TexImageDOM(
&self,
target: u32,
level: i32,
internal_format: u32,
width: i32,
height: i32,
format: u32,
data_type: u32,
source: &HTMLIFrameElement,
) -> Fallible<()> {
self.base.TexImageDOM(
target,
level,
internal_format,
width,
height,
format,
data_type,
source,
)
}
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
fn TexSubImage2D(
&self,

View file

@ -1533,6 +1533,340 @@ impl WebGLRenderingContext {
let last_slot = constants::COLOR_ATTACHMENT0 + self.limits().max_color_attachments - 1;
constants::COLOR_ATTACHMENT0 <= attachment && attachment <= last_slot
}
pub fn compressed_tex_image_2d<'a>(
&self,
target: u32,
level: i32,
internal_format: u32,
width: i32,
height: i32,
border: i32,
data: &'a [u8],
) {
let validator = CompressedTexImage2DValidator::new(
self,
target,
level,
width,
height,
border,
internal_format,
data.len(),
);
let CommonCompressedTexImage2DValidatorResult {
texture,
target,
level,
width,
height,
compression,
} = match validator.validate() {
Ok(result) => result,
Err(_) => return,
};
let size = Size2D::new(width, height);
let buff = IpcSharedMemory::from_bytes(data);
let pixels = TexPixels::from_array(buff, size);
let data = pixels.data;
handle_potential_webgl_error!(
self,
texture.initialize(
target,
size.width,
size.height,
1,
compression.format,
level,
Some(TexDataType::UnsignedByte)
)
);
self.send_command(WebGLCommand::CompressedTexImage2D {
target: target.as_gl_constant(),
level,
internal_format,
size: Size2D::new(width, height),
data: data.into(),
});
if let Some(fb) = self.bound_draw_framebuffer.get() {
fb.invalidate_texture(&*texture);
}
}
pub fn compressed_tex_sub_image_2d<'a>(
&self,
target: u32,
level: i32,
xoffset: i32,
yoffset: i32,
width: i32,
height: i32,
format: u32,
data: &'a [u8],
) {
let validator = CompressedTexSubImage2DValidator::new(
self,
target,
level,
xoffset,
yoffset,
width,
height,
format,
data.len(),
);
let CommonCompressedTexImage2DValidatorResult {
texture: _,
target,
level,
width,
height,
..
} = match validator.validate() {
Ok(result) => result,
Err(_) => return,
};
let buff = IpcSharedMemory::from_bytes(data);
let pixels = TexPixels::from_array(buff, Size2D::new(width, height));
let data = pixels.data;
self.send_command(WebGLCommand::CompressedTexSubImage2D {
target: target.as_gl_constant(),
level: level as i32,
xoffset,
yoffset,
size: Size2D::new(width, height),
format,
data: data.into(),
});
}
pub fn uniform1iv(
&self,
location: Option<&WebGLUniformLocation>,
val: Int32ArrayOrLongSequence,
src_offset: u32,
src_length: u32,
) {
self.with_location(location, |location| {
match location.type_() {
constants::BOOL |
constants::INT |
constants::SAMPLER_2D |
constants::SAMPLER_CUBE => {},
_ => return Err(InvalidOperation),
}
let val = self.uniform_vec_section_int(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 < 0 || v as u32 >= self.limits.max_combined_texture_image_units {
return Err(InvalidValue);
}
}
},
_ => {},
}
self.send_command(WebGLCommand::Uniform1iv(location.id(), val));
Ok(())
});
}
pub fn uniform1fv(
&self,
location: Option<&WebGLUniformLocation>,
val: Float32ArrayOrUnrestrictedFloatSequence,
src_offset: u32,
src_length: u32,
) {
self.with_location(location, |location| {
match location.type_() {
constants::BOOL | constants::FLOAT => {},
_ => return Err(InvalidOperation),
}
let val = self.uniform_vec_section_float(val, src_offset, src_length, 1, location)?;
self.send_command(WebGLCommand::Uniform1fv(location.id(), val));
Ok(())
});
}
pub fn uniform2fv(
&self,
location: Option<&WebGLUniformLocation>,
val: Float32ArrayOrUnrestrictedFloatSequence,
src_offset: u32,
src_length: u32,
) {
self.with_location(location, |location| {
match location.type_() {
constants::BOOL_VEC2 | constants::FLOAT_VEC2 => {},
_ => return Err(InvalidOperation),
}
let val = self.uniform_vec_section_float(val, src_offset, src_length, 2, location)?;
self.send_command(WebGLCommand::Uniform2fv(location.id(), val));
Ok(())
});
}
pub fn uniform2iv(
&self,
location: Option<&WebGLUniformLocation>,
val: Int32ArrayOrLongSequence,
src_offset: u32,
src_length: u32,
) {
self.with_location(location, |location| {
match location.type_() {
constants::BOOL_VEC2 | constants::INT_VEC2 => {},
_ => return Err(InvalidOperation),
}
let val = self.uniform_vec_section_int(val, src_offset, src_length, 2, location)?;
self.send_command(WebGLCommand::Uniform2iv(location.id(), val));
Ok(())
});
}
pub fn uniform3fv(
&self,
location: Option<&WebGLUniformLocation>,
val: Float32ArrayOrUnrestrictedFloatSequence,
src_offset: u32,
src_length: u32,
) {
self.with_location(location, |location| {
match location.type_() {
constants::BOOL_VEC3 | constants::FLOAT_VEC3 => {},
_ => return Err(InvalidOperation),
}
let val = self.uniform_vec_section_float(val, src_offset, src_length, 3, location)?;
self.send_command(WebGLCommand::Uniform3fv(location.id(), val));
Ok(())
});
}
pub fn uniform3iv(
&self,
location: Option<&WebGLUniformLocation>,
val: Int32ArrayOrLongSequence,
src_offset: u32,
src_length: u32,
) {
self.with_location(location, |location| {
match location.type_() {
constants::BOOL_VEC3 | constants::INT_VEC3 => {},
_ => return Err(InvalidOperation),
}
let val = self.uniform_vec_section_int(val, src_offset, src_length, 3, location)?;
self.send_command(WebGLCommand::Uniform3iv(location.id(), val));
Ok(())
});
}
pub fn uniform4iv(
&self,
location: Option<&WebGLUniformLocation>,
val: Int32ArrayOrLongSequence,
src_offset: u32,
src_length: u32,
) {
self.with_location(location, |location| {
match location.type_() {
constants::BOOL_VEC4 | constants::INT_VEC4 => {},
_ => return Err(InvalidOperation),
}
let val = self.uniform_vec_section_int(val, src_offset, src_length, 4, location)?;
self.send_command(WebGLCommand::Uniform4iv(location.id(), val));
Ok(())
});
}
pub fn uniform4fv(
&self,
location: Option<&WebGLUniformLocation>,
val: Float32ArrayOrUnrestrictedFloatSequence,
src_offset: u32,
src_length: u32,
) {
self.with_location(location, |location| {
match location.type_() {
constants::BOOL_VEC4 | constants::FLOAT_VEC4 => {},
_ => return Err(InvalidOperation),
}
let val = self.uniform_vec_section_float(val, src_offset, src_length, 4, location)?;
self.send_command(WebGLCommand::Uniform4fv(location.id(), val));
Ok(())
});
}
pub fn uniform_matrix_2fv(
&self,
location: Option<&WebGLUniformLocation>,
transpose: bool,
val: Float32ArrayOrUnrestrictedFloatSequence,
src_offset: u32,
src_length: u32,
) {
self.with_location(location, |location| {
match location.type_() {
constants::FLOAT_MAT2 => {},
_ => return Err(InvalidOperation),
}
let val =
self.uniform_matrix_section(val, src_offset, src_length, transpose, 4, location)?;
self.send_command(WebGLCommand::UniformMatrix2fv(location.id(), val));
Ok(())
});
}
pub fn uniform_matrix_3fv(
&self,
location: Option<&WebGLUniformLocation>,
transpose: bool,
val: Float32ArrayOrUnrestrictedFloatSequence,
src_offset: u32,
src_length: u32,
) {
self.with_location(location, |location| {
match location.type_() {
constants::FLOAT_MAT3 => {},
_ => return Err(InvalidOperation),
}
let val =
self.uniform_matrix_section(val, src_offset, src_length, transpose, 9, location)?;
self.send_command(WebGLCommand::UniformMatrix3fv(location.id(), val));
Ok(())
});
}
pub fn uniform_matrix_4fv(
&self,
location: Option<&WebGLUniformLocation>,
transpose: bool,
val: Float32ArrayOrUnrestrictedFloatSequence,
src_offset: u32,
src_length: u32,
) {
self.with_location(location, |location| {
match location.type_() {
constants::FLOAT_MAT4 => {},
_ => return Err(InvalidOperation),
}
let val =
self.uniform_matrix_section(val, src_offset, src_length, transpose, 16, location)?;
self.send_command(WebGLCommand::UniformMatrix4fv(location.id(), val));
Ok(())
});
}
}
#[cfg(not(feature = "webgl_backtrace"))]
@ -2110,14 +2444,14 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
fn BufferData(&self, target: u32, data: Option<ArrayBufferViewOrArrayBuffer>, usage: u32) {
fn BufferData_(&self, target: u32, data: Option<ArrayBufferViewOrArrayBuffer>, usage: u32) {
let usage = handle_potential_webgl_error!(self, self.buffer_usage(usage), return);
let bound_buffer = handle_potential_webgl_error!(self, self.bound_buffer(target), return);
self.buffer_data(target, data, usage, bound_buffer)
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
fn BufferData_(&self, target: u32, size: i64, usage: u32) {
fn BufferData(&self, target: u32, size: i64, usage: u32) {
let usage = handle_potential_webgl_error!(self, self.buffer_usage(usage), return);
let bound_buffer = handle_potential_webgl_error!(self, self.bound_buffer(target), return);
self.buffer_data_(target, size, usage, bound_buffer)
@ -2142,55 +2476,8 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
border: i32,
data: CustomAutoRooterGuard<ArrayBufferView>,
) {
let validator = CompressedTexImage2DValidator::new(
self,
target,
level,
width,
height,
border,
internal_format,
data.len(),
);
let CommonCompressedTexImage2DValidatorResult {
texture,
target,
level,
width,
height,
compression,
} = match validator.validate() {
Ok(result) => result,
Err(_) => return,
};
let buff = IpcSharedMemory::from_bytes(unsafe { data.as_slice() });
let pixels = TexPixels::from_array(buff, Size2D::new(width, height));
handle_potential_webgl_error!(
self,
texture.initialize(
target,
pixels.size.width,
pixels.size.height,
1,
compression.format,
level,
Some(TexDataType::UnsignedByte)
)
);
self.send_command(WebGLCommand::CompressedTexImage2D {
target: target.as_gl_constant(),
level,
internal_format,
size: Size2D::new(width, height),
data: pixels.data.into(),
});
if let Some(fb) = self.bound_draw_framebuffer.get() {
fb.invalidate_texture(&*texture);
}
let data = unsafe { data.as_slice() };
self.compressed_tex_image_2d(target, level, internal_format, width, height, border, data)
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
@ -2206,41 +2493,10 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
format: u32,
data: CustomAutoRooterGuard<ArrayBufferView>,
) {
let validator = CompressedTexSubImage2DValidator::new(
self,
target,
level,
xoffset,
yoffset,
width,
height,
format,
data.len(),
);
let CommonCompressedTexImage2DValidatorResult {
texture: _,
target,
level,
width,
height,
..
} = match validator.validate() {
Ok(result) => result,
Err(_) => return,
};
let buff = IpcSharedMemory::from_bytes(unsafe { data.as_slice() });
let pixels = TexPixels::from_array(buff, Size2D::new(width, height));
self.send_command(WebGLCommand::CompressedTexSubImage2D {
target: target.as_gl_constant(),
level: level as i32,
xoffset,
yoffset,
size: Size2D::new(width, height),
format,
data: pixels.data.into(),
});
let data = unsafe { data.as_slice() };
self.compressed_tex_sub_image_2d(
target, level, xoffset, yoffset, width, height, format, data,
)
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.8
@ -3548,40 +3804,8 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn Uniform1iv(
&self,
location: Option<&WebGLUniformLocation>,
val: Int32ArrayOrLongSequence,
src_offset: u32,
src_length: u32,
) {
self.with_location(location, |location| {
match location.type_() {
constants::BOOL |
constants::INT |
constants::SAMPLER_2D |
constants::SAMPLER_CUBE => {},
_ => return Err(InvalidOperation),
}
let val = self.uniform_vec_section_int(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 < 0 || v as u32 >= self.limits.max_combined_texture_image_units {
return Err(InvalidValue);
}
}
},
_ => {},
}
self.send_command(WebGLCommand::Uniform1iv(location.id(), val));
Ok(())
});
fn Uniform1iv(&self, location: Option<&WebGLUniformLocation>, val: Int32ArrayOrLongSequence) {
self.uniform1iv(location, val, 0, 0)
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
@ -3589,18 +3813,8 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
&self,
location: Option<&WebGLUniformLocation>,
val: Float32ArrayOrUnrestrictedFloatSequence,
src_offset: u32,
src_length: u32,
) {
self.with_location(location, |location| {
match location.type_() {
constants::BOOL | constants::FLOAT => {},
_ => return Err(InvalidOperation),
}
let val = self.uniform_vec_section_float(val, src_offset, src_length, 1, location)?;
self.send_command(WebGLCommand::Uniform1fv(location.id(), val));
Ok(())
});
self.uniform1fv(location, val, 0, 0)
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
@ -3620,18 +3834,8 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
&self,
location: Option<&WebGLUniformLocation>,
val: Float32ArrayOrUnrestrictedFloatSequence,
src_offset: u32,
src_length: u32,
) {
self.with_location(location, |location| {
match location.type_() {
constants::BOOL_VEC2 | constants::FLOAT_VEC2 => {},
_ => return Err(InvalidOperation),
}
let val = self.uniform_vec_section_float(val, src_offset, src_length, 2, location)?;
self.send_command(WebGLCommand::Uniform2fv(location.id(), val));
Ok(())
});
self.uniform2fv(location, val, 0, 0)
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
@ -3647,22 +3851,8 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn Uniform2iv(
&self,
location: Option<&WebGLUniformLocation>,
val: Int32ArrayOrLongSequence,
src_offset: u32,
src_length: u32,
) {
self.with_location(location, |location| {
match location.type_() {
constants::BOOL_VEC2 | constants::INT_VEC2 => {},
_ => return Err(InvalidOperation),
}
let val = self.uniform_vec_section_int(val, src_offset, src_length, 2, location)?;
self.send_command(WebGLCommand::Uniform2iv(location.id(), val));
Ok(())
});
fn Uniform2iv(&self, location: Option<&WebGLUniformLocation>, val: Int32ArrayOrLongSequence) {
self.uniform2iv(location, val, 0, 0)
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
@ -3682,18 +3872,8 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
&self,
location: Option<&WebGLUniformLocation>,
val: Float32ArrayOrUnrestrictedFloatSequence,
src_offset: u32,
src_length: u32,
) {
self.with_location(location, |location| {
match location.type_() {
constants::BOOL_VEC3 | constants::FLOAT_VEC3 => {},
_ => return Err(InvalidOperation),
}
let val = self.uniform_vec_section_float(val, src_offset, src_length, 3, location)?;
self.send_command(WebGLCommand::Uniform3fv(location.id(), val));
Ok(())
});
self.uniform3fv(location, val, 0, 0)
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
@ -3709,22 +3889,8 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn Uniform3iv(
&self,
location: Option<&WebGLUniformLocation>,
val: Int32ArrayOrLongSequence,
src_offset: u32,
src_length: u32,
) {
self.with_location(location, |location| {
match location.type_() {
constants::BOOL_VEC3 | constants::INT_VEC3 => {},
_ => return Err(InvalidOperation),
}
let val = self.uniform_vec_section_int(val, src_offset, src_length, 3, location)?;
self.send_command(WebGLCommand::Uniform3iv(location.id(), val));
Ok(())
});
fn Uniform3iv(&self, location: Option<&WebGLUniformLocation>, val: Int32ArrayOrLongSequence) {
self.uniform3iv(location, val, 0, 0)
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
@ -3740,22 +3906,8 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
fn Uniform4iv(
&self,
location: Option<&WebGLUniformLocation>,
val: Int32ArrayOrLongSequence,
src_offset: u32,
src_length: u32,
) {
self.with_location(location, |location| {
match location.type_() {
constants::BOOL_VEC4 | constants::INT_VEC4 => {},
_ => return Err(InvalidOperation),
}
let val = self.uniform_vec_section_int(val, src_offset, src_length, 4, location)?;
self.send_command(WebGLCommand::Uniform4iv(location.id(), val));
Ok(())
});
fn Uniform4iv(&self, location: Option<&WebGLUniformLocation>, val: Int32ArrayOrLongSequence) {
self.uniform4iv(location, val, 0, 0)
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
@ -3775,18 +3927,8 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
&self,
location: Option<&WebGLUniformLocation>,
val: Float32ArrayOrUnrestrictedFloatSequence,
src_offset: u32,
src_length: u32,
) {
self.with_location(location, |location| {
match location.type_() {
constants::BOOL_VEC4 | constants::FLOAT_VEC4 => {},
_ => return Err(InvalidOperation),
}
let val = self.uniform_vec_section_float(val, src_offset, src_length, 4, location)?;
self.send_command(WebGLCommand::Uniform4fv(location.id(), val));
Ok(())
});
self.uniform4fv(location, val, 0, 0)
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
@ -3795,19 +3937,8 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
location: Option<&WebGLUniformLocation>,
transpose: bool,
val: Float32ArrayOrUnrestrictedFloatSequence,
src_offset: u32,
src_length: u32,
) {
self.with_location(location, |location| {
match location.type_() {
constants::FLOAT_MAT2 => {},
_ => return Err(InvalidOperation),
}
let val =
self.uniform_matrix_section(val, src_offset, src_length, transpose, 4, location)?;
self.send_command(WebGLCommand::UniformMatrix2fv(location.id(), val));
Ok(())
});
self.uniform_matrix_2fv(location, transpose, val, 0, 0)
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
@ -3816,19 +3947,8 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
location: Option<&WebGLUniformLocation>,
transpose: bool,
val: Float32ArrayOrUnrestrictedFloatSequence,
src_offset: u32,
src_length: u32,
) {
self.with_location(location, |location| {
match location.type_() {
constants::FLOAT_MAT3 => {},
_ => return Err(InvalidOperation),
}
let val =
self.uniform_matrix_section(val, src_offset, src_length, transpose, 9, location)?;
self.send_command(WebGLCommand::UniformMatrix3fv(location.id(), val));
Ok(())
});
self.uniform_matrix_3fv(location, transpose, val, 0, 0)
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
@ -3837,19 +3957,8 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
location: Option<&WebGLUniformLocation>,
transpose: bool,
val: Float32ArrayOrUnrestrictedFloatSequence,
src_offset: u32,
src_length: u32,
) {
self.with_location(location, |location| {
match location.type_() {
constants::FLOAT_MAT4 => {},
_ => return Err(InvalidOperation),
}
let val =
self.uniform_matrix_section(val, src_offset, src_length, transpose, 16, location)?;
self.send_command(WebGLCommand::UniformMatrix4fv(location.id(), val));
Ok(())
});
self.uniform_matrix_4fv(location, transpose, val, 0, 0)
}
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.10
@ -4055,7 +4164,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
&self,
target: u32,
level: i32,
internal_format: u32,
internal_format: i32,
width: i32,
height: i32,
border: i32,
@ -4071,7 +4180,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
self,
target,
level,
internal_format,
internal_format as u32,
width,
height,
border,
@ -4153,7 +4262,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
&self,
target: u32,
level: i32,
internal_format: u32,
internal_format: i32,
format: u32,
data_type: u32,
source: TexImageSource,
@ -4171,7 +4280,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
self,
target,
level,
internal_format,
internal_format as u32,
pixels.size.width as i32,
pixels.size.height as i32,
0,

View file

@ -286,17 +286,6 @@ interface mixin WebGL2RenderingContextBase
const GLenum MAX_CLIENT_WAIT_TIMEOUT_WEBGL = 0x9247;
/* Buffer objects */
// WebGL1:
// BUG: https://github.com/KhronosGroup/WebGL/issues/2216
void bufferData(GLenum target, /*[AllowShared]*/ BufferSource? data, GLenum usage);
void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
void bufferSubData(GLenum target, GLintptr dstByteOffset, /*[AllowShared]*/ BufferSource srcData);
// WebGL2:
void bufferData(GLenum target, /*[AllowShared]*/ ArrayBufferView srcData, GLenum usage, GLuint srcOffset,
optional GLuint length = 0);
void bufferSubData(GLenum target, GLintptr dstByteOffset, /*[AllowShared]*/ ArrayBufferView srcData,
GLuint srcOffset, optional GLuint length = 0);
void copyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset,
GLintptr writeOffset, GLsizeiptr size);
// MapBufferRange, in particular its read-only and write-only modes,
@ -326,96 +315,51 @@ interface mixin WebGL2RenderingContextBase
// void texStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width,
// GLsizei height, GLsizei depth);
// WebGL1 legacy entrypoints:
// BUG: https://github.com/KhronosGroup/WebGL/issues/2216
[Throws]
void texImage2D(GLenum target, GLint level, GLenum internalformat,
GLsizei width, GLsizei height, GLint border, GLenum format,
GLenum type, /*[AllowShared]*/ ArrayBufferView? pixels);
[Throws]
void texImage2D(GLenum target, GLint level, GLenum internalformat,
GLenum format, GLenum type, TexImageSource source); // May throw DOMException
//[Throws]
//void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
// GLsizei depth, GLint border, GLenum format, GLenum type, GLintptr pboOffset);
//[Throws]
//void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
// GLsizei depth, GLint border, GLenum format, GLenum type,
// TexImageSource source); // May throw DOMException
//[Throws]
//void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
// GLsizei depth, GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView? srcData);
//[Throws]
//void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
// GLsizei depth, GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView srcData,
// GLuint srcOffset);
// BUG: https://github.com/KhronosGroup/WebGL/issues/2216
[Throws]
void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type, /*[AllowShared]*/ ArrayBufferView? pixels);
[Throws]
void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLenum format, GLenum type, TexImageSource source); // May throw DOMException
//[Throws]
//void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
// GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
// GLintptr pboOffset);
//[Throws]
//void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
// GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
// TexImageSource source); // May throw DOMException
//[Throws]
//void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
// GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
// [AllowShared] ArrayBufferView? srcData, optional GLuint srcOffset = 0);
// WebGL2 entrypoints:
// void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
// GLint border, GLenum format, GLenum type, GLintptr pboOffset);
// void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
// GLint border, GLenum format, GLenum type,
// TexImageSource source); // May throw DOMException
// void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
// GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView srcData,
// GLuint srcOffset);
//void copyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
// GLint x, GLint y, GLsizei width, GLsizei height);
// void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
// GLsizei depth, GLint border, GLenum format, GLenum type, GLintptr pboOffset);
// void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
// GLsizei depth, GLint border, GLenum format, GLenum type,
// TexImageSource source); // May throw DOMException
// void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
// GLsizei depth, GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView? srcData);
// void texImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
// GLsizei depth, GLint border, GLenum format, GLenum type, [AllowShared] ArrayBufferView srcData,
// GLuint srcOffset);
//void compressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width,
// GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLintptr offset);
//void compressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width,
// GLsizei height, GLsizei depth, GLint border, [AllowShared] ArrayBufferView srcData,
// optional GLuint srcOffset = 0, optional GLuint srcLengthOverride = 0);
// void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
// GLsizei height, GLenum format, GLenum type, GLintptr pboOffset);
// void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
// GLsizei height, GLenum format, GLenum type,
// TexImageSource source); // May throw DOMException
// void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
// GLsizei height, GLenum format, GLenum type, [AllowShared] ArrayBufferView srcData,
// GLuint srcOffset);
// void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
// GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
// GLintptr pboOffset);
// void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
// GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
// TexImageSource source); // May throw DOMException
// void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
// GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type,
// [AllowShared] ArrayBufferView? srcData, optional GLuint srcOffset = 0);
// void copyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
// GLint x, GLint y, GLsizei width, GLsizei height);
// void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width,
// GLsizei height, GLint border, GLsizei imageSize, GLintptr offset);
// void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width,
// GLsizei height, GLint border, [AllowShared] ArrayBufferView srcData,
// optional GLuint srcOffset = 0, optional GLuint srcLengthOverride = 0);
// void compressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width,
// GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLintptr offset);
// void compressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width,
// GLsizei height, GLsizei depth, GLint border, [AllowShared] ArrayBufferView srcData,
// optional GLuint srcOffset = 0, optional GLuint srcLengthOverride = 0);
// void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
// GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLintptr offset);
// void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
// GLsizei width, GLsizei height, GLenum format,
// [AllowShared] ArrayBufferView srcData,
// optional GLuint srcOffset = 0,
// optional GLuint srcLengthOverride = 0);
// void compressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
// GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
// GLenum format, GLsizei imageSize, GLintptr offset);
// void compressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
// GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
// GLenum format, [AllowShared] ArrayBufferView srcData,
// optional GLuint srcOffset = 0,
// optional GLuint srcLengthOverride = 0);
//void compressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
// GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
// GLenum format, GLsizei imageSize, GLintptr offset);
//void compressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
// GLint zoffset, GLsizei width, GLsizei height, GLsizei depth,
// GLenum format, [AllowShared] ArrayBufferView srcData,
// optional GLuint srcOffset = 0,
// optional GLuint srcLengthOverride = 0);
/* Programs and shaders */
[WebGLHandlesContextLoss] GLint getFragDataLocation(WebGLProgram program, DOMString name);
@ -463,17 +407,6 @@ interface mixin WebGL2RenderingContextBase
void drawElementsInstanced(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei instanceCount);
void drawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLintptr offset);
/* Reading back pixels */
// WebGL1:
// BUG: https://github.com/KhronosGroup/WebGL/issues/2216
void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
/*[AllowShared]*/ ArrayBufferView? dstData);
// WebGL2:
void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
GLintptr offset);
void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
/*[AllowShared]*/ ArrayBufferView dstData, GLuint dstOffset);
/* Multiple Render Targets */
void drawBuffers(sequence<GLenum> buffers);
@ -542,9 +475,114 @@ interface mixin WebGL2RenderingContextBase
void bindVertexArray(WebGLVertexArrayObject? array);
};
interface mixin WebGL2RenderingContextOverloads
{
// WebGL1:
void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
void bufferData(GLenum target, /*[AllowShared]*/ BufferSource? srcData, GLenum usage);
void bufferSubData(GLenum target, GLintptr dstByteOffset, /*[AllowShared]*/ BufferSource srcData);
// WebGL2:
void bufferData(GLenum target, /*[AllowShared]*/ ArrayBufferView srcData, GLenum usage, GLuint srcOffset,
optional GLuint length = 0);
void bufferSubData(GLenum target, GLintptr dstByteOffset, /*[AllowShared]*/ ArrayBufferView srcData,
GLuint srcOffset, optional GLuint length = 0);
// WebGL1 legacy entrypoints:
[Throws]
void texImage2D(GLenum target, GLint level, GLint internalformat,
GLsizei width, GLsizei height, GLint border, GLenum format,
GLenum type, /*[AllowShared]*/ ArrayBufferView? pixels);
[Throws]
void texImage2D(GLenum target, GLint level, GLint internalformat,
GLenum format, GLenum type, TexImageSource source); // May throw DOMException
[Throws]
void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type, /*[AllowShared]*/ ArrayBufferView? pixels);
[Throws]
void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLenum format, GLenum type, TexImageSource source); // May throw DOMException
// WebGL2 entrypoints:
//[Throws]
//void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
// GLint border, GLenum format, GLenum type, GLintptr pboOffset);
//[Throws]
//void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
// GLint border, GLenum format, GLenum type,
// TexImageSource source); // May throw DOMException
//[Throws]
//void texImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
// GLint border, GLenum format, GLenum type, /*[AllowShared]*/ ArrayBufferView srcData,
// GLuint srcOffset);
//[Throws]
//void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
// GLsizei height, GLenum format, GLenum type, GLintptr pboOffset);
//[Throws]
//void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
// GLsizei height, GLenum format, GLenum type,
// TexImageSource source); // May throw DOMException
//[Throws]
//void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width,
// GLsizei height, GLenum format, GLenum type, /*[AllowShared]*/ ArrayBufferView srcData,
// GLuint srcOffset);
//void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width,
// GLsizei height, GLint border, GLsizei imageSize, GLintptr offset);
void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width,
GLsizei height, GLint border, /*[AllowShared]*/ ArrayBufferView srcData,
optional GLuint srcOffset = 0, optional GLuint srcLengthOverride = 0);
//void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
// GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, GLintptr offset);
void compressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height, GLenum format,
/*[AllowShared]*/ ArrayBufferView srcData,
optional GLuint srcOffset = 0,
optional GLuint srcLengthOverride = 0);
void uniform1fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform2fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform3fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform4fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform1iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform2iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform3iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform4iv(WebGLUniformLocation? location, Int32List 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);
void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
/* Reading back pixels */
// WebGL1:
void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
/*[AllowShared]*/ ArrayBufferView? dstData);
// WebGL2:
void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
GLintptr offset);
void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type,
/*[AllowShared]*/ ArrayBufferView dstData, GLuint dstOffset);
};
[Exposed=Window, Func="WebGL2RenderingContext::is_webgl2_enabled"]
interface WebGL2RenderingContext
{
};
WebGL2RenderingContext includes WebGLRenderingContextBase;
WebGL2RenderingContext includes WebGL2RenderingContextBase;
WebGL2RenderingContext includes WebGL2RenderingContextOverloads;

View file

@ -421,8 +421,6 @@ interface mixin WebGLRenderingContextBase
const GLenum RGB5_A1 = 0x8057;
const GLenum RGB565 = 0x8D62;
const GLenum DEPTH_COMPONENT16 = 0x81A5;
// https://github.com/KhronosGroup/WebGL/pull/2371
// const GLenum STENCIL_INDEX = 0x1901;
const GLenum STENCIL_INDEX8 = 0x8D48;
const GLenum DEPTH_STENCIL = 0x84F9;
@ -492,11 +490,6 @@ interface mixin WebGLRenderingContextBase
void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB,
GLenum srcAlpha, GLenum dstAlpha);
// BUG: https://github.com/KhronosGroup/WebGL/issues/2216
// void bufferData(GLenum target, object? data, GLenum usage);
// void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
// void bufferSubData(GLenum target, GLintptr offset, /*[AllowShared]*/ BufferSource data);
[WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target);
void clear(GLbitfield mask);
void clearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
@ -505,14 +498,6 @@ interface mixin WebGLRenderingContextBase
void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
void compileShader(WebGLShader shader);
void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat,
GLsizei width, GLsizei height, GLint border,
/*[AllowShared]*/ ArrayBufferView data);
void compressedTexSubImage2D(GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height, GLenum format,
/*[AllowShared]*/ ArrayBufferView data);
void copyTexImage2D(GLenum target, GLint level, GLenum internalformat,
GLint x, GLint y, GLsizei width, GLsizei height,
GLint border);
@ -602,10 +587,6 @@ interface mixin WebGLRenderingContextBase
void pixelStorei(GLenum pname, GLint param);
void polygonOffset(GLfloat factor, GLfloat units);
// BUG: https://github.com/KhronosGroup/WebGL/issues/2216
// void readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
// GLenum format, GLenum type, /*[AllowShared]*/ ArrayBufferView? pixels);
void renderbufferStorage(GLenum target, GLenum internalformat,
GLsizei width, GLsizei height);
void sampleCoverage(GLclampf value, GLboolean invert);
@ -620,26 +601,9 @@ interface mixin WebGLRenderingContextBase
void stencilOp(GLenum fail, GLenum zfail, GLenum zpass);
void stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
// BUG: https://github.com/KhronosGroup/WebGL/issues/2216
// void texImage2D(GLenum target, GLint level, GLenum internalformat,
// GLsizei width, GLsizei height, GLint border, GLenum format,
// GLenum type, /*[AllowShared]*/ ArrayBufferView? pixels);
// void texImage2D(GLenum target, GLint level, GLenum internalformat,
// GLenum format, GLenum type, TexImageSource source); // May throw DOMException
[Throws, Pref="dom.webgl.dom_to_texture.enabled"]
void texImageDOM(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
GLenum format, GLenum type, HTMLIFrameElement source); // May throw DOMException
void texParameterf(GLenum target, GLenum pname, GLfloat param);
void texParameteri(GLenum target, GLenum pname, GLint param);
// BUG: https://github.com/KhronosGroup/WebGL/issues/2216
// void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
// GLsizei width, GLsizei height,
// GLenum format, GLenum type, /*[AllowShared]*/ ArrayBufferView? pixels);
// void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
// GLenum format, GLenum type, TexImageSource source); // May throw DOMException
void uniform1f(WebGLUniformLocation? location, GLfloat x);
void uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y);
void uniform3f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z);
@ -650,31 +614,6 @@ interface mixin WebGLRenderingContextBase
void uniform3i(WebGLUniformLocation? location, GLint x, GLint y, GLint z);
void uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w);
void uniform1fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform2fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform3fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform4fv(WebGLUniformLocation? location, Float32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform1iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform2iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform3iv(WebGLUniformLocation? location, Int32List data, optional GLuint srcOffset = 0,
optional GLuint srcLength = 0);
void uniform4iv(WebGLUniformLocation? location, Int32List 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);
void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data,
optional GLuint srcOffset = 0, optional GLuint srcLength = 0);
void useProgram(WebGLProgram? program);
void validateProgram(WebGLProgram program);
@ -694,34 +633,64 @@ interface mixin WebGLRenderingContextBase
void viewport(GLint x, GLint y, GLsizei width, GLsizei height);
};
[Exposed=Window]
interface WebGLRenderingContext
interface mixin WebGLRenderingContextOverloads
{
// BUG: https://github.com/KhronosGroup/WebGL/issues/2216
void bufferData(GLenum target, /*[AllowShared]*/ BufferSource? data, GLenum usage);
void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
void bufferData(GLenum target, /*[AllowShared]*/ BufferSource? data, GLenum usage);
void bufferSubData(GLenum target, GLintptr offset, /*[AllowShared]*/ BufferSource data);
// FIXME: https://github.com/servo/servo/issues/20516
void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat,
GLsizei width, GLsizei height, GLint border,
/*[AllowShared]*/ ArrayBufferView data);
void compressedTexSubImage2D(GLenum target, GLint level,
GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height, GLenum format,
/*[AllowShared]*/ ArrayBufferView data);
void readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type, /*[AllowShared]*/ ArrayBufferView? pixels);
[Throws]
void texImage2D(GLenum target, GLint level, GLenum internalformat,
void texImage2D(GLenum target, GLint level, GLint internalformat,
GLsizei width, GLsizei height, GLint border, GLenum format,
GLenum type, /*[AllowShared]*/ ArrayBufferView? pixels);
[Throws]
void texImage2D(GLenum target, GLint level, GLenum internalformat,
void texImage2D(GLenum target, GLint level, GLint internalformat,
GLenum format, GLenum type, TexImageSource source); // May throw DOMException
// FIXME: https://github.com/servo/servo/issues/20516
[Throws]
void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLsizei width, GLsizei height,
GLenum format, GLenum type, /*[AllowShared]*/ ArrayBufferView? pixels);
GLsizei width, GLsizei height,
GLenum format, GLenum type, /*[AllowShared]*/ ArrayBufferView? pixels);
[Throws]
void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
GLenum format, GLenum type, TexImageSource source); // May throw DOMException
void readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type, /*[AllowShared]*/ ArrayBufferView? pixels);
void uniform1fv(WebGLUniformLocation? location, Float32List v);
void uniform2fv(WebGLUniformLocation? location, Float32List v);
void uniform3fv(WebGLUniformLocation? location, Float32List v);
void uniform4fv(WebGLUniformLocation? location, Float32List v);
void uniform1iv(WebGLUniformLocation? location, Int32List v);
void uniform2iv(WebGLUniformLocation? location, Int32List v);
void uniform3iv(WebGLUniformLocation? location, Int32List v);
void uniform4iv(WebGLUniformLocation? location, Int32List v);
void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value);
void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value);
void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List value);
};
interface mixin WebGLRenderingContextExtensions {
[Throws, Pref="dom.webgl.dom_to_texture.enabled"]
void texImageDOM(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
GLenum format, GLenum type, HTMLIFrameElement source); // May throw DOMException
};
[Exposed=(Window)]
interface WebGLRenderingContext
{
};
WebGLRenderingContext includes WebGLRenderingContextBase;
WebGLRenderingContext includes WebGLRenderingContextOverloads;
WebGLRenderingContext includes WebGLRenderingContextExtensions;