#![allow(non_camel_case_types,non_upper_case_globals,unused_imports,unused_variables,unused_assignments,unused_mut,clippy::approx_constant,clippy::let_unit_value,clippy::needless_return,clippy::too_many_arguments,clippy::unnecessary_cast,clippy::upper_case_acronyms)]
use crate::dom::bindings::codegen::Bindings::EventTargetBinding::EventTarget_Binding;
use crate::dom::bindings::import::base::*;
use crate::dom::bindings::record::Record;
use crate::dom::types::EventTarget;
use crate::dom::types::GPUBindGroupLayout;
use crate::dom::types::GPUBuffer;
use crate::dom::types::GPUDevice;
use crate::dom::types::GPUOutOfMemoryError;
use crate::dom::types::GPUQuerySet;
use crate::dom::types::GPUSampler;
use crate::dom::types::GPUShaderModule;
use crate::dom::types::GPUTexture;
use crate::dom::types::GPUTextureView;
use crate::dom::types::GPUValidationError;
#[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUPowerPreference {
Low_power,
High_performance
}
pub mod GPUPowerPreferenceValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUPowerPreference)] = &[
("low-power", super::GPUPowerPreference::Low_power),
("high-performance", super::GPUPowerPreference::High_performance),
];
impl super::GPUPowerPreference {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUPowerPreference {
fn default() -> super::GPUPowerPreference {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUPowerPreference {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUPowerPreference {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUPowerPreference>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUPowerPreference'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUFeatureName {
Depth_clip_control,
Depth24unorm_stencil8,
Depth32float_stencil8,
Pipeline_statistics_query,
Texture_compression_bc,
Texture_compression_etc2,
Texture_compression_astc,
Timestamp_query,
Indirect_first_instance
}
pub mod GPUFeatureNameValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUFeatureName)] = &[
("depth-clip-control", super::GPUFeatureName::Depth_clip_control),
("depth24unorm-stencil8", super::GPUFeatureName::Depth24unorm_stencil8),
("depth32float-stencil8", super::GPUFeatureName::Depth32float_stencil8),
("pipeline-statistics-query", super::GPUFeatureName::Pipeline_statistics_query),
("texture-compression-bc", super::GPUFeatureName::Texture_compression_bc),
("texture-compression-etc2", super::GPUFeatureName::Texture_compression_etc2),
("texture-compression-astc", super::GPUFeatureName::Texture_compression_astc),
("timestamp-query", super::GPUFeatureName::Timestamp_query),
("indirect-first-instance", super::GPUFeatureName::Indirect_first_instance),
];
impl super::GPUFeatureName {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUFeatureName {
fn default() -> super::GPUFeatureName {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUFeatureName {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUFeatureName {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUFeatureName>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUFeatureName'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUTextureDimension {
_1d,
_2d,
_3d
}
pub mod GPUTextureDimensionValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUTextureDimension)] = &[
("1d", super::GPUTextureDimension::_1d),
("2d", super::GPUTextureDimension::_2d),
("3d", super::GPUTextureDimension::_3d),
];
impl super::GPUTextureDimension {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUTextureDimension {
fn default() -> super::GPUTextureDimension {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUTextureDimension {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUTextureDimension {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUTextureDimension>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUTextureDimension'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUTextureViewDimension {
_1d,
_2d,
_2d_array,
Cube,
Cube_array,
_3d
}
pub mod GPUTextureViewDimensionValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUTextureViewDimension)] = &[
("1d", super::GPUTextureViewDimension::_1d),
("2d", super::GPUTextureViewDimension::_2d),
("2d-array", super::GPUTextureViewDimension::_2d_array),
("cube", super::GPUTextureViewDimension::Cube),
("cube-array", super::GPUTextureViewDimension::Cube_array),
("3d", super::GPUTextureViewDimension::_3d),
];
impl super::GPUTextureViewDimension {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUTextureViewDimension {
fn default() -> super::GPUTextureViewDimension {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUTextureViewDimension {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUTextureViewDimension {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUTextureViewDimension>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUTextureViewDimension'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUTextureAspect {
All,
Stencil_only,
Depth_only
}
pub mod GPUTextureAspectValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUTextureAspect)] = &[
("all", super::GPUTextureAspect::All),
("stencil-only", super::GPUTextureAspect::Stencil_only),
("depth-only", super::GPUTextureAspect::Depth_only),
];
impl super::GPUTextureAspect {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUTextureAspect {
fn default() -> super::GPUTextureAspect {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUTextureAspect {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUTextureAspect {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUTextureAspect>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUTextureAspect'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUTextureFormat {
R8unorm,
R8snorm,
R8uint,
R8sint,
R16uint,
R16sint,
R16float,
Rg8unorm,
Rg8snorm,
Rg8uint,
Rg8sint,
R32uint,
R32sint,
R32float,
Rg16uint,
Rg16sint,
Rg16float,
Rgba8unorm,
Rgba8unorm_srgb,
Rgba8snorm,
Rgba8uint,
Rgba8sint,
Bgra8unorm,
Bgra8unorm_srgb,
Rgb10a2unorm,
Rg11b10float,
Rg32uint,
Rg32sint,
Rg32float,
Rgba16uint,
Rgba16sint,
Rgba16float,
Rgba32uint,
Rgba32sint,
Rgba32float,
Depth24plus,
Depth24plus_stencil8,
Depth32float,
Bc1_rgba_unorm,
Bc1_rgba_unorm_srgb,
Bc2_rgba_unorm,
Bc2_rgba_unorm_srgb,
Bc3_rgba_unorm,
Bc3_rgba_unorm_srgb,
Bc4_r_unorm,
Bc4_r_snorm,
Bc5_rg_unorm,
Bc5_rg_snorm,
Bc6h_rgb_ufloat,
Bc6h_rgb_float,
Bc7_rgba_unorm,
Bc7_rgba_unorm_srgb
}
pub mod GPUTextureFormatValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUTextureFormat)] = &[
("r8unorm", super::GPUTextureFormat::R8unorm),
("r8snorm", super::GPUTextureFormat::R8snorm),
("r8uint", super::GPUTextureFormat::R8uint),
("r8sint", super::GPUTextureFormat::R8sint),
("r16uint", super::GPUTextureFormat::R16uint),
("r16sint", super::GPUTextureFormat::R16sint),
("r16float", super::GPUTextureFormat::R16float),
("rg8unorm", super::GPUTextureFormat::Rg8unorm),
("rg8snorm", super::GPUTextureFormat::Rg8snorm),
("rg8uint", super::GPUTextureFormat::Rg8uint),
("rg8sint", super::GPUTextureFormat::Rg8sint),
("r32uint", super::GPUTextureFormat::R32uint),
("r32sint", super::GPUTextureFormat::R32sint),
("r32float", super::GPUTextureFormat::R32float),
("rg16uint", super::GPUTextureFormat::Rg16uint),
("rg16sint", super::GPUTextureFormat::Rg16sint),
("rg16float", super::GPUTextureFormat::Rg16float),
("rgba8unorm", super::GPUTextureFormat::Rgba8unorm),
("rgba8unorm-srgb", super::GPUTextureFormat::Rgba8unorm_srgb),
("rgba8snorm", super::GPUTextureFormat::Rgba8snorm),
("rgba8uint", super::GPUTextureFormat::Rgba8uint),
("rgba8sint", super::GPUTextureFormat::Rgba8sint),
("bgra8unorm", super::GPUTextureFormat::Bgra8unorm),
("bgra8unorm-srgb", super::GPUTextureFormat::Bgra8unorm_srgb),
("rgb10a2unorm", super::GPUTextureFormat::Rgb10a2unorm),
("rg11b10float", super::GPUTextureFormat::Rg11b10float),
("rg32uint", super::GPUTextureFormat::Rg32uint),
("rg32sint", super::GPUTextureFormat::Rg32sint),
("rg32float", super::GPUTextureFormat::Rg32float),
("rgba16uint", super::GPUTextureFormat::Rgba16uint),
("rgba16sint", super::GPUTextureFormat::Rgba16sint),
("rgba16float", super::GPUTextureFormat::Rgba16float),
("rgba32uint", super::GPUTextureFormat::Rgba32uint),
("rgba32sint", super::GPUTextureFormat::Rgba32sint),
("rgba32float", super::GPUTextureFormat::Rgba32float),
("depth24plus", super::GPUTextureFormat::Depth24plus),
("depth24plus-stencil8", super::GPUTextureFormat::Depth24plus_stencil8),
("depth32float", super::GPUTextureFormat::Depth32float),
("bc1-rgba-unorm", super::GPUTextureFormat::Bc1_rgba_unorm),
("bc1-rgba-unorm-srgb", super::GPUTextureFormat::Bc1_rgba_unorm_srgb),
("bc2-rgba-unorm", super::GPUTextureFormat::Bc2_rgba_unorm),
("bc2-rgba-unorm-srgb", super::GPUTextureFormat::Bc2_rgba_unorm_srgb),
("bc3-rgba-unorm", super::GPUTextureFormat::Bc3_rgba_unorm),
("bc3-rgba-unorm-srgb", super::GPUTextureFormat::Bc3_rgba_unorm_srgb),
("bc4-r-unorm", super::GPUTextureFormat::Bc4_r_unorm),
("bc4-r-snorm", super::GPUTextureFormat::Bc4_r_snorm),
("bc5-rg-unorm", super::GPUTextureFormat::Bc5_rg_unorm),
("bc5-rg-snorm", super::GPUTextureFormat::Bc5_rg_snorm),
("bc6h-rgb-ufloat", super::GPUTextureFormat::Bc6h_rgb_ufloat),
("bc6h-rgb-float", super::GPUTextureFormat::Bc6h_rgb_float),
("bc7-rgba-unorm", super::GPUTextureFormat::Bc7_rgba_unorm),
("bc7-rgba-unorm-srgb", super::GPUTextureFormat::Bc7_rgba_unorm_srgb),
];
impl super::GPUTextureFormat {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUTextureFormat {
fn default() -> super::GPUTextureFormat {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUTextureFormat {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUTextureFormat {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUTextureFormat>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUTextureFormat'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUAddressMode {
Clamp_to_edge,
Repeat,
Mirror_repeat
}
pub mod GPUAddressModeValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUAddressMode)] = &[
("clamp-to-edge", super::GPUAddressMode::Clamp_to_edge),
("repeat", super::GPUAddressMode::Repeat),
("mirror-repeat", super::GPUAddressMode::Mirror_repeat),
];
impl super::GPUAddressMode {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUAddressMode {
fn default() -> super::GPUAddressMode {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUAddressMode {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUAddressMode {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUAddressMode>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUAddressMode'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUFilterMode {
Nearest,
Linear
}
pub mod GPUFilterModeValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUFilterMode)] = &[
("nearest", super::GPUFilterMode::Nearest),
("linear", super::GPUFilterMode::Linear),
];
impl super::GPUFilterMode {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUFilterMode {
fn default() -> super::GPUFilterMode {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUFilterMode {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUFilterMode {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUFilterMode>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUFilterMode'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUCompareFunction {
Never,
Less,
Equal,
Less_equal,
Greater,
Not_equal,
Greater_equal,
Always
}
pub mod GPUCompareFunctionValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUCompareFunction)] = &[
("never", super::GPUCompareFunction::Never),
("less", super::GPUCompareFunction::Less),
("equal", super::GPUCompareFunction::Equal),
("less-equal", super::GPUCompareFunction::Less_equal),
("greater", super::GPUCompareFunction::Greater),
("not-equal", super::GPUCompareFunction::Not_equal),
("greater-equal", super::GPUCompareFunction::Greater_equal),
("always", super::GPUCompareFunction::Always),
];
impl super::GPUCompareFunction {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUCompareFunction {
fn default() -> super::GPUCompareFunction {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUCompareFunction {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUCompareFunction {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUCompareFunction>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUCompareFunction'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUBufferBindingType {
Uniform,
Storage,
Read_only_storage
}
pub mod GPUBufferBindingTypeValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUBufferBindingType)] = &[
("uniform", super::GPUBufferBindingType::Uniform),
("storage", super::GPUBufferBindingType::Storage),
("read-only-storage", super::GPUBufferBindingType::Read_only_storage),
];
impl super::GPUBufferBindingType {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUBufferBindingType {
fn default() -> super::GPUBufferBindingType {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUBufferBindingType {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUBufferBindingType {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUBufferBindingType>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUBufferBindingType'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUSamplerBindingType {
Filtering,
Non_filtering,
Comparison
}
pub mod GPUSamplerBindingTypeValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUSamplerBindingType)] = &[
("filtering", super::GPUSamplerBindingType::Filtering),
("non-filtering", super::GPUSamplerBindingType::Non_filtering),
("comparison", super::GPUSamplerBindingType::Comparison),
];
impl super::GPUSamplerBindingType {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUSamplerBindingType {
fn default() -> super::GPUSamplerBindingType {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUSamplerBindingType {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUSamplerBindingType {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUSamplerBindingType>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUSamplerBindingType'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUTextureSampleType {
Float,
Unfilterable_float,
Depth,
Sint,
Uint
}
pub mod GPUTextureSampleTypeValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUTextureSampleType)] = &[
("float", super::GPUTextureSampleType::Float),
("unfilterable-float", super::GPUTextureSampleType::Unfilterable_float),
("depth", super::GPUTextureSampleType::Depth),
("sint", super::GPUTextureSampleType::Sint),
("uint", super::GPUTextureSampleType::Uint),
];
impl super::GPUTextureSampleType {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUTextureSampleType {
fn default() -> super::GPUTextureSampleType {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUTextureSampleType {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUTextureSampleType {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUTextureSampleType>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUTextureSampleType'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUStorageTextureAccess {
Write_only
}
pub mod GPUStorageTextureAccessValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUStorageTextureAccess)] = &[
("write-only", super::GPUStorageTextureAccess::Write_only),
];
impl super::GPUStorageTextureAccess {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUStorageTextureAccess {
fn default() -> super::GPUStorageTextureAccess {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUStorageTextureAccess {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUStorageTextureAccess {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUStorageTextureAccess>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUStorageTextureAccess'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUCompilationMessageType {
Error,
Warning,
Info
}
pub mod GPUCompilationMessageTypeValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUCompilationMessageType)] = &[
("error", super::GPUCompilationMessageType::Error),
("warning", super::GPUCompilationMessageType::Warning),
("info", super::GPUCompilationMessageType::Info),
];
impl super::GPUCompilationMessageType {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUCompilationMessageType {
fn default() -> super::GPUCompilationMessageType {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUCompilationMessageType {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUCompilationMessageType {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUCompilationMessageType>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUCompilationMessageType'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUAutoLayoutMode {
Auto
}
pub mod GPUAutoLayoutModeValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUAutoLayoutMode)] = &[
("auto", super::GPUAutoLayoutMode::Auto),
];
impl super::GPUAutoLayoutMode {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUAutoLayoutMode {
fn default() -> super::GPUAutoLayoutMode {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUAutoLayoutMode {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUAutoLayoutMode {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUAutoLayoutMode>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUAutoLayoutMode'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUPrimitiveTopology {
Point_list,
Line_list,
Line_strip,
Triangle_list,
Triangle_strip
}
pub mod GPUPrimitiveTopologyValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUPrimitiveTopology)] = &[
("point-list", super::GPUPrimitiveTopology::Point_list),
("line-list", super::GPUPrimitiveTopology::Line_list),
("line-strip", super::GPUPrimitiveTopology::Line_strip),
("triangle-list", super::GPUPrimitiveTopology::Triangle_list),
("triangle-strip", super::GPUPrimitiveTopology::Triangle_strip),
];
impl super::GPUPrimitiveTopology {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUPrimitiveTopology {
fn default() -> super::GPUPrimitiveTopology {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUPrimitiveTopology {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUPrimitiveTopology {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUPrimitiveTopology>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUPrimitiveTopology'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUFrontFace {
Ccw,
Cw
}
pub mod GPUFrontFaceValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUFrontFace)] = &[
("ccw", super::GPUFrontFace::Ccw),
("cw", super::GPUFrontFace::Cw),
];
impl super::GPUFrontFace {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUFrontFace {
fn default() -> super::GPUFrontFace {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUFrontFace {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUFrontFace {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUFrontFace>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUFrontFace'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUCullMode {
None,
Front,
Back
}
pub mod GPUCullModeValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUCullMode)] = &[
("none", super::GPUCullMode::None),
("front", super::GPUCullMode::Front),
("back", super::GPUCullMode::Back),
];
impl super::GPUCullMode {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUCullMode {
fn default() -> super::GPUCullMode {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUCullMode {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUCullMode {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUCullMode>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUCullMode'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUBlendFactor {
Zero,
One,
Src,
One_minus_src,
Src_alpha,
One_minus_src_alpha,
Dst,
One_minus_dst,
Dst_alpha,
One_minus_dst_alpha,
Src_alpha_saturated,
Constant,
One_minus_constant
}
pub mod GPUBlendFactorValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUBlendFactor)] = &[
("zero", super::GPUBlendFactor::Zero),
("one", super::GPUBlendFactor::One),
("src", super::GPUBlendFactor::Src),
("one-minus-src", super::GPUBlendFactor::One_minus_src),
("src-alpha", super::GPUBlendFactor::Src_alpha),
("one-minus-src-alpha", super::GPUBlendFactor::One_minus_src_alpha),
("dst", super::GPUBlendFactor::Dst),
("one-minus-dst", super::GPUBlendFactor::One_minus_dst),
("dst-alpha", super::GPUBlendFactor::Dst_alpha),
("one-minus-dst-alpha", super::GPUBlendFactor::One_minus_dst_alpha),
("src-alpha-saturated", super::GPUBlendFactor::Src_alpha_saturated),
("constant", super::GPUBlendFactor::Constant),
("one-minus-constant", super::GPUBlendFactor::One_minus_constant),
];
impl super::GPUBlendFactor {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUBlendFactor {
fn default() -> super::GPUBlendFactor {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUBlendFactor {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUBlendFactor {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUBlendFactor>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUBlendFactor'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUBlendOperation {
Add,
Subtract,
Reverse_subtract,
Min,
Max
}
pub mod GPUBlendOperationValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUBlendOperation)] = &[
("add", super::GPUBlendOperation::Add),
("subtract", super::GPUBlendOperation::Subtract),
("reverse-subtract", super::GPUBlendOperation::Reverse_subtract),
("min", super::GPUBlendOperation::Min),
("max", super::GPUBlendOperation::Max),
];
impl super::GPUBlendOperation {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUBlendOperation {
fn default() -> super::GPUBlendOperation {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUBlendOperation {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUBlendOperation {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUBlendOperation>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUBlendOperation'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUStencilOperation {
Keep,
Zero,
Replace,
Invert,
Increment_clamp,
Decrement_clamp,
Increment_wrap,
Decrement_wrap
}
pub mod GPUStencilOperationValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUStencilOperation)] = &[
("keep", super::GPUStencilOperation::Keep),
("zero", super::GPUStencilOperation::Zero),
("replace", super::GPUStencilOperation::Replace),
("invert", super::GPUStencilOperation::Invert),
("increment-clamp", super::GPUStencilOperation::Increment_clamp),
("decrement-clamp", super::GPUStencilOperation::Decrement_clamp),
("increment-wrap", super::GPUStencilOperation::Increment_wrap),
("decrement-wrap", super::GPUStencilOperation::Decrement_wrap),
];
impl super::GPUStencilOperation {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUStencilOperation {
fn default() -> super::GPUStencilOperation {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUStencilOperation {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUStencilOperation {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUStencilOperation>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUStencilOperation'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUIndexFormat {
Uint16,
Uint32
}
pub mod GPUIndexFormatValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUIndexFormat)] = &[
("uint16", super::GPUIndexFormat::Uint16),
("uint32", super::GPUIndexFormat::Uint32),
];
impl super::GPUIndexFormat {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUIndexFormat {
fn default() -> super::GPUIndexFormat {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUIndexFormat {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUIndexFormat {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUIndexFormat>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUIndexFormat'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUVertexFormat {
Uint8x2,
Uint8x4,
Sint8x2,
Sint8x4,
Unorm8x2,
Unorm8x4,
Snorm8x2,
Snorm8x4,
Uint16x2,
Uint16x4,
Sint16x2,
Sint16x4,
Unorm16x2,
Unorm16x4,
Snorm16x2,
Snorm16x4,
Float16x2,
Float16x4,
Float32,
Float32x2,
Float32x3,
Float32x4,
Uint32,
Uint32x2,
Uint32x3,
Uint32x4,
Sint32,
Sint32x2,
Sint32x3,
Sint32x4
}
pub mod GPUVertexFormatValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUVertexFormat)] = &[
("uint8x2", super::GPUVertexFormat::Uint8x2),
("uint8x4", super::GPUVertexFormat::Uint8x4),
("sint8x2", super::GPUVertexFormat::Sint8x2),
("sint8x4", super::GPUVertexFormat::Sint8x4),
("unorm8x2", super::GPUVertexFormat::Unorm8x2),
("unorm8x4", super::GPUVertexFormat::Unorm8x4),
("snorm8x2", super::GPUVertexFormat::Snorm8x2),
("snorm8x4", super::GPUVertexFormat::Snorm8x4),
("uint16x2", super::GPUVertexFormat::Uint16x2),
("uint16x4", super::GPUVertexFormat::Uint16x4),
("sint16x2", super::GPUVertexFormat::Sint16x2),
("sint16x4", super::GPUVertexFormat::Sint16x4),
("unorm16x2", super::GPUVertexFormat::Unorm16x2),
("unorm16x4", super::GPUVertexFormat::Unorm16x4),
("snorm16x2", super::GPUVertexFormat::Snorm16x2),
("snorm16x4", super::GPUVertexFormat::Snorm16x4),
("float16x2", super::GPUVertexFormat::Float16x2),
("float16x4", super::GPUVertexFormat::Float16x4),
("float32", super::GPUVertexFormat::Float32),
("float32x2", super::GPUVertexFormat::Float32x2),
("float32x3", super::GPUVertexFormat::Float32x3),
("float32x4", super::GPUVertexFormat::Float32x4),
("uint32", super::GPUVertexFormat::Uint32),
("uint32x2", super::GPUVertexFormat::Uint32x2),
("uint32x3", super::GPUVertexFormat::Uint32x3),
("uint32x4", super::GPUVertexFormat::Uint32x4),
("sint32", super::GPUVertexFormat::Sint32),
("sint32x2", super::GPUVertexFormat::Sint32x2),
("sint32x3", super::GPUVertexFormat::Sint32x3),
("sint32x4", super::GPUVertexFormat::Sint32x4),
];
impl super::GPUVertexFormat {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUVertexFormat {
fn default() -> super::GPUVertexFormat {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUVertexFormat {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUVertexFormat {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUVertexFormat>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUVertexFormat'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUVertexStepMode {
Vertex,
Instance
}
pub mod GPUVertexStepModeValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUVertexStepMode)] = &[
("vertex", super::GPUVertexStepMode::Vertex),
("instance", super::GPUVertexStepMode::Instance),
];
impl super::GPUVertexStepMode {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUVertexStepMode {
fn default() -> super::GPUVertexStepMode {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUVertexStepMode {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUVertexStepMode {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUVertexStepMode>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUVertexStepMode'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPULoadOp {
Load,
Clear
}
pub mod GPULoadOpValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPULoadOp)] = &[
("load", super::GPULoadOp::Load),
("clear", super::GPULoadOp::Clear),
];
impl super::GPULoadOp {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPULoadOp {
fn default() -> super::GPULoadOp {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPULoadOp {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPULoadOp {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPULoadOp>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPULoadOp'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUStoreOp {
Store,
Discard
}
pub mod GPUStoreOpValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUStoreOp)] = &[
("store", super::GPUStoreOp::Store),
("discard", super::GPUStoreOp::Discard),
];
impl super::GPUStoreOp {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUStoreOp {
fn default() -> super::GPUStoreOp {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUStoreOp {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUStoreOp {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUStoreOp>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUStoreOp'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUPipelineStatisticName {
Vertex_shader_invocations,
Clipper_invocations,
Clipper_primitives_out,
Fragment_shader_invocations,
Compute_shader_invocations
}
pub mod GPUPipelineStatisticNameValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUPipelineStatisticName)] = &[
("vertex-shader-invocations", super::GPUPipelineStatisticName::Vertex_shader_invocations),
("clipper-invocations", super::GPUPipelineStatisticName::Clipper_invocations),
("clipper-primitives-out", super::GPUPipelineStatisticName::Clipper_primitives_out),
("fragment-shader-invocations", super::GPUPipelineStatisticName::Fragment_shader_invocations),
("compute-shader-invocations", super::GPUPipelineStatisticName::Compute_shader_invocations),
];
impl super::GPUPipelineStatisticName {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUPipelineStatisticName {
fn default() -> super::GPUPipelineStatisticName {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUPipelineStatisticName {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUPipelineStatisticName {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUPipelineStatisticName>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUPipelineStatisticName'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUQueryType {
Occlusion,
Pipeline_statistics,
Timestamp
}
pub mod GPUQueryTypeValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUQueryType)] = &[
("occlusion", super::GPUQueryType::Occlusion),
("pipeline-statistics", super::GPUQueryType::Pipeline_statistics),
("timestamp", super::GPUQueryType::Timestamp),
];
impl super::GPUQueryType {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUQueryType {
fn default() -> super::GPUQueryType {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUQueryType {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUQueryType {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUQueryType>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUQueryType'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUCanvasAlphaMode {
Opaque,
Premultiplied
}
pub mod GPUCanvasAlphaModeValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUCanvasAlphaMode)] = &[
("opaque", super::GPUCanvasAlphaMode::Opaque),
("premultiplied", super::GPUCanvasAlphaMode::Premultiplied),
];
impl super::GPUCanvasAlphaMode {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUCanvasAlphaMode {
fn default() -> super::GPUCanvasAlphaMode {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUCanvasAlphaMode {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUCanvasAlphaMode {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUCanvasAlphaMode>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUCanvasAlphaMode'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUDeviceLostReason {
Unknown,
Destroyed
}
pub mod GPUDeviceLostReasonValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUDeviceLostReason)] = &[
("unknown", super::GPUDeviceLostReason::Unknown),
("destroyed", super::GPUDeviceLostReason::Destroyed),
];
impl super::GPUDeviceLostReason {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUDeviceLostReason {
fn default() -> super::GPUDeviceLostReason {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUDeviceLostReason {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUDeviceLostReason {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUDeviceLostReason>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUDeviceLostReason'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} #[repr(usize)]
#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum GPUErrorFilter {
Validation,
Out_of_memory,
Internal
}
pub mod GPUErrorFilterValues {
use crate::dom::bindings::conversions::ConversionResult;
use crate::dom::bindings::conversions::FromJSValConvertible;
use crate::dom::bindings::conversions::ToJSValConvertible;
use crate::dom::bindings::utils::find_enum_value;
use js::jsapi::JSContext;
use js::rust::HandleValue;
use js::rust::MutableHandleValue;
use js::jsval::JSVal;
pub const pairs: &[(&str, super::GPUErrorFilter)] = &[
("validation", super::GPUErrorFilter::Validation),
("out-of-memory", super::GPUErrorFilter::Out_of_memory),
("internal", super::GPUErrorFilter::Internal),
];
impl super::GPUErrorFilter {
pub fn as_str(&self) -> &'static str {
pairs[*self as usize].0
}
}
impl Default for super::GPUErrorFilter {
fn default() -> super::GPUErrorFilter {
pairs[0].1
}
}
impl ToJSValConvertible for super::GPUErrorFilter {
unsafe fn to_jsval(&self, cx: *mut JSContext, rval: MutableHandleValue) {
pairs[*self as usize].0.to_jsval(cx, rval);
}
}
impl FromJSValConvertible for super::GPUErrorFilter {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<super::GPUErrorFilter>, ()> {
match find_enum_value(cx, value, pairs) {
Err(_) => Err(()),
Ok((None, search)) => {
Ok(ConversionResult::Failure(
format!("'{}' is not a valid enum value for enumeration 'GPUErrorFilter'.", search).into()
))
}
Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
}
}
}
} pub type GPUBufferUsageFlags = u32;
pub type GPUMapModeFlags = u32;
pub type GPUTextureUsageFlags = u32;
pub type GPUShaderStageFlags = u32;
pub use self::UnionTypes::GPUSamplerOrGPUTextureViewOrGPUBufferBinding as GPUBindingResource;
pub type GPUColorWriteFlags = u32;
pub use self::UnionTypes::GPUOutOfMemoryErrorOrGPUValidationError as GPUError;
pub type GPUBufferDynamicOffset = u32;
pub type GPUStencilValue = u32;
pub type GPUSampleMask = u32;
pub type GPUDepthBias = i32;
pub type GPUSize64 = u64;
pub type GPUIntegerCoordinate = u32;
pub type GPUIndex32 = u32;
pub type GPUSize32 = u32;
pub type GPUSignedOffset32 = i32;
pub use self::UnionTypes::DoubleSequenceOrGPUColorDict as GPUColor;
pub use self::UnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUOrigin2DDict as GPUOrigin2D;
pub use self::UnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUOrigin3DDict as GPUOrigin3D;
pub use self::UnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict as GPUExtent3D;
#[derive(JSTraceable)]
pub struct GPUObjectDescriptorBase {
pub label: Option<USVString>,
}
impl GPUObjectDescriptorBase {
pub fn empty() -> Self {
Self {
label: None,
}
}
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUObjectDescriptorBase>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUObjectDescriptorBase {
label: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "label", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
})
} else {
None
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUObjectDescriptorBase {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUObjectDescriptorBase>, ()> {
GPUObjectDescriptorBase::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUObjectDescriptorBase {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
if let Some(ref label) = self.label {
rooted!(in(cx) let mut label_js = UndefinedValue());
label.to_jsval(cx, label_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "label", label_js.handle()).unwrap();
}
}
}
impl ToJSValConvertible for GPUObjectDescriptorBase {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPURequestAdapterOptions {
pub forceFallbackAdapter: bool,
pub powerPreference: Option<GPUPowerPreference>,
}
impl GPURequestAdapterOptions {
pub fn empty() -> Self {
Self {
forceFallbackAdapter: false,
powerPreference: None,
}
}
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPURequestAdapterOptions>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPURequestAdapterOptions {
forceFallbackAdapter: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "forceFallbackAdapter", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
false
}
},
powerPreference: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "powerPreference", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
})
} else {
None
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPURequestAdapterOptions {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPURequestAdapterOptions>, ()> {
GPURequestAdapterOptions::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPURequestAdapterOptions {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let forceFallbackAdapter = &self.forceFallbackAdapter;
rooted!(in(cx) let mut forceFallbackAdapter_js = UndefinedValue());
forceFallbackAdapter.to_jsval(cx, forceFallbackAdapter_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "forceFallbackAdapter", forceFallbackAdapter_js.handle()).unwrap();
if let Some(ref powerPreference) = self.powerPreference {
rooted!(in(cx) let mut powerPreference_js = UndefinedValue());
powerPreference.to_jsval(cx, powerPreference_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "powerPreference", powerPreference_js.handle()).unwrap();
}
}
}
impl ToJSValConvertible for GPURequestAdapterOptions {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUDeviceDescriptor {
pub requiredFeatures: Vec<GPUFeatureName>,
pub requiredLimits: Option<Record<DOMString, u64>>,
}
impl GPUDeviceDescriptor {
pub fn empty() -> Self {
Self {
requiredFeatures: Vec::new(),
requiredLimits: None,
}
}
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUDeviceDescriptor>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUDeviceDescriptor {
requiredFeatures: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "requiredFeatures", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
Vec::new()
}
},
requiredLimits: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "requiredLimits", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::Default) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
})
} else {
None
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUDeviceDescriptor {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUDeviceDescriptor>, ()> {
GPUDeviceDescriptor::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUDeviceDescriptor {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let requiredFeatures = &self.requiredFeatures;
rooted!(in(cx) let mut requiredFeatures_js = UndefinedValue());
requiredFeatures.to_jsval(cx, requiredFeatures_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "requiredFeatures", requiredFeatures_js.handle()).unwrap();
if let Some(ref requiredLimits) = self.requiredLimits {
rooted!(in(cx) let mut requiredLimits_js = UndefinedValue());
requiredLimits.to_jsval(cx, requiredLimits_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "requiredLimits", requiredLimits_js.handle()).unwrap();
}
}
}
impl ToJSValConvertible for GPUDeviceDescriptor {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUBufferDescriptor {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase,
pub mappedAtCreation: bool,
pub size: u64,
pub usage: u32,
}
impl GPUBufferDescriptor {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUBufferDescriptor>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUBufferDescriptor {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
mappedAtCreation: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "mappedAtCreation", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
false
}
},
size: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "size", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
throw_type_error(*cx, "Missing required member \"size\".");
return Err(());
}
},
usage: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "usage", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
throw_type_error(*cx, "Missing required member \"usage\".");
return Err(());
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUBufferDescriptor {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUBufferDescriptor>, ()> {
GPUBufferDescriptor::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUBufferDescriptor {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
let mappedAtCreation = &self.mappedAtCreation;
rooted!(in(cx) let mut mappedAtCreation_js = UndefinedValue());
mappedAtCreation.to_jsval(cx, mappedAtCreation_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "mappedAtCreation", mappedAtCreation_js.handle()).unwrap();
let size = &self.size;
rooted!(in(cx) let mut size_js = UndefinedValue());
size.to_jsval(cx, size_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "size", size_js.handle()).unwrap();
let usage = &self.usage;
rooted!(in(cx) let mut usage_js = UndefinedValue());
usage.to_jsval(cx, usage_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "usage", usage_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUBufferDescriptor {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUTextureDescriptor {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase,
pub dimension: GPUTextureDimension,
pub format: GPUTextureFormat,
pub mipLevelCount: u32,
pub sampleCount: u32,
pub size: UnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict,
pub usage: u32,
pub viewFormats: Vec<GPUTextureFormat>,
}
impl GPUTextureDescriptor {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUTextureDescriptor>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUTextureDescriptor {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
dimension: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "dimension", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUTextureDimension::_2d
}
},
format: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "format", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"format\".");
return Err(());
}
},
mipLevelCount: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "mipLevelCount", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
1
}
},
sampleCount: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "sampleCount", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
1
}
},
size: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "size", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"size\".");
return Err(());
}
},
usage: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "usage", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
throw_type_error(*cx, "Missing required member \"usage\".");
return Err(());
}
},
viewFormats: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "viewFormats", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
Vec::new()
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUTextureDescriptor {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUTextureDescriptor>, ()> {
GPUTextureDescriptor::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUTextureDescriptor {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
let dimension = &self.dimension;
rooted!(in(cx) let mut dimension_js = UndefinedValue());
dimension.to_jsval(cx, dimension_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "dimension", dimension_js.handle()).unwrap();
let format = &self.format;
rooted!(in(cx) let mut format_js = UndefinedValue());
format.to_jsval(cx, format_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "format", format_js.handle()).unwrap();
let mipLevelCount = &self.mipLevelCount;
rooted!(in(cx) let mut mipLevelCount_js = UndefinedValue());
mipLevelCount.to_jsval(cx, mipLevelCount_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "mipLevelCount", mipLevelCount_js.handle()).unwrap();
let sampleCount = &self.sampleCount;
rooted!(in(cx) let mut sampleCount_js = UndefinedValue());
sampleCount.to_jsval(cx, sampleCount_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "sampleCount", sampleCount_js.handle()).unwrap();
let size = &self.size;
rooted!(in(cx) let mut size_js = UndefinedValue());
size.to_jsval(cx, size_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "size", size_js.handle()).unwrap();
let usage = &self.usage;
rooted!(in(cx) let mut usage_js = UndefinedValue());
usage.to_jsval(cx, usage_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "usage", usage_js.handle()).unwrap();
let viewFormats = &self.viewFormats;
rooted!(in(cx) let mut viewFormats_js = UndefinedValue());
viewFormats.to_jsval(cx, viewFormats_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "viewFormats", viewFormats_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUTextureDescriptor {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUTextureViewDescriptor {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase,
pub arrayLayerCount: Option<u32>,
pub aspect: GPUTextureAspect,
pub baseArrayLayer: u32,
pub baseMipLevel: u32,
pub dimension: Option<GPUTextureViewDimension>,
pub format: Option<GPUTextureFormat>,
pub mipLevelCount: Option<u32>,
}
impl GPUTextureViewDescriptor {
pub fn empty() -> Self {
Self {
parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase::empty(),
arrayLayerCount: None,
aspect: GPUTextureAspect::All,
baseArrayLayer: 0,
baseMipLevel: 0,
dimension: None,
format: None,
mipLevelCount: None,
}
}
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUTextureViewDescriptor>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUTextureViewDescriptor {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
arrayLayerCount: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "arrayLayerCount", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
})
} else {
None
}
},
aspect: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "aspect", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUTextureAspect::All
}
},
baseArrayLayer: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "baseArrayLayer", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
0
}
},
baseMipLevel: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "baseMipLevel", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
0
}
},
dimension: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "dimension", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
})
} else {
None
}
},
format: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "format", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
})
} else {
None
}
},
mipLevelCount: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "mipLevelCount", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
})
} else {
None
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUTextureViewDescriptor {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUTextureViewDescriptor>, ()> {
GPUTextureViewDescriptor::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUTextureViewDescriptor {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
if let Some(ref arrayLayerCount) = self.arrayLayerCount {
rooted!(in(cx) let mut arrayLayerCount_js = UndefinedValue());
arrayLayerCount.to_jsval(cx, arrayLayerCount_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "arrayLayerCount", arrayLayerCount_js.handle()).unwrap();
}
let aspect = &self.aspect;
rooted!(in(cx) let mut aspect_js = UndefinedValue());
aspect.to_jsval(cx, aspect_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "aspect", aspect_js.handle()).unwrap();
let baseArrayLayer = &self.baseArrayLayer;
rooted!(in(cx) let mut baseArrayLayer_js = UndefinedValue());
baseArrayLayer.to_jsval(cx, baseArrayLayer_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "baseArrayLayer", baseArrayLayer_js.handle()).unwrap();
let baseMipLevel = &self.baseMipLevel;
rooted!(in(cx) let mut baseMipLevel_js = UndefinedValue());
baseMipLevel.to_jsval(cx, baseMipLevel_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "baseMipLevel", baseMipLevel_js.handle()).unwrap();
if let Some(ref dimension) = self.dimension {
rooted!(in(cx) let mut dimension_js = UndefinedValue());
dimension.to_jsval(cx, dimension_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "dimension", dimension_js.handle()).unwrap();
}
if let Some(ref format) = self.format {
rooted!(in(cx) let mut format_js = UndefinedValue());
format.to_jsval(cx, format_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "format", format_js.handle()).unwrap();
}
if let Some(ref mipLevelCount) = self.mipLevelCount {
rooted!(in(cx) let mut mipLevelCount_js = UndefinedValue());
mipLevelCount.to_jsval(cx, mipLevelCount_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "mipLevelCount", mipLevelCount_js.handle()).unwrap();
}
}
}
impl ToJSValConvertible for GPUTextureViewDescriptor {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUSamplerDescriptor {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase,
pub addressModeU: GPUAddressMode,
pub addressModeV: GPUAddressMode,
pub addressModeW: GPUAddressMode,
pub compare: Option<GPUCompareFunction>,
pub lodMaxClamp: Finite<f32>,
pub lodMinClamp: Finite<f32>,
pub magFilter: GPUFilterMode,
pub maxAnisotropy: u16,
pub minFilter: GPUFilterMode,
pub mipmapFilter: GPUFilterMode,
}
impl GPUSamplerDescriptor {
pub fn empty() -> Self {
Self {
parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase::empty(),
addressModeU: GPUAddressMode::Clamp_to_edge,
addressModeV: GPUAddressMode::Clamp_to_edge,
addressModeW: GPUAddressMode::Clamp_to_edge,
compare: None,
lodMaxClamp: Finite::wrap(1000.0),
lodMinClamp: Finite::wrap(0.0),
magFilter: GPUFilterMode::Nearest,
maxAnisotropy: 1,
minFilter: GPUFilterMode::Nearest,
mipmapFilter: GPUFilterMode::Nearest,
}
}
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUSamplerDescriptor>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUSamplerDescriptor {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
addressModeU: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "addressModeU", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUAddressMode::Clamp_to_edge
}
},
addressModeV: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "addressModeV", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUAddressMode::Clamp_to_edge
}
},
addressModeW: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "addressModeW", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUAddressMode::Clamp_to_edge
}
},
compare: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "compare", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
})
} else {
None
}
},
lodMaxClamp: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "lodMaxClamp", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
Finite::wrap(1000.0)
}
},
lodMinClamp: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "lodMinClamp", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
Finite::wrap(0.0)
}
},
magFilter: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "magFilter", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUFilterMode::Nearest
}
},
maxAnisotropy: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "maxAnisotropy", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::Clamp) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
1
}
},
minFilter: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "minFilter", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUFilterMode::Nearest
}
},
mipmapFilter: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "mipmapFilter", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUFilterMode::Nearest
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUSamplerDescriptor {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUSamplerDescriptor>, ()> {
GPUSamplerDescriptor::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUSamplerDescriptor {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
let addressModeU = &self.addressModeU;
rooted!(in(cx) let mut addressModeU_js = UndefinedValue());
addressModeU.to_jsval(cx, addressModeU_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "addressModeU", addressModeU_js.handle()).unwrap();
let addressModeV = &self.addressModeV;
rooted!(in(cx) let mut addressModeV_js = UndefinedValue());
addressModeV.to_jsval(cx, addressModeV_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "addressModeV", addressModeV_js.handle()).unwrap();
let addressModeW = &self.addressModeW;
rooted!(in(cx) let mut addressModeW_js = UndefinedValue());
addressModeW.to_jsval(cx, addressModeW_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "addressModeW", addressModeW_js.handle()).unwrap();
if let Some(ref compare) = self.compare {
rooted!(in(cx) let mut compare_js = UndefinedValue());
compare.to_jsval(cx, compare_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "compare", compare_js.handle()).unwrap();
}
let lodMaxClamp = &self.lodMaxClamp;
rooted!(in(cx) let mut lodMaxClamp_js = UndefinedValue());
lodMaxClamp.to_jsval(cx, lodMaxClamp_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "lodMaxClamp", lodMaxClamp_js.handle()).unwrap();
let lodMinClamp = &self.lodMinClamp;
rooted!(in(cx) let mut lodMinClamp_js = UndefinedValue());
lodMinClamp.to_jsval(cx, lodMinClamp_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "lodMinClamp", lodMinClamp_js.handle()).unwrap();
let magFilter = &self.magFilter;
rooted!(in(cx) let mut magFilter_js = UndefinedValue());
magFilter.to_jsval(cx, magFilter_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "magFilter", magFilter_js.handle()).unwrap();
let maxAnisotropy = &self.maxAnisotropy;
rooted!(in(cx) let mut maxAnisotropy_js = UndefinedValue());
maxAnisotropy.to_jsval(cx, maxAnisotropy_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "maxAnisotropy", maxAnisotropy_js.handle()).unwrap();
let minFilter = &self.minFilter;
rooted!(in(cx) let mut minFilter_js = UndefinedValue());
minFilter.to_jsval(cx, minFilter_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "minFilter", minFilter_js.handle()).unwrap();
let mipmapFilter = &self.mipmapFilter;
rooted!(in(cx) let mut mipmapFilter_js = UndefinedValue());
mipmapFilter.to_jsval(cx, mipmapFilter_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "mipmapFilter", mipmapFilter_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUSamplerDescriptor {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUBindGroupLayoutDescriptor {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase,
pub entries: Vec<crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUBindGroupLayoutEntry>,
}
impl GPUBindGroupLayoutDescriptor {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUBindGroupLayoutDescriptor>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUBindGroupLayoutDescriptor {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
entries: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "entries", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"entries\".");
return Err(());
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUBindGroupLayoutDescriptor {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUBindGroupLayoutDescriptor>, ()> {
GPUBindGroupLayoutDescriptor::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUBindGroupLayoutDescriptor {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
let entries = &self.entries;
rooted!(in(cx) let mut entries_js = UndefinedValue());
entries.to_jsval(cx, entries_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "entries", entries_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUBindGroupLayoutDescriptor {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUBindGroupLayoutEntry {
pub binding: u32,
pub buffer: Option<crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUBufferBindingLayout>,
pub sampler: Option<crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUSamplerBindingLayout>,
pub storageTexture: Option<crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUStorageTextureBindingLayout>,
pub texture: Option<crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureBindingLayout>,
pub visibility: u32,
}
impl GPUBindGroupLayoutEntry {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUBindGroupLayoutEntry>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUBindGroupLayoutEntry {
binding: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "binding", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
throw_type_error(*cx, "Missing required member \"binding\".");
return Err(());
}
},
buffer: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "buffer", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
})
} else {
None
}
},
sampler: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "sampler", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
})
} else {
None
}
},
storageTexture: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "storageTexture", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
})
} else {
None
}
},
texture: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "texture", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
})
} else {
None
}
},
visibility: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "visibility", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
throw_type_error(*cx, "Missing required member \"visibility\".");
return Err(());
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUBindGroupLayoutEntry {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUBindGroupLayoutEntry>, ()> {
GPUBindGroupLayoutEntry::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUBindGroupLayoutEntry {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let binding = &self.binding;
rooted!(in(cx) let mut binding_js = UndefinedValue());
binding.to_jsval(cx, binding_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "binding", binding_js.handle()).unwrap();
if let Some(ref buffer) = self.buffer {
rooted!(in(cx) let mut buffer_js = UndefinedValue());
buffer.to_jsval(cx, buffer_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "buffer", buffer_js.handle()).unwrap();
}
if let Some(ref sampler) = self.sampler {
rooted!(in(cx) let mut sampler_js = UndefinedValue());
sampler.to_jsval(cx, sampler_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "sampler", sampler_js.handle()).unwrap();
}
if let Some(ref storageTexture) = self.storageTexture {
rooted!(in(cx) let mut storageTexture_js = UndefinedValue());
storageTexture.to_jsval(cx, storageTexture_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "storageTexture", storageTexture_js.handle()).unwrap();
}
if let Some(ref texture) = self.texture {
rooted!(in(cx) let mut texture_js = UndefinedValue());
texture.to_jsval(cx, texture_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "texture", texture_js.handle()).unwrap();
}
let visibility = &self.visibility;
rooted!(in(cx) let mut visibility_js = UndefinedValue());
visibility.to_jsval(cx, visibility_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "visibility", visibility_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUBindGroupLayoutEntry {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUBufferBindingLayout {
pub hasDynamicOffset: bool,
pub minBindingSize: u64,
pub type_: GPUBufferBindingType,
}
impl GPUBufferBindingLayout {
pub fn empty() -> Self {
Self {
hasDynamicOffset: false,
minBindingSize: 0,
type_: GPUBufferBindingType::Uniform,
}
}
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUBufferBindingLayout>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUBufferBindingLayout {
hasDynamicOffset: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "hasDynamicOffset", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
false
}
},
minBindingSize: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "minBindingSize", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
0
}
},
type_: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "type", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUBufferBindingType::Uniform
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUBufferBindingLayout {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUBufferBindingLayout>, ()> {
GPUBufferBindingLayout::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUBufferBindingLayout {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let hasDynamicOffset = &self.hasDynamicOffset;
rooted!(in(cx) let mut hasDynamicOffset_js = UndefinedValue());
hasDynamicOffset.to_jsval(cx, hasDynamicOffset_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "hasDynamicOffset", hasDynamicOffset_js.handle()).unwrap();
let minBindingSize = &self.minBindingSize;
rooted!(in(cx) let mut minBindingSize_js = UndefinedValue());
minBindingSize.to_jsval(cx, minBindingSize_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "minBindingSize", minBindingSize_js.handle()).unwrap();
let type_ = &self.type_;
rooted!(in(cx) let mut type__js = UndefinedValue());
type_.to_jsval(cx, type__js.handle_mut());
set_dictionary_property(cx, obj.handle(), "type", type__js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUBufferBindingLayout {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUSamplerBindingLayout {
pub type_: GPUSamplerBindingType,
}
impl GPUSamplerBindingLayout {
pub fn empty() -> Self {
Self {
type_: GPUSamplerBindingType::Filtering,
}
}
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUSamplerBindingLayout>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUSamplerBindingLayout {
type_: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "type", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUSamplerBindingType::Filtering
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUSamplerBindingLayout {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUSamplerBindingLayout>, ()> {
GPUSamplerBindingLayout::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUSamplerBindingLayout {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let type_ = &self.type_;
rooted!(in(cx) let mut type__js = UndefinedValue());
type_.to_jsval(cx, type__js.handle_mut());
set_dictionary_property(cx, obj.handle(), "type", type__js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUSamplerBindingLayout {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUTextureBindingLayout {
pub multisampled: bool,
pub sampleType: GPUTextureSampleType,
pub viewDimension: GPUTextureViewDimension,
}
impl GPUTextureBindingLayout {
pub fn empty() -> Self {
Self {
multisampled: false,
sampleType: GPUTextureSampleType::Float,
viewDimension: GPUTextureViewDimension::_2d,
}
}
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUTextureBindingLayout>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUTextureBindingLayout {
multisampled: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "multisampled", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
false
}
},
sampleType: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "sampleType", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUTextureSampleType::Float
}
},
viewDimension: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "viewDimension", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUTextureViewDimension::_2d
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUTextureBindingLayout {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUTextureBindingLayout>, ()> {
GPUTextureBindingLayout::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUTextureBindingLayout {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let multisampled = &self.multisampled;
rooted!(in(cx) let mut multisampled_js = UndefinedValue());
multisampled.to_jsval(cx, multisampled_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "multisampled", multisampled_js.handle()).unwrap();
let sampleType = &self.sampleType;
rooted!(in(cx) let mut sampleType_js = UndefinedValue());
sampleType.to_jsval(cx, sampleType_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "sampleType", sampleType_js.handle()).unwrap();
let viewDimension = &self.viewDimension;
rooted!(in(cx) let mut viewDimension_js = UndefinedValue());
viewDimension.to_jsval(cx, viewDimension_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "viewDimension", viewDimension_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUTextureBindingLayout {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUStorageTextureBindingLayout {
pub access: GPUStorageTextureAccess,
pub format: GPUTextureFormat,
pub viewDimension: GPUTextureViewDimension,
}
impl GPUStorageTextureBindingLayout {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUStorageTextureBindingLayout>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUStorageTextureBindingLayout {
access: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "access", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUStorageTextureAccess::Write_only
}
},
format: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "format", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"format\".");
return Err(());
}
},
viewDimension: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "viewDimension", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUTextureViewDimension::_2d
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUStorageTextureBindingLayout {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUStorageTextureBindingLayout>, ()> {
GPUStorageTextureBindingLayout::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUStorageTextureBindingLayout {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let access = &self.access;
rooted!(in(cx) let mut access_js = UndefinedValue());
access.to_jsval(cx, access_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "access", access_js.handle()).unwrap();
let format = &self.format;
rooted!(in(cx) let mut format_js = UndefinedValue());
format.to_jsval(cx, format_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "format", format_js.handle()).unwrap();
let viewDimension = &self.viewDimension;
rooted!(in(cx) let mut viewDimension_js = UndefinedValue());
viewDimension.to_jsval(cx, viewDimension_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "viewDimension", viewDimension_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUStorageTextureBindingLayout {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUBindGroupDescriptor {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase,
pub entries: Vec<crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUBindGroupEntry>,
pub layout: DomRoot<GPUBindGroupLayout>,
}
impl GPUBindGroupDescriptor {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUBindGroupDescriptor>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUBindGroupDescriptor {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
entries: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "entries", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"entries\".");
return Err(());
}
},
layout: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "layout", rval.handle_mut())? && !rval.is_undefined() {
if rval.handle().get().is_object() {
match root_from_handlevalue(rval.handle(), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUBindGroupLayout.");
return Err(());
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return Err(());
}
} else {
throw_type_error(*cx, "Missing required member \"layout\".");
return Err(());
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUBindGroupDescriptor {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUBindGroupDescriptor>, ()> {
GPUBindGroupDescriptor::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUBindGroupDescriptor {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
let entries = &self.entries;
rooted!(in(cx) let mut entries_js = UndefinedValue());
entries.to_jsval(cx, entries_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "entries", entries_js.handle()).unwrap();
let layout = &self.layout;
rooted!(in(cx) let mut layout_js = UndefinedValue());
layout.to_jsval(cx, layout_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "layout", layout_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUBindGroupDescriptor {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUBindGroupEntry {
pub binding: u32,
pub resource: UnionTypes::GPUSamplerOrGPUTextureViewOrGPUBufferBinding,
}
impl GPUBindGroupEntry {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUBindGroupEntry>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUBindGroupEntry {
binding: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "binding", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
throw_type_error(*cx, "Missing required member \"binding\".");
return Err(());
}
},
resource: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "resource", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"resource\".");
return Err(());
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUBindGroupEntry {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUBindGroupEntry>, ()> {
GPUBindGroupEntry::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUBindGroupEntry {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let binding = &self.binding;
rooted!(in(cx) let mut binding_js = UndefinedValue());
binding.to_jsval(cx, binding_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "binding", binding_js.handle()).unwrap();
let resource = &self.resource;
rooted!(in(cx) let mut resource_js = UndefinedValue());
resource.to_jsval(cx, resource_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "resource", resource_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUBindGroupEntry {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUBufferBinding {
pub buffer: DomRoot<GPUBuffer>,
pub offset: u64,
pub size: Option<u64>,
}
impl GPUBufferBinding {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUBufferBinding>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUBufferBinding {
buffer: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "buffer", rval.handle_mut())? && !rval.is_undefined() {
if rval.handle().get().is_object() {
match root_from_handlevalue(rval.handle(), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUBuffer.");
return Err(());
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return Err(());
}
} else {
throw_type_error(*cx, "Missing required member \"buffer\".");
return Err(());
}
},
offset: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "offset", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
0
}
},
size: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "size", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
})
} else {
None
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUBufferBinding {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUBufferBinding>, ()> {
GPUBufferBinding::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUBufferBinding {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let buffer = &self.buffer;
rooted!(in(cx) let mut buffer_js = UndefinedValue());
buffer.to_jsval(cx, buffer_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "buffer", buffer_js.handle()).unwrap();
let offset = &self.offset;
rooted!(in(cx) let mut offset_js = UndefinedValue());
offset.to_jsval(cx, offset_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "offset", offset_js.handle()).unwrap();
if let Some(ref size) = self.size {
rooted!(in(cx) let mut size_js = UndefinedValue());
size.to_jsval(cx, size_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "size", size_js.handle()).unwrap();
}
}
}
impl ToJSValConvertible for GPUBufferBinding {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUPipelineLayoutDescriptor {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase,
pub bindGroupLayouts: Vec<DomRoot<GPUBindGroupLayout>>,
}
impl GPUPipelineLayoutDescriptor {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUPipelineLayoutDescriptor>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUPipelineLayoutDescriptor {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
bindGroupLayouts: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "bindGroupLayouts", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"bindGroupLayouts\".");
return Err(());
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUPipelineLayoutDescriptor {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUPipelineLayoutDescriptor>, ()> {
GPUPipelineLayoutDescriptor::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUPipelineLayoutDescriptor {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
let bindGroupLayouts = &self.bindGroupLayouts;
rooted!(in(cx) let mut bindGroupLayouts_js = UndefinedValue());
bindGroupLayouts.to_jsval(cx, bindGroupLayouts_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "bindGroupLayouts", bindGroupLayouts_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUPipelineLayoutDescriptor {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
#[crown::unrooted_must_root_lint::must_root]
pub struct GPUShaderModuleDescriptor {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase,
pub code: USVString,
pub sourceMap: Option<RootedTraceableBox<Heap<*mut JSObject>>>,
}
impl GPUShaderModuleDescriptor {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<RootedTraceableBox<GPUShaderModuleDescriptor>>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = RootedTraceableBox::new(GPUShaderModuleDescriptor {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
code: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "code", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"code\".");
return Err(());
}
},
sourceMap: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "sourceMap", rval.handle_mut())? && !rval.is_undefined() {
Some(if rval.handle().get().is_object() {
RootedTraceableBox::from_box(Heap::boxed(rval.handle().get().to_object()))
} else {
throw_type_error(*cx, "Value is not an object.");
return Err(());
})
} else {
None
}
},
});
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for RootedTraceableBox<GPUShaderModuleDescriptor> {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<RootedTraceableBox<GPUShaderModuleDescriptor>>, ()> {
GPUShaderModuleDescriptor::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUShaderModuleDescriptor {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
let code = &self.code;
rooted!(in(cx) let mut code_js = UndefinedValue());
code.to_jsval(cx, code_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "code", code_js.handle()).unwrap();
if let Some(ref sourceMap) = self.sourceMap {
rooted!(in(cx) let mut sourceMap_js = UndefinedValue());
sourceMap.to_jsval(cx, sourceMap_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "sourceMap", sourceMap_js.handle()).unwrap();
}
}
}
impl ToJSValConvertible for GPUShaderModuleDescriptor {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUPipelineDescriptorBase {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase,
pub layout: UnionTypes::GPUPipelineLayoutOrGPUAutoLayoutMode,
}
impl GPUPipelineDescriptorBase {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUPipelineDescriptorBase>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUPipelineDescriptorBase {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
layout: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "layout", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"layout\".");
return Err(());
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUPipelineDescriptorBase {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUPipelineDescriptorBase>, ()> {
GPUPipelineDescriptorBase::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUPipelineDescriptorBase {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
let layout = &self.layout;
rooted!(in(cx) let mut layout_js = UndefinedValue());
layout.to_jsval(cx, layout_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "layout", layout_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUPipelineDescriptorBase {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUProgrammableStage {
pub entryPoint: USVString,
pub module: DomRoot<GPUShaderModule>,
}
impl GPUProgrammableStage {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUProgrammableStage>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUProgrammableStage {
entryPoint: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "entryPoint", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"entryPoint\".");
return Err(());
}
},
module: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "module", rval.handle_mut())? && !rval.is_undefined() {
if rval.handle().get().is_object() {
match root_from_handlevalue(rval.handle(), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUShaderModule.");
return Err(());
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return Err(());
}
} else {
throw_type_error(*cx, "Missing required member \"module\".");
return Err(());
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUProgrammableStage {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUProgrammableStage>, ()> {
GPUProgrammableStage::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUProgrammableStage {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let entryPoint = &self.entryPoint;
rooted!(in(cx) let mut entryPoint_js = UndefinedValue());
entryPoint.to_jsval(cx, entryPoint_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "entryPoint", entryPoint_js.handle()).unwrap();
let module = &self.module;
rooted!(in(cx) let mut module_js = UndefinedValue());
module.to_jsval(cx, module_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "module", module_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUProgrammableStage {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUComputePipelineDescriptor {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUPipelineDescriptorBase,
pub compute: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUProgrammableStage,
}
impl GPUComputePipelineDescriptor {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUComputePipelineDescriptor>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUComputePipelineDescriptor {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUPipelineDescriptorBase::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
compute: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "compute", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"compute\".");
return Err(());
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUComputePipelineDescriptor {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUComputePipelineDescriptor>, ()> {
GPUComputePipelineDescriptor::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUComputePipelineDescriptor {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
let compute = &self.compute;
rooted!(in(cx) let mut compute_js = UndefinedValue());
compute.to_jsval(cx, compute_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "compute", compute_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUComputePipelineDescriptor {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPURenderPipelineDescriptor {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUPipelineDescriptorBase,
pub depthStencil: Option<crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUDepthStencilState>,
pub fragment: Option<crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUFragmentState>,
pub multisample: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUMultisampleState,
pub primitive: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUPrimitiveState,
pub vertex: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUVertexState,
}
impl GPURenderPipelineDescriptor {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPURenderPipelineDescriptor>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPURenderPipelineDescriptor {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUPipelineDescriptorBase::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
depthStencil: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "depthStencil", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
})
} else {
None
}
},
fragment: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "fragment", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
})
} else {
None
}
},
multisample: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "multisample", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUMultisampleState::empty()
}
},
primitive: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "primitive", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUPrimitiveState::empty()
}
},
vertex: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "vertex", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"vertex\".");
return Err(());
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPURenderPipelineDescriptor {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPURenderPipelineDescriptor>, ()> {
GPURenderPipelineDescriptor::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPURenderPipelineDescriptor {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
if let Some(ref depthStencil) = self.depthStencil {
rooted!(in(cx) let mut depthStencil_js = UndefinedValue());
depthStencil.to_jsval(cx, depthStencil_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "depthStencil", depthStencil_js.handle()).unwrap();
}
if let Some(ref fragment) = self.fragment {
rooted!(in(cx) let mut fragment_js = UndefinedValue());
fragment.to_jsval(cx, fragment_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "fragment", fragment_js.handle()).unwrap();
}
let multisample = &self.multisample;
rooted!(in(cx) let mut multisample_js = UndefinedValue());
multisample.to_jsval(cx, multisample_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "multisample", multisample_js.handle()).unwrap();
let primitive = &self.primitive;
rooted!(in(cx) let mut primitive_js = UndefinedValue());
primitive.to_jsval(cx, primitive_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "primitive", primitive_js.handle()).unwrap();
let vertex = &self.vertex;
rooted!(in(cx) let mut vertex_js = UndefinedValue());
vertex.to_jsval(cx, vertex_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "vertex", vertex_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPURenderPipelineDescriptor {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUPrimitiveState {
pub clampDepth: bool,
pub cullMode: GPUCullMode,
pub frontFace: GPUFrontFace,
pub stripIndexFormat: Option<GPUIndexFormat>,
pub topology: GPUPrimitiveTopology,
}
impl GPUPrimitiveState {
pub fn empty() -> Self {
Self {
clampDepth: false,
cullMode: GPUCullMode::None,
frontFace: GPUFrontFace::Ccw,
stripIndexFormat: None,
topology: GPUPrimitiveTopology::Triangle_list,
}
}
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUPrimitiveState>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUPrimitiveState {
clampDepth: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "clampDepth", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
false
}
},
cullMode: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "cullMode", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUCullMode::None
}
},
frontFace: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "frontFace", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUFrontFace::Ccw
}
},
stripIndexFormat: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "stripIndexFormat", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
})
} else {
None
}
},
topology: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "topology", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUPrimitiveTopology::Triangle_list
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUPrimitiveState {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUPrimitiveState>, ()> {
GPUPrimitiveState::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUPrimitiveState {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let clampDepth = &self.clampDepth;
rooted!(in(cx) let mut clampDepth_js = UndefinedValue());
clampDepth.to_jsval(cx, clampDepth_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "clampDepth", clampDepth_js.handle()).unwrap();
let cullMode = &self.cullMode;
rooted!(in(cx) let mut cullMode_js = UndefinedValue());
cullMode.to_jsval(cx, cullMode_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "cullMode", cullMode_js.handle()).unwrap();
let frontFace = &self.frontFace;
rooted!(in(cx) let mut frontFace_js = UndefinedValue());
frontFace.to_jsval(cx, frontFace_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "frontFace", frontFace_js.handle()).unwrap();
if let Some(ref stripIndexFormat) = self.stripIndexFormat {
rooted!(in(cx) let mut stripIndexFormat_js = UndefinedValue());
stripIndexFormat.to_jsval(cx, stripIndexFormat_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "stripIndexFormat", stripIndexFormat_js.handle()).unwrap();
}
let topology = &self.topology;
rooted!(in(cx) let mut topology_js = UndefinedValue());
topology.to_jsval(cx, topology_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "topology", topology_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUPrimitiveState {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUMultisampleState {
pub alphaToCoverageEnabled: bool,
pub count: u32,
pub mask: u32,
}
impl GPUMultisampleState {
pub fn empty() -> Self {
Self {
alphaToCoverageEnabled: false,
count: 1,
mask: 4294967295,
}
}
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUMultisampleState>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUMultisampleState {
alphaToCoverageEnabled: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "alphaToCoverageEnabled", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
false
}
},
count: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "count", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
1
}
},
mask: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "mask", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
4294967295
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUMultisampleState {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUMultisampleState>, ()> {
GPUMultisampleState::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUMultisampleState {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let alphaToCoverageEnabled = &self.alphaToCoverageEnabled;
rooted!(in(cx) let mut alphaToCoverageEnabled_js = UndefinedValue());
alphaToCoverageEnabled.to_jsval(cx, alphaToCoverageEnabled_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "alphaToCoverageEnabled", alphaToCoverageEnabled_js.handle()).unwrap();
let count = &self.count;
rooted!(in(cx) let mut count_js = UndefinedValue());
count.to_jsval(cx, count_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "count", count_js.handle()).unwrap();
let mask = &self.mask;
rooted!(in(cx) let mut mask_js = UndefinedValue());
mask.to_jsval(cx, mask_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "mask", mask_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUMultisampleState {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUFragmentState {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUProgrammableStage,
pub targets: Vec<crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUColorTargetState>,
}
impl GPUFragmentState {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUFragmentState>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUFragmentState {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUProgrammableStage::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
targets: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "targets", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"targets\".");
return Err(());
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUFragmentState {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUFragmentState>, ()> {
GPUFragmentState::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUFragmentState {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
let targets = &self.targets;
rooted!(in(cx) let mut targets_js = UndefinedValue());
targets.to_jsval(cx, targets_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "targets", targets_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUFragmentState {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUColorTargetState {
pub blend: Option<crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUBlendState>,
pub format: GPUTextureFormat,
pub writeMask: u32,
}
impl GPUColorTargetState {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUColorTargetState>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUColorTargetState {
blend: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "blend", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
})
} else {
None
}
},
format: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "format", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"format\".");
return Err(());
}
},
writeMask: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "writeMask", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
15
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUColorTargetState {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUColorTargetState>, ()> {
GPUColorTargetState::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUColorTargetState {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
if let Some(ref blend) = self.blend {
rooted!(in(cx) let mut blend_js = UndefinedValue());
blend.to_jsval(cx, blend_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "blend", blend_js.handle()).unwrap();
}
let format = &self.format;
rooted!(in(cx) let mut format_js = UndefinedValue());
format.to_jsval(cx, format_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "format", format_js.handle()).unwrap();
let writeMask = &self.writeMask;
rooted!(in(cx) let mut writeMask_js = UndefinedValue());
writeMask.to_jsval(cx, writeMask_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "writeMask", writeMask_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUColorTargetState {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUBlendState {
pub alpha: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUBlendComponent,
pub color: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUBlendComponent,
}
impl GPUBlendState {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUBlendState>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUBlendState {
alpha: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "alpha", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"alpha\".");
return Err(());
}
},
color: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "color", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"color\".");
return Err(());
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUBlendState {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUBlendState>, ()> {
GPUBlendState::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUBlendState {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let alpha = &self.alpha;
rooted!(in(cx) let mut alpha_js = UndefinedValue());
alpha.to_jsval(cx, alpha_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "alpha", alpha_js.handle()).unwrap();
let color = &self.color;
rooted!(in(cx) let mut color_js = UndefinedValue());
color.to_jsval(cx, color_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "color", color_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUBlendState {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUBlendComponent {
pub dstFactor: GPUBlendFactor,
pub operation: GPUBlendOperation,
pub srcFactor: GPUBlendFactor,
}
impl GPUBlendComponent {
pub fn empty() -> Self {
Self {
dstFactor: GPUBlendFactor::Zero,
operation: GPUBlendOperation::Add,
srcFactor: GPUBlendFactor::One,
}
}
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUBlendComponent>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUBlendComponent {
dstFactor: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "dstFactor", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUBlendFactor::Zero
}
},
operation: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "operation", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUBlendOperation::Add
}
},
srcFactor: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "srcFactor", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUBlendFactor::One
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUBlendComponent {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUBlendComponent>, ()> {
GPUBlendComponent::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUBlendComponent {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let dstFactor = &self.dstFactor;
rooted!(in(cx) let mut dstFactor_js = UndefinedValue());
dstFactor.to_jsval(cx, dstFactor_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "dstFactor", dstFactor_js.handle()).unwrap();
let operation = &self.operation;
rooted!(in(cx) let mut operation_js = UndefinedValue());
operation.to_jsval(cx, operation_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "operation", operation_js.handle()).unwrap();
let srcFactor = &self.srcFactor;
rooted!(in(cx) let mut srcFactor_js = UndefinedValue());
srcFactor.to_jsval(cx, srcFactor_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "srcFactor", srcFactor_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUBlendComponent {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUDepthStencilState {
pub depthBias: i32,
pub depthBiasClamp: Finite<f32>,
pub depthBiasSlopeScale: Finite<f32>,
pub depthCompare: GPUCompareFunction,
pub depthWriteEnabled: bool,
pub format: GPUTextureFormat,
pub stencilBack: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUStencilFaceState,
pub stencilFront: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUStencilFaceState,
pub stencilReadMask: u32,
pub stencilWriteMask: u32,
}
impl GPUDepthStencilState {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUDepthStencilState>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUDepthStencilState {
depthBias: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "depthBias", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
0
}
},
depthBiasClamp: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "depthBiasClamp", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
Finite::wrap(0.0)
}
},
depthBiasSlopeScale: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "depthBiasSlopeScale", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
Finite::wrap(0.0)
}
},
depthCompare: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "depthCompare", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUCompareFunction::Always
}
},
depthWriteEnabled: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "depthWriteEnabled", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
false
}
},
format: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "format", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"format\".");
return Err(());
}
},
stencilBack: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "stencilBack", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUStencilFaceState::empty()
}
},
stencilFront: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "stencilFront", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUStencilFaceState::empty()
}
},
stencilReadMask: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "stencilReadMask", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
4294967295
}
},
stencilWriteMask: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "stencilWriteMask", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
4294967295
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUDepthStencilState {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUDepthStencilState>, ()> {
GPUDepthStencilState::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUDepthStencilState {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let depthBias = &self.depthBias;
rooted!(in(cx) let mut depthBias_js = UndefinedValue());
depthBias.to_jsval(cx, depthBias_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "depthBias", depthBias_js.handle()).unwrap();
let depthBiasClamp = &self.depthBiasClamp;
rooted!(in(cx) let mut depthBiasClamp_js = UndefinedValue());
depthBiasClamp.to_jsval(cx, depthBiasClamp_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "depthBiasClamp", depthBiasClamp_js.handle()).unwrap();
let depthBiasSlopeScale = &self.depthBiasSlopeScale;
rooted!(in(cx) let mut depthBiasSlopeScale_js = UndefinedValue());
depthBiasSlopeScale.to_jsval(cx, depthBiasSlopeScale_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "depthBiasSlopeScale", depthBiasSlopeScale_js.handle()).unwrap();
let depthCompare = &self.depthCompare;
rooted!(in(cx) let mut depthCompare_js = UndefinedValue());
depthCompare.to_jsval(cx, depthCompare_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "depthCompare", depthCompare_js.handle()).unwrap();
let depthWriteEnabled = &self.depthWriteEnabled;
rooted!(in(cx) let mut depthWriteEnabled_js = UndefinedValue());
depthWriteEnabled.to_jsval(cx, depthWriteEnabled_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "depthWriteEnabled", depthWriteEnabled_js.handle()).unwrap();
let format = &self.format;
rooted!(in(cx) let mut format_js = UndefinedValue());
format.to_jsval(cx, format_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "format", format_js.handle()).unwrap();
let stencilBack = &self.stencilBack;
rooted!(in(cx) let mut stencilBack_js = UndefinedValue());
stencilBack.to_jsval(cx, stencilBack_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "stencilBack", stencilBack_js.handle()).unwrap();
let stencilFront = &self.stencilFront;
rooted!(in(cx) let mut stencilFront_js = UndefinedValue());
stencilFront.to_jsval(cx, stencilFront_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "stencilFront", stencilFront_js.handle()).unwrap();
let stencilReadMask = &self.stencilReadMask;
rooted!(in(cx) let mut stencilReadMask_js = UndefinedValue());
stencilReadMask.to_jsval(cx, stencilReadMask_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "stencilReadMask", stencilReadMask_js.handle()).unwrap();
let stencilWriteMask = &self.stencilWriteMask;
rooted!(in(cx) let mut stencilWriteMask_js = UndefinedValue());
stencilWriteMask.to_jsval(cx, stencilWriteMask_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "stencilWriteMask", stencilWriteMask_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUDepthStencilState {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUStencilFaceState {
pub compare: GPUCompareFunction,
pub depthFailOp: GPUStencilOperation,
pub failOp: GPUStencilOperation,
pub passOp: GPUStencilOperation,
}
impl GPUStencilFaceState {
pub fn empty() -> Self {
Self {
compare: GPUCompareFunction::Always,
depthFailOp: GPUStencilOperation::Keep,
failOp: GPUStencilOperation::Keep,
passOp: GPUStencilOperation::Keep,
}
}
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUStencilFaceState>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUStencilFaceState {
compare: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "compare", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUCompareFunction::Always
}
},
depthFailOp: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "depthFailOp", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUStencilOperation::Keep
}
},
failOp: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "failOp", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUStencilOperation::Keep
}
},
passOp: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "passOp", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUStencilOperation::Keep
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUStencilFaceState {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUStencilFaceState>, ()> {
GPUStencilFaceState::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUStencilFaceState {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let compare = &self.compare;
rooted!(in(cx) let mut compare_js = UndefinedValue());
compare.to_jsval(cx, compare_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "compare", compare_js.handle()).unwrap();
let depthFailOp = &self.depthFailOp;
rooted!(in(cx) let mut depthFailOp_js = UndefinedValue());
depthFailOp.to_jsval(cx, depthFailOp_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "depthFailOp", depthFailOp_js.handle()).unwrap();
let failOp = &self.failOp;
rooted!(in(cx) let mut failOp_js = UndefinedValue());
failOp.to_jsval(cx, failOp_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "failOp", failOp_js.handle()).unwrap();
let passOp = &self.passOp;
rooted!(in(cx) let mut passOp_js = UndefinedValue());
passOp.to_jsval(cx, passOp_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "passOp", passOp_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUStencilFaceState {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUVertexState {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUProgrammableStage,
pub buffers: Vec<crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUVertexBufferLayout>,
}
impl GPUVertexState {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUVertexState>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUVertexState {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUProgrammableStage::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
buffers: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "buffers", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
Vec::new()
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUVertexState {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUVertexState>, ()> {
GPUVertexState::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUVertexState {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
let buffers = &self.buffers;
rooted!(in(cx) let mut buffers_js = UndefinedValue());
buffers.to_jsval(cx, buffers_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "buffers", buffers_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUVertexState {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUVertexBufferLayout {
pub arrayStride: u64,
pub attributes: Vec<crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUVertexAttribute>,
pub stepMode: GPUVertexStepMode,
}
impl GPUVertexBufferLayout {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUVertexBufferLayout>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUVertexBufferLayout {
arrayStride: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "arrayStride", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
throw_type_error(*cx, "Missing required member \"arrayStride\".");
return Err(());
}
},
attributes: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "attributes", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"attributes\".");
return Err(());
}
},
stepMode: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "stepMode", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUVertexStepMode::Vertex
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUVertexBufferLayout {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUVertexBufferLayout>, ()> {
GPUVertexBufferLayout::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUVertexBufferLayout {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let arrayStride = &self.arrayStride;
rooted!(in(cx) let mut arrayStride_js = UndefinedValue());
arrayStride.to_jsval(cx, arrayStride_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "arrayStride", arrayStride_js.handle()).unwrap();
let attributes = &self.attributes;
rooted!(in(cx) let mut attributes_js = UndefinedValue());
attributes.to_jsval(cx, attributes_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "attributes", attributes_js.handle()).unwrap();
let stepMode = &self.stepMode;
rooted!(in(cx) let mut stepMode_js = UndefinedValue());
stepMode.to_jsval(cx, stepMode_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "stepMode", stepMode_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUVertexBufferLayout {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUVertexAttribute {
pub format: GPUVertexFormat,
pub offset: u64,
pub shaderLocation: u32,
}
impl GPUVertexAttribute {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUVertexAttribute>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUVertexAttribute {
format: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "format", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"format\".");
return Err(());
}
},
offset: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "offset", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
throw_type_error(*cx, "Missing required member \"offset\".");
return Err(());
}
},
shaderLocation: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "shaderLocation", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
throw_type_error(*cx, "Missing required member \"shaderLocation\".");
return Err(());
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUVertexAttribute {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUVertexAttribute>, ()> {
GPUVertexAttribute::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUVertexAttribute {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let format = &self.format;
rooted!(in(cx) let mut format_js = UndefinedValue());
format.to_jsval(cx, format_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "format", format_js.handle()).unwrap();
let offset = &self.offset;
rooted!(in(cx) let mut offset_js = UndefinedValue());
offset.to_jsval(cx, offset_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "offset", offset_js.handle()).unwrap();
let shaderLocation = &self.shaderLocation;
rooted!(in(cx) let mut shaderLocation_js = UndefinedValue());
shaderLocation.to_jsval(cx, shaderLocation_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "shaderLocation", shaderLocation_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUVertexAttribute {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUImageDataLayout {
pub bytesPerRow: Option<u32>,
pub offset: u64,
pub rowsPerImage: Option<u32>,
}
impl GPUImageDataLayout {
pub fn empty() -> Self {
Self {
bytesPerRow: None,
offset: 0,
rowsPerImage: None,
}
}
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUImageDataLayout>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUImageDataLayout {
bytesPerRow: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "bytesPerRow", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
})
} else {
None
}
},
offset: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "offset", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
0
}
},
rowsPerImage: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "rowsPerImage", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
})
} else {
None
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUImageDataLayout {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUImageDataLayout>, ()> {
GPUImageDataLayout::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUImageDataLayout {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
if let Some(ref bytesPerRow) = self.bytesPerRow {
rooted!(in(cx) let mut bytesPerRow_js = UndefinedValue());
bytesPerRow.to_jsval(cx, bytesPerRow_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "bytesPerRow", bytesPerRow_js.handle()).unwrap();
}
let offset = &self.offset;
rooted!(in(cx) let mut offset_js = UndefinedValue());
offset.to_jsval(cx, offset_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "offset", offset_js.handle()).unwrap();
if let Some(ref rowsPerImage) = self.rowsPerImage {
rooted!(in(cx) let mut rowsPerImage_js = UndefinedValue());
rowsPerImage.to_jsval(cx, rowsPerImage_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "rowsPerImage", rowsPerImage_js.handle()).unwrap();
}
}
}
impl ToJSValConvertible for GPUImageDataLayout {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUImageCopyBuffer {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageDataLayout,
pub buffer: DomRoot<GPUBuffer>,
}
impl GPUImageCopyBuffer {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUImageCopyBuffer>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUImageCopyBuffer {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageDataLayout::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
buffer: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "buffer", rval.handle_mut())? && !rval.is_undefined() {
if rval.handle().get().is_object() {
match root_from_handlevalue(rval.handle(), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUBuffer.");
return Err(());
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return Err(());
}
} else {
throw_type_error(*cx, "Missing required member \"buffer\".");
return Err(());
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUImageCopyBuffer {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUImageCopyBuffer>, ()> {
GPUImageCopyBuffer::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUImageCopyBuffer {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
let buffer = &self.buffer;
rooted!(in(cx) let mut buffer_js = UndefinedValue());
buffer.to_jsval(cx, buffer_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "buffer", buffer_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUImageCopyBuffer {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUImageCopyTexture {
pub aspect: GPUTextureAspect,
pub mipLevel: u32,
pub origin: Option<UnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUOrigin3DDict>,
pub texture: DomRoot<GPUTexture>,
}
impl GPUImageCopyTexture {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUImageCopyTexture>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUImageCopyTexture {
aspect: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "aspect", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUTextureAspect::All
}
},
mipLevel: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "mipLevel", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
0
}
},
origin: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "origin", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
})
} else {
None
}
},
texture: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "texture", rval.handle_mut())? && !rval.is_undefined() {
if rval.handle().get().is_object() {
match root_from_handlevalue(rval.handle(), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUTexture.");
return Err(());
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return Err(());
}
} else {
throw_type_error(*cx, "Missing required member \"texture\".");
return Err(());
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUImageCopyTexture {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUImageCopyTexture>, ()> {
GPUImageCopyTexture::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUImageCopyTexture {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let aspect = &self.aspect;
rooted!(in(cx) let mut aspect_js = UndefinedValue());
aspect.to_jsval(cx, aspect_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "aspect", aspect_js.handle()).unwrap();
let mipLevel = &self.mipLevel;
rooted!(in(cx) let mut mipLevel_js = UndefinedValue());
mipLevel.to_jsval(cx, mipLevel_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "mipLevel", mipLevel_js.handle()).unwrap();
if let Some(ref origin) = self.origin {
rooted!(in(cx) let mut origin_js = UndefinedValue());
origin.to_jsval(cx, origin_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "origin", origin_js.handle()).unwrap();
}
let texture = &self.texture;
rooted!(in(cx) let mut texture_js = UndefinedValue());
texture.to_jsval(cx, texture_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "texture", texture_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUImageCopyTexture {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUImageCopyTextureTagged {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageCopyTexture,
pub premultipliedAlpha: bool,
}
impl GPUImageCopyTextureTagged {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUImageCopyTextureTagged>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUImageCopyTextureTagged {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageCopyTexture::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
premultipliedAlpha: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "premultipliedAlpha", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
false
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUImageCopyTextureTagged {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUImageCopyTextureTagged>, ()> {
GPUImageCopyTextureTagged::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUImageCopyTextureTagged {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
let premultipliedAlpha = &self.premultipliedAlpha;
rooted!(in(cx) let mut premultipliedAlpha_js = UndefinedValue());
premultipliedAlpha.to_jsval(cx, premultipliedAlpha_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "premultipliedAlpha", premultipliedAlpha_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUImageCopyTextureTagged {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUImageCopyExternalImage {
pub flipY: bool,
pub origin: UnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUOrigin2DDict,
pub source: UnionTypes::ImageBitmapOrHTMLCanvasElementOrOffscreenCanvas,
}
impl GPUImageCopyExternalImage {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUImageCopyExternalImage>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUImageCopyExternalImage {
flipY: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "flipY", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
false
}
},
origin: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "origin", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
UnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUOrigin2DDict::GPUOrigin2DDict(crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUOrigin2DDict::empty())
}
},
source: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "source", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"source\".");
return Err(());
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUImageCopyExternalImage {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUImageCopyExternalImage>, ()> {
GPUImageCopyExternalImage::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUImageCopyExternalImage {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let flipY = &self.flipY;
rooted!(in(cx) let mut flipY_js = UndefinedValue());
flipY.to_jsval(cx, flipY_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "flipY", flipY_js.handle()).unwrap();
let origin = &self.origin;
rooted!(in(cx) let mut origin_js = UndefinedValue());
origin.to_jsval(cx, origin_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "origin", origin_js.handle()).unwrap();
let source = &self.source;
rooted!(in(cx) let mut source_js = UndefinedValue());
source.to_jsval(cx, source_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "source", source_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUImageCopyExternalImage {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUCommandBufferDescriptor {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase,
}
impl GPUCommandBufferDescriptor {
pub fn empty() -> Self {
Self {
parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase::empty(),
}
}
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUCommandBufferDescriptor>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUCommandBufferDescriptor {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUCommandBufferDescriptor {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUCommandBufferDescriptor>, ()> {
GPUCommandBufferDescriptor::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUCommandBufferDescriptor {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
}
}
impl ToJSValConvertible for GPUCommandBufferDescriptor {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUImageBitmapCopyView {
pub origin: Option<UnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUOrigin2DDict>,
}
impl GPUImageBitmapCopyView {
pub fn empty() -> Self {
Self {
origin: None,
}
}
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUImageBitmapCopyView>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUImageBitmapCopyView {
origin: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "origin", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
})
} else {
None
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUImageBitmapCopyView {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUImageBitmapCopyView>, ()> {
GPUImageBitmapCopyView::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUImageBitmapCopyView {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
if let Some(ref origin) = self.origin {
rooted!(in(cx) let mut origin_js = UndefinedValue());
origin.to_jsval(cx, origin_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "origin", origin_js.handle()).unwrap();
}
}
}
impl ToJSValConvertible for GPUImageBitmapCopyView {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUCommandEncoderDescriptor {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase,
pub measureExecutionTime: bool,
}
impl GPUCommandEncoderDescriptor {
pub fn empty() -> Self {
Self {
parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase::empty(),
measureExecutionTime: false,
}
}
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUCommandEncoderDescriptor>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUCommandEncoderDescriptor {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
measureExecutionTime: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "measureExecutionTime", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
false
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUCommandEncoderDescriptor {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUCommandEncoderDescriptor>, ()> {
GPUCommandEncoderDescriptor::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUCommandEncoderDescriptor {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
let measureExecutionTime = &self.measureExecutionTime;
rooted!(in(cx) let mut measureExecutionTime_js = UndefinedValue());
measureExecutionTime.to_jsval(cx, measureExecutionTime_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "measureExecutionTime", measureExecutionTime_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUCommandEncoderDescriptor {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUComputePassDescriptor {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase,
}
impl GPUComputePassDescriptor {
pub fn empty() -> Self {
Self {
parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase::empty(),
}
}
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUComputePassDescriptor>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUComputePassDescriptor {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUComputePassDescriptor {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUComputePassDescriptor>, ()> {
GPUComputePassDescriptor::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUComputePassDescriptor {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
}
}
impl ToJSValConvertible for GPUComputePassDescriptor {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPURenderPassDescriptor {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase,
pub colorAttachments: Vec<crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderPassColorAttachment>,
pub depthStencilAttachment: Option<crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderPassDepthStencilAttachment>,
pub occlusionQuerySet: Option<DomRoot<GPUQuerySet>>,
}
impl GPURenderPassDescriptor {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPURenderPassDescriptor>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPURenderPassDescriptor {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
colorAttachments: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "colorAttachments", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"colorAttachments\".");
return Err(());
}
},
depthStencilAttachment: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "depthStencilAttachment", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
})
} else {
None
}
},
occlusionQuerySet: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "occlusionQuerySet", rval.handle_mut())? && !rval.is_undefined() {
Some(if rval.handle().get().is_object() {
match root_from_handlevalue(rval.handle(), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUQuerySet.");
return Err(());
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return Err(());
})
} else {
None
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPURenderPassDescriptor {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPURenderPassDescriptor>, ()> {
GPURenderPassDescriptor::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPURenderPassDescriptor {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
let colorAttachments = &self.colorAttachments;
rooted!(in(cx) let mut colorAttachments_js = UndefinedValue());
colorAttachments.to_jsval(cx, colorAttachments_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "colorAttachments", colorAttachments_js.handle()).unwrap();
if let Some(ref depthStencilAttachment) = self.depthStencilAttachment {
rooted!(in(cx) let mut depthStencilAttachment_js = UndefinedValue());
depthStencilAttachment.to_jsval(cx, depthStencilAttachment_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "depthStencilAttachment", depthStencilAttachment_js.handle()).unwrap();
}
if let Some(ref occlusionQuerySet) = self.occlusionQuerySet {
rooted!(in(cx) let mut occlusionQuerySet_js = UndefinedValue());
occlusionQuerySet.to_jsval(cx, occlusionQuerySet_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "occlusionQuerySet", occlusionQuerySet_js.handle()).unwrap();
}
}
}
impl ToJSValConvertible for GPURenderPassDescriptor {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPURenderPassColorAttachment {
pub clearValue: Option<UnionTypes::DoubleSequenceOrGPUColorDict>,
pub loadOp: GPULoadOp,
pub resolveTarget: Option<DomRoot<GPUTextureView>>,
pub storeOp: GPUStoreOp,
pub view: DomRoot<GPUTextureView>,
}
impl GPURenderPassColorAttachment {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPURenderPassColorAttachment>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPURenderPassColorAttachment {
clearValue: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "clearValue", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
})
} else {
None
}
},
loadOp: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "loadOp", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"loadOp\".");
return Err(());
}
},
resolveTarget: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "resolveTarget", rval.handle_mut())? && !rval.is_undefined() {
Some(if rval.handle().get().is_object() {
match root_from_handlevalue(rval.handle(), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUTextureView.");
return Err(());
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return Err(());
})
} else {
None
}
},
storeOp: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "storeOp", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"storeOp\".");
return Err(());
}
},
view: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "view", rval.handle_mut())? && !rval.is_undefined() {
if rval.handle().get().is_object() {
match root_from_handlevalue(rval.handle(), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUTextureView.");
return Err(());
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return Err(());
}
} else {
throw_type_error(*cx, "Missing required member \"view\".");
return Err(());
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPURenderPassColorAttachment {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPURenderPassColorAttachment>, ()> {
GPURenderPassColorAttachment::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPURenderPassColorAttachment {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
if let Some(ref clearValue) = self.clearValue {
rooted!(in(cx) let mut clearValue_js = UndefinedValue());
clearValue.to_jsval(cx, clearValue_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "clearValue", clearValue_js.handle()).unwrap();
}
let loadOp = &self.loadOp;
rooted!(in(cx) let mut loadOp_js = UndefinedValue());
loadOp.to_jsval(cx, loadOp_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "loadOp", loadOp_js.handle()).unwrap();
if let Some(ref resolveTarget) = self.resolveTarget {
rooted!(in(cx) let mut resolveTarget_js = UndefinedValue());
resolveTarget.to_jsval(cx, resolveTarget_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "resolveTarget", resolveTarget_js.handle()).unwrap();
}
let storeOp = &self.storeOp;
rooted!(in(cx) let mut storeOp_js = UndefinedValue());
storeOp.to_jsval(cx, storeOp_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "storeOp", storeOp_js.handle()).unwrap();
let view = &self.view;
rooted!(in(cx) let mut view_js = UndefinedValue());
view.to_jsval(cx, view_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "view", view_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPURenderPassColorAttachment {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPURenderPassDepthStencilAttachment {
pub depthClearValue: Option<Finite<f32>>,
pub depthLoadOp: Option<GPULoadOp>,
pub depthReadOnly: bool,
pub depthStoreOp: Option<GPUStoreOp>,
pub stencilClearValue: u32,
pub stencilLoadOp: Option<GPULoadOp>,
pub stencilReadOnly: bool,
pub stencilStoreOp: Option<GPUStoreOp>,
pub view: DomRoot<GPUTextureView>,
}
impl GPURenderPassDepthStencilAttachment {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPURenderPassDepthStencilAttachment>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPURenderPassDepthStencilAttachment {
depthClearValue: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "depthClearValue", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
})
} else {
None
}
},
depthLoadOp: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "depthLoadOp", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
})
} else {
None
}
},
depthReadOnly: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "depthReadOnly", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
false
}
},
depthStoreOp: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "depthStoreOp", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
})
} else {
None
}
},
stencilClearValue: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "stencilClearValue", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
0
}
},
stencilLoadOp: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "stencilLoadOp", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
})
} else {
None
}
},
stencilReadOnly: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "stencilReadOnly", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
false
}
},
stencilStoreOp: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "stencilStoreOp", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
})
} else {
None
}
},
view: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "view", rval.handle_mut())? && !rval.is_undefined() {
if rval.handle().get().is_object() {
match root_from_handlevalue(rval.handle(), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUTextureView.");
return Err(());
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return Err(());
}
} else {
throw_type_error(*cx, "Missing required member \"view\".");
return Err(());
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPURenderPassDepthStencilAttachment {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPURenderPassDepthStencilAttachment>, ()> {
GPURenderPassDepthStencilAttachment::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPURenderPassDepthStencilAttachment {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
if let Some(ref depthClearValue) = self.depthClearValue {
rooted!(in(cx) let mut depthClearValue_js = UndefinedValue());
depthClearValue.to_jsval(cx, depthClearValue_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "depthClearValue", depthClearValue_js.handle()).unwrap();
}
if let Some(ref depthLoadOp) = self.depthLoadOp {
rooted!(in(cx) let mut depthLoadOp_js = UndefinedValue());
depthLoadOp.to_jsval(cx, depthLoadOp_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "depthLoadOp", depthLoadOp_js.handle()).unwrap();
}
let depthReadOnly = &self.depthReadOnly;
rooted!(in(cx) let mut depthReadOnly_js = UndefinedValue());
depthReadOnly.to_jsval(cx, depthReadOnly_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "depthReadOnly", depthReadOnly_js.handle()).unwrap();
if let Some(ref depthStoreOp) = self.depthStoreOp {
rooted!(in(cx) let mut depthStoreOp_js = UndefinedValue());
depthStoreOp.to_jsval(cx, depthStoreOp_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "depthStoreOp", depthStoreOp_js.handle()).unwrap();
}
let stencilClearValue = &self.stencilClearValue;
rooted!(in(cx) let mut stencilClearValue_js = UndefinedValue());
stencilClearValue.to_jsval(cx, stencilClearValue_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "stencilClearValue", stencilClearValue_js.handle()).unwrap();
if let Some(ref stencilLoadOp) = self.stencilLoadOp {
rooted!(in(cx) let mut stencilLoadOp_js = UndefinedValue());
stencilLoadOp.to_jsval(cx, stencilLoadOp_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "stencilLoadOp", stencilLoadOp_js.handle()).unwrap();
}
let stencilReadOnly = &self.stencilReadOnly;
rooted!(in(cx) let mut stencilReadOnly_js = UndefinedValue());
stencilReadOnly.to_jsval(cx, stencilReadOnly_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "stencilReadOnly", stencilReadOnly_js.handle()).unwrap();
if let Some(ref stencilStoreOp) = self.stencilStoreOp {
rooted!(in(cx) let mut stencilStoreOp_js = UndefinedValue());
stencilStoreOp.to_jsval(cx, stencilStoreOp_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "stencilStoreOp", stencilStoreOp_js.handle()).unwrap();
}
let view = &self.view;
rooted!(in(cx) let mut view_js = UndefinedValue());
view.to_jsval(cx, view_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "view", view_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPURenderPassDepthStencilAttachment {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPURenderPassLayout {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase,
pub colorFormats: Vec<GPUTextureFormat>,
pub depthStencilFormat: Option<GPUTextureFormat>,
pub sampleCount: u32,
}
impl GPURenderPassLayout {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPURenderPassLayout>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPURenderPassLayout {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
colorFormats: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "colorFormats", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"colorFormats\".");
return Err(());
}
},
depthStencilFormat: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "depthStencilFormat", rval.handle_mut())? && !rval.is_undefined() {
Some(match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
})
} else {
None
}
},
sampleCount: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "sampleCount", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
1
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPURenderPassLayout {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPURenderPassLayout>, ()> {
GPURenderPassLayout::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPURenderPassLayout {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
let colorFormats = &self.colorFormats;
rooted!(in(cx) let mut colorFormats_js = UndefinedValue());
colorFormats.to_jsval(cx, colorFormats_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "colorFormats", colorFormats_js.handle()).unwrap();
if let Some(ref depthStencilFormat) = self.depthStencilFormat {
rooted!(in(cx) let mut depthStencilFormat_js = UndefinedValue());
depthStencilFormat.to_jsval(cx, depthStencilFormat_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "depthStencilFormat", depthStencilFormat_js.handle()).unwrap();
}
let sampleCount = &self.sampleCount;
rooted!(in(cx) let mut sampleCount_js = UndefinedValue());
sampleCount.to_jsval(cx, sampleCount_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "sampleCount", sampleCount_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPURenderPassLayout {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPURenderBundleDescriptor {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase,
}
impl GPURenderBundleDescriptor {
pub fn empty() -> Self {
Self {
parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase::empty(),
}
}
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPURenderBundleDescriptor>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPURenderBundleDescriptor {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPURenderBundleDescriptor {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPURenderBundleDescriptor>, ()> {
GPURenderBundleDescriptor::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPURenderBundleDescriptor {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
}
}
impl ToJSValConvertible for GPURenderBundleDescriptor {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPURenderBundleEncoderDescriptor {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderPassLayout,
pub depthReadOnly: bool,
pub stencilReadOnly: bool,
}
impl GPURenderBundleEncoderDescriptor {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPURenderBundleEncoderDescriptor>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPURenderBundleEncoderDescriptor {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderPassLayout::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
depthReadOnly: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "depthReadOnly", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
false
}
},
stencilReadOnly: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "stencilReadOnly", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
false
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPURenderBundleEncoderDescriptor {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPURenderBundleEncoderDescriptor>, ()> {
GPURenderBundleEncoderDescriptor::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPURenderBundleEncoderDescriptor {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
let depthReadOnly = &self.depthReadOnly;
rooted!(in(cx) let mut depthReadOnly_js = UndefinedValue());
depthReadOnly.to_jsval(cx, depthReadOnly_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "depthReadOnly", depthReadOnly_js.handle()).unwrap();
let stencilReadOnly = &self.stencilReadOnly;
rooted!(in(cx) let mut stencilReadOnly_js = UndefinedValue());
stencilReadOnly.to_jsval(cx, stencilReadOnly_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "stencilReadOnly", stencilReadOnly_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPURenderBundleEncoderDescriptor {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUQuerySetDescriptor {
pub parent: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase,
pub count: u32,
pub pipelineStatistics: Vec<GPUPipelineStatisticName>,
pub type_: GPUQueryType,
}
impl GPUQuerySetDescriptor {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUQuerySetDescriptor>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUQuerySetDescriptor {
parent: {
match crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
count: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "count", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
throw_type_error(*cx, "Missing required member \"count\".");
return Err(());
}
},
pipelineStatistics: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "pipelineStatistics", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
Vec::new()
}
},
type_: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "type", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"type\".");
return Err(());
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUQuerySetDescriptor {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUQuerySetDescriptor>, ()> {
GPUQuerySetDescriptor::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUQuerySetDescriptor {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
let count = &self.count;
rooted!(in(cx) let mut count_js = UndefinedValue());
count.to_jsval(cx, count_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "count", count_js.handle()).unwrap();
let pipelineStatistics = &self.pipelineStatistics;
rooted!(in(cx) let mut pipelineStatistics_js = UndefinedValue());
pipelineStatistics.to_jsval(cx, pipelineStatistics_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "pipelineStatistics", pipelineStatistics_js.handle()).unwrap();
let type_ = &self.type_;
rooted!(in(cx) let mut type__js = UndefinedValue());
type_.to_jsval(cx, type__js.handle_mut());
set_dictionary_property(cx, obj.handle(), "type", type__js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUQuerySetDescriptor {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUCanvasConfiguration {
pub alphaMode: GPUCanvasAlphaMode,
pub device: DomRoot<GPUDevice>,
pub format: GPUTextureFormat,
pub usage: u32,
pub viewFormats: Vec<GPUTextureFormat>,
}
impl GPUCanvasConfiguration {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUCanvasConfiguration>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUCanvasConfiguration {
alphaMode: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "alphaMode", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
GPUCanvasAlphaMode::Opaque
}
},
device: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "device", rval.handle_mut())? && !rval.is_undefined() {
if rval.handle().get().is_object() {
match root_from_handlevalue(rval.handle(), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUDevice.");
return Err(());
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return Err(());
}
} else {
throw_type_error(*cx, "Missing required member \"device\".");
return Err(());
}
},
format: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "format", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) { Err(_) => { return Err(());
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"format\".");
return Err(());
}
},
usage: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "usage", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
16
}
},
viewFormats: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "viewFormats", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
Vec::new()
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUCanvasConfiguration {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUCanvasConfiguration>, ()> {
GPUCanvasConfiguration::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUCanvasConfiguration {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let alphaMode = &self.alphaMode;
rooted!(in(cx) let mut alphaMode_js = UndefinedValue());
alphaMode.to_jsval(cx, alphaMode_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "alphaMode", alphaMode_js.handle()).unwrap();
let device = &self.device;
rooted!(in(cx) let mut device_js = UndefinedValue());
device.to_jsval(cx, device_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "device", device_js.handle()).unwrap();
let format = &self.format;
rooted!(in(cx) let mut format_js = UndefinedValue());
format.to_jsval(cx, format_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "format", format_js.handle()).unwrap();
let usage = &self.usage;
rooted!(in(cx) let mut usage_js = UndefinedValue());
usage.to_jsval(cx, usage_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "usage", usage_js.handle()).unwrap();
let viewFormats = &self.viewFormats;
rooted!(in(cx) let mut viewFormats_js = UndefinedValue());
viewFormats.to_jsval(cx, viewFormats_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "viewFormats", viewFormats_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUCanvasConfiguration {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUUncapturedErrorEventInit {
pub parent: crate::dom::bindings::codegen::Bindings::EventBinding::EventInit,
pub error: UnionTypes::GPUOutOfMemoryErrorOrGPUValidationError,
}
impl GPUUncapturedErrorEventInit {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUUncapturedErrorEventInit>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUUncapturedErrorEventInit {
parent: {
match crate::dom::bindings::codegen::Bindings::EventBinding::EventInit::new(cx, val)? {
ConversionResult::Success(v) => v,
ConversionResult::Failure(error) => {
throw_type_error(*cx, &error);
return Err(());
}
}
},
error: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "error", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
},
}
} else {
throw_type_error(*cx, "Missing required member \"error\".");
return Err(());
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUUncapturedErrorEventInit {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUUncapturedErrorEventInit>, ()> {
GPUUncapturedErrorEventInit::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUUncapturedErrorEventInit {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
self.parent.to_jsobject(cx, obj);
let error = &self.error;
rooted!(in(cx) let mut error_js = UndefinedValue());
error.to_jsval(cx, error_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "error", error_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUUncapturedErrorEventInit {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUColorDict {
pub a: Finite<f64>,
pub b: Finite<f64>,
pub g: Finite<f64>,
pub r: Finite<f64>,
}
impl GPUColorDict {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUColorDict>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUColorDict {
a: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "a", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
throw_type_error(*cx, "Missing required member \"a\".");
return Err(());
}
},
b: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "b", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
throw_type_error(*cx, "Missing required member \"b\".");
return Err(());
}
},
g: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "g", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
throw_type_error(*cx, "Missing required member \"g\".");
return Err(());
}
},
r: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "r", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
throw_type_error(*cx, "Missing required member \"r\".");
return Err(());
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUColorDict {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUColorDict>, ()> {
GPUColorDict::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUColorDict {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let a = &self.a;
rooted!(in(cx) let mut a_js = UndefinedValue());
a.to_jsval(cx, a_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "a", a_js.handle()).unwrap();
let b = &self.b;
rooted!(in(cx) let mut b_js = UndefinedValue());
b.to_jsval(cx, b_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "b", b_js.handle()).unwrap();
let g = &self.g;
rooted!(in(cx) let mut g_js = UndefinedValue());
g.to_jsval(cx, g_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "g", g_js.handle()).unwrap();
let r = &self.r;
rooted!(in(cx) let mut r_js = UndefinedValue());
r.to_jsval(cx, r_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "r", r_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUColorDict {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUOrigin2DDict {
pub x: u32,
pub y: u32,
}
impl GPUOrigin2DDict {
pub fn empty() -> Self {
Self {
x: 0,
y: 0,
}
}
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUOrigin2DDict>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUOrigin2DDict {
x: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "x", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
0
}
},
y: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "y", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
0
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUOrigin2DDict {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUOrigin2DDict>, ()> {
GPUOrigin2DDict::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUOrigin2DDict {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let x = &self.x;
rooted!(in(cx) let mut x_js = UndefinedValue());
x.to_jsval(cx, x_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "x", x_js.handle()).unwrap();
let y = &self.y;
rooted!(in(cx) let mut y_js = UndefinedValue());
y.to_jsval(cx, y_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "y", y_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUOrigin2DDict {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUOrigin3DDict {
pub x: u32,
pub y: u32,
pub z: u32,
}
impl GPUOrigin3DDict {
pub fn empty() -> Self {
Self {
x: 0,
y: 0,
z: 0,
}
}
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUOrigin3DDict>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUOrigin3DDict {
x: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "x", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
0
}
},
y: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "y", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
0
}
},
z: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "z", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
0
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUOrigin3DDict {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUOrigin3DDict>, ()> {
GPUOrigin3DDict::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUOrigin3DDict {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let x = &self.x;
rooted!(in(cx) let mut x_js = UndefinedValue());
x.to_jsval(cx, x_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "x", x_js.handle()).unwrap();
let y = &self.y;
rooted!(in(cx) let mut y_js = UndefinedValue());
y.to_jsval(cx, y_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "y", y_js.handle()).unwrap();
let z = &self.z;
rooted!(in(cx) let mut z_js = UndefinedValue());
z.to_jsval(cx, z_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "z", z_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUOrigin3DDict {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
#[derive(JSTraceable)]
pub struct GPUExtent3DDict {
pub depthOrArrayLayers: u32,
pub height: u32,
pub width: u32,
}
impl GPUExtent3DDict {
pub fn new(cx: SafeJSContext, val: HandleValue)
-> Result<ConversionResult<GPUExtent3DDict>, ()> {
unsafe {
let object = if val.get().is_null_or_undefined() {
ptr::null_mut()
} else if val.get().is_object() {
val.get().to_object()
} else {
return Ok(ConversionResult::Failure("Value is not an object.".into()));
};
rooted!(in(*cx) let object = object);
let dictionary = GPUExtent3DDict {
depthOrArrayLayers: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "depthOrArrayLayers", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
1
}
},
height: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "height", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
1
}
},
width: {
rooted!(in(*cx) let mut rval = UndefinedValue());
if get_dictionary_property(*cx, object.handle(), "width", rval.handle_mut())? && !rval.is_undefined() {
match FromJSValConvertible::from_jsval(*cx, rval.handle(), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return Err(());
}
_ => { return Err(());
}
}
} else {
throw_type_error(*cx, "Missing required member \"width\".");
return Err(());
}
},
};
Ok(ConversionResult::Success(dictionary))
}
}
}
impl FromJSValConvertible for GPUExtent3DDict {
type Config = ();
unsafe fn from_jsval(cx: *mut JSContext, value: HandleValue, _option: ())
-> Result<ConversionResult<GPUExtent3DDict>, ()> {
GPUExtent3DDict::new(SafeJSContext::from_ptr(cx), value)
}
}
impl GPUExtent3DDict {
pub(crate) unsafe fn to_jsobject(&self, cx: *mut JSContext, mut obj: MutableHandleObject) {
let depthOrArrayLayers = &self.depthOrArrayLayers;
rooted!(in(cx) let mut depthOrArrayLayers_js = UndefinedValue());
depthOrArrayLayers.to_jsval(cx, depthOrArrayLayers_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "depthOrArrayLayers", depthOrArrayLayers_js.handle()).unwrap();
let height = &self.height;
rooted!(in(cx) let mut height_js = UndefinedValue());
height.to_jsval(cx, height_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "height", height_js.handle()).unwrap();
let width = &self.width;
rooted!(in(cx) let mut width_js = UndefinedValue());
width.to_jsval(cx, width_js.handle_mut());
set_dictionary_property(cx, obj.handle(), "width", width_js.handle()).unwrap();
}
}
impl ToJSValConvertible for GPUExtent3DDict {
unsafe fn to_jsval(&self, cx: *mut JSContext, mut rval: MutableHandleValue) {
rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
self.to_jsobject(cx, obj.handle_mut());
rval.set(ObjectOrNullValue(obj.get()))
}
}
pub use self::GPU_Binding::{Wrap as GPUWrap, GPUMethods, GetProtoObject as GPUGetProtoObject, DefineDOMInterface as GPUDefineDOMInterface};
pub mod GPU_Binding {
use crate::dom;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUPowerPreference;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUPowerPreferenceValues;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURequestAdapterOptions;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureFormat;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureFormatValues;
use crate::dom::bindings::import::module::*;
use crate::dom::promise::Promise;
use crate::dom::types::GPU;
unsafe extern fn requestAdapter(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPU);
let args = &*args;
let argc = args.argc_;
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURequestAdapterOptions = if args.get(0).is_undefined() {
crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURequestAdapterOptions::empty()
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
}
};
let result: Rc<Promise> = this.RequestAdapter(&arg0, InRealm::in_realm(&AlreadyInRealm::assert_for_cx(cx)));
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const requestAdapter_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(requestAdapter)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPU as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn getPreferredCanvasFormat(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPU);
let args = &*args;
let argc = args.argc_;
let result: GPUTextureFormat = this.GetPreferredCanvasFormat();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const getPreferredCanvasFormat_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(getPreferredCanvasFormat)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPU as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPU>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPU>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPU\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPU, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPU> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPU {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPU>) -> DomRoot<GPU> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpu::GPU {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPU {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPU {
fn eq(&self, other: &GPU) -> bool {
self as *const GPU == other
}
}
pub trait GPUMethods {
fn RequestAdapter(&self, options: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURequestAdapterOptions, _comp: InRealm) -> Rc<Promise>;
fn GetPreferredCanvasFormat(&self) -> GPUTextureFormat;
}
const sMethods_specs: &[&[JSFunctionSpec]] = &[
&[
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"requestAdapter\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &requestAdapter_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"getPreferredCanvasFormat\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &getPreferredCanvasFormat_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: ptr::null() },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 0,
flags: 0,
selfHostedName: ptr::null()
}]
];
const sMethods: &[Guard<&[JSFunctionSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sMethods_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sMethods_specs[0])
];
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPU\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Satisfied, sAttributes_specs[0])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPU), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPU() {\n [native code]\n}",
PrototypeList::ID::GPU,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPU), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
sMethods,
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPU as usize].is_null());
(*cache)[PrototypeList::ID::GPU as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPU as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPU\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUAdapter_Binding::{Wrap as GPUAdapterWrap, GPUAdapterMethods, GetProtoObject as GPUAdapterGetProtoObject, DefineDOMInterface as GPUAdapterDefineDOMInterface};
pub mod GPUAdapter_Binding {
use crate::dom;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUDeviceDescriptor;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUFeatureName;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUFeatureNameValues;
use crate::dom::bindings::import::module::*;
use crate::dom::bindings::record::Record;
use crate::dom::promise::Promise;
use crate::dom::types::GPUAdapter;
use crate::dom::types::GPUSupportedFeatures;
use crate::dom::types::GPUSupportedLimits;
unsafe extern fn get_features(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUAdapter);
let result: DomRoot<GPUSupportedFeatures> = this.Features();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const features_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_features)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUAdapter as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasNone as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
true,
true,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_limits(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUAdapter);
let result: DomRoot<GPUSupportedLimits> = this.Limits();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const limits_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_limits)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUAdapter as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasNone as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
true,
true,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_isFallbackAdapter(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUAdapter);
let result: bool = this.IsFallbackAdapter();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const isFallbackAdapter_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_isFallbackAdapter)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUAdapter as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_BOOLEAN as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn requestDevice(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUAdapter);
let args = &*args;
let argc = args.argc_;
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUDeviceDescriptor = if args.get(0).is_undefined() {
crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUDeviceDescriptor::empty()
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
}
};
let result: Rc<Promise> = this.RequestDevice(&arg0, InRealm::in_realm(&AlreadyInRealm::assert_for_cx(cx)));
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const requestDevice_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(requestDevice)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUAdapter as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn requestAdapterInfo(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUAdapter);
let args = &*args;
let argc = args.argc_;
let arg0: Vec<DOMString> = if args.get(0).is_undefined() {
Vec::new()
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
}
};
let result: Rc<Promise> = this.RequestAdapterInfo(arg0, InRealm::in_realm(&AlreadyInRealm::assert_for_cx(cx)));
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const requestAdapterInfo_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(requestAdapterInfo)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUAdapter as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUAdapter>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUAdapter>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUAdapter\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUAdapter, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUAdapter> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUAdapter {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUAdapter>) -> DomRoot<GPUAdapter> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpuadapter::GPUAdapter {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUAdapter {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUAdapter {
fn eq(&self, other: &GPUAdapter) -> bool {
self as *const GPUAdapter == other
}
}
pub trait GPUAdapterMethods {
fn Features(&self) -> DomRoot<GPUSupportedFeatures>;
fn Limits(&self) -> DomRoot<GPUSupportedLimits>;
fn IsFallbackAdapter(&self) -> bool;
fn RequestDevice(&self, descriptor: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUDeviceDescriptor, _comp: InRealm) -> Rc<Promise>;
fn RequestAdapterInfo(&self, unmaskHints: Vec<DOMString>, _comp: InRealm) -> Rc<Promise>;
}
const sMethods_specs: &[&[JSFunctionSpec]] = &[
&[
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"requestDevice\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &requestDevice_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"requestAdapterInfo\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &requestAdapterInfo_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: ptr::null() },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 0,
flags: 0,
selfHostedName: ptr::null()
}]
];
const sMethods: &[Guard<&[JSFunctionSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sMethods_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sMethods_specs[0])
];
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"features\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &features_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"limits\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &limits_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"isFallbackAdapter\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &isFallbackAdapter_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUAdapter\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUAdapter), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUAdapterPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUAdapter() {\n [native code]\n}",
PrototypeList::ID::GPUAdapter,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUAdapter), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
sMethods,
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUAdapter as usize].is_null());
(*cache)[PrototypeList::ID::GPUAdapter as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUAdapter as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUAdapter\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUAdapterInfo_Binding::{Wrap as GPUAdapterInfoWrap, GPUAdapterInfoMethods, GetProtoObject as GPUAdapterInfoGetProtoObject, DefineDOMInterface as GPUAdapterInfoDefineDOMInterface};
pub mod GPUAdapterInfo_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUAdapterInfo;
unsafe extern fn get_vendor(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUAdapterInfo);
let result: DOMString = this.Vendor();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const vendor_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_vendor)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUAdapterInfo as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_architecture(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUAdapterInfo);
let result: DOMString = this.Architecture();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const architecture_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_architecture)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUAdapterInfo as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_device(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUAdapterInfo);
let result: DOMString = this.Device();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const device_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_device)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUAdapterInfo as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_description(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUAdapterInfo);
let result: DOMString = this.Description();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const description_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_description)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUAdapterInfo as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUAdapterInfo>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUAdapterInfo>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUAdapterInfo\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUAdapterInfo, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUAdapterInfo> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUAdapterInfo {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUAdapterInfo>) -> DomRoot<GPUAdapterInfo> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpuadapterinfo::GPUAdapterInfo {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUAdapterInfo {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUAdapterInfo {
fn eq(&self, other: &GPUAdapterInfo) -> bool {
self as *const GPUAdapterInfo == other
}
}
pub trait GPUAdapterInfoMethods {
fn Vendor(&self) -> DOMString;
fn Architecture(&self) -> DOMString;
fn Device(&self) -> DOMString;
fn Description(&self) -> DOMString;
}
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"vendor\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &vendor_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"architecture\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &architecture_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"device\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &device_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"description\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &description_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUAdapterInfo\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUAdapterInfo), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUAdapterInfoPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUAdapterInfo() {\n [native code]\n}",
PrototypeList::ID::GPUAdapterInfo,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUAdapterInfo), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
&[],
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUAdapterInfo as usize].is_null());
(*cache)[PrototypeList::ID::GPUAdapterInfo as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUAdapterInfo as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUAdapterInfo\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUBindGroup_Binding::{Wrap as GPUBindGroupWrap, GPUBindGroupMethods, GetProtoObject as GPUBindGroupGetProtoObject, DefineDOMInterface as GPUBindGroupDefineDOMInterface};
pub mod GPUBindGroup_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUBindGroup;
unsafe extern fn get_label(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUBindGroup);
let result: USVString = this.Label();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
unsafe extern fn set_label(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUBindGroup);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.SetLabel(arg0);
true
})());
result
}
const label_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUBindGroup as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const label_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUBindGroup as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUBindGroup>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUBindGroup>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUBindGroup\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUBindGroup, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUBindGroup> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUBindGroup {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUBindGroup>) -> DomRoot<GPUBindGroup> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpubindgroup::GPUBindGroup {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUBindGroup {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUBindGroup {
fn eq(&self, other: &GPUBindGroup) -> bool {
self as *const GPUBindGroup == other
}
}
pub trait GPUBindGroupMethods {
fn Label(&self) -> USVString;
fn SetLabel(&self, value: USVString);
}
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"label\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &label_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &label_setterinfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUBindGroup\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUBindGroup), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUBindGroupPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUBindGroup() {\n [native code]\n}",
PrototypeList::ID::GPUBindGroup,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUBindGroup), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
&[],
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUBindGroup as usize].is_null());
(*cache)[PrototypeList::ID::GPUBindGroup as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUBindGroup as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUBindGroup\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUBindGroupLayout_Binding::{Wrap as GPUBindGroupLayoutWrap, GPUBindGroupLayoutMethods, GetProtoObject as GPUBindGroupLayoutGetProtoObject, DefineDOMInterface as GPUBindGroupLayoutDefineDOMInterface};
pub mod GPUBindGroupLayout_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUBindGroupLayout;
unsafe extern fn get_label(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUBindGroupLayout);
let result: USVString = this.Label();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
unsafe extern fn set_label(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUBindGroupLayout);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.SetLabel(arg0);
true
})());
result
}
const label_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUBindGroupLayout as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const label_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUBindGroupLayout as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUBindGroupLayout>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUBindGroupLayout>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUBindGroupLayout\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUBindGroupLayout, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUBindGroupLayout> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUBindGroupLayout {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUBindGroupLayout>) -> DomRoot<GPUBindGroupLayout> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpubindgrouplayout::GPUBindGroupLayout {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUBindGroupLayout {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUBindGroupLayout {
fn eq(&self, other: &GPUBindGroupLayout) -> bool {
self as *const GPUBindGroupLayout == other
}
}
pub trait GPUBindGroupLayoutMethods {
fn Label(&self) -> USVString;
fn SetLabel(&self, value: USVString);
}
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"label\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &label_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &label_setterinfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUBindGroupLayout\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUBindGroupLayout), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUBindGroupLayoutPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUBindGroupLayout() {\n [native code]\n}",
PrototypeList::ID::GPUBindGroupLayout,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUBindGroupLayout), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
&[],
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUBindGroupLayout as usize].is_null());
(*cache)[PrototypeList::ID::GPUBindGroupLayout as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUBindGroupLayout as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUBindGroupLayout\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUBuffer_Binding::{Wrap as GPUBufferWrap, GPUBufferMethods, GetProtoObject as GPUBufferGetProtoObject, DefineDOMInterface as GPUBufferDefineDOMInterface};
pub mod GPUBuffer_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::promise::Promise;
use crate::dom::types::GPUBuffer;
unsafe extern fn mapAsync(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUBuffer);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPUBuffer.mapAsync\".");
return false;
}
let arg0: u32 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let arg1: u64 = if args.get(1).is_undefined() {
0
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let arg2: Option<u64> = if args.get(2).is_undefined() {
None
} else {
Some(match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
})
};
let result: Rc<Promise> = this.MapAsync(arg0, arg1, arg2, InRealm::in_realm(&AlreadyInRealm::assert_for_cx(cx)));
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const mapAsync_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(mapAsync)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUBuffer as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn getMappedRange(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUBuffer);
let args = &*args;
let argc = args.argc_;
let arg0: u64 = if args.get(0).is_undefined() {
0
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let arg1: Option<u64> = if args.get(1).is_undefined() {
None
} else {
Some(match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
})
};
let result: Result<ArrayBuffer, Error> = this.GetMappedRange(cx, arg0, arg1);
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const getMappedRange_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(getMappedRange)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUBuffer as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn unmap(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUBuffer);
let args = &*args;
let argc = args.argc_;
let result: Result<(), Error> = this.Unmap();
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const unmap_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(unmap)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUBuffer as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn destroy(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUBuffer);
let args = &*args;
let argc = args.argc_;
let result: Result<(), Error> = this.Destroy();
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const destroy_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(destroy)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUBuffer as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_label(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUBuffer);
let result: USVString = this.Label();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
unsafe extern fn set_label(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUBuffer);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.SetLabel(arg0);
true
})());
result
}
const label_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUBuffer as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const label_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUBuffer as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUBuffer>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUBuffer>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUBuffer\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUBuffer, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUBuffer> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUBuffer {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUBuffer>) -> DomRoot<GPUBuffer> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpubuffer::GPUBuffer {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUBuffer {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUBuffer {
fn eq(&self, other: &GPUBuffer) -> bool {
self as *const GPUBuffer == other
}
}
pub trait GPUBufferMethods {
fn MapAsync(&self, mode: u32, offset: u64, size: Option<u64>, _comp: InRealm) -> Rc<Promise>;
fn GetMappedRange(&self, cx: SafeJSContext, offset: u64, size: Option<u64>) -> Fallible<ArrayBuffer>;
fn Unmap(&self) -> Fallible<()>;
fn Destroy(&self) -> Fallible<()>;
fn Label(&self) -> USVString;
fn SetLabel(&self, value: USVString);
}
const sMethods_specs: &[&[JSFunctionSpec]] = &[
&[
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"mapAsync\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &mapAsync_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"getMappedRange\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &getMappedRange_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"unmap\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &unmap_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"destroy\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &destroy_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: ptr::null() },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 0,
flags: 0,
selfHostedName: ptr::null()
}]
];
const sMethods: &[Guard<&[JSFunctionSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sMethods_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sMethods_specs[0])
];
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"label\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &label_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &label_setterinfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUBuffer\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUBuffer), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUBufferPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUBuffer() {\n [native code]\n}",
PrototypeList::ID::GPUBuffer,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUBuffer), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
sMethods,
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUBuffer as usize].is_null());
(*cache)[PrototypeList::ID::GPUBuffer as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUBuffer as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUBuffer\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUBufferUsage_Binding::{GPUBufferUsageConstants, Wrap as GPUBufferUsageWrap, GetProtoObject as GPUBufferUsageGetProtoObject, DefineDOMInterface as GPUBufferUsageDefineDOMInterface};
pub mod GPUBufferUsage_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUBufferUsage;
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUBufferUsage>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUBufferUsage>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
pub mod GPUBufferUsageConstants {
pub const MAP_READ: u32 = 1;
pub const MAP_WRITE: u32 = 2;
pub const COPY_SRC: u32 = 4;
pub const COPY_DST: u32 = 8;
pub const INDEX: u32 = 16;
pub const VERTEX: u32 = 32;
pub const UNIFORM: u32 = 64;
pub const STORAGE: u32 = 128;
pub const INDIRECT: u32 = 256;
pub const QUERY_RESOLVE: u32 = 512;
} static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUBufferUsage\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUBufferUsage, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUBufferUsage> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUBufferUsage {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUBufferUsage>) -> DomRoot<GPUBufferUsage> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpubufferusage::GPUBufferUsage {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUBufferUsage {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUBufferUsage {
fn eq(&self, other: &GPUBufferUsage) -> bool {
self as *const GPUBufferUsage == other
}
}
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUBufferUsage\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Satisfied, sAttributes_specs[0])
];
const sConstants_specs: &[&[ConstantSpec]] = &[
&[
ConstantSpec { name: b"MAP_READ\0", value: ConstantVal::UintVal(1) },
ConstantSpec { name: b"MAP_WRITE\0", value: ConstantVal::UintVal(2) },
ConstantSpec { name: b"COPY_SRC\0", value: ConstantVal::UintVal(4) },
ConstantSpec { name: b"COPY_DST\0", value: ConstantVal::UintVal(8) },
ConstantSpec { name: b"INDEX\0", value: ConstantVal::UintVal(16) },
ConstantSpec { name: b"VERTEX\0", value: ConstantVal::UintVal(32) },
ConstantSpec { name: b"UNIFORM\0", value: ConstantVal::UintVal(64) },
ConstantSpec { name: b"STORAGE\0", value: ConstantVal::UintVal(128) },
ConstantSpec { name: b"INDIRECT\0", value: ConstantVal::UintVal(256) },
ConstantSpec { name: b"QUERY_RESOLVE\0", value: ConstantVal::UintVal(512) }]
];
const sConstants: &[Guard<&[ConstantSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sConstants_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sConstants_specs[0])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUBufferUsage), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUBufferUsagePrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUBufferUsage() {\n [native code]\n}",
PrototypeList::ID::GPUBufferUsage,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUBufferUsage), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
&[],
sAttributes,
sConstants,
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUBufferUsage as usize].is_null());
(*cache)[PrototypeList::ID::GPUBufferUsage as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUBufferUsage as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
sConstants,
prototype.handle(),
b"GPUBufferUsage\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUCanvasContext_Binding::{Wrap as GPUCanvasContextWrap, GPUCanvasContextMethods, GetProtoObject as GPUCanvasContextGetProtoObject, DefineDOMInterface as GPUCanvasContextDefineDOMInterface};
pub mod GPUCanvasContext_Binding {
use crate::dom;
use crate::dom::bindings::codegen::Bindings::ElementBinding::Element_Binding;
use crate::dom::bindings::codegen::Bindings::EventTargetBinding::EventTarget_Binding;
use crate::dom::bindings::codegen::Bindings::HTMLElementBinding::HTMLElement_Binding;
use crate::dom::bindings::codegen::Bindings::NodeBinding::Node_Binding;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUCanvasAlphaMode;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUCanvasAlphaModeValues;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUCanvasConfiguration;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureFormat;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureFormatValues;
use crate::dom::bindings::import::module::*;
use crate::dom::types::Element;
use crate::dom::types::EventTarget;
use crate::dom::types::GPUCanvasContext;
use crate::dom::types::GPUDevice;
use crate::dom::types::GPUTexture;
use crate::dom::types::HTMLCanvasElement;
use crate::dom::types::HTMLElement;
use crate::dom::types::Node;
use crate::dom::types::OffscreenCanvas;
unsafe extern fn get_canvas(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUCanvasContext);
let result: UnionTypes::HTMLCanvasElementOrOffscreenCanvas = this.Canvas();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const canvas_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_canvas)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUCanvasContext as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn configure(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUCanvasContext);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPUCanvasContext.configure\".");
return false;
}
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUCanvasConfiguration = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.Configure(&arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const configure_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(configure)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUCanvasContext as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn unconfigure(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUCanvasContext);
let args = &*args;
let argc = args.argc_;
let result: () = this.Unconfigure();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const unconfigure_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(unconfigure)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUCanvasContext as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn getCurrentTexture(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUCanvasContext);
let args = &*args;
let argc = args.argc_;
let result: Result<DomRoot<GPUTexture>, Error> = this.GetCurrentTexture();
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const getCurrentTexture_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(getCurrentTexture)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUCanvasContext as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUCanvasContext>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUCanvasContext>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUCanvasContext\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUCanvasContext, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUCanvasContext> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUCanvasContext {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUCanvasContext>) -> DomRoot<GPUCanvasContext> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpucanvascontext::GPUCanvasContext {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUCanvasContext {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUCanvasContext {
fn eq(&self, other: &GPUCanvasContext) -> bool {
self as *const GPUCanvasContext == other
}
}
pub trait GPUCanvasContextMethods {
fn Canvas(&self) -> UnionTypes::HTMLCanvasElementOrOffscreenCanvas;
fn Configure(&self, descriptor: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUCanvasConfiguration);
fn Unconfigure(&self);
fn GetCurrentTexture(&self) -> Fallible<DomRoot<GPUTexture>>;
}
const sMethods_specs: &[&[JSFunctionSpec]] = &[
&[
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"configure\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &configure_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"unconfigure\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &unconfigure_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"getCurrentTexture\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &getCurrentTexture_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: ptr::null() },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 0,
flags: 0,
selfHostedName: ptr::null()
}]
];
const sMethods: &[Guard<&[JSFunctionSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sMethods_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sMethods_specs[0])
];
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"canvas\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &canvas_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUCanvasContext\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUCanvasContext), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUCanvasContextPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUCanvasContext() {\n [native code]\n}",
PrototypeList::ID::GPUCanvasContext,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUCanvasContext), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
sMethods,
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUCanvasContext as usize].is_null());
(*cache)[PrototypeList::ID::GPUCanvasContext as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUCanvasContext as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUCanvasContext\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUColorWrite_Binding::{GPUColorWriteConstants, Wrap as GPUColorWriteWrap, GetProtoObject as GPUColorWriteGetProtoObject, DefineDOMInterface as GPUColorWriteDefineDOMInterface};
pub mod GPUColorWrite_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUColorWrite;
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUColorWrite>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUColorWrite>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
pub mod GPUColorWriteConstants {
pub const RED: u32 = 1;
pub const GREEN: u32 = 2;
pub const BLUE: u32 = 4;
pub const ALPHA: u32 = 8;
pub const ALL: u32 = 15;
} static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUColorWrite\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUColorWrite, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUColorWrite> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUColorWrite {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUColorWrite>) -> DomRoot<GPUColorWrite> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpucolorwrite::GPUColorWrite {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUColorWrite {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUColorWrite {
fn eq(&self, other: &GPUColorWrite) -> bool {
self as *const GPUColorWrite == other
}
}
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUColorWrite\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Satisfied, sAttributes_specs[0])
];
const sConstants_specs: &[&[ConstantSpec]] = &[
&[
ConstantSpec { name: b"RED\0", value: ConstantVal::UintVal(1) },
ConstantSpec { name: b"GREEN\0", value: ConstantVal::UintVal(2) },
ConstantSpec { name: b"BLUE\0", value: ConstantVal::UintVal(4) },
ConstantSpec { name: b"ALPHA\0", value: ConstantVal::UintVal(8) },
ConstantSpec { name: b"ALL\0", value: ConstantVal::UintVal(15) }]
];
const sConstants: &[Guard<&[ConstantSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sConstants_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sConstants_specs[0])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUColorWrite), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUColorWritePrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUColorWrite() {\n [native code]\n}",
PrototypeList::ID::GPUColorWrite,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUColorWrite), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
&[],
sAttributes,
sConstants,
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUColorWrite as usize].is_null());
(*cache)[PrototypeList::ID::GPUColorWrite as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUColorWrite as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
sConstants,
prototype.handle(),
b"GPUColorWrite\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUCommandBuffer_Binding::{Wrap as GPUCommandBufferWrap, GPUCommandBufferMethods, GetProtoObject as GPUCommandBufferGetProtoObject, DefineDOMInterface as GPUCommandBufferDefineDOMInterface};
pub mod GPUCommandBuffer_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUCommandBuffer;
unsafe extern fn get_label(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUCommandBuffer);
let result: USVString = this.Label();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
unsafe extern fn set_label(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUCommandBuffer);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.SetLabel(arg0);
true
})());
result
}
const label_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUCommandBuffer as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const label_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUCommandBuffer as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUCommandBuffer>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUCommandBuffer>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUCommandBuffer\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUCommandBuffer, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUCommandBuffer> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUCommandBuffer {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUCommandBuffer>) -> DomRoot<GPUCommandBuffer> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpucommandbuffer::GPUCommandBuffer {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUCommandBuffer {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUCommandBuffer {
fn eq(&self, other: &GPUCommandBuffer) -> bool {
self as *const GPUCommandBuffer == other
}
}
pub trait GPUCommandBufferMethods {
fn Label(&self) -> USVString;
fn SetLabel(&self, value: USVString);
}
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"label\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &label_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &label_setterinfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUCommandBuffer\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUCommandBuffer), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUCommandBufferPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUCommandBuffer() {\n [native code]\n}",
PrototypeList::ID::GPUCommandBuffer,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUCommandBuffer), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
&[],
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUCommandBuffer as usize].is_null());
(*cache)[PrototypeList::ID::GPUCommandBuffer as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUCommandBuffer as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUCommandBuffer\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUCommandEncoder_Binding::{Wrap as GPUCommandEncoderWrap, GPUCommandEncoderMethods, GetProtoObject as GPUCommandEncoderGetProtoObject, DefineDOMInterface as GPUCommandEncoderDefineDOMInterface};
pub mod GPUCommandEncoder_Binding {
use crate::dom;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUCommandBufferDescriptor;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUComputePassDescriptor;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUExtent3DDict;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageCopyBuffer;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageCopyTexture;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderPassColorAttachment;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderPassDepthStencilAttachment;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderPassDescriptor;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureAspect;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureAspectValues;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUBuffer;
use crate::dom::types::GPUCommandBuffer;
use crate::dom::types::GPUCommandEncoder;
use crate::dom::types::GPUComputePassEncoder;
use crate::dom::types::GPUQuerySet;
use crate::dom::types::GPURenderPassEncoder;
use crate::dom::types::GPUTexture;
unsafe extern fn beginComputePass(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUCommandEncoder);
let args = &*args;
let argc = args.argc_;
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUComputePassDescriptor = if args.get(0).is_undefined() {
crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUComputePassDescriptor::empty()
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
}
};
let result: DomRoot<GPUComputePassEncoder> = this.BeginComputePass(&arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const beginComputePass_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(beginComputePass)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUCommandEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn beginRenderPass(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUCommandEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPUCommandEncoder.beginRenderPass\".");
return false;
}
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderPassDescriptor = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: DomRoot<GPURenderPassEncoder> = this.BeginRenderPass(&arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const beginRenderPass_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(beginRenderPass)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUCommandEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn copyBufferToBuffer(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUCommandEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 5 {
throw_type_error(*cx, "Not enough arguments to \"GPUCommandEncoder.copyBufferToBuffer\".");
return false;
}
let arg0: DomRoot<GPUBuffer> = if HandleValue::from_raw(args.get(0)).get().is_object() {
match root_from_handlevalue(HandleValue::from_raw(args.get(0)), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUBuffer.");
return false;
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return false;
};
let arg1: u64 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let arg2: DomRoot<GPUBuffer> = if HandleValue::from_raw(args.get(2)).get().is_object() {
match root_from_handlevalue(HandleValue::from_raw(args.get(2)), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUBuffer.");
return false;
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return false;
};
let arg3: u64 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(3)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let arg4: u64 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(4)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let result: () = this.CopyBufferToBuffer(&arg0, arg1, &arg2, arg3, arg4);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const copyBufferToBuffer_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(copyBufferToBuffer)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUCommandEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn copyBufferToTexture(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUCommandEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 3 {
throw_type_error(*cx, "Not enough arguments to \"GPUCommandEncoder.copyBufferToTexture\".");
return false;
}
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageCopyBuffer = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let arg1: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageCopyTexture = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let arg2: UnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(2)), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.CopyBufferToTexture(&arg0, &arg1, arg2);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const copyBufferToTexture_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(copyBufferToTexture)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUCommandEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn copyTextureToBuffer(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUCommandEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 3 {
throw_type_error(*cx, "Not enough arguments to \"GPUCommandEncoder.copyTextureToBuffer\".");
return false;
}
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageCopyTexture = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let arg1: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageCopyBuffer = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let arg2: UnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(2)), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.CopyTextureToBuffer(&arg0, &arg1, arg2);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const copyTextureToBuffer_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(copyTextureToBuffer)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUCommandEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn copyTextureToTexture(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUCommandEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 3 {
throw_type_error(*cx, "Not enough arguments to \"GPUCommandEncoder.copyTextureToTexture\".");
return false;
}
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageCopyTexture = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let arg1: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageCopyTexture = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let arg2: UnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(2)), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.CopyTextureToTexture(&arg0, &arg1, arg2);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const copyTextureToTexture_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(copyTextureToTexture)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUCommandEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn finish(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUCommandEncoder);
let args = &*args;
let argc = args.argc_;
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUCommandBufferDescriptor = if args.get(0).is_undefined() {
crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUCommandBufferDescriptor::empty()
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
}
};
let result: DomRoot<GPUCommandBuffer> = this.Finish(&arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const finish_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(finish)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUCommandEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_label(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUCommandEncoder);
let result: USVString = this.Label();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
unsafe extern fn set_label(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUCommandEncoder);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.SetLabel(arg0);
true
})());
result
}
const label_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUCommandEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const label_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUCommandEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUCommandEncoder>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUCommandEncoder>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUCommandEncoder\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUCommandEncoder, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUCommandEncoder> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUCommandEncoder {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUCommandEncoder>) -> DomRoot<GPUCommandEncoder> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpucommandencoder::GPUCommandEncoder {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUCommandEncoder {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUCommandEncoder {
fn eq(&self, other: &GPUCommandEncoder) -> bool {
self as *const GPUCommandEncoder == other
}
}
pub trait GPUCommandEncoderMethods {
fn BeginComputePass(&self, descriptor: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUComputePassDescriptor) -> DomRoot<GPUComputePassEncoder>;
fn BeginRenderPass(&self, descriptor: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderPassDescriptor) -> DomRoot<GPURenderPassEncoder>;
fn CopyBufferToBuffer(&self, source: &GPUBuffer, sourceOffset: u64, destination: &GPUBuffer, destinationOffset: u64, size: u64);
fn CopyBufferToTexture(&self, source: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageCopyBuffer, destination: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageCopyTexture, copySize: UnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict);
fn CopyTextureToBuffer(&self, source: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageCopyTexture, destination: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageCopyBuffer, copySize: UnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict);
fn CopyTextureToTexture(&self, source: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageCopyTexture, destination: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageCopyTexture, copySize: UnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict);
fn Finish(&self, descriptor: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUCommandBufferDescriptor) -> DomRoot<GPUCommandBuffer>;
fn Label(&self) -> USVString;
fn SetLabel(&self, value: USVString);
}
const sMethods_specs: &[&[JSFunctionSpec]] = &[
&[
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"beginComputePass\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &beginComputePass_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"beginRenderPass\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &beginRenderPass_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"copyBufferToBuffer\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: ©BufferToBuffer_methodinfo as *const _ as *const JSJitInfo },
nargs: 5,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"copyBufferToTexture\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: ©BufferToTexture_methodinfo as *const _ as *const JSJitInfo },
nargs: 3,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"copyTextureToBuffer\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: ©TextureToBuffer_methodinfo as *const _ as *const JSJitInfo },
nargs: 3,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"copyTextureToTexture\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: ©TextureToTexture_methodinfo as *const _ as *const JSJitInfo },
nargs: 3,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"finish\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &finish_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: ptr::null() },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 0,
flags: 0,
selfHostedName: ptr::null()
}]
];
const sMethods: &[Guard<&[JSFunctionSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sMethods_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sMethods_specs[0])
];
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"label\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &label_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &label_setterinfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUCommandEncoder\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUCommandEncoder), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUCommandEncoderPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUCommandEncoder() {\n [native code]\n}",
PrototypeList::ID::GPUCommandEncoder,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUCommandEncoder), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
sMethods,
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUCommandEncoder as usize].is_null());
(*cache)[PrototypeList::ID::GPUCommandEncoder as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUCommandEncoder as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUCommandEncoder\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUCompilationInfo_Binding::{Wrap as GPUCompilationInfoWrap, GPUCompilationInfoMethods, GetProtoObject as GPUCompilationInfoGetProtoObject, DefineDOMInterface as GPUCompilationInfoDefineDOMInterface};
pub mod GPUCompilationInfo_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUCompilationInfo;
unsafe extern fn get_messages(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUCompilationInfo);
let result: JSVal = this.Messages(cx);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const messages_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_messages)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUCompilationInfo as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNKNOWN as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUCompilationInfo>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUCompilationInfo>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUCompilationInfo\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUCompilationInfo, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUCompilationInfo> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUCompilationInfo {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUCompilationInfo>) -> DomRoot<GPUCompilationInfo> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpucompilationinfo::GPUCompilationInfo {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUCompilationInfo {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUCompilationInfo {
fn eq(&self, other: &GPUCompilationInfo) -> bool {
self as *const GPUCompilationInfo == other
}
}
pub trait GPUCompilationInfoMethods {
fn Messages(&self, cx: SafeJSContext) -> JSVal;
}
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"messages\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &messages_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUCompilationInfo\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUCompilationInfo), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUCompilationInfoPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUCompilationInfo() {\n [native code]\n}",
PrototypeList::ID::GPUCompilationInfo,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUCompilationInfo), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
&[],
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUCompilationInfo as usize].is_null());
(*cache)[PrototypeList::ID::GPUCompilationInfo as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUCompilationInfo as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUCompilationInfo\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUCompilationMessage_Binding::{Wrap as GPUCompilationMessageWrap, GPUCompilationMessageMethods, GetProtoObject as GPUCompilationMessageGetProtoObject, DefineDOMInterface as GPUCompilationMessageDefineDOMInterface};
pub mod GPUCompilationMessage_Binding {
use crate::dom;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUCompilationMessageType;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUCompilationMessageTypeValues;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUCompilationMessage;
unsafe extern fn get_message(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUCompilationMessage);
let result: DOMString = this.Message();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const message_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_message)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUCompilationMessage as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_type(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUCompilationMessage);
let result: GPUCompilationMessageType = this.Type();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const type_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_type)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUCompilationMessage as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_lineNum(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUCompilationMessage);
let result: u64 = this.LineNum();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const lineNum_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_lineNum)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUCompilationMessage as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_linePos(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUCompilationMessage);
let result: u64 = this.LinePos();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const linePos_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_linePos)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUCompilationMessage as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_offset(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUCompilationMessage);
let result: u64 = this.Offset();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const offset_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_offset)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUCompilationMessage as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_length(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUCompilationMessage);
let result: u64 = this.Length();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const length_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_length)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUCompilationMessage as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUCompilationMessage>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUCompilationMessage>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUCompilationMessage\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUCompilationMessage, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUCompilationMessage> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUCompilationMessage {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUCompilationMessage>) -> DomRoot<GPUCompilationMessage> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpucompilationmessage::GPUCompilationMessage {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUCompilationMessage {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUCompilationMessage {
fn eq(&self, other: &GPUCompilationMessage) -> bool {
self as *const GPUCompilationMessage == other
}
}
pub trait GPUCompilationMessageMethods {
fn Message(&self) -> DOMString;
fn Type(&self) -> GPUCompilationMessageType;
fn LineNum(&self) -> u64;
fn LinePos(&self) -> u64;
fn Offset(&self) -> u64;
fn Length(&self) -> u64;
}
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"message\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &message_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"type\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &type_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"lineNum\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &lineNum_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"linePos\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &linePos_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"offset\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &offset_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"length\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &length_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUCompilationMessage\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUCompilationMessage), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUCompilationMessagePrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUCompilationMessage() {\n [native code]\n}",
PrototypeList::ID::GPUCompilationMessage,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUCompilationMessage), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
&[],
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUCompilationMessage as usize].is_null());
(*cache)[PrototypeList::ID::GPUCompilationMessage as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUCompilationMessage as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUCompilationMessage\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUComputePassEncoder_Binding::{Wrap as GPUComputePassEncoderWrap, GPUComputePassEncoderMethods, GetProtoObject as GPUComputePassEncoderGetProtoObject, DefineDOMInterface as GPUComputePassEncoderDefineDOMInterface};
pub mod GPUComputePassEncoder_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUBindGroup;
use crate::dom::types::GPUBuffer;
use crate::dom::types::GPUComputePassEncoder;
use crate::dom::types::GPUComputePipeline;
unsafe extern fn setPipeline(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUComputePassEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPUComputePassEncoder.setPipeline\".");
return false;
}
let arg0: DomRoot<GPUComputePipeline> = if HandleValue::from_raw(args.get(0)).get().is_object() {
match root_from_handlevalue(HandleValue::from_raw(args.get(0)), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUComputePipeline.");
return false;
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return false;
};
let result: () = this.SetPipeline(&arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const setPipeline_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(setPipeline)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUComputePassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn dispatchWorkgroups(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUComputePassEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPUComputePassEncoder.dispatchWorkgroups\".");
return false;
}
let arg0: u32 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let arg1: u32 = if args.get(1).is_undefined() {
1
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let arg2: u32 = if args.get(2).is_undefined() {
1
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let result: () = this.DispatchWorkgroups(arg0, arg1, arg2);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const dispatchWorkgroups_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(dispatchWorkgroups)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUComputePassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn dispatchWorkgroupsIndirect(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUComputePassEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 2 {
throw_type_error(*cx, "Not enough arguments to \"GPUComputePassEncoder.dispatchWorkgroupsIndirect\".");
return false;
}
let arg0: DomRoot<GPUBuffer> = if HandleValue::from_raw(args.get(0)).get().is_object() {
match root_from_handlevalue(HandleValue::from_raw(args.get(0)), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUBuffer.");
return false;
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return false;
};
let arg1: u64 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let result: () = this.DispatchWorkgroupsIndirect(&arg0, arg1);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const dispatchWorkgroupsIndirect_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(dispatchWorkgroupsIndirect)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUComputePassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn end(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUComputePassEncoder);
let args = &*args;
let argc = args.argc_;
let result: Result<(), Error> = this.End();
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const end_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(end)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUComputePassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_label(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUComputePassEncoder);
let result: USVString = this.Label();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
unsafe extern fn set_label(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUComputePassEncoder);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.SetLabel(arg0);
true
})());
result
}
const label_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUComputePassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const label_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUComputePassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn setBindGroup(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUComputePassEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 2 {
throw_type_error(*cx, "Not enough arguments to \"GPUComputePassEncoder.setBindGroup\".");
return false;
}
let arg0: u32 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let arg1: DomRoot<GPUBindGroup> = if HandleValue::from_raw(args.get(1)).get().is_object() {
match root_from_handlevalue(HandleValue::from_raw(args.get(1)), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUBindGroup.");
return false;
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return false;
};
let arg2: Vec<u32> = if args.get(2).is_undefined() {
Vec::new()
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(2)), ConversionBehavior::Default) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
}
};
let result: () = this.SetBindGroup(arg0, &arg1, arg2);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const setBindGroup_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(setBindGroup)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUComputePassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUComputePassEncoder>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUComputePassEncoder>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUComputePassEncoder\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUComputePassEncoder, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUComputePassEncoder> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUComputePassEncoder {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUComputePassEncoder>) -> DomRoot<GPUComputePassEncoder> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpucomputepassencoder::GPUComputePassEncoder {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUComputePassEncoder {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUComputePassEncoder {
fn eq(&self, other: &GPUComputePassEncoder) -> bool {
self as *const GPUComputePassEncoder == other
}
}
pub trait GPUComputePassEncoderMethods {
fn SetPipeline(&self, pipeline: &GPUComputePipeline);
fn DispatchWorkgroups(&self, x: u32, y: u32, z: u32);
fn DispatchWorkgroupsIndirect(&self, indirectBuffer: &GPUBuffer, indirectOffset: u64);
fn End(&self) -> Fallible<()>;
fn Label(&self) -> USVString;
fn SetLabel(&self, value: USVString);
fn SetBindGroup(&self, index: u32, bindGroup: &GPUBindGroup, dynamicOffsets: Vec<u32>);
}
const sMethods_specs: &[&[JSFunctionSpec]] = &[
&[
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"setPipeline\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &setPipeline_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"dispatchWorkgroups\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &dispatchWorkgroups_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"dispatchWorkgroupsIndirect\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &dispatchWorkgroupsIndirect_methodinfo as *const _ as *const JSJitInfo },
nargs: 2,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"end\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &end_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"setBindGroup\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &setBindGroup_methodinfo as *const _ as *const JSJitInfo },
nargs: 2,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: ptr::null() },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 0,
flags: 0,
selfHostedName: ptr::null()
}]
];
const sMethods: &[Guard<&[JSFunctionSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sMethods_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sMethods_specs[0])
];
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"label\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &label_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &label_setterinfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUComputePassEncoder\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUComputePassEncoder), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUComputePassEncoderPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUComputePassEncoder() {\n [native code]\n}",
PrototypeList::ID::GPUComputePassEncoder,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUComputePassEncoder), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
sMethods,
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUComputePassEncoder as usize].is_null());
(*cache)[PrototypeList::ID::GPUComputePassEncoder as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUComputePassEncoder as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUComputePassEncoder\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUComputePipeline_Binding::{Wrap as GPUComputePipelineWrap, GPUComputePipelineMethods, GetProtoObject as GPUComputePipelineGetProtoObject, DefineDOMInterface as GPUComputePipelineDefineDOMInterface};
pub mod GPUComputePipeline_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUBindGroupLayout;
use crate::dom::types::GPUComputePipeline;
unsafe extern fn get_label(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUComputePipeline);
let result: USVString = this.Label();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
unsafe extern fn set_label(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUComputePipeline);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.SetLabel(arg0);
true
})());
result
}
const label_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUComputePipeline as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const label_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUComputePipeline as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn getBindGroupLayout(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUComputePipeline);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPUComputePipeline.getBindGroupLayout\".");
return false;
}
let arg0: u32 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ConversionBehavior::Default) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let result: Result<DomRoot<GPUBindGroupLayout>, Error> = this.GetBindGroupLayout(arg0);
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const getBindGroupLayout_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(getBindGroupLayout)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUComputePipeline as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUComputePipeline>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUComputePipeline>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUComputePipeline\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUComputePipeline, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUComputePipeline> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUComputePipeline {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUComputePipeline>) -> DomRoot<GPUComputePipeline> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpucomputepipeline::GPUComputePipeline {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUComputePipeline {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUComputePipeline {
fn eq(&self, other: &GPUComputePipeline) -> bool {
self as *const GPUComputePipeline == other
}
}
pub trait GPUComputePipelineMethods {
fn Label(&self) -> USVString;
fn SetLabel(&self, value: USVString);
fn GetBindGroupLayout(&self, index: u32) -> Fallible<DomRoot<GPUBindGroupLayout>>;
}
const sMethods_specs: &[&[JSFunctionSpec]] = &[
&[
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"getBindGroupLayout\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &getBindGroupLayout_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: ptr::null() },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 0,
flags: 0,
selfHostedName: ptr::null()
}]
];
const sMethods: &[Guard<&[JSFunctionSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sMethods_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sMethods_specs[0])
];
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"label\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &label_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &label_setterinfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUComputePipeline\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUComputePipeline), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUComputePipelinePrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUComputePipeline() {\n [native code]\n}",
PrototypeList::ID::GPUComputePipeline,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUComputePipeline), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
sMethods,
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUComputePipeline as usize].is_null());
(*cache)[PrototypeList::ID::GPUComputePipeline as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUComputePipeline as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUComputePipeline\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUDevice_Binding::{Wrap as GPUDeviceWrap, GPUDeviceMethods, GetProtoObject as GPUDeviceGetProtoObject, DefineDOMInterface as GPUDeviceDefineDOMInterface};
pub mod GPUDevice_Binding {
use crate::dom;
use crate::dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull;
use crate::dom::bindings::codegen::Bindings::EventTargetBinding::EventTarget_Binding;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUAddressMode;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUAddressModeValues;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUBindGroupDescriptor;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUBindGroupEntry;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUBindGroupLayoutDescriptor;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUBindGroupLayoutEntry;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUBufferDescriptor;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUCommandEncoderDescriptor;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUCompareFunction;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUCompareFunctionValues;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUComputePipelineDescriptor;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUDepthStencilState;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUErrorFilter;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUErrorFilterValues;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUFilterMode;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUFilterModeValues;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUFragmentState;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUMultisampleState;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUPipelineLayoutDescriptor;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUPrimitiveState;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUProgrammableStage;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderBundleEncoderDescriptor;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderPipelineDescriptor;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUSamplerDescriptor;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUShaderModuleDescriptor;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureDescriptor;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureDimension;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureDimensionValues;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureFormat;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureFormatValues;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUVertexState;
use crate::dom::bindings::import::module::*;
use crate::dom::promise::Promise;
use crate::dom::types::EventTarget;
use crate::dom::types::GPUBindGroup;
use crate::dom::types::GPUBindGroupLayout;
use crate::dom::types::GPUBuffer;
use crate::dom::types::GPUCommandEncoder;
use crate::dom::types::GPUComputePipeline;
use crate::dom::types::GPUDevice;
use crate::dom::types::GPUPipelineLayout;
use crate::dom::types::GPUQueue;
use crate::dom::types::GPURenderBundleEncoder;
use crate::dom::types::GPURenderPipeline;
use crate::dom::types::GPUSampler;
use crate::dom::types::GPUShaderModule;
use crate::dom::types::GPUSupportedFeatures;
use crate::dom::types::GPUSupportedLimits;
use crate::dom::types::GPUTexture;
unsafe extern fn get_features(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let result: DomRoot<GPUSupportedFeatures> = this.Features();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const features_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_features)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasNone as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
true,
true,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_limits(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let result: DomRoot<GPUSupportedLimits> = this.Limits();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const limits_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_limits)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasNone as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
true,
true,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_queue(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let result: DomRoot<GPUQueue> = this.GetQueue();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const queue_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_queue)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasNone as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
true,
true,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn destroy(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let args = &*args;
let argc = args.argc_;
let result: () = this.Destroy();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const destroy_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(destroy)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn createBuffer(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPUDevice.createBuffer\".");
return false;
}
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUBufferDescriptor = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: Result<DomRoot<GPUBuffer>, Error> = this.CreateBuffer(&arg0);
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const createBuffer_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(createBuffer)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn createTexture(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPUDevice.createTexture\".");
return false;
}
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureDescriptor = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: DomRoot<GPUTexture> = this.CreateTexture(&arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const createTexture_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(createTexture)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn createSampler(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let args = &*args;
let argc = args.argc_;
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUSamplerDescriptor = if args.get(0).is_undefined() {
crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUSamplerDescriptor::empty()
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
}
};
let result: DomRoot<GPUSampler> = this.CreateSampler(&arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const createSampler_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(createSampler)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn createBindGroupLayout(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPUDevice.createBindGroupLayout\".");
return false;
}
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUBindGroupLayoutDescriptor = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: DomRoot<GPUBindGroupLayout> = this.CreateBindGroupLayout(&arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const createBindGroupLayout_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(createBindGroupLayout)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn createPipelineLayout(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPUDevice.createPipelineLayout\".");
return false;
}
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUPipelineLayoutDescriptor = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: DomRoot<GPUPipelineLayout> = this.CreatePipelineLayout(&arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const createPipelineLayout_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(createPipelineLayout)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn createBindGroup(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPUDevice.createBindGroup\".");
return false;
}
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUBindGroupDescriptor = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: DomRoot<GPUBindGroup> = this.CreateBindGroup(&arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const createBindGroup_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(createBindGroup)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn createShaderModule(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPUDevice.createShaderModule\".");
return false;
}
let arg0: RootedTraceableBox<crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUShaderModuleDescriptor> = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: DomRoot<GPUShaderModule> = this.CreateShaderModule(arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const createShaderModule_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(createShaderModule)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn createComputePipeline(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPUDevice.createComputePipeline\".");
return false;
}
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUComputePipelineDescriptor = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: DomRoot<GPUComputePipeline> = this.CreateComputePipeline(&arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const createComputePipeline_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(createComputePipeline)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn createRenderPipeline(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPUDevice.createRenderPipeline\".");
return false;
}
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderPipelineDescriptor = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: DomRoot<GPURenderPipeline> = this.CreateRenderPipeline(&arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const createRenderPipeline_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(createRenderPipeline)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn createComputePipelineAsync(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPUDevice.createComputePipelineAsync\".");
return false;
}
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUComputePipelineDescriptor = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: Rc<Promise> = this.CreateComputePipelineAsync(&arg0, InRealm::in_realm(&AlreadyInRealm::assert_for_cx(cx)));
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const createComputePipelineAsync_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(createComputePipelineAsync)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn createRenderPipelineAsync(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPUDevice.createRenderPipelineAsync\".");
return false;
}
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderPipelineDescriptor = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: Rc<Promise> = this.CreateRenderPipelineAsync(&arg0, InRealm::in_realm(&AlreadyInRealm::assert_for_cx(cx)));
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const createRenderPipelineAsync_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(createRenderPipelineAsync)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn createCommandEncoder(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let args = &*args;
let argc = args.argc_;
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUCommandEncoderDescriptor = if args.get(0).is_undefined() {
crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUCommandEncoderDescriptor::empty()
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
}
};
let result: DomRoot<GPUCommandEncoder> = this.CreateCommandEncoder(&arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const createCommandEncoder_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(createCommandEncoder)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn createRenderBundleEncoder(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPUDevice.createRenderBundleEncoder\".");
return false;
}
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderBundleEncoderDescriptor = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: DomRoot<GPURenderBundleEncoder> = this.CreateRenderBundleEncoder(&arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const createRenderBundleEncoder_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(createRenderBundleEncoder)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_lost(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let result: Result<Rc<Promise>, Error> = this.GetLost(InRealm::in_realm(&AlreadyInRealm::assert_for_cx(cx)));
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const lost_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_lost)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn pushErrorScope(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPUDevice.pushErrorScope\".");
return false;
}
let arg0: GPUErrorFilter = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) { Err(_) => { return false;
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return false;
},
};
let result: () = this.PushErrorScope(arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const pushErrorScope_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(pushErrorScope)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn popErrorScope(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let args = &*args;
let argc = args.argc_;
let result: Rc<Promise> = this.PopErrorScope(InRealm::in_realm(&AlreadyInRealm::assert_for_cx(cx)));
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const popErrorScope_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(popErrorScope)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_onuncapturederror(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let result: Option<Rc<crate::dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull>> = this.GetOnuncapturederror();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
unsafe extern fn set_onuncapturederror(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let arg0: Option<Rc<EventHandlerNonNull>> = if HandleValue::from_raw(args.get(0)).get().is_object() {
Some(EventHandlerNonNull::new(cx, HandleValue::from_raw(args.get(0)).get().to_object()))
} else {
None
};
let result: () = this.SetOnuncapturederror(arg0);
true
});
result
}
const onuncapturederror_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_onuncapturederror)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNKNOWN as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const onuncapturederror_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_onuncapturederror)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_label(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let result: USVString = this.Label();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
unsafe extern fn set_label(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDevice);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.SetLabel(arg0);
true
})());
result
}
const label_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const label_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDevice as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUDevice>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUDevice>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUDevice\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::EventTarget, PrototypeList::ID::GPUDevice, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 1,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { eventtarget: (crate::dom::bindings::codegen::InheritTypes::EventTargetTypeId::GPUDevice) },
malloc_size_of: malloc_size_of_including_raw_self::<GPUDevice> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUDevice {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &EventTarget = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUDevice>) -> DomRoot<GPUDevice> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpudevice::GPUDevice {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUDevice {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUDevice {
fn eq(&self, other: &GPUDevice) -> bool {
self as *const GPUDevice == other
}
}
pub trait GPUDeviceMethods {
fn Features(&self) -> DomRoot<GPUSupportedFeatures>;
fn Limits(&self) -> DomRoot<GPUSupportedLimits>;
fn GetQueue(&self) -> DomRoot<GPUQueue>;
fn Destroy(&self);
fn CreateBuffer(&self, descriptor: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUBufferDescriptor) -> Fallible<DomRoot<GPUBuffer>>;
fn CreateTexture(&self, descriptor: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureDescriptor) -> DomRoot<GPUTexture>;
fn CreateSampler(&self, descriptor: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUSamplerDescriptor) -> DomRoot<GPUSampler>;
fn CreateBindGroupLayout(&self, descriptor: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUBindGroupLayoutDescriptor) -> DomRoot<GPUBindGroupLayout>;
fn CreatePipelineLayout(&self, descriptor: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUPipelineLayoutDescriptor) -> DomRoot<GPUPipelineLayout>;
fn CreateBindGroup(&self, descriptor: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUBindGroupDescriptor) -> DomRoot<GPUBindGroup>;
fn CreateShaderModule(&self, descriptor: RootedTraceableBox<crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUShaderModuleDescriptor>) -> DomRoot<GPUShaderModule>;
fn CreateComputePipeline(&self, descriptor: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUComputePipelineDescriptor) -> DomRoot<GPUComputePipeline>;
fn CreateRenderPipeline(&self, descriptor: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderPipelineDescriptor) -> DomRoot<GPURenderPipeline>;
fn CreateComputePipelineAsync(&self, descriptor: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUComputePipelineDescriptor, _comp: InRealm) -> Rc<Promise>;
fn CreateRenderPipelineAsync(&self, descriptor: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderPipelineDescriptor, _comp: InRealm) -> Rc<Promise>;
fn CreateCommandEncoder(&self, descriptor: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUCommandEncoderDescriptor) -> DomRoot<GPUCommandEncoder>;
fn CreateRenderBundleEncoder(&self, descriptor: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderBundleEncoderDescriptor) -> DomRoot<GPURenderBundleEncoder>;
fn GetLost(&self, _comp: InRealm) -> Fallible<Rc<Promise>>;
fn PushErrorScope(&self, filter: GPUErrorFilter);
fn PopErrorScope(&self, _comp: InRealm) -> Rc<Promise>;
fn GetOnuncapturederror(&self) -> Option<Rc<crate::dom::bindings::codegen::Bindings::EventHandlerBinding::EventHandlerNonNull>>;
fn SetOnuncapturederror(&self, value: Option<Rc<EventHandlerNonNull>>);
fn Label(&self) -> USVString;
fn SetLabel(&self, value: USVString);
}
const sMethods_specs: &[&[JSFunctionSpec]] = &[
&[
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"destroy\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &destroy_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"createBuffer\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &createBuffer_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"createTexture\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &createTexture_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"createSampler\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &createSampler_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"createBindGroupLayout\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &createBindGroupLayout_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"createPipelineLayout\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &createPipelineLayout_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"createBindGroup\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &createBindGroup_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"createShaderModule\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &createShaderModule_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"createComputePipeline\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &createComputePipeline_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"createRenderPipeline\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &createRenderPipeline_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"createComputePipelineAsync\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &createComputePipelineAsync_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"createRenderPipelineAsync\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &createRenderPipelineAsync_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"createCommandEncoder\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &createCommandEncoder_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"createRenderBundleEncoder\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &createRenderBundleEncoder_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"pushErrorScope\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &pushErrorScope_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"popErrorScope\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &popErrorScope_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: ptr::null() },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 0,
flags: 0,
selfHostedName: ptr::null()
}]
];
const sMethods: &[Guard<&[JSFunctionSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sMethods_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sMethods_specs[0])
];
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"features\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &features_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"limits\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &limits_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"queue\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &queue_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"lost\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &lost_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"onuncapturederror\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &onuncapturederror_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &onuncapturederror_setterinfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"label\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &label_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &label_setterinfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUDevice\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sAttributes_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[1]),
Guard::new(Condition::Satisfied, sAttributes_specs[2])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUDevice), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUDevicePrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUDevice() {\n [native code]\n}",
PrototypeList::ID::GPUDevice,
1);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUDevice), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
EventTarget_Binding::GetProtoObject(cx, global, prototype_proto.handle_mut());
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
sMethods,
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUDevice as usize].is_null());
(*cache)[PrototypeList::ID::GPUDevice as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUDevice as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
EventTarget_Binding::GetConstructorObject(cx, global, interface_proto.handle_mut());
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUDevice\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUDeviceLostInfo_Binding::{Wrap as GPUDeviceLostInfoWrap, GPUDeviceLostInfoMethods, GetProtoObject as GPUDeviceLostInfoGetProtoObject, DefineDOMInterface as GPUDeviceLostInfoDefineDOMInterface};
pub mod GPUDeviceLostInfo_Binding {
use crate::dom;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUDeviceLostReason;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUDeviceLostReasonValues;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUDeviceLostInfo;
unsafe extern fn get_reason(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDeviceLostInfo);
let result: GPUDeviceLostReason = this.Reason();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const reason_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_reason)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDeviceLostInfo as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_message(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUDeviceLostInfo);
let result: DOMString = this.Message();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const message_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_message)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUDeviceLostInfo as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUDeviceLostInfo>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUDeviceLostInfo>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUDeviceLostInfo\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUDeviceLostInfo, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUDeviceLostInfo> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUDeviceLostInfo {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUDeviceLostInfo>) -> DomRoot<GPUDeviceLostInfo> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpudevicelostinfo::GPUDeviceLostInfo {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUDeviceLostInfo {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUDeviceLostInfo {
fn eq(&self, other: &GPUDeviceLostInfo) -> bool {
self as *const GPUDeviceLostInfo == other
}
}
pub trait GPUDeviceLostInfoMethods {
fn Reason(&self) -> GPUDeviceLostReason;
fn Message(&self) -> DOMString;
}
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"reason\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &reason_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"message\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &message_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUDeviceLostInfo\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUDeviceLostInfo), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUDeviceLostInfoPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUDeviceLostInfo() {\n [native code]\n}",
PrototypeList::ID::GPUDeviceLostInfo,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUDeviceLostInfo), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
&[],
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUDeviceLostInfo as usize].is_null());
(*cache)[PrototypeList::ID::GPUDeviceLostInfo as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUDeviceLostInfo as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUDeviceLostInfo\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUMapMode_Binding::{GPUMapModeConstants, Wrap as GPUMapModeWrap, GetProtoObject as GPUMapModeGetProtoObject, DefineDOMInterface as GPUMapModeDefineDOMInterface};
pub mod GPUMapMode_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUMapMode;
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUMapMode>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUMapMode>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
pub mod GPUMapModeConstants {
pub const READ: u32 = 1;
pub const WRITE: u32 = 2;
} static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUMapMode\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUMapMode, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUMapMode> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUMapMode {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUMapMode>) -> DomRoot<GPUMapMode> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpumapmode::GPUMapMode {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUMapMode {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUMapMode {
fn eq(&self, other: &GPUMapMode) -> bool {
self as *const GPUMapMode == other
}
}
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUMapMode\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Satisfied, sAttributes_specs[0])
];
const sConstants_specs: &[&[ConstantSpec]] = &[
&[
ConstantSpec { name: b"READ\0", value: ConstantVal::UintVal(1) },
ConstantSpec { name: b"WRITE\0", value: ConstantVal::UintVal(2) }]
];
const sConstants: &[Guard<&[ConstantSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sConstants_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sConstants_specs[0])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUMapMode), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUMapModePrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUMapMode() {\n [native code]\n}",
PrototypeList::ID::GPUMapMode,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUMapMode), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
&[],
sAttributes,
sConstants,
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUMapMode as usize].is_null());
(*cache)[PrototypeList::ID::GPUMapMode as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUMapMode as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
sConstants,
prototype.handle(),
b"GPUMapMode\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUOutOfMemoryError_Binding::{Wrap as GPUOutOfMemoryErrorWrap, GetProtoObject as GPUOutOfMemoryErrorGetProtoObject, DefineDOMInterface as GPUOutOfMemoryErrorDefineDOMInterface};
pub mod GPUOutOfMemoryError_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUOutOfMemoryError;
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUOutOfMemoryError>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUOutOfMemoryError>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUOutOfMemoryError\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUOutOfMemoryError, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUOutOfMemoryError> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUOutOfMemoryError {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUOutOfMemoryError>) -> DomRoot<GPUOutOfMemoryError> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpuoutofmemoryerror::GPUOutOfMemoryError {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUOutOfMemoryError {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUOutOfMemoryError {
fn eq(&self, other: &GPUOutOfMemoryError) -> bool {
self as *const GPUOutOfMemoryError == other
}
}
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUOutOfMemoryError\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Satisfied, sAttributes_specs[0])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUOutOfMemoryError), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUOutOfMemoryErrorPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
unsafe extern fn _constructor(cx: *mut JSContext, argc: u32, vp: *mut JSVal) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let args = CallArgs::from_vp(vp, argc);
let global = GlobalScope::from_object(JS_CALLEE(*cx, vp).to_object());
if !callargs_is_constructing(&args) {
throw_constructor_without_new(*cx, "GPUOutOfMemoryError");
return false;
}
rooted!(in(*cx) let mut desired_proto = ptr::null_mut::<JSObject>());
let proto_result = get_desired_proto(
cx,
&args,
PrototypeList::ID::GPUOutOfMemoryError,
CreateInterfaceObjects,
desired_proto.handle_mut(),
);
assert!(proto_result.is_ok());
if proto_result.is_err() {
return false;
}
let result: DomRoot<GPUOutOfMemoryError> = GPUOutOfMemoryError::Constructor(&global, Some(desired_proto.handle()));
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::call(_constructor);
&BEHAVIOR
},
b"function GPUOutOfMemoryError() {\n [native code]\n}",
PrototypeList::ID::GPUOutOfMemoryError,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUOutOfMemoryError), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
&[],
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUOutOfMemoryError as usize].is_null());
(*cache)[PrototypeList::ID::GPUOutOfMemoryError as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUOutOfMemoryError as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUOutOfMemoryError\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUPipelineLayout_Binding::{Wrap as GPUPipelineLayoutWrap, GPUPipelineLayoutMethods, GetProtoObject as GPUPipelineLayoutGetProtoObject, DefineDOMInterface as GPUPipelineLayoutDefineDOMInterface};
pub mod GPUPipelineLayout_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUPipelineLayout;
unsafe extern fn get_label(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUPipelineLayout);
let result: USVString = this.Label();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
unsafe extern fn set_label(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUPipelineLayout);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.SetLabel(arg0);
true
})());
result
}
const label_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUPipelineLayout as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const label_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUPipelineLayout as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUPipelineLayout>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUPipelineLayout>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUPipelineLayout\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUPipelineLayout, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUPipelineLayout> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUPipelineLayout {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUPipelineLayout>) -> DomRoot<GPUPipelineLayout> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpupipelinelayout::GPUPipelineLayout {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUPipelineLayout {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUPipelineLayout {
fn eq(&self, other: &GPUPipelineLayout) -> bool {
self as *const GPUPipelineLayout == other
}
}
pub trait GPUPipelineLayoutMethods {
fn Label(&self) -> USVString;
fn SetLabel(&self, value: USVString);
}
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"label\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &label_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &label_setterinfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUPipelineLayout\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUPipelineLayout), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUPipelineLayoutPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUPipelineLayout() {\n [native code]\n}",
PrototypeList::ID::GPUPipelineLayout,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUPipelineLayout), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
&[],
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUPipelineLayout as usize].is_null());
(*cache)[PrototypeList::ID::GPUPipelineLayout as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUPipelineLayout as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUPipelineLayout\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUQuerySet_Binding::{Wrap as GPUQuerySetWrap, GPUQuerySetMethods, GetProtoObject as GPUQuerySetGetProtoObject, DefineDOMInterface as GPUQuerySetDefineDOMInterface};
pub mod GPUQuerySet_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUQuerySet;
unsafe extern fn destroy(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUQuerySet);
let args = &*args;
let argc = args.argc_;
let result: () = this.Destroy();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const destroy_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(destroy)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUQuerySet as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_label(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUQuerySet);
let result: USVString = this.Label();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
unsafe extern fn set_label(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUQuerySet);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.SetLabel(arg0);
true
})());
result
}
const label_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUQuerySet as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const label_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUQuerySet as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUQuerySet>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUQuerySet>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUQuerySet\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUQuerySet, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUQuerySet> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUQuerySet {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUQuerySet>) -> DomRoot<GPUQuerySet> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpuqueryset::GPUQuerySet {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUQuerySet {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUQuerySet {
fn eq(&self, other: &GPUQuerySet) -> bool {
self as *const GPUQuerySet == other
}
}
pub trait GPUQuerySetMethods {
fn Destroy(&self);
fn Label(&self) -> USVString;
fn SetLabel(&self, value: USVString);
}
const sMethods_specs: &[&[JSFunctionSpec]] = &[
&[
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"destroy\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &destroy_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: ptr::null() },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 0,
flags: 0,
selfHostedName: ptr::null()
}]
];
const sMethods: &[Guard<&[JSFunctionSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sMethods_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sMethods_specs[0])
];
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"label\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &label_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &label_setterinfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUQuerySet\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUQuerySet), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUQuerySetPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUQuerySet() {\n [native code]\n}",
PrototypeList::ID::GPUQuerySet,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUQuerySet), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
sMethods,
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUQuerySet as usize].is_null());
(*cache)[PrototypeList::ID::GPUQuerySet as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUQuerySet as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUQuerySet\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUQueue_Binding::{Wrap as GPUQueueWrap, GPUQueueMethods, GetProtoObject as GPUQueueGetProtoObject, DefineDOMInterface as GPUQueueDefineDOMInterface};
pub mod GPUQueue_Binding {
use crate::dom;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUExtent3DDict;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageCopyTexture;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageDataLayout;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureAspect;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureAspectValues;
use crate::dom::bindings::import::module::*;
use crate::dom::promise::Promise;
use crate::dom::types::GPUBuffer;
use crate::dom::types::GPUCommandBuffer;
use crate::dom::types::GPUQueue;
use crate::dom::types::GPUTexture;
unsafe extern fn submit(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUQueue);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPUQueue.submit\".");
return false;
}
let arg0: Vec<DomRoot<GPUCommandBuffer>> = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.Submit(arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const submit_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(submit)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUQueue as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn onSubmittedWorkDone(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUQueue);
let args = &*args;
let argc = args.argc_;
let result: Rc<Promise> = this.OnSubmittedWorkDone();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const onSubmittedWorkDone_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(onSubmittedWorkDone)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUQueue as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn writeBuffer(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUQueue);
let args = &*args;
let argc = args.argc_;
if argc < 3 {
throw_type_error(*cx, "Not enough arguments to \"GPUQueue.writeBuffer\".");
return false;
}
let arg0: DomRoot<GPUBuffer> = if HandleValue::from_raw(args.get(0)).get().is_object() {
match root_from_handlevalue(HandleValue::from_raw(args.get(0)), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUBuffer.");
return false;
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return false;
};
let arg1: u64 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let arg2: UnionTypes::ArrayBufferViewOrArrayBuffer = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(2)), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let arg3: u64 = if args.get(3).is_undefined() {
0
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(3)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let arg4: Option<u64> = if args.get(4).is_undefined() {
None
} else {
Some(match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(4)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
})
};
let result: Result<(), Error> = this.WriteBuffer(&arg0, arg1, arg2, arg3, arg4);
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const writeBuffer_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(writeBuffer)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUQueue as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn writeTexture(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUQueue);
let args = &*args;
let argc = args.argc_;
if argc < 4 {
throw_type_error(*cx, "Not enough arguments to \"GPUQueue.writeTexture\".");
return false;
}
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageCopyTexture = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let arg1: UnionTypes::ArrayBufferViewOrArrayBuffer = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let arg2: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageDataLayout = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(2)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let arg3: UnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(3)), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: Result<(), Error> = this.WriteTexture(&arg0, arg1, &arg2, arg3);
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const writeTexture_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(writeTexture)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUQueue as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_label(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUQueue);
let result: USVString = this.Label();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
unsafe extern fn set_label(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUQueue);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.SetLabel(arg0);
true
})());
result
}
const label_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUQueue as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const label_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUQueue as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUQueue>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUQueue>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUQueue\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUQueue, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUQueue> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUQueue {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUQueue>) -> DomRoot<GPUQueue> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpuqueue::GPUQueue {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUQueue {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUQueue {
fn eq(&self, other: &GPUQueue) -> bool {
self as *const GPUQueue == other
}
}
pub trait GPUQueueMethods {
fn Submit(&self, buffers: Vec<DomRoot<GPUCommandBuffer>>);
fn OnSubmittedWorkDone(&self) -> Rc<Promise>;
fn WriteBuffer(&self, buffer: &GPUBuffer, bufferOffset: u64, data: UnionTypes::ArrayBufferViewOrArrayBuffer, dataOffset: u64, size: Option<u64>) -> Fallible<()>;
fn WriteTexture(&self, destination: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageCopyTexture, data: UnionTypes::ArrayBufferViewOrArrayBuffer, dataLayout: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUImageDataLayout, size: UnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict) -> Fallible<()>;
fn Label(&self) -> USVString;
fn SetLabel(&self, value: USVString);
}
const sMethods_specs: &[&[JSFunctionSpec]] = &[
&[
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"submit\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &submit_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"onSubmittedWorkDone\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &onSubmittedWorkDone_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"writeBuffer\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &writeBuffer_methodinfo as *const _ as *const JSJitInfo },
nargs: 3,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"writeTexture\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &writeTexture_methodinfo as *const _ as *const JSJitInfo },
nargs: 4,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: ptr::null() },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 0,
flags: 0,
selfHostedName: ptr::null()
}]
];
const sMethods: &[Guard<&[JSFunctionSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sMethods_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sMethods_specs[0])
];
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"label\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &label_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &label_setterinfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUQueue\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUQueue), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUQueuePrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUQueue() {\n [native code]\n}",
PrototypeList::ID::GPUQueue,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUQueue), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
sMethods,
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUQueue as usize].is_null());
(*cache)[PrototypeList::ID::GPUQueue as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUQueue as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUQueue\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPURenderBundle_Binding::{Wrap as GPURenderBundleWrap, GPURenderBundleMethods, GetProtoObject as GPURenderBundleGetProtoObject, DefineDOMInterface as GPURenderBundleDefineDOMInterface};
pub mod GPURenderBundle_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPURenderBundle;
unsafe extern fn get_label(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderBundle);
let result: USVString = this.Label();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
unsafe extern fn set_label(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderBundle);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.SetLabel(arg0);
true
})());
result
}
const label_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderBundle as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const label_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderBundle as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPURenderBundle>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPURenderBundle>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPURenderBundle\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPURenderBundle, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPURenderBundle> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPURenderBundle {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPURenderBundle>) -> DomRoot<GPURenderBundle> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpurenderbundle::GPURenderBundle {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPURenderBundle {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPURenderBundle {
fn eq(&self, other: &GPURenderBundle) -> bool {
self as *const GPURenderBundle == other
}
}
pub trait GPURenderBundleMethods {
fn Label(&self) -> USVString;
fn SetLabel(&self, value: USVString);
}
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"label\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &label_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &label_setterinfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPURenderBundle\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPURenderBundle), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPURenderBundlePrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPURenderBundle() {\n [native code]\n}",
PrototypeList::ID::GPURenderBundle,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPURenderBundle), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
&[],
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPURenderBundle as usize].is_null());
(*cache)[PrototypeList::ID::GPURenderBundle as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPURenderBundle as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPURenderBundle\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPURenderBundleEncoder_Binding::{Wrap as GPURenderBundleEncoderWrap, GPURenderBundleEncoderMethods, GetProtoObject as GPURenderBundleEncoderGetProtoObject, DefineDOMInterface as GPURenderBundleEncoderDefineDOMInterface};
pub mod GPURenderBundleEncoder_Binding {
use crate::dom;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUIndexFormat;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUIndexFormatValues;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderBundleDescriptor;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUBindGroup;
use crate::dom::types::GPUBuffer;
use crate::dom::types::GPURenderBundle;
use crate::dom::types::GPURenderBundleEncoder;
use crate::dom::types::GPURenderPipeline;
unsafe extern fn finish(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderBundleEncoder);
let args = &*args;
let argc = args.argc_;
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderBundleDescriptor = if args.get(0).is_undefined() {
crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderBundleDescriptor::empty()
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
}
};
let result: DomRoot<GPURenderBundle> = this.Finish(&arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const finish_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(finish)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderBundleEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_label(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderBundleEncoder);
let result: USVString = this.Label();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
unsafe extern fn set_label(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderBundleEncoder);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.SetLabel(arg0);
true
})());
result
}
const label_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderBundleEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const label_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderBundleEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn setBindGroup(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderBundleEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 2 {
throw_type_error(*cx, "Not enough arguments to \"GPURenderBundleEncoder.setBindGroup\".");
return false;
}
let arg0: u32 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let arg1: DomRoot<GPUBindGroup> = if HandleValue::from_raw(args.get(1)).get().is_object() {
match root_from_handlevalue(HandleValue::from_raw(args.get(1)), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUBindGroup.");
return false;
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return false;
};
let arg2: Vec<u32> = if args.get(2).is_undefined() {
Vec::new()
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(2)), ConversionBehavior::Default) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
}
};
let result: () = this.SetBindGroup(arg0, &arg1, arg2);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const setBindGroup_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(setBindGroup)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderBundleEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn setPipeline(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderBundleEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPURenderBundleEncoder.setPipeline\".");
return false;
}
let arg0: DomRoot<GPURenderPipeline> = if HandleValue::from_raw(args.get(0)).get().is_object() {
match root_from_handlevalue(HandleValue::from_raw(args.get(0)), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPURenderPipeline.");
return false;
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return false;
};
let result: () = this.SetPipeline(&arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const setPipeline_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(setPipeline)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderBundleEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn setIndexBuffer(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderBundleEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 2 {
throw_type_error(*cx, "Not enough arguments to \"GPURenderBundleEncoder.setIndexBuffer\".");
return false;
}
let arg0: DomRoot<GPUBuffer> = if HandleValue::from_raw(args.get(0)).get().is_object() {
match root_from_handlevalue(HandleValue::from_raw(args.get(0)), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUBuffer.");
return false;
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return false;
};
let arg1: GPUIndexFormat = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ()) { Err(_) => { return false;
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return false;
},
};
let arg2: u64 = if args.get(2).is_undefined() {
0
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let arg3: u64 = if args.get(3).is_undefined() {
0
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(3)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let result: () = this.SetIndexBuffer(&arg0, arg1, arg2, arg3);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const setIndexBuffer_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(setIndexBuffer)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderBundleEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn setVertexBuffer(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderBundleEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 2 {
throw_type_error(*cx, "Not enough arguments to \"GPURenderBundleEncoder.setVertexBuffer\".");
return false;
}
let arg0: u32 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let arg1: DomRoot<GPUBuffer> = if HandleValue::from_raw(args.get(1)).get().is_object() {
match root_from_handlevalue(HandleValue::from_raw(args.get(1)), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUBuffer.");
return false;
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return false;
};
let arg2: u64 = if args.get(2).is_undefined() {
0
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let arg3: u64 = if args.get(3).is_undefined() {
0
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(3)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let result: () = this.SetVertexBuffer(arg0, &arg1, arg2, arg3);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const setVertexBuffer_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(setVertexBuffer)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderBundleEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn draw(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderBundleEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPURenderBundleEncoder.draw\".");
return false;
}
let arg0: u32 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let arg1: u32 = if args.get(1).is_undefined() {
1
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let arg2: u32 = if args.get(2).is_undefined() {
0
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let arg3: u32 = if args.get(3).is_undefined() {
0
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(3)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let result: () = this.Draw(arg0, arg1, arg2, arg3);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const draw_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(draw)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderBundleEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn drawIndexed(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderBundleEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPURenderBundleEncoder.drawIndexed\".");
return false;
}
let arg0: u32 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let arg1: u32 = if args.get(1).is_undefined() {
1
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let arg2: u32 = if args.get(2).is_undefined() {
0
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let arg3: i32 = if args.get(3).is_undefined() {
0
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(3)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let arg4: u32 = if args.get(4).is_undefined() {
0
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(4)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let result: () = this.DrawIndexed(arg0, arg1, arg2, arg3, arg4);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const drawIndexed_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(drawIndexed)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderBundleEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn drawIndirect(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderBundleEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 2 {
throw_type_error(*cx, "Not enough arguments to \"GPURenderBundleEncoder.drawIndirect\".");
return false;
}
let arg0: DomRoot<GPUBuffer> = if HandleValue::from_raw(args.get(0)).get().is_object() {
match root_from_handlevalue(HandleValue::from_raw(args.get(0)), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUBuffer.");
return false;
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return false;
};
let arg1: u64 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let result: () = this.DrawIndirect(&arg0, arg1);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const drawIndirect_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(drawIndirect)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderBundleEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn drawIndexedIndirect(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderBundleEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 2 {
throw_type_error(*cx, "Not enough arguments to \"GPURenderBundleEncoder.drawIndexedIndirect\".");
return false;
}
let arg0: DomRoot<GPUBuffer> = if HandleValue::from_raw(args.get(0)).get().is_object() {
match root_from_handlevalue(HandleValue::from_raw(args.get(0)), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUBuffer.");
return false;
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return false;
};
let arg1: u64 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let result: () = this.DrawIndexedIndirect(&arg0, arg1);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const drawIndexedIndirect_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(drawIndexedIndirect)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderBundleEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPURenderBundleEncoder>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPURenderBundleEncoder>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPURenderBundleEncoder\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPURenderBundleEncoder, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPURenderBundleEncoder> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPURenderBundleEncoder {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPURenderBundleEncoder>) -> DomRoot<GPURenderBundleEncoder> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpurenderbundleencoder::GPURenderBundleEncoder {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPURenderBundleEncoder {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPURenderBundleEncoder {
fn eq(&self, other: &GPURenderBundleEncoder) -> bool {
self as *const GPURenderBundleEncoder == other
}
}
pub trait GPURenderBundleEncoderMethods {
fn Finish(&self, descriptor: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPURenderBundleDescriptor) -> DomRoot<GPURenderBundle>;
fn Label(&self) -> USVString;
fn SetLabel(&self, value: USVString);
fn SetBindGroup(&self, index: u32, bindGroup: &GPUBindGroup, dynamicOffsets: Vec<u32>);
fn SetPipeline(&self, pipeline: &GPURenderPipeline);
fn SetIndexBuffer(&self, buffer: &GPUBuffer, indexFormat: GPUIndexFormat, offset: u64, size: u64);
fn SetVertexBuffer(&self, slot: u32, buffer: &GPUBuffer, offset: u64, size: u64);
fn Draw(&self, vertexCount: u32, instanceCount: u32, firstVertex: u32, firstInstance: u32);
fn DrawIndexed(&self, indexCount: u32, instanceCount: u32, firstIndex: u32, baseVertex: i32, firstInstance: u32);
fn DrawIndirect(&self, indirectBuffer: &GPUBuffer, indirectOffset: u64);
fn DrawIndexedIndirect(&self, indirectBuffer: &GPUBuffer, indirectOffset: u64);
}
const sMethods_specs: &[&[JSFunctionSpec]] = &[
&[
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"finish\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &finish_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"setBindGroup\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &setBindGroup_methodinfo as *const _ as *const JSJitInfo },
nargs: 2,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"setPipeline\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &setPipeline_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"setIndexBuffer\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &setIndexBuffer_methodinfo as *const _ as *const JSJitInfo },
nargs: 2,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"setVertexBuffer\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &setVertexBuffer_methodinfo as *const _ as *const JSJitInfo },
nargs: 2,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"draw\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &draw_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"drawIndexed\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &drawIndexed_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"drawIndirect\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &drawIndirect_methodinfo as *const _ as *const JSJitInfo },
nargs: 2,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"drawIndexedIndirect\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &drawIndexedIndirect_methodinfo as *const _ as *const JSJitInfo },
nargs: 2,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: ptr::null() },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 0,
flags: 0,
selfHostedName: ptr::null()
}]
];
const sMethods: &[Guard<&[JSFunctionSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sMethods_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sMethods_specs[0])
];
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"label\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &label_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &label_setterinfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPURenderBundleEncoder\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPURenderBundleEncoder), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPURenderBundleEncoderPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPURenderBundleEncoder() {\n [native code]\n}",
PrototypeList::ID::GPURenderBundleEncoder,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPURenderBundleEncoder), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
sMethods,
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPURenderBundleEncoder as usize].is_null());
(*cache)[PrototypeList::ID::GPURenderBundleEncoder as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPURenderBundleEncoder as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPURenderBundleEncoder\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPURenderPassEncoder_Binding::{Wrap as GPURenderPassEncoderWrap, GPURenderPassEncoderMethods, GetProtoObject as GPURenderPassEncoderGetProtoObject, DefineDOMInterface as GPURenderPassEncoderDefineDOMInterface};
pub mod GPURenderPassEncoder_Binding {
use crate::dom;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUColorDict;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUIndexFormat;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUIndexFormatValues;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUBindGroup;
use crate::dom::types::GPUBuffer;
use crate::dom::types::GPURenderBundle;
use crate::dom::types::GPURenderPassEncoder;
use crate::dom::types::GPURenderPipeline;
unsafe extern fn setViewport(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderPassEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 6 {
throw_type_error(*cx, "Not enough arguments to \"GPURenderPassEncoder.setViewport\".");
return false;
}
let arg0: Finite<f32> = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let arg1: Finite<f32> = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let arg2: Finite<f32> = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(2)), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let arg3: Finite<f32> = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(3)), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let arg4: Finite<f32> = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(4)), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let arg5: Finite<f32> = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(5)), ()) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let result: () = this.SetViewport(arg0, arg1, arg2, arg3, arg4, arg5);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const setViewport_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(setViewport)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn setScissorRect(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderPassEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 4 {
throw_type_error(*cx, "Not enough arguments to \"GPURenderPassEncoder.setScissorRect\".");
return false;
}
let arg0: u32 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let arg1: u32 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let arg2: u32 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let arg3: u32 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(3)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let result: () = this.SetScissorRect(arg0, arg1, arg2, arg3);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const setScissorRect_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(setScissorRect)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn setBlendConstant(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderPassEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPURenderPassEncoder.setBlendConstant\".");
return false;
}
let arg0: UnionTypes::DoubleSequenceOrGPUColorDict = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.SetBlendConstant(arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const setBlendConstant_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(setBlendConstant)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn setStencilReference(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderPassEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPURenderPassEncoder.setStencilReference\".");
return false;
}
let arg0: u32 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let result: () = this.SetStencilReference(arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const setStencilReference_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(setStencilReference)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn executeBundles(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderPassEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPURenderPassEncoder.executeBundles\".");
return false;
}
let arg0: Vec<DomRoot<GPURenderBundle>> = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.ExecuteBundles(arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const executeBundles_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(executeBundles)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn end(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderPassEncoder);
let args = &*args;
let argc = args.argc_;
let result: Result<(), Error> = this.End();
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const end_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(end)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_label(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderPassEncoder);
let result: USVString = this.Label();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
unsafe extern fn set_label(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderPassEncoder);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.SetLabel(arg0);
true
})());
result
}
const label_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const label_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn setBindGroup(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderPassEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 2 {
throw_type_error(*cx, "Not enough arguments to \"GPURenderPassEncoder.setBindGroup\".");
return false;
}
let arg0: u32 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let arg1: DomRoot<GPUBindGroup> = if HandleValue::from_raw(args.get(1)).get().is_object() {
match root_from_handlevalue(HandleValue::from_raw(args.get(1)), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUBindGroup.");
return false;
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return false;
};
let arg2: Vec<u32> = if args.get(2).is_undefined() {
Vec::new()
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(2)), ConversionBehavior::Default) {
Ok(ConversionResult::Success(value)) => value,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
}
};
let result: () = this.SetBindGroup(arg0, &arg1, arg2);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const setBindGroup_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(setBindGroup)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn setPipeline(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderPassEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPURenderPassEncoder.setPipeline\".");
return false;
}
let arg0: DomRoot<GPURenderPipeline> = if HandleValue::from_raw(args.get(0)).get().is_object() {
match root_from_handlevalue(HandleValue::from_raw(args.get(0)), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPURenderPipeline.");
return false;
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return false;
};
let result: () = this.SetPipeline(&arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const setPipeline_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(setPipeline)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn setIndexBuffer(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderPassEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 2 {
throw_type_error(*cx, "Not enough arguments to \"GPURenderPassEncoder.setIndexBuffer\".");
return false;
}
let arg0: DomRoot<GPUBuffer> = if HandleValue::from_raw(args.get(0)).get().is_object() {
match root_from_handlevalue(HandleValue::from_raw(args.get(0)), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUBuffer.");
return false;
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return false;
};
let arg1: GPUIndexFormat = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ()) { Err(_) => { return false;
},
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => { throw_type_error(*cx, &error); return false;
},
};
let arg2: u64 = if args.get(2).is_undefined() {
0
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let arg3: u64 = if args.get(3).is_undefined() {
0
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(3)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let result: () = this.SetIndexBuffer(&arg0, arg1, arg2, arg3);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const setIndexBuffer_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(setIndexBuffer)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn setVertexBuffer(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderPassEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 2 {
throw_type_error(*cx, "Not enough arguments to \"GPURenderPassEncoder.setVertexBuffer\".");
return false;
}
let arg0: u32 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let arg1: DomRoot<GPUBuffer> = if HandleValue::from_raw(args.get(1)).get().is_object() {
match root_from_handlevalue(HandleValue::from_raw(args.get(1)), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUBuffer.");
return false;
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return false;
};
let arg2: u64 = if args.get(2).is_undefined() {
0
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let arg3: u64 = if args.get(3).is_undefined() {
0
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(3)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let result: () = this.SetVertexBuffer(arg0, &arg1, arg2, arg3);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const setVertexBuffer_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(setVertexBuffer)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn draw(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderPassEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPURenderPassEncoder.draw\".");
return false;
}
let arg0: u32 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let arg1: u32 = if args.get(1).is_undefined() {
1
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let arg2: u32 = if args.get(2).is_undefined() {
0
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let arg3: u32 = if args.get(3).is_undefined() {
0
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(3)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let result: () = this.Draw(arg0, arg1, arg2, arg3);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const draw_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(draw)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn drawIndexed(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderPassEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPURenderPassEncoder.drawIndexed\".");
return false;
}
let arg0: u32 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let arg1: u32 = if args.get(1).is_undefined() {
1
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let arg2: u32 = if args.get(2).is_undefined() {
0
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let arg3: i32 = if args.get(3).is_undefined() {
0
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(3)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let arg4: u32 = if args.get(4).is_undefined() {
0
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(4)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
}
};
let result: () = this.DrawIndexed(arg0, arg1, arg2, arg3, arg4);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const drawIndexed_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(drawIndexed)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn drawIndirect(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderPassEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 2 {
throw_type_error(*cx, "Not enough arguments to \"GPURenderPassEncoder.drawIndirect\".");
return false;
}
let arg0: DomRoot<GPUBuffer> = if HandleValue::from_raw(args.get(0)).get().is_object() {
match root_from_handlevalue(HandleValue::from_raw(args.get(0)), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUBuffer.");
return false;
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return false;
};
let arg1: u64 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let result: () = this.DrawIndirect(&arg0, arg1);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const drawIndirect_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(drawIndirect)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn drawIndexedIndirect(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderPassEncoder);
let args = &*args;
let argc = args.argc_;
if argc < 2 {
throw_type_error(*cx, "Not enough arguments to \"GPURenderPassEncoder.drawIndexedIndirect\".");
return false;
}
let arg0: DomRoot<GPUBuffer> = if HandleValue::from_raw(args.get(0)).get().is_object() {
match root_from_handlevalue(HandleValue::from_raw(args.get(0)), *cx) {
Ok(val) => val,
Err(()) => {
throw_type_error(*cx, "value does not implement interface GPUBuffer.");
return false;
}
}
} else {
throw_type_error(*cx, "Value is not an object.");
return false;
};
let arg1: u64 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let result: () = this.DrawIndexedIndirect(&arg0, arg1);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const drawIndexedIndirect_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(drawIndexedIndirect)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPURenderPassEncoder>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPURenderPassEncoder>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPURenderPassEncoder\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPURenderPassEncoder, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPURenderPassEncoder> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPURenderPassEncoder {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPURenderPassEncoder>) -> DomRoot<GPURenderPassEncoder> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpurenderpassencoder::GPURenderPassEncoder {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPURenderPassEncoder {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPURenderPassEncoder {
fn eq(&self, other: &GPURenderPassEncoder) -> bool {
self as *const GPURenderPassEncoder == other
}
}
pub trait GPURenderPassEncoderMethods {
fn SetViewport(&self, x: Finite<f32>, y: Finite<f32>, width: Finite<f32>, height: Finite<f32>, minDepth: Finite<f32>, maxDepth: Finite<f32>);
fn SetScissorRect(&self, x: u32, y: u32, width: u32, height: u32);
fn SetBlendConstant(&self, color: UnionTypes::DoubleSequenceOrGPUColorDict);
fn SetStencilReference(&self, reference: u32);
fn ExecuteBundles(&self, bundles: Vec<DomRoot<GPURenderBundle>>);
fn End(&self) -> Fallible<()>;
fn Label(&self) -> USVString;
fn SetLabel(&self, value: USVString);
fn SetBindGroup(&self, index: u32, bindGroup: &GPUBindGroup, dynamicOffsets: Vec<u32>);
fn SetPipeline(&self, pipeline: &GPURenderPipeline);
fn SetIndexBuffer(&self, buffer: &GPUBuffer, indexFormat: GPUIndexFormat, offset: u64, size: u64);
fn SetVertexBuffer(&self, slot: u32, buffer: &GPUBuffer, offset: u64, size: u64);
fn Draw(&self, vertexCount: u32, instanceCount: u32, firstVertex: u32, firstInstance: u32);
fn DrawIndexed(&self, indexCount: u32, instanceCount: u32, firstIndex: u32, baseVertex: i32, firstInstance: u32);
fn DrawIndirect(&self, indirectBuffer: &GPUBuffer, indirectOffset: u64);
fn DrawIndexedIndirect(&self, indirectBuffer: &GPUBuffer, indirectOffset: u64);
}
const sMethods_specs: &[&[JSFunctionSpec]] = &[
&[
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"setViewport\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &setViewport_methodinfo as *const _ as *const JSJitInfo },
nargs: 6,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"setScissorRect\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &setScissorRect_methodinfo as *const _ as *const JSJitInfo },
nargs: 4,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"setBlendConstant\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &setBlendConstant_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"setStencilReference\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &setStencilReference_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"executeBundles\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &executeBundles_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"end\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &end_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"setBindGroup\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &setBindGroup_methodinfo as *const _ as *const JSJitInfo },
nargs: 2,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"setPipeline\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &setPipeline_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"setIndexBuffer\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &setIndexBuffer_methodinfo as *const _ as *const JSJitInfo },
nargs: 2,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"setVertexBuffer\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &setVertexBuffer_methodinfo as *const _ as *const JSJitInfo },
nargs: 2,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"draw\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &draw_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"drawIndexed\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &drawIndexed_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"drawIndirect\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &drawIndirect_methodinfo as *const _ as *const JSJitInfo },
nargs: 2,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"drawIndexedIndirect\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &drawIndexedIndirect_methodinfo as *const _ as *const JSJitInfo },
nargs: 2,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: ptr::null() },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 0,
flags: 0,
selfHostedName: ptr::null()
}]
];
const sMethods: &[Guard<&[JSFunctionSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sMethods_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sMethods_specs[0])
];
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"label\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &label_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &label_setterinfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPURenderPassEncoder\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPURenderPassEncoder), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPURenderPassEncoderPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPURenderPassEncoder() {\n [native code]\n}",
PrototypeList::ID::GPURenderPassEncoder,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPURenderPassEncoder), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
sMethods,
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPURenderPassEncoder as usize].is_null());
(*cache)[PrototypeList::ID::GPURenderPassEncoder as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPURenderPassEncoder as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPURenderPassEncoder\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPURenderPipeline_Binding::{Wrap as GPURenderPipelineWrap, GPURenderPipelineMethods, GetProtoObject as GPURenderPipelineGetProtoObject, DefineDOMInterface as GPURenderPipelineDefineDOMInterface};
pub mod GPURenderPipeline_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUBindGroupLayout;
use crate::dom::types::GPURenderPipeline;
unsafe extern fn get_label(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderPipeline);
let result: USVString = this.Label();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
unsafe extern fn set_label(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderPipeline);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.SetLabel(arg0);
true
})());
result
}
const label_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderPipeline as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const label_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderPipeline as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn getBindGroupLayout(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPURenderPipeline);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPURenderPipeline.getBindGroupLayout\".");
return false;
}
let arg0: u32 = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ConversionBehavior::Default) {
Ok(ConversionResult::Success(v)) => v,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
}
};
let result: Result<DomRoot<GPUBindGroupLayout>, Error> = this.GetBindGroupLayout(arg0);
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const getBindGroupLayout_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(getBindGroupLayout)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPURenderPipeline as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPURenderPipeline>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPURenderPipeline>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPURenderPipeline\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPURenderPipeline, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPURenderPipeline> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPURenderPipeline {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPURenderPipeline>) -> DomRoot<GPURenderPipeline> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpurenderpipeline::GPURenderPipeline {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPURenderPipeline {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPURenderPipeline {
fn eq(&self, other: &GPURenderPipeline) -> bool {
self as *const GPURenderPipeline == other
}
}
pub trait GPURenderPipelineMethods {
fn Label(&self) -> USVString;
fn SetLabel(&self, value: USVString);
fn GetBindGroupLayout(&self, index: u32) -> Fallible<DomRoot<GPUBindGroupLayout>>;
}
const sMethods_specs: &[&[JSFunctionSpec]] = &[
&[
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"getBindGroupLayout\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &getBindGroupLayout_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: ptr::null() },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 0,
flags: 0,
selfHostedName: ptr::null()
}]
];
const sMethods: &[Guard<&[JSFunctionSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sMethods_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sMethods_specs[0])
];
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"label\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &label_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &label_setterinfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPURenderPipeline\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPURenderPipeline), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPURenderPipelinePrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPURenderPipeline() {\n [native code]\n}",
PrototypeList::ID::GPURenderPipeline,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPURenderPipeline), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
sMethods,
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPURenderPipeline as usize].is_null());
(*cache)[PrototypeList::ID::GPURenderPipeline as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPURenderPipeline as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPURenderPipeline\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUSampler_Binding::{Wrap as GPUSamplerWrap, GPUSamplerMethods, GetProtoObject as GPUSamplerGetProtoObject, DefineDOMInterface as GPUSamplerDefineDOMInterface};
pub mod GPUSampler_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUSampler;
unsafe extern fn get_label(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSampler);
let result: USVString = this.Label();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
unsafe extern fn set_label(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSampler);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.SetLabel(arg0);
true
})());
result
}
const label_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSampler as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const label_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSampler as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUSampler>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUSampler>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUSampler\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUSampler, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUSampler> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUSampler {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUSampler>) -> DomRoot<GPUSampler> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpusampler::GPUSampler {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUSampler {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUSampler {
fn eq(&self, other: &GPUSampler) -> bool {
self as *const GPUSampler == other
}
}
pub trait GPUSamplerMethods {
fn Label(&self) -> USVString;
fn SetLabel(&self, value: USVString);
}
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"label\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &label_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &label_setterinfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUSampler\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUSampler), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUSamplerPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUSampler() {\n [native code]\n}",
PrototypeList::ID::GPUSampler,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUSampler), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
&[],
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUSampler as usize].is_null());
(*cache)[PrototypeList::ID::GPUSampler as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUSampler as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUSampler\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUShaderModule_Binding::{Wrap as GPUShaderModuleWrap, GPUShaderModuleMethods, GetProtoObject as GPUShaderModuleGetProtoObject, DefineDOMInterface as GPUShaderModuleDefineDOMInterface};
pub mod GPUShaderModule_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::promise::Promise;
use crate::dom::types::GPUShaderModule;
unsafe extern fn getCompilationInfo(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUShaderModule);
let args = &*args;
let argc = args.argc_;
let result: Result<Rc<Promise>, Error> = this.GetCompilationInfo();
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const getCompilationInfo_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(getCompilationInfo)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUShaderModule as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_label(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUShaderModule);
let result: USVString = this.Label();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
unsafe extern fn set_label(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUShaderModule);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.SetLabel(arg0);
true
})());
result
}
const label_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUShaderModule as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const label_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUShaderModule as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUShaderModule>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUShaderModule>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUShaderModule\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUShaderModule, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUShaderModule> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUShaderModule {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUShaderModule>) -> DomRoot<GPUShaderModule> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpushadermodule::GPUShaderModule {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUShaderModule {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUShaderModule {
fn eq(&self, other: &GPUShaderModule) -> bool {
self as *const GPUShaderModule == other
}
}
pub trait GPUShaderModuleMethods {
fn GetCompilationInfo(&self) -> Fallible<Rc<Promise>>;
fn Label(&self) -> USVString;
fn SetLabel(&self, value: USVString);
}
const sMethods_specs: &[&[JSFunctionSpec]] = &[
&[
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"getCompilationInfo\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &getCompilationInfo_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: ptr::null() },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 0,
flags: 0,
selfHostedName: ptr::null()
}]
];
const sMethods: &[Guard<&[JSFunctionSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sMethods_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sMethods_specs[0])
];
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"label\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &label_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &label_setterinfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUShaderModule\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUShaderModule), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUShaderModulePrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUShaderModule() {\n [native code]\n}",
PrototypeList::ID::GPUShaderModule,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUShaderModule), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
sMethods,
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUShaderModule as usize].is_null());
(*cache)[PrototypeList::ID::GPUShaderModule as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUShaderModule as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUShaderModule\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUShaderStage_Binding::{GPUShaderStageConstants, Wrap as GPUShaderStageWrap, GetProtoObject as GPUShaderStageGetProtoObject, DefineDOMInterface as GPUShaderStageDefineDOMInterface};
pub mod GPUShaderStage_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUShaderStage;
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUShaderStage>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUShaderStage>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
pub mod GPUShaderStageConstants {
pub const VERTEX: u32 = 1;
pub const FRAGMENT: u32 = 2;
pub const COMPUTE: u32 = 4;
} static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUShaderStage\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUShaderStage, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUShaderStage> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUShaderStage {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUShaderStage>) -> DomRoot<GPUShaderStage> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpushaderstage::GPUShaderStage {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUShaderStage {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUShaderStage {
fn eq(&self, other: &GPUShaderStage) -> bool {
self as *const GPUShaderStage == other
}
}
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUShaderStage\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Satisfied, sAttributes_specs[0])
];
const sConstants_specs: &[&[ConstantSpec]] = &[
&[
ConstantSpec { name: b"VERTEX\0", value: ConstantVal::UintVal(1) },
ConstantSpec { name: b"FRAGMENT\0", value: ConstantVal::UintVal(2) },
ConstantSpec { name: b"COMPUTE\0", value: ConstantVal::UintVal(4) }]
];
const sConstants: &[Guard<&[ConstantSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sConstants_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sConstants_specs[0])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUShaderStage), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUShaderStagePrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUShaderStage() {\n [native code]\n}",
PrototypeList::ID::GPUShaderStage,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUShaderStage), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
&[],
sAttributes,
sConstants,
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUShaderStage as usize].is_null());
(*cache)[PrototypeList::ID::GPUShaderStage as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUShaderStage as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
sConstants,
prototype.handle(),
b"GPUShaderStage\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUSupportedFeatures_Binding::{Wrap as GPUSupportedFeaturesWrap, GPUSupportedFeaturesMethods, GetProtoObject as GPUSupportedFeaturesGetProtoObject, DefineDOMInterface as GPUSupportedFeaturesDefineDOMInterface};
pub mod GPUSupportedFeatures_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUSupportedFeatures;
unsafe extern fn get_size(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedFeatures);
let result: u32 = this.Size();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const size_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_size)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedFeatures as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn entries(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedFeatures);
let args = &*args;
let argc = args.argc_;
let result = crate::dom::bindings::iterable::IterableIterator::new(this, IteratorType::Entries);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const entries_methodinfo_argTypes: [i32; 1] = [ JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
const entries_methodinfo: JSTypedMethodJitInfo = JSTypedMethodJitInfo {
base: JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(entries)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedFeatures as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
true,
0,
).to_ne_bytes()
),
},
argTypes: &entries_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
};
unsafe extern fn keys(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedFeatures);
let args = &*args;
let argc = args.argc_;
let result = crate::dom::bindings::iterable::IterableIterator::new(this, IteratorType::Keys);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const keys_methodinfo_argTypes: [i32; 1] = [ JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
const keys_methodinfo: JSTypedMethodJitInfo = JSTypedMethodJitInfo {
base: JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(keys)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedFeatures as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
true,
0,
).to_ne_bytes()
),
},
argTypes: &keys_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
};
unsafe extern fn values(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedFeatures);
let args = &*args;
let argc = args.argc_;
let result = crate::dom::bindings::iterable::IterableIterator::new(this, IteratorType::Values);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const values_methodinfo_argTypes: [i32; 1] = [ JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
const values_methodinfo: JSTypedMethodJitInfo = JSTypedMethodJitInfo {
base: JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(values)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedFeatures as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
true,
0,
).to_ne_bytes()
),
},
argTypes: &values_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
};
unsafe extern fn forEach(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedFeatures);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPUSupportedFeatures.forEach\".");
return false;
}
let arg0: *mut JSObject = if HandleValue::from_raw(args.get(0)).get().is_object() {
HandleValue::from_raw(args.get(0)).get().to_object()
} else {
throw_type_error(*cx, "Value is not an object.");
return false;
};
let arg1: HandleValue = if args.get(1).is_undefined() {
HandleValue::undefined()
} else {
HandleValue::from_raw(args.get(1))
};
if !IsCallable(arg0) {
throw_type_error(*cx, "Argument 1 of GPUSupportedFeatures.forEach is not callable.");
return false;
}
rooted!(in(*cx) let arg0 = ObjectValue(arg0));
rooted!(in(*cx) let mut call_arg1 = UndefinedValue());
rooted!(in(*cx) let mut call_arg2 = UndefinedValue());
let mut call_args = [UndefinedValue(), UndefinedValue(), ObjectValue(*_obj)];
rooted!(in(*cx) let mut ignoredReturnVal = UndefinedValue());
let mut i = 0;
while i < (*this).get_iterable_length() {
(*this).get_value_at_index(i).to_jsval(*cx, call_arg1.handle_mut());
(*this).get_key_at_index(i).to_jsval(*cx, call_arg2.handle_mut());
call_args[0] = call_arg1.handle().get();
call_args[1] = call_arg2.handle().get();
let call_args = HandleValueArray { length_: 3, elements_: call_args.as_ptr() };
if !Call(*cx, arg1, arg0.handle(), &call_args,
ignoredReturnVal.handle_mut()) {
return false;
}
i += 1;
}
let result = ();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const forEach_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(forEach)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedFeatures as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn has(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedFeatures);
let args = &*args;
let argc = args.argc_;
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPUSupportedFeatures.has\".");
return false;
}
let arg0: DOMString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result = Setlike::has(this, arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const has_methodinfo_argTypes: [i32; 2] = [ JSJitInfo_ArgType::String as i32, JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
const has_methodinfo: JSTypedMethodJitInfo = JSTypedMethodJitInfo {
base: JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(has)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedFeatures as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasDOMSets as u8,
JSValueType::JSVAL_TYPE_BOOLEAN as u8,
false,
false,
false,
false,
false,
true,
0,
).to_ne_bytes()
),
},
argTypes: &has_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUSupportedFeatures>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUSupportedFeatures>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUSupportedFeatures\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUSupportedFeatures, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUSupportedFeatures> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUSupportedFeatures {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUSupportedFeatures>) -> DomRoot<GPUSupportedFeatures> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpusupportedfeatures::GPUSupportedFeatures {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUSupportedFeatures {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUSupportedFeatures {
fn eq(&self, other: &GPUSupportedFeatures) -> bool {
self as *const GPUSupportedFeatures == other
}
}
pub trait GPUSupportedFeaturesMethods {
fn Size(&self) -> u32;
}
const sMethods_specs: &[&[JSFunctionSpec]] = &[
&[
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"entries\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &entries_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"keys\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &keys_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"values\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &values_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"forEach\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &forEach_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"has\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &has_methodinfo as *const _ as *const JSJitInfo },
nargs: 1,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: ptr::null() },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 0,
flags: 0,
selfHostedName: ptr::null()
}]
];
const sMethods: &[Guard<&[JSFunctionSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sMethods_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sMethods_specs[0])
];
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"size\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &size_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUSupportedFeatures\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUSupportedFeatures), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUSupportedFeaturesPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUSupportedFeatures() {\n [native code]\n}",
PrototypeList::ID::GPUSupportedFeatures,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUSupportedFeatures), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
sMethods,
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUSupportedFeatures as usize].is_null());
(*cache)[PrototypeList::ID::GPUSupportedFeatures as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUSupportedFeatures as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUSupportedFeatures\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
rooted!(in(*cx) let mut aliasedVal = UndefinedValue());
assert!(JS_GetProperty(*cx, prototype.handle(),
b"values\0" as *const u8 as *const _,
aliasedVal.handle_mut()));
rooted!(in(*cx) let mut iteratorId: jsid);
RUST_SYMBOL_TO_JSID(GetWellKnownSymbol(*cx, SymbolCode::iterator), iteratorId.handle_mut());
assert!(JS_DefinePropertyById2(*cx, prototype.handle(), iteratorId.handle(), aliasedVal.handle(), 0));
}
} pub use self::GPUSupportedLimits_Binding::{Wrap as GPUSupportedLimitsWrap, GPUSupportedLimitsMethods, GetProtoObject as GPUSupportedLimitsGetProtoObject, DefineDOMInterface as GPUSupportedLimitsDefineDOMInterface};
pub mod GPUSupportedLimits_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUSupportedLimits;
unsafe extern fn get_maxTextureDimension1D(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxTextureDimension1D();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxTextureDimension1D_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxTextureDimension1D)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxTextureDimension2D(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxTextureDimension2D();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxTextureDimension2D_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxTextureDimension2D)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxTextureDimension3D(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxTextureDimension3D();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxTextureDimension3D_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxTextureDimension3D)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxTextureArrayLayers(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxTextureArrayLayers();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxTextureArrayLayers_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxTextureArrayLayers)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxBindGroups(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxBindGroups();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxBindGroups_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxBindGroups)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxBindingsPerBindGroup(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxBindingsPerBindGroup();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxBindingsPerBindGroup_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxBindingsPerBindGroup)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxDynamicUniformBuffersPerPipelineLayout(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxDynamicUniformBuffersPerPipelineLayout();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxDynamicUniformBuffersPerPipelineLayout_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxDynamicUniformBuffersPerPipelineLayout)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxDynamicStorageBuffersPerPipelineLayout(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxDynamicStorageBuffersPerPipelineLayout();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxDynamicStorageBuffersPerPipelineLayout_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxDynamicStorageBuffersPerPipelineLayout)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxSampledTexturesPerShaderStage(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxSampledTexturesPerShaderStage();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxSampledTexturesPerShaderStage_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxSampledTexturesPerShaderStage)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxSamplersPerShaderStage(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxSamplersPerShaderStage();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxSamplersPerShaderStage_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxSamplersPerShaderStage)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxStorageBuffersPerShaderStage(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxStorageBuffersPerShaderStage();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxStorageBuffersPerShaderStage_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxStorageBuffersPerShaderStage)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxStorageTexturesPerShaderStage(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxStorageTexturesPerShaderStage();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxStorageTexturesPerShaderStage_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxStorageTexturesPerShaderStage)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxUniformBuffersPerShaderStage(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxUniformBuffersPerShaderStage();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxUniformBuffersPerShaderStage_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxUniformBuffersPerShaderStage)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxUniformBufferBindingSize(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u64 = this.MaxUniformBufferBindingSize();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxUniformBufferBindingSize_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxUniformBufferBindingSize)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxStorageBufferBindingSize(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u64 = this.MaxStorageBufferBindingSize();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxStorageBufferBindingSize_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxStorageBufferBindingSize)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_minUniformBufferOffsetAlignment(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MinUniformBufferOffsetAlignment();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const minUniformBufferOffsetAlignment_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_minUniformBufferOffsetAlignment)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_minStorageBufferOffsetAlignment(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MinStorageBufferOffsetAlignment();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const minStorageBufferOffsetAlignment_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_minStorageBufferOffsetAlignment)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxVertexBuffers(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxVertexBuffers();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxVertexBuffers_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxVertexBuffers)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxBufferSize(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u64 = this.MaxBufferSize();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxBufferSize_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxBufferSize)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxVertexAttributes(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxVertexAttributes();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxVertexAttributes_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxVertexAttributes)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxVertexBufferArrayStride(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxVertexBufferArrayStride();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxVertexBufferArrayStride_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxVertexBufferArrayStride)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxInterStageShaderComponents(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxInterStageShaderComponents();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxInterStageShaderComponents_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxInterStageShaderComponents)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxComputeWorkgroupStorageSize(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxComputeWorkgroupStorageSize();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxComputeWorkgroupStorageSize_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxComputeWorkgroupStorageSize)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxComputeInvocationsPerWorkgroup(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxComputeInvocationsPerWorkgroup();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxComputeInvocationsPerWorkgroup_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxComputeInvocationsPerWorkgroup)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxComputeWorkgroupSizeX(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxComputeWorkgroupSizeX();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxComputeWorkgroupSizeX_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxComputeWorkgroupSizeX)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxComputeWorkgroupSizeY(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxComputeWorkgroupSizeY();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxComputeWorkgroupSizeY_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxComputeWorkgroupSizeY)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxComputeWorkgroupSizeZ(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxComputeWorkgroupSizeZ();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxComputeWorkgroupSizeZ_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxComputeWorkgroupSizeZ)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_maxComputeWorkgroupsPerDimension(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUSupportedLimits);
let result: u32 = this.MaxComputeWorkgroupsPerDimension();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const maxComputeWorkgroupsPerDimension_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_maxComputeWorkgroupsPerDimension)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedLimits as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_DOUBLE as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUSupportedLimits>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUSupportedLimits>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUSupportedLimits\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUSupportedLimits, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUSupportedLimits> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUSupportedLimits {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUSupportedLimits>) -> DomRoot<GPUSupportedLimits> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpusupportedlimits::GPUSupportedLimits {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUSupportedLimits {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUSupportedLimits {
fn eq(&self, other: &GPUSupportedLimits) -> bool {
self as *const GPUSupportedLimits == other
}
}
pub trait GPUSupportedLimitsMethods {
fn MaxTextureDimension1D(&self) -> u32;
fn MaxTextureDimension2D(&self) -> u32;
fn MaxTextureDimension3D(&self) -> u32;
fn MaxTextureArrayLayers(&self) -> u32;
fn MaxBindGroups(&self) -> u32;
fn MaxBindingsPerBindGroup(&self) -> u32;
fn MaxDynamicUniformBuffersPerPipelineLayout(&self) -> u32;
fn MaxDynamicStorageBuffersPerPipelineLayout(&self) -> u32;
fn MaxSampledTexturesPerShaderStage(&self) -> u32;
fn MaxSamplersPerShaderStage(&self) -> u32;
fn MaxStorageBuffersPerShaderStage(&self) -> u32;
fn MaxStorageTexturesPerShaderStage(&self) -> u32;
fn MaxUniformBuffersPerShaderStage(&self) -> u32;
fn MaxUniformBufferBindingSize(&self) -> u64;
fn MaxStorageBufferBindingSize(&self) -> u64;
fn MinUniformBufferOffsetAlignment(&self) -> u32;
fn MinStorageBufferOffsetAlignment(&self) -> u32;
fn MaxVertexBuffers(&self) -> u32;
fn MaxBufferSize(&self) -> u64;
fn MaxVertexAttributes(&self) -> u32;
fn MaxVertexBufferArrayStride(&self) -> u32;
fn MaxInterStageShaderComponents(&self) -> u32;
fn MaxComputeWorkgroupStorageSize(&self) -> u32;
fn MaxComputeInvocationsPerWorkgroup(&self) -> u32;
fn MaxComputeWorkgroupSizeX(&self) -> u32;
fn MaxComputeWorkgroupSizeY(&self) -> u32;
fn MaxComputeWorkgroupSizeZ(&self) -> u32;
fn MaxComputeWorkgroupsPerDimension(&self) -> u32;
}
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxTextureDimension1D\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxTextureDimension1D_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxTextureDimension2D\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxTextureDimension2D_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxTextureDimension3D\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxTextureDimension3D_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxTextureArrayLayers\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxTextureArrayLayers_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxBindGroups\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxBindGroups_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxBindingsPerBindGroup\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxBindingsPerBindGroup_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxDynamicUniformBuffersPerPipelineLayout\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxDynamicUniformBuffersPerPipelineLayout_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxDynamicStorageBuffersPerPipelineLayout\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxDynamicStorageBuffersPerPipelineLayout_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxSampledTexturesPerShaderStage\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxSampledTexturesPerShaderStage_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxSamplersPerShaderStage\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxSamplersPerShaderStage_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxStorageBuffersPerShaderStage\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxStorageBuffersPerShaderStage_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxStorageTexturesPerShaderStage\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxStorageTexturesPerShaderStage_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxUniformBuffersPerShaderStage\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxUniformBuffersPerShaderStage_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxUniformBufferBindingSize\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxUniformBufferBindingSize_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxStorageBufferBindingSize\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxStorageBufferBindingSize_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"minUniformBufferOffsetAlignment\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &minUniformBufferOffsetAlignment_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"minStorageBufferOffsetAlignment\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &minStorageBufferOffsetAlignment_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxVertexBuffers\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxVertexBuffers_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxBufferSize\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxBufferSize_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxVertexAttributes\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxVertexAttributes_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxVertexBufferArrayStride\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxVertexBufferArrayStride_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxInterStageShaderComponents\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxInterStageShaderComponents_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxComputeWorkgroupStorageSize\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxComputeWorkgroupStorageSize_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxComputeInvocationsPerWorkgroup\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxComputeInvocationsPerWorkgroup_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxComputeWorkgroupSizeX\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxComputeWorkgroupSizeX_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxComputeWorkgroupSizeY\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxComputeWorkgroupSizeY_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxComputeWorkgroupSizeZ\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxComputeWorkgroupSizeZ_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"maxComputeWorkgroupsPerDimension\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &maxComputeWorkgroupsPerDimension_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUSupportedLimits\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUSupportedLimits), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUSupportedLimitsPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUSupportedLimits() {\n [native code]\n}",
PrototypeList::ID::GPUSupportedLimits,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUSupportedLimits), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
&[],
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUSupportedLimits as usize].is_null());
(*cache)[PrototypeList::ID::GPUSupportedLimits as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUSupportedLimits as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUSupportedLimits\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUTexture_Binding::{Wrap as GPUTextureWrap, GPUTextureMethods, GetProtoObject as GPUTextureGetProtoObject, DefineDOMInterface as GPUTextureDefineDOMInterface};
pub mod GPUTexture_Binding {
use crate::dom;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureAspect;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureAspectValues;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureFormat;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureFormatValues;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureViewDescriptor;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureViewDimension;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureViewDimensionValues;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUTexture;
use crate::dom::types::GPUTextureView;
unsafe extern fn createView(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUTexture);
let args = &*args;
let argc = args.argc_;
let arg0: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureViewDescriptor = if args.get(0).is_undefined() {
crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureViewDescriptor::empty()
} else {
match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
}
};
let result: DomRoot<GPUTextureView> = this.CreateView(&arg0);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const createView_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(createView)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUTexture as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn destroy(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUTexture);
let args = &*args;
let argc = args.argc_;
let result: () = this.Destroy();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const destroy_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(destroy)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUTexture as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_label(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUTexture);
let result: USVString = this.Label();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
unsafe extern fn set_label(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUTexture);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.SetLabel(arg0);
true
})());
result
}
const label_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUTexture as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const label_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUTexture as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUTexture>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUTexture>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUTexture\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUTexture, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUTexture> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUTexture {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUTexture>) -> DomRoot<GPUTexture> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gputexture::GPUTexture {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUTexture {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUTexture {
fn eq(&self, other: &GPUTexture) -> bool {
self as *const GPUTexture == other
}
}
pub trait GPUTextureMethods {
fn CreateView(&self, descriptor: &crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTextureViewDescriptor) -> DomRoot<GPUTextureView>;
fn Destroy(&self);
fn Label(&self) -> USVString;
fn SetLabel(&self, value: USVString);
}
const sMethods_specs: &[&[JSFunctionSpec]] = &[
&[
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"createView\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &createView_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"destroy\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &destroy_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: ptr::null() },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 0,
flags: 0,
selfHostedName: ptr::null()
}]
];
const sMethods: &[Guard<&[JSFunctionSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sMethods_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sMethods_specs[0])
];
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"label\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &label_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &label_setterinfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUTexture\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUTexture), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUTexturePrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUTexture() {\n [native code]\n}",
PrototypeList::ID::GPUTexture,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUTexture), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
sMethods,
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUTexture as usize].is_null());
(*cache)[PrototypeList::ID::GPUTexture as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUTexture as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUTexture\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUTextureUsage_Binding::{GPUTextureUsageConstants, Wrap as GPUTextureUsageWrap, GetProtoObject as GPUTextureUsageGetProtoObject, DefineDOMInterface as GPUTextureUsageDefineDOMInterface};
pub mod GPUTextureUsage_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUTextureUsage;
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUTextureUsage>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUTextureUsage>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
pub mod GPUTextureUsageConstants {
pub const COPY_SRC: u32 = 1;
pub const COPY_DST: u32 = 2;
pub const TEXTURE_BINDING: u32 = 4;
pub const STORAGE_BINDING: u32 = 8;
pub const RENDER_ATTACHMENT: u32 = 16;
} static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUTextureUsage\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUTextureUsage, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUTextureUsage> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUTextureUsage {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUTextureUsage>) -> DomRoot<GPUTextureUsage> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gputextureusage::GPUTextureUsage {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUTextureUsage {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUTextureUsage {
fn eq(&self, other: &GPUTextureUsage) -> bool {
self as *const GPUTextureUsage == other
}
}
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUTextureUsage\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Satisfied, sAttributes_specs[0])
];
const sConstants_specs: &[&[ConstantSpec]] = &[
&[
ConstantSpec { name: b"COPY_SRC\0", value: ConstantVal::UintVal(1) },
ConstantSpec { name: b"COPY_DST\0", value: ConstantVal::UintVal(2) },
ConstantSpec { name: b"TEXTURE_BINDING\0", value: ConstantVal::UintVal(4) },
ConstantSpec { name: b"STORAGE_BINDING\0", value: ConstantVal::UintVal(8) },
ConstantSpec { name: b"RENDER_ATTACHMENT\0", value: ConstantVal::UintVal(16) }]
];
const sConstants: &[Guard<&[ConstantSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sConstants_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sConstants_specs[0])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUTextureUsage), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUTextureUsagePrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUTextureUsage() {\n [native code]\n}",
PrototypeList::ID::GPUTextureUsage,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUTextureUsage), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
&[],
sAttributes,
sConstants,
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUTextureUsage as usize].is_null());
(*cache)[PrototypeList::ID::GPUTextureUsage as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUTextureUsage as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
sConstants,
prototype.handle(),
b"GPUTextureUsage\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUTextureView_Binding::{Wrap as GPUTextureViewWrap, GPUTextureViewMethods, GetProtoObject as GPUTextureViewGetProtoObject, DefineDOMInterface as GPUTextureViewDefineDOMInterface};
pub mod GPUTextureView_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUTextureView;
unsafe extern fn get_label(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUTextureView);
let result: USVString = this.Label();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
unsafe extern fn set_label(cx: *mut JSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUTextureView);
let arg0: USVString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), ()) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: () = this.SetLabel(arg0);
true
})());
result
}
const label_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUTextureView as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
const label_setterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
setter: Some(set_label)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUTextureView as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Setter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_UNDEFINED as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUTextureView>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUTextureView>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUTextureView\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUTextureView, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUTextureView> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUTextureView {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUTextureView>) -> DomRoot<GPUTextureView> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gputextureview::GPUTextureView {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUTextureView {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUTextureView {
fn eq(&self, other: &GPUTextureView) -> bool {
self as *const GPUTextureView == other
}
}
pub trait GPUTextureViewMethods {
fn Label(&self) -> USVString;
fn SetLabel(&self, value: USVString);
}
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"label\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &label_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_setter), info: &label_setterinfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUTextureView\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUTextureView), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUTextureViewPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::throw();
&BEHAVIOR
},
b"function GPUTextureView() {\n [native code]\n}",
PrototypeList::ID::GPUTextureView,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUTextureView), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
&[],
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUTextureView as usize].is_null());
(*cache)[PrototypeList::ID::GPUTextureView as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUTextureView as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUTextureView\0",
0,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUUncapturedErrorEvent_Binding::{Wrap as GPUUncapturedErrorEventWrap, GPUUncapturedErrorEventMethods, GetProtoObject as GPUUncapturedErrorEventGetProtoObject, DefineDOMInterface as GPUUncapturedErrorEventDefineDOMInterface};
pub mod GPUUncapturedErrorEvent_Binding {
use crate::dom;
use crate::dom::bindings::codegen::Bindings::EventBinding::Event_Binding;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUUncapturedErrorEventInit;
use crate::dom::bindings::import::module::*;
use crate::dom::types::Event;
use crate::dom::types::GPUOutOfMemoryError;
use crate::dom::types::GPUUncapturedErrorEvent;
use crate::dom::types::GPUValidationError;
unsafe extern fn get_error(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUUncapturedErrorEvent);
let result: UnionTypes::GPUOutOfMemoryErrorOrGPUValidationError = this.Error();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const error_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_error)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUUncapturedErrorEvent as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn get_isTrusted(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUUncapturedErrorEvent);
let result: bool = this.IsTrusted();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const isTrusted_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_isTrusted)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUUncapturedErrorEvent as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_BOOLEAN as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUUncapturedErrorEvent>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUUncapturedErrorEvent>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUUncapturedErrorEvent\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::Event, PrototypeList::ID::GPUUncapturedErrorEvent, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 1,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { event: (crate::dom::bindings::codegen::InheritTypes::EventTypeId::GPUUncapturedErrorEvent) },
malloc_size_of: malloc_size_of_including_raw_self::<GPUUncapturedErrorEvent> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUUncapturedErrorEvent {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Event = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUUncapturedErrorEvent>) -> DomRoot<GPUUncapturedErrorEvent> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
let mut slot = UndefinedValue();
JS_GetReservedSlot(canonical_proto.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, &mut slot);
rooted!(in(*cx) let mut unforgeable_holder = ptr::null_mut::<JSObject>());
unforgeable_holder.handle_mut().set(slot.to_object());
assert!(JS_InitializePropertiesFromCompatibleNativeObject(*cx, obj.handle(), unforgeable_holder.handle()));
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpuuncapturederrorevent::GPUUncapturedErrorEvent {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUUncapturedErrorEvent {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUUncapturedErrorEvent {
fn eq(&self, other: &GPUUncapturedErrorEvent) -> bool {
self as *const GPUUncapturedErrorEvent == other
}
}
pub trait GPUUncapturedErrorEventMethods {
fn Error(&self) -> UnionTypes::GPUOutOfMemoryErrorOrGPUValidationError;
fn IsTrusted(&self) -> bool;
}
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"error\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &error_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUUncapturedErrorEvent\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
const sLegacyUnforgeableAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"isTrusted\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE | JSPROP_PERMANENT),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &isTrusted_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sLegacyUnforgeableAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sLegacyUnforgeableAttributes_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::SERVICE_WORKER_GLOBAL_SCOPE), sLegacyUnforgeableAttributes_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sLegacyUnforgeableAttributes_specs[0])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUUncapturedErrorEvent), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUUncapturedErrorEventPrototype\0" as *const u8 as *const libc::c_char,
flags:
(1 & JSCLASS_RESERVED_SLOTS_MASK ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
unsafe extern fn _constructor(cx: *mut JSContext, argc: u32, vp: *mut JSVal) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let args = CallArgs::from_vp(vp, argc);
let global = GlobalScope::from_object(JS_CALLEE(*cx, vp).to_object());
if !callargs_is_constructing(&args) {
throw_constructor_without_new(*cx, "GPUUncapturedErrorEvent");
return false;
}
rooted!(in(*cx) let mut desired_proto = ptr::null_mut::<JSObject>());
let proto_result = get_desired_proto(
cx,
&args,
PrototypeList::ID::GPUUncapturedErrorEvent,
CreateInterfaceObjects,
desired_proto.handle_mut(),
);
assert!(proto_result.is_ok());
if proto_result.is_err() {
return false;
}
if argc < 2 {
throw_type_error(*cx, "Not enough arguments to \"GPUUncapturedErrorEvent.constructor\".");
return false;
}
let arg0: DOMString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let arg1: crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUUncapturedErrorEventInit = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(1)), ()) {
Ok(ConversionResult::Success(dictionary)) => dictionary,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: DomRoot<GPUUncapturedErrorEvent> = GPUUncapturedErrorEvent::Constructor(&global, Some(desired_proto.handle()), arg0, &arg1);
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::call(_constructor);
&BEHAVIOR
},
b"function GPUUncapturedErrorEvent() {\n [native code]\n}",
PrototypeList::ID::GPUUncapturedErrorEvent,
1);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUUncapturedErrorEvent), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
Event_Binding::GetProtoObject(cx, global, prototype_proto.handle_mut());
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
&[],
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUUncapturedErrorEvent as usize].is_null());
(*cache)[PrototypeList::ID::GPUUncapturedErrorEvent as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUUncapturedErrorEvent as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
Event_Binding::GetConstructorObject(cx, global, interface_proto.handle_mut());
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUUncapturedErrorEvent\0",
2,
&[],
interface.handle_mut());
assert!(!interface.is_null());
rooted!(in(*cx) let mut unforgeable_holder = ptr::null_mut::<JSObject>());
unforgeable_holder.handle_mut().set(
JS_NewObjectWithoutMetadata(*cx, &Class.base as *const JSClass, prototype.handle()));
assert!(!unforgeable_holder.is_null());
define_guarded_properties(cx, unforgeable_holder.handle(), sLegacyUnforgeableAttributes, global);
let val = ObjectValue(unforgeable_holder.get());
JS_SetReservedSlot(prototype.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, &val)
}
} pub use self::GPUValidationError_Binding::{Wrap as GPUValidationErrorWrap, GPUValidationErrorMethods, GetProtoObject as GPUValidationErrorGetProtoObject, DefineDOMInterface as GPUValidationErrorDefineDOMInterface};
pub mod GPUValidationError_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::types::GPUValidationError;
unsafe extern fn get_message(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const GPUValidationError);
let result: DOMString = this.Message();
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const message_getterinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
getter: Some(get_message)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUValidationError as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Getter as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_STRING as u8,
true,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUValidationError>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<GPUValidationError>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUValidationError\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUValidationError, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<GPUValidationError> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
impl GPUValidationError {
fn __assert_parent_type(&self) {
use crate::dom::bindings::inheritance::HasParent;
let _: &Reflector = self.as_parent();
}
}
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<GPUValidationError>) -> DomRoot<GPUValidationError> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectWrap for dom::gpuvalidationerror::GPUValidationError {
const WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<Self>,
) -> Root<Dom<Self>> = Wrap;
}
impl IDLInterface for GPUValidationError {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for GPUValidationError {
fn eq(&self, other: &GPUValidationError) -> bool {
self as *const GPUValidationError == other
}
}
pub trait GPUValidationErrorMethods {
fn Message(&self) -> DOMString;
}
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { string_: b"message\0" as *const u8 as *const libc::c_char },
attributes_: (JSPROP_ENUMERATE),
kind_: (JSPropertySpec_Kind::NativeAccessor),
u: JSPropertySpec_AccessorsOrValue {
accessors: JSPropertySpec_AccessorsOrValue_Accessors {
getter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: Some(generic_getter), info: &message_getterinfo },
},
setter: JSPropertySpec_Accessor {
native: JSNativeWrapper { op: None, info: 0 as *const JSJitInfo },
}
}
}
}
,
JSPropertySpec::ZERO]
,
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUValidationError\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sAttributes_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sAttributes_specs[0]),
Guard::new(Condition::Satisfied, sAttributes_specs[1])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUValidationError), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUValidationErrorPrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
unsafe extern fn _constructor(cx: *mut JSContext, argc: u32, vp: *mut JSVal) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let args = CallArgs::from_vp(vp, argc);
let global = GlobalScope::from_object(JS_CALLEE(*cx, vp).to_object());
if !callargs_is_constructing(&args) {
throw_constructor_without_new(*cx, "GPUValidationError");
return false;
}
rooted!(in(*cx) let mut desired_proto = ptr::null_mut::<JSObject>());
let proto_result = get_desired_proto(
cx,
&args,
PrototypeList::ID::GPUValidationError,
CreateInterfaceObjects,
desired_proto.handle_mut(),
);
assert!(proto_result.is_ok());
if proto_result.is_err() {
return false;
}
if argc < 1 {
throw_type_error(*cx, "Not enough arguments to \"GPUValidationError.constructor\".");
return false;
}
let arg0: DOMString = match FromJSValConvertible::from_jsval(*cx, HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
Ok(ConversionResult::Success(strval)) => strval,
Ok(ConversionResult::Failure(error)) => {
throw_type_error(*cx, &error);
return false;
}
_ => { return false;
},
};
let result: Result<DomRoot<GPUValidationError>, Error> = GPUValidationError::Constructor(&global, Some(desired_proto.handle()), arg0);
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, global.upcast::<GlobalScope>(), e);
return false;
},
};
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
static INTERFACE_OBJECT_CLASS: NonCallbackInterfaceObjectClass =
NonCallbackInterfaceObjectClass::new(
{
const BEHAVIOR: InterfaceConstructorBehavior = InterfaceConstructorBehavior::call(_constructor);
&BEHAVIOR
},
b"function GPUValidationError() {\n [native code]\n}",
PrototypeList::ID::GPUValidationError,
0);
pub fn DefineDOMInterface(cx: SafeJSContext, global: HandleObject) {
define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUValidationError), CreateInterfaceObjects, ConstructorEnabled)
}
fn ConstructorEnabled(aCx: SafeJSContext, aObj: HandleObject) -> bool {
is_exposed_in(aObj, InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE | InterfaceObjectMap::Globals::WINDOW) &&
pref!(dom.webgpu.enabled)
}
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmObjectPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
&[],
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUValidationError as usize].is_null());
(*cache)[PrototypeList::ID::GPUValidationError as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUValidationError as isize),
ptr::null_mut(),
prototype.get());
rooted!(in(*cx) let mut interface_proto = ptr::null_mut::<JSObject>());
interface_proto.set(GetRealmFunctionPrototype(*cx));
assert!(!interface_proto.is_null());
rooted!(in(*cx) let mut interface = ptr::null_mut::<JSObject>());
create_noncallback_interface_object(cx,
global,
interface_proto.handle(),
&INTERFACE_OBJECT_CLASS,
&[],
&[],
&[],
prototype.handle(),
b"GPUValidationError\0",
1,
&[],
interface.handle_mut());
assert!(!interface.is_null());
}
} pub use self::GPUSupportedFeaturesSetlike_Binding::{Wrap as GPUSupportedFeaturesSetlikeWrap, GPUSupportedFeaturesSetlikeMethods, GetProtoObject as GPUSupportedFeaturesSetlikeGetProtoObject};
pub mod GPUSupportedFeaturesSetlike_Binding {
use crate::dom;
use crate::dom::bindings::import::module::*;
use crate::dom::bindings::iterable::IterableIterator;
use crate::dom::types::GPUSupportedFeatures;
unsafe extern fn next(cx: *mut JSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool {
let mut result = false;
wrap_panic(&mut || result = (|| {
let cx = SafeJSContext::from_ptr(cx);
let this = &*(this as *const crate::dom::bindings::iterable::IterableIterator<GPUSupportedFeatures>);
let args = &*args;
let argc = args.argc_;
let result: Result<NonNull<JSObject>, Error> = this.Next(cx);
let result = match result {
Ok(result) => result,
Err(e) => {
throw_dom_exception(cx, &this.global(), e);
return false;
},
};
(result).to_jsval(*cx, MutableHandleValue::from_raw(args.rval()));
return true;
})());
result
}
const next_methodinfo: JSJitInfo = JSJitInfo {
__bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
method: Some(next)
},
__bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
protoID: PrototypeList::ID::GPUSupportedFeaturesSetlike as u16,
},
__bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
_bitfield_align_1: [],
_bitfield_1: __BindgenBitfieldUnit::new(
new_jsjitinfo_bitfield_1!(
JSJitInfo_OpType::Method as u8,
JSJitInfo_AliasSet::AliasEverything as u8,
JSValueType::JSVAL_TYPE_OBJECT as u8,
false,
false,
false,
false,
false,
false,
0,
).to_ne_bytes()
),
};
unsafe extern fn _finalize(_cx: *mut GCContext, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<crate::dom::bindings::iterable::IterableIterator<GPUSupportedFeatures>>(obj).unwrap();
finalize_common(this);
})
}
unsafe extern fn _trace(trc: *mut JSTracer, obj: *mut JSObject) {
wrap_panic(&mut || {
let this = native_from_object_static::<crate::dom::bindings::iterable::IterableIterator<GPUSupportedFeatures>>(obj).unwrap();
if this.is_null() { return; } (*this).trace(trc);
})
}
static CLASS_OPS: JSClassOps = JSClassOps {
addProperty: None,
delProperty: None,
enumerate: None,
newEnumerate: None,
resolve: None,
mayResolve: None,
finalize: Some(_finalize),
call: None,
construct: None,
trace: Some(_trace),
};
static Class: DOMJSClass = DOMJSClass {
base: JSClass {
name: b"GPUSupportedFeaturesSetlike\0" as *const u8 as *const libc::c_char,
flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
(((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
,
cOps: &CLASS_OPS,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
},
dom_class: DOMClass {
interface_chain: [ PrototypeList::ID::GPUSupportedFeaturesSetlike, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
depth: 0,
type_id: crate::dom::bindings::codegen::InheritTypes::TopTypeId { alone: () },
malloc_size_of: malloc_size_of_including_raw_self::<crate::dom::bindings::iterable::IterableIterator<GPUSupportedFeatures>> as unsafe fn(&mut _, _) -> _,
global: InterfaceObjectMap::Globals::EMPTY,
}
};
pub unsafe fn Wrap(cx: SafeJSContext, scope: &GlobalScope, given_proto: Option<HandleObject>, object: Box<crate::dom::bindings::iterable::IterableIterator<GPUSupportedFeatures>>) -> DomRoot<crate::dom::bindings::iterable::IterableIterator<GPUSupportedFeatures>> {
let raw = Root::new(MaybeUnreflectedDom::from_box(object));
let scope = scope.reflector().get_jsobject();
assert!(!scope.get().is_null());
assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
let _ac = JSAutoRealm::new(*cx, scope.get());
rooted!(in(*cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
GetProtoObject(cx, scope, canonical_proto.handle_mut());
assert!(!canonical_proto.is_null());
rooted!(in(*cx) let mut proto = ptr::null_mut::<JSObject>());
if let Some(given) = given_proto {
*proto = *given;
if get_context_realm(*cx) != get_object_realm(*given) {
assert!(JS_WrapObject(*cx, proto.handle_mut()));
}
} else {
*proto = *canonical_proto;
}
rooted!(in(*cx) let obj = JS_NewObjectWithGivenProto(
*cx,
&Class.base,
proto.handle(),
));
assert!(!obj.is_null());
JS_SetReservedSlot(
obj.get(),
DOM_OBJECT_SLOT,
&PrivateValue(raw.as_ptr() as *const libc::c_void),
);
let root = raw.reflect_with(obj.get());
DomRoot::from_ref(&*root)
}
impl DomObjectIteratorWrap for GPUSupportedFeatures {
const ITER_WRAP: unsafe fn(
SafeJSContext,
&GlobalScope,
Option<HandleObject>,
Box<IterableIterator<Self>>,
) -> Root<Dom<IterableIterator<Self>>> = Wrap;
}
impl IDLInterface for crate::dom::bindings::iterable::IterableIterator<GPUSupportedFeatures> {
#[inline]
fn derives(class: &'static DOMClass) -> bool {
ptr::eq(class, &Class.dom_class)
}
}
impl PartialEq for crate::dom::bindings::iterable::IterableIterator<GPUSupportedFeatures> {
fn eq(&self, other: &crate::dom::bindings::iterable::IterableIterator<GPUSupportedFeatures>) -> bool {
self as *const crate::dom::bindings::iterable::IterableIterator<GPUSupportedFeatures> == other
}
}
pub trait GPUSupportedFeaturesSetlikeMethods {
fn Next(&self, cx: SafeJSContext) -> Fallible<NonNull<JSObject>>;
}
const sMethods_specs: &[&[JSFunctionSpec]] = &[
&[
JSFunctionSpec {
name: JSPropertySpec_Name { string_: b"next\0" as *const u8 as *const libc::c_char },
call: JSNativeWrapper { op: Some(generic_method), info: &next_methodinfo as *const _ as *const JSJitInfo },
nargs: 0,
flags: (JSPROP_ENUMERATE) as u16,
selfHostedName: 0 as *const libc::c_char
},
JSFunctionSpec {
name: JSPropertySpec_Name { string_: ptr::null() },
call: JSNativeWrapper { op: None, info: ptr::null() },
nargs: 0,
flags: 0,
selfHostedName: ptr::null()
}]
];
const sMethods: &[Guard<&[JSFunctionSpec]>] = &[
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::WINDOW), sMethods_specs[0]),
Guard::new(Condition::Exposed(InterfaceObjectMap::Globals::DEDICATED_WORKER_GLOBAL_SCOPE), sMethods_specs[0])
];
const sAttributes_specs: &[&[JSPropertySpec]] = &[
&[
JSPropertySpec {
name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
attributes_: (JSPROP_READONLY),
kind_: (JSPropertySpec_Kind::Value),
u: JSPropertySpec_AccessorsOrValue {
value: JSPropertySpec_ValueWrapper {
type_: JSPropertySpec_ValueWrapper_Type::String,
__bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
string: b"GPUSupportedFeatures Setlike\0" as *const u8 as *const libc::c_char,
}
}
}
}
,
JSPropertySpec::ZERO]
];
const sAttributes: &[Guard<&[JSPropertySpec]>] = &[
Guard::new(Condition::Satisfied, sAttributes_specs[0])
];
pub fn GetProtoObject(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject) {
get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUSupportedFeaturesSetlike), CreateInterfaceObjects, rval)
}
static PrototypeClass: JSClass = JSClass {
name: b"GPUSupportedFeaturesSetlikePrototype\0" as *const u8 as *const libc::c_char,
flags:
(0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
cOps: 0 as *const _,
spec: ptr::null(),
ext: ptr::null(),
oOps: ptr::null(),
};
unsafe fn CreateInterfaceObjects(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray) {
rooted!(in(*cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
prototype_proto.set(GetRealmIteratorPrototype(*cx));
assert!(!prototype_proto.is_null());
rooted!(in(*cx) let mut prototype = ptr::null_mut::<JSObject>());
create_interface_prototype_object(cx,
global,
prototype_proto.handle(),
&PrototypeClass,
sMethods,
sAttributes,
&[],
&[],
prototype.handle_mut());
assert!(!prototype.is_null());
assert!((*cache)[PrototypeList::ID::GPUSupportedFeaturesSetlike as usize].is_null());
(*cache)[PrototypeList::ID::GPUSupportedFeaturesSetlike as usize] = prototype.get();
<*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUSupportedFeaturesSetlike as isize),
ptr::null_mut(),
prototype.get());
}
}