1#![allow(non_camel_case_types,non_upper_case_globals,unsafe_op_in_unsafe_fn,unused_imports,unused_variables,unused_assignments,unused_mut,clippy::approx_constant,clippy::enum_variant_names,clippy::let_unit_value,clippy::needless_return,clippy::too_many_arguments,clippy::unnecessary_cast,clippy::upper_case_acronyms)]
4
5use crate::codegen::GenericBindings::DOMExceptionBinding::DOMException_Binding;
6use crate::codegen::GenericBindings::EventBinding::Event_Binding;
7use crate::codegen::GenericBindings::EventHandlerBinding::EventHandlerNonNull;
8use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
9use crate::codegen::GenericBindings::WorkerGlobalScopeBinding::WorkerGlobalScope_Binding;
10use crate::import::base::*;
11use crate::record::Record;
12
13
14#[repr(usize)]
15#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
16pub enum GPUPowerPreference {
17 Low_power,
18 High_performance
19}
20pub mod GPUPowerPreferenceValues {
21
22 use crate::utils::find_enum_value;
23 use js::conversions::ConversionResult;
24 use js::conversions::FromJSValConvertible;
25 use js::conversions::ToJSValConvertible;
26 use js::context::RawJSContext;
27 use js::rust::HandleValue;
28 use js::rust::MutableHandleValue;
29 use js::jsval::JSVal;
30
31 pub(crate) const pairs: &[(&str, super::GPUPowerPreference)] = &[
32 ("low-power", super::GPUPowerPreference::Low_power),
33 ("high-performance", super::GPUPowerPreference::High_performance),
34 ];
35
36 impl super::GPUPowerPreference {
37 pub fn as_str(&self) -> &'static str {
38 pairs[*self as usize].0
39 }
40 }
41
42 impl Default for super::GPUPowerPreference {
43 fn default() -> super::GPUPowerPreference {
44 pairs[0].1
45 }
46 }
47
48 impl std::str::FromStr for super::GPUPowerPreference {
49 type Err = ();
50
51 fn from_str(s: &str) -> Result<Self, Self::Err> {
52 pairs
53 .iter()
54 .find(|&&(key, _)| s == key)
55 .map(|&(_, ev)| ev)
56 .ok_or(())
57 }
58 }
59
60 impl ToJSValConvertible for super::GPUPowerPreference {
61 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
62 pairs[*self as usize].0.to_jsval(cx, rval);
63 }
64 }
65
66 impl FromJSValConvertible for super::GPUPowerPreference {
67 type Config = ();
68 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
69 -> Result<ConversionResult<super::GPUPowerPreference>, ()> {
70 match find_enum_value(cx, value, pairs) {
71 Err(_) => Err(()),
72 Ok((None, search)) => {
73 Ok(ConversionResult::Failure(
74 format!("'{}' is not a valid enum value for enumeration 'GPUPowerPreference'.", search).into()
75 ))
76 }
77 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
78 }
79 }
80 }
81 } #[repr(usize)]
85#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq, Eq, Hash)]
86pub enum GPUFeatureName {
87 Depth_clip_control,
88 Depth32float_stencil8,
89 Texture_compression_bc,
90 Texture_compression_bc_sliced_3d,
91 Texture_compression_etc2,
92 Texture_compression_astc,
93 Timestamp_query,
94 Indirect_first_instance,
95 Shader_f16,
96 Rg11b10ufloat_renderable,
97 Bgra8unorm_storage,
98 Float32_filterable,
99 Clip_distances,
100 Dual_source_blending,
101 Subgroups
102}
103pub mod GPUFeatureNameValues {
104
105 use crate::utils::find_enum_value;
106 use js::conversions::ConversionResult;
107 use js::conversions::FromJSValConvertible;
108 use js::conversions::ToJSValConvertible;
109 use js::context::RawJSContext;
110 use js::rust::HandleValue;
111 use js::rust::MutableHandleValue;
112 use js::jsval::JSVal;
113
114 pub(crate) const pairs: &[(&str, super::GPUFeatureName)] = &[
115 ("depth-clip-control", super::GPUFeatureName::Depth_clip_control),
116 ("depth32float-stencil8", super::GPUFeatureName::Depth32float_stencil8),
117 ("texture-compression-bc", super::GPUFeatureName::Texture_compression_bc),
118 ("texture-compression-bc-sliced-3d", super::GPUFeatureName::Texture_compression_bc_sliced_3d),
119 ("texture-compression-etc2", super::GPUFeatureName::Texture_compression_etc2),
120 ("texture-compression-astc", super::GPUFeatureName::Texture_compression_astc),
121 ("timestamp-query", super::GPUFeatureName::Timestamp_query),
122 ("indirect-first-instance", super::GPUFeatureName::Indirect_first_instance),
123 ("shader-f16", super::GPUFeatureName::Shader_f16),
124 ("rg11b10ufloat-renderable", super::GPUFeatureName::Rg11b10ufloat_renderable),
125 ("bgra8unorm-storage", super::GPUFeatureName::Bgra8unorm_storage),
126 ("float32-filterable", super::GPUFeatureName::Float32_filterable),
127 ("clip-distances", super::GPUFeatureName::Clip_distances),
128 ("dual-source-blending", super::GPUFeatureName::Dual_source_blending),
129 ("subgroups", super::GPUFeatureName::Subgroups),
130 ];
131
132 impl super::GPUFeatureName {
133 pub fn as_str(&self) -> &'static str {
134 pairs[*self as usize].0
135 }
136 }
137
138 impl Default for super::GPUFeatureName {
139 fn default() -> super::GPUFeatureName {
140 pairs[0].1
141 }
142 }
143
144 impl std::str::FromStr for super::GPUFeatureName {
145 type Err = ();
146
147 fn from_str(s: &str) -> Result<Self, Self::Err> {
148 pairs
149 .iter()
150 .find(|&&(key, _)| s == key)
151 .map(|&(_, ev)| ev)
152 .ok_or(())
153 }
154 }
155
156 impl ToJSValConvertible for super::GPUFeatureName {
157 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
158 pairs[*self as usize].0.to_jsval(cx, rval);
159 }
160 }
161
162 impl FromJSValConvertible for super::GPUFeatureName {
163 type Config = ();
164 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
165 -> Result<ConversionResult<super::GPUFeatureName>, ()> {
166 match find_enum_value(cx, value, pairs) {
167 Err(_) => Err(()),
168 Ok((None, search)) => {
169 Ok(ConversionResult::Failure(
170 format!("'{}' is not a valid enum value for enumeration 'GPUFeatureName'.", search).into()
171 ))
172 }
173 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
174 }
175 }
176 }
177 } #[repr(usize)]
181#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
182pub enum GPUBufferMapState {
183 Unmapped,
184 Pending,
185 Mapped
186}
187pub mod GPUBufferMapStateValues {
188
189 use crate::utils::find_enum_value;
190 use js::conversions::ConversionResult;
191 use js::conversions::FromJSValConvertible;
192 use js::conversions::ToJSValConvertible;
193 use js::context::RawJSContext;
194 use js::rust::HandleValue;
195 use js::rust::MutableHandleValue;
196 use js::jsval::JSVal;
197
198 pub(crate) const pairs: &[(&str, super::GPUBufferMapState)] = &[
199 ("unmapped", super::GPUBufferMapState::Unmapped),
200 ("pending", super::GPUBufferMapState::Pending),
201 ("mapped", super::GPUBufferMapState::Mapped),
202 ];
203
204 impl super::GPUBufferMapState {
205 pub fn as_str(&self) -> &'static str {
206 pairs[*self as usize].0
207 }
208 }
209
210 impl Default for super::GPUBufferMapState {
211 fn default() -> super::GPUBufferMapState {
212 pairs[0].1
213 }
214 }
215
216 impl std::str::FromStr for super::GPUBufferMapState {
217 type Err = ();
218
219 fn from_str(s: &str) -> Result<Self, Self::Err> {
220 pairs
221 .iter()
222 .find(|&&(key, _)| s == key)
223 .map(|&(_, ev)| ev)
224 .ok_or(())
225 }
226 }
227
228 impl ToJSValConvertible for super::GPUBufferMapState {
229 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
230 pairs[*self as usize].0.to_jsval(cx, rval);
231 }
232 }
233
234 impl FromJSValConvertible for super::GPUBufferMapState {
235 type Config = ();
236 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
237 -> Result<ConversionResult<super::GPUBufferMapState>, ()> {
238 match find_enum_value(cx, value, pairs) {
239 Err(_) => Err(()),
240 Ok((None, search)) => {
241 Ok(ConversionResult::Failure(
242 format!("'{}' is not a valid enum value for enumeration 'GPUBufferMapState'.", search).into()
243 ))
244 }
245 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
246 }
247 }
248 }
249 } #[repr(usize)]
253#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
254pub enum GPUTextureDimension {
255 _1d,
256 _2d,
257 _3d
258}
259pub mod GPUTextureDimensionValues {
260
261 use crate::utils::find_enum_value;
262 use js::conversions::ConversionResult;
263 use js::conversions::FromJSValConvertible;
264 use js::conversions::ToJSValConvertible;
265 use js::context::RawJSContext;
266 use js::rust::HandleValue;
267 use js::rust::MutableHandleValue;
268 use js::jsval::JSVal;
269
270 pub(crate) const pairs: &[(&str, super::GPUTextureDimension)] = &[
271 ("1d", super::GPUTextureDimension::_1d),
272 ("2d", super::GPUTextureDimension::_2d),
273 ("3d", super::GPUTextureDimension::_3d),
274 ];
275
276 impl super::GPUTextureDimension {
277 pub fn as_str(&self) -> &'static str {
278 pairs[*self as usize].0
279 }
280 }
281
282 impl Default for super::GPUTextureDimension {
283 fn default() -> super::GPUTextureDimension {
284 pairs[0].1
285 }
286 }
287
288 impl std::str::FromStr for super::GPUTextureDimension {
289 type Err = ();
290
291 fn from_str(s: &str) -> Result<Self, Self::Err> {
292 pairs
293 .iter()
294 .find(|&&(key, _)| s == key)
295 .map(|&(_, ev)| ev)
296 .ok_or(())
297 }
298 }
299
300 impl ToJSValConvertible for super::GPUTextureDimension {
301 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
302 pairs[*self as usize].0.to_jsval(cx, rval);
303 }
304 }
305
306 impl FromJSValConvertible for super::GPUTextureDimension {
307 type Config = ();
308 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
309 -> Result<ConversionResult<super::GPUTextureDimension>, ()> {
310 match find_enum_value(cx, value, pairs) {
311 Err(_) => Err(()),
312 Ok((None, search)) => {
313 Ok(ConversionResult::Failure(
314 format!("'{}' is not a valid enum value for enumeration 'GPUTextureDimension'.", search).into()
315 ))
316 }
317 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
318 }
319 }
320 }
321 } #[repr(usize)]
325#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
326pub enum GPUTextureViewDimension {
327 _1d,
328 _2d,
329 _2d_array,
330 Cube,
331 Cube_array,
332 _3d
333}
334pub mod GPUTextureViewDimensionValues {
335
336 use crate::utils::find_enum_value;
337 use js::conversions::ConversionResult;
338 use js::conversions::FromJSValConvertible;
339 use js::conversions::ToJSValConvertible;
340 use js::context::RawJSContext;
341 use js::rust::HandleValue;
342 use js::rust::MutableHandleValue;
343 use js::jsval::JSVal;
344
345 pub(crate) const pairs: &[(&str, super::GPUTextureViewDimension)] = &[
346 ("1d", super::GPUTextureViewDimension::_1d),
347 ("2d", super::GPUTextureViewDimension::_2d),
348 ("2d-array", super::GPUTextureViewDimension::_2d_array),
349 ("cube", super::GPUTextureViewDimension::Cube),
350 ("cube-array", super::GPUTextureViewDimension::Cube_array),
351 ("3d", super::GPUTextureViewDimension::_3d),
352 ];
353
354 impl super::GPUTextureViewDimension {
355 pub fn as_str(&self) -> &'static str {
356 pairs[*self as usize].0
357 }
358 }
359
360 impl Default for super::GPUTextureViewDimension {
361 fn default() -> super::GPUTextureViewDimension {
362 pairs[0].1
363 }
364 }
365
366 impl std::str::FromStr for super::GPUTextureViewDimension {
367 type Err = ();
368
369 fn from_str(s: &str) -> Result<Self, Self::Err> {
370 pairs
371 .iter()
372 .find(|&&(key, _)| s == key)
373 .map(|&(_, ev)| ev)
374 .ok_or(())
375 }
376 }
377
378 impl ToJSValConvertible for super::GPUTextureViewDimension {
379 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
380 pairs[*self as usize].0.to_jsval(cx, rval);
381 }
382 }
383
384 impl FromJSValConvertible for super::GPUTextureViewDimension {
385 type Config = ();
386 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
387 -> Result<ConversionResult<super::GPUTextureViewDimension>, ()> {
388 match find_enum_value(cx, value, pairs) {
389 Err(_) => Err(()),
390 Ok((None, search)) => {
391 Ok(ConversionResult::Failure(
392 format!("'{}' is not a valid enum value for enumeration 'GPUTextureViewDimension'.", search).into()
393 ))
394 }
395 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
396 }
397 }
398 }
399 } #[repr(usize)]
403#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
404pub enum GPUTextureAspect {
405 All,
406 Stencil_only,
407 Depth_only
408}
409pub mod GPUTextureAspectValues {
410
411 use crate::utils::find_enum_value;
412 use js::conversions::ConversionResult;
413 use js::conversions::FromJSValConvertible;
414 use js::conversions::ToJSValConvertible;
415 use js::context::RawJSContext;
416 use js::rust::HandleValue;
417 use js::rust::MutableHandleValue;
418 use js::jsval::JSVal;
419
420 pub(crate) const pairs: &[(&str, super::GPUTextureAspect)] = &[
421 ("all", super::GPUTextureAspect::All),
422 ("stencil-only", super::GPUTextureAspect::Stencil_only),
423 ("depth-only", super::GPUTextureAspect::Depth_only),
424 ];
425
426 impl super::GPUTextureAspect {
427 pub fn as_str(&self) -> &'static str {
428 pairs[*self as usize].0
429 }
430 }
431
432 impl Default for super::GPUTextureAspect {
433 fn default() -> super::GPUTextureAspect {
434 pairs[0].1
435 }
436 }
437
438 impl std::str::FromStr for super::GPUTextureAspect {
439 type Err = ();
440
441 fn from_str(s: &str) -> Result<Self, Self::Err> {
442 pairs
443 .iter()
444 .find(|&&(key, _)| s == key)
445 .map(|&(_, ev)| ev)
446 .ok_or(())
447 }
448 }
449
450 impl ToJSValConvertible for super::GPUTextureAspect {
451 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
452 pairs[*self as usize].0.to_jsval(cx, rval);
453 }
454 }
455
456 impl FromJSValConvertible for super::GPUTextureAspect {
457 type Config = ();
458 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
459 -> Result<ConversionResult<super::GPUTextureAspect>, ()> {
460 match find_enum_value(cx, value, pairs) {
461 Err(_) => Err(()),
462 Ok((None, search)) => {
463 Ok(ConversionResult::Failure(
464 format!("'{}' is not a valid enum value for enumeration 'GPUTextureAspect'.", search).into()
465 ))
466 }
467 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
468 }
469 }
470 }
471 } #[repr(usize)]
475#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
476pub enum GPUTextureFormat {
477 R8unorm,
478 R8snorm,
479 R8uint,
480 R8sint,
481 R16uint,
482 R16sint,
483 R16float,
484 Rg8unorm,
485 Rg8snorm,
486 Rg8uint,
487 Rg8sint,
488 R32uint,
489 R32sint,
490 R32float,
491 Rg16uint,
492 Rg16sint,
493 Rg16float,
494 Rgba8unorm,
495 Rgba8unorm_srgb,
496 Rgba8snorm,
497 Rgba8uint,
498 Rgba8sint,
499 Bgra8unorm,
500 Bgra8unorm_srgb,
501 Rgb9e5ufloat,
502 Rgb10a2uint,
503 Rgb10a2unorm,
504 Rg11b10ufloat,
505 Rg32uint,
506 Rg32sint,
507 Rg32float,
508 Rgba16uint,
509 Rgba16sint,
510 Rgba16float,
511 Rgba32uint,
512 Rgba32sint,
513 Rgba32float,
514 Stencil8,
515 Depth16unorm,
516 Depth24plus,
517 Depth24plus_stencil8,
518 Depth32float,
519 Depth32float_stencil8,
520 Bc1_rgba_unorm,
521 Bc1_rgba_unorm_srgb,
522 Bc2_rgba_unorm,
523 Bc2_rgba_unorm_srgb,
524 Bc3_rgba_unorm,
525 Bc3_rgba_unorm_srgb,
526 Bc4_r_unorm,
527 Bc4_r_snorm,
528 Bc5_rg_unorm,
529 Bc5_rg_snorm,
530 Bc6h_rgb_ufloat,
531 Bc6h_rgb_float,
532 Bc7_rgba_unorm,
533 Bc7_rgba_unorm_srgb,
534 Etc2_rgb8unorm,
535 Etc2_rgb8unorm_srgb,
536 Etc2_rgb8a1unorm,
537 Etc2_rgb8a1unorm_srgb,
538 Etc2_rgba8unorm,
539 Etc2_rgba8unorm_srgb,
540 Eac_r11unorm,
541 Eac_r11snorm,
542 Eac_rg11unorm,
543 Eac_rg11snorm,
544 Astc_4x4_unorm,
545 Astc_4x4_unorm_srgb,
546 Astc_5x4_unorm,
547 Astc_5x4_unorm_srgb,
548 Astc_5x5_unorm,
549 Astc_5x5_unorm_srgb,
550 Astc_6x5_unorm,
551 Astc_6x5_unorm_srgb,
552 Astc_6x6_unorm,
553 Astc_6x6_unorm_srgb,
554 Astc_8x5_unorm,
555 Astc_8x5_unorm_srgb,
556 Astc_8x6_unorm,
557 Astc_8x6_unorm_srgb,
558 Astc_8x8_unorm,
559 Astc_8x8_unorm_srgb,
560 Astc_10x5_unorm,
561 Astc_10x5_unorm_srgb,
562 Astc_10x6_unorm,
563 Astc_10x6_unorm_srgb,
564 Astc_10x8_unorm,
565 Astc_10x8_unorm_srgb,
566 Astc_10x10_unorm,
567 Astc_10x10_unorm_srgb,
568 Astc_12x10_unorm,
569 Astc_12x10_unorm_srgb,
570 Astc_12x12_unorm,
571 Astc_12x12_unorm_srgb
572}
573pub mod GPUTextureFormatValues {
574
575 use crate::utils::find_enum_value;
576 use js::conversions::ConversionResult;
577 use js::conversions::FromJSValConvertible;
578 use js::conversions::ToJSValConvertible;
579 use js::context::RawJSContext;
580 use js::rust::HandleValue;
581 use js::rust::MutableHandleValue;
582 use js::jsval::JSVal;
583
584 pub(crate) const pairs: &[(&str, super::GPUTextureFormat)] = &[
585 ("r8unorm", super::GPUTextureFormat::R8unorm),
586 ("r8snorm", super::GPUTextureFormat::R8snorm),
587 ("r8uint", super::GPUTextureFormat::R8uint),
588 ("r8sint", super::GPUTextureFormat::R8sint),
589 ("r16uint", super::GPUTextureFormat::R16uint),
590 ("r16sint", super::GPUTextureFormat::R16sint),
591 ("r16float", super::GPUTextureFormat::R16float),
592 ("rg8unorm", super::GPUTextureFormat::Rg8unorm),
593 ("rg8snorm", super::GPUTextureFormat::Rg8snorm),
594 ("rg8uint", super::GPUTextureFormat::Rg8uint),
595 ("rg8sint", super::GPUTextureFormat::Rg8sint),
596 ("r32uint", super::GPUTextureFormat::R32uint),
597 ("r32sint", super::GPUTextureFormat::R32sint),
598 ("r32float", super::GPUTextureFormat::R32float),
599 ("rg16uint", super::GPUTextureFormat::Rg16uint),
600 ("rg16sint", super::GPUTextureFormat::Rg16sint),
601 ("rg16float", super::GPUTextureFormat::Rg16float),
602 ("rgba8unorm", super::GPUTextureFormat::Rgba8unorm),
603 ("rgba8unorm-srgb", super::GPUTextureFormat::Rgba8unorm_srgb),
604 ("rgba8snorm", super::GPUTextureFormat::Rgba8snorm),
605 ("rgba8uint", super::GPUTextureFormat::Rgba8uint),
606 ("rgba8sint", super::GPUTextureFormat::Rgba8sint),
607 ("bgra8unorm", super::GPUTextureFormat::Bgra8unorm),
608 ("bgra8unorm-srgb", super::GPUTextureFormat::Bgra8unorm_srgb),
609 ("rgb9e5ufloat", super::GPUTextureFormat::Rgb9e5ufloat),
610 ("rgb10a2uint", super::GPUTextureFormat::Rgb10a2uint),
611 ("rgb10a2unorm", super::GPUTextureFormat::Rgb10a2unorm),
612 ("rg11b10ufloat", super::GPUTextureFormat::Rg11b10ufloat),
613 ("rg32uint", super::GPUTextureFormat::Rg32uint),
614 ("rg32sint", super::GPUTextureFormat::Rg32sint),
615 ("rg32float", super::GPUTextureFormat::Rg32float),
616 ("rgba16uint", super::GPUTextureFormat::Rgba16uint),
617 ("rgba16sint", super::GPUTextureFormat::Rgba16sint),
618 ("rgba16float", super::GPUTextureFormat::Rgba16float),
619 ("rgba32uint", super::GPUTextureFormat::Rgba32uint),
620 ("rgba32sint", super::GPUTextureFormat::Rgba32sint),
621 ("rgba32float", super::GPUTextureFormat::Rgba32float),
622 ("stencil8", super::GPUTextureFormat::Stencil8),
623 ("depth16unorm", super::GPUTextureFormat::Depth16unorm),
624 ("depth24plus", super::GPUTextureFormat::Depth24plus),
625 ("depth24plus-stencil8", super::GPUTextureFormat::Depth24plus_stencil8),
626 ("depth32float", super::GPUTextureFormat::Depth32float),
627 ("depth32float-stencil8", super::GPUTextureFormat::Depth32float_stencil8),
628 ("bc1-rgba-unorm", super::GPUTextureFormat::Bc1_rgba_unorm),
629 ("bc1-rgba-unorm-srgb", super::GPUTextureFormat::Bc1_rgba_unorm_srgb),
630 ("bc2-rgba-unorm", super::GPUTextureFormat::Bc2_rgba_unorm),
631 ("bc2-rgba-unorm-srgb", super::GPUTextureFormat::Bc2_rgba_unorm_srgb),
632 ("bc3-rgba-unorm", super::GPUTextureFormat::Bc3_rgba_unorm),
633 ("bc3-rgba-unorm-srgb", super::GPUTextureFormat::Bc3_rgba_unorm_srgb),
634 ("bc4-r-unorm", super::GPUTextureFormat::Bc4_r_unorm),
635 ("bc4-r-snorm", super::GPUTextureFormat::Bc4_r_snorm),
636 ("bc5-rg-unorm", super::GPUTextureFormat::Bc5_rg_unorm),
637 ("bc5-rg-snorm", super::GPUTextureFormat::Bc5_rg_snorm),
638 ("bc6h-rgb-ufloat", super::GPUTextureFormat::Bc6h_rgb_ufloat),
639 ("bc6h-rgb-float", super::GPUTextureFormat::Bc6h_rgb_float),
640 ("bc7-rgba-unorm", super::GPUTextureFormat::Bc7_rgba_unorm),
641 ("bc7-rgba-unorm-srgb", super::GPUTextureFormat::Bc7_rgba_unorm_srgb),
642 ("etc2-rgb8unorm", super::GPUTextureFormat::Etc2_rgb8unorm),
643 ("etc2-rgb8unorm-srgb", super::GPUTextureFormat::Etc2_rgb8unorm_srgb),
644 ("etc2-rgb8a1unorm", super::GPUTextureFormat::Etc2_rgb8a1unorm),
645 ("etc2-rgb8a1unorm-srgb", super::GPUTextureFormat::Etc2_rgb8a1unorm_srgb),
646 ("etc2-rgba8unorm", super::GPUTextureFormat::Etc2_rgba8unorm),
647 ("etc2-rgba8unorm-srgb", super::GPUTextureFormat::Etc2_rgba8unorm_srgb),
648 ("eac-r11unorm", super::GPUTextureFormat::Eac_r11unorm),
649 ("eac-r11snorm", super::GPUTextureFormat::Eac_r11snorm),
650 ("eac-rg11unorm", super::GPUTextureFormat::Eac_rg11unorm),
651 ("eac-rg11snorm", super::GPUTextureFormat::Eac_rg11snorm),
652 ("astc-4x4-unorm", super::GPUTextureFormat::Astc_4x4_unorm),
653 ("astc-4x4-unorm-srgb", super::GPUTextureFormat::Astc_4x4_unorm_srgb),
654 ("astc-5x4-unorm", super::GPUTextureFormat::Astc_5x4_unorm),
655 ("astc-5x4-unorm-srgb", super::GPUTextureFormat::Astc_5x4_unorm_srgb),
656 ("astc-5x5-unorm", super::GPUTextureFormat::Astc_5x5_unorm),
657 ("astc-5x5-unorm-srgb", super::GPUTextureFormat::Astc_5x5_unorm_srgb),
658 ("astc-6x5-unorm", super::GPUTextureFormat::Astc_6x5_unorm),
659 ("astc-6x5-unorm-srgb", super::GPUTextureFormat::Astc_6x5_unorm_srgb),
660 ("astc-6x6-unorm", super::GPUTextureFormat::Astc_6x6_unorm),
661 ("astc-6x6-unorm-srgb", super::GPUTextureFormat::Astc_6x6_unorm_srgb),
662 ("astc-8x5-unorm", super::GPUTextureFormat::Astc_8x5_unorm),
663 ("astc-8x5-unorm-srgb", super::GPUTextureFormat::Astc_8x5_unorm_srgb),
664 ("astc-8x6-unorm", super::GPUTextureFormat::Astc_8x6_unorm),
665 ("astc-8x6-unorm-srgb", super::GPUTextureFormat::Astc_8x6_unorm_srgb),
666 ("astc-8x8-unorm", super::GPUTextureFormat::Astc_8x8_unorm),
667 ("astc-8x8-unorm-srgb", super::GPUTextureFormat::Astc_8x8_unorm_srgb),
668 ("astc-10x5-unorm", super::GPUTextureFormat::Astc_10x5_unorm),
669 ("astc-10x5-unorm-srgb", super::GPUTextureFormat::Astc_10x5_unorm_srgb),
670 ("astc-10x6-unorm", super::GPUTextureFormat::Astc_10x6_unorm),
671 ("astc-10x6-unorm-srgb", super::GPUTextureFormat::Astc_10x6_unorm_srgb),
672 ("astc-10x8-unorm", super::GPUTextureFormat::Astc_10x8_unorm),
673 ("astc-10x8-unorm-srgb", super::GPUTextureFormat::Astc_10x8_unorm_srgb),
674 ("astc-10x10-unorm", super::GPUTextureFormat::Astc_10x10_unorm),
675 ("astc-10x10-unorm-srgb", super::GPUTextureFormat::Astc_10x10_unorm_srgb),
676 ("astc-12x10-unorm", super::GPUTextureFormat::Astc_12x10_unorm),
677 ("astc-12x10-unorm-srgb", super::GPUTextureFormat::Astc_12x10_unorm_srgb),
678 ("astc-12x12-unorm", super::GPUTextureFormat::Astc_12x12_unorm),
679 ("astc-12x12-unorm-srgb", super::GPUTextureFormat::Astc_12x12_unorm_srgb),
680 ];
681
682 impl super::GPUTextureFormat {
683 pub fn as_str(&self) -> &'static str {
684 pairs[*self as usize].0
685 }
686 }
687
688 impl Default for super::GPUTextureFormat {
689 fn default() -> super::GPUTextureFormat {
690 pairs[0].1
691 }
692 }
693
694 impl std::str::FromStr for super::GPUTextureFormat {
695 type Err = ();
696
697 fn from_str(s: &str) -> Result<Self, Self::Err> {
698 pairs
699 .iter()
700 .find(|&&(key, _)| s == key)
701 .map(|&(_, ev)| ev)
702 .ok_or(())
703 }
704 }
705
706 impl ToJSValConvertible for super::GPUTextureFormat {
707 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
708 pairs[*self as usize].0.to_jsval(cx, rval);
709 }
710 }
711
712 impl FromJSValConvertible for super::GPUTextureFormat {
713 type Config = ();
714 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
715 -> Result<ConversionResult<super::GPUTextureFormat>, ()> {
716 match find_enum_value(cx, value, pairs) {
717 Err(_) => Err(()),
718 Ok((None, search)) => {
719 Ok(ConversionResult::Failure(
720 format!("'{}' is not a valid enum value for enumeration 'GPUTextureFormat'.", search).into()
721 ))
722 }
723 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
724 }
725 }
726 }
727 } #[repr(usize)]
731#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
732pub enum GPUAddressMode {
733 Clamp_to_edge,
734 Repeat,
735 Mirror_repeat
736}
737pub mod GPUAddressModeValues {
738
739 use crate::utils::find_enum_value;
740 use js::conversions::ConversionResult;
741 use js::conversions::FromJSValConvertible;
742 use js::conversions::ToJSValConvertible;
743 use js::context::RawJSContext;
744 use js::rust::HandleValue;
745 use js::rust::MutableHandleValue;
746 use js::jsval::JSVal;
747
748 pub(crate) const pairs: &[(&str, super::GPUAddressMode)] = &[
749 ("clamp-to-edge", super::GPUAddressMode::Clamp_to_edge),
750 ("repeat", super::GPUAddressMode::Repeat),
751 ("mirror-repeat", super::GPUAddressMode::Mirror_repeat),
752 ];
753
754 impl super::GPUAddressMode {
755 pub fn as_str(&self) -> &'static str {
756 pairs[*self as usize].0
757 }
758 }
759
760 impl Default for super::GPUAddressMode {
761 fn default() -> super::GPUAddressMode {
762 pairs[0].1
763 }
764 }
765
766 impl std::str::FromStr for super::GPUAddressMode {
767 type Err = ();
768
769 fn from_str(s: &str) -> Result<Self, Self::Err> {
770 pairs
771 .iter()
772 .find(|&&(key, _)| s == key)
773 .map(|&(_, ev)| ev)
774 .ok_or(())
775 }
776 }
777
778 impl ToJSValConvertible for super::GPUAddressMode {
779 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
780 pairs[*self as usize].0.to_jsval(cx, rval);
781 }
782 }
783
784 impl FromJSValConvertible for super::GPUAddressMode {
785 type Config = ();
786 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
787 -> Result<ConversionResult<super::GPUAddressMode>, ()> {
788 match find_enum_value(cx, value, pairs) {
789 Err(_) => Err(()),
790 Ok((None, search)) => {
791 Ok(ConversionResult::Failure(
792 format!("'{}' is not a valid enum value for enumeration 'GPUAddressMode'.", search).into()
793 ))
794 }
795 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
796 }
797 }
798 }
799 } #[repr(usize)]
803#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
804pub enum GPUFilterMode {
805 Nearest,
806 Linear
807}
808pub mod GPUFilterModeValues {
809
810 use crate::utils::find_enum_value;
811 use js::conversions::ConversionResult;
812 use js::conversions::FromJSValConvertible;
813 use js::conversions::ToJSValConvertible;
814 use js::context::RawJSContext;
815 use js::rust::HandleValue;
816 use js::rust::MutableHandleValue;
817 use js::jsval::JSVal;
818
819 pub(crate) const pairs: &[(&str, super::GPUFilterMode)] = &[
820 ("nearest", super::GPUFilterMode::Nearest),
821 ("linear", super::GPUFilterMode::Linear),
822 ];
823
824 impl super::GPUFilterMode {
825 pub fn as_str(&self) -> &'static str {
826 pairs[*self as usize].0
827 }
828 }
829
830 impl Default for super::GPUFilterMode {
831 fn default() -> super::GPUFilterMode {
832 pairs[0].1
833 }
834 }
835
836 impl std::str::FromStr for super::GPUFilterMode {
837 type Err = ();
838
839 fn from_str(s: &str) -> Result<Self, Self::Err> {
840 pairs
841 .iter()
842 .find(|&&(key, _)| s == key)
843 .map(|&(_, ev)| ev)
844 .ok_or(())
845 }
846 }
847
848 impl ToJSValConvertible for super::GPUFilterMode {
849 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
850 pairs[*self as usize].0.to_jsval(cx, rval);
851 }
852 }
853
854 impl FromJSValConvertible for super::GPUFilterMode {
855 type Config = ();
856 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
857 -> Result<ConversionResult<super::GPUFilterMode>, ()> {
858 match find_enum_value(cx, value, pairs) {
859 Err(_) => Err(()),
860 Ok((None, search)) => {
861 Ok(ConversionResult::Failure(
862 format!("'{}' is not a valid enum value for enumeration 'GPUFilterMode'.", search).into()
863 ))
864 }
865 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
866 }
867 }
868 }
869 } #[repr(usize)]
873#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
874pub enum GPUCompareFunction {
875 Never,
876 Less,
877 Equal,
878 Less_equal,
879 Greater,
880 Not_equal,
881 Greater_equal,
882 Always
883}
884pub mod GPUCompareFunctionValues {
885
886 use crate::utils::find_enum_value;
887 use js::conversions::ConversionResult;
888 use js::conversions::FromJSValConvertible;
889 use js::conversions::ToJSValConvertible;
890 use js::context::RawJSContext;
891 use js::rust::HandleValue;
892 use js::rust::MutableHandleValue;
893 use js::jsval::JSVal;
894
895 pub(crate) const pairs: &[(&str, super::GPUCompareFunction)] = &[
896 ("never", super::GPUCompareFunction::Never),
897 ("less", super::GPUCompareFunction::Less),
898 ("equal", super::GPUCompareFunction::Equal),
899 ("less-equal", super::GPUCompareFunction::Less_equal),
900 ("greater", super::GPUCompareFunction::Greater),
901 ("not-equal", super::GPUCompareFunction::Not_equal),
902 ("greater-equal", super::GPUCompareFunction::Greater_equal),
903 ("always", super::GPUCompareFunction::Always),
904 ];
905
906 impl super::GPUCompareFunction {
907 pub fn as_str(&self) -> &'static str {
908 pairs[*self as usize].0
909 }
910 }
911
912 impl Default for super::GPUCompareFunction {
913 fn default() -> super::GPUCompareFunction {
914 pairs[0].1
915 }
916 }
917
918 impl std::str::FromStr for super::GPUCompareFunction {
919 type Err = ();
920
921 fn from_str(s: &str) -> Result<Self, Self::Err> {
922 pairs
923 .iter()
924 .find(|&&(key, _)| s == key)
925 .map(|&(_, ev)| ev)
926 .ok_or(())
927 }
928 }
929
930 impl ToJSValConvertible for super::GPUCompareFunction {
931 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
932 pairs[*self as usize].0.to_jsval(cx, rval);
933 }
934 }
935
936 impl FromJSValConvertible for super::GPUCompareFunction {
937 type Config = ();
938 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
939 -> Result<ConversionResult<super::GPUCompareFunction>, ()> {
940 match find_enum_value(cx, value, pairs) {
941 Err(_) => Err(()),
942 Ok((None, search)) => {
943 Ok(ConversionResult::Failure(
944 format!("'{}' is not a valid enum value for enumeration 'GPUCompareFunction'.", search).into()
945 ))
946 }
947 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
948 }
949 }
950 }
951 } #[repr(usize)]
955#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
956pub enum GPUBufferBindingType {
957 Uniform,
958 Storage,
959 Read_only_storage
960}
961pub mod GPUBufferBindingTypeValues {
962
963 use crate::utils::find_enum_value;
964 use js::conversions::ConversionResult;
965 use js::conversions::FromJSValConvertible;
966 use js::conversions::ToJSValConvertible;
967 use js::context::RawJSContext;
968 use js::rust::HandleValue;
969 use js::rust::MutableHandleValue;
970 use js::jsval::JSVal;
971
972 pub(crate) const pairs: &[(&str, super::GPUBufferBindingType)] = &[
973 ("uniform", super::GPUBufferBindingType::Uniform),
974 ("storage", super::GPUBufferBindingType::Storage),
975 ("read-only-storage", super::GPUBufferBindingType::Read_only_storage),
976 ];
977
978 impl super::GPUBufferBindingType {
979 pub fn as_str(&self) -> &'static str {
980 pairs[*self as usize].0
981 }
982 }
983
984 impl Default for super::GPUBufferBindingType {
985 fn default() -> super::GPUBufferBindingType {
986 pairs[0].1
987 }
988 }
989
990 impl std::str::FromStr for super::GPUBufferBindingType {
991 type Err = ();
992
993 fn from_str(s: &str) -> Result<Self, Self::Err> {
994 pairs
995 .iter()
996 .find(|&&(key, _)| s == key)
997 .map(|&(_, ev)| ev)
998 .ok_or(())
999 }
1000 }
1001
1002 impl ToJSValConvertible for super::GPUBufferBindingType {
1003 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
1004 pairs[*self as usize].0.to_jsval(cx, rval);
1005 }
1006 }
1007
1008 impl FromJSValConvertible for super::GPUBufferBindingType {
1009 type Config = ();
1010 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
1011 -> Result<ConversionResult<super::GPUBufferBindingType>, ()> {
1012 match find_enum_value(cx, value, pairs) {
1013 Err(_) => Err(()),
1014 Ok((None, search)) => {
1015 Ok(ConversionResult::Failure(
1016 format!("'{}' is not a valid enum value for enumeration 'GPUBufferBindingType'.", search).into()
1017 ))
1018 }
1019 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
1020 }
1021 }
1022 }
1023 } #[repr(usize)]
1027#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
1028pub enum GPUSamplerBindingType {
1029 Filtering,
1030 Non_filtering,
1031 Comparison
1032}
1033pub mod GPUSamplerBindingTypeValues {
1034
1035 use crate::utils::find_enum_value;
1036 use js::conversions::ConversionResult;
1037 use js::conversions::FromJSValConvertible;
1038 use js::conversions::ToJSValConvertible;
1039 use js::context::RawJSContext;
1040 use js::rust::HandleValue;
1041 use js::rust::MutableHandleValue;
1042 use js::jsval::JSVal;
1043
1044 pub(crate) const pairs: &[(&str, super::GPUSamplerBindingType)] = &[
1045 ("filtering", super::GPUSamplerBindingType::Filtering),
1046 ("non-filtering", super::GPUSamplerBindingType::Non_filtering),
1047 ("comparison", super::GPUSamplerBindingType::Comparison),
1048 ];
1049
1050 impl super::GPUSamplerBindingType {
1051 pub fn as_str(&self) -> &'static str {
1052 pairs[*self as usize].0
1053 }
1054 }
1055
1056 impl Default for super::GPUSamplerBindingType {
1057 fn default() -> super::GPUSamplerBindingType {
1058 pairs[0].1
1059 }
1060 }
1061
1062 impl std::str::FromStr for super::GPUSamplerBindingType {
1063 type Err = ();
1064
1065 fn from_str(s: &str) -> Result<Self, Self::Err> {
1066 pairs
1067 .iter()
1068 .find(|&&(key, _)| s == key)
1069 .map(|&(_, ev)| ev)
1070 .ok_or(())
1071 }
1072 }
1073
1074 impl ToJSValConvertible for super::GPUSamplerBindingType {
1075 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
1076 pairs[*self as usize].0.to_jsval(cx, rval);
1077 }
1078 }
1079
1080 impl FromJSValConvertible for super::GPUSamplerBindingType {
1081 type Config = ();
1082 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
1083 -> Result<ConversionResult<super::GPUSamplerBindingType>, ()> {
1084 match find_enum_value(cx, value, pairs) {
1085 Err(_) => Err(()),
1086 Ok((None, search)) => {
1087 Ok(ConversionResult::Failure(
1088 format!("'{}' is not a valid enum value for enumeration 'GPUSamplerBindingType'.", search).into()
1089 ))
1090 }
1091 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
1092 }
1093 }
1094 }
1095 } #[repr(usize)]
1099#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
1100pub enum GPUTextureSampleType {
1101 Float,
1102 Unfilterable_float,
1103 Depth,
1104 Sint,
1105 Uint
1106}
1107pub mod GPUTextureSampleTypeValues {
1108
1109 use crate::utils::find_enum_value;
1110 use js::conversions::ConversionResult;
1111 use js::conversions::FromJSValConvertible;
1112 use js::conversions::ToJSValConvertible;
1113 use js::context::RawJSContext;
1114 use js::rust::HandleValue;
1115 use js::rust::MutableHandleValue;
1116 use js::jsval::JSVal;
1117
1118 pub(crate) const pairs: &[(&str, super::GPUTextureSampleType)] = &[
1119 ("float", super::GPUTextureSampleType::Float),
1120 ("unfilterable-float", super::GPUTextureSampleType::Unfilterable_float),
1121 ("depth", super::GPUTextureSampleType::Depth),
1122 ("sint", super::GPUTextureSampleType::Sint),
1123 ("uint", super::GPUTextureSampleType::Uint),
1124 ];
1125
1126 impl super::GPUTextureSampleType {
1127 pub fn as_str(&self) -> &'static str {
1128 pairs[*self as usize].0
1129 }
1130 }
1131
1132 impl Default for super::GPUTextureSampleType {
1133 fn default() -> super::GPUTextureSampleType {
1134 pairs[0].1
1135 }
1136 }
1137
1138 impl std::str::FromStr for super::GPUTextureSampleType {
1139 type Err = ();
1140
1141 fn from_str(s: &str) -> Result<Self, Self::Err> {
1142 pairs
1143 .iter()
1144 .find(|&&(key, _)| s == key)
1145 .map(|&(_, ev)| ev)
1146 .ok_or(())
1147 }
1148 }
1149
1150 impl ToJSValConvertible for super::GPUTextureSampleType {
1151 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
1152 pairs[*self as usize].0.to_jsval(cx, rval);
1153 }
1154 }
1155
1156 impl FromJSValConvertible for super::GPUTextureSampleType {
1157 type Config = ();
1158 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
1159 -> Result<ConversionResult<super::GPUTextureSampleType>, ()> {
1160 match find_enum_value(cx, value, pairs) {
1161 Err(_) => Err(()),
1162 Ok((None, search)) => {
1163 Ok(ConversionResult::Failure(
1164 format!("'{}' is not a valid enum value for enumeration 'GPUTextureSampleType'.", search).into()
1165 ))
1166 }
1167 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
1168 }
1169 }
1170 }
1171 } #[repr(usize)]
1175#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
1176pub enum GPUStorageTextureAccess {
1177 Write_only,
1178 Read_only,
1179 Read_write
1180}
1181pub mod GPUStorageTextureAccessValues {
1182
1183 use crate::utils::find_enum_value;
1184 use js::conversions::ConversionResult;
1185 use js::conversions::FromJSValConvertible;
1186 use js::conversions::ToJSValConvertible;
1187 use js::context::RawJSContext;
1188 use js::rust::HandleValue;
1189 use js::rust::MutableHandleValue;
1190 use js::jsval::JSVal;
1191
1192 pub(crate) const pairs: &[(&str, super::GPUStorageTextureAccess)] = &[
1193 ("write-only", super::GPUStorageTextureAccess::Write_only),
1194 ("read-only", super::GPUStorageTextureAccess::Read_only),
1195 ("read-write", super::GPUStorageTextureAccess::Read_write),
1196 ];
1197
1198 impl super::GPUStorageTextureAccess {
1199 pub fn as_str(&self) -> &'static str {
1200 pairs[*self as usize].0
1201 }
1202 }
1203
1204 impl Default for super::GPUStorageTextureAccess {
1205 fn default() -> super::GPUStorageTextureAccess {
1206 pairs[0].1
1207 }
1208 }
1209
1210 impl std::str::FromStr for super::GPUStorageTextureAccess {
1211 type Err = ();
1212
1213 fn from_str(s: &str) -> Result<Self, Self::Err> {
1214 pairs
1215 .iter()
1216 .find(|&&(key, _)| s == key)
1217 .map(|&(_, ev)| ev)
1218 .ok_or(())
1219 }
1220 }
1221
1222 impl ToJSValConvertible for super::GPUStorageTextureAccess {
1223 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
1224 pairs[*self as usize].0.to_jsval(cx, rval);
1225 }
1226 }
1227
1228 impl FromJSValConvertible for super::GPUStorageTextureAccess {
1229 type Config = ();
1230 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
1231 -> Result<ConversionResult<super::GPUStorageTextureAccess>, ()> {
1232 match find_enum_value(cx, value, pairs) {
1233 Err(_) => Err(()),
1234 Ok((None, search)) => {
1235 Ok(ConversionResult::Failure(
1236 format!("'{}' is not a valid enum value for enumeration 'GPUStorageTextureAccess'.", search).into()
1237 ))
1238 }
1239 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
1240 }
1241 }
1242 }
1243 } #[repr(usize)]
1247#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
1248pub enum GPUCompilationMessageType {
1249 Error,
1250 Warning,
1251 Info
1252}
1253pub mod GPUCompilationMessageTypeValues {
1254
1255 use crate::utils::find_enum_value;
1256 use js::conversions::ConversionResult;
1257 use js::conversions::FromJSValConvertible;
1258 use js::conversions::ToJSValConvertible;
1259 use js::context::RawJSContext;
1260 use js::rust::HandleValue;
1261 use js::rust::MutableHandleValue;
1262 use js::jsval::JSVal;
1263
1264 pub(crate) const pairs: &[(&str, super::GPUCompilationMessageType)] = &[
1265 ("error", super::GPUCompilationMessageType::Error),
1266 ("warning", super::GPUCompilationMessageType::Warning),
1267 ("info", super::GPUCompilationMessageType::Info),
1268 ];
1269
1270 impl super::GPUCompilationMessageType {
1271 pub fn as_str(&self) -> &'static str {
1272 pairs[*self as usize].0
1273 }
1274 }
1275
1276 impl Default for super::GPUCompilationMessageType {
1277 fn default() -> super::GPUCompilationMessageType {
1278 pairs[0].1
1279 }
1280 }
1281
1282 impl std::str::FromStr for super::GPUCompilationMessageType {
1283 type Err = ();
1284
1285 fn from_str(s: &str) -> Result<Self, Self::Err> {
1286 pairs
1287 .iter()
1288 .find(|&&(key, _)| s == key)
1289 .map(|&(_, ev)| ev)
1290 .ok_or(())
1291 }
1292 }
1293
1294 impl ToJSValConvertible for super::GPUCompilationMessageType {
1295 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
1296 pairs[*self as usize].0.to_jsval(cx, rval);
1297 }
1298 }
1299
1300 impl FromJSValConvertible for super::GPUCompilationMessageType {
1301 type Config = ();
1302 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
1303 -> Result<ConversionResult<super::GPUCompilationMessageType>, ()> {
1304 match find_enum_value(cx, value, pairs) {
1305 Err(_) => Err(()),
1306 Ok((None, search)) => {
1307 Ok(ConversionResult::Failure(
1308 format!("'{}' is not a valid enum value for enumeration 'GPUCompilationMessageType'.", search).into()
1309 ))
1310 }
1311 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
1312 }
1313 }
1314 }
1315 } #[repr(usize)]
1319#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
1320pub enum GPUPipelineErrorReason {
1321 Validation,
1322 Internal
1323}
1324pub mod GPUPipelineErrorReasonValues {
1325
1326 use crate::utils::find_enum_value;
1327 use js::conversions::ConversionResult;
1328 use js::conversions::FromJSValConvertible;
1329 use js::conversions::ToJSValConvertible;
1330 use js::context::RawJSContext;
1331 use js::rust::HandleValue;
1332 use js::rust::MutableHandleValue;
1333 use js::jsval::JSVal;
1334
1335 pub(crate) const pairs: &[(&str, super::GPUPipelineErrorReason)] = &[
1336 ("validation", super::GPUPipelineErrorReason::Validation),
1337 ("internal", super::GPUPipelineErrorReason::Internal),
1338 ];
1339
1340 impl super::GPUPipelineErrorReason {
1341 pub fn as_str(&self) -> &'static str {
1342 pairs[*self as usize].0
1343 }
1344 }
1345
1346 impl Default for super::GPUPipelineErrorReason {
1347 fn default() -> super::GPUPipelineErrorReason {
1348 pairs[0].1
1349 }
1350 }
1351
1352 impl std::str::FromStr for super::GPUPipelineErrorReason {
1353 type Err = ();
1354
1355 fn from_str(s: &str) -> Result<Self, Self::Err> {
1356 pairs
1357 .iter()
1358 .find(|&&(key, _)| s == key)
1359 .map(|&(_, ev)| ev)
1360 .ok_or(())
1361 }
1362 }
1363
1364 impl ToJSValConvertible for super::GPUPipelineErrorReason {
1365 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
1366 pairs[*self as usize].0.to_jsval(cx, rval);
1367 }
1368 }
1369
1370 impl FromJSValConvertible for super::GPUPipelineErrorReason {
1371 type Config = ();
1372 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
1373 -> Result<ConversionResult<super::GPUPipelineErrorReason>, ()> {
1374 match find_enum_value(cx, value, pairs) {
1375 Err(_) => Err(()),
1376 Ok((None, search)) => {
1377 Ok(ConversionResult::Failure(
1378 format!("'{}' is not a valid enum value for enumeration 'GPUPipelineErrorReason'.", search).into()
1379 ))
1380 }
1381 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
1382 }
1383 }
1384 }
1385 } #[repr(usize)]
1389#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
1390pub enum GPUAutoLayoutMode {
1391 Auto
1392}
1393pub mod GPUAutoLayoutModeValues {
1394
1395 use crate::utils::find_enum_value;
1396 use js::conversions::ConversionResult;
1397 use js::conversions::FromJSValConvertible;
1398 use js::conversions::ToJSValConvertible;
1399 use js::context::RawJSContext;
1400 use js::rust::HandleValue;
1401 use js::rust::MutableHandleValue;
1402 use js::jsval::JSVal;
1403
1404 pub(crate) const pairs: &[(&str, super::GPUAutoLayoutMode)] = &[
1405 ("auto", super::GPUAutoLayoutMode::Auto),
1406 ];
1407
1408 impl super::GPUAutoLayoutMode {
1409 pub fn as_str(&self) -> &'static str {
1410 pairs[*self as usize].0
1411 }
1412 }
1413
1414 impl Default for super::GPUAutoLayoutMode {
1415 fn default() -> super::GPUAutoLayoutMode {
1416 pairs[0].1
1417 }
1418 }
1419
1420 impl std::str::FromStr for super::GPUAutoLayoutMode {
1421 type Err = ();
1422
1423 fn from_str(s: &str) -> Result<Self, Self::Err> {
1424 pairs
1425 .iter()
1426 .find(|&&(key, _)| s == key)
1427 .map(|&(_, ev)| ev)
1428 .ok_or(())
1429 }
1430 }
1431
1432 impl ToJSValConvertible for super::GPUAutoLayoutMode {
1433 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
1434 pairs[*self as usize].0.to_jsval(cx, rval);
1435 }
1436 }
1437
1438 impl FromJSValConvertible for super::GPUAutoLayoutMode {
1439 type Config = ();
1440 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
1441 -> Result<ConversionResult<super::GPUAutoLayoutMode>, ()> {
1442 match find_enum_value(cx, value, pairs) {
1443 Err(_) => Err(()),
1444 Ok((None, search)) => {
1445 Ok(ConversionResult::Failure(
1446 format!("'{}' is not a valid enum value for enumeration 'GPUAutoLayoutMode'.", search).into()
1447 ))
1448 }
1449 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
1450 }
1451 }
1452 }
1453 } #[repr(usize)]
1457#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
1458pub enum GPUPrimitiveTopology {
1459 Point_list,
1460 Line_list,
1461 Line_strip,
1462 Triangle_list,
1463 Triangle_strip
1464}
1465pub mod GPUPrimitiveTopologyValues {
1466
1467 use crate::utils::find_enum_value;
1468 use js::conversions::ConversionResult;
1469 use js::conversions::FromJSValConvertible;
1470 use js::conversions::ToJSValConvertible;
1471 use js::context::RawJSContext;
1472 use js::rust::HandleValue;
1473 use js::rust::MutableHandleValue;
1474 use js::jsval::JSVal;
1475
1476 pub(crate) const pairs: &[(&str, super::GPUPrimitiveTopology)] = &[
1477 ("point-list", super::GPUPrimitiveTopology::Point_list),
1478 ("line-list", super::GPUPrimitiveTopology::Line_list),
1479 ("line-strip", super::GPUPrimitiveTopology::Line_strip),
1480 ("triangle-list", super::GPUPrimitiveTopology::Triangle_list),
1481 ("triangle-strip", super::GPUPrimitiveTopology::Triangle_strip),
1482 ];
1483
1484 impl super::GPUPrimitiveTopology {
1485 pub fn as_str(&self) -> &'static str {
1486 pairs[*self as usize].0
1487 }
1488 }
1489
1490 impl Default for super::GPUPrimitiveTopology {
1491 fn default() -> super::GPUPrimitiveTopology {
1492 pairs[0].1
1493 }
1494 }
1495
1496 impl std::str::FromStr for super::GPUPrimitiveTopology {
1497 type Err = ();
1498
1499 fn from_str(s: &str) -> Result<Self, Self::Err> {
1500 pairs
1501 .iter()
1502 .find(|&&(key, _)| s == key)
1503 .map(|&(_, ev)| ev)
1504 .ok_or(())
1505 }
1506 }
1507
1508 impl ToJSValConvertible for super::GPUPrimitiveTopology {
1509 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
1510 pairs[*self as usize].0.to_jsval(cx, rval);
1511 }
1512 }
1513
1514 impl FromJSValConvertible for super::GPUPrimitiveTopology {
1515 type Config = ();
1516 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
1517 -> Result<ConversionResult<super::GPUPrimitiveTopology>, ()> {
1518 match find_enum_value(cx, value, pairs) {
1519 Err(_) => Err(()),
1520 Ok((None, search)) => {
1521 Ok(ConversionResult::Failure(
1522 format!("'{}' is not a valid enum value for enumeration 'GPUPrimitiveTopology'.", search).into()
1523 ))
1524 }
1525 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
1526 }
1527 }
1528 }
1529 } #[repr(usize)]
1533#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
1534pub enum GPUFrontFace {
1535 Ccw,
1536 Cw
1537}
1538pub mod GPUFrontFaceValues {
1539
1540 use crate::utils::find_enum_value;
1541 use js::conversions::ConversionResult;
1542 use js::conversions::FromJSValConvertible;
1543 use js::conversions::ToJSValConvertible;
1544 use js::context::RawJSContext;
1545 use js::rust::HandleValue;
1546 use js::rust::MutableHandleValue;
1547 use js::jsval::JSVal;
1548
1549 pub(crate) const pairs: &[(&str, super::GPUFrontFace)] = &[
1550 ("ccw", super::GPUFrontFace::Ccw),
1551 ("cw", super::GPUFrontFace::Cw),
1552 ];
1553
1554 impl super::GPUFrontFace {
1555 pub fn as_str(&self) -> &'static str {
1556 pairs[*self as usize].0
1557 }
1558 }
1559
1560 impl Default for super::GPUFrontFace {
1561 fn default() -> super::GPUFrontFace {
1562 pairs[0].1
1563 }
1564 }
1565
1566 impl std::str::FromStr for super::GPUFrontFace {
1567 type Err = ();
1568
1569 fn from_str(s: &str) -> Result<Self, Self::Err> {
1570 pairs
1571 .iter()
1572 .find(|&&(key, _)| s == key)
1573 .map(|&(_, ev)| ev)
1574 .ok_or(())
1575 }
1576 }
1577
1578 impl ToJSValConvertible for super::GPUFrontFace {
1579 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
1580 pairs[*self as usize].0.to_jsval(cx, rval);
1581 }
1582 }
1583
1584 impl FromJSValConvertible for super::GPUFrontFace {
1585 type Config = ();
1586 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
1587 -> Result<ConversionResult<super::GPUFrontFace>, ()> {
1588 match find_enum_value(cx, value, pairs) {
1589 Err(_) => Err(()),
1590 Ok((None, search)) => {
1591 Ok(ConversionResult::Failure(
1592 format!("'{}' is not a valid enum value for enumeration 'GPUFrontFace'.", search).into()
1593 ))
1594 }
1595 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
1596 }
1597 }
1598 }
1599 } #[repr(usize)]
1603#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
1604pub enum GPUCullMode {
1605 None,
1606 Front,
1607 Back
1608}
1609pub mod GPUCullModeValues {
1610
1611 use crate::utils::find_enum_value;
1612 use js::conversions::ConversionResult;
1613 use js::conversions::FromJSValConvertible;
1614 use js::conversions::ToJSValConvertible;
1615 use js::context::RawJSContext;
1616 use js::rust::HandleValue;
1617 use js::rust::MutableHandleValue;
1618 use js::jsval::JSVal;
1619
1620 pub(crate) const pairs: &[(&str, super::GPUCullMode)] = &[
1621 ("none", super::GPUCullMode::None),
1622 ("front", super::GPUCullMode::Front),
1623 ("back", super::GPUCullMode::Back),
1624 ];
1625
1626 impl super::GPUCullMode {
1627 pub fn as_str(&self) -> &'static str {
1628 pairs[*self as usize].0
1629 }
1630 }
1631
1632 impl Default for super::GPUCullMode {
1633 fn default() -> super::GPUCullMode {
1634 pairs[0].1
1635 }
1636 }
1637
1638 impl std::str::FromStr for super::GPUCullMode {
1639 type Err = ();
1640
1641 fn from_str(s: &str) -> Result<Self, Self::Err> {
1642 pairs
1643 .iter()
1644 .find(|&&(key, _)| s == key)
1645 .map(|&(_, ev)| ev)
1646 .ok_or(())
1647 }
1648 }
1649
1650 impl ToJSValConvertible for super::GPUCullMode {
1651 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
1652 pairs[*self as usize].0.to_jsval(cx, rval);
1653 }
1654 }
1655
1656 impl FromJSValConvertible for super::GPUCullMode {
1657 type Config = ();
1658 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
1659 -> Result<ConversionResult<super::GPUCullMode>, ()> {
1660 match find_enum_value(cx, value, pairs) {
1661 Err(_) => Err(()),
1662 Ok((None, search)) => {
1663 Ok(ConversionResult::Failure(
1664 format!("'{}' is not a valid enum value for enumeration 'GPUCullMode'.", search).into()
1665 ))
1666 }
1667 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
1668 }
1669 }
1670 }
1671 } #[repr(usize)]
1675#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
1676pub enum GPUBlendFactor {
1677 Zero,
1678 One,
1679 Src,
1680 One_minus_src,
1681 Src_alpha,
1682 One_minus_src_alpha,
1683 Dst,
1684 One_minus_dst,
1685 Dst_alpha,
1686 One_minus_dst_alpha,
1687 Src_alpha_saturated,
1688 Constant,
1689 One_minus_constant
1690}
1691pub mod GPUBlendFactorValues {
1692
1693 use crate::utils::find_enum_value;
1694 use js::conversions::ConversionResult;
1695 use js::conversions::FromJSValConvertible;
1696 use js::conversions::ToJSValConvertible;
1697 use js::context::RawJSContext;
1698 use js::rust::HandleValue;
1699 use js::rust::MutableHandleValue;
1700 use js::jsval::JSVal;
1701
1702 pub(crate) const pairs: &[(&str, super::GPUBlendFactor)] = &[
1703 ("zero", super::GPUBlendFactor::Zero),
1704 ("one", super::GPUBlendFactor::One),
1705 ("src", super::GPUBlendFactor::Src),
1706 ("one-minus-src", super::GPUBlendFactor::One_minus_src),
1707 ("src-alpha", super::GPUBlendFactor::Src_alpha),
1708 ("one-minus-src-alpha", super::GPUBlendFactor::One_minus_src_alpha),
1709 ("dst", super::GPUBlendFactor::Dst),
1710 ("one-minus-dst", super::GPUBlendFactor::One_minus_dst),
1711 ("dst-alpha", super::GPUBlendFactor::Dst_alpha),
1712 ("one-minus-dst-alpha", super::GPUBlendFactor::One_minus_dst_alpha),
1713 ("src-alpha-saturated", super::GPUBlendFactor::Src_alpha_saturated),
1714 ("constant", super::GPUBlendFactor::Constant),
1715 ("one-minus-constant", super::GPUBlendFactor::One_minus_constant),
1716 ];
1717
1718 impl super::GPUBlendFactor {
1719 pub fn as_str(&self) -> &'static str {
1720 pairs[*self as usize].0
1721 }
1722 }
1723
1724 impl Default for super::GPUBlendFactor {
1725 fn default() -> super::GPUBlendFactor {
1726 pairs[0].1
1727 }
1728 }
1729
1730 impl std::str::FromStr for super::GPUBlendFactor {
1731 type Err = ();
1732
1733 fn from_str(s: &str) -> Result<Self, Self::Err> {
1734 pairs
1735 .iter()
1736 .find(|&&(key, _)| s == key)
1737 .map(|&(_, ev)| ev)
1738 .ok_or(())
1739 }
1740 }
1741
1742 impl ToJSValConvertible for super::GPUBlendFactor {
1743 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
1744 pairs[*self as usize].0.to_jsval(cx, rval);
1745 }
1746 }
1747
1748 impl FromJSValConvertible for super::GPUBlendFactor {
1749 type Config = ();
1750 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
1751 -> Result<ConversionResult<super::GPUBlendFactor>, ()> {
1752 match find_enum_value(cx, value, pairs) {
1753 Err(_) => Err(()),
1754 Ok((None, search)) => {
1755 Ok(ConversionResult::Failure(
1756 format!("'{}' is not a valid enum value for enumeration 'GPUBlendFactor'.", search).into()
1757 ))
1758 }
1759 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
1760 }
1761 }
1762 }
1763 } #[repr(usize)]
1767#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
1768pub enum GPUBlendOperation {
1769 Add,
1770 Subtract,
1771 Reverse_subtract,
1772 Min,
1773 Max
1774}
1775pub mod GPUBlendOperationValues {
1776
1777 use crate::utils::find_enum_value;
1778 use js::conversions::ConversionResult;
1779 use js::conversions::FromJSValConvertible;
1780 use js::conversions::ToJSValConvertible;
1781 use js::context::RawJSContext;
1782 use js::rust::HandleValue;
1783 use js::rust::MutableHandleValue;
1784 use js::jsval::JSVal;
1785
1786 pub(crate) const pairs: &[(&str, super::GPUBlendOperation)] = &[
1787 ("add", super::GPUBlendOperation::Add),
1788 ("subtract", super::GPUBlendOperation::Subtract),
1789 ("reverse-subtract", super::GPUBlendOperation::Reverse_subtract),
1790 ("min", super::GPUBlendOperation::Min),
1791 ("max", super::GPUBlendOperation::Max),
1792 ];
1793
1794 impl super::GPUBlendOperation {
1795 pub fn as_str(&self) -> &'static str {
1796 pairs[*self as usize].0
1797 }
1798 }
1799
1800 impl Default for super::GPUBlendOperation {
1801 fn default() -> super::GPUBlendOperation {
1802 pairs[0].1
1803 }
1804 }
1805
1806 impl std::str::FromStr for super::GPUBlendOperation {
1807 type Err = ();
1808
1809 fn from_str(s: &str) -> Result<Self, Self::Err> {
1810 pairs
1811 .iter()
1812 .find(|&&(key, _)| s == key)
1813 .map(|&(_, ev)| ev)
1814 .ok_or(())
1815 }
1816 }
1817
1818 impl ToJSValConvertible for super::GPUBlendOperation {
1819 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
1820 pairs[*self as usize].0.to_jsval(cx, rval);
1821 }
1822 }
1823
1824 impl FromJSValConvertible for super::GPUBlendOperation {
1825 type Config = ();
1826 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
1827 -> Result<ConversionResult<super::GPUBlendOperation>, ()> {
1828 match find_enum_value(cx, value, pairs) {
1829 Err(_) => Err(()),
1830 Ok((None, search)) => {
1831 Ok(ConversionResult::Failure(
1832 format!("'{}' is not a valid enum value for enumeration 'GPUBlendOperation'.", search).into()
1833 ))
1834 }
1835 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
1836 }
1837 }
1838 }
1839 } #[repr(usize)]
1843#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
1844pub enum GPUStencilOperation {
1845 Keep,
1846 Zero,
1847 Replace,
1848 Invert,
1849 Increment_clamp,
1850 Decrement_clamp,
1851 Increment_wrap,
1852 Decrement_wrap
1853}
1854pub mod GPUStencilOperationValues {
1855
1856 use crate::utils::find_enum_value;
1857 use js::conversions::ConversionResult;
1858 use js::conversions::FromJSValConvertible;
1859 use js::conversions::ToJSValConvertible;
1860 use js::context::RawJSContext;
1861 use js::rust::HandleValue;
1862 use js::rust::MutableHandleValue;
1863 use js::jsval::JSVal;
1864
1865 pub(crate) const pairs: &[(&str, super::GPUStencilOperation)] = &[
1866 ("keep", super::GPUStencilOperation::Keep),
1867 ("zero", super::GPUStencilOperation::Zero),
1868 ("replace", super::GPUStencilOperation::Replace),
1869 ("invert", super::GPUStencilOperation::Invert),
1870 ("increment-clamp", super::GPUStencilOperation::Increment_clamp),
1871 ("decrement-clamp", super::GPUStencilOperation::Decrement_clamp),
1872 ("increment-wrap", super::GPUStencilOperation::Increment_wrap),
1873 ("decrement-wrap", super::GPUStencilOperation::Decrement_wrap),
1874 ];
1875
1876 impl super::GPUStencilOperation {
1877 pub fn as_str(&self) -> &'static str {
1878 pairs[*self as usize].0
1879 }
1880 }
1881
1882 impl Default for super::GPUStencilOperation {
1883 fn default() -> super::GPUStencilOperation {
1884 pairs[0].1
1885 }
1886 }
1887
1888 impl std::str::FromStr for super::GPUStencilOperation {
1889 type Err = ();
1890
1891 fn from_str(s: &str) -> Result<Self, Self::Err> {
1892 pairs
1893 .iter()
1894 .find(|&&(key, _)| s == key)
1895 .map(|&(_, ev)| ev)
1896 .ok_or(())
1897 }
1898 }
1899
1900 impl ToJSValConvertible for super::GPUStencilOperation {
1901 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
1902 pairs[*self as usize].0.to_jsval(cx, rval);
1903 }
1904 }
1905
1906 impl FromJSValConvertible for super::GPUStencilOperation {
1907 type Config = ();
1908 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
1909 -> Result<ConversionResult<super::GPUStencilOperation>, ()> {
1910 match find_enum_value(cx, value, pairs) {
1911 Err(_) => Err(()),
1912 Ok((None, search)) => {
1913 Ok(ConversionResult::Failure(
1914 format!("'{}' is not a valid enum value for enumeration 'GPUStencilOperation'.", search).into()
1915 ))
1916 }
1917 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
1918 }
1919 }
1920 }
1921 } #[repr(usize)]
1925#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
1926pub enum GPUIndexFormat {
1927 Uint16,
1928 Uint32
1929}
1930pub mod GPUIndexFormatValues {
1931
1932 use crate::utils::find_enum_value;
1933 use js::conversions::ConversionResult;
1934 use js::conversions::FromJSValConvertible;
1935 use js::conversions::ToJSValConvertible;
1936 use js::context::RawJSContext;
1937 use js::rust::HandleValue;
1938 use js::rust::MutableHandleValue;
1939 use js::jsval::JSVal;
1940
1941 pub(crate) const pairs: &[(&str, super::GPUIndexFormat)] = &[
1942 ("uint16", super::GPUIndexFormat::Uint16),
1943 ("uint32", super::GPUIndexFormat::Uint32),
1944 ];
1945
1946 impl super::GPUIndexFormat {
1947 pub fn as_str(&self) -> &'static str {
1948 pairs[*self as usize].0
1949 }
1950 }
1951
1952 impl Default for super::GPUIndexFormat {
1953 fn default() -> super::GPUIndexFormat {
1954 pairs[0].1
1955 }
1956 }
1957
1958 impl std::str::FromStr for super::GPUIndexFormat {
1959 type Err = ();
1960
1961 fn from_str(s: &str) -> Result<Self, Self::Err> {
1962 pairs
1963 .iter()
1964 .find(|&&(key, _)| s == key)
1965 .map(|&(_, ev)| ev)
1966 .ok_or(())
1967 }
1968 }
1969
1970 impl ToJSValConvertible for super::GPUIndexFormat {
1971 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
1972 pairs[*self as usize].0.to_jsval(cx, rval);
1973 }
1974 }
1975
1976 impl FromJSValConvertible for super::GPUIndexFormat {
1977 type Config = ();
1978 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
1979 -> Result<ConversionResult<super::GPUIndexFormat>, ()> {
1980 match find_enum_value(cx, value, pairs) {
1981 Err(_) => Err(()),
1982 Ok((None, search)) => {
1983 Ok(ConversionResult::Failure(
1984 format!("'{}' is not a valid enum value for enumeration 'GPUIndexFormat'.", search).into()
1985 ))
1986 }
1987 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
1988 }
1989 }
1990 }
1991 } #[repr(usize)]
1995#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
1996pub enum GPUVertexFormat {
1997 Uint8x2,
1998 Uint8x4,
1999 Sint8x2,
2000 Sint8x4,
2001 Unorm8x2,
2002 Unorm8x4,
2003 Snorm8x2,
2004 Snorm8x4,
2005 Uint16x2,
2006 Uint16x4,
2007 Sint16x2,
2008 Sint16x4,
2009 Unorm16x2,
2010 Unorm16x4,
2011 Snorm16x2,
2012 Snorm16x4,
2013 Float16x2,
2014 Float16x4,
2015 Float32,
2016 Float32x2,
2017 Float32x3,
2018 Float32x4,
2019 Uint32,
2020 Uint32x2,
2021 Uint32x3,
2022 Uint32x4,
2023 Sint32,
2024 Sint32x2,
2025 Sint32x3,
2026 Sint32x4
2027}
2028pub mod GPUVertexFormatValues {
2029
2030 use crate::utils::find_enum_value;
2031 use js::conversions::ConversionResult;
2032 use js::conversions::FromJSValConvertible;
2033 use js::conversions::ToJSValConvertible;
2034 use js::context::RawJSContext;
2035 use js::rust::HandleValue;
2036 use js::rust::MutableHandleValue;
2037 use js::jsval::JSVal;
2038
2039 pub(crate) const pairs: &[(&str, super::GPUVertexFormat)] = &[
2040 ("uint8x2", super::GPUVertexFormat::Uint8x2),
2041 ("uint8x4", super::GPUVertexFormat::Uint8x4),
2042 ("sint8x2", super::GPUVertexFormat::Sint8x2),
2043 ("sint8x4", super::GPUVertexFormat::Sint8x4),
2044 ("unorm8x2", super::GPUVertexFormat::Unorm8x2),
2045 ("unorm8x4", super::GPUVertexFormat::Unorm8x4),
2046 ("snorm8x2", super::GPUVertexFormat::Snorm8x2),
2047 ("snorm8x4", super::GPUVertexFormat::Snorm8x4),
2048 ("uint16x2", super::GPUVertexFormat::Uint16x2),
2049 ("uint16x4", super::GPUVertexFormat::Uint16x4),
2050 ("sint16x2", super::GPUVertexFormat::Sint16x2),
2051 ("sint16x4", super::GPUVertexFormat::Sint16x4),
2052 ("unorm16x2", super::GPUVertexFormat::Unorm16x2),
2053 ("unorm16x4", super::GPUVertexFormat::Unorm16x4),
2054 ("snorm16x2", super::GPUVertexFormat::Snorm16x2),
2055 ("snorm16x4", super::GPUVertexFormat::Snorm16x4),
2056 ("float16x2", super::GPUVertexFormat::Float16x2),
2057 ("float16x4", super::GPUVertexFormat::Float16x4),
2058 ("float32", super::GPUVertexFormat::Float32),
2059 ("float32x2", super::GPUVertexFormat::Float32x2),
2060 ("float32x3", super::GPUVertexFormat::Float32x3),
2061 ("float32x4", super::GPUVertexFormat::Float32x4),
2062 ("uint32", super::GPUVertexFormat::Uint32),
2063 ("uint32x2", super::GPUVertexFormat::Uint32x2),
2064 ("uint32x3", super::GPUVertexFormat::Uint32x3),
2065 ("uint32x4", super::GPUVertexFormat::Uint32x4),
2066 ("sint32", super::GPUVertexFormat::Sint32),
2067 ("sint32x2", super::GPUVertexFormat::Sint32x2),
2068 ("sint32x3", super::GPUVertexFormat::Sint32x3),
2069 ("sint32x4", super::GPUVertexFormat::Sint32x4),
2070 ];
2071
2072 impl super::GPUVertexFormat {
2073 pub fn as_str(&self) -> &'static str {
2074 pairs[*self as usize].0
2075 }
2076 }
2077
2078 impl Default for super::GPUVertexFormat {
2079 fn default() -> super::GPUVertexFormat {
2080 pairs[0].1
2081 }
2082 }
2083
2084 impl std::str::FromStr for super::GPUVertexFormat {
2085 type Err = ();
2086
2087 fn from_str(s: &str) -> Result<Self, Self::Err> {
2088 pairs
2089 .iter()
2090 .find(|&&(key, _)| s == key)
2091 .map(|&(_, ev)| ev)
2092 .ok_or(())
2093 }
2094 }
2095
2096 impl ToJSValConvertible for super::GPUVertexFormat {
2097 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
2098 pairs[*self as usize].0.to_jsval(cx, rval);
2099 }
2100 }
2101
2102 impl FromJSValConvertible for super::GPUVertexFormat {
2103 type Config = ();
2104 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
2105 -> Result<ConversionResult<super::GPUVertexFormat>, ()> {
2106 match find_enum_value(cx, value, pairs) {
2107 Err(_) => Err(()),
2108 Ok((None, search)) => {
2109 Ok(ConversionResult::Failure(
2110 format!("'{}' is not a valid enum value for enumeration 'GPUVertexFormat'.", search).into()
2111 ))
2112 }
2113 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
2114 }
2115 }
2116 }
2117 } #[repr(usize)]
2121#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
2122pub enum GPUVertexStepMode {
2123 Vertex,
2124 Instance
2125}
2126pub mod GPUVertexStepModeValues {
2127
2128 use crate::utils::find_enum_value;
2129 use js::conversions::ConversionResult;
2130 use js::conversions::FromJSValConvertible;
2131 use js::conversions::ToJSValConvertible;
2132 use js::context::RawJSContext;
2133 use js::rust::HandleValue;
2134 use js::rust::MutableHandleValue;
2135 use js::jsval::JSVal;
2136
2137 pub(crate) const pairs: &[(&str, super::GPUVertexStepMode)] = &[
2138 ("vertex", super::GPUVertexStepMode::Vertex),
2139 ("instance", super::GPUVertexStepMode::Instance),
2140 ];
2141
2142 impl super::GPUVertexStepMode {
2143 pub fn as_str(&self) -> &'static str {
2144 pairs[*self as usize].0
2145 }
2146 }
2147
2148 impl Default for super::GPUVertexStepMode {
2149 fn default() -> super::GPUVertexStepMode {
2150 pairs[0].1
2151 }
2152 }
2153
2154 impl std::str::FromStr for super::GPUVertexStepMode {
2155 type Err = ();
2156
2157 fn from_str(s: &str) -> Result<Self, Self::Err> {
2158 pairs
2159 .iter()
2160 .find(|&&(key, _)| s == key)
2161 .map(|&(_, ev)| ev)
2162 .ok_or(())
2163 }
2164 }
2165
2166 impl ToJSValConvertible for super::GPUVertexStepMode {
2167 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
2168 pairs[*self as usize].0.to_jsval(cx, rval);
2169 }
2170 }
2171
2172 impl FromJSValConvertible for super::GPUVertexStepMode {
2173 type Config = ();
2174 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
2175 -> Result<ConversionResult<super::GPUVertexStepMode>, ()> {
2176 match find_enum_value(cx, value, pairs) {
2177 Err(_) => Err(()),
2178 Ok((None, search)) => {
2179 Ok(ConversionResult::Failure(
2180 format!("'{}' is not a valid enum value for enumeration 'GPUVertexStepMode'.", search).into()
2181 ))
2182 }
2183 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
2184 }
2185 }
2186 }
2187 } #[repr(usize)]
2191#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
2192pub enum GPULoadOp {
2193 Load,
2194 Clear
2195}
2196pub mod GPULoadOpValues {
2197
2198 use crate::utils::find_enum_value;
2199 use js::conversions::ConversionResult;
2200 use js::conversions::FromJSValConvertible;
2201 use js::conversions::ToJSValConvertible;
2202 use js::context::RawJSContext;
2203 use js::rust::HandleValue;
2204 use js::rust::MutableHandleValue;
2205 use js::jsval::JSVal;
2206
2207 pub(crate) const pairs: &[(&str, super::GPULoadOp)] = &[
2208 ("load", super::GPULoadOp::Load),
2209 ("clear", super::GPULoadOp::Clear),
2210 ];
2211
2212 impl super::GPULoadOp {
2213 pub fn as_str(&self) -> &'static str {
2214 pairs[*self as usize].0
2215 }
2216 }
2217
2218 impl Default for super::GPULoadOp {
2219 fn default() -> super::GPULoadOp {
2220 pairs[0].1
2221 }
2222 }
2223
2224 impl std::str::FromStr for super::GPULoadOp {
2225 type Err = ();
2226
2227 fn from_str(s: &str) -> Result<Self, Self::Err> {
2228 pairs
2229 .iter()
2230 .find(|&&(key, _)| s == key)
2231 .map(|&(_, ev)| ev)
2232 .ok_or(())
2233 }
2234 }
2235
2236 impl ToJSValConvertible for super::GPULoadOp {
2237 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
2238 pairs[*self as usize].0.to_jsval(cx, rval);
2239 }
2240 }
2241
2242 impl FromJSValConvertible for super::GPULoadOp {
2243 type Config = ();
2244 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
2245 -> Result<ConversionResult<super::GPULoadOp>, ()> {
2246 match find_enum_value(cx, value, pairs) {
2247 Err(_) => Err(()),
2248 Ok((None, search)) => {
2249 Ok(ConversionResult::Failure(
2250 format!("'{}' is not a valid enum value for enumeration 'GPULoadOp'.", search).into()
2251 ))
2252 }
2253 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
2254 }
2255 }
2256 }
2257 } #[repr(usize)]
2261#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
2262pub enum GPUStoreOp {
2263 Store,
2264 Discard
2265}
2266pub mod GPUStoreOpValues {
2267
2268 use crate::utils::find_enum_value;
2269 use js::conversions::ConversionResult;
2270 use js::conversions::FromJSValConvertible;
2271 use js::conversions::ToJSValConvertible;
2272 use js::context::RawJSContext;
2273 use js::rust::HandleValue;
2274 use js::rust::MutableHandleValue;
2275 use js::jsval::JSVal;
2276
2277 pub(crate) const pairs: &[(&str, super::GPUStoreOp)] = &[
2278 ("store", super::GPUStoreOp::Store),
2279 ("discard", super::GPUStoreOp::Discard),
2280 ];
2281
2282 impl super::GPUStoreOp {
2283 pub fn as_str(&self) -> &'static str {
2284 pairs[*self as usize].0
2285 }
2286 }
2287
2288 impl Default for super::GPUStoreOp {
2289 fn default() -> super::GPUStoreOp {
2290 pairs[0].1
2291 }
2292 }
2293
2294 impl std::str::FromStr for super::GPUStoreOp {
2295 type Err = ();
2296
2297 fn from_str(s: &str) -> Result<Self, Self::Err> {
2298 pairs
2299 .iter()
2300 .find(|&&(key, _)| s == key)
2301 .map(|&(_, ev)| ev)
2302 .ok_or(())
2303 }
2304 }
2305
2306 impl ToJSValConvertible for super::GPUStoreOp {
2307 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
2308 pairs[*self as usize].0.to_jsval(cx, rval);
2309 }
2310 }
2311
2312 impl FromJSValConvertible for super::GPUStoreOp {
2313 type Config = ();
2314 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
2315 -> Result<ConversionResult<super::GPUStoreOp>, ()> {
2316 match find_enum_value(cx, value, pairs) {
2317 Err(_) => Err(()),
2318 Ok((None, search)) => {
2319 Ok(ConversionResult::Failure(
2320 format!("'{}' is not a valid enum value for enumeration 'GPUStoreOp'.", search).into()
2321 ))
2322 }
2323 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
2324 }
2325 }
2326 }
2327 } #[repr(usize)]
2331#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
2332pub enum GPUPipelineStatisticName {
2333 Vertex_shader_invocations,
2334 Clipper_invocations,
2335 Clipper_primitives_out,
2336 Fragment_shader_invocations,
2337 Compute_shader_invocations
2338}
2339pub mod GPUPipelineStatisticNameValues {
2340
2341 use crate::utils::find_enum_value;
2342 use js::conversions::ConversionResult;
2343 use js::conversions::FromJSValConvertible;
2344 use js::conversions::ToJSValConvertible;
2345 use js::context::RawJSContext;
2346 use js::rust::HandleValue;
2347 use js::rust::MutableHandleValue;
2348 use js::jsval::JSVal;
2349
2350 pub(crate) const pairs: &[(&str, super::GPUPipelineStatisticName)] = &[
2351 ("vertex-shader-invocations", super::GPUPipelineStatisticName::Vertex_shader_invocations),
2352 ("clipper-invocations", super::GPUPipelineStatisticName::Clipper_invocations),
2353 ("clipper-primitives-out", super::GPUPipelineStatisticName::Clipper_primitives_out),
2354 ("fragment-shader-invocations", super::GPUPipelineStatisticName::Fragment_shader_invocations),
2355 ("compute-shader-invocations", super::GPUPipelineStatisticName::Compute_shader_invocations),
2356 ];
2357
2358 impl super::GPUPipelineStatisticName {
2359 pub fn as_str(&self) -> &'static str {
2360 pairs[*self as usize].0
2361 }
2362 }
2363
2364 impl Default for super::GPUPipelineStatisticName {
2365 fn default() -> super::GPUPipelineStatisticName {
2366 pairs[0].1
2367 }
2368 }
2369
2370 impl std::str::FromStr for super::GPUPipelineStatisticName {
2371 type Err = ();
2372
2373 fn from_str(s: &str) -> Result<Self, Self::Err> {
2374 pairs
2375 .iter()
2376 .find(|&&(key, _)| s == key)
2377 .map(|&(_, ev)| ev)
2378 .ok_or(())
2379 }
2380 }
2381
2382 impl ToJSValConvertible for super::GPUPipelineStatisticName {
2383 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
2384 pairs[*self as usize].0.to_jsval(cx, rval);
2385 }
2386 }
2387
2388 impl FromJSValConvertible for super::GPUPipelineStatisticName {
2389 type Config = ();
2390 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
2391 -> Result<ConversionResult<super::GPUPipelineStatisticName>, ()> {
2392 match find_enum_value(cx, value, pairs) {
2393 Err(_) => Err(()),
2394 Ok((None, search)) => {
2395 Ok(ConversionResult::Failure(
2396 format!("'{}' is not a valid enum value for enumeration 'GPUPipelineStatisticName'.", search).into()
2397 ))
2398 }
2399 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
2400 }
2401 }
2402 }
2403 } #[repr(usize)]
2407#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
2408pub enum GPUQueryType {
2409 Occlusion,
2410 Pipeline_statistics,
2411 Timestamp
2412}
2413pub mod GPUQueryTypeValues {
2414
2415 use crate::utils::find_enum_value;
2416 use js::conversions::ConversionResult;
2417 use js::conversions::FromJSValConvertible;
2418 use js::conversions::ToJSValConvertible;
2419 use js::context::RawJSContext;
2420 use js::rust::HandleValue;
2421 use js::rust::MutableHandleValue;
2422 use js::jsval::JSVal;
2423
2424 pub(crate) const pairs: &[(&str, super::GPUQueryType)] = &[
2425 ("occlusion", super::GPUQueryType::Occlusion),
2426 ("pipeline-statistics", super::GPUQueryType::Pipeline_statistics),
2427 ("timestamp", super::GPUQueryType::Timestamp),
2428 ];
2429
2430 impl super::GPUQueryType {
2431 pub fn as_str(&self) -> &'static str {
2432 pairs[*self as usize].0
2433 }
2434 }
2435
2436 impl Default for super::GPUQueryType {
2437 fn default() -> super::GPUQueryType {
2438 pairs[0].1
2439 }
2440 }
2441
2442 impl std::str::FromStr for super::GPUQueryType {
2443 type Err = ();
2444
2445 fn from_str(s: &str) -> Result<Self, Self::Err> {
2446 pairs
2447 .iter()
2448 .find(|&&(key, _)| s == key)
2449 .map(|&(_, ev)| ev)
2450 .ok_or(())
2451 }
2452 }
2453
2454 impl ToJSValConvertible for super::GPUQueryType {
2455 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
2456 pairs[*self as usize].0.to_jsval(cx, rval);
2457 }
2458 }
2459
2460 impl FromJSValConvertible for super::GPUQueryType {
2461 type Config = ();
2462 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
2463 -> Result<ConversionResult<super::GPUQueryType>, ()> {
2464 match find_enum_value(cx, value, pairs) {
2465 Err(_) => Err(()),
2466 Ok((None, search)) => {
2467 Ok(ConversionResult::Failure(
2468 format!("'{}' is not a valid enum value for enumeration 'GPUQueryType'.", search).into()
2469 ))
2470 }
2471 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
2472 }
2473 }
2474 }
2475 } #[repr(usize)]
2479#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
2480pub enum GPUCanvasAlphaMode {
2481 Opaque,
2482 Premultiplied
2483}
2484pub mod GPUCanvasAlphaModeValues {
2485
2486 use crate::utils::find_enum_value;
2487 use js::conversions::ConversionResult;
2488 use js::conversions::FromJSValConvertible;
2489 use js::conversions::ToJSValConvertible;
2490 use js::context::RawJSContext;
2491 use js::rust::HandleValue;
2492 use js::rust::MutableHandleValue;
2493 use js::jsval::JSVal;
2494
2495 pub(crate) const pairs: &[(&str, super::GPUCanvasAlphaMode)] = &[
2496 ("opaque", super::GPUCanvasAlphaMode::Opaque),
2497 ("premultiplied", super::GPUCanvasAlphaMode::Premultiplied),
2498 ];
2499
2500 impl super::GPUCanvasAlphaMode {
2501 pub fn as_str(&self) -> &'static str {
2502 pairs[*self as usize].0
2503 }
2504 }
2505
2506 impl Default for super::GPUCanvasAlphaMode {
2507 fn default() -> super::GPUCanvasAlphaMode {
2508 pairs[0].1
2509 }
2510 }
2511
2512 impl std::str::FromStr for super::GPUCanvasAlphaMode {
2513 type Err = ();
2514
2515 fn from_str(s: &str) -> Result<Self, Self::Err> {
2516 pairs
2517 .iter()
2518 .find(|&&(key, _)| s == key)
2519 .map(|&(_, ev)| ev)
2520 .ok_or(())
2521 }
2522 }
2523
2524 impl ToJSValConvertible for super::GPUCanvasAlphaMode {
2525 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
2526 pairs[*self as usize].0.to_jsval(cx, rval);
2527 }
2528 }
2529
2530 impl FromJSValConvertible for super::GPUCanvasAlphaMode {
2531 type Config = ();
2532 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
2533 -> Result<ConversionResult<super::GPUCanvasAlphaMode>, ()> {
2534 match find_enum_value(cx, value, pairs) {
2535 Err(_) => Err(()),
2536 Ok((None, search)) => {
2537 Ok(ConversionResult::Failure(
2538 format!("'{}' is not a valid enum value for enumeration 'GPUCanvasAlphaMode'.", search).into()
2539 ))
2540 }
2541 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
2542 }
2543 }
2544 }
2545 } #[repr(usize)]
2549#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
2550pub enum GPUDeviceLostReason {
2551 Unknown,
2552 Destroyed
2553}
2554pub mod GPUDeviceLostReasonValues {
2555
2556 use crate::utils::find_enum_value;
2557 use js::conversions::ConversionResult;
2558 use js::conversions::FromJSValConvertible;
2559 use js::conversions::ToJSValConvertible;
2560 use js::context::RawJSContext;
2561 use js::rust::HandleValue;
2562 use js::rust::MutableHandleValue;
2563 use js::jsval::JSVal;
2564
2565 pub(crate) const pairs: &[(&str, super::GPUDeviceLostReason)] = &[
2566 ("unknown", super::GPUDeviceLostReason::Unknown),
2567 ("destroyed", super::GPUDeviceLostReason::Destroyed),
2568 ];
2569
2570 impl super::GPUDeviceLostReason {
2571 pub fn as_str(&self) -> &'static str {
2572 pairs[*self as usize].0
2573 }
2574 }
2575
2576 impl Default for super::GPUDeviceLostReason {
2577 fn default() -> super::GPUDeviceLostReason {
2578 pairs[0].1
2579 }
2580 }
2581
2582 impl std::str::FromStr for super::GPUDeviceLostReason {
2583 type Err = ();
2584
2585 fn from_str(s: &str) -> Result<Self, Self::Err> {
2586 pairs
2587 .iter()
2588 .find(|&&(key, _)| s == key)
2589 .map(|&(_, ev)| ev)
2590 .ok_or(())
2591 }
2592 }
2593
2594 impl ToJSValConvertible for super::GPUDeviceLostReason {
2595 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
2596 pairs[*self as usize].0.to_jsval(cx, rval);
2597 }
2598 }
2599
2600 impl FromJSValConvertible for super::GPUDeviceLostReason {
2601 type Config = ();
2602 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
2603 -> Result<ConversionResult<super::GPUDeviceLostReason>, ()> {
2604 match find_enum_value(cx, value, pairs) {
2605 Err(_) => Err(()),
2606 Ok((None, search)) => {
2607 Ok(ConversionResult::Failure(
2608 format!("'{}' is not a valid enum value for enumeration 'GPUDeviceLostReason'.", search).into()
2609 ))
2610 }
2611 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
2612 }
2613 }
2614 }
2615 } #[repr(usize)]
2619#[derive(Copy, Clone, Debug, JSTraceable, MallocSizeOf, PartialEq)]
2620pub enum GPUErrorFilter {
2621 Validation,
2622 Out_of_memory,
2623 Internal
2624}
2625pub mod GPUErrorFilterValues {
2626
2627 use crate::utils::find_enum_value;
2628 use js::conversions::ConversionResult;
2629 use js::conversions::FromJSValConvertible;
2630 use js::conversions::ToJSValConvertible;
2631 use js::context::RawJSContext;
2632 use js::rust::HandleValue;
2633 use js::rust::MutableHandleValue;
2634 use js::jsval::JSVal;
2635
2636 pub(crate) const pairs: &[(&str, super::GPUErrorFilter)] = &[
2637 ("validation", super::GPUErrorFilter::Validation),
2638 ("out-of-memory", super::GPUErrorFilter::Out_of_memory),
2639 ("internal", super::GPUErrorFilter::Internal),
2640 ];
2641
2642 impl super::GPUErrorFilter {
2643 pub fn as_str(&self) -> &'static str {
2644 pairs[*self as usize].0
2645 }
2646 }
2647
2648 impl Default for super::GPUErrorFilter {
2649 fn default() -> super::GPUErrorFilter {
2650 pairs[0].1
2651 }
2652 }
2653
2654 impl std::str::FromStr for super::GPUErrorFilter {
2655 type Err = ();
2656
2657 fn from_str(s: &str) -> Result<Self, Self::Err> {
2658 pairs
2659 .iter()
2660 .find(|&&(key, _)| s == key)
2661 .map(|&(_, ev)| ev)
2662 .ok_or(())
2663 }
2664 }
2665
2666 impl ToJSValConvertible for super::GPUErrorFilter {
2667 unsafe fn to_jsval(&self, cx: *mut RawJSContext, rval: MutableHandleValue) {
2668 pairs[*self as usize].0.to_jsval(cx, rval);
2669 }
2670 }
2671
2672 impl FromJSValConvertible for super::GPUErrorFilter {
2673 type Config = ();
2674 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
2675 -> Result<ConversionResult<super::GPUErrorFilter>, ()> {
2676 match find_enum_value(cx, value, pairs) {
2677 Err(_) => Err(()),
2678 Ok((None, search)) => {
2679 Ok(ConversionResult::Failure(
2680 format!("'{}' is not a valid enum value for enumeration 'GPUErrorFilter'.", search).into()
2681 ))
2682 }
2683 Ok((Some(&value), _)) => Ok(ConversionResult::Success(value)),
2684 }
2685 }
2686 }
2687 } pub type GPUBufferUsageFlags = u32;
2690
2691pub type GPUMapModeFlags = u32;
2692
2693pub type GPUTextureUsageFlags = u32;
2694
2695pub type GPUShaderStageFlags = u32;
2696
2697pub use self::GenericUnionTypes::GPUSamplerOrGPUTextureViewOrGPUBufferBinding as GPUBindingResource;
2698
2699pub type GPUPipelineConstantValue = Finite<f64>;
2700
2701pub type GPUColorWriteFlags = u32;
2702
2703pub type GPUBufferDynamicOffset = u32;
2704
2705pub type GPUStencilValue = u32;
2706
2707pub type GPUSampleMask = u32;
2708
2709pub type GPUDepthBias = i32;
2710
2711pub type GPUSize64 = u64;
2712
2713pub type GPUIntegerCoordinate = u32;
2714
2715pub type GPUIndex32 = u32;
2716
2717pub type GPUSize32 = u32;
2718
2719pub type GPUSignedOffset32 = i32;
2720
2721pub type GPUSize64Out = u64;
2722
2723pub type GPUIntegerCoordinateOut = u32;
2724
2725pub type GPUSize32Out = u32;
2726
2727pub type GPUFlagsConstant = u32;
2728
2729pub use self::GenericUnionTypes::DoubleSequenceOrGPUColorDict as GPUColor;
2730
2731pub use self::GenericUnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUOrigin2DDict as GPUOrigin2D;
2732
2733pub use self::GenericUnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUOrigin3DDict as GPUOrigin3D;
2734
2735pub use self::GenericUnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict as GPUExtent3D;
2736
2737#[derive(JSTraceable, MallocSizeOf)]
2738pub struct GPUObjectDescriptorBase {
2739 pub label: USVString,
2740}
2741impl Default for GPUObjectDescriptorBase {
2742 fn default() -> Self {
2743 Self::empty()
2744 }
2745}
2746
2747impl GPUObjectDescriptorBase {
2748 pub fn empty() -> Self {
2749 Self {
2750 label: USVString("".to_owned()),
2751 }
2752 }
2753 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
2754 -> Result<ConversionResult<GPUObjectDescriptorBase>, ()> {
2755 unsafe {
2756 let object = if val.get().is_null_or_undefined() {
2757 ptr::null_mut()
2758 } else if val.get().is_object() {
2759 val.get().to_object()
2760 } else {
2761 return Ok(ConversionResult::Failure("Value is not an object.".into()));
2762 };
2763 rooted!(&in(cx) let object = object);
2764 let dictionary = GPUObjectDescriptorBase {
2765 label: {
2766 rooted!(&in(cx) let mut rval = UndefinedValue());
2767 if get_dictionary_property(cx.raw_cx(), object.handle(), "label", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
2768 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
2769 Ok(ConversionResult::Success(value)) => value,
2770 Ok(ConversionResult::Failure(error)) => {
2771 throw_type_error(cx.raw_cx(), &error);
2772 return Err(());
2773
2774 }
2775 _ => {
2776 return Err(());
2777
2778 },
2779 }
2780
2781 } else {
2782 USVString("".to_owned())
2783 }
2784 },
2785 };
2786 Ok(ConversionResult::Success(dictionary))
2787 }
2788 }
2789}
2790
2791impl FromJSValConvertible for GPUObjectDescriptorBase {
2792 type Config = ();
2793 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
2794 -> Result<ConversionResult<GPUObjectDescriptorBase>, ()> {
2795 GPUObjectDescriptorBase::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
2796 }
2797}
2798
2799impl GPUObjectDescriptorBase {
2800 #[allow(clippy::wrong_self_convention)]
2801 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
2802 let label = &self.label;
2803 rooted!(in(cx) let mut label_js = UndefinedValue());
2804 label.to_jsval(cx, label_js.handle_mut());
2805 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "label", label_js.handle()).unwrap();
2806 }
2807}
2808
2809impl ToJSValConvertible for GPUObjectDescriptorBase {
2810 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
2811 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
2812 self.to_jsobject(cx, obj.handle_mut());
2813 rval.set(ObjectOrNullValue(obj.get()))
2814 }
2815}
2816
2817
2818#[derive(JSTraceable)]
2819pub struct GPURequestAdapterOptions {
2820 pub forceFallbackAdapter: bool,
2821 pub powerPreference: Option<GPUPowerPreference>,
2822}
2823impl Default for GPURequestAdapterOptions {
2824 fn default() -> Self {
2825 Self::empty()
2826 }
2827}
2828
2829impl GPURequestAdapterOptions {
2830 pub fn empty() -> Self {
2831 Self {
2832 forceFallbackAdapter: false,
2833 powerPreference: None,
2834 }
2835 }
2836 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
2837 -> Result<ConversionResult<GPURequestAdapterOptions>, ()> {
2838 unsafe {
2839 let object = if val.get().is_null_or_undefined() {
2840 ptr::null_mut()
2841 } else if val.get().is_object() {
2842 val.get().to_object()
2843 } else {
2844 return Ok(ConversionResult::Failure("Value is not an object.".into()));
2845 };
2846 rooted!(&in(cx) let object = object);
2847 let dictionary = GPURequestAdapterOptions {
2848 forceFallbackAdapter: {
2849 rooted!(&in(cx) let mut rval = UndefinedValue());
2850 if get_dictionary_property(cx.raw_cx(), object.handle(), "forceFallbackAdapter", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
2851 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
2852 Ok(ConversionResult::Success(value)) => value,
2853 Ok(ConversionResult::Failure(error)) => {
2854 throw_type_error(cx.raw_cx(), &error);
2855 return Err(());
2856
2857 }
2858 _ => {
2859 return Err(());
2860
2861 },
2862 }
2863
2864 } else {
2865 false
2866 }
2867 },
2868 powerPreference: {
2869 rooted!(&in(cx) let mut rval = UndefinedValue());
2870 if get_dictionary_property(cx.raw_cx(), object.handle(), "powerPreference", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
2871 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
2872 Ok(ConversionResult::Success(value)) => value,
2873 Ok(ConversionResult::Failure(error)) => {
2874 throw_type_error(cx.raw_cx(), &error); return Err(());
2875
2876 }
2877 _ => {
2878 return Err(());
2879
2880 },
2881 }
2882 )
2883 } else {
2884 None
2885 }
2886 },
2887 };
2888 Ok(ConversionResult::Success(dictionary))
2889 }
2890 }
2891}
2892
2893impl FromJSValConvertible for GPURequestAdapterOptions {
2894 type Config = ();
2895 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
2896 -> Result<ConversionResult<GPURequestAdapterOptions>, ()> {
2897 GPURequestAdapterOptions::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
2898 }
2899}
2900
2901impl GPURequestAdapterOptions {
2902 #[allow(clippy::wrong_self_convention)]
2903 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
2904 let forceFallbackAdapter = &self.forceFallbackAdapter;
2905 rooted!(in(cx) let mut forceFallbackAdapter_js = UndefinedValue());
2906 forceFallbackAdapter.to_jsval(cx, forceFallbackAdapter_js.handle_mut());
2907 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "forceFallbackAdapter", forceFallbackAdapter_js.handle()).unwrap();
2908 if let Some(ref powerPreference) = self.powerPreference {
2909 rooted!(in(cx) let mut powerPreference_js = UndefinedValue());
2910 powerPreference.to_jsval(cx, powerPreference_js.handle_mut());
2911 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "powerPreference", powerPreference_js.handle()).unwrap();
2912 }
2913 }
2914}
2915
2916impl ToJSValConvertible for GPURequestAdapterOptions {
2917 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
2918 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
2919 self.to_jsobject(cx, obj.handle_mut());
2920 rval.set(ObjectOrNullValue(obj.get()))
2921 }
2922}
2923
2924
2925#[derive(JSTraceable)]
2926pub struct GPUDeviceDescriptor {
2927 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase,
2928 pub requiredFeatures: Vec<GPUFeatureName>,
2929 pub requiredLimits: Option<Record<DOMString, u64>>,
2930}
2931impl Default for GPUDeviceDescriptor {
2932 fn default() -> Self {
2933 Self::empty()
2934 }
2935}
2936
2937impl GPUDeviceDescriptor {
2938 pub fn empty() -> Self {
2939 Self {
2940 parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::empty(),
2941 requiredFeatures: Vec::new(),
2942 requiredLimits: None,
2943 }
2944 }
2945 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
2946 -> Result<ConversionResult<GPUDeviceDescriptor>, ()> {
2947 unsafe {
2948 let object = if val.get().is_null_or_undefined() {
2949 ptr::null_mut()
2950 } else if val.get().is_object() {
2951 val.get().to_object()
2952 } else {
2953 return Ok(ConversionResult::Failure("Value is not an object.".into()));
2954 };
2955 rooted!(&in(cx) let object = object);
2956 let dictionary = GPUDeviceDescriptor {
2957 parent: {
2958 match crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val, can_gc)? {
2959 ConversionResult::Success(v) => v,
2960 ConversionResult::Failure(error) => {
2961 throw_type_error(cx.raw_cx(), &error);
2962 return Err(());
2963 }
2964 }
2965 },
2966 requiredFeatures: {
2967 rooted!(&in(cx) let mut rval = UndefinedValue());
2968 if get_dictionary_property(cx.raw_cx(), object.handle(), "requiredFeatures", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
2969 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
2970 Ok(ConversionResult::Success(value)) => value,
2971 Ok(ConversionResult::Failure(error)) => {
2972 throw_type_error(cx.raw_cx(), &error);
2973 return Err(());
2974
2975 }
2976 _ => {
2977 return Err(());
2978
2979 },
2980 }
2981
2982 } else {
2983 Vec::new()
2984 }
2985 },
2986 requiredLimits: {
2987 rooted!(&in(cx) let mut rval = UndefinedValue());
2988 if get_dictionary_property(cx.raw_cx(), object.handle(), "requiredLimits", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
2989 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
2990 Ok(ConversionResult::Success(value)) => value,
2991 Ok(ConversionResult::Failure(error)) => {
2992 throw_type_error(cx.raw_cx(), &error);
2993 return Err(());
2994
2995 }
2996 _ => {
2997 return Err(());
2998
2999 },
3000 }
3001 )
3002 } else {
3003 None
3004 }
3005 },
3006 };
3007 Ok(ConversionResult::Success(dictionary))
3008 }
3009 }
3010}
3011
3012impl FromJSValConvertible for GPUDeviceDescriptor {
3013 type Config = ();
3014 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
3015 -> Result<ConversionResult<GPUDeviceDescriptor>, ()> {
3016 GPUDeviceDescriptor::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
3017 }
3018}
3019
3020impl GPUDeviceDescriptor {
3021 #[allow(clippy::wrong_self_convention)]
3022 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
3023 self.parent.to_jsobject(cx, obj.reborrow());
3024 let requiredFeatures = &self.requiredFeatures;
3025 rooted!(in(cx) let mut requiredFeatures_js = UndefinedValue());
3026 requiredFeatures.to_jsval(cx, requiredFeatures_js.handle_mut());
3027 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "requiredFeatures", requiredFeatures_js.handle()).unwrap();
3028 if let Some(ref requiredLimits) = self.requiredLimits {
3029 rooted!(in(cx) let mut requiredLimits_js = UndefinedValue());
3030 requiredLimits.to_jsval(cx, requiredLimits_js.handle_mut());
3031 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "requiredLimits", requiredLimits_js.handle()).unwrap();
3032 }
3033 }
3034}
3035
3036impl ToJSValConvertible for GPUDeviceDescriptor {
3037 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
3038 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
3039 self.to_jsobject(cx, obj.handle_mut());
3040 rval.set(ObjectOrNullValue(obj.get()))
3041 }
3042}
3043
3044
3045#[derive(JSTraceable)]
3046pub struct GPUBufferDescriptor {
3047 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase,
3048 pub mappedAtCreation: bool,
3049 pub size: u64,
3050 pub usage: u32,
3051}
3052
3053impl GPUBufferDescriptor {
3054
3055 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
3056 -> Result<ConversionResult<GPUBufferDescriptor>, ()> {
3057 unsafe {
3058 let object = if val.get().is_null_or_undefined() {
3059 ptr::null_mut()
3060 } else if val.get().is_object() {
3061 val.get().to_object()
3062 } else {
3063 return Ok(ConversionResult::Failure("Value is not an object.".into()));
3064 };
3065 rooted!(&in(cx) let object = object);
3066 let dictionary = GPUBufferDescriptor {
3067 parent: {
3068 match crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val, can_gc)? {
3069 ConversionResult::Success(v) => v,
3070 ConversionResult::Failure(error) => {
3071 throw_type_error(cx.raw_cx(), &error);
3072 return Err(());
3073 }
3074 }
3075 },
3076 mappedAtCreation: {
3077 rooted!(&in(cx) let mut rval = UndefinedValue());
3078 if get_dictionary_property(cx.raw_cx(), object.handle(), "mappedAtCreation", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3079 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
3080 Ok(ConversionResult::Success(value)) => value,
3081 Ok(ConversionResult::Failure(error)) => {
3082 throw_type_error(cx.raw_cx(), &error);
3083 return Err(());
3084
3085 }
3086 _ => {
3087 return Err(());
3088
3089 },
3090 }
3091
3092 } else {
3093 false
3094 }
3095 },
3096 size: {
3097 rooted!(&in(cx) let mut rval = UndefinedValue());
3098 if get_dictionary_property(cx.raw_cx(), object.handle(), "size", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3099 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
3100 Ok(ConversionResult::Success(value)) => value,
3101 Ok(ConversionResult::Failure(error)) => {
3102 throw_type_error(cx.raw_cx(), &error);
3103 return Err(());
3104
3105 }
3106 _ => {
3107 return Err(());
3108
3109 },
3110 }
3111
3112 } else {
3113 throw_type_error(cx.raw_cx(), "Missing required member \"size\".");
3114 return Err(());
3115 }
3116 },
3117 usage: {
3118 rooted!(&in(cx) let mut rval = UndefinedValue());
3119 if get_dictionary_property(cx.raw_cx(), object.handle(), "usage", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3120 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
3121 Ok(ConversionResult::Success(value)) => value,
3122 Ok(ConversionResult::Failure(error)) => {
3123 throw_type_error(cx.raw_cx(), &error);
3124 return Err(());
3125
3126 }
3127 _ => {
3128 return Err(());
3129
3130 },
3131 }
3132
3133 } else {
3134 throw_type_error(cx.raw_cx(), "Missing required member \"usage\".");
3135 return Err(());
3136 }
3137 },
3138 };
3139 Ok(ConversionResult::Success(dictionary))
3140 }
3141 }
3142}
3143
3144impl FromJSValConvertible for GPUBufferDescriptor {
3145 type Config = ();
3146 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
3147 -> Result<ConversionResult<GPUBufferDescriptor>, ()> {
3148 GPUBufferDescriptor::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
3149 }
3150}
3151
3152impl GPUBufferDescriptor {
3153 #[allow(clippy::wrong_self_convention)]
3154 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
3155 self.parent.to_jsobject(cx, obj.reborrow());
3156 let mappedAtCreation = &self.mappedAtCreation;
3157 rooted!(in(cx) let mut mappedAtCreation_js = UndefinedValue());
3158 mappedAtCreation.to_jsval(cx, mappedAtCreation_js.handle_mut());
3159 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "mappedAtCreation", mappedAtCreation_js.handle()).unwrap();
3160 let size = &self.size;
3161 rooted!(in(cx) let mut size_js = UndefinedValue());
3162 size.to_jsval(cx, size_js.handle_mut());
3163 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "size", size_js.handle()).unwrap();
3164 let usage = &self.usage;
3165 rooted!(in(cx) let mut usage_js = UndefinedValue());
3166 usage.to_jsval(cx, usage_js.handle_mut());
3167 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "usage", usage_js.handle()).unwrap();
3168 }
3169}
3170
3171impl ToJSValConvertible for GPUBufferDescriptor {
3172 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
3173 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
3174 self.to_jsobject(cx, obj.handle_mut());
3175 rval.set(ObjectOrNullValue(obj.get()))
3176 }
3177}
3178
3179
3180#[derive(JSTraceable, MallocSizeOf)]
3181pub struct GPUTextureDescriptor {
3182 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase,
3183 pub dimension: GPUTextureDimension,
3184 pub format: GPUTextureFormat,
3185 pub mipLevelCount: u32,
3186 pub sampleCount: u32,
3187 pub size: GenericUnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict,
3188 pub usage: u32,
3189 pub viewFormats: Vec<GPUTextureFormat>,
3190}
3191
3192impl GPUTextureDescriptor {
3193
3194 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
3195 -> Result<ConversionResult<GPUTextureDescriptor>, ()> {
3196 unsafe {
3197 let object = if val.get().is_null_or_undefined() {
3198 ptr::null_mut()
3199 } else if val.get().is_object() {
3200 val.get().to_object()
3201 } else {
3202 return Ok(ConversionResult::Failure("Value is not an object.".into()));
3203 };
3204 rooted!(&in(cx) let object = object);
3205 let dictionary = GPUTextureDescriptor {
3206 parent: {
3207 match crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val, can_gc)? {
3208 ConversionResult::Success(v) => v,
3209 ConversionResult::Failure(error) => {
3210 throw_type_error(cx.raw_cx(), &error);
3211 return Err(());
3212 }
3213 }
3214 },
3215 dimension: {
3216 rooted!(&in(cx) let mut rval = UndefinedValue());
3217 if get_dictionary_property(cx.raw_cx(), object.handle(), "dimension", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3218 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
3219 Ok(ConversionResult::Success(value)) => value,
3220 Ok(ConversionResult::Failure(error)) => {
3221 throw_type_error(cx.raw_cx(), &error); return Err(());
3222
3223 }
3224 _ => {
3225 return Err(());
3226
3227 },
3228 }
3229
3230 } else {
3231 GPUTextureDimension::_2d
3232 }
3233 },
3234 format: {
3235 rooted!(&in(cx) let mut rval = UndefinedValue());
3236 if get_dictionary_property(cx.raw_cx(), object.handle(), "format", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3237 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
3238 Ok(ConversionResult::Success(value)) => value,
3239 Ok(ConversionResult::Failure(error)) => {
3240 throw_type_error(cx.raw_cx(), &error); return Err(());
3241
3242 }
3243 _ => {
3244 return Err(());
3245
3246 },
3247 }
3248
3249 } else {
3250 throw_type_error(cx.raw_cx(), "Missing required member \"format\".");
3251 return Err(());
3252 }
3253 },
3254 mipLevelCount: {
3255 rooted!(&in(cx) let mut rval = UndefinedValue());
3256 if get_dictionary_property(cx.raw_cx(), object.handle(), "mipLevelCount", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3257 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
3258 Ok(ConversionResult::Success(value)) => value,
3259 Ok(ConversionResult::Failure(error)) => {
3260 throw_type_error(cx.raw_cx(), &error);
3261 return Err(());
3262
3263 }
3264 _ => {
3265 return Err(());
3266
3267 },
3268 }
3269
3270 } else {
3271 1
3272 }
3273 },
3274 sampleCount: {
3275 rooted!(&in(cx) let mut rval = UndefinedValue());
3276 if get_dictionary_property(cx.raw_cx(), object.handle(), "sampleCount", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3277 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
3278 Ok(ConversionResult::Success(value)) => value,
3279 Ok(ConversionResult::Failure(error)) => {
3280 throw_type_error(cx.raw_cx(), &error);
3281 return Err(());
3282
3283 }
3284 _ => {
3285 return Err(());
3286
3287 },
3288 }
3289
3290 } else {
3291 1
3292 }
3293 },
3294 size: {
3295 rooted!(&in(cx) let mut rval = UndefinedValue());
3296 if get_dictionary_property(cx.raw_cx(), object.handle(), "size", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3297 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
3298 Ok(ConversionResult::Success(value)) => value,
3299 Ok(ConversionResult::Failure(error)) => {
3300 throw_type_error(cx.raw_cx(), &error);
3301 return Err(());
3302
3303 }
3304 _ => {
3305 return Err(());
3306
3307 },
3308 }
3309
3310 } else {
3311 throw_type_error(cx.raw_cx(), "Missing required member \"size\".");
3312 return Err(());
3313 }
3314 },
3315 usage: {
3316 rooted!(&in(cx) let mut rval = UndefinedValue());
3317 if get_dictionary_property(cx.raw_cx(), object.handle(), "usage", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3318 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
3319 Ok(ConversionResult::Success(value)) => value,
3320 Ok(ConversionResult::Failure(error)) => {
3321 throw_type_error(cx.raw_cx(), &error);
3322 return Err(());
3323
3324 }
3325 _ => {
3326 return Err(());
3327
3328 },
3329 }
3330
3331 } else {
3332 throw_type_error(cx.raw_cx(), "Missing required member \"usage\".");
3333 return Err(());
3334 }
3335 },
3336 viewFormats: {
3337 rooted!(&in(cx) let mut rval = UndefinedValue());
3338 if get_dictionary_property(cx.raw_cx(), object.handle(), "viewFormats", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3339 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
3340 Ok(ConversionResult::Success(value)) => value,
3341 Ok(ConversionResult::Failure(error)) => {
3342 throw_type_error(cx.raw_cx(), &error);
3343 return Err(());
3344
3345 }
3346 _ => {
3347 return Err(());
3348
3349 },
3350 }
3351
3352 } else {
3353 Vec::new()
3354 }
3355 },
3356 };
3357 Ok(ConversionResult::Success(dictionary))
3358 }
3359 }
3360}
3361
3362impl FromJSValConvertible for GPUTextureDescriptor {
3363 type Config = ();
3364 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
3365 -> Result<ConversionResult<GPUTextureDescriptor>, ()> {
3366 GPUTextureDescriptor::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
3367 }
3368}
3369
3370impl GPUTextureDescriptor {
3371 #[allow(clippy::wrong_self_convention)]
3372 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
3373 self.parent.to_jsobject(cx, obj.reborrow());
3374 let dimension = &self.dimension;
3375 rooted!(in(cx) let mut dimension_js = UndefinedValue());
3376 dimension.to_jsval(cx, dimension_js.handle_mut());
3377 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "dimension", dimension_js.handle()).unwrap();
3378 let format = &self.format;
3379 rooted!(in(cx) let mut format_js = UndefinedValue());
3380 format.to_jsval(cx, format_js.handle_mut());
3381 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "format", format_js.handle()).unwrap();
3382 let mipLevelCount = &self.mipLevelCount;
3383 rooted!(in(cx) let mut mipLevelCount_js = UndefinedValue());
3384 mipLevelCount.to_jsval(cx, mipLevelCount_js.handle_mut());
3385 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "mipLevelCount", mipLevelCount_js.handle()).unwrap();
3386 let sampleCount = &self.sampleCount;
3387 rooted!(in(cx) let mut sampleCount_js = UndefinedValue());
3388 sampleCount.to_jsval(cx, sampleCount_js.handle_mut());
3389 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "sampleCount", sampleCount_js.handle()).unwrap();
3390 let size = &self.size;
3391 rooted!(in(cx) let mut size_js = UndefinedValue());
3392 size.to_jsval(cx, size_js.handle_mut());
3393 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "size", size_js.handle()).unwrap();
3394 let usage = &self.usage;
3395 rooted!(in(cx) let mut usage_js = UndefinedValue());
3396 usage.to_jsval(cx, usage_js.handle_mut());
3397 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "usage", usage_js.handle()).unwrap();
3398 let viewFormats = &self.viewFormats;
3399 rooted!(in(cx) let mut viewFormats_js = UndefinedValue());
3400 viewFormats.to_jsval(cx, viewFormats_js.handle_mut());
3401 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "viewFormats", viewFormats_js.handle()).unwrap();
3402 }
3403}
3404
3405impl ToJSValConvertible for GPUTextureDescriptor {
3406 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
3407 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
3408 self.to_jsobject(cx, obj.handle_mut());
3409 rval.set(ObjectOrNullValue(obj.get()))
3410 }
3411}
3412
3413
3414#[derive(JSTraceable)]
3415pub struct GPUTextureViewDescriptor {
3416 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase,
3417 pub arrayLayerCount: Option<u32>,
3418 pub aspect: GPUTextureAspect,
3419 pub baseArrayLayer: u32,
3420 pub baseMipLevel: u32,
3421 pub dimension: Option<GPUTextureViewDimension>,
3422 pub format: Option<GPUTextureFormat>,
3423 pub mipLevelCount: Option<u32>,
3424 pub usage: u32,
3425}
3426impl Default for GPUTextureViewDescriptor {
3427 fn default() -> Self {
3428 Self::empty()
3429 }
3430}
3431
3432impl GPUTextureViewDescriptor {
3433 pub fn empty() -> Self {
3434 Self {
3435 parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::empty(),
3436 arrayLayerCount: None,
3437 aspect: GPUTextureAspect::All,
3438 baseArrayLayer: 0,
3439 baseMipLevel: 0,
3440 dimension: None,
3441 format: None,
3442 mipLevelCount: None,
3443 usage: 0,
3444 }
3445 }
3446 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
3447 -> Result<ConversionResult<GPUTextureViewDescriptor>, ()> {
3448 unsafe {
3449 let object = if val.get().is_null_or_undefined() {
3450 ptr::null_mut()
3451 } else if val.get().is_object() {
3452 val.get().to_object()
3453 } else {
3454 return Ok(ConversionResult::Failure("Value is not an object.".into()));
3455 };
3456 rooted!(&in(cx) let object = object);
3457 let dictionary = GPUTextureViewDescriptor {
3458 parent: {
3459 match crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val, can_gc)? {
3460 ConversionResult::Success(v) => v,
3461 ConversionResult::Failure(error) => {
3462 throw_type_error(cx.raw_cx(), &error);
3463 return Err(());
3464 }
3465 }
3466 },
3467 arrayLayerCount: {
3468 rooted!(&in(cx) let mut rval = UndefinedValue());
3469 if get_dictionary_property(cx.raw_cx(), object.handle(), "arrayLayerCount", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3470 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
3471 Ok(ConversionResult::Success(value)) => value,
3472 Ok(ConversionResult::Failure(error)) => {
3473 throw_type_error(cx.raw_cx(), &error);
3474 return Err(());
3475
3476 }
3477 _ => {
3478 return Err(());
3479
3480 },
3481 }
3482 )
3483 } else {
3484 None
3485 }
3486 },
3487 aspect: {
3488 rooted!(&in(cx) let mut rval = UndefinedValue());
3489 if get_dictionary_property(cx.raw_cx(), object.handle(), "aspect", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3490 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
3491 Ok(ConversionResult::Success(value)) => value,
3492 Ok(ConversionResult::Failure(error)) => {
3493 throw_type_error(cx.raw_cx(), &error); return Err(());
3494
3495 }
3496 _ => {
3497 return Err(());
3498
3499 },
3500 }
3501
3502 } else {
3503 GPUTextureAspect::All
3504 }
3505 },
3506 baseArrayLayer: {
3507 rooted!(&in(cx) let mut rval = UndefinedValue());
3508 if get_dictionary_property(cx.raw_cx(), object.handle(), "baseArrayLayer", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3509 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
3510 Ok(ConversionResult::Success(value)) => value,
3511 Ok(ConversionResult::Failure(error)) => {
3512 throw_type_error(cx.raw_cx(), &error);
3513 return Err(());
3514
3515 }
3516 _ => {
3517 return Err(());
3518
3519 },
3520 }
3521
3522 } else {
3523 0
3524 }
3525 },
3526 baseMipLevel: {
3527 rooted!(&in(cx) let mut rval = UndefinedValue());
3528 if get_dictionary_property(cx.raw_cx(), object.handle(), "baseMipLevel", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3529 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
3530 Ok(ConversionResult::Success(value)) => value,
3531 Ok(ConversionResult::Failure(error)) => {
3532 throw_type_error(cx.raw_cx(), &error);
3533 return Err(());
3534
3535 }
3536 _ => {
3537 return Err(());
3538
3539 },
3540 }
3541
3542 } else {
3543 0
3544 }
3545 },
3546 dimension: {
3547 rooted!(&in(cx) let mut rval = UndefinedValue());
3548 if get_dictionary_property(cx.raw_cx(), object.handle(), "dimension", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3549 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
3550 Ok(ConversionResult::Success(value)) => value,
3551 Ok(ConversionResult::Failure(error)) => {
3552 throw_type_error(cx.raw_cx(), &error); return Err(());
3553
3554 }
3555 _ => {
3556 return Err(());
3557
3558 },
3559 }
3560 )
3561 } else {
3562 None
3563 }
3564 },
3565 format: {
3566 rooted!(&in(cx) let mut rval = UndefinedValue());
3567 if get_dictionary_property(cx.raw_cx(), object.handle(), "format", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3568 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
3569 Ok(ConversionResult::Success(value)) => value,
3570 Ok(ConversionResult::Failure(error)) => {
3571 throw_type_error(cx.raw_cx(), &error); return Err(());
3572
3573 }
3574 _ => {
3575 return Err(());
3576
3577 },
3578 }
3579 )
3580 } else {
3581 None
3582 }
3583 },
3584 mipLevelCount: {
3585 rooted!(&in(cx) let mut rval = UndefinedValue());
3586 if get_dictionary_property(cx.raw_cx(), object.handle(), "mipLevelCount", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3587 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
3588 Ok(ConversionResult::Success(value)) => value,
3589 Ok(ConversionResult::Failure(error)) => {
3590 throw_type_error(cx.raw_cx(), &error);
3591 return Err(());
3592
3593 }
3594 _ => {
3595 return Err(());
3596
3597 },
3598 }
3599 )
3600 } else {
3601 None
3602 }
3603 },
3604 usage: {
3605 rooted!(&in(cx) let mut rval = UndefinedValue());
3606 if get_dictionary_property(cx.raw_cx(), object.handle(), "usage", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3607 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
3608 Ok(ConversionResult::Success(value)) => value,
3609 Ok(ConversionResult::Failure(error)) => {
3610 throw_type_error(cx.raw_cx(), &error);
3611 return Err(());
3612
3613 }
3614 _ => {
3615 return Err(());
3616
3617 },
3618 }
3619
3620 } else {
3621 0
3622 }
3623 },
3624 };
3625 Ok(ConversionResult::Success(dictionary))
3626 }
3627 }
3628}
3629
3630impl FromJSValConvertible for GPUTextureViewDescriptor {
3631 type Config = ();
3632 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
3633 -> Result<ConversionResult<GPUTextureViewDescriptor>, ()> {
3634 GPUTextureViewDescriptor::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
3635 }
3636}
3637
3638impl GPUTextureViewDescriptor {
3639 #[allow(clippy::wrong_self_convention)]
3640 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
3641 self.parent.to_jsobject(cx, obj.reborrow());
3642 if let Some(ref arrayLayerCount) = self.arrayLayerCount {
3643 rooted!(in(cx) let mut arrayLayerCount_js = UndefinedValue());
3644 arrayLayerCount.to_jsval(cx, arrayLayerCount_js.handle_mut());
3645 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "arrayLayerCount", arrayLayerCount_js.handle()).unwrap();
3646 }
3647 let aspect = &self.aspect;
3648 rooted!(in(cx) let mut aspect_js = UndefinedValue());
3649 aspect.to_jsval(cx, aspect_js.handle_mut());
3650 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "aspect", aspect_js.handle()).unwrap();
3651 let baseArrayLayer = &self.baseArrayLayer;
3652 rooted!(in(cx) let mut baseArrayLayer_js = UndefinedValue());
3653 baseArrayLayer.to_jsval(cx, baseArrayLayer_js.handle_mut());
3654 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "baseArrayLayer", baseArrayLayer_js.handle()).unwrap();
3655 let baseMipLevel = &self.baseMipLevel;
3656 rooted!(in(cx) let mut baseMipLevel_js = UndefinedValue());
3657 baseMipLevel.to_jsval(cx, baseMipLevel_js.handle_mut());
3658 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "baseMipLevel", baseMipLevel_js.handle()).unwrap();
3659 if let Some(ref dimension) = self.dimension {
3660 rooted!(in(cx) let mut dimension_js = UndefinedValue());
3661 dimension.to_jsval(cx, dimension_js.handle_mut());
3662 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "dimension", dimension_js.handle()).unwrap();
3663 }
3664 if let Some(ref format) = self.format {
3665 rooted!(in(cx) let mut format_js = UndefinedValue());
3666 format.to_jsval(cx, format_js.handle_mut());
3667 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "format", format_js.handle()).unwrap();
3668 }
3669 if let Some(ref mipLevelCount) = self.mipLevelCount {
3670 rooted!(in(cx) let mut mipLevelCount_js = UndefinedValue());
3671 mipLevelCount.to_jsval(cx, mipLevelCount_js.handle_mut());
3672 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "mipLevelCount", mipLevelCount_js.handle()).unwrap();
3673 }
3674 let usage = &self.usage;
3675 rooted!(in(cx) let mut usage_js = UndefinedValue());
3676 usage.to_jsval(cx, usage_js.handle_mut());
3677 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "usage", usage_js.handle()).unwrap();
3678 }
3679}
3680
3681impl ToJSValConvertible for GPUTextureViewDescriptor {
3682 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
3683 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
3684 self.to_jsobject(cx, obj.handle_mut());
3685 rval.set(ObjectOrNullValue(obj.get()))
3686 }
3687}
3688
3689
3690#[derive(JSTraceable)]
3691pub struct GPUSamplerDescriptor {
3692 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase,
3693 pub addressModeU: GPUAddressMode,
3694 pub addressModeV: GPUAddressMode,
3695 pub addressModeW: GPUAddressMode,
3696 pub compare: Option<GPUCompareFunction>,
3697 pub lodMaxClamp: Finite<f32>,
3698 pub lodMinClamp: Finite<f32>,
3699 pub magFilter: GPUFilterMode,
3700 pub maxAnisotropy: u16,
3701 pub minFilter: GPUFilterMode,
3702 pub mipmapFilter: GPUFilterMode,
3703}
3704impl Default for GPUSamplerDescriptor {
3705 fn default() -> Self {
3706 Self::empty()
3707 }
3708}
3709
3710impl GPUSamplerDescriptor {
3711 pub fn empty() -> Self {
3712 Self {
3713 parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::empty(),
3714 addressModeU: GPUAddressMode::Clamp_to_edge,
3715 addressModeV: GPUAddressMode::Clamp_to_edge,
3716 addressModeW: GPUAddressMode::Clamp_to_edge,
3717 compare: None,
3718 lodMaxClamp: Finite::wrap(1000.0),
3719 lodMinClamp: Finite::wrap(0.0),
3720 magFilter: GPUFilterMode::Nearest,
3721 maxAnisotropy: 1,
3722 minFilter: GPUFilterMode::Nearest,
3723 mipmapFilter: GPUFilterMode::Nearest,
3724 }
3725 }
3726 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
3727 -> Result<ConversionResult<GPUSamplerDescriptor>, ()> {
3728 unsafe {
3729 let object = if val.get().is_null_or_undefined() {
3730 ptr::null_mut()
3731 } else if val.get().is_object() {
3732 val.get().to_object()
3733 } else {
3734 return Ok(ConversionResult::Failure("Value is not an object.".into()));
3735 };
3736 rooted!(&in(cx) let object = object);
3737 let dictionary = GPUSamplerDescriptor {
3738 parent: {
3739 match crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val, can_gc)? {
3740 ConversionResult::Success(v) => v,
3741 ConversionResult::Failure(error) => {
3742 throw_type_error(cx.raw_cx(), &error);
3743 return Err(());
3744 }
3745 }
3746 },
3747 addressModeU: {
3748 rooted!(&in(cx) let mut rval = UndefinedValue());
3749 if get_dictionary_property(cx.raw_cx(), object.handle(), "addressModeU", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3750 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
3751 Ok(ConversionResult::Success(value)) => value,
3752 Ok(ConversionResult::Failure(error)) => {
3753 throw_type_error(cx.raw_cx(), &error); return Err(());
3754
3755 }
3756 _ => {
3757 return Err(());
3758
3759 },
3760 }
3761
3762 } else {
3763 GPUAddressMode::Clamp_to_edge
3764 }
3765 },
3766 addressModeV: {
3767 rooted!(&in(cx) let mut rval = UndefinedValue());
3768 if get_dictionary_property(cx.raw_cx(), object.handle(), "addressModeV", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3769 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
3770 Ok(ConversionResult::Success(value)) => value,
3771 Ok(ConversionResult::Failure(error)) => {
3772 throw_type_error(cx.raw_cx(), &error); return Err(());
3773
3774 }
3775 _ => {
3776 return Err(());
3777
3778 },
3779 }
3780
3781 } else {
3782 GPUAddressMode::Clamp_to_edge
3783 }
3784 },
3785 addressModeW: {
3786 rooted!(&in(cx) let mut rval = UndefinedValue());
3787 if get_dictionary_property(cx.raw_cx(), object.handle(), "addressModeW", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3788 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
3789 Ok(ConversionResult::Success(value)) => value,
3790 Ok(ConversionResult::Failure(error)) => {
3791 throw_type_error(cx.raw_cx(), &error); return Err(());
3792
3793 }
3794 _ => {
3795 return Err(());
3796
3797 },
3798 }
3799
3800 } else {
3801 GPUAddressMode::Clamp_to_edge
3802 }
3803 },
3804 compare: {
3805 rooted!(&in(cx) let mut rval = UndefinedValue());
3806 if get_dictionary_property(cx.raw_cx(), object.handle(), "compare", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3807 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
3808 Ok(ConversionResult::Success(value)) => value,
3809 Ok(ConversionResult::Failure(error)) => {
3810 throw_type_error(cx.raw_cx(), &error); return Err(());
3811
3812 }
3813 _ => {
3814 return Err(());
3815
3816 },
3817 }
3818 )
3819 } else {
3820 None
3821 }
3822 },
3823 lodMaxClamp: {
3824 rooted!(&in(cx) let mut rval = UndefinedValue());
3825 if get_dictionary_property(cx.raw_cx(), object.handle(), "lodMaxClamp", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3826 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
3827 Ok(ConversionResult::Success(value)) => value,
3828 Ok(ConversionResult::Failure(error)) => {
3829 throw_type_error(cx.raw_cx(), &error);
3830 return Err(());
3831
3832 }
3833 _ => {
3834 return Err(());
3835
3836 },
3837 }
3838
3839 } else {
3840 Finite::wrap(1000.0)
3841 }
3842 },
3843 lodMinClamp: {
3844 rooted!(&in(cx) let mut rval = UndefinedValue());
3845 if get_dictionary_property(cx.raw_cx(), object.handle(), "lodMinClamp", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3846 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
3847 Ok(ConversionResult::Success(value)) => value,
3848 Ok(ConversionResult::Failure(error)) => {
3849 throw_type_error(cx.raw_cx(), &error);
3850 return Err(());
3851
3852 }
3853 _ => {
3854 return Err(());
3855
3856 },
3857 }
3858
3859 } else {
3860 Finite::wrap(0.0)
3861 }
3862 },
3863 magFilter: {
3864 rooted!(&in(cx) let mut rval = UndefinedValue());
3865 if get_dictionary_property(cx.raw_cx(), object.handle(), "magFilter", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3866 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
3867 Ok(ConversionResult::Success(value)) => value,
3868 Ok(ConversionResult::Failure(error)) => {
3869 throw_type_error(cx.raw_cx(), &error); return Err(());
3870
3871 }
3872 _ => {
3873 return Err(());
3874
3875 },
3876 }
3877
3878 } else {
3879 GPUFilterMode::Nearest
3880 }
3881 },
3882 maxAnisotropy: {
3883 rooted!(&in(cx) let mut rval = UndefinedValue());
3884 if get_dictionary_property(cx.raw_cx(), object.handle(), "maxAnisotropy", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3885 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::Clamp) {
3886 Ok(ConversionResult::Success(value)) => value,
3887 Ok(ConversionResult::Failure(error)) => {
3888 throw_type_error(cx.raw_cx(), &error);
3889 return Err(());
3890
3891 }
3892 _ => {
3893 return Err(());
3894
3895 },
3896 }
3897
3898 } else {
3899 1
3900 }
3901 },
3902 minFilter: {
3903 rooted!(&in(cx) let mut rval = UndefinedValue());
3904 if get_dictionary_property(cx.raw_cx(), object.handle(), "minFilter", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3905 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
3906 Ok(ConversionResult::Success(value)) => value,
3907 Ok(ConversionResult::Failure(error)) => {
3908 throw_type_error(cx.raw_cx(), &error); return Err(());
3909
3910 }
3911 _ => {
3912 return Err(());
3913
3914 },
3915 }
3916
3917 } else {
3918 GPUFilterMode::Nearest
3919 }
3920 },
3921 mipmapFilter: {
3922 rooted!(&in(cx) let mut rval = UndefinedValue());
3923 if get_dictionary_property(cx.raw_cx(), object.handle(), "mipmapFilter", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
3924 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
3925 Ok(ConversionResult::Success(value)) => value,
3926 Ok(ConversionResult::Failure(error)) => {
3927 throw_type_error(cx.raw_cx(), &error); return Err(());
3928
3929 }
3930 _ => {
3931 return Err(());
3932
3933 },
3934 }
3935
3936 } else {
3937 GPUFilterMode::Nearest
3938 }
3939 },
3940 };
3941 Ok(ConversionResult::Success(dictionary))
3942 }
3943 }
3944}
3945
3946impl FromJSValConvertible for GPUSamplerDescriptor {
3947 type Config = ();
3948 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
3949 -> Result<ConversionResult<GPUSamplerDescriptor>, ()> {
3950 GPUSamplerDescriptor::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
3951 }
3952}
3953
3954impl GPUSamplerDescriptor {
3955 #[allow(clippy::wrong_self_convention)]
3956 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
3957 self.parent.to_jsobject(cx, obj.reborrow());
3958 let addressModeU = &self.addressModeU;
3959 rooted!(in(cx) let mut addressModeU_js = UndefinedValue());
3960 addressModeU.to_jsval(cx, addressModeU_js.handle_mut());
3961 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "addressModeU", addressModeU_js.handle()).unwrap();
3962 let addressModeV = &self.addressModeV;
3963 rooted!(in(cx) let mut addressModeV_js = UndefinedValue());
3964 addressModeV.to_jsval(cx, addressModeV_js.handle_mut());
3965 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "addressModeV", addressModeV_js.handle()).unwrap();
3966 let addressModeW = &self.addressModeW;
3967 rooted!(in(cx) let mut addressModeW_js = UndefinedValue());
3968 addressModeW.to_jsval(cx, addressModeW_js.handle_mut());
3969 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "addressModeW", addressModeW_js.handle()).unwrap();
3970 if let Some(ref compare) = self.compare {
3971 rooted!(in(cx) let mut compare_js = UndefinedValue());
3972 compare.to_jsval(cx, compare_js.handle_mut());
3973 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "compare", compare_js.handle()).unwrap();
3974 }
3975 let lodMaxClamp = &self.lodMaxClamp;
3976 rooted!(in(cx) let mut lodMaxClamp_js = UndefinedValue());
3977 lodMaxClamp.to_jsval(cx, lodMaxClamp_js.handle_mut());
3978 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "lodMaxClamp", lodMaxClamp_js.handle()).unwrap();
3979 let lodMinClamp = &self.lodMinClamp;
3980 rooted!(in(cx) let mut lodMinClamp_js = UndefinedValue());
3981 lodMinClamp.to_jsval(cx, lodMinClamp_js.handle_mut());
3982 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "lodMinClamp", lodMinClamp_js.handle()).unwrap();
3983 let magFilter = &self.magFilter;
3984 rooted!(in(cx) let mut magFilter_js = UndefinedValue());
3985 magFilter.to_jsval(cx, magFilter_js.handle_mut());
3986 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "magFilter", magFilter_js.handle()).unwrap();
3987 let maxAnisotropy = &self.maxAnisotropy;
3988 rooted!(in(cx) let mut maxAnisotropy_js = UndefinedValue());
3989 maxAnisotropy.to_jsval(cx, maxAnisotropy_js.handle_mut());
3990 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "maxAnisotropy", maxAnisotropy_js.handle()).unwrap();
3991 let minFilter = &self.minFilter;
3992 rooted!(in(cx) let mut minFilter_js = UndefinedValue());
3993 minFilter.to_jsval(cx, minFilter_js.handle_mut());
3994 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "minFilter", minFilter_js.handle()).unwrap();
3995 let mipmapFilter = &self.mipmapFilter;
3996 rooted!(in(cx) let mut mipmapFilter_js = UndefinedValue());
3997 mipmapFilter.to_jsval(cx, mipmapFilter_js.handle_mut());
3998 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "mipmapFilter", mipmapFilter_js.handle()).unwrap();
3999 }
4000}
4001
4002impl ToJSValConvertible for GPUSamplerDescriptor {
4003 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
4004 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
4005 self.to_jsobject(cx, obj.handle_mut());
4006 rval.set(ObjectOrNullValue(obj.get()))
4007 }
4008}
4009
4010
4011#[derive(JSTraceable)]
4012pub struct GPUBindGroupLayoutDescriptor {
4013 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase,
4014 pub entries: Vec<crate::codegen::GenericBindings::WebGPUBinding::GPUBindGroupLayoutEntry>,
4015}
4016
4017impl GPUBindGroupLayoutDescriptor {
4018
4019 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
4020 -> Result<ConversionResult<GPUBindGroupLayoutDescriptor>, ()> {
4021 unsafe {
4022 let object = if val.get().is_null_or_undefined() {
4023 ptr::null_mut()
4024 } else if val.get().is_object() {
4025 val.get().to_object()
4026 } else {
4027 return Ok(ConversionResult::Failure("Value is not an object.".into()));
4028 };
4029 rooted!(&in(cx) let object = object);
4030 let dictionary = GPUBindGroupLayoutDescriptor {
4031 parent: {
4032 match crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val, can_gc)? {
4033 ConversionResult::Success(v) => v,
4034 ConversionResult::Failure(error) => {
4035 throw_type_error(cx.raw_cx(), &error);
4036 return Err(());
4037 }
4038 }
4039 },
4040 entries: {
4041 rooted!(&in(cx) let mut rval = UndefinedValue());
4042 if get_dictionary_property(cx.raw_cx(), object.handle(), "entries", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
4043 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
4044 Ok(ConversionResult::Success(value)) => value,
4045 Ok(ConversionResult::Failure(error)) => {
4046 throw_type_error(cx.raw_cx(), &error);
4047 return Err(());
4048
4049 }
4050 _ => {
4051 return Err(());
4052
4053 },
4054 }
4055
4056 } else {
4057 throw_type_error(cx.raw_cx(), "Missing required member \"entries\".");
4058 return Err(());
4059 }
4060 },
4061 };
4062 Ok(ConversionResult::Success(dictionary))
4063 }
4064 }
4065}
4066
4067impl FromJSValConvertible for GPUBindGroupLayoutDescriptor {
4068 type Config = ();
4069 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
4070 -> Result<ConversionResult<GPUBindGroupLayoutDescriptor>, ()> {
4071 GPUBindGroupLayoutDescriptor::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
4072 }
4073}
4074
4075impl GPUBindGroupLayoutDescriptor {
4076 #[allow(clippy::wrong_self_convention)]
4077 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
4078 self.parent.to_jsobject(cx, obj.reborrow());
4079 let entries = &self.entries;
4080 rooted!(in(cx) let mut entries_js = UndefinedValue());
4081 entries.to_jsval(cx, entries_js.handle_mut());
4082 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "entries", entries_js.handle()).unwrap();
4083 }
4084}
4085
4086impl ToJSValConvertible for GPUBindGroupLayoutDescriptor {
4087 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
4088 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
4089 self.to_jsobject(cx, obj.handle_mut());
4090 rval.set(ObjectOrNullValue(obj.get()))
4091 }
4092}
4093
4094
4095#[derive(JSTraceable)]
4096pub struct GPUBindGroupLayoutEntry {
4097 pub binding: u32,
4098 pub buffer: Option<crate::codegen::GenericBindings::WebGPUBinding::GPUBufferBindingLayout>,
4099 pub externalTexture: Option<crate::codegen::GenericBindings::WebGPUBinding::GPUExternalTextureBindingLayout>,
4100 pub sampler: Option<crate::codegen::GenericBindings::WebGPUBinding::GPUSamplerBindingLayout>,
4101 pub storageTexture: Option<crate::codegen::GenericBindings::WebGPUBinding::GPUStorageTextureBindingLayout>,
4102 pub texture: Option<crate::codegen::GenericBindings::WebGPUBinding::GPUTextureBindingLayout>,
4103 pub visibility: u32,
4104}
4105
4106impl GPUBindGroupLayoutEntry {
4107
4108 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
4109 -> Result<ConversionResult<GPUBindGroupLayoutEntry>, ()> {
4110 unsafe {
4111 let object = if val.get().is_null_or_undefined() {
4112 ptr::null_mut()
4113 } else if val.get().is_object() {
4114 val.get().to_object()
4115 } else {
4116 return Ok(ConversionResult::Failure("Value is not an object.".into()));
4117 };
4118 rooted!(&in(cx) let object = object);
4119 let dictionary = GPUBindGroupLayoutEntry {
4120 binding: {
4121 rooted!(&in(cx) let mut rval = UndefinedValue());
4122 if get_dictionary_property(cx.raw_cx(), object.handle(), "binding", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
4123 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
4124 Ok(ConversionResult::Success(value)) => value,
4125 Ok(ConversionResult::Failure(error)) => {
4126 throw_type_error(cx.raw_cx(), &error);
4127 return Err(());
4128
4129 }
4130 _ => {
4131 return Err(());
4132
4133 },
4134 }
4135
4136 } else {
4137 throw_type_error(cx.raw_cx(), "Missing required member \"binding\".");
4138 return Err(());
4139 }
4140 },
4141 buffer: {
4142 rooted!(&in(cx) let mut rval = UndefinedValue());
4143 if get_dictionary_property(cx.raw_cx(), object.handle(), "buffer", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
4144 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
4145 Ok(ConversionResult::Success(value)) => value,
4146 Ok(ConversionResult::Failure(error)) => {
4147 throw_type_error(cx.raw_cx(), &error);
4148 return Err(());
4149
4150 }
4151 _ => {
4152 return Err(());
4153
4154 },
4155 }
4156 )
4157 } else {
4158 None
4159 }
4160 },
4161 externalTexture: {
4162 rooted!(&in(cx) let mut rval = UndefinedValue());
4163 if get_dictionary_property(cx.raw_cx(), object.handle(), "externalTexture", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
4164 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
4165 Ok(ConversionResult::Success(value)) => value,
4166 Ok(ConversionResult::Failure(error)) => {
4167 throw_type_error(cx.raw_cx(), &error);
4168 return Err(());
4169
4170 }
4171 _ => {
4172 return Err(());
4173
4174 },
4175 }
4176 )
4177 } else {
4178 None
4179 }
4180 },
4181 sampler: {
4182 rooted!(&in(cx) let mut rval = UndefinedValue());
4183 if get_dictionary_property(cx.raw_cx(), object.handle(), "sampler", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
4184 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
4185 Ok(ConversionResult::Success(value)) => value,
4186 Ok(ConversionResult::Failure(error)) => {
4187 throw_type_error(cx.raw_cx(), &error);
4188 return Err(());
4189
4190 }
4191 _ => {
4192 return Err(());
4193
4194 },
4195 }
4196 )
4197 } else {
4198 None
4199 }
4200 },
4201 storageTexture: {
4202 rooted!(&in(cx) let mut rval = UndefinedValue());
4203 if get_dictionary_property(cx.raw_cx(), object.handle(), "storageTexture", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
4204 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
4205 Ok(ConversionResult::Success(value)) => value,
4206 Ok(ConversionResult::Failure(error)) => {
4207 throw_type_error(cx.raw_cx(), &error);
4208 return Err(());
4209
4210 }
4211 _ => {
4212 return Err(());
4213
4214 },
4215 }
4216 )
4217 } else {
4218 None
4219 }
4220 },
4221 texture: {
4222 rooted!(&in(cx) let mut rval = UndefinedValue());
4223 if get_dictionary_property(cx.raw_cx(), object.handle(), "texture", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
4224 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
4225 Ok(ConversionResult::Success(value)) => value,
4226 Ok(ConversionResult::Failure(error)) => {
4227 throw_type_error(cx.raw_cx(), &error);
4228 return Err(());
4229
4230 }
4231 _ => {
4232 return Err(());
4233
4234 },
4235 }
4236 )
4237 } else {
4238 None
4239 }
4240 },
4241 visibility: {
4242 rooted!(&in(cx) let mut rval = UndefinedValue());
4243 if get_dictionary_property(cx.raw_cx(), object.handle(), "visibility", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
4244 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
4245 Ok(ConversionResult::Success(value)) => value,
4246 Ok(ConversionResult::Failure(error)) => {
4247 throw_type_error(cx.raw_cx(), &error);
4248 return Err(());
4249
4250 }
4251 _ => {
4252 return Err(());
4253
4254 },
4255 }
4256
4257 } else {
4258 throw_type_error(cx.raw_cx(), "Missing required member \"visibility\".");
4259 return Err(());
4260 }
4261 },
4262 };
4263 Ok(ConversionResult::Success(dictionary))
4264 }
4265 }
4266}
4267
4268impl FromJSValConvertible for GPUBindGroupLayoutEntry {
4269 type Config = ();
4270 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
4271 -> Result<ConversionResult<GPUBindGroupLayoutEntry>, ()> {
4272 GPUBindGroupLayoutEntry::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
4273 }
4274}
4275
4276impl GPUBindGroupLayoutEntry {
4277 #[allow(clippy::wrong_self_convention)]
4278 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
4279 let binding = &self.binding;
4280 rooted!(in(cx) let mut binding_js = UndefinedValue());
4281 binding.to_jsval(cx, binding_js.handle_mut());
4282 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "binding", binding_js.handle()).unwrap();
4283 if let Some(ref buffer) = self.buffer {
4284 rooted!(in(cx) let mut buffer_js = UndefinedValue());
4285 buffer.to_jsval(cx, buffer_js.handle_mut());
4286 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "buffer", buffer_js.handle()).unwrap();
4287 }
4288 if let Some(ref externalTexture) = self.externalTexture {
4289 rooted!(in(cx) let mut externalTexture_js = UndefinedValue());
4290 externalTexture.to_jsval(cx, externalTexture_js.handle_mut());
4291 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "externalTexture", externalTexture_js.handle()).unwrap();
4292 }
4293 if let Some(ref sampler) = self.sampler {
4294 rooted!(in(cx) let mut sampler_js = UndefinedValue());
4295 sampler.to_jsval(cx, sampler_js.handle_mut());
4296 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "sampler", sampler_js.handle()).unwrap();
4297 }
4298 if let Some(ref storageTexture) = self.storageTexture {
4299 rooted!(in(cx) let mut storageTexture_js = UndefinedValue());
4300 storageTexture.to_jsval(cx, storageTexture_js.handle_mut());
4301 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "storageTexture", storageTexture_js.handle()).unwrap();
4302 }
4303 if let Some(ref texture) = self.texture {
4304 rooted!(in(cx) let mut texture_js = UndefinedValue());
4305 texture.to_jsval(cx, texture_js.handle_mut());
4306 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "texture", texture_js.handle()).unwrap();
4307 }
4308 let visibility = &self.visibility;
4309 rooted!(in(cx) let mut visibility_js = UndefinedValue());
4310 visibility.to_jsval(cx, visibility_js.handle_mut());
4311 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "visibility", visibility_js.handle()).unwrap();
4312 }
4313}
4314
4315impl ToJSValConvertible for GPUBindGroupLayoutEntry {
4316 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
4317 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
4318 self.to_jsobject(cx, obj.handle_mut());
4319 rval.set(ObjectOrNullValue(obj.get()))
4320 }
4321}
4322
4323
4324#[derive(JSTraceable)]
4325pub struct GPUBufferBindingLayout {
4326 pub hasDynamicOffset: bool,
4327 pub minBindingSize: u64,
4328 pub type_: GPUBufferBindingType,
4329}
4330impl Default for GPUBufferBindingLayout {
4331 fn default() -> Self {
4332 Self::empty()
4333 }
4334}
4335
4336impl GPUBufferBindingLayout {
4337 pub fn empty() -> Self {
4338 Self {
4339 hasDynamicOffset: false,
4340 minBindingSize: 0,
4341 type_: GPUBufferBindingType::Uniform,
4342 }
4343 }
4344 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
4345 -> Result<ConversionResult<GPUBufferBindingLayout>, ()> {
4346 unsafe {
4347 let object = if val.get().is_null_or_undefined() {
4348 ptr::null_mut()
4349 } else if val.get().is_object() {
4350 val.get().to_object()
4351 } else {
4352 return Ok(ConversionResult::Failure("Value is not an object.".into()));
4353 };
4354 rooted!(&in(cx) let object = object);
4355 let dictionary = GPUBufferBindingLayout {
4356 hasDynamicOffset: {
4357 rooted!(&in(cx) let mut rval = UndefinedValue());
4358 if get_dictionary_property(cx.raw_cx(), object.handle(), "hasDynamicOffset", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
4359 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
4360 Ok(ConversionResult::Success(value)) => value,
4361 Ok(ConversionResult::Failure(error)) => {
4362 throw_type_error(cx.raw_cx(), &error);
4363 return Err(());
4364
4365 }
4366 _ => {
4367 return Err(());
4368
4369 },
4370 }
4371
4372 } else {
4373 false
4374 }
4375 },
4376 minBindingSize: {
4377 rooted!(&in(cx) let mut rval = UndefinedValue());
4378 if get_dictionary_property(cx.raw_cx(), object.handle(), "minBindingSize", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
4379 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
4380 Ok(ConversionResult::Success(value)) => value,
4381 Ok(ConversionResult::Failure(error)) => {
4382 throw_type_error(cx.raw_cx(), &error);
4383 return Err(());
4384
4385 }
4386 _ => {
4387 return Err(());
4388
4389 },
4390 }
4391
4392 } else {
4393 0
4394 }
4395 },
4396 type_: {
4397 rooted!(&in(cx) let mut rval = UndefinedValue());
4398 if get_dictionary_property(cx.raw_cx(), object.handle(), "type", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
4399 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
4400 Ok(ConversionResult::Success(value)) => value,
4401 Ok(ConversionResult::Failure(error)) => {
4402 throw_type_error(cx.raw_cx(), &error); return Err(());
4403
4404 }
4405 _ => {
4406 return Err(());
4407
4408 },
4409 }
4410
4411 } else {
4412 GPUBufferBindingType::Uniform
4413 }
4414 },
4415 };
4416 Ok(ConversionResult::Success(dictionary))
4417 }
4418 }
4419}
4420
4421impl FromJSValConvertible for GPUBufferBindingLayout {
4422 type Config = ();
4423 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
4424 -> Result<ConversionResult<GPUBufferBindingLayout>, ()> {
4425 GPUBufferBindingLayout::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
4426 }
4427}
4428
4429impl GPUBufferBindingLayout {
4430 #[allow(clippy::wrong_self_convention)]
4431 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
4432 let hasDynamicOffset = &self.hasDynamicOffset;
4433 rooted!(in(cx) let mut hasDynamicOffset_js = UndefinedValue());
4434 hasDynamicOffset.to_jsval(cx, hasDynamicOffset_js.handle_mut());
4435 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "hasDynamicOffset", hasDynamicOffset_js.handle()).unwrap();
4436 let minBindingSize = &self.minBindingSize;
4437 rooted!(in(cx) let mut minBindingSize_js = UndefinedValue());
4438 minBindingSize.to_jsval(cx, minBindingSize_js.handle_mut());
4439 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "minBindingSize", minBindingSize_js.handle()).unwrap();
4440 let type_ = &self.type_;
4441 rooted!(in(cx) let mut type__js = UndefinedValue());
4442 type_.to_jsval(cx, type__js.handle_mut());
4443 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "type", type__js.handle()).unwrap();
4444 }
4445}
4446
4447impl ToJSValConvertible for GPUBufferBindingLayout {
4448 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
4449 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
4450 self.to_jsobject(cx, obj.handle_mut());
4451 rval.set(ObjectOrNullValue(obj.get()))
4452 }
4453}
4454
4455
4456#[derive(JSTraceable)]
4457pub struct GPUSamplerBindingLayout {
4458 pub type_: GPUSamplerBindingType,
4459}
4460impl Default for GPUSamplerBindingLayout {
4461 fn default() -> Self {
4462 Self::empty()
4463 }
4464}
4465
4466impl GPUSamplerBindingLayout {
4467 pub fn empty() -> Self {
4468 Self {
4469 type_: GPUSamplerBindingType::Filtering,
4470 }
4471 }
4472 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
4473 -> Result<ConversionResult<GPUSamplerBindingLayout>, ()> {
4474 unsafe {
4475 let object = if val.get().is_null_or_undefined() {
4476 ptr::null_mut()
4477 } else if val.get().is_object() {
4478 val.get().to_object()
4479 } else {
4480 return Ok(ConversionResult::Failure("Value is not an object.".into()));
4481 };
4482 rooted!(&in(cx) let object = object);
4483 let dictionary = GPUSamplerBindingLayout {
4484 type_: {
4485 rooted!(&in(cx) let mut rval = UndefinedValue());
4486 if get_dictionary_property(cx.raw_cx(), object.handle(), "type", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
4487 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
4488 Ok(ConversionResult::Success(value)) => value,
4489 Ok(ConversionResult::Failure(error)) => {
4490 throw_type_error(cx.raw_cx(), &error); return Err(());
4491
4492 }
4493 _ => {
4494 return Err(());
4495
4496 },
4497 }
4498
4499 } else {
4500 GPUSamplerBindingType::Filtering
4501 }
4502 },
4503 };
4504 Ok(ConversionResult::Success(dictionary))
4505 }
4506 }
4507}
4508
4509impl FromJSValConvertible for GPUSamplerBindingLayout {
4510 type Config = ();
4511 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
4512 -> Result<ConversionResult<GPUSamplerBindingLayout>, ()> {
4513 GPUSamplerBindingLayout::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
4514 }
4515}
4516
4517impl GPUSamplerBindingLayout {
4518 #[allow(clippy::wrong_self_convention)]
4519 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
4520 let type_ = &self.type_;
4521 rooted!(in(cx) let mut type__js = UndefinedValue());
4522 type_.to_jsval(cx, type__js.handle_mut());
4523 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "type", type__js.handle()).unwrap();
4524 }
4525}
4526
4527impl ToJSValConvertible for GPUSamplerBindingLayout {
4528 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
4529 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
4530 self.to_jsobject(cx, obj.handle_mut());
4531 rval.set(ObjectOrNullValue(obj.get()))
4532 }
4533}
4534
4535
4536#[derive(JSTraceable)]
4537pub struct GPUTextureBindingLayout {
4538 pub multisampled: bool,
4539 pub sampleType: GPUTextureSampleType,
4540 pub viewDimension: GPUTextureViewDimension,
4541}
4542impl Default for GPUTextureBindingLayout {
4543 fn default() -> Self {
4544 Self::empty()
4545 }
4546}
4547
4548impl GPUTextureBindingLayout {
4549 pub fn empty() -> Self {
4550 Self {
4551 multisampled: false,
4552 sampleType: GPUTextureSampleType::Float,
4553 viewDimension: GPUTextureViewDimension::_2d,
4554 }
4555 }
4556 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
4557 -> Result<ConversionResult<GPUTextureBindingLayout>, ()> {
4558 unsafe {
4559 let object = if val.get().is_null_or_undefined() {
4560 ptr::null_mut()
4561 } else if val.get().is_object() {
4562 val.get().to_object()
4563 } else {
4564 return Ok(ConversionResult::Failure("Value is not an object.".into()));
4565 };
4566 rooted!(&in(cx) let object = object);
4567 let dictionary = GPUTextureBindingLayout {
4568 multisampled: {
4569 rooted!(&in(cx) let mut rval = UndefinedValue());
4570 if get_dictionary_property(cx.raw_cx(), object.handle(), "multisampled", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
4571 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
4572 Ok(ConversionResult::Success(value)) => value,
4573 Ok(ConversionResult::Failure(error)) => {
4574 throw_type_error(cx.raw_cx(), &error);
4575 return Err(());
4576
4577 }
4578 _ => {
4579 return Err(());
4580
4581 },
4582 }
4583
4584 } else {
4585 false
4586 }
4587 },
4588 sampleType: {
4589 rooted!(&in(cx) let mut rval = UndefinedValue());
4590 if get_dictionary_property(cx.raw_cx(), object.handle(), "sampleType", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
4591 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
4592 Ok(ConversionResult::Success(value)) => value,
4593 Ok(ConversionResult::Failure(error)) => {
4594 throw_type_error(cx.raw_cx(), &error); return Err(());
4595
4596 }
4597 _ => {
4598 return Err(());
4599
4600 },
4601 }
4602
4603 } else {
4604 GPUTextureSampleType::Float
4605 }
4606 },
4607 viewDimension: {
4608 rooted!(&in(cx) let mut rval = UndefinedValue());
4609 if get_dictionary_property(cx.raw_cx(), object.handle(), "viewDimension", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
4610 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
4611 Ok(ConversionResult::Success(value)) => value,
4612 Ok(ConversionResult::Failure(error)) => {
4613 throw_type_error(cx.raw_cx(), &error); return Err(());
4614
4615 }
4616 _ => {
4617 return Err(());
4618
4619 },
4620 }
4621
4622 } else {
4623 GPUTextureViewDimension::_2d
4624 }
4625 },
4626 };
4627 Ok(ConversionResult::Success(dictionary))
4628 }
4629 }
4630}
4631
4632impl FromJSValConvertible for GPUTextureBindingLayout {
4633 type Config = ();
4634 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
4635 -> Result<ConversionResult<GPUTextureBindingLayout>, ()> {
4636 GPUTextureBindingLayout::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
4637 }
4638}
4639
4640impl GPUTextureBindingLayout {
4641 #[allow(clippy::wrong_self_convention)]
4642 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
4643 let multisampled = &self.multisampled;
4644 rooted!(in(cx) let mut multisampled_js = UndefinedValue());
4645 multisampled.to_jsval(cx, multisampled_js.handle_mut());
4646 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "multisampled", multisampled_js.handle()).unwrap();
4647 let sampleType = &self.sampleType;
4648 rooted!(in(cx) let mut sampleType_js = UndefinedValue());
4649 sampleType.to_jsval(cx, sampleType_js.handle_mut());
4650 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "sampleType", sampleType_js.handle()).unwrap();
4651 let viewDimension = &self.viewDimension;
4652 rooted!(in(cx) let mut viewDimension_js = UndefinedValue());
4653 viewDimension.to_jsval(cx, viewDimension_js.handle_mut());
4654 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "viewDimension", viewDimension_js.handle()).unwrap();
4655 }
4656}
4657
4658impl ToJSValConvertible for GPUTextureBindingLayout {
4659 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
4660 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
4661 self.to_jsobject(cx, obj.handle_mut());
4662 rval.set(ObjectOrNullValue(obj.get()))
4663 }
4664}
4665
4666
4667#[derive(JSTraceable)]
4668pub struct GPUStorageTextureBindingLayout {
4669 pub access: GPUStorageTextureAccess,
4670 pub format: GPUTextureFormat,
4671 pub viewDimension: GPUTextureViewDimension,
4672}
4673
4674impl GPUStorageTextureBindingLayout {
4675
4676 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
4677 -> Result<ConversionResult<GPUStorageTextureBindingLayout>, ()> {
4678 unsafe {
4679 let object = if val.get().is_null_or_undefined() {
4680 ptr::null_mut()
4681 } else if val.get().is_object() {
4682 val.get().to_object()
4683 } else {
4684 return Ok(ConversionResult::Failure("Value is not an object.".into()));
4685 };
4686 rooted!(&in(cx) let object = object);
4687 let dictionary = GPUStorageTextureBindingLayout {
4688 access: {
4689 rooted!(&in(cx) let mut rval = UndefinedValue());
4690 if get_dictionary_property(cx.raw_cx(), object.handle(), "access", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
4691 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
4692 Ok(ConversionResult::Success(value)) => value,
4693 Ok(ConversionResult::Failure(error)) => {
4694 throw_type_error(cx.raw_cx(), &error); return Err(());
4695
4696 }
4697 _ => {
4698 return Err(());
4699
4700 },
4701 }
4702
4703 } else {
4704 GPUStorageTextureAccess::Write_only
4705 }
4706 },
4707 format: {
4708 rooted!(&in(cx) let mut rval = UndefinedValue());
4709 if get_dictionary_property(cx.raw_cx(), object.handle(), "format", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
4710 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
4711 Ok(ConversionResult::Success(value)) => value,
4712 Ok(ConversionResult::Failure(error)) => {
4713 throw_type_error(cx.raw_cx(), &error); return Err(());
4714
4715 }
4716 _ => {
4717 return Err(());
4718
4719 },
4720 }
4721
4722 } else {
4723 throw_type_error(cx.raw_cx(), "Missing required member \"format\".");
4724 return Err(());
4725 }
4726 },
4727 viewDimension: {
4728 rooted!(&in(cx) let mut rval = UndefinedValue());
4729 if get_dictionary_property(cx.raw_cx(), object.handle(), "viewDimension", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
4730 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
4731 Ok(ConversionResult::Success(value)) => value,
4732 Ok(ConversionResult::Failure(error)) => {
4733 throw_type_error(cx.raw_cx(), &error); return Err(());
4734
4735 }
4736 _ => {
4737 return Err(());
4738
4739 },
4740 }
4741
4742 } else {
4743 GPUTextureViewDimension::_2d
4744 }
4745 },
4746 };
4747 Ok(ConversionResult::Success(dictionary))
4748 }
4749 }
4750}
4751
4752impl FromJSValConvertible for GPUStorageTextureBindingLayout {
4753 type Config = ();
4754 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
4755 -> Result<ConversionResult<GPUStorageTextureBindingLayout>, ()> {
4756 GPUStorageTextureBindingLayout::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
4757 }
4758}
4759
4760impl GPUStorageTextureBindingLayout {
4761 #[allow(clippy::wrong_self_convention)]
4762 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
4763 let access = &self.access;
4764 rooted!(in(cx) let mut access_js = UndefinedValue());
4765 access.to_jsval(cx, access_js.handle_mut());
4766 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "access", access_js.handle()).unwrap();
4767 let format = &self.format;
4768 rooted!(in(cx) let mut format_js = UndefinedValue());
4769 format.to_jsval(cx, format_js.handle_mut());
4770 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "format", format_js.handle()).unwrap();
4771 let viewDimension = &self.viewDimension;
4772 rooted!(in(cx) let mut viewDimension_js = UndefinedValue());
4773 viewDimension.to_jsval(cx, viewDimension_js.handle_mut());
4774 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "viewDimension", viewDimension_js.handle()).unwrap();
4775 }
4776}
4777
4778impl ToJSValConvertible for GPUStorageTextureBindingLayout {
4779 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
4780 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
4781 self.to_jsobject(cx, obj.handle_mut());
4782 rval.set(ObjectOrNullValue(obj.get()))
4783 }
4784}
4785
4786
4787#[derive(JSTraceable)]
4788pub struct GPUExternalTextureBindingLayout {
4789
4790}
4791impl Default for GPUExternalTextureBindingLayout {
4792 fn default() -> Self {
4793 Self::empty()
4794 }
4795}
4796
4797impl GPUExternalTextureBindingLayout {
4798 pub fn empty() -> Self {
4799 Self {
4800 }
4801 }
4802 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
4803 -> Result<ConversionResult<GPUExternalTextureBindingLayout>, ()> {
4804 {
4805 let object = if val.get().is_null_or_undefined() {
4806 ptr::null_mut()
4807 } else if val.get().is_object() {
4808 val.get().to_object()
4809 } else {
4810 return Ok(ConversionResult::Failure("Value is not an object.".into()));
4811 };
4812 rooted!(&in(cx) let object = object);
4813 let dictionary = GPUExternalTextureBindingLayout {
4814 };
4815 Ok(ConversionResult::Success(dictionary))
4816 }
4817 }
4818}
4819
4820impl FromJSValConvertible for GPUExternalTextureBindingLayout {
4821 type Config = ();
4822 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
4823 -> Result<ConversionResult<GPUExternalTextureBindingLayout>, ()> {
4824 GPUExternalTextureBindingLayout::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
4825 }
4826}
4827
4828impl GPUExternalTextureBindingLayout {
4829 #[allow(clippy::wrong_self_convention)]
4830 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
4831 }
4832}
4833
4834impl ToJSValConvertible for GPUExternalTextureBindingLayout {
4835 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
4836 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
4837 self.to_jsobject(cx, obj.handle_mut());
4838 rval.set(ObjectOrNullValue(obj.get()))
4839 }
4840}
4841
4842
4843#[derive(JSTraceable)]
4844pub struct GPUBindGroupDescriptor<D: DomTypes> {
4845 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase,
4846 pub entries: Vec<crate::codegen::GenericBindings::WebGPUBinding::GPUBindGroupEntry<D>>,
4847 pub layout: DomRoot<D::GPUBindGroupLayout>,
4848}
4849
4850impl<D: DomTypes> GPUBindGroupDescriptor<D> {
4851
4852 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
4853 -> Result<ConversionResult<GPUBindGroupDescriptor<D>>, ()> {
4854 unsafe {
4855 let object = if val.get().is_null_or_undefined() {
4856 ptr::null_mut()
4857 } else if val.get().is_object() {
4858 val.get().to_object()
4859 } else {
4860 return Ok(ConversionResult::Failure("Value is not an object.".into()));
4861 };
4862 rooted!(&in(cx) let object = object);
4863 let dictionary = GPUBindGroupDescriptor {
4864 parent: {
4865 match crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val, can_gc)? {
4866 ConversionResult::Success(v) => v,
4867 ConversionResult::Failure(error) => {
4868 throw_type_error(cx.raw_cx(), &error);
4869 return Err(());
4870 }
4871 }
4872 },
4873 entries: {
4874 rooted!(&in(cx) let mut rval = UndefinedValue());
4875 if get_dictionary_property(cx.raw_cx(), object.handle(), "entries", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
4876 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
4877 Ok(ConversionResult::Success(value)) => value,
4878 Ok(ConversionResult::Failure(error)) => {
4879 throw_type_error(cx.raw_cx(), &error);
4880 return Err(());
4881
4882 }
4883 _ => {
4884 return Err(());
4885
4886 },
4887 }
4888
4889 } else {
4890 throw_type_error(cx.raw_cx(), "Missing required member \"entries\".");
4891 return Err(());
4892 }
4893 },
4894 layout: {
4895 rooted!(&in(cx) let mut rval = UndefinedValue());
4896 if get_dictionary_property(cx.raw_cx(), object.handle(), "layout", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
4897 if rval.handle().get().is_object() {
4898 match root_from_handlevalue(rval.handle(), SafeJSContext::from_ptr(cx.raw_cx())) {
4899 Ok(val) => val,
4900 Err(()) => {
4901 throw_type_error(cx.raw_cx(), "value does not implement interface GPUBindGroupLayout.");
4902 return Err(());
4903
4904 }
4905 }
4906
4907 } else {
4908 throw_type_error(cx.raw_cx(), "Value is not an object.");
4909 return Err(());
4910
4911 }
4912 } else {
4913 throw_type_error(cx.raw_cx(), "Missing required member \"layout\".");
4914 return Err(());
4915 }
4916 },
4917 };
4918 Ok(ConversionResult::Success(dictionary))
4919 }
4920 }
4921}
4922
4923impl<D: DomTypes> FromJSValConvertible for GPUBindGroupDescriptor<D> {
4924 type Config = ();
4925 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
4926 -> Result<ConversionResult<GPUBindGroupDescriptor<D>>, ()> {
4927 GPUBindGroupDescriptor::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
4928 }
4929}
4930
4931impl<D: DomTypes> GPUBindGroupDescriptor<D> {
4932 #[allow(clippy::wrong_self_convention)]
4933 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
4934 self.parent.to_jsobject(cx, obj.reborrow());
4935 let entries = &self.entries;
4936 rooted!(in(cx) let mut entries_js = UndefinedValue());
4937 entries.to_jsval(cx, entries_js.handle_mut());
4938 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "entries", entries_js.handle()).unwrap();
4939 let layout = &self.layout;
4940 rooted!(in(cx) let mut layout_js = UndefinedValue());
4941 layout.to_jsval(cx, layout_js.handle_mut());
4942 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "layout", layout_js.handle()).unwrap();
4943 }
4944}
4945
4946impl<D: DomTypes> ToJSValConvertible for GPUBindGroupDescriptor<D> {
4947 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
4948 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
4949 self.to_jsobject(cx, obj.handle_mut());
4950 rval.set(ObjectOrNullValue(obj.get()))
4951 }
4952}
4953
4954
4955#[derive(JSTraceable)]
4956pub struct GPUBindGroupEntry<D: DomTypes> {
4957 pub binding: u32,
4958 pub resource: GenericUnionTypes::GPUSamplerOrGPUTextureViewOrGPUBufferBinding::<D>,
4959}
4960
4961impl<D: DomTypes> GPUBindGroupEntry<D> {
4962
4963 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
4964 -> Result<ConversionResult<GPUBindGroupEntry<D>>, ()> {
4965 unsafe {
4966 let object = if val.get().is_null_or_undefined() {
4967 ptr::null_mut()
4968 } else if val.get().is_object() {
4969 val.get().to_object()
4970 } else {
4971 return Ok(ConversionResult::Failure("Value is not an object.".into()));
4972 };
4973 rooted!(&in(cx) let object = object);
4974 let dictionary = GPUBindGroupEntry {
4975 binding: {
4976 rooted!(&in(cx) let mut rval = UndefinedValue());
4977 if get_dictionary_property(cx.raw_cx(), object.handle(), "binding", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
4978 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
4979 Ok(ConversionResult::Success(value)) => value,
4980 Ok(ConversionResult::Failure(error)) => {
4981 throw_type_error(cx.raw_cx(), &error);
4982 return Err(());
4983
4984 }
4985 _ => {
4986 return Err(());
4987
4988 },
4989 }
4990
4991 } else {
4992 throw_type_error(cx.raw_cx(), "Missing required member \"binding\".");
4993 return Err(());
4994 }
4995 },
4996 resource: {
4997 rooted!(&in(cx) let mut rval = UndefinedValue());
4998 if get_dictionary_property(cx.raw_cx(), object.handle(), "resource", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
4999 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
5000 Ok(ConversionResult::Success(value)) => value,
5001 Ok(ConversionResult::Failure(error)) => {
5002 throw_type_error(cx.raw_cx(), &error);
5003 return Err(());
5004
5005 }
5006 _ => {
5007 return Err(());
5008
5009 },
5010 }
5011
5012 } else {
5013 throw_type_error(cx.raw_cx(), "Missing required member \"resource\".");
5014 return Err(());
5015 }
5016 },
5017 };
5018 Ok(ConversionResult::Success(dictionary))
5019 }
5020 }
5021}
5022
5023impl<D: DomTypes> FromJSValConvertible for GPUBindGroupEntry<D> {
5024 type Config = ();
5025 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
5026 -> Result<ConversionResult<GPUBindGroupEntry<D>>, ()> {
5027 GPUBindGroupEntry::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
5028 }
5029}
5030
5031impl<D: DomTypes> GPUBindGroupEntry<D> {
5032 #[allow(clippy::wrong_self_convention)]
5033 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
5034 let binding = &self.binding;
5035 rooted!(in(cx) let mut binding_js = UndefinedValue());
5036 binding.to_jsval(cx, binding_js.handle_mut());
5037 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "binding", binding_js.handle()).unwrap();
5038 let resource = &self.resource;
5039 rooted!(in(cx) let mut resource_js = UndefinedValue());
5040 resource.to_jsval(cx, resource_js.handle_mut());
5041 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "resource", resource_js.handle()).unwrap();
5042 }
5043}
5044
5045impl<D: DomTypes> ToJSValConvertible for GPUBindGroupEntry<D> {
5046 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
5047 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
5048 self.to_jsobject(cx, obj.handle_mut());
5049 rval.set(ObjectOrNullValue(obj.get()))
5050 }
5051}
5052
5053
5054#[derive(JSTraceable)]
5055pub struct GPUBufferBinding<D: DomTypes> {
5056 pub buffer: DomRoot<D::GPUBuffer>,
5057 pub offset: u64,
5058 pub size: Option<u64>,
5059}
5060
5061impl<D: DomTypes> GPUBufferBinding<D> {
5062
5063 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
5064 -> Result<ConversionResult<GPUBufferBinding<D>>, ()> {
5065 unsafe {
5066 let object = if val.get().is_null_or_undefined() {
5067 ptr::null_mut()
5068 } else if val.get().is_object() {
5069 val.get().to_object()
5070 } else {
5071 return Ok(ConversionResult::Failure("Value is not an object.".into()));
5072 };
5073 rooted!(&in(cx) let object = object);
5074 let dictionary = GPUBufferBinding {
5075 buffer: {
5076 rooted!(&in(cx) let mut rval = UndefinedValue());
5077 if get_dictionary_property(cx.raw_cx(), object.handle(), "buffer", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
5078 if rval.handle().get().is_object() {
5079 match root_from_handlevalue(rval.handle(), SafeJSContext::from_ptr(cx.raw_cx())) {
5080 Ok(val) => val,
5081 Err(()) => {
5082 throw_type_error(cx.raw_cx(), "value does not implement interface GPUBuffer.");
5083 return Err(());
5084
5085 }
5086 }
5087
5088 } else {
5089 throw_type_error(cx.raw_cx(), "Value is not an object.");
5090 return Err(());
5091
5092 }
5093 } else {
5094 throw_type_error(cx.raw_cx(), "Missing required member \"buffer\".");
5095 return Err(());
5096 }
5097 },
5098 offset: {
5099 rooted!(&in(cx) let mut rval = UndefinedValue());
5100 if get_dictionary_property(cx.raw_cx(), object.handle(), "offset", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
5101 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
5102 Ok(ConversionResult::Success(value)) => value,
5103 Ok(ConversionResult::Failure(error)) => {
5104 throw_type_error(cx.raw_cx(), &error);
5105 return Err(());
5106
5107 }
5108 _ => {
5109 return Err(());
5110
5111 },
5112 }
5113
5114 } else {
5115 0
5116 }
5117 },
5118 size: {
5119 rooted!(&in(cx) let mut rval = UndefinedValue());
5120 if get_dictionary_property(cx.raw_cx(), object.handle(), "size", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
5121 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
5122 Ok(ConversionResult::Success(value)) => value,
5123 Ok(ConversionResult::Failure(error)) => {
5124 throw_type_error(cx.raw_cx(), &error);
5125 return Err(());
5126
5127 }
5128 _ => {
5129 return Err(());
5130
5131 },
5132 }
5133 )
5134 } else {
5135 None
5136 }
5137 },
5138 };
5139 Ok(ConversionResult::Success(dictionary))
5140 }
5141 }
5142}
5143
5144impl<D: DomTypes> FromJSValConvertible for GPUBufferBinding<D> {
5145 type Config = ();
5146 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
5147 -> Result<ConversionResult<GPUBufferBinding<D>>, ()> {
5148 GPUBufferBinding::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
5149 }
5150}
5151
5152impl<D: DomTypes> GPUBufferBinding<D> {
5153 #[allow(clippy::wrong_self_convention)]
5154 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
5155 let buffer = &self.buffer;
5156 rooted!(in(cx) let mut buffer_js = UndefinedValue());
5157 buffer.to_jsval(cx, buffer_js.handle_mut());
5158 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "buffer", buffer_js.handle()).unwrap();
5159 let offset = &self.offset;
5160 rooted!(in(cx) let mut offset_js = UndefinedValue());
5161 offset.to_jsval(cx, offset_js.handle_mut());
5162 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "offset", offset_js.handle()).unwrap();
5163 if let Some(ref size) = self.size {
5164 rooted!(in(cx) let mut size_js = UndefinedValue());
5165 size.to_jsval(cx, size_js.handle_mut());
5166 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "size", size_js.handle()).unwrap();
5167 }
5168 }
5169}
5170
5171impl<D: DomTypes> ToJSValConvertible for GPUBufferBinding<D> {
5172 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
5173 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
5174 self.to_jsobject(cx, obj.handle_mut());
5175 rval.set(ObjectOrNullValue(obj.get()))
5176 }
5177}
5178
5179
5180#[derive(JSTraceable)]
5181pub struct GPUPipelineLayoutDescriptor<D: DomTypes> {
5182 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase,
5183 pub bindGroupLayouts: Vec<DomRoot<D::GPUBindGroupLayout>>,
5184}
5185
5186impl<D: DomTypes> GPUPipelineLayoutDescriptor<D> {
5187
5188 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
5189 -> Result<ConversionResult<GPUPipelineLayoutDescriptor<D>>, ()> {
5190 unsafe {
5191 let object = if val.get().is_null_or_undefined() {
5192 ptr::null_mut()
5193 } else if val.get().is_object() {
5194 val.get().to_object()
5195 } else {
5196 return Ok(ConversionResult::Failure("Value is not an object.".into()));
5197 };
5198 rooted!(&in(cx) let object = object);
5199 let dictionary = GPUPipelineLayoutDescriptor {
5200 parent: {
5201 match crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val, can_gc)? {
5202 ConversionResult::Success(v) => v,
5203 ConversionResult::Failure(error) => {
5204 throw_type_error(cx.raw_cx(), &error);
5205 return Err(());
5206 }
5207 }
5208 },
5209 bindGroupLayouts: {
5210 rooted!(&in(cx) let mut rval = UndefinedValue());
5211 if get_dictionary_property(cx.raw_cx(), object.handle(), "bindGroupLayouts", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
5212 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
5213 Ok(ConversionResult::Success(value)) => value,
5214 Ok(ConversionResult::Failure(error)) => {
5215 throw_type_error(cx.raw_cx(), &error);
5216 return Err(());
5217
5218 }
5219 _ => {
5220 return Err(());
5221
5222 },
5223 }
5224
5225 } else {
5226 throw_type_error(cx.raw_cx(), "Missing required member \"bindGroupLayouts\".");
5227 return Err(());
5228 }
5229 },
5230 };
5231 Ok(ConversionResult::Success(dictionary))
5232 }
5233 }
5234}
5235
5236impl<D: DomTypes> FromJSValConvertible for GPUPipelineLayoutDescriptor<D> {
5237 type Config = ();
5238 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
5239 -> Result<ConversionResult<GPUPipelineLayoutDescriptor<D>>, ()> {
5240 GPUPipelineLayoutDescriptor::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
5241 }
5242}
5243
5244impl<D: DomTypes> GPUPipelineLayoutDescriptor<D> {
5245 #[allow(clippy::wrong_self_convention)]
5246 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
5247 self.parent.to_jsobject(cx, obj.reborrow());
5248 let bindGroupLayouts = &self.bindGroupLayouts;
5249 rooted!(in(cx) let mut bindGroupLayouts_js = UndefinedValue());
5250 bindGroupLayouts.to_jsval(cx, bindGroupLayouts_js.handle_mut());
5251 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "bindGroupLayouts", bindGroupLayouts_js.handle()).unwrap();
5252 }
5253}
5254
5255impl<D: DomTypes> ToJSValConvertible for GPUPipelineLayoutDescriptor<D> {
5256 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
5257 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
5258 self.to_jsobject(cx, obj.handle_mut());
5259 rval.set(ObjectOrNullValue(obj.get()))
5260 }
5261}
5262
5263
5264#[derive(JSTraceable)]
5265#[cfg_attr(crown, crown::unrooted_must_root_lint::must_root)]
5266pub struct GPUShaderModuleDescriptor {
5267 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase,
5268 pub code: USVString,
5269 pub sourceMap: Option<RootedTraceableBox<Heap<*mut JSObject>>>,
5270}
5271
5272impl GPUShaderModuleDescriptor {
5273
5274 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
5275 -> Result<ConversionResult<RootedTraceableBox<GPUShaderModuleDescriptor>>, ()> {
5276 unsafe {
5277 let object = if val.get().is_null_or_undefined() {
5278 ptr::null_mut()
5279 } else if val.get().is_object() {
5280 val.get().to_object()
5281 } else {
5282 return Ok(ConversionResult::Failure("Value is not an object.".into()));
5283 };
5284 rooted!(&in(cx) let object = object);
5285 let dictionary = RootedTraceableBox::new(GPUShaderModuleDescriptor {
5286 parent: {
5287 match crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val, can_gc)? {
5288 ConversionResult::Success(v) => v,
5289 ConversionResult::Failure(error) => {
5290 throw_type_error(cx.raw_cx(), &error);
5291 return Err(());
5292 }
5293 }
5294 },
5295 code: {
5296 rooted!(&in(cx) let mut rval = UndefinedValue());
5297 if get_dictionary_property(cx.raw_cx(), object.handle(), "code", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
5298 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
5299 Ok(ConversionResult::Success(value)) => value,
5300 Ok(ConversionResult::Failure(error)) => {
5301 throw_type_error(cx.raw_cx(), &error);
5302 return Err(());
5303
5304 }
5305 _ => {
5306 return Err(());
5307
5308 },
5309 }
5310
5311 } else {
5312 throw_type_error(cx.raw_cx(), "Missing required member \"code\".");
5313 return Err(());
5314 }
5315 },
5316 sourceMap: {
5317 rooted!(&in(cx) let mut rval = UndefinedValue());
5318 if get_dictionary_property(cx.raw_cx(), object.handle(), "sourceMap", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
5319 Some(if rval.handle().get().is_object() {
5320 RootedTraceableBox::from_box(Heap::boxed(rval.handle().get().to_object()))
5321 } else {
5322 throw_type_error(cx.raw_cx(), "Value is not an object.");
5323 return Err(());
5324
5325 })
5326 } else {
5327 None
5328 }
5329 },
5330 });
5331 Ok(ConversionResult::Success(dictionary))
5332 }
5333 }
5334}
5335
5336impl FromJSValConvertible for RootedTraceableBox<GPUShaderModuleDescriptor> {
5337 type Config = ();
5338 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
5339 -> Result<ConversionResult<RootedTraceableBox<GPUShaderModuleDescriptor>>, ()> {
5340 GPUShaderModuleDescriptor::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
5341 }
5342}
5343
5344impl GPUShaderModuleDescriptor {
5345 #[allow(clippy::wrong_self_convention)]
5346 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
5347 self.parent.to_jsobject(cx, obj.reborrow());
5348 let code = &self.code;
5349 rooted!(in(cx) let mut code_js = UndefinedValue());
5350 code.to_jsval(cx, code_js.handle_mut());
5351 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "code", code_js.handle()).unwrap();
5352 if let Some(ref sourceMap) = self.sourceMap {
5353 rooted!(in(cx) let mut sourceMap_js = UndefinedValue());
5354 sourceMap.to_jsval(cx, sourceMap_js.handle_mut());
5355 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "sourceMap", sourceMap_js.handle()).unwrap();
5356 }
5357 }
5358}
5359
5360impl ToJSValConvertible for GPUShaderModuleDescriptor {
5361 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
5362 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
5363 self.to_jsobject(cx, obj.handle_mut());
5364 rval.set(ObjectOrNullValue(obj.get()))
5365 }
5366}
5367
5368
5369#[derive(JSTraceable)]
5370pub struct GPUPipelineErrorInit {
5371 pub reason: GPUPipelineErrorReason,
5372}
5373
5374impl GPUPipelineErrorInit {
5375
5376 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
5377 -> Result<ConversionResult<GPUPipelineErrorInit>, ()> {
5378 unsafe {
5379 let object = if val.get().is_null_or_undefined() {
5380 ptr::null_mut()
5381 } else if val.get().is_object() {
5382 val.get().to_object()
5383 } else {
5384 return Ok(ConversionResult::Failure("Value is not an object.".into()));
5385 };
5386 rooted!(&in(cx) let object = object);
5387 let dictionary = GPUPipelineErrorInit {
5388 reason: {
5389 rooted!(&in(cx) let mut rval = UndefinedValue());
5390 if get_dictionary_property(cx.raw_cx(), object.handle(), "reason", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
5391 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
5392 Ok(ConversionResult::Success(value)) => value,
5393 Ok(ConversionResult::Failure(error)) => {
5394 throw_type_error(cx.raw_cx(), &error); return Err(());
5395
5396 }
5397 _ => {
5398 return Err(());
5399
5400 },
5401 }
5402
5403 } else {
5404 throw_type_error(cx.raw_cx(), "Missing required member \"reason\".");
5405 return Err(());
5406 }
5407 },
5408 };
5409 Ok(ConversionResult::Success(dictionary))
5410 }
5411 }
5412}
5413
5414impl FromJSValConvertible for GPUPipelineErrorInit {
5415 type Config = ();
5416 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
5417 -> Result<ConversionResult<GPUPipelineErrorInit>, ()> {
5418 GPUPipelineErrorInit::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
5419 }
5420}
5421
5422impl GPUPipelineErrorInit {
5423 #[allow(clippy::wrong_self_convention)]
5424 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
5425 let reason = &self.reason;
5426 rooted!(in(cx) let mut reason_js = UndefinedValue());
5427 reason.to_jsval(cx, reason_js.handle_mut());
5428 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "reason", reason_js.handle()).unwrap();
5429 }
5430}
5431
5432impl ToJSValConvertible for GPUPipelineErrorInit {
5433 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
5434 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
5435 self.to_jsobject(cx, obj.handle_mut());
5436 rval.set(ObjectOrNullValue(obj.get()))
5437 }
5438}
5439
5440
5441#[derive(JSTraceable)]
5442pub struct GPUPipelineDescriptorBase<D: DomTypes> {
5443 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase,
5444 pub layout: GenericUnionTypes::GPUPipelineLayoutOrGPUAutoLayoutMode::<D>,
5445}
5446
5447impl<D: DomTypes> GPUPipelineDescriptorBase<D> {
5448
5449 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
5450 -> Result<ConversionResult<GPUPipelineDescriptorBase<D>>, ()> {
5451 unsafe {
5452 let object = if val.get().is_null_or_undefined() {
5453 ptr::null_mut()
5454 } else if val.get().is_object() {
5455 val.get().to_object()
5456 } else {
5457 return Ok(ConversionResult::Failure("Value is not an object.".into()));
5458 };
5459 rooted!(&in(cx) let object = object);
5460 let dictionary = GPUPipelineDescriptorBase {
5461 parent: {
5462 match crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val, can_gc)? {
5463 ConversionResult::Success(v) => v,
5464 ConversionResult::Failure(error) => {
5465 throw_type_error(cx.raw_cx(), &error);
5466 return Err(());
5467 }
5468 }
5469 },
5470 layout: {
5471 rooted!(&in(cx) let mut rval = UndefinedValue());
5472 if get_dictionary_property(cx.raw_cx(), object.handle(), "layout", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
5473 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
5474 Ok(ConversionResult::Success(value)) => value,
5475 Ok(ConversionResult::Failure(error)) => {
5476 throw_type_error(cx.raw_cx(), &error);
5477 return Err(());
5478
5479 }
5480 _ => {
5481 return Err(());
5482
5483 },
5484 }
5485
5486 } else {
5487 throw_type_error(cx.raw_cx(), "Missing required member \"layout\".");
5488 return Err(());
5489 }
5490 },
5491 };
5492 Ok(ConversionResult::Success(dictionary))
5493 }
5494 }
5495}
5496
5497impl<D: DomTypes> FromJSValConvertible for GPUPipelineDescriptorBase<D> {
5498 type Config = ();
5499 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
5500 -> Result<ConversionResult<GPUPipelineDescriptorBase<D>>, ()> {
5501 GPUPipelineDescriptorBase::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
5502 }
5503}
5504
5505impl<D: DomTypes> GPUPipelineDescriptorBase<D> {
5506 #[allow(clippy::wrong_self_convention)]
5507 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
5508 self.parent.to_jsobject(cx, obj.reborrow());
5509 let layout = &self.layout;
5510 rooted!(in(cx) let mut layout_js = UndefinedValue());
5511 layout.to_jsval(cx, layout_js.handle_mut());
5512 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "layout", layout_js.handle()).unwrap();
5513 }
5514}
5515
5516impl<D: DomTypes> ToJSValConvertible for GPUPipelineDescriptorBase<D> {
5517 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
5518 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
5519 self.to_jsobject(cx, obj.handle_mut());
5520 rval.set(ObjectOrNullValue(obj.get()))
5521 }
5522}
5523
5524
5525#[derive(JSTraceable)]
5526pub struct GPUProgrammableStage<D: DomTypes> {
5527 pub constants: Option<Record<USVString, Finite<f64>>>,
5528 pub entryPoint: Option<USVString>,
5529 pub module: DomRoot<D::GPUShaderModule>,
5530}
5531
5532impl<D: DomTypes> GPUProgrammableStage<D> {
5533
5534 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
5535 -> Result<ConversionResult<GPUProgrammableStage<D>>, ()> {
5536 unsafe {
5537 let object = if val.get().is_null_or_undefined() {
5538 ptr::null_mut()
5539 } else if val.get().is_object() {
5540 val.get().to_object()
5541 } else {
5542 return Ok(ConversionResult::Failure("Value is not an object.".into()));
5543 };
5544 rooted!(&in(cx) let object = object);
5545 let dictionary = GPUProgrammableStage {
5546 constants: {
5547 rooted!(&in(cx) let mut rval = UndefinedValue());
5548 if get_dictionary_property(cx.raw_cx(), object.handle(), "constants", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
5549 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
5550 Ok(ConversionResult::Success(value)) => value,
5551 Ok(ConversionResult::Failure(error)) => {
5552 throw_type_error(cx.raw_cx(), &error);
5553 return Err(());
5554
5555 }
5556 _ => {
5557 return Err(());
5558
5559 },
5560 }
5561 )
5562 } else {
5563 None
5564 }
5565 },
5566 entryPoint: {
5567 rooted!(&in(cx) let mut rval = UndefinedValue());
5568 if get_dictionary_property(cx.raw_cx(), object.handle(), "entryPoint", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
5569 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
5570 Ok(ConversionResult::Success(value)) => value,
5571 Ok(ConversionResult::Failure(error)) => {
5572 throw_type_error(cx.raw_cx(), &error);
5573 return Err(());
5574
5575 }
5576 _ => {
5577 return Err(());
5578
5579 },
5580 }
5581 )
5582 } else {
5583 None
5584 }
5585 },
5586 module: {
5587 rooted!(&in(cx) let mut rval = UndefinedValue());
5588 if get_dictionary_property(cx.raw_cx(), object.handle(), "module", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
5589 if rval.handle().get().is_object() {
5590 match root_from_handlevalue(rval.handle(), SafeJSContext::from_ptr(cx.raw_cx())) {
5591 Ok(val) => val,
5592 Err(()) => {
5593 throw_type_error(cx.raw_cx(), "value does not implement interface GPUShaderModule.");
5594 return Err(());
5595
5596 }
5597 }
5598
5599 } else {
5600 throw_type_error(cx.raw_cx(), "Value is not an object.");
5601 return Err(());
5602
5603 }
5604 } else {
5605 throw_type_error(cx.raw_cx(), "Missing required member \"module\".");
5606 return Err(());
5607 }
5608 },
5609 };
5610 Ok(ConversionResult::Success(dictionary))
5611 }
5612 }
5613}
5614
5615impl<D: DomTypes> FromJSValConvertible for GPUProgrammableStage<D> {
5616 type Config = ();
5617 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
5618 -> Result<ConversionResult<GPUProgrammableStage<D>>, ()> {
5619 GPUProgrammableStage::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
5620 }
5621}
5622
5623impl<D: DomTypes> GPUProgrammableStage<D> {
5624 #[allow(clippy::wrong_self_convention)]
5625 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
5626 if let Some(ref constants) = self.constants {
5627 rooted!(in(cx) let mut constants_js = UndefinedValue());
5628 constants.to_jsval(cx, constants_js.handle_mut());
5629 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "constants", constants_js.handle()).unwrap();
5630 }
5631 if let Some(ref entryPoint) = self.entryPoint {
5632 rooted!(in(cx) let mut entryPoint_js = UndefinedValue());
5633 entryPoint.to_jsval(cx, entryPoint_js.handle_mut());
5634 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "entryPoint", entryPoint_js.handle()).unwrap();
5635 }
5636 let module = &self.module;
5637 rooted!(in(cx) let mut module_js = UndefinedValue());
5638 module.to_jsval(cx, module_js.handle_mut());
5639 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "module", module_js.handle()).unwrap();
5640 }
5641}
5642
5643impl<D: DomTypes> ToJSValConvertible for GPUProgrammableStage<D> {
5644 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
5645 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
5646 self.to_jsobject(cx, obj.handle_mut());
5647 rval.set(ObjectOrNullValue(obj.get()))
5648 }
5649}
5650
5651
5652#[derive(JSTraceable)]
5653pub struct GPUComputePipelineDescriptor<D: DomTypes> {
5654 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUPipelineDescriptorBase<D>,
5655 pub compute: crate::codegen::GenericBindings::WebGPUBinding::GPUProgrammableStage<D>,
5656}
5657
5658impl<D: DomTypes> GPUComputePipelineDescriptor<D> {
5659
5660 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
5661 -> Result<ConversionResult<GPUComputePipelineDescriptor<D>>, ()> {
5662 unsafe {
5663 let object = if val.get().is_null_or_undefined() {
5664 ptr::null_mut()
5665 } else if val.get().is_object() {
5666 val.get().to_object()
5667 } else {
5668 return Ok(ConversionResult::Failure("Value is not an object.".into()));
5669 };
5670 rooted!(&in(cx) let object = object);
5671 let dictionary = GPUComputePipelineDescriptor {
5672 parent: {
5673 match crate::codegen::GenericBindings::WebGPUBinding::GPUPipelineDescriptorBase::new(cx, val, can_gc)? {
5674 ConversionResult::Success(v) => v,
5675 ConversionResult::Failure(error) => {
5676 throw_type_error(cx.raw_cx(), &error);
5677 return Err(());
5678 }
5679 }
5680 },
5681 compute: {
5682 rooted!(&in(cx) let mut rval = UndefinedValue());
5683 if get_dictionary_property(cx.raw_cx(), object.handle(), "compute", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
5684 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
5685 Ok(ConversionResult::Success(value)) => value,
5686 Ok(ConversionResult::Failure(error)) => {
5687 throw_type_error(cx.raw_cx(), &error);
5688 return Err(());
5689
5690 }
5691 _ => {
5692 return Err(());
5693
5694 },
5695 }
5696
5697 } else {
5698 throw_type_error(cx.raw_cx(), "Missing required member \"compute\".");
5699 return Err(());
5700 }
5701 },
5702 };
5703 Ok(ConversionResult::Success(dictionary))
5704 }
5705 }
5706}
5707
5708impl<D: DomTypes> FromJSValConvertible for GPUComputePipelineDescriptor<D> {
5709 type Config = ();
5710 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
5711 -> Result<ConversionResult<GPUComputePipelineDescriptor<D>>, ()> {
5712 GPUComputePipelineDescriptor::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
5713 }
5714}
5715
5716impl<D: DomTypes> GPUComputePipelineDescriptor<D> {
5717 #[allow(clippy::wrong_self_convention)]
5718 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
5719 self.parent.to_jsobject(cx, obj.reborrow());
5720 let compute = &self.compute;
5721 rooted!(in(cx) let mut compute_js = UndefinedValue());
5722 compute.to_jsval(cx, compute_js.handle_mut());
5723 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "compute", compute_js.handle()).unwrap();
5724 }
5725}
5726
5727impl<D: DomTypes> ToJSValConvertible for GPUComputePipelineDescriptor<D> {
5728 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
5729 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
5730 self.to_jsobject(cx, obj.handle_mut());
5731 rval.set(ObjectOrNullValue(obj.get()))
5732 }
5733}
5734
5735
5736#[derive(JSTraceable)]
5737pub struct GPURenderPipelineDescriptor<D: DomTypes> {
5738 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUPipelineDescriptorBase<D>,
5739 pub depthStencil: Option<crate::codegen::GenericBindings::WebGPUBinding::GPUDepthStencilState>,
5740 pub fragment: Option<crate::codegen::GenericBindings::WebGPUBinding::GPUFragmentState<D>>,
5741 pub multisample: crate::codegen::GenericBindings::WebGPUBinding::GPUMultisampleState,
5742 pub primitive: crate::codegen::GenericBindings::WebGPUBinding::GPUPrimitiveState,
5743 pub vertex: crate::codegen::GenericBindings::WebGPUBinding::GPUVertexState<D>,
5744}
5745
5746impl<D: DomTypes> GPURenderPipelineDescriptor<D> {
5747
5748 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
5749 -> Result<ConversionResult<GPURenderPipelineDescriptor<D>>, ()> {
5750 unsafe {
5751 let object = if val.get().is_null_or_undefined() {
5752 ptr::null_mut()
5753 } else if val.get().is_object() {
5754 val.get().to_object()
5755 } else {
5756 return Ok(ConversionResult::Failure("Value is not an object.".into()));
5757 };
5758 rooted!(&in(cx) let object = object);
5759 let dictionary = GPURenderPipelineDescriptor {
5760 parent: {
5761 match crate::codegen::GenericBindings::WebGPUBinding::GPUPipelineDescriptorBase::new(cx, val, can_gc)? {
5762 ConversionResult::Success(v) => v,
5763 ConversionResult::Failure(error) => {
5764 throw_type_error(cx.raw_cx(), &error);
5765 return Err(());
5766 }
5767 }
5768 },
5769 depthStencil: {
5770 rooted!(&in(cx) let mut rval = UndefinedValue());
5771 if get_dictionary_property(cx.raw_cx(), object.handle(), "depthStencil", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
5772 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
5773 Ok(ConversionResult::Success(value)) => value,
5774 Ok(ConversionResult::Failure(error)) => {
5775 throw_type_error(cx.raw_cx(), &error);
5776 return Err(());
5777
5778 }
5779 _ => {
5780 return Err(());
5781
5782 },
5783 }
5784 )
5785 } else {
5786 None
5787 }
5788 },
5789 fragment: {
5790 rooted!(&in(cx) let mut rval = UndefinedValue());
5791 if get_dictionary_property(cx.raw_cx(), object.handle(), "fragment", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
5792 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
5793 Ok(ConversionResult::Success(value)) => value,
5794 Ok(ConversionResult::Failure(error)) => {
5795 throw_type_error(cx.raw_cx(), &error);
5796 return Err(());
5797
5798 }
5799 _ => {
5800 return Err(());
5801
5802 },
5803 }
5804 )
5805 } else {
5806 None
5807 }
5808 },
5809 multisample: {
5810 rooted!(&in(cx) let mut rval = UndefinedValue());
5811 if get_dictionary_property(cx.raw_cx(), object.handle(), "multisample", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
5812 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
5813 Ok(ConversionResult::Success(value)) => value,
5814 Ok(ConversionResult::Failure(error)) => {
5815 throw_type_error(cx.raw_cx(), &error);
5816 return Err(());
5817
5818 }
5819 _ => {
5820 return Err(());
5821
5822 },
5823 }
5824
5825 } else {
5826 crate::codegen::GenericBindings::WebGPUBinding::GPUMultisampleState::empty()
5827 }
5828 },
5829 primitive: {
5830 rooted!(&in(cx) let mut rval = UndefinedValue());
5831 if get_dictionary_property(cx.raw_cx(), object.handle(), "primitive", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
5832 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
5833 Ok(ConversionResult::Success(value)) => value,
5834 Ok(ConversionResult::Failure(error)) => {
5835 throw_type_error(cx.raw_cx(), &error);
5836 return Err(());
5837
5838 }
5839 _ => {
5840 return Err(());
5841
5842 },
5843 }
5844
5845 } else {
5846 crate::codegen::GenericBindings::WebGPUBinding::GPUPrimitiveState::empty()
5847 }
5848 },
5849 vertex: {
5850 rooted!(&in(cx) let mut rval = UndefinedValue());
5851 if get_dictionary_property(cx.raw_cx(), object.handle(), "vertex", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
5852 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
5853 Ok(ConversionResult::Success(value)) => value,
5854 Ok(ConversionResult::Failure(error)) => {
5855 throw_type_error(cx.raw_cx(), &error);
5856 return Err(());
5857
5858 }
5859 _ => {
5860 return Err(());
5861
5862 },
5863 }
5864
5865 } else {
5866 throw_type_error(cx.raw_cx(), "Missing required member \"vertex\".");
5867 return Err(());
5868 }
5869 },
5870 };
5871 Ok(ConversionResult::Success(dictionary))
5872 }
5873 }
5874}
5875
5876impl<D: DomTypes> FromJSValConvertible for GPURenderPipelineDescriptor<D> {
5877 type Config = ();
5878 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
5879 -> Result<ConversionResult<GPURenderPipelineDescriptor<D>>, ()> {
5880 GPURenderPipelineDescriptor::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
5881 }
5882}
5883
5884impl<D: DomTypes> GPURenderPipelineDescriptor<D> {
5885 #[allow(clippy::wrong_self_convention)]
5886 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
5887 self.parent.to_jsobject(cx, obj.reborrow());
5888 if let Some(ref depthStencil) = self.depthStencil {
5889 rooted!(in(cx) let mut depthStencil_js = UndefinedValue());
5890 depthStencil.to_jsval(cx, depthStencil_js.handle_mut());
5891 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "depthStencil", depthStencil_js.handle()).unwrap();
5892 }
5893 if let Some(ref fragment) = self.fragment {
5894 rooted!(in(cx) let mut fragment_js = UndefinedValue());
5895 fragment.to_jsval(cx, fragment_js.handle_mut());
5896 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "fragment", fragment_js.handle()).unwrap();
5897 }
5898 let multisample = &self.multisample;
5899 rooted!(in(cx) let mut multisample_js = UndefinedValue());
5900 multisample.to_jsval(cx, multisample_js.handle_mut());
5901 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "multisample", multisample_js.handle()).unwrap();
5902 let primitive = &self.primitive;
5903 rooted!(in(cx) let mut primitive_js = UndefinedValue());
5904 primitive.to_jsval(cx, primitive_js.handle_mut());
5905 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "primitive", primitive_js.handle()).unwrap();
5906 let vertex = &self.vertex;
5907 rooted!(in(cx) let mut vertex_js = UndefinedValue());
5908 vertex.to_jsval(cx, vertex_js.handle_mut());
5909 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "vertex", vertex_js.handle()).unwrap();
5910 }
5911}
5912
5913impl<D: DomTypes> ToJSValConvertible for GPURenderPipelineDescriptor<D> {
5914 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
5915 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
5916 self.to_jsobject(cx, obj.handle_mut());
5917 rval.set(ObjectOrNullValue(obj.get()))
5918 }
5919}
5920
5921
5922#[derive(JSTraceable)]
5923pub struct GPUPrimitiveState {
5924 pub clampDepth: bool,
5925 pub cullMode: GPUCullMode,
5926 pub frontFace: GPUFrontFace,
5927 pub stripIndexFormat: Option<GPUIndexFormat>,
5928 pub topology: GPUPrimitiveTopology,
5929}
5930impl Default for GPUPrimitiveState {
5931 fn default() -> Self {
5932 Self::empty()
5933 }
5934}
5935
5936impl GPUPrimitiveState {
5937 pub fn empty() -> Self {
5938 Self {
5939 clampDepth: false,
5940 cullMode: GPUCullMode::None,
5941 frontFace: GPUFrontFace::Ccw,
5942 stripIndexFormat: None,
5943 topology: GPUPrimitiveTopology::Triangle_list,
5944 }
5945 }
5946 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
5947 -> Result<ConversionResult<GPUPrimitiveState>, ()> {
5948 unsafe {
5949 let object = if val.get().is_null_or_undefined() {
5950 ptr::null_mut()
5951 } else if val.get().is_object() {
5952 val.get().to_object()
5953 } else {
5954 return Ok(ConversionResult::Failure("Value is not an object.".into()));
5955 };
5956 rooted!(&in(cx) let object = object);
5957 let dictionary = GPUPrimitiveState {
5958 clampDepth: {
5959 rooted!(&in(cx) let mut rval = UndefinedValue());
5960 if get_dictionary_property(cx.raw_cx(), object.handle(), "clampDepth", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
5961 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
5962 Ok(ConversionResult::Success(value)) => value,
5963 Ok(ConversionResult::Failure(error)) => {
5964 throw_type_error(cx.raw_cx(), &error);
5965 return Err(());
5966
5967 }
5968 _ => {
5969 return Err(());
5970
5971 },
5972 }
5973
5974 } else {
5975 false
5976 }
5977 },
5978 cullMode: {
5979 rooted!(&in(cx) let mut rval = UndefinedValue());
5980 if get_dictionary_property(cx.raw_cx(), object.handle(), "cullMode", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
5981 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
5982 Ok(ConversionResult::Success(value)) => value,
5983 Ok(ConversionResult::Failure(error)) => {
5984 throw_type_error(cx.raw_cx(), &error); return Err(());
5985
5986 }
5987 _ => {
5988 return Err(());
5989
5990 },
5991 }
5992
5993 } else {
5994 GPUCullMode::None
5995 }
5996 },
5997 frontFace: {
5998 rooted!(&in(cx) let mut rval = UndefinedValue());
5999 if get_dictionary_property(cx.raw_cx(), object.handle(), "frontFace", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6000 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
6001 Ok(ConversionResult::Success(value)) => value,
6002 Ok(ConversionResult::Failure(error)) => {
6003 throw_type_error(cx.raw_cx(), &error); return Err(());
6004
6005 }
6006 _ => {
6007 return Err(());
6008
6009 },
6010 }
6011
6012 } else {
6013 GPUFrontFace::Ccw
6014 }
6015 },
6016 stripIndexFormat: {
6017 rooted!(&in(cx) let mut rval = UndefinedValue());
6018 if get_dictionary_property(cx.raw_cx(), object.handle(), "stripIndexFormat", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6019 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
6020 Ok(ConversionResult::Success(value)) => value,
6021 Ok(ConversionResult::Failure(error)) => {
6022 throw_type_error(cx.raw_cx(), &error); return Err(());
6023
6024 }
6025 _ => {
6026 return Err(());
6027
6028 },
6029 }
6030 )
6031 } else {
6032 None
6033 }
6034 },
6035 topology: {
6036 rooted!(&in(cx) let mut rval = UndefinedValue());
6037 if get_dictionary_property(cx.raw_cx(), object.handle(), "topology", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6038 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
6039 Ok(ConversionResult::Success(value)) => value,
6040 Ok(ConversionResult::Failure(error)) => {
6041 throw_type_error(cx.raw_cx(), &error); return Err(());
6042
6043 }
6044 _ => {
6045 return Err(());
6046
6047 },
6048 }
6049
6050 } else {
6051 GPUPrimitiveTopology::Triangle_list
6052 }
6053 },
6054 };
6055 Ok(ConversionResult::Success(dictionary))
6056 }
6057 }
6058}
6059
6060impl FromJSValConvertible for GPUPrimitiveState {
6061 type Config = ();
6062 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
6063 -> Result<ConversionResult<GPUPrimitiveState>, ()> {
6064 GPUPrimitiveState::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
6065 }
6066}
6067
6068impl GPUPrimitiveState {
6069 #[allow(clippy::wrong_self_convention)]
6070 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
6071 let clampDepth = &self.clampDepth;
6072 rooted!(in(cx) let mut clampDepth_js = UndefinedValue());
6073 clampDepth.to_jsval(cx, clampDepth_js.handle_mut());
6074 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "clampDepth", clampDepth_js.handle()).unwrap();
6075 let cullMode = &self.cullMode;
6076 rooted!(in(cx) let mut cullMode_js = UndefinedValue());
6077 cullMode.to_jsval(cx, cullMode_js.handle_mut());
6078 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "cullMode", cullMode_js.handle()).unwrap();
6079 let frontFace = &self.frontFace;
6080 rooted!(in(cx) let mut frontFace_js = UndefinedValue());
6081 frontFace.to_jsval(cx, frontFace_js.handle_mut());
6082 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "frontFace", frontFace_js.handle()).unwrap();
6083 if let Some(ref stripIndexFormat) = self.stripIndexFormat {
6084 rooted!(in(cx) let mut stripIndexFormat_js = UndefinedValue());
6085 stripIndexFormat.to_jsval(cx, stripIndexFormat_js.handle_mut());
6086 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "stripIndexFormat", stripIndexFormat_js.handle()).unwrap();
6087 }
6088 let topology = &self.topology;
6089 rooted!(in(cx) let mut topology_js = UndefinedValue());
6090 topology.to_jsval(cx, topology_js.handle_mut());
6091 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "topology", topology_js.handle()).unwrap();
6092 }
6093}
6094
6095impl ToJSValConvertible for GPUPrimitiveState {
6096 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
6097 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
6098 self.to_jsobject(cx, obj.handle_mut());
6099 rval.set(ObjectOrNullValue(obj.get()))
6100 }
6101}
6102
6103
6104#[derive(JSTraceable)]
6105pub struct GPUMultisampleState {
6106 pub alphaToCoverageEnabled: bool,
6107 pub count: u32,
6108 pub mask: u32,
6109}
6110impl Default for GPUMultisampleState {
6111 fn default() -> Self {
6112 Self::empty()
6113 }
6114}
6115
6116impl GPUMultisampleState {
6117 pub fn empty() -> Self {
6118 Self {
6119 alphaToCoverageEnabled: false,
6120 count: 1,
6121 mask: 4294967295,
6122 }
6123 }
6124 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
6125 -> Result<ConversionResult<GPUMultisampleState>, ()> {
6126 unsafe {
6127 let object = if val.get().is_null_or_undefined() {
6128 ptr::null_mut()
6129 } else if val.get().is_object() {
6130 val.get().to_object()
6131 } else {
6132 return Ok(ConversionResult::Failure("Value is not an object.".into()));
6133 };
6134 rooted!(&in(cx) let object = object);
6135 let dictionary = GPUMultisampleState {
6136 alphaToCoverageEnabled: {
6137 rooted!(&in(cx) let mut rval = UndefinedValue());
6138 if get_dictionary_property(cx.raw_cx(), object.handle(), "alphaToCoverageEnabled", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6139 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
6140 Ok(ConversionResult::Success(value)) => value,
6141 Ok(ConversionResult::Failure(error)) => {
6142 throw_type_error(cx.raw_cx(), &error);
6143 return Err(());
6144
6145 }
6146 _ => {
6147 return Err(());
6148
6149 },
6150 }
6151
6152 } else {
6153 false
6154 }
6155 },
6156 count: {
6157 rooted!(&in(cx) let mut rval = UndefinedValue());
6158 if get_dictionary_property(cx.raw_cx(), object.handle(), "count", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6159 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
6160 Ok(ConversionResult::Success(value)) => value,
6161 Ok(ConversionResult::Failure(error)) => {
6162 throw_type_error(cx.raw_cx(), &error);
6163 return Err(());
6164
6165 }
6166 _ => {
6167 return Err(());
6168
6169 },
6170 }
6171
6172 } else {
6173 1
6174 }
6175 },
6176 mask: {
6177 rooted!(&in(cx) let mut rval = UndefinedValue());
6178 if get_dictionary_property(cx.raw_cx(), object.handle(), "mask", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6179 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
6180 Ok(ConversionResult::Success(value)) => value,
6181 Ok(ConversionResult::Failure(error)) => {
6182 throw_type_error(cx.raw_cx(), &error);
6183 return Err(());
6184
6185 }
6186 _ => {
6187 return Err(());
6188
6189 },
6190 }
6191
6192 } else {
6193 4294967295
6194 }
6195 },
6196 };
6197 Ok(ConversionResult::Success(dictionary))
6198 }
6199 }
6200}
6201
6202impl FromJSValConvertible for GPUMultisampleState {
6203 type Config = ();
6204 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
6205 -> Result<ConversionResult<GPUMultisampleState>, ()> {
6206 GPUMultisampleState::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
6207 }
6208}
6209
6210impl GPUMultisampleState {
6211 #[allow(clippy::wrong_self_convention)]
6212 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
6213 let alphaToCoverageEnabled = &self.alphaToCoverageEnabled;
6214 rooted!(in(cx) let mut alphaToCoverageEnabled_js = UndefinedValue());
6215 alphaToCoverageEnabled.to_jsval(cx, alphaToCoverageEnabled_js.handle_mut());
6216 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "alphaToCoverageEnabled", alphaToCoverageEnabled_js.handle()).unwrap();
6217 let count = &self.count;
6218 rooted!(in(cx) let mut count_js = UndefinedValue());
6219 count.to_jsval(cx, count_js.handle_mut());
6220 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "count", count_js.handle()).unwrap();
6221 let mask = &self.mask;
6222 rooted!(in(cx) let mut mask_js = UndefinedValue());
6223 mask.to_jsval(cx, mask_js.handle_mut());
6224 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "mask", mask_js.handle()).unwrap();
6225 }
6226}
6227
6228impl ToJSValConvertible for GPUMultisampleState {
6229 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
6230 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
6231 self.to_jsobject(cx, obj.handle_mut());
6232 rval.set(ObjectOrNullValue(obj.get()))
6233 }
6234}
6235
6236
6237#[derive(JSTraceable)]
6238pub struct GPUFragmentState<D: DomTypes> {
6239 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUProgrammableStage<D>,
6240 pub targets: Vec<crate::codegen::GenericBindings::WebGPUBinding::GPUColorTargetState>,
6241}
6242
6243impl<D: DomTypes> GPUFragmentState<D> {
6244
6245 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
6246 -> Result<ConversionResult<GPUFragmentState<D>>, ()> {
6247 unsafe {
6248 let object = if val.get().is_null_or_undefined() {
6249 ptr::null_mut()
6250 } else if val.get().is_object() {
6251 val.get().to_object()
6252 } else {
6253 return Ok(ConversionResult::Failure("Value is not an object.".into()));
6254 };
6255 rooted!(&in(cx) let object = object);
6256 let dictionary = GPUFragmentState {
6257 parent: {
6258 match crate::codegen::GenericBindings::WebGPUBinding::GPUProgrammableStage::new(cx, val, can_gc)? {
6259 ConversionResult::Success(v) => v,
6260 ConversionResult::Failure(error) => {
6261 throw_type_error(cx.raw_cx(), &error);
6262 return Err(());
6263 }
6264 }
6265 },
6266 targets: {
6267 rooted!(&in(cx) let mut rval = UndefinedValue());
6268 if get_dictionary_property(cx.raw_cx(), object.handle(), "targets", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6269 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
6270 Ok(ConversionResult::Success(value)) => value,
6271 Ok(ConversionResult::Failure(error)) => {
6272 throw_type_error(cx.raw_cx(), &error);
6273 return Err(());
6274
6275 }
6276 _ => {
6277 return Err(());
6278
6279 },
6280 }
6281
6282 } else {
6283 throw_type_error(cx.raw_cx(), "Missing required member \"targets\".");
6284 return Err(());
6285 }
6286 },
6287 };
6288 Ok(ConversionResult::Success(dictionary))
6289 }
6290 }
6291}
6292
6293impl<D: DomTypes> FromJSValConvertible for GPUFragmentState<D> {
6294 type Config = ();
6295 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
6296 -> Result<ConversionResult<GPUFragmentState<D>>, ()> {
6297 GPUFragmentState::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
6298 }
6299}
6300
6301impl<D: DomTypes> GPUFragmentState<D> {
6302 #[allow(clippy::wrong_self_convention)]
6303 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
6304 self.parent.to_jsobject(cx, obj.reborrow());
6305 let targets = &self.targets;
6306 rooted!(in(cx) let mut targets_js = UndefinedValue());
6307 targets.to_jsval(cx, targets_js.handle_mut());
6308 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "targets", targets_js.handle()).unwrap();
6309 }
6310}
6311
6312impl<D: DomTypes> ToJSValConvertible for GPUFragmentState<D> {
6313 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
6314 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
6315 self.to_jsobject(cx, obj.handle_mut());
6316 rval.set(ObjectOrNullValue(obj.get()))
6317 }
6318}
6319
6320
6321#[derive(JSTraceable)]
6322pub struct GPUColorTargetState {
6323 pub blend: Option<crate::codegen::GenericBindings::WebGPUBinding::GPUBlendState>,
6324 pub format: GPUTextureFormat,
6325 pub writeMask: u32,
6326}
6327
6328impl GPUColorTargetState {
6329
6330 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
6331 -> Result<ConversionResult<GPUColorTargetState>, ()> {
6332 unsafe {
6333 let object = if val.get().is_null_or_undefined() {
6334 ptr::null_mut()
6335 } else if val.get().is_object() {
6336 val.get().to_object()
6337 } else {
6338 return Ok(ConversionResult::Failure("Value is not an object.".into()));
6339 };
6340 rooted!(&in(cx) let object = object);
6341 let dictionary = GPUColorTargetState {
6342 blend: {
6343 rooted!(&in(cx) let mut rval = UndefinedValue());
6344 if get_dictionary_property(cx.raw_cx(), object.handle(), "blend", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6345 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
6346 Ok(ConversionResult::Success(value)) => value,
6347 Ok(ConversionResult::Failure(error)) => {
6348 throw_type_error(cx.raw_cx(), &error);
6349 return Err(());
6350
6351 }
6352 _ => {
6353 return Err(());
6354
6355 },
6356 }
6357 )
6358 } else {
6359 None
6360 }
6361 },
6362 format: {
6363 rooted!(&in(cx) let mut rval = UndefinedValue());
6364 if get_dictionary_property(cx.raw_cx(), object.handle(), "format", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6365 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
6366 Ok(ConversionResult::Success(value)) => value,
6367 Ok(ConversionResult::Failure(error)) => {
6368 throw_type_error(cx.raw_cx(), &error); return Err(());
6369
6370 }
6371 _ => {
6372 return Err(());
6373
6374 },
6375 }
6376
6377 } else {
6378 throw_type_error(cx.raw_cx(), "Missing required member \"format\".");
6379 return Err(());
6380 }
6381 },
6382 writeMask: {
6383 rooted!(&in(cx) let mut rval = UndefinedValue());
6384 if get_dictionary_property(cx.raw_cx(), object.handle(), "writeMask", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6385 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
6386 Ok(ConversionResult::Success(value)) => value,
6387 Ok(ConversionResult::Failure(error)) => {
6388 throw_type_error(cx.raw_cx(), &error);
6389 return Err(());
6390
6391 }
6392 _ => {
6393 return Err(());
6394
6395 },
6396 }
6397
6398 } else {
6399 15
6400 }
6401 },
6402 };
6403 Ok(ConversionResult::Success(dictionary))
6404 }
6405 }
6406}
6407
6408impl FromJSValConvertible for GPUColorTargetState {
6409 type Config = ();
6410 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
6411 -> Result<ConversionResult<GPUColorTargetState>, ()> {
6412 GPUColorTargetState::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
6413 }
6414}
6415
6416impl GPUColorTargetState {
6417 #[allow(clippy::wrong_self_convention)]
6418 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
6419 if let Some(ref blend) = self.blend {
6420 rooted!(in(cx) let mut blend_js = UndefinedValue());
6421 blend.to_jsval(cx, blend_js.handle_mut());
6422 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "blend", blend_js.handle()).unwrap();
6423 }
6424 let format = &self.format;
6425 rooted!(in(cx) let mut format_js = UndefinedValue());
6426 format.to_jsval(cx, format_js.handle_mut());
6427 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "format", format_js.handle()).unwrap();
6428 let writeMask = &self.writeMask;
6429 rooted!(in(cx) let mut writeMask_js = UndefinedValue());
6430 writeMask.to_jsval(cx, writeMask_js.handle_mut());
6431 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "writeMask", writeMask_js.handle()).unwrap();
6432 }
6433}
6434
6435impl ToJSValConvertible for GPUColorTargetState {
6436 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
6437 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
6438 self.to_jsobject(cx, obj.handle_mut());
6439 rval.set(ObjectOrNullValue(obj.get()))
6440 }
6441}
6442
6443
6444#[derive(JSTraceable)]
6445pub struct GPUBlendState {
6446 pub alpha: crate::codegen::GenericBindings::WebGPUBinding::GPUBlendComponent,
6447 pub color: crate::codegen::GenericBindings::WebGPUBinding::GPUBlendComponent,
6448}
6449
6450impl GPUBlendState {
6451
6452 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
6453 -> Result<ConversionResult<GPUBlendState>, ()> {
6454 unsafe {
6455 let object = if val.get().is_null_or_undefined() {
6456 ptr::null_mut()
6457 } else if val.get().is_object() {
6458 val.get().to_object()
6459 } else {
6460 return Ok(ConversionResult::Failure("Value is not an object.".into()));
6461 };
6462 rooted!(&in(cx) let object = object);
6463 let dictionary = GPUBlendState {
6464 alpha: {
6465 rooted!(&in(cx) let mut rval = UndefinedValue());
6466 if get_dictionary_property(cx.raw_cx(), object.handle(), "alpha", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6467 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
6468 Ok(ConversionResult::Success(value)) => value,
6469 Ok(ConversionResult::Failure(error)) => {
6470 throw_type_error(cx.raw_cx(), &error);
6471 return Err(());
6472
6473 }
6474 _ => {
6475 return Err(());
6476
6477 },
6478 }
6479
6480 } else {
6481 throw_type_error(cx.raw_cx(), "Missing required member \"alpha\".");
6482 return Err(());
6483 }
6484 },
6485 color: {
6486 rooted!(&in(cx) let mut rval = UndefinedValue());
6487 if get_dictionary_property(cx.raw_cx(), object.handle(), "color", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6488 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
6489 Ok(ConversionResult::Success(value)) => value,
6490 Ok(ConversionResult::Failure(error)) => {
6491 throw_type_error(cx.raw_cx(), &error);
6492 return Err(());
6493
6494 }
6495 _ => {
6496 return Err(());
6497
6498 },
6499 }
6500
6501 } else {
6502 throw_type_error(cx.raw_cx(), "Missing required member \"color\".");
6503 return Err(());
6504 }
6505 },
6506 };
6507 Ok(ConversionResult::Success(dictionary))
6508 }
6509 }
6510}
6511
6512impl FromJSValConvertible for GPUBlendState {
6513 type Config = ();
6514 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
6515 -> Result<ConversionResult<GPUBlendState>, ()> {
6516 GPUBlendState::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
6517 }
6518}
6519
6520impl GPUBlendState {
6521 #[allow(clippy::wrong_self_convention)]
6522 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
6523 let alpha = &self.alpha;
6524 rooted!(in(cx) let mut alpha_js = UndefinedValue());
6525 alpha.to_jsval(cx, alpha_js.handle_mut());
6526 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "alpha", alpha_js.handle()).unwrap();
6527 let color = &self.color;
6528 rooted!(in(cx) let mut color_js = UndefinedValue());
6529 color.to_jsval(cx, color_js.handle_mut());
6530 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "color", color_js.handle()).unwrap();
6531 }
6532}
6533
6534impl ToJSValConvertible for GPUBlendState {
6535 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
6536 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
6537 self.to_jsobject(cx, obj.handle_mut());
6538 rval.set(ObjectOrNullValue(obj.get()))
6539 }
6540}
6541
6542
6543#[derive(JSTraceable)]
6544pub struct GPUBlendComponent {
6545 pub dstFactor: GPUBlendFactor,
6546 pub operation: GPUBlendOperation,
6547 pub srcFactor: GPUBlendFactor,
6548}
6549impl Default for GPUBlendComponent {
6550 fn default() -> Self {
6551 Self::empty()
6552 }
6553}
6554
6555impl GPUBlendComponent {
6556 pub fn empty() -> Self {
6557 Self {
6558 dstFactor: GPUBlendFactor::Zero,
6559 operation: GPUBlendOperation::Add,
6560 srcFactor: GPUBlendFactor::One,
6561 }
6562 }
6563 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
6564 -> Result<ConversionResult<GPUBlendComponent>, ()> {
6565 unsafe {
6566 let object = if val.get().is_null_or_undefined() {
6567 ptr::null_mut()
6568 } else if val.get().is_object() {
6569 val.get().to_object()
6570 } else {
6571 return Ok(ConversionResult::Failure("Value is not an object.".into()));
6572 };
6573 rooted!(&in(cx) let object = object);
6574 let dictionary = GPUBlendComponent {
6575 dstFactor: {
6576 rooted!(&in(cx) let mut rval = UndefinedValue());
6577 if get_dictionary_property(cx.raw_cx(), object.handle(), "dstFactor", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6578 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
6579 Ok(ConversionResult::Success(value)) => value,
6580 Ok(ConversionResult::Failure(error)) => {
6581 throw_type_error(cx.raw_cx(), &error); return Err(());
6582
6583 }
6584 _ => {
6585 return Err(());
6586
6587 },
6588 }
6589
6590 } else {
6591 GPUBlendFactor::Zero
6592 }
6593 },
6594 operation: {
6595 rooted!(&in(cx) let mut rval = UndefinedValue());
6596 if get_dictionary_property(cx.raw_cx(), object.handle(), "operation", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6597 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
6598 Ok(ConversionResult::Success(value)) => value,
6599 Ok(ConversionResult::Failure(error)) => {
6600 throw_type_error(cx.raw_cx(), &error); return Err(());
6601
6602 }
6603 _ => {
6604 return Err(());
6605
6606 },
6607 }
6608
6609 } else {
6610 GPUBlendOperation::Add
6611 }
6612 },
6613 srcFactor: {
6614 rooted!(&in(cx) let mut rval = UndefinedValue());
6615 if get_dictionary_property(cx.raw_cx(), object.handle(), "srcFactor", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6616 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
6617 Ok(ConversionResult::Success(value)) => value,
6618 Ok(ConversionResult::Failure(error)) => {
6619 throw_type_error(cx.raw_cx(), &error); return Err(());
6620
6621 }
6622 _ => {
6623 return Err(());
6624
6625 },
6626 }
6627
6628 } else {
6629 GPUBlendFactor::One
6630 }
6631 },
6632 };
6633 Ok(ConversionResult::Success(dictionary))
6634 }
6635 }
6636}
6637
6638impl FromJSValConvertible for GPUBlendComponent {
6639 type Config = ();
6640 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
6641 -> Result<ConversionResult<GPUBlendComponent>, ()> {
6642 GPUBlendComponent::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
6643 }
6644}
6645
6646impl GPUBlendComponent {
6647 #[allow(clippy::wrong_self_convention)]
6648 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
6649 let dstFactor = &self.dstFactor;
6650 rooted!(in(cx) let mut dstFactor_js = UndefinedValue());
6651 dstFactor.to_jsval(cx, dstFactor_js.handle_mut());
6652 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "dstFactor", dstFactor_js.handle()).unwrap();
6653 let operation = &self.operation;
6654 rooted!(in(cx) let mut operation_js = UndefinedValue());
6655 operation.to_jsval(cx, operation_js.handle_mut());
6656 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "operation", operation_js.handle()).unwrap();
6657 let srcFactor = &self.srcFactor;
6658 rooted!(in(cx) let mut srcFactor_js = UndefinedValue());
6659 srcFactor.to_jsval(cx, srcFactor_js.handle_mut());
6660 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "srcFactor", srcFactor_js.handle()).unwrap();
6661 }
6662}
6663
6664impl ToJSValConvertible for GPUBlendComponent {
6665 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
6666 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
6667 self.to_jsobject(cx, obj.handle_mut());
6668 rval.set(ObjectOrNullValue(obj.get()))
6669 }
6670}
6671
6672
6673#[derive(JSTraceable)]
6674pub struct GPUDepthStencilState {
6675 pub depthBias: i32,
6676 pub depthBiasClamp: Finite<f32>,
6677 pub depthBiasSlopeScale: Finite<f32>,
6678 pub depthCompare: GPUCompareFunction,
6679 pub depthWriteEnabled: bool,
6680 pub format: GPUTextureFormat,
6681 pub stencilBack: crate::codegen::GenericBindings::WebGPUBinding::GPUStencilFaceState,
6682 pub stencilFront: crate::codegen::GenericBindings::WebGPUBinding::GPUStencilFaceState,
6683 pub stencilReadMask: u32,
6684 pub stencilWriteMask: u32,
6685}
6686
6687impl GPUDepthStencilState {
6688
6689 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
6690 -> Result<ConversionResult<GPUDepthStencilState>, ()> {
6691 unsafe {
6692 let object = if val.get().is_null_or_undefined() {
6693 ptr::null_mut()
6694 } else if val.get().is_object() {
6695 val.get().to_object()
6696 } else {
6697 return Ok(ConversionResult::Failure("Value is not an object.".into()));
6698 };
6699 rooted!(&in(cx) let object = object);
6700 let dictionary = GPUDepthStencilState {
6701 depthBias: {
6702 rooted!(&in(cx) let mut rval = UndefinedValue());
6703 if get_dictionary_property(cx.raw_cx(), object.handle(), "depthBias", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6704 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
6705 Ok(ConversionResult::Success(value)) => value,
6706 Ok(ConversionResult::Failure(error)) => {
6707 throw_type_error(cx.raw_cx(), &error);
6708 return Err(());
6709
6710 }
6711 _ => {
6712 return Err(());
6713
6714 },
6715 }
6716
6717 } else {
6718 0
6719 }
6720 },
6721 depthBiasClamp: {
6722 rooted!(&in(cx) let mut rval = UndefinedValue());
6723 if get_dictionary_property(cx.raw_cx(), object.handle(), "depthBiasClamp", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6724 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
6725 Ok(ConversionResult::Success(value)) => value,
6726 Ok(ConversionResult::Failure(error)) => {
6727 throw_type_error(cx.raw_cx(), &error);
6728 return Err(());
6729
6730 }
6731 _ => {
6732 return Err(());
6733
6734 },
6735 }
6736
6737 } else {
6738 Finite::wrap(0.0)
6739 }
6740 },
6741 depthBiasSlopeScale: {
6742 rooted!(&in(cx) let mut rval = UndefinedValue());
6743 if get_dictionary_property(cx.raw_cx(), object.handle(), "depthBiasSlopeScale", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6744 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
6745 Ok(ConversionResult::Success(value)) => value,
6746 Ok(ConversionResult::Failure(error)) => {
6747 throw_type_error(cx.raw_cx(), &error);
6748 return Err(());
6749
6750 }
6751 _ => {
6752 return Err(());
6753
6754 },
6755 }
6756
6757 } else {
6758 Finite::wrap(0.0)
6759 }
6760 },
6761 depthCompare: {
6762 rooted!(&in(cx) let mut rval = UndefinedValue());
6763 if get_dictionary_property(cx.raw_cx(), object.handle(), "depthCompare", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6764 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
6765 Ok(ConversionResult::Success(value)) => value,
6766 Ok(ConversionResult::Failure(error)) => {
6767 throw_type_error(cx.raw_cx(), &error); return Err(());
6768
6769 }
6770 _ => {
6771 return Err(());
6772
6773 },
6774 }
6775
6776 } else {
6777 GPUCompareFunction::Always
6778 }
6779 },
6780 depthWriteEnabled: {
6781 rooted!(&in(cx) let mut rval = UndefinedValue());
6782 if get_dictionary_property(cx.raw_cx(), object.handle(), "depthWriteEnabled", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6783 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
6784 Ok(ConversionResult::Success(value)) => value,
6785 Ok(ConversionResult::Failure(error)) => {
6786 throw_type_error(cx.raw_cx(), &error);
6787 return Err(());
6788
6789 }
6790 _ => {
6791 return Err(());
6792
6793 },
6794 }
6795
6796 } else {
6797 false
6798 }
6799 },
6800 format: {
6801 rooted!(&in(cx) let mut rval = UndefinedValue());
6802 if get_dictionary_property(cx.raw_cx(), object.handle(), "format", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6803 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
6804 Ok(ConversionResult::Success(value)) => value,
6805 Ok(ConversionResult::Failure(error)) => {
6806 throw_type_error(cx.raw_cx(), &error); return Err(());
6807
6808 }
6809 _ => {
6810 return Err(());
6811
6812 },
6813 }
6814
6815 } else {
6816 throw_type_error(cx.raw_cx(), "Missing required member \"format\".");
6817 return Err(());
6818 }
6819 },
6820 stencilBack: {
6821 rooted!(&in(cx) let mut rval = UndefinedValue());
6822 if get_dictionary_property(cx.raw_cx(), object.handle(), "stencilBack", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6823 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
6824 Ok(ConversionResult::Success(value)) => value,
6825 Ok(ConversionResult::Failure(error)) => {
6826 throw_type_error(cx.raw_cx(), &error);
6827 return Err(());
6828
6829 }
6830 _ => {
6831 return Err(());
6832
6833 },
6834 }
6835
6836 } else {
6837 crate::codegen::GenericBindings::WebGPUBinding::GPUStencilFaceState::empty()
6838 }
6839 },
6840 stencilFront: {
6841 rooted!(&in(cx) let mut rval = UndefinedValue());
6842 if get_dictionary_property(cx.raw_cx(), object.handle(), "stencilFront", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6843 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
6844 Ok(ConversionResult::Success(value)) => value,
6845 Ok(ConversionResult::Failure(error)) => {
6846 throw_type_error(cx.raw_cx(), &error);
6847 return Err(());
6848
6849 }
6850 _ => {
6851 return Err(());
6852
6853 },
6854 }
6855
6856 } else {
6857 crate::codegen::GenericBindings::WebGPUBinding::GPUStencilFaceState::empty()
6858 }
6859 },
6860 stencilReadMask: {
6861 rooted!(&in(cx) let mut rval = UndefinedValue());
6862 if get_dictionary_property(cx.raw_cx(), object.handle(), "stencilReadMask", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6863 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
6864 Ok(ConversionResult::Success(value)) => value,
6865 Ok(ConversionResult::Failure(error)) => {
6866 throw_type_error(cx.raw_cx(), &error);
6867 return Err(());
6868
6869 }
6870 _ => {
6871 return Err(());
6872
6873 },
6874 }
6875
6876 } else {
6877 4294967295
6878 }
6879 },
6880 stencilWriteMask: {
6881 rooted!(&in(cx) let mut rval = UndefinedValue());
6882 if get_dictionary_property(cx.raw_cx(), object.handle(), "stencilWriteMask", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
6883 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
6884 Ok(ConversionResult::Success(value)) => value,
6885 Ok(ConversionResult::Failure(error)) => {
6886 throw_type_error(cx.raw_cx(), &error);
6887 return Err(());
6888
6889 }
6890 _ => {
6891 return Err(());
6892
6893 },
6894 }
6895
6896 } else {
6897 4294967295
6898 }
6899 },
6900 };
6901 Ok(ConversionResult::Success(dictionary))
6902 }
6903 }
6904}
6905
6906impl FromJSValConvertible for GPUDepthStencilState {
6907 type Config = ();
6908 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
6909 -> Result<ConversionResult<GPUDepthStencilState>, ()> {
6910 GPUDepthStencilState::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
6911 }
6912}
6913
6914impl GPUDepthStencilState {
6915 #[allow(clippy::wrong_self_convention)]
6916 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
6917 let depthBias = &self.depthBias;
6918 rooted!(in(cx) let mut depthBias_js = UndefinedValue());
6919 depthBias.to_jsval(cx, depthBias_js.handle_mut());
6920 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "depthBias", depthBias_js.handle()).unwrap();
6921 let depthBiasClamp = &self.depthBiasClamp;
6922 rooted!(in(cx) let mut depthBiasClamp_js = UndefinedValue());
6923 depthBiasClamp.to_jsval(cx, depthBiasClamp_js.handle_mut());
6924 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "depthBiasClamp", depthBiasClamp_js.handle()).unwrap();
6925 let depthBiasSlopeScale = &self.depthBiasSlopeScale;
6926 rooted!(in(cx) let mut depthBiasSlopeScale_js = UndefinedValue());
6927 depthBiasSlopeScale.to_jsval(cx, depthBiasSlopeScale_js.handle_mut());
6928 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "depthBiasSlopeScale", depthBiasSlopeScale_js.handle()).unwrap();
6929 let depthCompare = &self.depthCompare;
6930 rooted!(in(cx) let mut depthCompare_js = UndefinedValue());
6931 depthCompare.to_jsval(cx, depthCompare_js.handle_mut());
6932 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "depthCompare", depthCompare_js.handle()).unwrap();
6933 let depthWriteEnabled = &self.depthWriteEnabled;
6934 rooted!(in(cx) let mut depthWriteEnabled_js = UndefinedValue());
6935 depthWriteEnabled.to_jsval(cx, depthWriteEnabled_js.handle_mut());
6936 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "depthWriteEnabled", depthWriteEnabled_js.handle()).unwrap();
6937 let format = &self.format;
6938 rooted!(in(cx) let mut format_js = UndefinedValue());
6939 format.to_jsval(cx, format_js.handle_mut());
6940 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "format", format_js.handle()).unwrap();
6941 let stencilBack = &self.stencilBack;
6942 rooted!(in(cx) let mut stencilBack_js = UndefinedValue());
6943 stencilBack.to_jsval(cx, stencilBack_js.handle_mut());
6944 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "stencilBack", stencilBack_js.handle()).unwrap();
6945 let stencilFront = &self.stencilFront;
6946 rooted!(in(cx) let mut stencilFront_js = UndefinedValue());
6947 stencilFront.to_jsval(cx, stencilFront_js.handle_mut());
6948 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "stencilFront", stencilFront_js.handle()).unwrap();
6949 let stencilReadMask = &self.stencilReadMask;
6950 rooted!(in(cx) let mut stencilReadMask_js = UndefinedValue());
6951 stencilReadMask.to_jsval(cx, stencilReadMask_js.handle_mut());
6952 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "stencilReadMask", stencilReadMask_js.handle()).unwrap();
6953 let stencilWriteMask = &self.stencilWriteMask;
6954 rooted!(in(cx) let mut stencilWriteMask_js = UndefinedValue());
6955 stencilWriteMask.to_jsval(cx, stencilWriteMask_js.handle_mut());
6956 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "stencilWriteMask", stencilWriteMask_js.handle()).unwrap();
6957 }
6958}
6959
6960impl ToJSValConvertible for GPUDepthStencilState {
6961 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
6962 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
6963 self.to_jsobject(cx, obj.handle_mut());
6964 rval.set(ObjectOrNullValue(obj.get()))
6965 }
6966}
6967
6968
6969#[derive(JSTraceable)]
6970pub struct GPUStencilFaceState {
6971 pub compare: GPUCompareFunction,
6972 pub depthFailOp: GPUStencilOperation,
6973 pub failOp: GPUStencilOperation,
6974 pub passOp: GPUStencilOperation,
6975}
6976impl Default for GPUStencilFaceState {
6977 fn default() -> Self {
6978 Self::empty()
6979 }
6980}
6981
6982impl GPUStencilFaceState {
6983 pub fn empty() -> Self {
6984 Self {
6985 compare: GPUCompareFunction::Always,
6986 depthFailOp: GPUStencilOperation::Keep,
6987 failOp: GPUStencilOperation::Keep,
6988 passOp: GPUStencilOperation::Keep,
6989 }
6990 }
6991 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
6992 -> Result<ConversionResult<GPUStencilFaceState>, ()> {
6993 unsafe {
6994 let object = if val.get().is_null_or_undefined() {
6995 ptr::null_mut()
6996 } else if val.get().is_object() {
6997 val.get().to_object()
6998 } else {
6999 return Ok(ConversionResult::Failure("Value is not an object.".into()));
7000 };
7001 rooted!(&in(cx) let object = object);
7002 let dictionary = GPUStencilFaceState {
7003 compare: {
7004 rooted!(&in(cx) let mut rval = UndefinedValue());
7005 if get_dictionary_property(cx.raw_cx(), object.handle(), "compare", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7006 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
7007 Ok(ConversionResult::Success(value)) => value,
7008 Ok(ConversionResult::Failure(error)) => {
7009 throw_type_error(cx.raw_cx(), &error); return Err(());
7010
7011 }
7012 _ => {
7013 return Err(());
7014
7015 },
7016 }
7017
7018 } else {
7019 GPUCompareFunction::Always
7020 }
7021 },
7022 depthFailOp: {
7023 rooted!(&in(cx) let mut rval = UndefinedValue());
7024 if get_dictionary_property(cx.raw_cx(), object.handle(), "depthFailOp", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7025 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
7026 Ok(ConversionResult::Success(value)) => value,
7027 Ok(ConversionResult::Failure(error)) => {
7028 throw_type_error(cx.raw_cx(), &error); return Err(());
7029
7030 }
7031 _ => {
7032 return Err(());
7033
7034 },
7035 }
7036
7037 } else {
7038 GPUStencilOperation::Keep
7039 }
7040 },
7041 failOp: {
7042 rooted!(&in(cx) let mut rval = UndefinedValue());
7043 if get_dictionary_property(cx.raw_cx(), object.handle(), "failOp", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7044 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
7045 Ok(ConversionResult::Success(value)) => value,
7046 Ok(ConversionResult::Failure(error)) => {
7047 throw_type_error(cx.raw_cx(), &error); return Err(());
7048
7049 }
7050 _ => {
7051 return Err(());
7052
7053 },
7054 }
7055
7056 } else {
7057 GPUStencilOperation::Keep
7058 }
7059 },
7060 passOp: {
7061 rooted!(&in(cx) let mut rval = UndefinedValue());
7062 if get_dictionary_property(cx.raw_cx(), object.handle(), "passOp", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7063 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
7064 Ok(ConversionResult::Success(value)) => value,
7065 Ok(ConversionResult::Failure(error)) => {
7066 throw_type_error(cx.raw_cx(), &error); return Err(());
7067
7068 }
7069 _ => {
7070 return Err(());
7071
7072 },
7073 }
7074
7075 } else {
7076 GPUStencilOperation::Keep
7077 }
7078 },
7079 };
7080 Ok(ConversionResult::Success(dictionary))
7081 }
7082 }
7083}
7084
7085impl FromJSValConvertible for GPUStencilFaceState {
7086 type Config = ();
7087 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
7088 -> Result<ConversionResult<GPUStencilFaceState>, ()> {
7089 GPUStencilFaceState::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
7090 }
7091}
7092
7093impl GPUStencilFaceState {
7094 #[allow(clippy::wrong_self_convention)]
7095 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
7096 let compare = &self.compare;
7097 rooted!(in(cx) let mut compare_js = UndefinedValue());
7098 compare.to_jsval(cx, compare_js.handle_mut());
7099 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "compare", compare_js.handle()).unwrap();
7100 let depthFailOp = &self.depthFailOp;
7101 rooted!(in(cx) let mut depthFailOp_js = UndefinedValue());
7102 depthFailOp.to_jsval(cx, depthFailOp_js.handle_mut());
7103 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "depthFailOp", depthFailOp_js.handle()).unwrap();
7104 let failOp = &self.failOp;
7105 rooted!(in(cx) let mut failOp_js = UndefinedValue());
7106 failOp.to_jsval(cx, failOp_js.handle_mut());
7107 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "failOp", failOp_js.handle()).unwrap();
7108 let passOp = &self.passOp;
7109 rooted!(in(cx) let mut passOp_js = UndefinedValue());
7110 passOp.to_jsval(cx, passOp_js.handle_mut());
7111 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "passOp", passOp_js.handle()).unwrap();
7112 }
7113}
7114
7115impl ToJSValConvertible for GPUStencilFaceState {
7116 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
7117 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
7118 self.to_jsobject(cx, obj.handle_mut());
7119 rval.set(ObjectOrNullValue(obj.get()))
7120 }
7121}
7122
7123
7124#[derive(JSTraceable)]
7125pub struct GPUVertexState<D: DomTypes> {
7126 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUProgrammableStage<D>,
7127 pub buffers: Vec<crate::codegen::GenericBindings::WebGPUBinding::GPUVertexBufferLayout>,
7128}
7129
7130impl<D: DomTypes> GPUVertexState<D> {
7131
7132 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
7133 -> Result<ConversionResult<GPUVertexState<D>>, ()> {
7134 unsafe {
7135 let object = if val.get().is_null_or_undefined() {
7136 ptr::null_mut()
7137 } else if val.get().is_object() {
7138 val.get().to_object()
7139 } else {
7140 return Ok(ConversionResult::Failure("Value is not an object.".into()));
7141 };
7142 rooted!(&in(cx) let object = object);
7143 let dictionary = GPUVertexState {
7144 parent: {
7145 match crate::codegen::GenericBindings::WebGPUBinding::GPUProgrammableStage::new(cx, val, can_gc)? {
7146 ConversionResult::Success(v) => v,
7147 ConversionResult::Failure(error) => {
7148 throw_type_error(cx.raw_cx(), &error);
7149 return Err(());
7150 }
7151 }
7152 },
7153 buffers: {
7154 rooted!(&in(cx) let mut rval = UndefinedValue());
7155 if get_dictionary_property(cx.raw_cx(), object.handle(), "buffers", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7156 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
7157 Ok(ConversionResult::Success(value)) => value,
7158 Ok(ConversionResult::Failure(error)) => {
7159 throw_type_error(cx.raw_cx(), &error);
7160 return Err(());
7161
7162 }
7163 _ => {
7164 return Err(());
7165
7166 },
7167 }
7168
7169 } else {
7170 Vec::new()
7171 }
7172 },
7173 };
7174 Ok(ConversionResult::Success(dictionary))
7175 }
7176 }
7177}
7178
7179impl<D: DomTypes> FromJSValConvertible for GPUVertexState<D> {
7180 type Config = ();
7181 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
7182 -> Result<ConversionResult<GPUVertexState<D>>, ()> {
7183 GPUVertexState::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
7184 }
7185}
7186
7187impl<D: DomTypes> GPUVertexState<D> {
7188 #[allow(clippy::wrong_self_convention)]
7189 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
7190 self.parent.to_jsobject(cx, obj.reborrow());
7191 let buffers = &self.buffers;
7192 rooted!(in(cx) let mut buffers_js = UndefinedValue());
7193 buffers.to_jsval(cx, buffers_js.handle_mut());
7194 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "buffers", buffers_js.handle()).unwrap();
7195 }
7196}
7197
7198impl<D: DomTypes> ToJSValConvertible for GPUVertexState<D> {
7199 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
7200 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
7201 self.to_jsobject(cx, obj.handle_mut());
7202 rval.set(ObjectOrNullValue(obj.get()))
7203 }
7204}
7205
7206
7207#[derive(JSTraceable)]
7208pub struct GPUVertexBufferLayout {
7209 pub arrayStride: u64,
7210 pub attributes: Vec<crate::codegen::GenericBindings::WebGPUBinding::GPUVertexAttribute>,
7211 pub stepMode: GPUVertexStepMode,
7212}
7213
7214impl GPUVertexBufferLayout {
7215
7216 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
7217 -> Result<ConversionResult<GPUVertexBufferLayout>, ()> {
7218 unsafe {
7219 let object = if val.get().is_null_or_undefined() {
7220 ptr::null_mut()
7221 } else if val.get().is_object() {
7222 val.get().to_object()
7223 } else {
7224 return Ok(ConversionResult::Failure("Value is not an object.".into()));
7225 };
7226 rooted!(&in(cx) let object = object);
7227 let dictionary = GPUVertexBufferLayout {
7228 arrayStride: {
7229 rooted!(&in(cx) let mut rval = UndefinedValue());
7230 if get_dictionary_property(cx.raw_cx(), object.handle(), "arrayStride", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7231 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
7232 Ok(ConversionResult::Success(value)) => value,
7233 Ok(ConversionResult::Failure(error)) => {
7234 throw_type_error(cx.raw_cx(), &error);
7235 return Err(());
7236
7237 }
7238 _ => {
7239 return Err(());
7240
7241 },
7242 }
7243
7244 } else {
7245 throw_type_error(cx.raw_cx(), "Missing required member \"arrayStride\".");
7246 return Err(());
7247 }
7248 },
7249 attributes: {
7250 rooted!(&in(cx) let mut rval = UndefinedValue());
7251 if get_dictionary_property(cx.raw_cx(), object.handle(), "attributes", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7252 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
7253 Ok(ConversionResult::Success(value)) => value,
7254 Ok(ConversionResult::Failure(error)) => {
7255 throw_type_error(cx.raw_cx(), &error);
7256 return Err(());
7257
7258 }
7259 _ => {
7260 return Err(());
7261
7262 },
7263 }
7264
7265 } else {
7266 throw_type_error(cx.raw_cx(), "Missing required member \"attributes\".");
7267 return Err(());
7268 }
7269 },
7270 stepMode: {
7271 rooted!(&in(cx) let mut rval = UndefinedValue());
7272 if get_dictionary_property(cx.raw_cx(), object.handle(), "stepMode", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7273 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
7274 Ok(ConversionResult::Success(value)) => value,
7275 Ok(ConversionResult::Failure(error)) => {
7276 throw_type_error(cx.raw_cx(), &error); return Err(());
7277
7278 }
7279 _ => {
7280 return Err(());
7281
7282 },
7283 }
7284
7285 } else {
7286 GPUVertexStepMode::Vertex
7287 }
7288 },
7289 };
7290 Ok(ConversionResult::Success(dictionary))
7291 }
7292 }
7293}
7294
7295impl FromJSValConvertible for GPUVertexBufferLayout {
7296 type Config = ();
7297 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
7298 -> Result<ConversionResult<GPUVertexBufferLayout>, ()> {
7299 GPUVertexBufferLayout::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
7300 }
7301}
7302
7303impl GPUVertexBufferLayout {
7304 #[allow(clippy::wrong_self_convention)]
7305 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
7306 let arrayStride = &self.arrayStride;
7307 rooted!(in(cx) let mut arrayStride_js = UndefinedValue());
7308 arrayStride.to_jsval(cx, arrayStride_js.handle_mut());
7309 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "arrayStride", arrayStride_js.handle()).unwrap();
7310 let attributes = &self.attributes;
7311 rooted!(in(cx) let mut attributes_js = UndefinedValue());
7312 attributes.to_jsval(cx, attributes_js.handle_mut());
7313 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "attributes", attributes_js.handle()).unwrap();
7314 let stepMode = &self.stepMode;
7315 rooted!(in(cx) let mut stepMode_js = UndefinedValue());
7316 stepMode.to_jsval(cx, stepMode_js.handle_mut());
7317 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "stepMode", stepMode_js.handle()).unwrap();
7318 }
7319}
7320
7321impl ToJSValConvertible for GPUVertexBufferLayout {
7322 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
7323 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
7324 self.to_jsobject(cx, obj.handle_mut());
7325 rval.set(ObjectOrNullValue(obj.get()))
7326 }
7327}
7328
7329
7330#[derive(JSTraceable)]
7331pub struct GPUVertexAttribute {
7332 pub format: GPUVertexFormat,
7333 pub offset: u64,
7334 pub shaderLocation: u32,
7335}
7336
7337impl GPUVertexAttribute {
7338
7339 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
7340 -> Result<ConversionResult<GPUVertexAttribute>, ()> {
7341 unsafe {
7342 let object = if val.get().is_null_or_undefined() {
7343 ptr::null_mut()
7344 } else if val.get().is_object() {
7345 val.get().to_object()
7346 } else {
7347 return Ok(ConversionResult::Failure("Value is not an object.".into()));
7348 };
7349 rooted!(&in(cx) let object = object);
7350 let dictionary = GPUVertexAttribute {
7351 format: {
7352 rooted!(&in(cx) let mut rval = UndefinedValue());
7353 if get_dictionary_property(cx.raw_cx(), object.handle(), "format", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7354 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
7355 Ok(ConversionResult::Success(value)) => value,
7356 Ok(ConversionResult::Failure(error)) => {
7357 throw_type_error(cx.raw_cx(), &error); return Err(());
7358
7359 }
7360 _ => {
7361 return Err(());
7362
7363 },
7364 }
7365
7366 } else {
7367 throw_type_error(cx.raw_cx(), "Missing required member \"format\".");
7368 return Err(());
7369 }
7370 },
7371 offset: {
7372 rooted!(&in(cx) let mut rval = UndefinedValue());
7373 if get_dictionary_property(cx.raw_cx(), object.handle(), "offset", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7374 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
7375 Ok(ConversionResult::Success(value)) => value,
7376 Ok(ConversionResult::Failure(error)) => {
7377 throw_type_error(cx.raw_cx(), &error);
7378 return Err(());
7379
7380 }
7381 _ => {
7382 return Err(());
7383
7384 },
7385 }
7386
7387 } else {
7388 throw_type_error(cx.raw_cx(), "Missing required member \"offset\".");
7389 return Err(());
7390 }
7391 },
7392 shaderLocation: {
7393 rooted!(&in(cx) let mut rval = UndefinedValue());
7394 if get_dictionary_property(cx.raw_cx(), object.handle(), "shaderLocation", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7395 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
7396 Ok(ConversionResult::Success(value)) => value,
7397 Ok(ConversionResult::Failure(error)) => {
7398 throw_type_error(cx.raw_cx(), &error);
7399 return Err(());
7400
7401 }
7402 _ => {
7403 return Err(());
7404
7405 },
7406 }
7407
7408 } else {
7409 throw_type_error(cx.raw_cx(), "Missing required member \"shaderLocation\".");
7410 return Err(());
7411 }
7412 },
7413 };
7414 Ok(ConversionResult::Success(dictionary))
7415 }
7416 }
7417}
7418
7419impl FromJSValConvertible for GPUVertexAttribute {
7420 type Config = ();
7421 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
7422 -> Result<ConversionResult<GPUVertexAttribute>, ()> {
7423 GPUVertexAttribute::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
7424 }
7425}
7426
7427impl GPUVertexAttribute {
7428 #[allow(clippy::wrong_self_convention)]
7429 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
7430 let format = &self.format;
7431 rooted!(in(cx) let mut format_js = UndefinedValue());
7432 format.to_jsval(cx, format_js.handle_mut());
7433 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "format", format_js.handle()).unwrap();
7434 let offset = &self.offset;
7435 rooted!(in(cx) let mut offset_js = UndefinedValue());
7436 offset.to_jsval(cx, offset_js.handle_mut());
7437 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "offset", offset_js.handle()).unwrap();
7438 let shaderLocation = &self.shaderLocation;
7439 rooted!(in(cx) let mut shaderLocation_js = UndefinedValue());
7440 shaderLocation.to_jsval(cx, shaderLocation_js.handle_mut());
7441 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "shaderLocation", shaderLocation_js.handle()).unwrap();
7442 }
7443}
7444
7445impl ToJSValConvertible for GPUVertexAttribute {
7446 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
7447 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
7448 self.to_jsobject(cx, obj.handle_mut());
7449 rval.set(ObjectOrNullValue(obj.get()))
7450 }
7451}
7452
7453
7454#[derive(JSTraceable)]
7455pub struct GPUImageDataLayout {
7456 pub bytesPerRow: Option<u32>,
7457 pub offset: u64,
7458 pub rowsPerImage: Option<u32>,
7459}
7460impl Default for GPUImageDataLayout {
7461 fn default() -> Self {
7462 Self::empty()
7463 }
7464}
7465
7466impl GPUImageDataLayout {
7467 pub fn empty() -> Self {
7468 Self {
7469 bytesPerRow: None,
7470 offset: 0,
7471 rowsPerImage: None,
7472 }
7473 }
7474 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
7475 -> Result<ConversionResult<GPUImageDataLayout>, ()> {
7476 unsafe {
7477 let object = if val.get().is_null_or_undefined() {
7478 ptr::null_mut()
7479 } else if val.get().is_object() {
7480 val.get().to_object()
7481 } else {
7482 return Ok(ConversionResult::Failure("Value is not an object.".into()));
7483 };
7484 rooted!(&in(cx) let object = object);
7485 let dictionary = GPUImageDataLayout {
7486 bytesPerRow: {
7487 rooted!(&in(cx) let mut rval = UndefinedValue());
7488 if get_dictionary_property(cx.raw_cx(), object.handle(), "bytesPerRow", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7489 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
7490 Ok(ConversionResult::Success(value)) => value,
7491 Ok(ConversionResult::Failure(error)) => {
7492 throw_type_error(cx.raw_cx(), &error);
7493 return Err(());
7494
7495 }
7496 _ => {
7497 return Err(());
7498
7499 },
7500 }
7501 )
7502 } else {
7503 None
7504 }
7505 },
7506 offset: {
7507 rooted!(&in(cx) let mut rval = UndefinedValue());
7508 if get_dictionary_property(cx.raw_cx(), object.handle(), "offset", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7509 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
7510 Ok(ConversionResult::Success(value)) => value,
7511 Ok(ConversionResult::Failure(error)) => {
7512 throw_type_error(cx.raw_cx(), &error);
7513 return Err(());
7514
7515 }
7516 _ => {
7517 return Err(());
7518
7519 },
7520 }
7521
7522 } else {
7523 0
7524 }
7525 },
7526 rowsPerImage: {
7527 rooted!(&in(cx) let mut rval = UndefinedValue());
7528 if get_dictionary_property(cx.raw_cx(), object.handle(), "rowsPerImage", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7529 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
7530 Ok(ConversionResult::Success(value)) => value,
7531 Ok(ConversionResult::Failure(error)) => {
7532 throw_type_error(cx.raw_cx(), &error);
7533 return Err(());
7534
7535 }
7536 _ => {
7537 return Err(());
7538
7539 },
7540 }
7541 )
7542 } else {
7543 None
7544 }
7545 },
7546 };
7547 Ok(ConversionResult::Success(dictionary))
7548 }
7549 }
7550}
7551
7552impl FromJSValConvertible for GPUImageDataLayout {
7553 type Config = ();
7554 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
7555 -> Result<ConversionResult<GPUImageDataLayout>, ()> {
7556 GPUImageDataLayout::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
7557 }
7558}
7559
7560impl GPUImageDataLayout {
7561 #[allow(clippy::wrong_self_convention)]
7562 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
7563 if let Some(ref bytesPerRow) = self.bytesPerRow {
7564 rooted!(in(cx) let mut bytesPerRow_js = UndefinedValue());
7565 bytesPerRow.to_jsval(cx, bytesPerRow_js.handle_mut());
7566 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "bytesPerRow", bytesPerRow_js.handle()).unwrap();
7567 }
7568 let offset = &self.offset;
7569 rooted!(in(cx) let mut offset_js = UndefinedValue());
7570 offset.to_jsval(cx, offset_js.handle_mut());
7571 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "offset", offset_js.handle()).unwrap();
7572 if let Some(ref rowsPerImage) = self.rowsPerImage {
7573 rooted!(in(cx) let mut rowsPerImage_js = UndefinedValue());
7574 rowsPerImage.to_jsval(cx, rowsPerImage_js.handle_mut());
7575 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "rowsPerImage", rowsPerImage_js.handle()).unwrap();
7576 }
7577 }
7578}
7579
7580impl ToJSValConvertible for GPUImageDataLayout {
7581 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
7582 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
7583 self.to_jsobject(cx, obj.handle_mut());
7584 rval.set(ObjectOrNullValue(obj.get()))
7585 }
7586}
7587
7588
7589#[derive(JSTraceable)]
7590pub struct GPUImageCopyBuffer<D: DomTypes> {
7591 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUImageDataLayout,
7592 pub buffer: DomRoot<D::GPUBuffer>,
7593}
7594
7595impl<D: DomTypes> GPUImageCopyBuffer<D> {
7596
7597 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
7598 -> Result<ConversionResult<GPUImageCopyBuffer<D>>, ()> {
7599 unsafe {
7600 let object = if val.get().is_null_or_undefined() {
7601 ptr::null_mut()
7602 } else if val.get().is_object() {
7603 val.get().to_object()
7604 } else {
7605 return Ok(ConversionResult::Failure("Value is not an object.".into()));
7606 };
7607 rooted!(&in(cx) let object = object);
7608 let dictionary = GPUImageCopyBuffer {
7609 parent: {
7610 match crate::codegen::GenericBindings::WebGPUBinding::GPUImageDataLayout::new(cx, val, can_gc)? {
7611 ConversionResult::Success(v) => v,
7612 ConversionResult::Failure(error) => {
7613 throw_type_error(cx.raw_cx(), &error);
7614 return Err(());
7615 }
7616 }
7617 },
7618 buffer: {
7619 rooted!(&in(cx) let mut rval = UndefinedValue());
7620 if get_dictionary_property(cx.raw_cx(), object.handle(), "buffer", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7621 if rval.handle().get().is_object() {
7622 match root_from_handlevalue(rval.handle(), SafeJSContext::from_ptr(cx.raw_cx())) {
7623 Ok(val) => val,
7624 Err(()) => {
7625 throw_type_error(cx.raw_cx(), "value does not implement interface GPUBuffer.");
7626 return Err(());
7627
7628 }
7629 }
7630
7631 } else {
7632 throw_type_error(cx.raw_cx(), "Value is not an object.");
7633 return Err(());
7634
7635 }
7636 } else {
7637 throw_type_error(cx.raw_cx(), "Missing required member \"buffer\".");
7638 return Err(());
7639 }
7640 },
7641 };
7642 Ok(ConversionResult::Success(dictionary))
7643 }
7644 }
7645}
7646
7647impl<D: DomTypes> FromJSValConvertible for GPUImageCopyBuffer<D> {
7648 type Config = ();
7649 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
7650 -> Result<ConversionResult<GPUImageCopyBuffer<D>>, ()> {
7651 GPUImageCopyBuffer::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
7652 }
7653}
7654
7655impl<D: DomTypes> GPUImageCopyBuffer<D> {
7656 #[allow(clippy::wrong_self_convention)]
7657 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
7658 self.parent.to_jsobject(cx, obj.reborrow());
7659 let buffer = &self.buffer;
7660 rooted!(in(cx) let mut buffer_js = UndefinedValue());
7661 buffer.to_jsval(cx, buffer_js.handle_mut());
7662 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "buffer", buffer_js.handle()).unwrap();
7663 }
7664}
7665
7666impl<D: DomTypes> ToJSValConvertible for GPUImageCopyBuffer<D> {
7667 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
7668 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
7669 self.to_jsobject(cx, obj.handle_mut());
7670 rval.set(ObjectOrNullValue(obj.get()))
7671 }
7672}
7673
7674
7675#[derive(JSTraceable)]
7676pub struct GPUImageCopyTexture<D: DomTypes> {
7677 pub aspect: GPUTextureAspect,
7678 pub mipLevel: u32,
7679 pub origin: Option<GenericUnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUOrigin3DDict>,
7680 pub texture: DomRoot<D::GPUTexture>,
7681}
7682
7683impl<D: DomTypes> GPUImageCopyTexture<D> {
7684
7685 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
7686 -> Result<ConversionResult<GPUImageCopyTexture<D>>, ()> {
7687 unsafe {
7688 let object = if val.get().is_null_or_undefined() {
7689 ptr::null_mut()
7690 } else if val.get().is_object() {
7691 val.get().to_object()
7692 } else {
7693 return Ok(ConversionResult::Failure("Value is not an object.".into()));
7694 };
7695 rooted!(&in(cx) let object = object);
7696 let dictionary = GPUImageCopyTexture {
7697 aspect: {
7698 rooted!(&in(cx) let mut rval = UndefinedValue());
7699 if get_dictionary_property(cx.raw_cx(), object.handle(), "aspect", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7700 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
7701 Ok(ConversionResult::Success(value)) => value,
7702 Ok(ConversionResult::Failure(error)) => {
7703 throw_type_error(cx.raw_cx(), &error); return Err(());
7704
7705 }
7706 _ => {
7707 return Err(());
7708
7709 },
7710 }
7711
7712 } else {
7713 GPUTextureAspect::All
7714 }
7715 },
7716 mipLevel: {
7717 rooted!(&in(cx) let mut rval = UndefinedValue());
7718 if get_dictionary_property(cx.raw_cx(), object.handle(), "mipLevel", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7719 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
7720 Ok(ConversionResult::Success(value)) => value,
7721 Ok(ConversionResult::Failure(error)) => {
7722 throw_type_error(cx.raw_cx(), &error);
7723 return Err(());
7724
7725 }
7726 _ => {
7727 return Err(());
7728
7729 },
7730 }
7731
7732 } else {
7733 0
7734 }
7735 },
7736 origin: {
7737 rooted!(&in(cx) let mut rval = UndefinedValue());
7738 if get_dictionary_property(cx.raw_cx(), object.handle(), "origin", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7739 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
7740 Ok(ConversionResult::Success(value)) => value,
7741 Ok(ConversionResult::Failure(error)) => {
7742 throw_type_error(cx.raw_cx(), &error);
7743 return Err(());
7744
7745 }
7746 _ => {
7747 return Err(());
7748
7749 },
7750 }
7751 )
7752 } else {
7753 None
7754 }
7755 },
7756 texture: {
7757 rooted!(&in(cx) let mut rval = UndefinedValue());
7758 if get_dictionary_property(cx.raw_cx(), object.handle(), "texture", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7759 if rval.handle().get().is_object() {
7760 match root_from_handlevalue(rval.handle(), SafeJSContext::from_ptr(cx.raw_cx())) {
7761 Ok(val) => val,
7762 Err(()) => {
7763 throw_type_error(cx.raw_cx(), "value does not implement interface GPUTexture.");
7764 return Err(());
7765
7766 }
7767 }
7768
7769 } else {
7770 throw_type_error(cx.raw_cx(), "Value is not an object.");
7771 return Err(());
7772
7773 }
7774 } else {
7775 throw_type_error(cx.raw_cx(), "Missing required member \"texture\".");
7776 return Err(());
7777 }
7778 },
7779 };
7780 Ok(ConversionResult::Success(dictionary))
7781 }
7782 }
7783}
7784
7785impl<D: DomTypes> FromJSValConvertible for GPUImageCopyTexture<D> {
7786 type Config = ();
7787 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
7788 -> Result<ConversionResult<GPUImageCopyTexture<D>>, ()> {
7789 GPUImageCopyTexture::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
7790 }
7791}
7792
7793impl<D: DomTypes> GPUImageCopyTexture<D> {
7794 #[allow(clippy::wrong_self_convention)]
7795 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
7796 let aspect = &self.aspect;
7797 rooted!(in(cx) let mut aspect_js = UndefinedValue());
7798 aspect.to_jsval(cx, aspect_js.handle_mut());
7799 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "aspect", aspect_js.handle()).unwrap();
7800 let mipLevel = &self.mipLevel;
7801 rooted!(in(cx) let mut mipLevel_js = UndefinedValue());
7802 mipLevel.to_jsval(cx, mipLevel_js.handle_mut());
7803 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "mipLevel", mipLevel_js.handle()).unwrap();
7804 if let Some(ref origin) = self.origin {
7805 rooted!(in(cx) let mut origin_js = UndefinedValue());
7806 origin.to_jsval(cx, origin_js.handle_mut());
7807 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "origin", origin_js.handle()).unwrap();
7808 }
7809 let texture = &self.texture;
7810 rooted!(in(cx) let mut texture_js = UndefinedValue());
7811 texture.to_jsval(cx, texture_js.handle_mut());
7812 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "texture", texture_js.handle()).unwrap();
7813 }
7814}
7815
7816impl<D: DomTypes> ToJSValConvertible for GPUImageCopyTexture<D> {
7817 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
7818 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
7819 self.to_jsobject(cx, obj.handle_mut());
7820 rval.set(ObjectOrNullValue(obj.get()))
7821 }
7822}
7823
7824
7825#[derive(JSTraceable)]
7826pub struct GPUImageCopyTextureTagged<D: DomTypes> {
7827 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUImageCopyTexture<D>,
7828 pub premultipliedAlpha: bool,
7829}
7830
7831impl<D: DomTypes> GPUImageCopyTextureTagged<D> {
7832
7833 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
7834 -> Result<ConversionResult<GPUImageCopyTextureTagged<D>>, ()> {
7835 unsafe {
7836 let object = if val.get().is_null_or_undefined() {
7837 ptr::null_mut()
7838 } else if val.get().is_object() {
7839 val.get().to_object()
7840 } else {
7841 return Ok(ConversionResult::Failure("Value is not an object.".into()));
7842 };
7843 rooted!(&in(cx) let object = object);
7844 let dictionary = GPUImageCopyTextureTagged {
7845 parent: {
7846 match crate::codegen::GenericBindings::WebGPUBinding::GPUImageCopyTexture::new(cx, val, can_gc)? {
7847 ConversionResult::Success(v) => v,
7848 ConversionResult::Failure(error) => {
7849 throw_type_error(cx.raw_cx(), &error);
7850 return Err(());
7851 }
7852 }
7853 },
7854 premultipliedAlpha: {
7855 rooted!(&in(cx) let mut rval = UndefinedValue());
7856 if get_dictionary_property(cx.raw_cx(), object.handle(), "premultipliedAlpha", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7857 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
7858 Ok(ConversionResult::Success(value)) => value,
7859 Ok(ConversionResult::Failure(error)) => {
7860 throw_type_error(cx.raw_cx(), &error);
7861 return Err(());
7862
7863 }
7864 _ => {
7865 return Err(());
7866
7867 },
7868 }
7869
7870 } else {
7871 false
7872 }
7873 },
7874 };
7875 Ok(ConversionResult::Success(dictionary))
7876 }
7877 }
7878}
7879
7880impl<D: DomTypes> FromJSValConvertible for GPUImageCopyTextureTagged<D> {
7881 type Config = ();
7882 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
7883 -> Result<ConversionResult<GPUImageCopyTextureTagged<D>>, ()> {
7884 GPUImageCopyTextureTagged::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
7885 }
7886}
7887
7888impl<D: DomTypes> GPUImageCopyTextureTagged<D> {
7889 #[allow(clippy::wrong_self_convention)]
7890 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
7891 self.parent.to_jsobject(cx, obj.reborrow());
7892 let premultipliedAlpha = &self.premultipliedAlpha;
7893 rooted!(in(cx) let mut premultipliedAlpha_js = UndefinedValue());
7894 premultipliedAlpha.to_jsval(cx, premultipliedAlpha_js.handle_mut());
7895 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "premultipliedAlpha", premultipliedAlpha_js.handle()).unwrap();
7896 }
7897}
7898
7899impl<D: DomTypes> ToJSValConvertible for GPUImageCopyTextureTagged<D> {
7900 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
7901 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
7902 self.to_jsobject(cx, obj.handle_mut());
7903 rval.set(ObjectOrNullValue(obj.get()))
7904 }
7905}
7906
7907
7908#[derive(JSTraceable)]
7909pub struct GPUImageCopyExternalImage<D: DomTypes> {
7910 pub flipY: bool,
7911 pub origin: GenericUnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUOrigin2DDict,
7912 pub source: GenericUnionTypes::ImageBitmapOrHTMLCanvasElementOrOffscreenCanvas::<D>,
7913}
7914
7915impl<D: DomTypes> GPUImageCopyExternalImage<D> {
7916
7917 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
7918 -> Result<ConversionResult<GPUImageCopyExternalImage<D>>, ()> {
7919 unsafe {
7920 let object = if val.get().is_null_or_undefined() {
7921 ptr::null_mut()
7922 } else if val.get().is_object() {
7923 val.get().to_object()
7924 } else {
7925 return Ok(ConversionResult::Failure("Value is not an object.".into()));
7926 };
7927 rooted!(&in(cx) let object = object);
7928 let dictionary = GPUImageCopyExternalImage {
7929 flipY: {
7930 rooted!(&in(cx) let mut rval = UndefinedValue());
7931 if get_dictionary_property(cx.raw_cx(), object.handle(), "flipY", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7932 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
7933 Ok(ConversionResult::Success(value)) => value,
7934 Ok(ConversionResult::Failure(error)) => {
7935 throw_type_error(cx.raw_cx(), &error);
7936 return Err(());
7937
7938 }
7939 _ => {
7940 return Err(());
7941
7942 },
7943 }
7944
7945 } else {
7946 false
7947 }
7948 },
7949 origin: {
7950 rooted!(&in(cx) let mut rval = UndefinedValue());
7951 if get_dictionary_property(cx.raw_cx(), object.handle(), "origin", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7952 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
7953 Ok(ConversionResult::Success(value)) => value,
7954 Ok(ConversionResult::Failure(error)) => {
7955 throw_type_error(cx.raw_cx(), &error);
7956 return Err(());
7957
7958 }
7959 _ => {
7960 return Err(());
7961
7962 },
7963 }
7964
7965 } else {
7966 GenericUnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUOrigin2DDict::GPUOrigin2DDict(crate::codegen::GenericBindings::WebGPUBinding::GPUOrigin2DDict::empty())
7967 }
7968 },
7969 source: {
7970 rooted!(&in(cx) let mut rval = UndefinedValue());
7971 if get_dictionary_property(cx.raw_cx(), object.handle(), "source", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
7972 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
7973 Ok(ConversionResult::Success(value)) => value,
7974 Ok(ConversionResult::Failure(error)) => {
7975 throw_type_error(cx.raw_cx(), &error);
7976 return Err(());
7977
7978 }
7979 _ => {
7980 return Err(());
7981
7982 },
7983 }
7984
7985 } else {
7986 throw_type_error(cx.raw_cx(), "Missing required member \"source\".");
7987 return Err(());
7988 }
7989 },
7990 };
7991 Ok(ConversionResult::Success(dictionary))
7992 }
7993 }
7994}
7995
7996impl<D: DomTypes> FromJSValConvertible for GPUImageCopyExternalImage<D> {
7997 type Config = ();
7998 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
7999 -> Result<ConversionResult<GPUImageCopyExternalImage<D>>, ()> {
8000 GPUImageCopyExternalImage::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
8001 }
8002}
8003
8004impl<D: DomTypes> GPUImageCopyExternalImage<D> {
8005 #[allow(clippy::wrong_self_convention)]
8006 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
8007 let flipY = &self.flipY;
8008 rooted!(in(cx) let mut flipY_js = UndefinedValue());
8009 flipY.to_jsval(cx, flipY_js.handle_mut());
8010 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "flipY", flipY_js.handle()).unwrap();
8011 let origin = &self.origin;
8012 rooted!(in(cx) let mut origin_js = UndefinedValue());
8013 origin.to_jsval(cx, origin_js.handle_mut());
8014 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "origin", origin_js.handle()).unwrap();
8015 let source = &self.source;
8016 rooted!(in(cx) let mut source_js = UndefinedValue());
8017 source.to_jsval(cx, source_js.handle_mut());
8018 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "source", source_js.handle()).unwrap();
8019 }
8020}
8021
8022impl<D: DomTypes> ToJSValConvertible for GPUImageCopyExternalImage<D> {
8023 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
8024 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
8025 self.to_jsobject(cx, obj.handle_mut());
8026 rval.set(ObjectOrNullValue(obj.get()))
8027 }
8028}
8029
8030
8031#[derive(JSTraceable)]
8032pub struct GPUCommandBufferDescriptor {
8033 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase,
8034
8035}
8036impl Default for GPUCommandBufferDescriptor {
8037 fn default() -> Self {
8038 Self::empty()
8039 }
8040}
8041
8042impl GPUCommandBufferDescriptor {
8043 pub fn empty() -> Self {
8044 Self {
8045 parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::empty(),
8046 }
8047 }
8048 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
8049 -> Result<ConversionResult<GPUCommandBufferDescriptor>, ()> {
8050 unsafe {
8051 let object = if val.get().is_null_or_undefined() {
8052 ptr::null_mut()
8053 } else if val.get().is_object() {
8054 val.get().to_object()
8055 } else {
8056 return Ok(ConversionResult::Failure("Value is not an object.".into()));
8057 };
8058 rooted!(&in(cx) let object = object);
8059 let dictionary = GPUCommandBufferDescriptor {
8060 parent: {
8061 match crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val, can_gc)? {
8062 ConversionResult::Success(v) => v,
8063 ConversionResult::Failure(error) => {
8064 throw_type_error(cx.raw_cx(), &error);
8065 return Err(());
8066 }
8067 }
8068 },
8069 };
8070 Ok(ConversionResult::Success(dictionary))
8071 }
8072 }
8073}
8074
8075impl FromJSValConvertible for GPUCommandBufferDescriptor {
8076 type Config = ();
8077 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
8078 -> Result<ConversionResult<GPUCommandBufferDescriptor>, ()> {
8079 GPUCommandBufferDescriptor::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
8080 }
8081}
8082
8083impl GPUCommandBufferDescriptor {
8084 #[allow(clippy::wrong_self_convention)]
8085 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
8086 self.parent.to_jsobject(cx, obj.reborrow());
8087 }
8088}
8089
8090impl ToJSValConvertible for GPUCommandBufferDescriptor {
8091 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
8092 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
8093 self.to_jsobject(cx, obj.handle_mut());
8094 rval.set(ObjectOrNullValue(obj.get()))
8095 }
8096}
8097
8098
8099#[derive(JSTraceable)]
8100pub struct GPUImageBitmapCopyView {
8101 pub origin: Option<GenericUnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUOrigin2DDict>,
8102}
8103impl Default for GPUImageBitmapCopyView {
8104 fn default() -> Self {
8105 Self::empty()
8106 }
8107}
8108
8109impl GPUImageBitmapCopyView {
8110 pub fn empty() -> Self {
8111 Self {
8112 origin: None,
8113 }
8114 }
8115 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
8116 -> Result<ConversionResult<GPUImageBitmapCopyView>, ()> {
8117 unsafe {
8118 let object = if val.get().is_null_or_undefined() {
8119 ptr::null_mut()
8120 } else if val.get().is_object() {
8121 val.get().to_object()
8122 } else {
8123 return Ok(ConversionResult::Failure("Value is not an object.".into()));
8124 };
8125 rooted!(&in(cx) let object = object);
8126 let dictionary = GPUImageBitmapCopyView {
8127 origin: {
8128 rooted!(&in(cx) let mut rval = UndefinedValue());
8129 if get_dictionary_property(cx.raw_cx(), object.handle(), "origin", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
8130 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
8131 Ok(ConversionResult::Success(value)) => value,
8132 Ok(ConversionResult::Failure(error)) => {
8133 throw_type_error(cx.raw_cx(), &error);
8134 return Err(());
8135
8136 }
8137 _ => {
8138 return Err(());
8139
8140 },
8141 }
8142 )
8143 } else {
8144 None
8145 }
8146 },
8147 };
8148 Ok(ConversionResult::Success(dictionary))
8149 }
8150 }
8151}
8152
8153impl FromJSValConvertible for GPUImageBitmapCopyView {
8154 type Config = ();
8155 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
8156 -> Result<ConversionResult<GPUImageBitmapCopyView>, ()> {
8157 GPUImageBitmapCopyView::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
8158 }
8159}
8160
8161impl GPUImageBitmapCopyView {
8162 #[allow(clippy::wrong_self_convention)]
8163 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
8164 if let Some(ref origin) = self.origin {
8165 rooted!(in(cx) let mut origin_js = UndefinedValue());
8166 origin.to_jsval(cx, origin_js.handle_mut());
8167 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "origin", origin_js.handle()).unwrap();
8168 }
8169 }
8170}
8171
8172impl ToJSValConvertible for GPUImageBitmapCopyView {
8173 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
8174 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
8175 self.to_jsobject(cx, obj.handle_mut());
8176 rval.set(ObjectOrNullValue(obj.get()))
8177 }
8178}
8179
8180
8181#[derive(JSTraceable)]
8182pub struct GPUCommandEncoderDescriptor {
8183 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase,
8184 pub measureExecutionTime: bool,
8185}
8186impl Default for GPUCommandEncoderDescriptor {
8187 fn default() -> Self {
8188 Self::empty()
8189 }
8190}
8191
8192impl GPUCommandEncoderDescriptor {
8193 pub fn empty() -> Self {
8194 Self {
8195 parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::empty(),
8196 measureExecutionTime: false,
8197 }
8198 }
8199 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
8200 -> Result<ConversionResult<GPUCommandEncoderDescriptor>, ()> {
8201 unsafe {
8202 let object = if val.get().is_null_or_undefined() {
8203 ptr::null_mut()
8204 } else if val.get().is_object() {
8205 val.get().to_object()
8206 } else {
8207 return Ok(ConversionResult::Failure("Value is not an object.".into()));
8208 };
8209 rooted!(&in(cx) let object = object);
8210 let dictionary = GPUCommandEncoderDescriptor {
8211 parent: {
8212 match crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val, can_gc)? {
8213 ConversionResult::Success(v) => v,
8214 ConversionResult::Failure(error) => {
8215 throw_type_error(cx.raw_cx(), &error);
8216 return Err(());
8217 }
8218 }
8219 },
8220 measureExecutionTime: {
8221 rooted!(&in(cx) let mut rval = UndefinedValue());
8222 if get_dictionary_property(cx.raw_cx(), object.handle(), "measureExecutionTime", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
8223 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
8224 Ok(ConversionResult::Success(value)) => value,
8225 Ok(ConversionResult::Failure(error)) => {
8226 throw_type_error(cx.raw_cx(), &error);
8227 return Err(());
8228
8229 }
8230 _ => {
8231 return Err(());
8232
8233 },
8234 }
8235
8236 } else {
8237 false
8238 }
8239 },
8240 };
8241 Ok(ConversionResult::Success(dictionary))
8242 }
8243 }
8244}
8245
8246impl FromJSValConvertible for GPUCommandEncoderDescriptor {
8247 type Config = ();
8248 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
8249 -> Result<ConversionResult<GPUCommandEncoderDescriptor>, ()> {
8250 GPUCommandEncoderDescriptor::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
8251 }
8252}
8253
8254impl GPUCommandEncoderDescriptor {
8255 #[allow(clippy::wrong_self_convention)]
8256 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
8257 self.parent.to_jsobject(cx, obj.reborrow());
8258 let measureExecutionTime = &self.measureExecutionTime;
8259 rooted!(in(cx) let mut measureExecutionTime_js = UndefinedValue());
8260 measureExecutionTime.to_jsval(cx, measureExecutionTime_js.handle_mut());
8261 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "measureExecutionTime", measureExecutionTime_js.handle()).unwrap();
8262 }
8263}
8264
8265impl ToJSValConvertible for GPUCommandEncoderDescriptor {
8266 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
8267 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
8268 self.to_jsobject(cx, obj.handle_mut());
8269 rval.set(ObjectOrNullValue(obj.get()))
8270 }
8271}
8272
8273
8274#[derive(JSTraceable)]
8275pub struct GPUComputePassDescriptor {
8276 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase,
8277
8278}
8279impl Default for GPUComputePassDescriptor {
8280 fn default() -> Self {
8281 Self::empty()
8282 }
8283}
8284
8285impl GPUComputePassDescriptor {
8286 pub fn empty() -> Self {
8287 Self {
8288 parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::empty(),
8289 }
8290 }
8291 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
8292 -> Result<ConversionResult<GPUComputePassDescriptor>, ()> {
8293 unsafe {
8294 let object = if val.get().is_null_or_undefined() {
8295 ptr::null_mut()
8296 } else if val.get().is_object() {
8297 val.get().to_object()
8298 } else {
8299 return Ok(ConversionResult::Failure("Value is not an object.".into()));
8300 };
8301 rooted!(&in(cx) let object = object);
8302 let dictionary = GPUComputePassDescriptor {
8303 parent: {
8304 match crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val, can_gc)? {
8305 ConversionResult::Success(v) => v,
8306 ConversionResult::Failure(error) => {
8307 throw_type_error(cx.raw_cx(), &error);
8308 return Err(());
8309 }
8310 }
8311 },
8312 };
8313 Ok(ConversionResult::Success(dictionary))
8314 }
8315 }
8316}
8317
8318impl FromJSValConvertible for GPUComputePassDescriptor {
8319 type Config = ();
8320 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
8321 -> Result<ConversionResult<GPUComputePassDescriptor>, ()> {
8322 GPUComputePassDescriptor::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
8323 }
8324}
8325
8326impl GPUComputePassDescriptor {
8327 #[allow(clippy::wrong_self_convention)]
8328 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
8329 self.parent.to_jsobject(cx, obj.reborrow());
8330 }
8331}
8332
8333impl ToJSValConvertible for GPUComputePassDescriptor {
8334 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
8335 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
8336 self.to_jsobject(cx, obj.handle_mut());
8337 rval.set(ObjectOrNullValue(obj.get()))
8338 }
8339}
8340
8341
8342#[derive(JSTraceable)]
8343pub struct GPURenderPassDescriptor<D: DomTypes> {
8344 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase,
8345 pub colorAttachments: Vec<crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassColorAttachment<D>>,
8346 pub depthStencilAttachment: Option<crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassDepthStencilAttachment<D>>,
8347 pub occlusionQuerySet: Option<DomRoot<D::GPUQuerySet>>,
8348}
8349
8350impl<D: DomTypes> GPURenderPassDescriptor<D> {
8351
8352 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
8353 -> Result<ConversionResult<GPURenderPassDescriptor<D>>, ()> {
8354 unsafe {
8355 let object = if val.get().is_null_or_undefined() {
8356 ptr::null_mut()
8357 } else if val.get().is_object() {
8358 val.get().to_object()
8359 } else {
8360 return Ok(ConversionResult::Failure("Value is not an object.".into()));
8361 };
8362 rooted!(&in(cx) let object = object);
8363 let dictionary = GPURenderPassDescriptor {
8364 parent: {
8365 match crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val, can_gc)? {
8366 ConversionResult::Success(v) => v,
8367 ConversionResult::Failure(error) => {
8368 throw_type_error(cx.raw_cx(), &error);
8369 return Err(());
8370 }
8371 }
8372 },
8373 colorAttachments: {
8374 rooted!(&in(cx) let mut rval = UndefinedValue());
8375 if get_dictionary_property(cx.raw_cx(), object.handle(), "colorAttachments", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
8376 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
8377 Ok(ConversionResult::Success(value)) => value,
8378 Ok(ConversionResult::Failure(error)) => {
8379 throw_type_error(cx.raw_cx(), &error);
8380 return Err(());
8381
8382 }
8383 _ => {
8384 return Err(());
8385
8386 },
8387 }
8388
8389 } else {
8390 throw_type_error(cx.raw_cx(), "Missing required member \"colorAttachments\".");
8391 return Err(());
8392 }
8393 },
8394 depthStencilAttachment: {
8395 rooted!(&in(cx) let mut rval = UndefinedValue());
8396 if get_dictionary_property(cx.raw_cx(), object.handle(), "depthStencilAttachment", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
8397 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
8398 Ok(ConversionResult::Success(value)) => value,
8399 Ok(ConversionResult::Failure(error)) => {
8400 throw_type_error(cx.raw_cx(), &error);
8401 return Err(());
8402
8403 }
8404 _ => {
8405 return Err(());
8406
8407 },
8408 }
8409 )
8410 } else {
8411 None
8412 }
8413 },
8414 occlusionQuerySet: {
8415 rooted!(&in(cx) let mut rval = UndefinedValue());
8416 if get_dictionary_property(cx.raw_cx(), object.handle(), "occlusionQuerySet", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
8417 Some(if rval.handle().get().is_object() {
8418 match root_from_handlevalue(rval.handle(), SafeJSContext::from_ptr(cx.raw_cx())) {
8419 Ok(val) => val,
8420 Err(()) => {
8421 throw_type_error(cx.raw_cx(), "value does not implement interface GPUQuerySet.");
8422 return Err(());
8423
8424 }
8425 }
8426
8427 } else {
8428 throw_type_error(cx.raw_cx(), "Value is not an object.");
8429 return Err(());
8430
8431 })
8432 } else {
8433 None
8434 }
8435 },
8436 };
8437 Ok(ConversionResult::Success(dictionary))
8438 }
8439 }
8440}
8441
8442impl<D: DomTypes> FromJSValConvertible for GPURenderPassDescriptor<D> {
8443 type Config = ();
8444 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
8445 -> Result<ConversionResult<GPURenderPassDescriptor<D>>, ()> {
8446 GPURenderPassDescriptor::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
8447 }
8448}
8449
8450impl<D: DomTypes> GPURenderPassDescriptor<D> {
8451 #[allow(clippy::wrong_self_convention)]
8452 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
8453 self.parent.to_jsobject(cx, obj.reborrow());
8454 let colorAttachments = &self.colorAttachments;
8455 rooted!(in(cx) let mut colorAttachments_js = UndefinedValue());
8456 colorAttachments.to_jsval(cx, colorAttachments_js.handle_mut());
8457 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "colorAttachments", colorAttachments_js.handle()).unwrap();
8458 if let Some(ref depthStencilAttachment) = self.depthStencilAttachment {
8459 rooted!(in(cx) let mut depthStencilAttachment_js = UndefinedValue());
8460 depthStencilAttachment.to_jsval(cx, depthStencilAttachment_js.handle_mut());
8461 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "depthStencilAttachment", depthStencilAttachment_js.handle()).unwrap();
8462 }
8463 if let Some(ref occlusionQuerySet) = self.occlusionQuerySet {
8464 rooted!(in(cx) let mut occlusionQuerySet_js = UndefinedValue());
8465 occlusionQuerySet.to_jsval(cx, occlusionQuerySet_js.handle_mut());
8466 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "occlusionQuerySet", occlusionQuerySet_js.handle()).unwrap();
8467 }
8468 }
8469}
8470
8471impl<D: DomTypes> ToJSValConvertible for GPURenderPassDescriptor<D> {
8472 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
8473 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
8474 self.to_jsobject(cx, obj.handle_mut());
8475 rval.set(ObjectOrNullValue(obj.get()))
8476 }
8477}
8478
8479
8480#[derive(JSTraceable)]
8481pub struct GPURenderPassColorAttachment<D: DomTypes> {
8482 pub clearValue: Option<GenericUnionTypes::DoubleSequenceOrGPUColorDict>,
8483 pub loadOp: GPULoadOp,
8484 pub resolveTarget: Option<DomRoot<D::GPUTextureView>>,
8485 pub storeOp: GPUStoreOp,
8486 pub view: DomRoot<D::GPUTextureView>,
8487}
8488
8489impl<D: DomTypes> GPURenderPassColorAttachment<D> {
8490
8491 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
8492 -> Result<ConversionResult<GPURenderPassColorAttachment<D>>, ()> {
8493 unsafe {
8494 let object = if val.get().is_null_or_undefined() {
8495 ptr::null_mut()
8496 } else if val.get().is_object() {
8497 val.get().to_object()
8498 } else {
8499 return Ok(ConversionResult::Failure("Value is not an object.".into()));
8500 };
8501 rooted!(&in(cx) let object = object);
8502 let dictionary = GPURenderPassColorAttachment {
8503 clearValue: {
8504 rooted!(&in(cx) let mut rval = UndefinedValue());
8505 if get_dictionary_property(cx.raw_cx(), object.handle(), "clearValue", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
8506 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
8507 Ok(ConversionResult::Success(value)) => value,
8508 Ok(ConversionResult::Failure(error)) => {
8509 throw_type_error(cx.raw_cx(), &error);
8510 return Err(());
8511
8512 }
8513 _ => {
8514 return Err(());
8515
8516 },
8517 }
8518 )
8519 } else {
8520 None
8521 }
8522 },
8523 loadOp: {
8524 rooted!(&in(cx) let mut rval = UndefinedValue());
8525 if get_dictionary_property(cx.raw_cx(), object.handle(), "loadOp", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
8526 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
8527 Ok(ConversionResult::Success(value)) => value,
8528 Ok(ConversionResult::Failure(error)) => {
8529 throw_type_error(cx.raw_cx(), &error); return Err(());
8530
8531 }
8532 _ => {
8533 return Err(());
8534
8535 },
8536 }
8537
8538 } else {
8539 throw_type_error(cx.raw_cx(), "Missing required member \"loadOp\".");
8540 return Err(());
8541 }
8542 },
8543 resolveTarget: {
8544 rooted!(&in(cx) let mut rval = UndefinedValue());
8545 if get_dictionary_property(cx.raw_cx(), object.handle(), "resolveTarget", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
8546 Some(if rval.handle().get().is_object() {
8547 match root_from_handlevalue(rval.handle(), SafeJSContext::from_ptr(cx.raw_cx())) {
8548 Ok(val) => val,
8549 Err(()) => {
8550 throw_type_error(cx.raw_cx(), "value does not implement interface GPUTextureView.");
8551 return Err(());
8552
8553 }
8554 }
8555
8556 } else {
8557 throw_type_error(cx.raw_cx(), "Value is not an object.");
8558 return Err(());
8559
8560 })
8561 } else {
8562 None
8563 }
8564 },
8565 storeOp: {
8566 rooted!(&in(cx) let mut rval = UndefinedValue());
8567 if get_dictionary_property(cx.raw_cx(), object.handle(), "storeOp", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
8568 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
8569 Ok(ConversionResult::Success(value)) => value,
8570 Ok(ConversionResult::Failure(error)) => {
8571 throw_type_error(cx.raw_cx(), &error); return Err(());
8572
8573 }
8574 _ => {
8575 return Err(());
8576
8577 },
8578 }
8579
8580 } else {
8581 throw_type_error(cx.raw_cx(), "Missing required member \"storeOp\".");
8582 return Err(());
8583 }
8584 },
8585 view: {
8586 rooted!(&in(cx) let mut rval = UndefinedValue());
8587 if get_dictionary_property(cx.raw_cx(), object.handle(), "view", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
8588 if rval.handle().get().is_object() {
8589 match root_from_handlevalue(rval.handle(), SafeJSContext::from_ptr(cx.raw_cx())) {
8590 Ok(val) => val,
8591 Err(()) => {
8592 throw_type_error(cx.raw_cx(), "value does not implement interface GPUTextureView.");
8593 return Err(());
8594
8595 }
8596 }
8597
8598 } else {
8599 throw_type_error(cx.raw_cx(), "Value is not an object.");
8600 return Err(());
8601
8602 }
8603 } else {
8604 throw_type_error(cx.raw_cx(), "Missing required member \"view\".");
8605 return Err(());
8606 }
8607 },
8608 };
8609 Ok(ConversionResult::Success(dictionary))
8610 }
8611 }
8612}
8613
8614impl<D: DomTypes> FromJSValConvertible for GPURenderPassColorAttachment<D> {
8615 type Config = ();
8616 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
8617 -> Result<ConversionResult<GPURenderPassColorAttachment<D>>, ()> {
8618 GPURenderPassColorAttachment::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
8619 }
8620}
8621
8622impl<D: DomTypes> GPURenderPassColorAttachment<D> {
8623 #[allow(clippy::wrong_self_convention)]
8624 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
8625 if let Some(ref clearValue) = self.clearValue {
8626 rooted!(in(cx) let mut clearValue_js = UndefinedValue());
8627 clearValue.to_jsval(cx, clearValue_js.handle_mut());
8628 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "clearValue", clearValue_js.handle()).unwrap();
8629 }
8630 let loadOp = &self.loadOp;
8631 rooted!(in(cx) let mut loadOp_js = UndefinedValue());
8632 loadOp.to_jsval(cx, loadOp_js.handle_mut());
8633 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "loadOp", loadOp_js.handle()).unwrap();
8634 if let Some(ref resolveTarget) = self.resolveTarget {
8635 rooted!(in(cx) let mut resolveTarget_js = UndefinedValue());
8636 resolveTarget.to_jsval(cx, resolveTarget_js.handle_mut());
8637 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "resolveTarget", resolveTarget_js.handle()).unwrap();
8638 }
8639 let storeOp = &self.storeOp;
8640 rooted!(in(cx) let mut storeOp_js = UndefinedValue());
8641 storeOp.to_jsval(cx, storeOp_js.handle_mut());
8642 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "storeOp", storeOp_js.handle()).unwrap();
8643 let view = &self.view;
8644 rooted!(in(cx) let mut view_js = UndefinedValue());
8645 view.to_jsval(cx, view_js.handle_mut());
8646 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "view", view_js.handle()).unwrap();
8647 }
8648}
8649
8650impl<D: DomTypes> ToJSValConvertible for GPURenderPassColorAttachment<D> {
8651 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
8652 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
8653 self.to_jsobject(cx, obj.handle_mut());
8654 rval.set(ObjectOrNullValue(obj.get()))
8655 }
8656}
8657
8658
8659#[derive(JSTraceable)]
8660pub struct GPURenderPassDepthStencilAttachment<D: DomTypes> {
8661 pub depthClearValue: Option<Finite<f32>>,
8662 pub depthLoadOp: Option<GPULoadOp>,
8663 pub depthReadOnly: bool,
8664 pub depthStoreOp: Option<GPUStoreOp>,
8665 pub stencilClearValue: u32,
8666 pub stencilLoadOp: Option<GPULoadOp>,
8667 pub stencilReadOnly: bool,
8668 pub stencilStoreOp: Option<GPUStoreOp>,
8669 pub view: DomRoot<D::GPUTextureView>,
8670}
8671
8672impl<D: DomTypes> GPURenderPassDepthStencilAttachment<D> {
8673
8674 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
8675 -> Result<ConversionResult<GPURenderPassDepthStencilAttachment<D>>, ()> {
8676 unsafe {
8677 let object = if val.get().is_null_or_undefined() {
8678 ptr::null_mut()
8679 } else if val.get().is_object() {
8680 val.get().to_object()
8681 } else {
8682 return Ok(ConversionResult::Failure("Value is not an object.".into()));
8683 };
8684 rooted!(&in(cx) let object = object);
8685 let dictionary = GPURenderPassDepthStencilAttachment {
8686 depthClearValue: {
8687 rooted!(&in(cx) let mut rval = UndefinedValue());
8688 if get_dictionary_property(cx.raw_cx(), object.handle(), "depthClearValue", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
8689 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
8690 Ok(ConversionResult::Success(value)) => value,
8691 Ok(ConversionResult::Failure(error)) => {
8692 throw_type_error(cx.raw_cx(), &error);
8693 return Err(());
8694
8695 }
8696 _ => {
8697 return Err(());
8698
8699 },
8700 }
8701 )
8702 } else {
8703 None
8704 }
8705 },
8706 depthLoadOp: {
8707 rooted!(&in(cx) let mut rval = UndefinedValue());
8708 if get_dictionary_property(cx.raw_cx(), object.handle(), "depthLoadOp", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
8709 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
8710 Ok(ConversionResult::Success(value)) => value,
8711 Ok(ConversionResult::Failure(error)) => {
8712 throw_type_error(cx.raw_cx(), &error); return Err(());
8713
8714 }
8715 _ => {
8716 return Err(());
8717
8718 },
8719 }
8720 )
8721 } else {
8722 None
8723 }
8724 },
8725 depthReadOnly: {
8726 rooted!(&in(cx) let mut rval = UndefinedValue());
8727 if get_dictionary_property(cx.raw_cx(), object.handle(), "depthReadOnly", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
8728 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
8729 Ok(ConversionResult::Success(value)) => value,
8730 Ok(ConversionResult::Failure(error)) => {
8731 throw_type_error(cx.raw_cx(), &error);
8732 return Err(());
8733
8734 }
8735 _ => {
8736 return Err(());
8737
8738 },
8739 }
8740
8741 } else {
8742 false
8743 }
8744 },
8745 depthStoreOp: {
8746 rooted!(&in(cx) let mut rval = UndefinedValue());
8747 if get_dictionary_property(cx.raw_cx(), object.handle(), "depthStoreOp", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
8748 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
8749 Ok(ConversionResult::Success(value)) => value,
8750 Ok(ConversionResult::Failure(error)) => {
8751 throw_type_error(cx.raw_cx(), &error); return Err(());
8752
8753 }
8754 _ => {
8755 return Err(());
8756
8757 },
8758 }
8759 )
8760 } else {
8761 None
8762 }
8763 },
8764 stencilClearValue: {
8765 rooted!(&in(cx) let mut rval = UndefinedValue());
8766 if get_dictionary_property(cx.raw_cx(), object.handle(), "stencilClearValue", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
8767 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
8768 Ok(ConversionResult::Success(value)) => value,
8769 Ok(ConversionResult::Failure(error)) => {
8770 throw_type_error(cx.raw_cx(), &error);
8771 return Err(());
8772
8773 }
8774 _ => {
8775 return Err(());
8776
8777 },
8778 }
8779
8780 } else {
8781 0
8782 }
8783 },
8784 stencilLoadOp: {
8785 rooted!(&in(cx) let mut rval = UndefinedValue());
8786 if get_dictionary_property(cx.raw_cx(), object.handle(), "stencilLoadOp", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
8787 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
8788 Ok(ConversionResult::Success(value)) => value,
8789 Ok(ConversionResult::Failure(error)) => {
8790 throw_type_error(cx.raw_cx(), &error); return Err(());
8791
8792 }
8793 _ => {
8794 return Err(());
8795
8796 },
8797 }
8798 )
8799 } else {
8800 None
8801 }
8802 },
8803 stencilReadOnly: {
8804 rooted!(&in(cx) let mut rval = UndefinedValue());
8805 if get_dictionary_property(cx.raw_cx(), object.handle(), "stencilReadOnly", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
8806 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
8807 Ok(ConversionResult::Success(value)) => value,
8808 Ok(ConversionResult::Failure(error)) => {
8809 throw_type_error(cx.raw_cx(), &error);
8810 return Err(());
8811
8812 }
8813 _ => {
8814 return Err(());
8815
8816 },
8817 }
8818
8819 } else {
8820 false
8821 }
8822 },
8823 stencilStoreOp: {
8824 rooted!(&in(cx) let mut rval = UndefinedValue());
8825 if get_dictionary_property(cx.raw_cx(), object.handle(), "stencilStoreOp", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
8826 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
8827 Ok(ConversionResult::Success(value)) => value,
8828 Ok(ConversionResult::Failure(error)) => {
8829 throw_type_error(cx.raw_cx(), &error); return Err(());
8830
8831 }
8832 _ => {
8833 return Err(());
8834
8835 },
8836 }
8837 )
8838 } else {
8839 None
8840 }
8841 },
8842 view: {
8843 rooted!(&in(cx) let mut rval = UndefinedValue());
8844 if get_dictionary_property(cx.raw_cx(), object.handle(), "view", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
8845 if rval.handle().get().is_object() {
8846 match root_from_handlevalue(rval.handle(), SafeJSContext::from_ptr(cx.raw_cx())) {
8847 Ok(val) => val,
8848 Err(()) => {
8849 throw_type_error(cx.raw_cx(), "value does not implement interface GPUTextureView.");
8850 return Err(());
8851
8852 }
8853 }
8854
8855 } else {
8856 throw_type_error(cx.raw_cx(), "Value is not an object.");
8857 return Err(());
8858
8859 }
8860 } else {
8861 throw_type_error(cx.raw_cx(), "Missing required member \"view\".");
8862 return Err(());
8863 }
8864 },
8865 };
8866 Ok(ConversionResult::Success(dictionary))
8867 }
8868 }
8869}
8870
8871impl<D: DomTypes> FromJSValConvertible for GPURenderPassDepthStencilAttachment<D> {
8872 type Config = ();
8873 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
8874 -> Result<ConversionResult<GPURenderPassDepthStencilAttachment<D>>, ()> {
8875 GPURenderPassDepthStencilAttachment::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
8876 }
8877}
8878
8879impl<D: DomTypes> GPURenderPassDepthStencilAttachment<D> {
8880 #[allow(clippy::wrong_self_convention)]
8881 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
8882 if let Some(ref depthClearValue) = self.depthClearValue {
8883 rooted!(in(cx) let mut depthClearValue_js = UndefinedValue());
8884 depthClearValue.to_jsval(cx, depthClearValue_js.handle_mut());
8885 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "depthClearValue", depthClearValue_js.handle()).unwrap();
8886 }
8887 if let Some(ref depthLoadOp) = self.depthLoadOp {
8888 rooted!(in(cx) let mut depthLoadOp_js = UndefinedValue());
8889 depthLoadOp.to_jsval(cx, depthLoadOp_js.handle_mut());
8890 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "depthLoadOp", depthLoadOp_js.handle()).unwrap();
8891 }
8892 let depthReadOnly = &self.depthReadOnly;
8893 rooted!(in(cx) let mut depthReadOnly_js = UndefinedValue());
8894 depthReadOnly.to_jsval(cx, depthReadOnly_js.handle_mut());
8895 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "depthReadOnly", depthReadOnly_js.handle()).unwrap();
8896 if let Some(ref depthStoreOp) = self.depthStoreOp {
8897 rooted!(in(cx) let mut depthStoreOp_js = UndefinedValue());
8898 depthStoreOp.to_jsval(cx, depthStoreOp_js.handle_mut());
8899 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "depthStoreOp", depthStoreOp_js.handle()).unwrap();
8900 }
8901 let stencilClearValue = &self.stencilClearValue;
8902 rooted!(in(cx) let mut stencilClearValue_js = UndefinedValue());
8903 stencilClearValue.to_jsval(cx, stencilClearValue_js.handle_mut());
8904 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "stencilClearValue", stencilClearValue_js.handle()).unwrap();
8905 if let Some(ref stencilLoadOp) = self.stencilLoadOp {
8906 rooted!(in(cx) let mut stencilLoadOp_js = UndefinedValue());
8907 stencilLoadOp.to_jsval(cx, stencilLoadOp_js.handle_mut());
8908 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "stencilLoadOp", stencilLoadOp_js.handle()).unwrap();
8909 }
8910 let stencilReadOnly = &self.stencilReadOnly;
8911 rooted!(in(cx) let mut stencilReadOnly_js = UndefinedValue());
8912 stencilReadOnly.to_jsval(cx, stencilReadOnly_js.handle_mut());
8913 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "stencilReadOnly", stencilReadOnly_js.handle()).unwrap();
8914 if let Some(ref stencilStoreOp) = self.stencilStoreOp {
8915 rooted!(in(cx) let mut stencilStoreOp_js = UndefinedValue());
8916 stencilStoreOp.to_jsval(cx, stencilStoreOp_js.handle_mut());
8917 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "stencilStoreOp", stencilStoreOp_js.handle()).unwrap();
8918 }
8919 let view = &self.view;
8920 rooted!(in(cx) let mut view_js = UndefinedValue());
8921 view.to_jsval(cx, view_js.handle_mut());
8922 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "view", view_js.handle()).unwrap();
8923 }
8924}
8925
8926impl<D: DomTypes> ToJSValConvertible for GPURenderPassDepthStencilAttachment<D> {
8927 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
8928 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
8929 self.to_jsobject(cx, obj.handle_mut());
8930 rval.set(ObjectOrNullValue(obj.get()))
8931 }
8932}
8933
8934
8935#[derive(JSTraceable)]
8936pub struct GPURenderPassLayout {
8937 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase,
8938 pub colorFormats: Vec<GPUTextureFormat>,
8939 pub depthStencilFormat: Option<GPUTextureFormat>,
8940 pub sampleCount: u32,
8941}
8942
8943impl GPURenderPassLayout {
8944
8945 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
8946 -> Result<ConversionResult<GPURenderPassLayout>, ()> {
8947 unsafe {
8948 let object = if val.get().is_null_or_undefined() {
8949 ptr::null_mut()
8950 } else if val.get().is_object() {
8951 val.get().to_object()
8952 } else {
8953 return Ok(ConversionResult::Failure("Value is not an object.".into()));
8954 };
8955 rooted!(&in(cx) let object = object);
8956 let dictionary = GPURenderPassLayout {
8957 parent: {
8958 match crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val, can_gc)? {
8959 ConversionResult::Success(v) => v,
8960 ConversionResult::Failure(error) => {
8961 throw_type_error(cx.raw_cx(), &error);
8962 return Err(());
8963 }
8964 }
8965 },
8966 colorFormats: {
8967 rooted!(&in(cx) let mut rval = UndefinedValue());
8968 if get_dictionary_property(cx.raw_cx(), object.handle(), "colorFormats", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
8969 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
8970 Ok(ConversionResult::Success(value)) => value,
8971 Ok(ConversionResult::Failure(error)) => {
8972 throw_type_error(cx.raw_cx(), &error);
8973 return Err(());
8974
8975 }
8976 _ => {
8977 return Err(());
8978
8979 },
8980 }
8981
8982 } else {
8983 throw_type_error(cx.raw_cx(), "Missing required member \"colorFormats\".");
8984 return Err(());
8985 }
8986 },
8987 depthStencilFormat: {
8988 rooted!(&in(cx) let mut rval = UndefinedValue());
8989 if get_dictionary_property(cx.raw_cx(), object.handle(), "depthStencilFormat", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
8990 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
8991 Ok(ConversionResult::Success(value)) => value,
8992 Ok(ConversionResult::Failure(error)) => {
8993 throw_type_error(cx.raw_cx(), &error); return Err(());
8994
8995 }
8996 _ => {
8997 return Err(());
8998
8999 },
9000 }
9001 )
9002 } else {
9003 None
9004 }
9005 },
9006 sampleCount: {
9007 rooted!(&in(cx) let mut rval = UndefinedValue());
9008 if get_dictionary_property(cx.raw_cx(), object.handle(), "sampleCount", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
9009 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
9010 Ok(ConversionResult::Success(value)) => value,
9011 Ok(ConversionResult::Failure(error)) => {
9012 throw_type_error(cx.raw_cx(), &error);
9013 return Err(());
9014
9015 }
9016 _ => {
9017 return Err(());
9018
9019 },
9020 }
9021
9022 } else {
9023 1
9024 }
9025 },
9026 };
9027 Ok(ConversionResult::Success(dictionary))
9028 }
9029 }
9030}
9031
9032impl FromJSValConvertible for GPURenderPassLayout {
9033 type Config = ();
9034 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
9035 -> Result<ConversionResult<GPURenderPassLayout>, ()> {
9036 GPURenderPassLayout::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
9037 }
9038}
9039
9040impl GPURenderPassLayout {
9041 #[allow(clippy::wrong_self_convention)]
9042 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
9043 self.parent.to_jsobject(cx, obj.reborrow());
9044 let colorFormats = &self.colorFormats;
9045 rooted!(in(cx) let mut colorFormats_js = UndefinedValue());
9046 colorFormats.to_jsval(cx, colorFormats_js.handle_mut());
9047 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "colorFormats", colorFormats_js.handle()).unwrap();
9048 if let Some(ref depthStencilFormat) = self.depthStencilFormat {
9049 rooted!(in(cx) let mut depthStencilFormat_js = UndefinedValue());
9050 depthStencilFormat.to_jsval(cx, depthStencilFormat_js.handle_mut());
9051 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "depthStencilFormat", depthStencilFormat_js.handle()).unwrap();
9052 }
9053 let sampleCount = &self.sampleCount;
9054 rooted!(in(cx) let mut sampleCount_js = UndefinedValue());
9055 sampleCount.to_jsval(cx, sampleCount_js.handle_mut());
9056 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "sampleCount", sampleCount_js.handle()).unwrap();
9057 }
9058}
9059
9060impl ToJSValConvertible for GPURenderPassLayout {
9061 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
9062 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
9063 self.to_jsobject(cx, obj.handle_mut());
9064 rval.set(ObjectOrNullValue(obj.get()))
9065 }
9066}
9067
9068
9069#[derive(JSTraceable)]
9070pub struct GPURenderBundleDescriptor {
9071 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase,
9072
9073}
9074impl Default for GPURenderBundleDescriptor {
9075 fn default() -> Self {
9076 Self::empty()
9077 }
9078}
9079
9080impl GPURenderBundleDescriptor {
9081 pub fn empty() -> Self {
9082 Self {
9083 parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::empty(),
9084 }
9085 }
9086 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
9087 -> Result<ConversionResult<GPURenderBundleDescriptor>, ()> {
9088 unsafe {
9089 let object = if val.get().is_null_or_undefined() {
9090 ptr::null_mut()
9091 } else if val.get().is_object() {
9092 val.get().to_object()
9093 } else {
9094 return Ok(ConversionResult::Failure("Value is not an object.".into()));
9095 };
9096 rooted!(&in(cx) let object = object);
9097 let dictionary = GPURenderBundleDescriptor {
9098 parent: {
9099 match crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val, can_gc)? {
9100 ConversionResult::Success(v) => v,
9101 ConversionResult::Failure(error) => {
9102 throw_type_error(cx.raw_cx(), &error);
9103 return Err(());
9104 }
9105 }
9106 },
9107 };
9108 Ok(ConversionResult::Success(dictionary))
9109 }
9110 }
9111}
9112
9113impl FromJSValConvertible for GPURenderBundleDescriptor {
9114 type Config = ();
9115 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
9116 -> Result<ConversionResult<GPURenderBundleDescriptor>, ()> {
9117 GPURenderBundleDescriptor::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
9118 }
9119}
9120
9121impl GPURenderBundleDescriptor {
9122 #[allow(clippy::wrong_self_convention)]
9123 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
9124 self.parent.to_jsobject(cx, obj.reborrow());
9125 }
9126}
9127
9128impl ToJSValConvertible for GPURenderBundleDescriptor {
9129 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
9130 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
9131 self.to_jsobject(cx, obj.handle_mut());
9132 rval.set(ObjectOrNullValue(obj.get()))
9133 }
9134}
9135
9136
9137#[derive(JSTraceable)]
9138pub struct GPURenderBundleEncoderDescriptor {
9139 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassLayout,
9140 pub depthReadOnly: bool,
9141 pub stencilReadOnly: bool,
9142}
9143
9144impl GPURenderBundleEncoderDescriptor {
9145
9146 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
9147 -> Result<ConversionResult<GPURenderBundleEncoderDescriptor>, ()> {
9148 unsafe {
9149 let object = if val.get().is_null_or_undefined() {
9150 ptr::null_mut()
9151 } else if val.get().is_object() {
9152 val.get().to_object()
9153 } else {
9154 return Ok(ConversionResult::Failure("Value is not an object.".into()));
9155 };
9156 rooted!(&in(cx) let object = object);
9157 let dictionary = GPURenderBundleEncoderDescriptor {
9158 parent: {
9159 match crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassLayout::new(cx, val, can_gc)? {
9160 ConversionResult::Success(v) => v,
9161 ConversionResult::Failure(error) => {
9162 throw_type_error(cx.raw_cx(), &error);
9163 return Err(());
9164 }
9165 }
9166 },
9167 depthReadOnly: {
9168 rooted!(&in(cx) let mut rval = UndefinedValue());
9169 if get_dictionary_property(cx.raw_cx(), object.handle(), "depthReadOnly", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
9170 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
9171 Ok(ConversionResult::Success(value)) => value,
9172 Ok(ConversionResult::Failure(error)) => {
9173 throw_type_error(cx.raw_cx(), &error);
9174 return Err(());
9175
9176 }
9177 _ => {
9178 return Err(());
9179
9180 },
9181 }
9182
9183 } else {
9184 false
9185 }
9186 },
9187 stencilReadOnly: {
9188 rooted!(&in(cx) let mut rval = UndefinedValue());
9189 if get_dictionary_property(cx.raw_cx(), object.handle(), "stencilReadOnly", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
9190 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
9191 Ok(ConversionResult::Success(value)) => value,
9192 Ok(ConversionResult::Failure(error)) => {
9193 throw_type_error(cx.raw_cx(), &error);
9194 return Err(());
9195
9196 }
9197 _ => {
9198 return Err(());
9199
9200 },
9201 }
9202
9203 } else {
9204 false
9205 }
9206 },
9207 };
9208 Ok(ConversionResult::Success(dictionary))
9209 }
9210 }
9211}
9212
9213impl FromJSValConvertible for GPURenderBundleEncoderDescriptor {
9214 type Config = ();
9215 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
9216 -> Result<ConversionResult<GPURenderBundleEncoderDescriptor>, ()> {
9217 GPURenderBundleEncoderDescriptor::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
9218 }
9219}
9220
9221impl GPURenderBundleEncoderDescriptor {
9222 #[allow(clippy::wrong_self_convention)]
9223 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
9224 self.parent.to_jsobject(cx, obj.reborrow());
9225 let depthReadOnly = &self.depthReadOnly;
9226 rooted!(in(cx) let mut depthReadOnly_js = UndefinedValue());
9227 depthReadOnly.to_jsval(cx, depthReadOnly_js.handle_mut());
9228 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "depthReadOnly", depthReadOnly_js.handle()).unwrap();
9229 let stencilReadOnly = &self.stencilReadOnly;
9230 rooted!(in(cx) let mut stencilReadOnly_js = UndefinedValue());
9231 stencilReadOnly.to_jsval(cx, stencilReadOnly_js.handle_mut());
9232 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "stencilReadOnly", stencilReadOnly_js.handle()).unwrap();
9233 }
9234}
9235
9236impl ToJSValConvertible for GPURenderBundleEncoderDescriptor {
9237 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
9238 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
9239 self.to_jsobject(cx, obj.handle_mut());
9240 rval.set(ObjectOrNullValue(obj.get()))
9241 }
9242}
9243
9244
9245#[derive(JSTraceable)]
9246pub struct GPUQuerySetDescriptor {
9247 pub parent: crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase,
9248 pub count: u32,
9249 pub pipelineStatistics: Vec<GPUPipelineStatisticName>,
9250 pub type_: GPUQueryType,
9251}
9252
9253impl GPUQuerySetDescriptor {
9254
9255 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
9256 -> Result<ConversionResult<GPUQuerySetDescriptor>, ()> {
9257 unsafe {
9258 let object = if val.get().is_null_or_undefined() {
9259 ptr::null_mut()
9260 } else if val.get().is_object() {
9261 val.get().to_object()
9262 } else {
9263 return Ok(ConversionResult::Failure("Value is not an object.".into()));
9264 };
9265 rooted!(&in(cx) let object = object);
9266 let dictionary = GPUQuerySetDescriptor {
9267 parent: {
9268 match crate::codegen::GenericBindings::WebGPUBinding::GPUObjectDescriptorBase::new(cx, val, can_gc)? {
9269 ConversionResult::Success(v) => v,
9270 ConversionResult::Failure(error) => {
9271 throw_type_error(cx.raw_cx(), &error);
9272 return Err(());
9273 }
9274 }
9275 },
9276 count: {
9277 rooted!(&in(cx) let mut rval = UndefinedValue());
9278 if get_dictionary_property(cx.raw_cx(), object.handle(), "count", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
9279 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
9280 Ok(ConversionResult::Success(value)) => value,
9281 Ok(ConversionResult::Failure(error)) => {
9282 throw_type_error(cx.raw_cx(), &error);
9283 return Err(());
9284
9285 }
9286 _ => {
9287 return Err(());
9288
9289 },
9290 }
9291
9292 } else {
9293 throw_type_error(cx.raw_cx(), "Missing required member \"count\".");
9294 return Err(());
9295 }
9296 },
9297 pipelineStatistics: {
9298 rooted!(&in(cx) let mut rval = UndefinedValue());
9299 if get_dictionary_property(cx.raw_cx(), object.handle(), "pipelineStatistics", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
9300 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
9301 Ok(ConversionResult::Success(value)) => value,
9302 Ok(ConversionResult::Failure(error)) => {
9303 throw_type_error(cx.raw_cx(), &error);
9304 return Err(());
9305
9306 }
9307 _ => {
9308 return Err(());
9309
9310 },
9311 }
9312
9313 } else {
9314 Vec::new()
9315 }
9316 },
9317 type_: {
9318 rooted!(&in(cx) let mut rval = UndefinedValue());
9319 if get_dictionary_property(cx.raw_cx(), object.handle(), "type", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
9320 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
9321 Ok(ConversionResult::Success(value)) => value,
9322 Ok(ConversionResult::Failure(error)) => {
9323 throw_type_error(cx.raw_cx(), &error); return Err(());
9324
9325 }
9326 _ => {
9327 return Err(());
9328
9329 },
9330 }
9331
9332 } else {
9333 throw_type_error(cx.raw_cx(), "Missing required member \"type\".");
9334 return Err(());
9335 }
9336 },
9337 };
9338 Ok(ConversionResult::Success(dictionary))
9339 }
9340 }
9341}
9342
9343impl FromJSValConvertible for GPUQuerySetDescriptor {
9344 type Config = ();
9345 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
9346 -> Result<ConversionResult<GPUQuerySetDescriptor>, ()> {
9347 GPUQuerySetDescriptor::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
9348 }
9349}
9350
9351impl GPUQuerySetDescriptor {
9352 #[allow(clippy::wrong_self_convention)]
9353 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
9354 self.parent.to_jsobject(cx, obj.reborrow());
9355 let count = &self.count;
9356 rooted!(in(cx) let mut count_js = UndefinedValue());
9357 count.to_jsval(cx, count_js.handle_mut());
9358 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "count", count_js.handle()).unwrap();
9359 let pipelineStatistics = &self.pipelineStatistics;
9360 rooted!(in(cx) let mut pipelineStatistics_js = UndefinedValue());
9361 pipelineStatistics.to_jsval(cx, pipelineStatistics_js.handle_mut());
9362 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "pipelineStatistics", pipelineStatistics_js.handle()).unwrap();
9363 let type_ = &self.type_;
9364 rooted!(in(cx) let mut type__js = UndefinedValue());
9365 type_.to_jsval(cx, type__js.handle_mut());
9366 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "type", type__js.handle()).unwrap();
9367 }
9368}
9369
9370impl ToJSValConvertible for GPUQuerySetDescriptor {
9371 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
9372 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
9373 self.to_jsobject(cx, obj.handle_mut());
9374 rval.set(ObjectOrNullValue(obj.get()))
9375 }
9376}
9377
9378
9379#[derive(JSTraceable)]
9380pub struct GPUCanvasConfiguration<D: DomTypes> {
9381 pub alphaMode: GPUCanvasAlphaMode,
9382 pub device: DomRoot<D::GPUDevice>,
9383 pub format: GPUTextureFormat,
9384 pub usage: u32,
9385 pub viewFormats: Vec<GPUTextureFormat>,
9386}
9387
9388#[allow(clippy::clone_on_copy)]
9389impl<D: DomTypes> Clone for GPUCanvasConfiguration<D> {
9390 fn clone(&self) -> Self {
9391 Self {
9392 alphaMode: self.alphaMode.clone(),
9393 device: self.device.clone(),
9394 format: self.format.clone(),
9395 usage: self.usage.clone(),
9396 viewFormats: self.viewFormats.clone(),
9397 }
9398 }
9399}
9400
9401impl<D: DomTypes> GPUCanvasConfiguration<D> {
9402
9403 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
9404 -> Result<ConversionResult<GPUCanvasConfiguration<D>>, ()> {
9405 unsafe {
9406 let object = if val.get().is_null_or_undefined() {
9407 ptr::null_mut()
9408 } else if val.get().is_object() {
9409 val.get().to_object()
9410 } else {
9411 return Ok(ConversionResult::Failure("Value is not an object.".into()));
9412 };
9413 rooted!(&in(cx) let object = object);
9414 let dictionary = GPUCanvasConfiguration {
9415 alphaMode: {
9416 rooted!(&in(cx) let mut rval = UndefinedValue());
9417 if get_dictionary_property(cx.raw_cx(), object.handle(), "alphaMode", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
9418 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
9419 Ok(ConversionResult::Success(value)) => value,
9420 Ok(ConversionResult::Failure(error)) => {
9421 throw_type_error(cx.raw_cx(), &error); return Err(());
9422
9423 }
9424 _ => {
9425 return Err(());
9426
9427 },
9428 }
9429
9430 } else {
9431 GPUCanvasAlphaMode::Opaque
9432 }
9433 },
9434 device: {
9435 rooted!(&in(cx) let mut rval = UndefinedValue());
9436 if get_dictionary_property(cx.raw_cx(), object.handle(), "device", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
9437 if rval.handle().get().is_object() {
9438 match root_from_handlevalue(rval.handle(), SafeJSContext::from_ptr(cx.raw_cx())) {
9439 Ok(val) => val,
9440 Err(()) => {
9441 throw_type_error(cx.raw_cx(), "value does not implement interface GPUDevice.");
9442 return Err(());
9443
9444 }
9445 }
9446
9447 } else {
9448 throw_type_error(cx.raw_cx(), "Value is not an object.");
9449 return Err(());
9450
9451 }
9452 } else {
9453 throw_type_error(cx.raw_cx(), "Missing required member \"device\".");
9454 return Err(());
9455 }
9456 },
9457 format: {
9458 rooted!(&in(cx) let mut rval = UndefinedValue());
9459 if get_dictionary_property(cx.raw_cx(), object.handle(), "format", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
9460 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
9461 Ok(ConversionResult::Success(value)) => value,
9462 Ok(ConversionResult::Failure(error)) => {
9463 throw_type_error(cx.raw_cx(), &error); return Err(());
9464
9465 }
9466 _ => {
9467 return Err(());
9468
9469 },
9470 }
9471
9472 } else {
9473 throw_type_error(cx.raw_cx(), "Missing required member \"format\".");
9474 return Err(());
9475 }
9476 },
9477 usage: {
9478 rooted!(&in(cx) let mut rval = UndefinedValue());
9479 if get_dictionary_property(cx.raw_cx(), object.handle(), "usage", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
9480 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
9481 Ok(ConversionResult::Success(value)) => value,
9482 Ok(ConversionResult::Failure(error)) => {
9483 throw_type_error(cx.raw_cx(), &error);
9484 return Err(());
9485
9486 }
9487 _ => {
9488 return Err(());
9489
9490 },
9491 }
9492
9493 } else {
9494 16
9495 }
9496 },
9497 viewFormats: {
9498 rooted!(&in(cx) let mut rval = UndefinedValue());
9499 if get_dictionary_property(cx.raw_cx(), object.handle(), "viewFormats", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
9500 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
9501 Ok(ConversionResult::Success(value)) => value,
9502 Ok(ConversionResult::Failure(error)) => {
9503 throw_type_error(cx.raw_cx(), &error);
9504 return Err(());
9505
9506 }
9507 _ => {
9508 return Err(());
9509
9510 },
9511 }
9512
9513 } else {
9514 Vec::new()
9515 }
9516 },
9517 };
9518 Ok(ConversionResult::Success(dictionary))
9519 }
9520 }
9521}
9522
9523impl<D: DomTypes> FromJSValConvertible for GPUCanvasConfiguration<D> {
9524 type Config = ();
9525 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
9526 -> Result<ConversionResult<GPUCanvasConfiguration<D>>, ()> {
9527 GPUCanvasConfiguration::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
9528 }
9529}
9530
9531impl<D: DomTypes> GPUCanvasConfiguration<D> {
9532 #[allow(clippy::wrong_self_convention)]
9533 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
9534 let alphaMode = &self.alphaMode;
9535 rooted!(in(cx) let mut alphaMode_js = UndefinedValue());
9536 alphaMode.to_jsval(cx, alphaMode_js.handle_mut());
9537 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "alphaMode", alphaMode_js.handle()).unwrap();
9538 let device = &self.device;
9539 rooted!(in(cx) let mut device_js = UndefinedValue());
9540 device.to_jsval(cx, device_js.handle_mut());
9541 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "device", device_js.handle()).unwrap();
9542 let format = &self.format;
9543 rooted!(in(cx) let mut format_js = UndefinedValue());
9544 format.to_jsval(cx, format_js.handle_mut());
9545 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "format", format_js.handle()).unwrap();
9546 let usage = &self.usage;
9547 rooted!(in(cx) let mut usage_js = UndefinedValue());
9548 usage.to_jsval(cx, usage_js.handle_mut());
9549 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "usage", usage_js.handle()).unwrap();
9550 let viewFormats = &self.viewFormats;
9551 rooted!(in(cx) let mut viewFormats_js = UndefinedValue());
9552 viewFormats.to_jsval(cx, viewFormats_js.handle_mut());
9553 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "viewFormats", viewFormats_js.handle()).unwrap();
9554 }
9555}
9556
9557impl<D: DomTypes> ToJSValConvertible for GPUCanvasConfiguration<D> {
9558 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
9559 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
9560 self.to_jsobject(cx, obj.handle_mut());
9561 rval.set(ObjectOrNullValue(obj.get()))
9562 }
9563}
9564
9565
9566#[derive(JSTraceable)]
9567pub struct GPUUncapturedErrorEventInit<D: DomTypes> {
9568 pub parent: crate::codegen::GenericBindings::EventBinding::EventInit,
9569 pub error: DomRoot<D::GPUError>,
9570}
9571
9572impl<D: DomTypes> GPUUncapturedErrorEventInit<D> {
9573
9574 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
9575 -> Result<ConversionResult<GPUUncapturedErrorEventInit<D>>, ()> {
9576 unsafe {
9577 let object = if val.get().is_null_or_undefined() {
9578 ptr::null_mut()
9579 } else if val.get().is_object() {
9580 val.get().to_object()
9581 } else {
9582 return Ok(ConversionResult::Failure("Value is not an object.".into()));
9583 };
9584 rooted!(&in(cx) let object = object);
9585 let dictionary = GPUUncapturedErrorEventInit {
9586 parent: {
9587 match crate::codegen::GenericBindings::EventBinding::EventInit::new(cx, val, can_gc)? {
9588 ConversionResult::Success(v) => v,
9589 ConversionResult::Failure(error) => {
9590 throw_type_error(cx.raw_cx(), &error);
9591 return Err(());
9592 }
9593 }
9594 },
9595 error: {
9596 rooted!(&in(cx) let mut rval = UndefinedValue());
9597 if get_dictionary_property(cx.raw_cx(), object.handle(), "error", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
9598 if rval.handle().get().is_object() {
9599 match root_from_handlevalue(rval.handle(), SafeJSContext::from_ptr(cx.raw_cx())) {
9600 Ok(val) => val,
9601 Err(()) => {
9602 throw_type_error(cx.raw_cx(), "value does not implement interface GPUError.");
9603 return Err(());
9604
9605 }
9606 }
9607
9608 } else {
9609 throw_type_error(cx.raw_cx(), "Value is not an object.");
9610 return Err(());
9611
9612 }
9613 } else {
9614 throw_type_error(cx.raw_cx(), "Missing required member \"error\".");
9615 return Err(());
9616 }
9617 },
9618 };
9619 Ok(ConversionResult::Success(dictionary))
9620 }
9621 }
9622}
9623
9624impl<D: DomTypes> FromJSValConvertible for GPUUncapturedErrorEventInit<D> {
9625 type Config = ();
9626 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
9627 -> Result<ConversionResult<GPUUncapturedErrorEventInit<D>>, ()> {
9628 GPUUncapturedErrorEventInit::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
9629 }
9630}
9631
9632impl<D: DomTypes> GPUUncapturedErrorEventInit<D> {
9633 #[allow(clippy::wrong_self_convention)]
9634 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
9635 self.parent.to_jsobject(cx, obj.reborrow());
9636 let error = &self.error;
9637 rooted!(in(cx) let mut error_js = UndefinedValue());
9638 error.to_jsval(cx, error_js.handle_mut());
9639 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "error", error_js.handle()).unwrap();
9640 }
9641}
9642
9643impl<D: DomTypes> ToJSValConvertible for GPUUncapturedErrorEventInit<D> {
9644 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
9645 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
9646 self.to_jsobject(cx, obj.handle_mut());
9647 rval.set(ObjectOrNullValue(obj.get()))
9648 }
9649}
9650
9651
9652#[derive(JSTraceable)]
9653pub struct GPUColorDict {
9654 pub a: Finite<f64>,
9655 pub b: Finite<f64>,
9656 pub g: Finite<f64>,
9657 pub r: Finite<f64>,
9658}
9659
9660impl GPUColorDict {
9661
9662 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
9663 -> Result<ConversionResult<GPUColorDict>, ()> {
9664 unsafe {
9665 let object = if val.get().is_null_or_undefined() {
9666 ptr::null_mut()
9667 } else if val.get().is_object() {
9668 val.get().to_object()
9669 } else {
9670 return Ok(ConversionResult::Failure("Value is not an object.".into()));
9671 };
9672 rooted!(&in(cx) let object = object);
9673 let dictionary = GPUColorDict {
9674 a: {
9675 rooted!(&in(cx) let mut rval = UndefinedValue());
9676 if get_dictionary_property(cx.raw_cx(), object.handle(), "a", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
9677 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
9678 Ok(ConversionResult::Success(value)) => value,
9679 Ok(ConversionResult::Failure(error)) => {
9680 throw_type_error(cx.raw_cx(), &error);
9681 return Err(());
9682
9683 }
9684 _ => {
9685 return Err(());
9686
9687 },
9688 }
9689
9690 } else {
9691 throw_type_error(cx.raw_cx(), "Missing required member \"a\".");
9692 return Err(());
9693 }
9694 },
9695 b: {
9696 rooted!(&in(cx) let mut rval = UndefinedValue());
9697 if get_dictionary_property(cx.raw_cx(), object.handle(), "b", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
9698 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
9699 Ok(ConversionResult::Success(value)) => value,
9700 Ok(ConversionResult::Failure(error)) => {
9701 throw_type_error(cx.raw_cx(), &error);
9702 return Err(());
9703
9704 }
9705 _ => {
9706 return Err(());
9707
9708 },
9709 }
9710
9711 } else {
9712 throw_type_error(cx.raw_cx(), "Missing required member \"b\".");
9713 return Err(());
9714 }
9715 },
9716 g: {
9717 rooted!(&in(cx) let mut rval = UndefinedValue());
9718 if get_dictionary_property(cx.raw_cx(), object.handle(), "g", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
9719 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
9720 Ok(ConversionResult::Success(value)) => value,
9721 Ok(ConversionResult::Failure(error)) => {
9722 throw_type_error(cx.raw_cx(), &error);
9723 return Err(());
9724
9725 }
9726 _ => {
9727 return Err(());
9728
9729 },
9730 }
9731
9732 } else {
9733 throw_type_error(cx.raw_cx(), "Missing required member \"g\".");
9734 return Err(());
9735 }
9736 },
9737 r: {
9738 rooted!(&in(cx) let mut rval = UndefinedValue());
9739 if get_dictionary_property(cx.raw_cx(), object.handle(), "r", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
9740 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ()) {
9741 Ok(ConversionResult::Success(value)) => value,
9742 Ok(ConversionResult::Failure(error)) => {
9743 throw_type_error(cx.raw_cx(), &error);
9744 return Err(());
9745
9746 }
9747 _ => {
9748 return Err(());
9749
9750 },
9751 }
9752
9753 } else {
9754 throw_type_error(cx.raw_cx(), "Missing required member \"r\".");
9755 return Err(());
9756 }
9757 },
9758 };
9759 Ok(ConversionResult::Success(dictionary))
9760 }
9761 }
9762}
9763
9764impl FromJSValConvertible for GPUColorDict {
9765 type Config = ();
9766 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
9767 -> Result<ConversionResult<GPUColorDict>, ()> {
9768 GPUColorDict::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
9769 }
9770}
9771
9772impl GPUColorDict {
9773 #[allow(clippy::wrong_self_convention)]
9774 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
9775 let a = &self.a;
9776 rooted!(in(cx) let mut a_js = UndefinedValue());
9777 a.to_jsval(cx, a_js.handle_mut());
9778 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "a", a_js.handle()).unwrap();
9779 let b = &self.b;
9780 rooted!(in(cx) let mut b_js = UndefinedValue());
9781 b.to_jsval(cx, b_js.handle_mut());
9782 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "b", b_js.handle()).unwrap();
9783 let g = &self.g;
9784 rooted!(in(cx) let mut g_js = UndefinedValue());
9785 g.to_jsval(cx, g_js.handle_mut());
9786 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "g", g_js.handle()).unwrap();
9787 let r = &self.r;
9788 rooted!(in(cx) let mut r_js = UndefinedValue());
9789 r.to_jsval(cx, r_js.handle_mut());
9790 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "r", r_js.handle()).unwrap();
9791 }
9792}
9793
9794impl ToJSValConvertible for GPUColorDict {
9795 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
9796 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
9797 self.to_jsobject(cx, obj.handle_mut());
9798 rval.set(ObjectOrNullValue(obj.get()))
9799 }
9800}
9801
9802
9803#[derive(JSTraceable)]
9804pub struct GPUOrigin2DDict {
9805 pub x: u32,
9806 pub y: u32,
9807}
9808impl Default for GPUOrigin2DDict {
9809 fn default() -> Self {
9810 Self::empty()
9811 }
9812}
9813
9814impl GPUOrigin2DDict {
9815 pub fn empty() -> Self {
9816 Self {
9817 x: 0,
9818 y: 0,
9819 }
9820 }
9821 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
9822 -> Result<ConversionResult<GPUOrigin2DDict>, ()> {
9823 unsafe {
9824 let object = if val.get().is_null_or_undefined() {
9825 ptr::null_mut()
9826 } else if val.get().is_object() {
9827 val.get().to_object()
9828 } else {
9829 return Ok(ConversionResult::Failure("Value is not an object.".into()));
9830 };
9831 rooted!(&in(cx) let object = object);
9832 let dictionary = GPUOrigin2DDict {
9833 x: {
9834 rooted!(&in(cx) let mut rval = UndefinedValue());
9835 if get_dictionary_property(cx.raw_cx(), object.handle(), "x", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
9836 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
9837 Ok(ConversionResult::Success(value)) => value,
9838 Ok(ConversionResult::Failure(error)) => {
9839 throw_type_error(cx.raw_cx(), &error);
9840 return Err(());
9841
9842 }
9843 _ => {
9844 return Err(());
9845
9846 },
9847 }
9848
9849 } else {
9850 0
9851 }
9852 },
9853 y: {
9854 rooted!(&in(cx) let mut rval = UndefinedValue());
9855 if get_dictionary_property(cx.raw_cx(), object.handle(), "y", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
9856 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
9857 Ok(ConversionResult::Success(value)) => value,
9858 Ok(ConversionResult::Failure(error)) => {
9859 throw_type_error(cx.raw_cx(), &error);
9860 return Err(());
9861
9862 }
9863 _ => {
9864 return Err(());
9865
9866 },
9867 }
9868
9869 } else {
9870 0
9871 }
9872 },
9873 };
9874 Ok(ConversionResult::Success(dictionary))
9875 }
9876 }
9877}
9878
9879impl FromJSValConvertible for GPUOrigin2DDict {
9880 type Config = ();
9881 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
9882 -> Result<ConversionResult<GPUOrigin2DDict>, ()> {
9883 GPUOrigin2DDict::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
9884 }
9885}
9886
9887impl GPUOrigin2DDict {
9888 #[allow(clippy::wrong_self_convention)]
9889 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
9890 let x = &self.x;
9891 rooted!(in(cx) let mut x_js = UndefinedValue());
9892 x.to_jsval(cx, x_js.handle_mut());
9893 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "x", x_js.handle()).unwrap();
9894 let y = &self.y;
9895 rooted!(in(cx) let mut y_js = UndefinedValue());
9896 y.to_jsval(cx, y_js.handle_mut());
9897 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "y", y_js.handle()).unwrap();
9898 }
9899}
9900
9901impl ToJSValConvertible for GPUOrigin2DDict {
9902 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
9903 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
9904 self.to_jsobject(cx, obj.handle_mut());
9905 rval.set(ObjectOrNullValue(obj.get()))
9906 }
9907}
9908
9909
9910#[derive(JSTraceable)]
9911pub struct GPUOrigin3DDict {
9912 pub x: u32,
9913 pub y: u32,
9914 pub z: u32,
9915}
9916impl Default for GPUOrigin3DDict {
9917 fn default() -> Self {
9918 Self::empty()
9919 }
9920}
9921
9922impl GPUOrigin3DDict {
9923 pub fn empty() -> Self {
9924 Self {
9925 x: 0,
9926 y: 0,
9927 z: 0,
9928 }
9929 }
9930 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
9931 -> Result<ConversionResult<GPUOrigin3DDict>, ()> {
9932 unsafe {
9933 let object = if val.get().is_null_or_undefined() {
9934 ptr::null_mut()
9935 } else if val.get().is_object() {
9936 val.get().to_object()
9937 } else {
9938 return Ok(ConversionResult::Failure("Value is not an object.".into()));
9939 };
9940 rooted!(&in(cx) let object = object);
9941 let dictionary = GPUOrigin3DDict {
9942 x: {
9943 rooted!(&in(cx) let mut rval = UndefinedValue());
9944 if get_dictionary_property(cx.raw_cx(), object.handle(), "x", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
9945 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
9946 Ok(ConversionResult::Success(value)) => value,
9947 Ok(ConversionResult::Failure(error)) => {
9948 throw_type_error(cx.raw_cx(), &error);
9949 return Err(());
9950
9951 }
9952 _ => {
9953 return Err(());
9954
9955 },
9956 }
9957
9958 } else {
9959 0
9960 }
9961 },
9962 y: {
9963 rooted!(&in(cx) let mut rval = UndefinedValue());
9964 if get_dictionary_property(cx.raw_cx(), object.handle(), "y", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
9965 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
9966 Ok(ConversionResult::Success(value)) => value,
9967 Ok(ConversionResult::Failure(error)) => {
9968 throw_type_error(cx.raw_cx(), &error);
9969 return Err(());
9970
9971 }
9972 _ => {
9973 return Err(());
9974
9975 },
9976 }
9977
9978 } else {
9979 0
9980 }
9981 },
9982 z: {
9983 rooted!(&in(cx) let mut rval = UndefinedValue());
9984 if get_dictionary_property(cx.raw_cx(), object.handle(), "z", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
9985 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
9986 Ok(ConversionResult::Success(value)) => value,
9987 Ok(ConversionResult::Failure(error)) => {
9988 throw_type_error(cx.raw_cx(), &error);
9989 return Err(());
9990
9991 }
9992 _ => {
9993 return Err(());
9994
9995 },
9996 }
9997
9998 } else {
9999 0
10000 }
10001 },
10002 };
10003 Ok(ConversionResult::Success(dictionary))
10004 }
10005 }
10006}
10007
10008impl FromJSValConvertible for GPUOrigin3DDict {
10009 type Config = ();
10010 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
10011 -> Result<ConversionResult<GPUOrigin3DDict>, ()> {
10012 GPUOrigin3DDict::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
10013 }
10014}
10015
10016impl GPUOrigin3DDict {
10017 #[allow(clippy::wrong_self_convention)]
10018 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
10019 let x = &self.x;
10020 rooted!(in(cx) let mut x_js = UndefinedValue());
10021 x.to_jsval(cx, x_js.handle_mut());
10022 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "x", x_js.handle()).unwrap();
10023 let y = &self.y;
10024 rooted!(in(cx) let mut y_js = UndefinedValue());
10025 y.to_jsval(cx, y_js.handle_mut());
10026 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "y", y_js.handle()).unwrap();
10027 let z = &self.z;
10028 rooted!(in(cx) let mut z_js = UndefinedValue());
10029 z.to_jsval(cx, z_js.handle_mut());
10030 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "z", z_js.handle()).unwrap();
10031 }
10032}
10033
10034impl ToJSValConvertible for GPUOrigin3DDict {
10035 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
10036 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
10037 self.to_jsobject(cx, obj.handle_mut());
10038 rval.set(ObjectOrNullValue(obj.get()))
10039 }
10040}
10041
10042
10043#[derive(JSTraceable, MallocSizeOf)]
10044pub struct GPUExtent3DDict {
10045 pub depthOrArrayLayers: u32,
10046 pub height: u32,
10047 pub width: u32,
10048}
10049
10050impl GPUExtent3DDict {
10051
10052 pub fn new(cx: SafeJSContext, val: HandleValue, can_gc: CanGc)
10053 -> Result<ConversionResult<GPUExtent3DDict>, ()> {
10054 unsafe {
10055 let object = if val.get().is_null_or_undefined() {
10056 ptr::null_mut()
10057 } else if val.get().is_object() {
10058 val.get().to_object()
10059 } else {
10060 return Ok(ConversionResult::Failure("Value is not an object.".into()));
10061 };
10062 rooted!(&in(cx) let object = object);
10063 let dictionary = GPUExtent3DDict {
10064 depthOrArrayLayers: {
10065 rooted!(&in(cx) let mut rval = UndefinedValue());
10066 if get_dictionary_property(cx.raw_cx(), object.handle(), "depthOrArrayLayers", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
10067 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
10068 Ok(ConversionResult::Success(value)) => value,
10069 Ok(ConversionResult::Failure(error)) => {
10070 throw_type_error(cx.raw_cx(), &error);
10071 return Err(());
10072
10073 }
10074 _ => {
10075 return Err(());
10076
10077 },
10078 }
10079
10080 } else {
10081 1
10082 }
10083 },
10084 height: {
10085 rooted!(&in(cx) let mut rval = UndefinedValue());
10086 if get_dictionary_property(cx.raw_cx(), object.handle(), "height", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
10087 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
10088 Ok(ConversionResult::Success(value)) => value,
10089 Ok(ConversionResult::Failure(error)) => {
10090 throw_type_error(cx.raw_cx(), &error);
10091 return Err(());
10092
10093 }
10094 _ => {
10095 return Err(());
10096
10097 },
10098 }
10099
10100 } else {
10101 1
10102 }
10103 },
10104 width: {
10105 rooted!(&in(cx) let mut rval = UndefinedValue());
10106 if get_dictionary_property(cx.raw_cx(), object.handle(), "width", rval.handle_mut(), can_gc)? && !rval.is_undefined() {
10107 match FromJSValConvertible::from_jsval(cx.raw_cx(), rval.handle(), ConversionBehavior::EnforceRange) {
10108 Ok(ConversionResult::Success(value)) => value,
10109 Ok(ConversionResult::Failure(error)) => {
10110 throw_type_error(cx.raw_cx(), &error);
10111 return Err(());
10112
10113 }
10114 _ => {
10115 return Err(());
10116
10117 },
10118 }
10119
10120 } else {
10121 throw_type_error(cx.raw_cx(), "Missing required member \"width\".");
10122 return Err(());
10123 }
10124 },
10125 };
10126 Ok(ConversionResult::Success(dictionary))
10127 }
10128 }
10129}
10130
10131impl FromJSValConvertible for GPUExtent3DDict {
10132 type Config = ();
10133 unsafe fn from_jsval(cx: *mut RawJSContext, value: HandleValue, _option: ())
10134 -> Result<ConversionResult<GPUExtent3DDict>, ()> {
10135 GPUExtent3DDict::new(SafeJSContext::from_ptr(cx), value, CanGc::note())
10136 }
10137}
10138
10139impl GPUExtent3DDict {
10140 #[allow(clippy::wrong_self_convention)]
10141 pub unsafe fn to_jsobject(&self, cx: *mut RawJSContext, mut obj: MutableHandleObject) {
10142 let depthOrArrayLayers = &self.depthOrArrayLayers;
10143 rooted!(in(cx) let mut depthOrArrayLayers_js = UndefinedValue());
10144 depthOrArrayLayers.to_jsval(cx, depthOrArrayLayers_js.handle_mut());
10145 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "depthOrArrayLayers", depthOrArrayLayers_js.handle()).unwrap();
10146 let height = &self.height;
10147 rooted!(in(cx) let mut height_js = UndefinedValue());
10148 height.to_jsval(cx, height_js.handle_mut());
10149 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "height", height_js.handle()).unwrap();
10150 let width = &self.width;
10151 rooted!(in(cx) let mut width_js = UndefinedValue());
10152 width.to_jsval(cx, width_js.handle_mut());
10153 set_dictionary_property(SafeJSContext::from_ptr(cx), obj.handle(), "width", width_js.handle()).unwrap();
10154 }
10155}
10156
10157impl ToJSValConvertible for GPUExtent3DDict {
10158 unsafe fn to_jsval(&self, cx: *mut RawJSContext, mut rval: MutableHandleValue) {
10159 rooted!(in(cx) let mut obj = JS_NewObject(cx, ptr::null()));
10160 self.to_jsobject(cx, obj.handle_mut());
10161 rval.set(ObjectOrNullValue(obj.get()))
10162 }
10163}
10164
10165
10166pub use self::GPU_Binding::{Wrap as GPUWrap, GPUMethods, GetProtoObject as GPUGetProtoObject, DefineDOMInterface as GPUDefineDOMInterface};
10167pub mod GPU_Binding {
10168use crate::codegen::GenericBindings::WebGPUBinding::GPUPowerPreference;
10169use crate::codegen::GenericBindings::WebGPUBinding::GPUPowerPreferenceValues;
10170use crate::codegen::GenericBindings::WebGPUBinding::GPURequestAdapterOptions;
10171use crate::codegen::GenericBindings::WebGPUBinding::GPUTextureFormat;
10172use crate::codegen::GenericBindings::WebGPUBinding::GPUTextureFormatValues;
10173use crate::import::module::*;
10174
10175unsafe extern "C" fn requestAdapter<D: DomTypes>
10176(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
10177 let mut result = false;
10178 wrap_panic(&mut || result = (|| {
10179 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
10180 let this = &*(this as *const D::GPU);
10181 let args = &*args;
10182 let argc = args.argc_;
10183 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPURequestAdapterOptions = if args.get(0).is_undefined() {
10184 crate::codegen::GenericBindings::WebGPUBinding::GPURequestAdapterOptions::empty()
10185 } else {
10186 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
10187 Ok(ConversionResult::Success(value)) => value,
10188 Ok(ConversionResult::Failure(error)) => {
10189 throw_type_error(cx.raw_cx(), &error);
10190 return false;
10191
10192 }
10193 _ => {
10194 return false;
10195
10196 },
10197 }
10198
10199 };
10200 let result: Rc<D::Promise> = this.RequestAdapter(&arg0, InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx()))), CanGc::note());
10201
10202 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
10203 return true;
10204 })());
10205 result
10206}
10207
10208unsafe extern "C" fn requestAdapter_promise_wrapper<D: DomTypes>
10209(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
10210 let mut result = false;
10211 wrap_panic(&mut || result = (|| {
10212 let ok = requestAdapter::<D>(cx, _obj, this, args);
10213 if ok {
10214 return true;
10215 }
10216 return exception_to_promise(cx, (*args).rval(), CanGc::note());
10217
10218 })());
10219 result
10220}
10221
10222
10223static requestAdapter_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
10224
10225pub(crate) fn init_requestAdapter_methodinfo<D: DomTypes>() {
10226 requestAdapter_methodinfo.set(JSJitInfo {
10227 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
10228 method: Some(requestAdapter_promise_wrapper::<D>)
10229 },
10230 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
10231 protoID: PrototypeList::ID::GPU as u16,
10232 },
10233 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
10234 _bitfield_align_1: [],
10235 _bitfield_1: __BindgenBitfieldUnit::new(
10236 new_jsjitinfo_bitfield_1!(
10237 JSJitInfo_OpType::Method as u8,
10238 JSJitInfo_AliasSet::AliasEverything as u8,
10239 JSValueType::JSVAL_TYPE_OBJECT as u8,
10240 false,
10241 false,
10242 false,
10243 false,
10244 false,
10245 false,
10246 0,
10247 ).to_ne_bytes()
10248 ),
10249});
10250}
10251unsafe extern "C" fn getPreferredCanvasFormat<D: DomTypes>
10252(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
10253 let mut result = false;
10254 wrap_panic(&mut || result = (|| {
10255 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
10256 let this = &*(this as *const D::GPU);
10257 let args = &*args;
10258 let argc = args.argc_;
10259 let result: GPUTextureFormat = this.GetPreferredCanvasFormat();
10260
10261 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
10262 return true;
10263 })());
10264 result
10265}
10266
10267
10268static getPreferredCanvasFormat_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
10269
10270pub(crate) fn init_getPreferredCanvasFormat_methodinfo<D: DomTypes>() {
10271 getPreferredCanvasFormat_methodinfo.set(JSJitInfo {
10272 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
10273 method: Some(getPreferredCanvasFormat::<D>)
10274 },
10275 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
10276 protoID: PrototypeList::ID::GPU as u16,
10277 },
10278 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
10279 _bitfield_align_1: [],
10280 _bitfield_1: __BindgenBitfieldUnit::new(
10281 new_jsjitinfo_bitfield_1!(
10282 JSJitInfo_OpType::Method as u8,
10283 JSJitInfo_AliasSet::AliasEverything as u8,
10284 JSValueType::JSVAL_TYPE_STRING as u8,
10285 true,
10286 false,
10287 false,
10288 false,
10289 false,
10290 false,
10291 0,
10292 ).to_ne_bytes()
10293 ),
10294});
10295}
10296unsafe extern "C" fn get_wgslLanguageFeatures<D: DomTypes>
10297(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
10298 let mut result = false;
10299 wrap_panic(&mut || result = (|| {
10300 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
10301 let this = &*(this as *const D::GPU);
10302 let result: DomRoot<D::WGSLLanguageFeatures> = this.WgslLanguageFeatures(CanGc::note());
10303
10304 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
10305 return true;
10306 })());
10307 result
10308}
10309
10310
10311static wgslLanguageFeatures_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
10312
10313pub(crate) fn init_wgslLanguageFeatures_getterinfo<D: DomTypes>() {
10314 wgslLanguageFeatures_getterinfo.set(JSJitInfo {
10315 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
10316 getter: Some(get_wgslLanguageFeatures::<D>)
10317 },
10318 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
10319 protoID: PrototypeList::ID::GPU as u16,
10320 },
10321 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
10322 _bitfield_align_1: [],
10323 _bitfield_1: __BindgenBitfieldUnit::new(
10324 new_jsjitinfo_bitfield_1!(
10325 JSJitInfo_OpType::Getter as u8,
10326 JSJitInfo_AliasSet::AliasNone as u8,
10327 JSValueType::JSVAL_TYPE_OBJECT as u8,
10328 true,
10329 true,
10330 false,
10331 false,
10332 false,
10333 false,
10334 0,
10335 ).to_ne_bytes()
10336 ),
10337});
10338}
10339unsafe extern "C" fn _finalize<D: DomTypes>
10340(_cx: *mut GCContext, obj: *mut JSObject){
10341 wrap_panic(&mut || {
10342
10343 let this = native_from_object_static::<D::GPU>(obj).unwrap();
10344 finalize_common(this);
10345 })
10346}
10347
10348unsafe extern "C" fn _trace<D: DomTypes>
10349(trc: *mut JSTracer, obj: *mut JSObject){
10350 wrap_panic(&mut || {
10351
10352 let this = native_from_object_static::<D::GPU>(obj).unwrap();
10353 if this.is_null() { return; } (*this).trace(trc);
10355 })
10356}
10357
10358
10359static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
10360
10361pub(crate) fn init_class_ops<D: DomTypes>() {
10362 CLASS_OPS.set(JSClassOps {
10363 addProperty: None,
10364 delProperty: None,
10365 enumerate: None,
10366 newEnumerate: None,
10367 resolve: None,
10368 mayResolve: None,
10369 finalize: Some(_finalize::<D>),
10370 call: None,
10371 construct: None,
10372 trace: Some(_trace::<D>),
10373 });
10374}
10375
10376pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
10377
10378pub(crate) fn init_domjs_class<D: DomTypes>() {
10379 init_class_ops::<D>();
10380 Class.set(DOMJSClass {
10381 base: JSClass {
10382 name: c"GPU".as_ptr(),
10383 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
10384 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
10385 ,
10386 cOps: unsafe { CLASS_OPS.get() },
10387 spec: ptr::null(),
10388 ext: ptr::null(),
10389 oOps: ptr::null(),
10390 },
10391 dom_class:
10392DOMClass {
10393 interface_chain: [ PrototypeList::ID::GPU, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
10394 depth: 0,
10395 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
10396 malloc_size_of: malloc_size_of_including_raw_self::<D::GPU> as unsafe fn(&mut _, _) -> _,
10397 global: Globals::EMPTY,
10398},
10399 });
10400}
10401
10402#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
10403(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPU>, _can_gc: CanGc) -> DomRoot<D::GPU>{
10404
10405 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
10406
10407 let scope = scope.reflector().get_jsobject();
10408 assert!(!scope.get().is_null());
10409 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
10410 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
10411
10412 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
10413 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
10414 assert!(!canonical_proto.is_null());
10415
10416
10417 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
10418 if let Some(given) = given_proto {
10419 proto.set(*given);
10420 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
10421 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
10422 }
10423 } else {
10424 proto.set(*canonical_proto);
10425 }
10426 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
10427 cx.raw_cx(),
10428 &Class.get().base,
10429 proto.handle(),
10430 ));
10431 assert!(!obj.is_null());
10432 JS_SetReservedSlot(
10433 obj.get(),
10434 DOM_OBJECT_SLOT,
10435 &PrivateValue(raw.as_ptr() as *const libc::c_void),
10436 );
10437
10438 let root = raw.reflect_with(obj.get());
10439
10440
10441
10442 DomRoot::from_ref(&*root)
10443}
10444
10445pub trait GPUMethods<D: DomTypes> {
10446 fn RequestAdapter(&self, r#options: &crate::codegen::GenericBindings::WebGPUBinding::GPURequestAdapterOptions, r#_comp: InRealm, r#_can_gc: CanGc) -> Rc<D::Promise>;
10447 fn GetPreferredCanvasFormat(&self, ) -> GPUTextureFormat;
10448 fn WgslLanguageFeatures(&self, r#_can_gc: CanGc) -> DomRoot<D::WGSLLanguageFeatures>;
10449}
10450static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
10451
10452pub(crate) fn init_sMethods_specs<D: DomTypes>() {
10453 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
10454 JSFunctionSpec {
10455 name: JSPropertySpec_Name { string_: c"requestAdapter".as_ptr() },
10456 call: JSNativeWrapper { op: Some(generic_method::<true>), info: unsafe { requestAdapter_methodinfo.get() } as *const _ as *const JSJitInfo },
10457 nargs: 0,
10458 flags: (JSPROP_ENUMERATE) as u16,
10459 selfHostedName: ptr::null()
10460 },
10461 JSFunctionSpec {
10462 name: JSPropertySpec_Name { string_: c"getPreferredCanvasFormat".as_ptr() },
10463 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { getPreferredCanvasFormat_methodinfo.get() } as *const _ as *const JSJitInfo },
10464 nargs: 0,
10465 flags: (JSPROP_ENUMERATE) as u16,
10466 selfHostedName: ptr::null()
10467 },
10468 JSFunctionSpec {
10469 name: JSPropertySpec_Name { string_: ptr::null() },
10470 call: JSNativeWrapper { op: None, info: ptr::null() },
10471 nargs: 0,
10472 flags: 0,
10473 selfHostedName: ptr::null()
10474 }]))[..]
10475])));
10476}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
10477
10478pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
10479 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sMethods_specs.get() })[0])])));
10480}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
10481
10482pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
10483 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
10484 JSPropertySpec {
10485 name: JSPropertySpec_Name { string_: c"wgslLanguageFeatures".as_ptr() },
10486 attributes_: (JSPROP_ENUMERATE),
10487 kind_: (JSPropertySpec_Kind::NativeAccessor),
10488 u: JSPropertySpec_AccessorsOrValue {
10489 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
10490 getter: JSPropertySpec_Accessor {
10491 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { wgslLanguageFeatures_getterinfo.get() } },
10492 },
10493 setter: JSPropertySpec_Accessor {
10494 native: JSNativeWrapper { op: None, info: ptr::null() },
10495 }
10496 }
10497 }
10498 }
10499,
10500 JSPropertySpec::ZERO]))[..]
10501,
10502&Box::leak(Box::new([
10503 JSPropertySpec {
10504 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
10505 attributes_: (JSPROP_READONLY),
10506 kind_: (JSPropertySpec_Kind::Value),
10507 u: JSPropertySpec_AccessorsOrValue {
10508 value: JSPropertySpec_ValueWrapper {
10509 type_: JSPropertySpec_ValueWrapper_Type::String,
10510 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
10511 string: c"GPU".as_ptr(),
10512 }
10513 }
10514 }
10515 }
10516,
10517 JSPropertySpec::ZERO]))[..]
10518])));
10519}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
10520
10521pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
10522 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
10523 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
10524}
10525pub fn GetProtoObject<D: DomTypes>
10526(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
10527 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPU), CreateInterfaceObjects::<D>, rval)
10529}
10530
10531
10532static PrototypeClass: JSClass = JSClass {
10533 name: c"GPUPrototype".as_ptr(),
10534 flags:
10535 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
10537 cOps: ptr::null(),
10538 spec: ptr::null(),
10539 ext: ptr::null(),
10540 oOps: ptr::null(),
10541};
10542
10543
10544static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
10545
10546pub(crate) fn init_interface_object<D: DomTypes>() {
10547 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
10548 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
10549 b"function GPU() {\n [native code]\n}",
10550 PrototypeList::ID::GPU,
10551 0,
10552 ));
10553}
10554
10555pub fn DefineDOMInterface<D: DomTypes>
10556(cx: SafeJSContext, global: HandleObject){
10557 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPU),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
10558}
10559
10560pub fn ConstructorEnabled<D: DomTypes>
10561(aCx: SafeJSContext, aObj: HandleObject) -> bool{
10562 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
10563 pref!(dom_webgpu_enabled)
10564}
10565
10566unsafe fn CreateInterfaceObjects<D: DomTypes>
10567(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
10568
10569 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
10570 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
10571 assert!(!prototype_proto.is_null());
10572
10573 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
10574 create_interface_prototype_object::<D>(cx,
10575 global,
10576 prototype_proto.handle(),
10577 &PrototypeClass,
10578 sMethods.get(),
10579 sAttributes.get(),
10580 &[],
10581 &[],
10582 prototype.handle_mut());
10583 assert!(!prototype.is_null());
10584 assert!((*cache)[PrototypeList::ID::GPU as usize].is_null());
10585 (*cache)[PrototypeList::ID::GPU as usize] = prototype.get();
10586 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPU as isize),
10587 ptr::null_mut(),
10588 prototype.get());
10589
10590 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
10591 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
10592
10593 assert!(!interface_proto.is_null());
10594
10595 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
10596 create_noncallback_interface_object::<D>(cx,
10597 global,
10598 interface_proto.handle(),
10599 INTERFACE_OBJECT_CLASS.get(),
10600 &[],
10601 &[],
10602 &[],
10603 prototype.handle(),
10604 c"GPU",
10605 0,
10606 &[],
10607 interface.handle_mut());
10608 assert!(!interface.is_null());
10609}
10610
10611
10612 pub(crate) fn init_statics<D: DomTypes>() {
10613 init_interface_object::<D>();
10614 init_domjs_class::<D>();
10615 crate::codegen::GenericBindings::WebGPUBinding::GPU_Binding::init_requestAdapter_methodinfo::<D>();
10616crate::codegen::GenericBindings::WebGPUBinding::GPU_Binding::init_getPreferredCanvasFormat_methodinfo::<D>();
10617 init_wgslLanguageFeatures_getterinfo::<D>();
10618
10619
10620 init_sMethods_specs::<D>();
10621init_sMethods_prefs::<D>();
10622init_sAttributes_specs::<D>();
10623init_sAttributes_prefs::<D>();
10624 }
10625 } pub use self::GPUAdapter_Binding::{Wrap as GPUAdapterWrap, GPUAdapterMethods, GetProtoObject as GPUAdapterGetProtoObject, DefineDOMInterface as GPUAdapterDefineDOMInterface};
10629pub mod GPUAdapter_Binding {
10630use crate::codegen::GenericBindings::WebGPUBinding::GPUDeviceDescriptor;
10631use crate::codegen::GenericBindings::WebGPUBinding::GPUFeatureName;
10632use crate::codegen::GenericBindings::WebGPUBinding::GPUFeatureNameValues;
10633use crate::import::module::*;
10634use crate::record::Record;
10635
10636unsafe extern "C" fn get_features<D: DomTypes>
10637(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
10638 let mut result = false;
10639 wrap_panic(&mut || result = (|| {
10640 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
10641 let this = &*(this as *const D::GPUAdapter);
10642 let result: DomRoot<D::GPUSupportedFeatures> = this.Features();
10643
10644 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
10645 return true;
10646 })());
10647 result
10648}
10649
10650
10651static features_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
10652
10653pub(crate) fn init_features_getterinfo<D: DomTypes>() {
10654 features_getterinfo.set(JSJitInfo {
10655 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
10656 getter: Some(get_features::<D>)
10657 },
10658 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
10659 protoID: PrototypeList::ID::GPUAdapter as u16,
10660 },
10661 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
10662 _bitfield_align_1: [],
10663 _bitfield_1: __BindgenBitfieldUnit::new(
10664 new_jsjitinfo_bitfield_1!(
10665 JSJitInfo_OpType::Getter as u8,
10666 JSJitInfo_AliasSet::AliasNone as u8,
10667 JSValueType::JSVAL_TYPE_OBJECT as u8,
10668 true,
10669 true,
10670 false,
10671 false,
10672 false,
10673 false,
10674 0,
10675 ).to_ne_bytes()
10676 ),
10677});
10678}
10679unsafe extern "C" fn get_limits<D: DomTypes>
10680(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
10681 let mut result = false;
10682 wrap_panic(&mut || result = (|| {
10683 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
10684 let this = &*(this as *const D::GPUAdapter);
10685 let result: DomRoot<D::GPUSupportedLimits> = this.Limits();
10686
10687 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
10688 return true;
10689 })());
10690 result
10691}
10692
10693
10694static limits_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
10695
10696pub(crate) fn init_limits_getterinfo<D: DomTypes>() {
10697 limits_getterinfo.set(JSJitInfo {
10698 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
10699 getter: Some(get_limits::<D>)
10700 },
10701 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
10702 protoID: PrototypeList::ID::GPUAdapter as u16,
10703 },
10704 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
10705 _bitfield_align_1: [],
10706 _bitfield_1: __BindgenBitfieldUnit::new(
10707 new_jsjitinfo_bitfield_1!(
10708 JSJitInfo_OpType::Getter as u8,
10709 JSJitInfo_AliasSet::AliasNone as u8,
10710 JSValueType::JSVAL_TYPE_OBJECT as u8,
10711 true,
10712 true,
10713 false,
10714 false,
10715 false,
10716 false,
10717 0,
10718 ).to_ne_bytes()
10719 ),
10720});
10721}
10722unsafe extern "C" fn get_info<D: DomTypes>
10723(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
10724 let mut result = false;
10725 wrap_panic(&mut || result = (|| {
10726 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
10727 let this = &*(this as *const D::GPUAdapter);
10728 let result: DomRoot<D::GPUAdapterInfo> = this.Info();
10729
10730 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
10731 return true;
10732 })());
10733 result
10734}
10735
10736
10737static info_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
10738
10739pub(crate) fn init_info_getterinfo<D: DomTypes>() {
10740 info_getterinfo.set(JSJitInfo {
10741 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
10742 getter: Some(get_info::<D>)
10743 },
10744 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
10745 protoID: PrototypeList::ID::GPUAdapter as u16,
10746 },
10747 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
10748 _bitfield_align_1: [],
10749 _bitfield_1: __BindgenBitfieldUnit::new(
10750 new_jsjitinfo_bitfield_1!(
10751 JSJitInfo_OpType::Getter as u8,
10752 JSJitInfo_AliasSet::AliasNone as u8,
10753 JSValueType::JSVAL_TYPE_OBJECT as u8,
10754 true,
10755 true,
10756 false,
10757 false,
10758 false,
10759 false,
10760 0,
10761 ).to_ne_bytes()
10762 ),
10763});
10764}
10765unsafe extern "C" fn requestDevice<D: DomTypes>
10766(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
10767 let mut result = false;
10768 wrap_panic(&mut || result = (|| {
10769 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
10770 let this = &*(this as *const D::GPUAdapter);
10771 let args = &*args;
10772 let argc = args.argc_;
10773 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPUDeviceDescriptor = if args.get(0).is_undefined() {
10774 crate::codegen::GenericBindings::WebGPUBinding::GPUDeviceDescriptor::empty()
10775 } else {
10776 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
10777 Ok(ConversionResult::Success(value)) => value,
10778 Ok(ConversionResult::Failure(error)) => {
10779 throw_type_error(cx.raw_cx(), &error);
10780 return false;
10781
10782 }
10783 _ => {
10784 return false;
10785
10786 },
10787 }
10788
10789 };
10790 let result: Rc<D::Promise> = this.RequestDevice(&arg0, InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx()))), CanGc::note());
10791
10792 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
10793 return true;
10794 })());
10795 result
10796}
10797
10798unsafe extern "C" fn requestDevice_promise_wrapper<D: DomTypes>
10799(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
10800 let mut result = false;
10801 wrap_panic(&mut || result = (|| {
10802 let ok = requestDevice::<D>(cx, _obj, this, args);
10803 if ok {
10804 return true;
10805 }
10806 return exception_to_promise(cx, (*args).rval(), CanGc::note());
10807
10808 })());
10809 result
10810}
10811
10812
10813static requestDevice_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
10814
10815pub(crate) fn init_requestDevice_methodinfo<D: DomTypes>() {
10816 requestDevice_methodinfo.set(JSJitInfo {
10817 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
10818 method: Some(requestDevice_promise_wrapper::<D>)
10819 },
10820 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
10821 protoID: PrototypeList::ID::GPUAdapter as u16,
10822 },
10823 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
10824 _bitfield_align_1: [],
10825 _bitfield_1: __BindgenBitfieldUnit::new(
10826 new_jsjitinfo_bitfield_1!(
10827 JSJitInfo_OpType::Method as u8,
10828 JSJitInfo_AliasSet::AliasEverything as u8,
10829 JSValueType::JSVAL_TYPE_OBJECT as u8,
10830 false,
10831 false,
10832 false,
10833 false,
10834 false,
10835 false,
10836 0,
10837 ).to_ne_bytes()
10838 ),
10839});
10840}
10841unsafe extern "C" fn _finalize<D: DomTypes>
10842(_cx: *mut GCContext, obj: *mut JSObject){
10843 wrap_panic(&mut || {
10844
10845 let this = native_from_object_static::<D::GPUAdapter>(obj).unwrap();
10846 finalize_common(this);
10847 })
10848}
10849
10850unsafe extern "C" fn _trace<D: DomTypes>
10851(trc: *mut JSTracer, obj: *mut JSObject){
10852 wrap_panic(&mut || {
10853
10854 let this = native_from_object_static::<D::GPUAdapter>(obj).unwrap();
10855 if this.is_null() { return; } (*this).trace(trc);
10857 })
10858}
10859
10860
10861static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
10862
10863pub(crate) fn init_class_ops<D: DomTypes>() {
10864 CLASS_OPS.set(JSClassOps {
10865 addProperty: None,
10866 delProperty: None,
10867 enumerate: None,
10868 newEnumerate: None,
10869 resolve: None,
10870 mayResolve: None,
10871 finalize: Some(_finalize::<D>),
10872 call: None,
10873 construct: None,
10874 trace: Some(_trace::<D>),
10875 });
10876}
10877
10878pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
10879
10880pub(crate) fn init_domjs_class<D: DomTypes>() {
10881 init_class_ops::<D>();
10882 Class.set(DOMJSClass {
10883 base: JSClass {
10884 name: c"GPUAdapter".as_ptr(),
10885 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
10886 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
10887 ,
10888 cOps: unsafe { CLASS_OPS.get() },
10889 spec: ptr::null(),
10890 ext: ptr::null(),
10891 oOps: ptr::null(),
10892 },
10893 dom_class:
10894DOMClass {
10895 interface_chain: [ PrototypeList::ID::GPUAdapter, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
10896 depth: 0,
10897 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
10898 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUAdapter> as unsafe fn(&mut _, _) -> _,
10899 global: Globals::EMPTY,
10900},
10901 });
10902}
10903
10904#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
10905(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUAdapter>, _can_gc: CanGc) -> DomRoot<D::GPUAdapter>{
10906
10907 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
10908
10909 let scope = scope.reflector().get_jsobject();
10910 assert!(!scope.get().is_null());
10911 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
10912 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
10913
10914 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
10915 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
10916 assert!(!canonical_proto.is_null());
10917
10918
10919 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
10920 if let Some(given) = given_proto {
10921 proto.set(*given);
10922 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
10923 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
10924 }
10925 } else {
10926 proto.set(*canonical_proto);
10927 }
10928 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
10929 cx.raw_cx(),
10930 &Class.get().base,
10931 proto.handle(),
10932 ));
10933 assert!(!obj.is_null());
10934 JS_SetReservedSlot(
10935 obj.get(),
10936 DOM_OBJECT_SLOT,
10937 &PrivateValue(raw.as_ptr() as *const libc::c_void),
10938 );
10939
10940 let root = raw.reflect_with(obj.get());
10941
10942
10943
10944 DomRoot::from_ref(&*root)
10945}
10946
10947pub trait GPUAdapterMethods<D: DomTypes> {
10948 fn Features(&self, ) -> DomRoot<D::GPUSupportedFeatures>;
10949 fn Limits(&self, ) -> DomRoot<D::GPUSupportedLimits>;
10950 fn Info(&self, ) -> DomRoot<D::GPUAdapterInfo>;
10951 fn RequestDevice(&self, r#descriptor: &crate::codegen::GenericBindings::WebGPUBinding::GPUDeviceDescriptor, r#_comp: InRealm, r#_can_gc: CanGc) -> Rc<D::Promise>;
10952}
10953static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
10954
10955pub(crate) fn init_sMethods_specs<D: DomTypes>() {
10956 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
10957 JSFunctionSpec {
10958 name: JSPropertySpec_Name { string_: c"requestDevice".as_ptr() },
10959 call: JSNativeWrapper { op: Some(generic_method::<true>), info: unsafe { requestDevice_methodinfo.get() } as *const _ as *const JSJitInfo },
10960 nargs: 0,
10961 flags: (JSPROP_ENUMERATE) as u16,
10962 selfHostedName: ptr::null()
10963 },
10964 JSFunctionSpec {
10965 name: JSPropertySpec_Name { string_: ptr::null() },
10966 call: JSNativeWrapper { op: None, info: ptr::null() },
10967 nargs: 0,
10968 flags: 0,
10969 selfHostedName: ptr::null()
10970 }]))[..]
10971])));
10972}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
10973
10974pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
10975 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sMethods_specs.get() })[0])])));
10976}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
10977
10978pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
10979 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
10980 JSPropertySpec {
10981 name: JSPropertySpec_Name { string_: c"features".as_ptr() },
10982 attributes_: (JSPROP_ENUMERATE),
10983 kind_: (JSPropertySpec_Kind::NativeAccessor),
10984 u: JSPropertySpec_AccessorsOrValue {
10985 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
10986 getter: JSPropertySpec_Accessor {
10987 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { features_getterinfo.get() } },
10988 },
10989 setter: JSPropertySpec_Accessor {
10990 native: JSNativeWrapper { op: None, info: ptr::null() },
10991 }
10992 }
10993 }
10994 }
10995,
10996 JSPropertySpec {
10997 name: JSPropertySpec_Name { string_: c"limits".as_ptr() },
10998 attributes_: (JSPROP_ENUMERATE),
10999 kind_: (JSPropertySpec_Kind::NativeAccessor),
11000 u: JSPropertySpec_AccessorsOrValue {
11001 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
11002 getter: JSPropertySpec_Accessor {
11003 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { limits_getterinfo.get() } },
11004 },
11005 setter: JSPropertySpec_Accessor {
11006 native: JSNativeWrapper { op: None, info: ptr::null() },
11007 }
11008 }
11009 }
11010 }
11011,
11012 JSPropertySpec {
11013 name: JSPropertySpec_Name { string_: c"info".as_ptr() },
11014 attributes_: (JSPROP_ENUMERATE),
11015 kind_: (JSPropertySpec_Kind::NativeAccessor),
11016 u: JSPropertySpec_AccessorsOrValue {
11017 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
11018 getter: JSPropertySpec_Accessor {
11019 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { info_getterinfo.get() } },
11020 },
11021 setter: JSPropertySpec_Accessor {
11022 native: JSNativeWrapper { op: None, info: ptr::null() },
11023 }
11024 }
11025 }
11026 }
11027,
11028 JSPropertySpec::ZERO]))[..]
11029,
11030&Box::leak(Box::new([
11031 JSPropertySpec {
11032 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
11033 attributes_: (JSPROP_READONLY),
11034 kind_: (JSPropertySpec_Kind::Value),
11035 u: JSPropertySpec_AccessorsOrValue {
11036 value: JSPropertySpec_ValueWrapper {
11037 type_: JSPropertySpec_ValueWrapper_Type::String,
11038 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
11039 string: c"GPUAdapter".as_ptr(),
11040 }
11041 }
11042 }
11043 }
11044,
11045 JSPropertySpec::ZERO]))[..]
11046])));
11047}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
11048
11049pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
11050 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
11051 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
11052}
11053pub fn GetProtoObject<D: DomTypes>
11054(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
11055 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUAdapter), CreateInterfaceObjects::<D>, rval)
11057}
11058
11059
11060static PrototypeClass: JSClass = JSClass {
11061 name: c"GPUAdapterPrototype".as_ptr(),
11062 flags:
11063 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
11065 cOps: ptr::null(),
11066 spec: ptr::null(),
11067 ext: ptr::null(),
11068 oOps: ptr::null(),
11069};
11070
11071
11072static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
11073
11074pub(crate) fn init_interface_object<D: DomTypes>() {
11075 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
11076 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
11077 b"function GPUAdapter() {\n [native code]\n}",
11078 PrototypeList::ID::GPUAdapter,
11079 0,
11080 ));
11081}
11082
11083pub fn DefineDOMInterface<D: DomTypes>
11084(cx: SafeJSContext, global: HandleObject){
11085 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUAdapter),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
11086}
11087
11088pub fn ConstructorEnabled<D: DomTypes>
11089(aCx: SafeJSContext, aObj: HandleObject) -> bool{
11090 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
11091 pref!(dom_webgpu_enabled)
11092}
11093
11094unsafe fn CreateInterfaceObjects<D: DomTypes>
11095(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
11096
11097 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
11098 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
11099 assert!(!prototype_proto.is_null());
11100
11101 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
11102 create_interface_prototype_object::<D>(cx,
11103 global,
11104 prototype_proto.handle(),
11105 &PrototypeClass,
11106 sMethods.get(),
11107 sAttributes.get(),
11108 &[],
11109 &[],
11110 prototype.handle_mut());
11111 assert!(!prototype.is_null());
11112 assert!((*cache)[PrototypeList::ID::GPUAdapter as usize].is_null());
11113 (*cache)[PrototypeList::ID::GPUAdapter as usize] = prototype.get();
11114 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUAdapter as isize),
11115 ptr::null_mut(),
11116 prototype.get());
11117
11118 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
11119 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
11120
11121 assert!(!interface_proto.is_null());
11122
11123 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
11124 create_noncallback_interface_object::<D>(cx,
11125 global,
11126 interface_proto.handle(),
11127 INTERFACE_OBJECT_CLASS.get(),
11128 &[],
11129 &[],
11130 &[],
11131 prototype.handle(),
11132 c"GPUAdapter",
11133 0,
11134 &[],
11135 interface.handle_mut());
11136 assert!(!interface.is_null());
11137}
11138
11139
11140 pub(crate) fn init_statics<D: DomTypes>() {
11141 init_interface_object::<D>();
11142 init_domjs_class::<D>();
11143 crate::codegen::GenericBindings::WebGPUBinding::GPUAdapter_Binding::init_requestDevice_methodinfo::<D>();
11144 init_features_getterinfo::<D>();
11145init_limits_getterinfo::<D>();
11146init_info_getterinfo::<D>();
11147
11148
11149 init_sMethods_specs::<D>();
11150init_sMethods_prefs::<D>();
11151init_sAttributes_specs::<D>();
11152init_sAttributes_prefs::<D>();
11153 }
11154 } pub use self::GPUAdapterInfo_Binding::{Wrap as GPUAdapterInfoWrap, GPUAdapterInfoMethods, GetProtoObject as GPUAdapterInfoGetProtoObject, DefineDOMInterface as GPUAdapterInfoDefineDOMInterface};
11158pub mod GPUAdapterInfo_Binding {
11159use crate::import::module::*;
11160
11161unsafe extern "C" fn get_vendor<D: DomTypes>
11162(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
11163 let mut result = false;
11164 wrap_panic(&mut || result = (|| {
11165 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
11166 let this = &*(this as *const D::GPUAdapterInfo);
11167 let result: DOMString = this.Vendor();
11168
11169 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
11170 return true;
11171 })());
11172 result
11173}
11174
11175
11176static vendor_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
11177
11178pub(crate) fn init_vendor_getterinfo<D: DomTypes>() {
11179 vendor_getterinfo.set(JSJitInfo {
11180 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
11181 getter: Some(get_vendor::<D>)
11182 },
11183 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
11184 protoID: PrototypeList::ID::GPUAdapterInfo as u16,
11185 },
11186 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
11187 _bitfield_align_1: [],
11188 _bitfield_1: __BindgenBitfieldUnit::new(
11189 new_jsjitinfo_bitfield_1!(
11190 JSJitInfo_OpType::Getter as u8,
11191 JSJitInfo_AliasSet::AliasEverything as u8,
11192 JSValueType::JSVAL_TYPE_STRING as u8,
11193 true,
11194 false,
11195 false,
11196 false,
11197 false,
11198 false,
11199 0,
11200 ).to_ne_bytes()
11201 ),
11202});
11203}
11204unsafe extern "C" fn get_architecture<D: DomTypes>
11205(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
11206 let mut result = false;
11207 wrap_panic(&mut || result = (|| {
11208 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
11209 let this = &*(this as *const D::GPUAdapterInfo);
11210 let result: DOMString = this.Architecture();
11211
11212 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
11213 return true;
11214 })());
11215 result
11216}
11217
11218
11219static architecture_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
11220
11221pub(crate) fn init_architecture_getterinfo<D: DomTypes>() {
11222 architecture_getterinfo.set(JSJitInfo {
11223 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
11224 getter: Some(get_architecture::<D>)
11225 },
11226 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
11227 protoID: PrototypeList::ID::GPUAdapterInfo as u16,
11228 },
11229 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
11230 _bitfield_align_1: [],
11231 _bitfield_1: __BindgenBitfieldUnit::new(
11232 new_jsjitinfo_bitfield_1!(
11233 JSJitInfo_OpType::Getter as u8,
11234 JSJitInfo_AliasSet::AliasEverything as u8,
11235 JSValueType::JSVAL_TYPE_STRING as u8,
11236 true,
11237 false,
11238 false,
11239 false,
11240 false,
11241 false,
11242 0,
11243 ).to_ne_bytes()
11244 ),
11245});
11246}
11247unsafe extern "C" fn get_device<D: DomTypes>
11248(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
11249 let mut result = false;
11250 wrap_panic(&mut || result = (|| {
11251 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
11252 let this = &*(this as *const D::GPUAdapterInfo);
11253 let result: DOMString = this.Device();
11254
11255 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
11256 return true;
11257 })());
11258 result
11259}
11260
11261
11262static device_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
11263
11264pub(crate) fn init_device_getterinfo<D: DomTypes>() {
11265 device_getterinfo.set(JSJitInfo {
11266 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
11267 getter: Some(get_device::<D>)
11268 },
11269 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
11270 protoID: PrototypeList::ID::GPUAdapterInfo as u16,
11271 },
11272 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
11273 _bitfield_align_1: [],
11274 _bitfield_1: __BindgenBitfieldUnit::new(
11275 new_jsjitinfo_bitfield_1!(
11276 JSJitInfo_OpType::Getter as u8,
11277 JSJitInfo_AliasSet::AliasEverything as u8,
11278 JSValueType::JSVAL_TYPE_STRING as u8,
11279 true,
11280 false,
11281 false,
11282 false,
11283 false,
11284 false,
11285 0,
11286 ).to_ne_bytes()
11287 ),
11288});
11289}
11290unsafe extern "C" fn get_description<D: DomTypes>
11291(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
11292 let mut result = false;
11293 wrap_panic(&mut || result = (|| {
11294 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
11295 let this = &*(this as *const D::GPUAdapterInfo);
11296 let result: DOMString = this.Description();
11297
11298 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
11299 return true;
11300 })());
11301 result
11302}
11303
11304
11305static description_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
11306
11307pub(crate) fn init_description_getterinfo<D: DomTypes>() {
11308 description_getterinfo.set(JSJitInfo {
11309 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
11310 getter: Some(get_description::<D>)
11311 },
11312 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
11313 protoID: PrototypeList::ID::GPUAdapterInfo as u16,
11314 },
11315 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
11316 _bitfield_align_1: [],
11317 _bitfield_1: __BindgenBitfieldUnit::new(
11318 new_jsjitinfo_bitfield_1!(
11319 JSJitInfo_OpType::Getter as u8,
11320 JSJitInfo_AliasSet::AliasEverything as u8,
11321 JSValueType::JSVAL_TYPE_STRING as u8,
11322 true,
11323 false,
11324 false,
11325 false,
11326 false,
11327 false,
11328 0,
11329 ).to_ne_bytes()
11330 ),
11331});
11332}
11333unsafe extern "C" fn get_subgroupMinSize<D: DomTypes>
11334(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
11335 let mut result = false;
11336 wrap_panic(&mut || result = (|| {
11337 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
11338 let this = &*(this as *const D::GPUAdapterInfo);
11339 let result: u32 = this.SubgroupMinSize();
11340
11341 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
11342 return true;
11343 })());
11344 result
11345}
11346
11347
11348static subgroupMinSize_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
11349
11350pub(crate) fn init_subgroupMinSize_getterinfo<D: DomTypes>() {
11351 subgroupMinSize_getterinfo.set(JSJitInfo {
11352 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
11353 getter: Some(get_subgroupMinSize::<D>)
11354 },
11355 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
11356 protoID: PrototypeList::ID::GPUAdapterInfo as u16,
11357 },
11358 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
11359 _bitfield_align_1: [],
11360 _bitfield_1: __BindgenBitfieldUnit::new(
11361 new_jsjitinfo_bitfield_1!(
11362 JSJitInfo_OpType::Getter as u8,
11363 JSJitInfo_AliasSet::AliasEverything as u8,
11364 JSValueType::JSVAL_TYPE_DOUBLE as u8,
11365 true,
11366 false,
11367 false,
11368 false,
11369 false,
11370 false,
11371 0,
11372 ).to_ne_bytes()
11373 ),
11374});
11375}
11376unsafe extern "C" fn get_subgroupMaxSize<D: DomTypes>
11377(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
11378 let mut result = false;
11379 wrap_panic(&mut || result = (|| {
11380 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
11381 let this = &*(this as *const D::GPUAdapterInfo);
11382 let result: u32 = this.SubgroupMaxSize();
11383
11384 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
11385 return true;
11386 })());
11387 result
11388}
11389
11390
11391static subgroupMaxSize_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
11392
11393pub(crate) fn init_subgroupMaxSize_getterinfo<D: DomTypes>() {
11394 subgroupMaxSize_getterinfo.set(JSJitInfo {
11395 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
11396 getter: Some(get_subgroupMaxSize::<D>)
11397 },
11398 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
11399 protoID: PrototypeList::ID::GPUAdapterInfo as u16,
11400 },
11401 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
11402 _bitfield_align_1: [],
11403 _bitfield_1: __BindgenBitfieldUnit::new(
11404 new_jsjitinfo_bitfield_1!(
11405 JSJitInfo_OpType::Getter as u8,
11406 JSJitInfo_AliasSet::AliasEverything as u8,
11407 JSValueType::JSVAL_TYPE_DOUBLE as u8,
11408 true,
11409 false,
11410 false,
11411 false,
11412 false,
11413 false,
11414 0,
11415 ).to_ne_bytes()
11416 ),
11417});
11418}
11419unsafe extern "C" fn get_isFallbackAdapter<D: DomTypes>
11420(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
11421 let mut result = false;
11422 wrap_panic(&mut || result = (|| {
11423 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
11424 let this = &*(this as *const D::GPUAdapterInfo);
11425 let result: bool = this.IsFallbackAdapter();
11426
11427 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
11428 return true;
11429 })());
11430 result
11431}
11432
11433
11434static isFallbackAdapter_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
11435
11436pub(crate) fn init_isFallbackAdapter_getterinfo<D: DomTypes>() {
11437 isFallbackAdapter_getterinfo.set(JSJitInfo {
11438 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
11439 getter: Some(get_isFallbackAdapter::<D>)
11440 },
11441 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
11442 protoID: PrototypeList::ID::GPUAdapterInfo as u16,
11443 },
11444 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
11445 _bitfield_align_1: [],
11446 _bitfield_1: __BindgenBitfieldUnit::new(
11447 new_jsjitinfo_bitfield_1!(
11448 JSJitInfo_OpType::Getter as u8,
11449 JSJitInfo_AliasSet::AliasEverything as u8,
11450 JSValueType::JSVAL_TYPE_BOOLEAN as u8,
11451 true,
11452 false,
11453 false,
11454 false,
11455 false,
11456 false,
11457 0,
11458 ).to_ne_bytes()
11459 ),
11460});
11461}
11462unsafe extern "C" fn _finalize<D: DomTypes>
11463(_cx: *mut GCContext, obj: *mut JSObject){
11464 wrap_panic(&mut || {
11465
11466 let this = native_from_object_static::<D::GPUAdapterInfo>(obj).unwrap();
11467 finalize_common(this);
11468 })
11469}
11470
11471unsafe extern "C" fn _trace<D: DomTypes>
11472(trc: *mut JSTracer, obj: *mut JSObject){
11473 wrap_panic(&mut || {
11474
11475 let this = native_from_object_static::<D::GPUAdapterInfo>(obj).unwrap();
11476 if this.is_null() { return; } (*this).trace(trc);
11478 })
11479}
11480
11481
11482static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
11483
11484pub(crate) fn init_class_ops<D: DomTypes>() {
11485 CLASS_OPS.set(JSClassOps {
11486 addProperty: None,
11487 delProperty: None,
11488 enumerate: None,
11489 newEnumerate: None,
11490 resolve: None,
11491 mayResolve: None,
11492 finalize: Some(_finalize::<D>),
11493 call: None,
11494 construct: None,
11495 trace: Some(_trace::<D>),
11496 });
11497}
11498
11499pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
11500
11501pub(crate) fn init_domjs_class<D: DomTypes>() {
11502 init_class_ops::<D>();
11503 Class.set(DOMJSClass {
11504 base: JSClass {
11505 name: c"GPUAdapterInfo".as_ptr(),
11506 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
11507 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
11508 ,
11509 cOps: unsafe { CLASS_OPS.get() },
11510 spec: ptr::null(),
11511 ext: ptr::null(),
11512 oOps: ptr::null(),
11513 },
11514 dom_class:
11515DOMClass {
11516 interface_chain: [ PrototypeList::ID::GPUAdapterInfo, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
11517 depth: 0,
11518 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
11519 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUAdapterInfo> as unsafe fn(&mut _, _) -> _,
11520 global: Globals::EMPTY,
11521},
11522 });
11523}
11524
11525#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
11526(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUAdapterInfo>, _can_gc: CanGc) -> DomRoot<D::GPUAdapterInfo>{
11527
11528 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
11529
11530 let scope = scope.reflector().get_jsobject();
11531 assert!(!scope.get().is_null());
11532 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
11533 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
11534
11535 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
11536 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
11537 assert!(!canonical_proto.is_null());
11538
11539
11540 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
11541 if let Some(given) = given_proto {
11542 proto.set(*given);
11543 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
11544 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
11545 }
11546 } else {
11547 proto.set(*canonical_proto);
11548 }
11549 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
11550 cx.raw_cx(),
11551 &Class.get().base,
11552 proto.handle(),
11553 ));
11554 assert!(!obj.is_null());
11555 JS_SetReservedSlot(
11556 obj.get(),
11557 DOM_OBJECT_SLOT,
11558 &PrivateValue(raw.as_ptr() as *const libc::c_void),
11559 );
11560
11561 let root = raw.reflect_with(obj.get());
11562
11563
11564
11565 DomRoot::from_ref(&*root)
11566}
11567
11568pub trait GPUAdapterInfoMethods<D: DomTypes> {
11569 fn Vendor(&self, ) -> DOMString;
11570 fn Architecture(&self, ) -> DOMString;
11571 fn Device(&self, ) -> DOMString;
11572 fn Description(&self, ) -> DOMString;
11573 fn SubgroupMinSize(&self, ) -> u32;
11574 fn SubgroupMaxSize(&self, ) -> u32;
11575 fn IsFallbackAdapter(&self, ) -> bool;
11576}
11577static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
11578
11579pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
11580 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
11581 JSPropertySpec {
11582 name: JSPropertySpec_Name { string_: c"vendor".as_ptr() },
11583 attributes_: (JSPROP_ENUMERATE),
11584 kind_: (JSPropertySpec_Kind::NativeAccessor),
11585 u: JSPropertySpec_AccessorsOrValue {
11586 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
11587 getter: JSPropertySpec_Accessor {
11588 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { vendor_getterinfo.get() } },
11589 },
11590 setter: JSPropertySpec_Accessor {
11591 native: JSNativeWrapper { op: None, info: ptr::null() },
11592 }
11593 }
11594 }
11595 }
11596,
11597 JSPropertySpec {
11598 name: JSPropertySpec_Name { string_: c"architecture".as_ptr() },
11599 attributes_: (JSPROP_ENUMERATE),
11600 kind_: (JSPropertySpec_Kind::NativeAccessor),
11601 u: JSPropertySpec_AccessorsOrValue {
11602 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
11603 getter: JSPropertySpec_Accessor {
11604 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { architecture_getterinfo.get() } },
11605 },
11606 setter: JSPropertySpec_Accessor {
11607 native: JSNativeWrapper { op: None, info: ptr::null() },
11608 }
11609 }
11610 }
11611 }
11612,
11613 JSPropertySpec {
11614 name: JSPropertySpec_Name { string_: c"device".as_ptr() },
11615 attributes_: (JSPROP_ENUMERATE),
11616 kind_: (JSPropertySpec_Kind::NativeAccessor),
11617 u: JSPropertySpec_AccessorsOrValue {
11618 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
11619 getter: JSPropertySpec_Accessor {
11620 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { device_getterinfo.get() } },
11621 },
11622 setter: JSPropertySpec_Accessor {
11623 native: JSNativeWrapper { op: None, info: ptr::null() },
11624 }
11625 }
11626 }
11627 }
11628,
11629 JSPropertySpec {
11630 name: JSPropertySpec_Name { string_: c"description".as_ptr() },
11631 attributes_: (JSPROP_ENUMERATE),
11632 kind_: (JSPropertySpec_Kind::NativeAccessor),
11633 u: JSPropertySpec_AccessorsOrValue {
11634 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
11635 getter: JSPropertySpec_Accessor {
11636 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { description_getterinfo.get() } },
11637 },
11638 setter: JSPropertySpec_Accessor {
11639 native: JSNativeWrapper { op: None, info: ptr::null() },
11640 }
11641 }
11642 }
11643 }
11644,
11645 JSPropertySpec {
11646 name: JSPropertySpec_Name { string_: c"subgroupMinSize".as_ptr() },
11647 attributes_: (JSPROP_ENUMERATE),
11648 kind_: (JSPropertySpec_Kind::NativeAccessor),
11649 u: JSPropertySpec_AccessorsOrValue {
11650 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
11651 getter: JSPropertySpec_Accessor {
11652 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { subgroupMinSize_getterinfo.get() } },
11653 },
11654 setter: JSPropertySpec_Accessor {
11655 native: JSNativeWrapper { op: None, info: ptr::null() },
11656 }
11657 }
11658 }
11659 }
11660,
11661 JSPropertySpec {
11662 name: JSPropertySpec_Name { string_: c"subgroupMaxSize".as_ptr() },
11663 attributes_: (JSPROP_ENUMERATE),
11664 kind_: (JSPropertySpec_Kind::NativeAccessor),
11665 u: JSPropertySpec_AccessorsOrValue {
11666 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
11667 getter: JSPropertySpec_Accessor {
11668 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { subgroupMaxSize_getterinfo.get() } },
11669 },
11670 setter: JSPropertySpec_Accessor {
11671 native: JSNativeWrapper { op: None, info: ptr::null() },
11672 }
11673 }
11674 }
11675 }
11676,
11677 JSPropertySpec {
11678 name: JSPropertySpec_Name { string_: c"isFallbackAdapter".as_ptr() },
11679 attributes_: (JSPROP_ENUMERATE),
11680 kind_: (JSPropertySpec_Kind::NativeAccessor),
11681 u: JSPropertySpec_AccessorsOrValue {
11682 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
11683 getter: JSPropertySpec_Accessor {
11684 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { isFallbackAdapter_getterinfo.get() } },
11685 },
11686 setter: JSPropertySpec_Accessor {
11687 native: JSNativeWrapper { op: None, info: ptr::null() },
11688 }
11689 }
11690 }
11691 }
11692,
11693 JSPropertySpec::ZERO]))[..]
11694,
11695&Box::leak(Box::new([
11696 JSPropertySpec {
11697 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
11698 attributes_: (JSPROP_READONLY),
11699 kind_: (JSPropertySpec_Kind::Value),
11700 u: JSPropertySpec_AccessorsOrValue {
11701 value: JSPropertySpec_ValueWrapper {
11702 type_: JSPropertySpec_ValueWrapper_Type::String,
11703 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
11704 string: c"GPUAdapterInfo".as_ptr(),
11705 }
11706 }
11707 }
11708 }
11709,
11710 JSPropertySpec::ZERO]))[..]
11711])));
11712}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
11713
11714pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
11715 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
11716 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
11717}
11718pub fn GetProtoObject<D: DomTypes>
11719(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
11720 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUAdapterInfo), CreateInterfaceObjects::<D>, rval)
11722}
11723
11724
11725static PrototypeClass: JSClass = JSClass {
11726 name: c"GPUAdapterInfoPrototype".as_ptr(),
11727 flags:
11728 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
11730 cOps: ptr::null(),
11731 spec: ptr::null(),
11732 ext: ptr::null(),
11733 oOps: ptr::null(),
11734};
11735
11736
11737static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
11738
11739pub(crate) fn init_interface_object<D: DomTypes>() {
11740 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
11741 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
11742 b"function GPUAdapterInfo() {\n [native code]\n}",
11743 PrototypeList::ID::GPUAdapterInfo,
11744 0,
11745 ));
11746}
11747
11748pub fn DefineDOMInterface<D: DomTypes>
11749(cx: SafeJSContext, global: HandleObject){
11750 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUAdapterInfo),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
11751}
11752
11753pub fn ConstructorEnabled<D: DomTypes>
11754(aCx: SafeJSContext, aObj: HandleObject) -> bool{
11755 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
11756 pref!(dom_webgpu_enabled)
11757}
11758
11759unsafe fn CreateInterfaceObjects<D: DomTypes>
11760(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
11761
11762 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
11763 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
11764 assert!(!prototype_proto.is_null());
11765
11766 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
11767 create_interface_prototype_object::<D>(cx,
11768 global,
11769 prototype_proto.handle(),
11770 &PrototypeClass,
11771 &[],
11772 sAttributes.get(),
11773 &[],
11774 &[],
11775 prototype.handle_mut());
11776 assert!(!prototype.is_null());
11777 assert!((*cache)[PrototypeList::ID::GPUAdapterInfo as usize].is_null());
11778 (*cache)[PrototypeList::ID::GPUAdapterInfo as usize] = prototype.get();
11779 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUAdapterInfo as isize),
11780 ptr::null_mut(),
11781 prototype.get());
11782
11783 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
11784 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
11785
11786 assert!(!interface_proto.is_null());
11787
11788 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
11789 create_noncallback_interface_object::<D>(cx,
11790 global,
11791 interface_proto.handle(),
11792 INTERFACE_OBJECT_CLASS.get(),
11793 &[],
11794 &[],
11795 &[],
11796 prototype.handle(),
11797 c"GPUAdapterInfo",
11798 0,
11799 &[],
11800 interface.handle_mut());
11801 assert!(!interface.is_null());
11802}
11803
11804
11805 pub(crate) fn init_statics<D: DomTypes>() {
11806 init_interface_object::<D>();
11807 init_domjs_class::<D>();
11808
11809 init_vendor_getterinfo::<D>();
11810init_architecture_getterinfo::<D>();
11811init_device_getterinfo::<D>();
11812init_description_getterinfo::<D>();
11813init_subgroupMinSize_getterinfo::<D>();
11814init_subgroupMaxSize_getterinfo::<D>();
11815init_isFallbackAdapter_getterinfo::<D>();
11816
11817
11818 init_sAttributes_specs::<D>();
11819init_sAttributes_prefs::<D>();
11820 }
11821 } pub use self::GPUBindGroup_Binding::{Wrap as GPUBindGroupWrap, GPUBindGroupMethods, GetProtoObject as GPUBindGroupGetProtoObject, DefineDOMInterface as GPUBindGroupDefineDOMInterface};
11825pub mod GPUBindGroup_Binding {
11826use crate::import::module::*;
11827
11828unsafe extern "C" fn get_label<D: DomTypes>
11829(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
11830 let mut result = false;
11831 wrap_panic(&mut || result = (|| {
11832 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
11833 let this = &*(this as *const D::GPUBindGroup);
11834 let result: USVString = this.Label();
11835
11836 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
11837 return true;
11838 })());
11839 result
11840}
11841
11842unsafe extern "C" fn set_label<D: DomTypes>
11843(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
11844 let mut result = false;
11845 wrap_panic(&mut || result = (|| {
11846 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
11847 let this = &*(this as *const D::GPUBindGroup);
11848 let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
11849 Ok(ConversionResult::Success(value)) => value,
11850 Ok(ConversionResult::Failure(error)) => {
11851 throw_type_error(cx.raw_cx(), &error);
11852 return false;
11853
11854 }
11855 _ => {
11856 return false;
11857
11858 },
11859 }
11860 ;
11861 let result: () = this.SetLabel(arg0);
11862
11863 true
11864 })());
11865 result
11866}
11867
11868
11869static label_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
11870
11871pub(crate) fn init_label_getterinfo<D: DomTypes>() {
11872 label_getterinfo.set(JSJitInfo {
11873 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
11874 getter: Some(get_label::<D>)
11875 },
11876 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
11877 protoID: PrototypeList::ID::GPUBindGroup as u16,
11878 },
11879 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
11880 _bitfield_align_1: [],
11881 _bitfield_1: __BindgenBitfieldUnit::new(
11882 new_jsjitinfo_bitfield_1!(
11883 JSJitInfo_OpType::Getter as u8,
11884 JSJitInfo_AliasSet::AliasEverything as u8,
11885 JSValueType::JSVAL_TYPE_STRING as u8,
11886 true,
11887 false,
11888 false,
11889 false,
11890 false,
11891 false,
11892 0,
11893 ).to_ne_bytes()
11894 ),
11895});
11896}
11897static label_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
11898
11899pub(crate) fn init_label_setterinfo<D: DomTypes>() {
11900 label_setterinfo.set(JSJitInfo {
11901 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
11902 setter: Some(set_label::<D>)
11903 },
11904 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
11905 protoID: PrototypeList::ID::GPUBindGroup as u16,
11906 },
11907 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
11908 _bitfield_align_1: [],
11909 _bitfield_1: __BindgenBitfieldUnit::new(
11910 new_jsjitinfo_bitfield_1!(
11911 JSJitInfo_OpType::Setter as u8,
11912 JSJitInfo_AliasSet::AliasEverything as u8,
11913 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
11914 false,
11915 false,
11916 false,
11917 false,
11918 false,
11919 false,
11920 0,
11921 ).to_ne_bytes()
11922 ),
11923});
11924}
11925unsafe extern "C" fn _finalize<D: DomTypes>
11926(_cx: *mut GCContext, obj: *mut JSObject){
11927 wrap_panic(&mut || {
11928
11929 let this = native_from_object_static::<D::GPUBindGroup>(obj).unwrap();
11930 finalize_common(this);
11931 })
11932}
11933
11934unsafe extern "C" fn _trace<D: DomTypes>
11935(trc: *mut JSTracer, obj: *mut JSObject){
11936 wrap_panic(&mut || {
11937
11938 let this = native_from_object_static::<D::GPUBindGroup>(obj).unwrap();
11939 if this.is_null() { return; } (*this).trace(trc);
11941 })
11942}
11943
11944
11945static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
11946
11947pub(crate) fn init_class_ops<D: DomTypes>() {
11948 CLASS_OPS.set(JSClassOps {
11949 addProperty: None,
11950 delProperty: None,
11951 enumerate: None,
11952 newEnumerate: None,
11953 resolve: None,
11954 mayResolve: None,
11955 finalize: Some(_finalize::<D>),
11956 call: None,
11957 construct: None,
11958 trace: Some(_trace::<D>),
11959 });
11960}
11961
11962pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
11963
11964pub(crate) fn init_domjs_class<D: DomTypes>() {
11965 init_class_ops::<D>();
11966 Class.set(DOMJSClass {
11967 base: JSClass {
11968 name: c"GPUBindGroup".as_ptr(),
11969 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
11970 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
11971 ,
11972 cOps: unsafe { CLASS_OPS.get() },
11973 spec: ptr::null(),
11974 ext: ptr::null(),
11975 oOps: ptr::null(),
11976 },
11977 dom_class:
11978DOMClass {
11979 interface_chain: [ PrototypeList::ID::GPUBindGroup, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
11980 depth: 0,
11981 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
11982 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUBindGroup> as unsafe fn(&mut _, _) -> _,
11983 global: Globals::EMPTY,
11984},
11985 });
11986}
11987
11988#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
11989(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUBindGroup>, _can_gc: CanGc) -> DomRoot<D::GPUBindGroup>{
11990
11991 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
11992
11993 let scope = scope.reflector().get_jsobject();
11994 assert!(!scope.get().is_null());
11995 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
11996 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
11997
11998 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
11999 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
12000 assert!(!canonical_proto.is_null());
12001
12002
12003 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
12004 if let Some(given) = given_proto {
12005 proto.set(*given);
12006 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
12007 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
12008 }
12009 } else {
12010 proto.set(*canonical_proto);
12011 }
12012 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
12013 cx.raw_cx(),
12014 &Class.get().base,
12015 proto.handle(),
12016 ));
12017 assert!(!obj.is_null());
12018 JS_SetReservedSlot(
12019 obj.get(),
12020 DOM_OBJECT_SLOT,
12021 &PrivateValue(raw.as_ptr() as *const libc::c_void),
12022 );
12023
12024 let root = raw.reflect_with(obj.get());
12025
12026
12027
12028 DomRoot::from_ref(&*root)
12029}
12030
12031pub trait GPUBindGroupMethods<D: DomTypes> {
12032 fn Label(&self, ) -> USVString;
12033 fn SetLabel(&self, r#value: USVString);
12034}
12035static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
12036
12037pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
12038 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
12039 JSPropertySpec {
12040 name: JSPropertySpec_Name { string_: c"label".as_ptr() },
12041 attributes_: (JSPROP_ENUMERATE),
12042 kind_: (JSPropertySpec_Kind::NativeAccessor),
12043 u: JSPropertySpec_AccessorsOrValue {
12044 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
12045 getter: JSPropertySpec_Accessor {
12046 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { label_getterinfo.get() } },
12047 },
12048 setter: JSPropertySpec_Accessor {
12049 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { label_setterinfo.get() } },
12050 }
12051 }
12052 }
12053 }
12054,
12055 JSPropertySpec::ZERO]))[..]
12056,
12057&Box::leak(Box::new([
12058 JSPropertySpec {
12059 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
12060 attributes_: (JSPROP_READONLY),
12061 kind_: (JSPropertySpec_Kind::Value),
12062 u: JSPropertySpec_AccessorsOrValue {
12063 value: JSPropertySpec_ValueWrapper {
12064 type_: JSPropertySpec_ValueWrapper_Type::String,
12065 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
12066 string: c"GPUBindGroup".as_ptr(),
12067 }
12068 }
12069 }
12070 }
12071,
12072 JSPropertySpec::ZERO]))[..]
12073])));
12074}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
12075
12076pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
12077 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
12078 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
12079}
12080pub fn GetProtoObject<D: DomTypes>
12081(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
12082 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUBindGroup), CreateInterfaceObjects::<D>, rval)
12084}
12085
12086
12087static PrototypeClass: JSClass = JSClass {
12088 name: c"GPUBindGroupPrototype".as_ptr(),
12089 flags:
12090 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
12092 cOps: ptr::null(),
12093 spec: ptr::null(),
12094 ext: ptr::null(),
12095 oOps: ptr::null(),
12096};
12097
12098
12099static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
12100
12101pub(crate) fn init_interface_object<D: DomTypes>() {
12102 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
12103 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
12104 b"function GPUBindGroup() {\n [native code]\n}",
12105 PrototypeList::ID::GPUBindGroup,
12106 0,
12107 ));
12108}
12109
12110pub fn DefineDOMInterface<D: DomTypes>
12111(cx: SafeJSContext, global: HandleObject){
12112 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUBindGroup),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
12113}
12114
12115pub fn ConstructorEnabled<D: DomTypes>
12116(aCx: SafeJSContext, aObj: HandleObject) -> bool{
12117 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
12118 pref!(dom_webgpu_enabled)
12119}
12120
12121unsafe fn CreateInterfaceObjects<D: DomTypes>
12122(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
12123
12124 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
12125 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
12126 assert!(!prototype_proto.is_null());
12127
12128 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
12129 create_interface_prototype_object::<D>(cx,
12130 global,
12131 prototype_proto.handle(),
12132 &PrototypeClass,
12133 &[],
12134 sAttributes.get(),
12135 &[],
12136 &[],
12137 prototype.handle_mut());
12138 assert!(!prototype.is_null());
12139 assert!((*cache)[PrototypeList::ID::GPUBindGroup as usize].is_null());
12140 (*cache)[PrototypeList::ID::GPUBindGroup as usize] = prototype.get();
12141 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUBindGroup as isize),
12142 ptr::null_mut(),
12143 prototype.get());
12144
12145 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
12146 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
12147
12148 assert!(!interface_proto.is_null());
12149
12150 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
12151 create_noncallback_interface_object::<D>(cx,
12152 global,
12153 interface_proto.handle(),
12154 INTERFACE_OBJECT_CLASS.get(),
12155 &[],
12156 &[],
12157 &[],
12158 prototype.handle(),
12159 c"GPUBindGroup",
12160 0,
12161 &[],
12162 interface.handle_mut());
12163 assert!(!interface.is_null());
12164}
12165
12166
12167 pub(crate) fn init_statics<D: DomTypes>() {
12168 init_interface_object::<D>();
12169 init_domjs_class::<D>();
12170
12171 init_label_getterinfo::<D>();
12172 init_label_setterinfo::<D>();
12173
12174 init_sAttributes_specs::<D>();
12175init_sAttributes_prefs::<D>();
12176 }
12177 } pub use self::GPUBindGroupLayout_Binding::{Wrap as GPUBindGroupLayoutWrap, GPUBindGroupLayoutMethods, GetProtoObject as GPUBindGroupLayoutGetProtoObject, DefineDOMInterface as GPUBindGroupLayoutDefineDOMInterface};
12181pub mod GPUBindGroupLayout_Binding {
12182use crate::import::module::*;
12183
12184unsafe extern "C" fn get_label<D: DomTypes>
12185(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
12186 let mut result = false;
12187 wrap_panic(&mut || result = (|| {
12188 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
12189 let this = &*(this as *const D::GPUBindGroupLayout);
12190 let result: USVString = this.Label();
12191
12192 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
12193 return true;
12194 })());
12195 result
12196}
12197
12198unsafe extern "C" fn set_label<D: DomTypes>
12199(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
12200 let mut result = false;
12201 wrap_panic(&mut || result = (|| {
12202 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
12203 let this = &*(this as *const D::GPUBindGroupLayout);
12204 let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
12205 Ok(ConversionResult::Success(value)) => value,
12206 Ok(ConversionResult::Failure(error)) => {
12207 throw_type_error(cx.raw_cx(), &error);
12208 return false;
12209
12210 }
12211 _ => {
12212 return false;
12213
12214 },
12215 }
12216 ;
12217 let result: () = this.SetLabel(arg0);
12218
12219 true
12220 })());
12221 result
12222}
12223
12224
12225static label_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
12226
12227pub(crate) fn init_label_getterinfo<D: DomTypes>() {
12228 label_getterinfo.set(JSJitInfo {
12229 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
12230 getter: Some(get_label::<D>)
12231 },
12232 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
12233 protoID: PrototypeList::ID::GPUBindGroupLayout as u16,
12234 },
12235 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
12236 _bitfield_align_1: [],
12237 _bitfield_1: __BindgenBitfieldUnit::new(
12238 new_jsjitinfo_bitfield_1!(
12239 JSJitInfo_OpType::Getter as u8,
12240 JSJitInfo_AliasSet::AliasEverything as u8,
12241 JSValueType::JSVAL_TYPE_STRING as u8,
12242 true,
12243 false,
12244 false,
12245 false,
12246 false,
12247 false,
12248 0,
12249 ).to_ne_bytes()
12250 ),
12251});
12252}
12253static label_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
12254
12255pub(crate) fn init_label_setterinfo<D: DomTypes>() {
12256 label_setterinfo.set(JSJitInfo {
12257 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
12258 setter: Some(set_label::<D>)
12259 },
12260 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
12261 protoID: PrototypeList::ID::GPUBindGroupLayout as u16,
12262 },
12263 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
12264 _bitfield_align_1: [],
12265 _bitfield_1: __BindgenBitfieldUnit::new(
12266 new_jsjitinfo_bitfield_1!(
12267 JSJitInfo_OpType::Setter as u8,
12268 JSJitInfo_AliasSet::AliasEverything as u8,
12269 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
12270 false,
12271 false,
12272 false,
12273 false,
12274 false,
12275 false,
12276 0,
12277 ).to_ne_bytes()
12278 ),
12279});
12280}
12281unsafe extern "C" fn _finalize<D: DomTypes>
12282(_cx: *mut GCContext, obj: *mut JSObject){
12283 wrap_panic(&mut || {
12284
12285 let this = native_from_object_static::<D::GPUBindGroupLayout>(obj).unwrap();
12286 finalize_common(this);
12287 })
12288}
12289
12290unsafe extern "C" fn _trace<D: DomTypes>
12291(trc: *mut JSTracer, obj: *mut JSObject){
12292 wrap_panic(&mut || {
12293
12294 let this = native_from_object_static::<D::GPUBindGroupLayout>(obj).unwrap();
12295 if this.is_null() { return; } (*this).trace(trc);
12297 })
12298}
12299
12300
12301static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
12302
12303pub(crate) fn init_class_ops<D: DomTypes>() {
12304 CLASS_OPS.set(JSClassOps {
12305 addProperty: None,
12306 delProperty: None,
12307 enumerate: None,
12308 newEnumerate: None,
12309 resolve: None,
12310 mayResolve: None,
12311 finalize: Some(_finalize::<D>),
12312 call: None,
12313 construct: None,
12314 trace: Some(_trace::<D>),
12315 });
12316}
12317
12318pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
12319
12320pub(crate) fn init_domjs_class<D: DomTypes>() {
12321 init_class_ops::<D>();
12322 Class.set(DOMJSClass {
12323 base: JSClass {
12324 name: c"GPUBindGroupLayout".as_ptr(),
12325 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
12326 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
12327 ,
12328 cOps: unsafe { CLASS_OPS.get() },
12329 spec: ptr::null(),
12330 ext: ptr::null(),
12331 oOps: ptr::null(),
12332 },
12333 dom_class:
12334DOMClass {
12335 interface_chain: [ PrototypeList::ID::GPUBindGroupLayout, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
12336 depth: 0,
12337 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
12338 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUBindGroupLayout> as unsafe fn(&mut _, _) -> _,
12339 global: Globals::EMPTY,
12340},
12341 });
12342}
12343
12344#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
12345(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUBindGroupLayout>, _can_gc: CanGc) -> DomRoot<D::GPUBindGroupLayout>{
12346
12347 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
12348
12349 let scope = scope.reflector().get_jsobject();
12350 assert!(!scope.get().is_null());
12351 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
12352 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
12353
12354 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
12355 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
12356 assert!(!canonical_proto.is_null());
12357
12358
12359 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
12360 if let Some(given) = given_proto {
12361 proto.set(*given);
12362 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
12363 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
12364 }
12365 } else {
12366 proto.set(*canonical_proto);
12367 }
12368 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
12369 cx.raw_cx(),
12370 &Class.get().base,
12371 proto.handle(),
12372 ));
12373 assert!(!obj.is_null());
12374 JS_SetReservedSlot(
12375 obj.get(),
12376 DOM_OBJECT_SLOT,
12377 &PrivateValue(raw.as_ptr() as *const libc::c_void),
12378 );
12379
12380 let root = raw.reflect_with(obj.get());
12381
12382
12383
12384 DomRoot::from_ref(&*root)
12385}
12386
12387pub trait GPUBindGroupLayoutMethods<D: DomTypes> {
12388 fn Label(&self, ) -> USVString;
12389 fn SetLabel(&self, r#value: USVString);
12390}
12391static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
12392
12393pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
12394 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
12395 JSPropertySpec {
12396 name: JSPropertySpec_Name { string_: c"label".as_ptr() },
12397 attributes_: (JSPROP_ENUMERATE),
12398 kind_: (JSPropertySpec_Kind::NativeAccessor),
12399 u: JSPropertySpec_AccessorsOrValue {
12400 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
12401 getter: JSPropertySpec_Accessor {
12402 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { label_getterinfo.get() } },
12403 },
12404 setter: JSPropertySpec_Accessor {
12405 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { label_setterinfo.get() } },
12406 }
12407 }
12408 }
12409 }
12410,
12411 JSPropertySpec::ZERO]))[..]
12412,
12413&Box::leak(Box::new([
12414 JSPropertySpec {
12415 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
12416 attributes_: (JSPROP_READONLY),
12417 kind_: (JSPropertySpec_Kind::Value),
12418 u: JSPropertySpec_AccessorsOrValue {
12419 value: JSPropertySpec_ValueWrapper {
12420 type_: JSPropertySpec_ValueWrapper_Type::String,
12421 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
12422 string: c"GPUBindGroupLayout".as_ptr(),
12423 }
12424 }
12425 }
12426 }
12427,
12428 JSPropertySpec::ZERO]))[..]
12429])));
12430}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
12431
12432pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
12433 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
12434 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
12435}
12436pub fn GetProtoObject<D: DomTypes>
12437(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
12438 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUBindGroupLayout), CreateInterfaceObjects::<D>, rval)
12440}
12441
12442
12443static PrototypeClass: JSClass = JSClass {
12444 name: c"GPUBindGroupLayoutPrototype".as_ptr(),
12445 flags:
12446 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
12448 cOps: ptr::null(),
12449 spec: ptr::null(),
12450 ext: ptr::null(),
12451 oOps: ptr::null(),
12452};
12453
12454
12455static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
12456
12457pub(crate) fn init_interface_object<D: DomTypes>() {
12458 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
12459 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
12460 b"function GPUBindGroupLayout() {\n [native code]\n}",
12461 PrototypeList::ID::GPUBindGroupLayout,
12462 0,
12463 ));
12464}
12465
12466pub fn DefineDOMInterface<D: DomTypes>
12467(cx: SafeJSContext, global: HandleObject){
12468 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUBindGroupLayout),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
12469}
12470
12471pub fn ConstructorEnabled<D: DomTypes>
12472(aCx: SafeJSContext, aObj: HandleObject) -> bool{
12473 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
12474 pref!(dom_webgpu_enabled)
12475}
12476
12477unsafe fn CreateInterfaceObjects<D: DomTypes>
12478(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
12479
12480 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
12481 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
12482 assert!(!prototype_proto.is_null());
12483
12484 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
12485 create_interface_prototype_object::<D>(cx,
12486 global,
12487 prototype_proto.handle(),
12488 &PrototypeClass,
12489 &[],
12490 sAttributes.get(),
12491 &[],
12492 &[],
12493 prototype.handle_mut());
12494 assert!(!prototype.is_null());
12495 assert!((*cache)[PrototypeList::ID::GPUBindGroupLayout as usize].is_null());
12496 (*cache)[PrototypeList::ID::GPUBindGroupLayout as usize] = prototype.get();
12497 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUBindGroupLayout as isize),
12498 ptr::null_mut(),
12499 prototype.get());
12500
12501 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
12502 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
12503
12504 assert!(!interface_proto.is_null());
12505
12506 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
12507 create_noncallback_interface_object::<D>(cx,
12508 global,
12509 interface_proto.handle(),
12510 INTERFACE_OBJECT_CLASS.get(),
12511 &[],
12512 &[],
12513 &[],
12514 prototype.handle(),
12515 c"GPUBindGroupLayout",
12516 0,
12517 &[],
12518 interface.handle_mut());
12519 assert!(!interface.is_null());
12520}
12521
12522
12523 pub(crate) fn init_statics<D: DomTypes>() {
12524 init_interface_object::<D>();
12525 init_domjs_class::<D>();
12526
12527 init_label_getterinfo::<D>();
12528 init_label_setterinfo::<D>();
12529
12530 init_sAttributes_specs::<D>();
12531init_sAttributes_prefs::<D>();
12532 }
12533 } pub use self::GPUBuffer_Binding::{Wrap as GPUBufferWrap, GPUBufferMethods, GetProtoObject as GPUBufferGetProtoObject, DefineDOMInterface as GPUBufferDefineDOMInterface};
12537pub mod GPUBuffer_Binding {
12538use crate::codegen::GenericBindings::WebGPUBinding::GPUBufferMapState;
12539use crate::codegen::GenericBindings::WebGPUBinding::GPUBufferMapStateValues;
12540use crate::import::module::*;
12541
12542unsafe extern "C" fn get_size<D: DomTypes>
12543(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
12544 let mut result = false;
12545 wrap_panic(&mut || result = (|| {
12546 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
12547 let this = &*(this as *const D::GPUBuffer);
12548 let result: u64 = this.Size();
12549
12550 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
12551 return true;
12552 })());
12553 result
12554}
12555
12556
12557static size_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
12558
12559pub(crate) fn init_size_getterinfo<D: DomTypes>() {
12560 size_getterinfo.set(JSJitInfo {
12561 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
12562 getter: Some(get_size::<D>)
12563 },
12564 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
12565 protoID: PrototypeList::ID::GPUBuffer as u16,
12566 },
12567 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
12568 _bitfield_align_1: [],
12569 _bitfield_1: __BindgenBitfieldUnit::new(
12570 new_jsjitinfo_bitfield_1!(
12571 JSJitInfo_OpType::Getter as u8,
12572 JSJitInfo_AliasSet::AliasEverything as u8,
12573 JSValueType::JSVAL_TYPE_DOUBLE as u8,
12574 true,
12575 false,
12576 false,
12577 false,
12578 false,
12579 false,
12580 0,
12581 ).to_ne_bytes()
12582 ),
12583});
12584}
12585unsafe extern "C" fn get_usage<D: DomTypes>
12586(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
12587 let mut result = false;
12588 wrap_panic(&mut || result = (|| {
12589 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
12590 let this = &*(this as *const D::GPUBuffer);
12591 let result: u32 = this.Usage();
12592
12593 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
12594 return true;
12595 })());
12596 result
12597}
12598
12599
12600static usage_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
12601
12602pub(crate) fn init_usage_getterinfo<D: DomTypes>() {
12603 usage_getterinfo.set(JSJitInfo {
12604 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
12605 getter: Some(get_usage::<D>)
12606 },
12607 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
12608 protoID: PrototypeList::ID::GPUBuffer as u16,
12609 },
12610 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
12611 _bitfield_align_1: [],
12612 _bitfield_1: __BindgenBitfieldUnit::new(
12613 new_jsjitinfo_bitfield_1!(
12614 JSJitInfo_OpType::Getter as u8,
12615 JSJitInfo_AliasSet::AliasEverything as u8,
12616 JSValueType::JSVAL_TYPE_DOUBLE as u8,
12617 true,
12618 false,
12619 false,
12620 false,
12621 false,
12622 false,
12623 0,
12624 ).to_ne_bytes()
12625 ),
12626});
12627}
12628unsafe extern "C" fn get_mapState<D: DomTypes>
12629(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
12630 let mut result = false;
12631 wrap_panic(&mut || result = (|| {
12632 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
12633 let this = &*(this as *const D::GPUBuffer);
12634 let result: GPUBufferMapState = this.MapState();
12635
12636 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
12637 return true;
12638 })());
12639 result
12640}
12641
12642
12643static mapState_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
12644
12645pub(crate) fn init_mapState_getterinfo<D: DomTypes>() {
12646 mapState_getterinfo.set(JSJitInfo {
12647 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
12648 getter: Some(get_mapState::<D>)
12649 },
12650 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
12651 protoID: PrototypeList::ID::GPUBuffer as u16,
12652 },
12653 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
12654 _bitfield_align_1: [],
12655 _bitfield_1: __BindgenBitfieldUnit::new(
12656 new_jsjitinfo_bitfield_1!(
12657 JSJitInfo_OpType::Getter as u8,
12658 JSJitInfo_AliasSet::AliasEverything as u8,
12659 JSValueType::JSVAL_TYPE_STRING as u8,
12660 true,
12661 false,
12662 false,
12663 false,
12664 false,
12665 false,
12666 0,
12667 ).to_ne_bytes()
12668 ),
12669});
12670}
12671unsafe extern "C" fn mapAsync<D: DomTypes>
12672(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
12673 let mut result = false;
12674 wrap_panic(&mut || result = (|| {
12675 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
12676 let this = &*(this as *const D::GPUBuffer);
12677 let args = &*args;
12678 let argc = args.argc_;
12679
12680 if argc < 1 {
12681 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUBuffer.mapAsync\".");
12682 return false;
12683 }
12684 let arg0: u32 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
12685 Ok(ConversionResult::Success(value)) => value,
12686 Ok(ConversionResult::Failure(error)) => {
12687 throw_type_error(cx.raw_cx(), &error);
12688 return false;
12689
12690 }
12691 _ => {
12692 return false;
12693
12694 },
12695 }
12696 ;
12697 let arg1: u64 = if args.get(1).is_undefined() {
12698 0
12699 } else {
12700 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
12701 Ok(ConversionResult::Success(value)) => value,
12702 Ok(ConversionResult::Failure(error)) => {
12703 throw_type_error(cx.raw_cx(), &error);
12704 return false;
12705
12706 }
12707 _ => {
12708 return false;
12709
12710 },
12711 }
12712
12713 };
12714 let arg2: Option<u64> = if args.get(2).is_undefined() {
12715 None
12716 } else {
12717 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
12718 Ok(ConversionResult::Success(value)) => value,
12719 Ok(ConversionResult::Failure(error)) => {
12720 throw_type_error(cx.raw_cx(), &error);
12721 return false;
12722
12723 }
12724 _ => {
12725 return false;
12726
12727 },
12728 }
12729 )
12730 };
12731 let result: Rc<D::Promise> = this.MapAsync(arg0, arg1, arg2, InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx()))), CanGc::note());
12732
12733 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
12734 return true;
12735 })());
12736 result
12737}
12738
12739unsafe extern "C" fn mapAsync_promise_wrapper<D: DomTypes>
12740(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
12741 let mut result = false;
12742 wrap_panic(&mut || result = (|| {
12743 let ok = mapAsync::<D>(cx, _obj, this, args);
12744 if ok {
12745 return true;
12746 }
12747 return exception_to_promise(cx, (*args).rval(), CanGc::note());
12748
12749 })());
12750 result
12751}
12752
12753
12754static mapAsync_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
12755
12756pub(crate) fn init_mapAsync_methodinfo<D: DomTypes>() {
12757 mapAsync_methodinfo.set(JSJitInfo {
12758 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
12759 method: Some(mapAsync_promise_wrapper::<D>)
12760 },
12761 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
12762 protoID: PrototypeList::ID::GPUBuffer as u16,
12763 },
12764 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
12765 _bitfield_align_1: [],
12766 _bitfield_1: __BindgenBitfieldUnit::new(
12767 new_jsjitinfo_bitfield_1!(
12768 JSJitInfo_OpType::Method as u8,
12769 JSJitInfo_AliasSet::AliasEverything as u8,
12770 JSValueType::JSVAL_TYPE_OBJECT as u8,
12771 false,
12772 false,
12773 false,
12774 false,
12775 false,
12776 false,
12777 0,
12778 ).to_ne_bytes()
12779 ),
12780});
12781}
12782unsafe extern "C" fn getMappedRange<D: DomTypes>
12783(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
12784 let mut result = false;
12785 wrap_panic(&mut || result = (|| {
12786 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
12787 let this = &*(this as *const D::GPUBuffer);
12788 let args = &*args;
12789 let argc = args.argc_;
12790 let arg0: u64 = if args.get(0).is_undefined() {
12791 0
12792 } else {
12793 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
12794 Ok(ConversionResult::Success(value)) => value,
12795 Ok(ConversionResult::Failure(error)) => {
12796 throw_type_error(cx.raw_cx(), &error);
12797 return false;
12798
12799 }
12800 _ => {
12801 return false;
12802
12803 },
12804 }
12805
12806 };
12807 let arg1: Option<u64> = if args.get(1).is_undefined() {
12808 None
12809 } else {
12810 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
12811 Ok(ConversionResult::Success(value)) => value,
12812 Ok(ConversionResult::Failure(error)) => {
12813 throw_type_error(cx.raw_cx(), &error);
12814 return false;
12815
12816 }
12817 _ => {
12818 return false;
12819
12820 },
12821 }
12822 )
12823 };
12824 let result: Result<ArrayBuffer, Error> = this.GetMappedRange(SafeJSContext::from_ptr(cx.raw_cx()), arg0, arg1, CanGc::note());
12825 let result = match result {
12826 Ok(result) => result,
12827 Err(e) => {
12828 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
12829 return false;
12830 },
12831 };
12832
12833 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
12834 return true;
12835 })());
12836 result
12837}
12838
12839
12840static getMappedRange_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
12841
12842pub(crate) fn init_getMappedRange_methodinfo<D: DomTypes>() {
12843 getMappedRange_methodinfo.set(JSJitInfo {
12844 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
12845 method: Some(getMappedRange::<D>)
12846 },
12847 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
12848 protoID: PrototypeList::ID::GPUBuffer as u16,
12849 },
12850 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
12851 _bitfield_align_1: [],
12852 _bitfield_1: __BindgenBitfieldUnit::new(
12853 new_jsjitinfo_bitfield_1!(
12854 JSJitInfo_OpType::Method as u8,
12855 JSJitInfo_AliasSet::AliasEverything as u8,
12856 JSValueType::JSVAL_TYPE_OBJECT as u8,
12857 false,
12858 false,
12859 false,
12860 false,
12861 false,
12862 false,
12863 0,
12864 ).to_ne_bytes()
12865 ),
12866});
12867}
12868unsafe extern "C" fn unmap<D: DomTypes>
12869(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
12870 let mut result = false;
12871 wrap_panic(&mut || result = (|| {
12872 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
12873 let this = &*(this as *const D::GPUBuffer);
12874 let args = &*args;
12875 let argc = args.argc_;
12876 let result: () = this.Unmap();
12877
12878 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
12879 return true;
12880 })());
12881 result
12882}
12883
12884
12885static unmap_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
12886
12887pub(crate) fn init_unmap_methodinfo<D: DomTypes>() {
12888 unmap_methodinfo.set(JSJitInfo {
12889 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
12890 method: Some(unmap::<D>)
12891 },
12892 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
12893 protoID: PrototypeList::ID::GPUBuffer as u16,
12894 },
12895 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
12896 _bitfield_align_1: [],
12897 _bitfield_1: __BindgenBitfieldUnit::new(
12898 new_jsjitinfo_bitfield_1!(
12899 JSJitInfo_OpType::Method as u8,
12900 JSJitInfo_AliasSet::AliasEverything as u8,
12901 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
12902 true,
12903 false,
12904 false,
12905 false,
12906 false,
12907 false,
12908 0,
12909 ).to_ne_bytes()
12910 ),
12911});
12912}
12913unsafe extern "C" fn destroy<D: DomTypes>
12914(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
12915 let mut result = false;
12916 wrap_panic(&mut || result = (|| {
12917 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
12918 let this = &*(this as *const D::GPUBuffer);
12919 let args = &*args;
12920 let argc = args.argc_;
12921 let result: () = this.Destroy();
12922
12923 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
12924 return true;
12925 })());
12926 result
12927}
12928
12929
12930static destroy_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
12931
12932pub(crate) fn init_destroy_methodinfo<D: DomTypes>() {
12933 destroy_methodinfo.set(JSJitInfo {
12934 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
12935 method: Some(destroy::<D>)
12936 },
12937 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
12938 protoID: PrototypeList::ID::GPUBuffer as u16,
12939 },
12940 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
12941 _bitfield_align_1: [],
12942 _bitfield_1: __BindgenBitfieldUnit::new(
12943 new_jsjitinfo_bitfield_1!(
12944 JSJitInfo_OpType::Method as u8,
12945 JSJitInfo_AliasSet::AliasEverything as u8,
12946 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
12947 true,
12948 false,
12949 false,
12950 false,
12951 false,
12952 false,
12953 0,
12954 ).to_ne_bytes()
12955 ),
12956});
12957}
12958unsafe extern "C" fn get_label<D: DomTypes>
12959(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
12960 let mut result = false;
12961 wrap_panic(&mut || result = (|| {
12962 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
12963 let this = &*(this as *const D::GPUBuffer);
12964 let result: USVString = this.Label();
12965
12966 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
12967 return true;
12968 })());
12969 result
12970}
12971
12972unsafe extern "C" fn set_label<D: DomTypes>
12973(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
12974 let mut result = false;
12975 wrap_panic(&mut || result = (|| {
12976 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
12977 let this = &*(this as *const D::GPUBuffer);
12978 let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
12979 Ok(ConversionResult::Success(value)) => value,
12980 Ok(ConversionResult::Failure(error)) => {
12981 throw_type_error(cx.raw_cx(), &error);
12982 return false;
12983
12984 }
12985 _ => {
12986 return false;
12987
12988 },
12989 }
12990 ;
12991 let result: () = this.SetLabel(arg0);
12992
12993 true
12994 })());
12995 result
12996}
12997
12998
12999static label_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
13000
13001pub(crate) fn init_label_getterinfo<D: DomTypes>() {
13002 label_getterinfo.set(JSJitInfo {
13003 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
13004 getter: Some(get_label::<D>)
13005 },
13006 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
13007 protoID: PrototypeList::ID::GPUBuffer as u16,
13008 },
13009 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
13010 _bitfield_align_1: [],
13011 _bitfield_1: __BindgenBitfieldUnit::new(
13012 new_jsjitinfo_bitfield_1!(
13013 JSJitInfo_OpType::Getter as u8,
13014 JSJitInfo_AliasSet::AliasEverything as u8,
13015 JSValueType::JSVAL_TYPE_STRING as u8,
13016 true,
13017 false,
13018 false,
13019 false,
13020 false,
13021 false,
13022 0,
13023 ).to_ne_bytes()
13024 ),
13025});
13026}
13027static label_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
13028
13029pub(crate) fn init_label_setterinfo<D: DomTypes>() {
13030 label_setterinfo.set(JSJitInfo {
13031 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
13032 setter: Some(set_label::<D>)
13033 },
13034 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
13035 protoID: PrototypeList::ID::GPUBuffer as u16,
13036 },
13037 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
13038 _bitfield_align_1: [],
13039 _bitfield_1: __BindgenBitfieldUnit::new(
13040 new_jsjitinfo_bitfield_1!(
13041 JSJitInfo_OpType::Setter as u8,
13042 JSJitInfo_AliasSet::AliasEverything as u8,
13043 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
13044 false,
13045 false,
13046 false,
13047 false,
13048 false,
13049 false,
13050 0,
13051 ).to_ne_bytes()
13052 ),
13053});
13054}
13055unsafe extern "C" fn _finalize<D: DomTypes>
13056(_cx: *mut GCContext, obj: *mut JSObject){
13057 wrap_panic(&mut || {
13058
13059 let this = native_from_object_static::<D::GPUBuffer>(obj).unwrap();
13060 finalize_common(this);
13061 })
13062}
13063
13064unsafe extern "C" fn _trace<D: DomTypes>
13065(trc: *mut JSTracer, obj: *mut JSObject){
13066 wrap_panic(&mut || {
13067
13068 let this = native_from_object_static::<D::GPUBuffer>(obj).unwrap();
13069 if this.is_null() { return; } (*this).trace(trc);
13071 })
13072}
13073
13074
13075static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
13076
13077pub(crate) fn init_class_ops<D: DomTypes>() {
13078 CLASS_OPS.set(JSClassOps {
13079 addProperty: None,
13080 delProperty: None,
13081 enumerate: None,
13082 newEnumerate: None,
13083 resolve: None,
13084 mayResolve: None,
13085 finalize: Some(_finalize::<D>),
13086 call: None,
13087 construct: None,
13088 trace: Some(_trace::<D>),
13089 });
13090}
13091
13092pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
13093
13094pub(crate) fn init_domjs_class<D: DomTypes>() {
13095 init_class_ops::<D>();
13096 Class.set(DOMJSClass {
13097 base: JSClass {
13098 name: c"GPUBuffer".as_ptr(),
13099 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
13100 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
13101 ,
13102 cOps: unsafe { CLASS_OPS.get() },
13103 spec: ptr::null(),
13104 ext: ptr::null(),
13105 oOps: ptr::null(),
13106 },
13107 dom_class:
13108DOMClass {
13109 interface_chain: [ PrototypeList::ID::GPUBuffer, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
13110 depth: 0,
13111 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
13112 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUBuffer> as unsafe fn(&mut _, _) -> _,
13113 global: Globals::EMPTY,
13114},
13115 });
13116}
13117
13118#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
13119(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUBuffer>, _can_gc: CanGc) -> DomRoot<D::GPUBuffer>{
13120
13121 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
13122
13123 let scope = scope.reflector().get_jsobject();
13124 assert!(!scope.get().is_null());
13125 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
13126 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
13127
13128 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
13129 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
13130 assert!(!canonical_proto.is_null());
13131
13132
13133 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
13134 if let Some(given) = given_proto {
13135 proto.set(*given);
13136 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
13137 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
13138 }
13139 } else {
13140 proto.set(*canonical_proto);
13141 }
13142 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
13143 cx.raw_cx(),
13144 &Class.get().base,
13145 proto.handle(),
13146 ));
13147 assert!(!obj.is_null());
13148 JS_SetReservedSlot(
13149 obj.get(),
13150 DOM_OBJECT_SLOT,
13151 &PrivateValue(raw.as_ptr() as *const libc::c_void),
13152 );
13153
13154 let root = raw.reflect_with(obj.get());
13155
13156
13157
13158 DomRoot::from_ref(&*root)
13159}
13160
13161pub trait GPUBufferMethods<D: DomTypes> {
13162 fn Size(&self, ) -> u64;
13163 fn Usage(&self, ) -> u32;
13164 fn MapState(&self, ) -> GPUBufferMapState;
13165 fn MapAsync(&self, r#mode: u32, r#offset: u64, r#size: Option<u64>, r#_comp: InRealm, r#_can_gc: CanGc) -> Rc<D::Promise>;
13166 fn GetMappedRange(&self, r#cx: SafeJSContext, r#offset: u64, r#size: Option<u64>, r#_can_gc: CanGc) -> Fallible<ArrayBuffer>;
13167 fn Unmap(&self, );
13168 fn Destroy(&self, );
13169 fn Label(&self, ) -> USVString;
13170 fn SetLabel(&self, r#value: USVString);
13171}
13172static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
13173
13174pub(crate) fn init_sMethods_specs<D: DomTypes>() {
13175 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
13176 JSFunctionSpec {
13177 name: JSPropertySpec_Name { string_: c"mapAsync".as_ptr() },
13178 call: JSNativeWrapper { op: Some(generic_method::<true>), info: unsafe { mapAsync_methodinfo.get() } as *const _ as *const JSJitInfo },
13179 nargs: 1,
13180 flags: (JSPROP_ENUMERATE) as u16,
13181 selfHostedName: ptr::null()
13182 },
13183 JSFunctionSpec {
13184 name: JSPropertySpec_Name { string_: c"getMappedRange".as_ptr() },
13185 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { getMappedRange_methodinfo.get() } as *const _ as *const JSJitInfo },
13186 nargs: 0,
13187 flags: (JSPROP_ENUMERATE) as u16,
13188 selfHostedName: ptr::null()
13189 },
13190 JSFunctionSpec {
13191 name: JSPropertySpec_Name { string_: c"unmap".as_ptr() },
13192 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { unmap_methodinfo.get() } as *const _ as *const JSJitInfo },
13193 nargs: 0,
13194 flags: (JSPROP_ENUMERATE) as u16,
13195 selfHostedName: ptr::null()
13196 },
13197 JSFunctionSpec {
13198 name: JSPropertySpec_Name { string_: c"destroy".as_ptr() },
13199 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { destroy_methodinfo.get() } as *const _ as *const JSJitInfo },
13200 nargs: 0,
13201 flags: (JSPROP_ENUMERATE) as u16,
13202 selfHostedName: ptr::null()
13203 },
13204 JSFunctionSpec {
13205 name: JSPropertySpec_Name { string_: ptr::null() },
13206 call: JSNativeWrapper { op: None, info: ptr::null() },
13207 nargs: 0,
13208 flags: 0,
13209 selfHostedName: ptr::null()
13210 }]))[..]
13211])));
13212}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
13213
13214pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
13215 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sMethods_specs.get() })[0])])));
13216}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
13217
13218pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
13219 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
13220 JSPropertySpec {
13221 name: JSPropertySpec_Name { string_: c"size".as_ptr() },
13222 attributes_: (JSPROP_ENUMERATE),
13223 kind_: (JSPropertySpec_Kind::NativeAccessor),
13224 u: JSPropertySpec_AccessorsOrValue {
13225 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
13226 getter: JSPropertySpec_Accessor {
13227 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { size_getterinfo.get() } },
13228 },
13229 setter: JSPropertySpec_Accessor {
13230 native: JSNativeWrapper { op: None, info: ptr::null() },
13231 }
13232 }
13233 }
13234 }
13235,
13236 JSPropertySpec {
13237 name: JSPropertySpec_Name { string_: c"usage".as_ptr() },
13238 attributes_: (JSPROP_ENUMERATE),
13239 kind_: (JSPropertySpec_Kind::NativeAccessor),
13240 u: JSPropertySpec_AccessorsOrValue {
13241 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
13242 getter: JSPropertySpec_Accessor {
13243 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { usage_getterinfo.get() } },
13244 },
13245 setter: JSPropertySpec_Accessor {
13246 native: JSNativeWrapper { op: None, info: ptr::null() },
13247 }
13248 }
13249 }
13250 }
13251,
13252 JSPropertySpec {
13253 name: JSPropertySpec_Name { string_: c"mapState".as_ptr() },
13254 attributes_: (JSPROP_ENUMERATE),
13255 kind_: (JSPropertySpec_Kind::NativeAccessor),
13256 u: JSPropertySpec_AccessorsOrValue {
13257 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
13258 getter: JSPropertySpec_Accessor {
13259 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { mapState_getterinfo.get() } },
13260 },
13261 setter: JSPropertySpec_Accessor {
13262 native: JSNativeWrapper { op: None, info: ptr::null() },
13263 }
13264 }
13265 }
13266 }
13267,
13268 JSPropertySpec {
13269 name: JSPropertySpec_Name { string_: c"label".as_ptr() },
13270 attributes_: (JSPROP_ENUMERATE),
13271 kind_: (JSPropertySpec_Kind::NativeAccessor),
13272 u: JSPropertySpec_AccessorsOrValue {
13273 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
13274 getter: JSPropertySpec_Accessor {
13275 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { label_getterinfo.get() } },
13276 },
13277 setter: JSPropertySpec_Accessor {
13278 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { label_setterinfo.get() } },
13279 }
13280 }
13281 }
13282 }
13283,
13284 JSPropertySpec::ZERO]))[..]
13285,
13286&Box::leak(Box::new([
13287 JSPropertySpec {
13288 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
13289 attributes_: (JSPROP_READONLY),
13290 kind_: (JSPropertySpec_Kind::Value),
13291 u: JSPropertySpec_AccessorsOrValue {
13292 value: JSPropertySpec_ValueWrapper {
13293 type_: JSPropertySpec_ValueWrapper_Type::String,
13294 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
13295 string: c"GPUBuffer".as_ptr(),
13296 }
13297 }
13298 }
13299 }
13300,
13301 JSPropertySpec::ZERO]))[..]
13302])));
13303}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
13304
13305pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
13306 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
13307 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
13308}
13309pub fn GetProtoObject<D: DomTypes>
13310(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
13311 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUBuffer), CreateInterfaceObjects::<D>, rval)
13313}
13314
13315
13316static PrototypeClass: JSClass = JSClass {
13317 name: c"GPUBufferPrototype".as_ptr(),
13318 flags:
13319 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
13321 cOps: ptr::null(),
13322 spec: ptr::null(),
13323 ext: ptr::null(),
13324 oOps: ptr::null(),
13325};
13326
13327
13328static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
13329
13330pub(crate) fn init_interface_object<D: DomTypes>() {
13331 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
13332 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
13333 b"function GPUBuffer() {\n [native code]\n}",
13334 PrototypeList::ID::GPUBuffer,
13335 0,
13336 ));
13337}
13338
13339pub fn DefineDOMInterface<D: DomTypes>
13340(cx: SafeJSContext, global: HandleObject){
13341 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUBuffer),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
13342}
13343
13344pub fn ConstructorEnabled<D: DomTypes>
13345(aCx: SafeJSContext, aObj: HandleObject) -> bool{
13346 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
13347 pref!(dom_webgpu_enabled)
13348}
13349
13350unsafe fn CreateInterfaceObjects<D: DomTypes>
13351(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
13352
13353 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
13354 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
13355 assert!(!prototype_proto.is_null());
13356
13357 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
13358 create_interface_prototype_object::<D>(cx,
13359 global,
13360 prototype_proto.handle(),
13361 &PrototypeClass,
13362 sMethods.get(),
13363 sAttributes.get(),
13364 &[],
13365 &[],
13366 prototype.handle_mut());
13367 assert!(!prototype.is_null());
13368 assert!((*cache)[PrototypeList::ID::GPUBuffer as usize].is_null());
13369 (*cache)[PrototypeList::ID::GPUBuffer as usize] = prototype.get();
13370 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUBuffer as isize),
13371 ptr::null_mut(),
13372 prototype.get());
13373
13374 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
13375 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
13376
13377 assert!(!interface_proto.is_null());
13378
13379 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
13380 create_noncallback_interface_object::<D>(cx,
13381 global,
13382 interface_proto.handle(),
13383 INTERFACE_OBJECT_CLASS.get(),
13384 &[],
13385 &[],
13386 &[],
13387 prototype.handle(),
13388 c"GPUBuffer",
13389 0,
13390 &[],
13391 interface.handle_mut());
13392 assert!(!interface.is_null());
13393}
13394
13395
13396 pub(crate) fn init_statics<D: DomTypes>() {
13397 init_interface_object::<D>();
13398 init_domjs_class::<D>();
13399 crate::codegen::GenericBindings::WebGPUBinding::GPUBuffer_Binding::init_mapAsync_methodinfo::<D>();
13400crate::codegen::GenericBindings::WebGPUBinding::GPUBuffer_Binding::init_getMappedRange_methodinfo::<D>();
13401crate::codegen::GenericBindings::WebGPUBinding::GPUBuffer_Binding::init_unmap_methodinfo::<D>();
13402crate::codegen::GenericBindings::WebGPUBinding::GPUBuffer_Binding::init_destroy_methodinfo::<D>();
13403 init_size_getterinfo::<D>();
13404init_usage_getterinfo::<D>();
13405init_mapState_getterinfo::<D>();
13406init_label_getterinfo::<D>();
13407 init_label_setterinfo::<D>();
13408
13409 init_sMethods_specs::<D>();
13410init_sMethods_prefs::<D>();
13411init_sAttributes_specs::<D>();
13412init_sAttributes_prefs::<D>();
13413 }
13414 } pub use self::GPUBufferUsage_Binding::{GPUBufferUsageConstants, GetConstructorObject as GPUBufferUsageGetConstructorObject, DefineDOMInterface as GPUBufferUsageDefineDOMInterface};
13418pub mod GPUBufferUsage_Binding {
13419use crate::import::module::*;
13420
13421pub mod GPUBufferUsageConstants {
13422 pub const MAP_READ: u32 = 1;
13423 pub const MAP_WRITE: u32 = 2;
13424 pub const COPY_SRC: u32 = 4;
13425 pub const COPY_DST: u32 = 8;
13426 pub const INDEX: u32 = 16;
13427 pub const VERTEX: u32 = 32;
13428 pub const UNIFORM: u32 = 64;
13429 pub const STORAGE: u32 = 128;
13430 pub const INDIRECT: u32 = 256;
13431 pub const QUERY_RESOLVE: u32 = 512;
13432} pub trait GPUBufferUsageMethods<D: DomTypes> {
13434}
13435static sConstants_specs: ThreadUnsafeOnceLock<&[&[ConstantSpec]]> = ThreadUnsafeOnceLock::new();
13436
13437pub(crate) fn init_sConstants_specs<D: DomTypes>() {
13438 sConstants_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
13439 ConstantSpec { name: c"MAP_READ", value: ConstantVal::Uint(1) },
13440 ConstantSpec { name: c"MAP_WRITE", value: ConstantVal::Uint(2) },
13441 ConstantSpec { name: c"COPY_SRC", value: ConstantVal::Uint(4) },
13442 ConstantSpec { name: c"COPY_DST", value: ConstantVal::Uint(8) },
13443 ConstantSpec { name: c"INDEX", value: ConstantVal::Uint(16) },
13444 ConstantSpec { name: c"VERTEX", value: ConstantVal::Uint(32) },
13445 ConstantSpec { name: c"UNIFORM", value: ConstantVal::Uint(64) },
13446 ConstantSpec { name: c"STORAGE", value: ConstantVal::Uint(128) },
13447 ConstantSpec { name: c"INDIRECT", value: ConstantVal::Uint(256) },
13448 ConstantSpec { name: c"QUERY_RESOLVE", value: ConstantVal::Uint(512) }]))[..]
13449])));
13450}static sConstants: ThreadUnsafeOnceLock<&[Guard<&[ConstantSpec]>]> = ThreadUnsafeOnceLock::new();
13451
13452pub(crate) fn init_sConstants_prefs<D: DomTypes>() {
13453 sConstants.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sConstants_specs.get() })[0])])));
13454}
13455
13456static NAMESPACE_OBJECT_CLASS: NamespaceObjectClass = unsafe {
13457 NamespaceObjectClass::new(c"Object")
13458};
13459
13460pub fn GetConstructorObject<D: DomTypes>
13461(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
13462 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::Constructor(PrototypeList::Constructor::GPUBufferUsage), CreateInterfaceObjects::<D>, rval)
13464}
13465
13466pub fn DefineDOMInterface<D: DomTypes>
13467(cx: SafeJSContext, global: HandleObject){
13468 define_dom_interface(cx, global, ProtoOrIfaceIndex::Constructor(PrototypeList::Constructor::GPUBufferUsage),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
13469}
13470
13471pub fn ConstructorEnabled<D: DomTypes>
13472(aCx: SafeJSContext, aObj: HandleObject) -> bool{
13473 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
13474 pref!(dom_webgpu_enabled)
13475}
13476
13477unsafe fn CreateInterfaceObjects<D: DomTypes>
13478(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
13479
13480 rooted!(&in(cx) let proto = JS_NewPlainObject(cx.raw_cx()));
13481 assert!(!proto.is_null());
13482 rooted!(&in(cx) let mut namespace = ptr::null_mut::<JSObject>());
13483 create_namespace_object::<D>(cx, global, proto.handle(), &NAMESPACE_OBJECT_CLASS,
13484 &[], sConstants.get(), c"GPUBufferUsage", namespace.handle_mut());
13485 assert!(!namespace.is_null());
13486 assert!((*cache)[PrototypeList::Constructor::GPUBufferUsage as usize].is_null());
13487 (*cache)[PrototypeList::Constructor::GPUBufferUsage as usize] = namespace.get();
13488 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::Constructor::GPUBufferUsage as isize),
13489 ptr::null_mut(),
13490 namespace.get());
13491
13492}
13493
13494
13495 pub(crate) fn init_statics<D: DomTypes>() {
13496
13497
13498
13499
13500
13501
13502 init_sConstants_specs::<D>();
13503init_sConstants_prefs::<D>();
13504 }
13505 } pub use self::GPUColorWrite_Binding::{GPUColorWriteConstants, Wrap as GPUColorWriteWrap, GetProtoObject as GPUColorWriteGetProtoObject, DefineDOMInterface as GPUColorWriteDefineDOMInterface};
13509pub mod GPUColorWrite_Binding {
13510use crate::import::module::*;
13511
13512unsafe extern "C" fn _finalize<D: DomTypes>
13513(_cx: *mut GCContext, obj: *mut JSObject){
13514 wrap_panic(&mut || {
13515
13516 let this = native_from_object_static::<D::GPUColorWrite>(obj).unwrap();
13517 finalize_common(this);
13518 })
13519}
13520
13521unsafe extern "C" fn _trace<D: DomTypes>
13522(trc: *mut JSTracer, obj: *mut JSObject){
13523 wrap_panic(&mut || {
13524
13525 let this = native_from_object_static::<D::GPUColorWrite>(obj).unwrap();
13526 if this.is_null() { return; } (*this).trace(trc);
13528 })
13529}
13530
13531pub mod GPUColorWriteConstants {
13532 pub const RED: u32 = 1;
13533 pub const GREEN: u32 = 2;
13534 pub const BLUE: u32 = 4;
13535 pub const ALPHA: u32 = 8;
13536 pub const ALL: u32 = 15;
13537} static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
13540
13541pub(crate) fn init_class_ops<D: DomTypes>() {
13542 CLASS_OPS.set(JSClassOps {
13543 addProperty: None,
13544 delProperty: None,
13545 enumerate: None,
13546 newEnumerate: None,
13547 resolve: None,
13548 mayResolve: None,
13549 finalize: Some(_finalize::<D>),
13550 call: None,
13551 construct: None,
13552 trace: Some(_trace::<D>),
13553 });
13554}
13555
13556pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
13557
13558pub(crate) fn init_domjs_class<D: DomTypes>() {
13559 init_class_ops::<D>();
13560 Class.set(DOMJSClass {
13561 base: JSClass {
13562 name: c"GPUColorWrite".as_ptr(),
13563 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
13564 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
13565 ,
13566 cOps: unsafe { CLASS_OPS.get() },
13567 spec: ptr::null(),
13568 ext: ptr::null(),
13569 oOps: ptr::null(),
13570 },
13571 dom_class:
13572DOMClass {
13573 interface_chain: [ PrototypeList::ID::GPUColorWrite, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
13574 depth: 0,
13575 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
13576 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUColorWrite> as unsafe fn(&mut _, _) -> _,
13577 global: Globals::EMPTY,
13578},
13579 });
13580}
13581
13582#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
13583(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUColorWrite>, _can_gc: CanGc) -> DomRoot<D::GPUColorWrite>{
13584
13585 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
13586
13587 let scope = scope.reflector().get_jsobject();
13588 assert!(!scope.get().is_null());
13589 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
13590 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
13591
13592 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
13593 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
13594 assert!(!canonical_proto.is_null());
13595
13596
13597 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
13598 if let Some(given) = given_proto {
13599 proto.set(*given);
13600 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
13601 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
13602 }
13603 } else {
13604 proto.set(*canonical_proto);
13605 }
13606 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
13607 cx.raw_cx(),
13608 &Class.get().base,
13609 proto.handle(),
13610 ));
13611 assert!(!obj.is_null());
13612 JS_SetReservedSlot(
13613 obj.get(),
13614 DOM_OBJECT_SLOT,
13615 &PrivateValue(raw.as_ptr() as *const libc::c_void),
13616 );
13617
13618 let root = raw.reflect_with(obj.get());
13619
13620
13621
13622 DomRoot::from_ref(&*root)
13623}
13624
13625pub trait GPUColorWriteMethods<D: DomTypes> {
13626}
13627static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
13628
13629pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
13630 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
13631 JSPropertySpec {
13632 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
13633 attributes_: (JSPROP_READONLY),
13634 kind_: (JSPropertySpec_Kind::Value),
13635 u: JSPropertySpec_AccessorsOrValue {
13636 value: JSPropertySpec_ValueWrapper {
13637 type_: JSPropertySpec_ValueWrapper_Type::String,
13638 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
13639 string: c"GPUColorWrite".as_ptr(),
13640 }
13641 }
13642 }
13643 }
13644,
13645 JSPropertySpec::ZERO]))[..]
13646])));
13647}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
13648
13649pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
13650 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[0])])));
13651}static sConstants_specs: ThreadUnsafeOnceLock<&[&[ConstantSpec]]> = ThreadUnsafeOnceLock::new();
13652
13653pub(crate) fn init_sConstants_specs<D: DomTypes>() {
13654 sConstants_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
13655 ConstantSpec { name: c"RED", value: ConstantVal::Uint(1) },
13656 ConstantSpec { name: c"GREEN", value: ConstantVal::Uint(2) },
13657 ConstantSpec { name: c"BLUE", value: ConstantVal::Uint(4) },
13658 ConstantSpec { name: c"ALPHA", value: ConstantVal::Uint(8) },
13659 ConstantSpec { name: c"ALL", value: ConstantVal::Uint(15) }]))[..]
13660])));
13661}static sConstants: ThreadUnsafeOnceLock<&[Guard<&[ConstantSpec]>]> = ThreadUnsafeOnceLock::new();
13662
13663pub(crate) fn init_sConstants_prefs<D: DomTypes>() {
13664 sConstants.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sConstants_specs.get() })[0])])));
13665}
13666pub fn GetProtoObject<D: DomTypes>
13667(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
13668 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUColorWrite), CreateInterfaceObjects::<D>, rval)
13670}
13671
13672
13673static PrototypeClass: JSClass = JSClass {
13674 name: c"GPUColorWritePrototype".as_ptr(),
13675 flags:
13676 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
13678 cOps: ptr::null(),
13679 spec: ptr::null(),
13680 ext: ptr::null(),
13681 oOps: ptr::null(),
13682};
13683
13684
13685static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
13686
13687pub(crate) fn init_interface_object<D: DomTypes>() {
13688 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
13689 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
13690 b"function GPUColorWrite() {\n [native code]\n}",
13691 PrototypeList::ID::GPUColorWrite,
13692 0,
13693 ));
13694}
13695
13696pub fn DefineDOMInterface<D: DomTypes>
13697(cx: SafeJSContext, global: HandleObject){
13698 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUColorWrite),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
13699}
13700
13701pub fn ConstructorEnabled<D: DomTypes>
13702(aCx: SafeJSContext, aObj: HandleObject) -> bool{
13703 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
13704 pref!(dom_webgpu_enabled)
13705}
13706
13707unsafe fn CreateInterfaceObjects<D: DomTypes>
13708(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
13709
13710 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
13711 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
13712 assert!(!prototype_proto.is_null());
13713
13714 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
13715 create_interface_prototype_object::<D>(cx,
13716 global,
13717 prototype_proto.handle(),
13718 &PrototypeClass,
13719 &[],
13720 sAttributes.get(),
13721 sConstants.get(),
13722 &[],
13723 prototype.handle_mut());
13724 assert!(!prototype.is_null());
13725 assert!((*cache)[PrototypeList::ID::GPUColorWrite as usize].is_null());
13726 (*cache)[PrototypeList::ID::GPUColorWrite as usize] = prototype.get();
13727 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUColorWrite as isize),
13728 ptr::null_mut(),
13729 prototype.get());
13730
13731 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
13732 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
13733
13734 assert!(!interface_proto.is_null());
13735
13736 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
13737 create_noncallback_interface_object::<D>(cx,
13738 global,
13739 interface_proto.handle(),
13740 INTERFACE_OBJECT_CLASS.get(),
13741 &[],
13742 &[],
13743 sConstants.get(),
13744 prototype.handle(),
13745 c"GPUColorWrite",
13746 0,
13747 &[],
13748 interface.handle_mut());
13749 assert!(!interface.is_null());
13750}
13751
13752
13753 pub(crate) fn init_statics<D: DomTypes>() {
13754 init_interface_object::<D>();
13755 init_domjs_class::<D>();
13756
13757
13758
13759
13760 init_sAttributes_specs::<D>();
13761init_sAttributes_prefs::<D>();
13762init_sConstants_specs::<D>();
13763init_sConstants_prefs::<D>();
13764 }
13765 } pub use self::GPUCommandBuffer_Binding::{Wrap as GPUCommandBufferWrap, GPUCommandBufferMethods, GetProtoObject as GPUCommandBufferGetProtoObject, DefineDOMInterface as GPUCommandBufferDefineDOMInterface};
13769pub mod GPUCommandBuffer_Binding {
13770use crate::import::module::*;
13771
13772unsafe extern "C" fn get_label<D: DomTypes>
13773(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
13774 let mut result = false;
13775 wrap_panic(&mut || result = (|| {
13776 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
13777 let this = &*(this as *const D::GPUCommandBuffer);
13778 let result: USVString = this.Label();
13779
13780 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
13781 return true;
13782 })());
13783 result
13784}
13785
13786unsafe extern "C" fn set_label<D: DomTypes>
13787(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
13788 let mut result = false;
13789 wrap_panic(&mut || result = (|| {
13790 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
13791 let this = &*(this as *const D::GPUCommandBuffer);
13792 let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
13793 Ok(ConversionResult::Success(value)) => value,
13794 Ok(ConversionResult::Failure(error)) => {
13795 throw_type_error(cx.raw_cx(), &error);
13796 return false;
13797
13798 }
13799 _ => {
13800 return false;
13801
13802 },
13803 }
13804 ;
13805 let result: () = this.SetLabel(arg0);
13806
13807 true
13808 })());
13809 result
13810}
13811
13812
13813static label_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
13814
13815pub(crate) fn init_label_getterinfo<D: DomTypes>() {
13816 label_getterinfo.set(JSJitInfo {
13817 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
13818 getter: Some(get_label::<D>)
13819 },
13820 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
13821 protoID: PrototypeList::ID::GPUCommandBuffer as u16,
13822 },
13823 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
13824 _bitfield_align_1: [],
13825 _bitfield_1: __BindgenBitfieldUnit::new(
13826 new_jsjitinfo_bitfield_1!(
13827 JSJitInfo_OpType::Getter as u8,
13828 JSJitInfo_AliasSet::AliasEverything as u8,
13829 JSValueType::JSVAL_TYPE_STRING as u8,
13830 true,
13831 false,
13832 false,
13833 false,
13834 false,
13835 false,
13836 0,
13837 ).to_ne_bytes()
13838 ),
13839});
13840}
13841static label_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
13842
13843pub(crate) fn init_label_setterinfo<D: DomTypes>() {
13844 label_setterinfo.set(JSJitInfo {
13845 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
13846 setter: Some(set_label::<D>)
13847 },
13848 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
13849 protoID: PrototypeList::ID::GPUCommandBuffer as u16,
13850 },
13851 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
13852 _bitfield_align_1: [],
13853 _bitfield_1: __BindgenBitfieldUnit::new(
13854 new_jsjitinfo_bitfield_1!(
13855 JSJitInfo_OpType::Setter as u8,
13856 JSJitInfo_AliasSet::AliasEverything as u8,
13857 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
13858 false,
13859 false,
13860 false,
13861 false,
13862 false,
13863 false,
13864 0,
13865 ).to_ne_bytes()
13866 ),
13867});
13868}
13869unsafe extern "C" fn _finalize<D: DomTypes>
13870(_cx: *mut GCContext, obj: *mut JSObject){
13871 wrap_panic(&mut || {
13872
13873 let this = native_from_object_static::<D::GPUCommandBuffer>(obj).unwrap();
13874 finalize_common(this);
13875 })
13876}
13877
13878unsafe extern "C" fn _trace<D: DomTypes>
13879(trc: *mut JSTracer, obj: *mut JSObject){
13880 wrap_panic(&mut || {
13881
13882 let this = native_from_object_static::<D::GPUCommandBuffer>(obj).unwrap();
13883 if this.is_null() { return; } (*this).trace(trc);
13885 })
13886}
13887
13888
13889static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
13890
13891pub(crate) fn init_class_ops<D: DomTypes>() {
13892 CLASS_OPS.set(JSClassOps {
13893 addProperty: None,
13894 delProperty: None,
13895 enumerate: None,
13896 newEnumerate: None,
13897 resolve: None,
13898 mayResolve: None,
13899 finalize: Some(_finalize::<D>),
13900 call: None,
13901 construct: None,
13902 trace: Some(_trace::<D>),
13903 });
13904}
13905
13906pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
13907
13908pub(crate) fn init_domjs_class<D: DomTypes>() {
13909 init_class_ops::<D>();
13910 Class.set(DOMJSClass {
13911 base: JSClass {
13912 name: c"GPUCommandBuffer".as_ptr(),
13913 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
13914 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
13915 ,
13916 cOps: unsafe { CLASS_OPS.get() },
13917 spec: ptr::null(),
13918 ext: ptr::null(),
13919 oOps: ptr::null(),
13920 },
13921 dom_class:
13922DOMClass {
13923 interface_chain: [ PrototypeList::ID::GPUCommandBuffer, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
13924 depth: 0,
13925 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
13926 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUCommandBuffer> as unsafe fn(&mut _, _) -> _,
13927 global: Globals::EMPTY,
13928},
13929 });
13930}
13931
13932#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
13933(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUCommandBuffer>, _can_gc: CanGc) -> DomRoot<D::GPUCommandBuffer>{
13934
13935 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
13936
13937 let scope = scope.reflector().get_jsobject();
13938 assert!(!scope.get().is_null());
13939 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
13940 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
13941
13942 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
13943 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
13944 assert!(!canonical_proto.is_null());
13945
13946
13947 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
13948 if let Some(given) = given_proto {
13949 proto.set(*given);
13950 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
13951 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
13952 }
13953 } else {
13954 proto.set(*canonical_proto);
13955 }
13956 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
13957 cx.raw_cx(),
13958 &Class.get().base,
13959 proto.handle(),
13960 ));
13961 assert!(!obj.is_null());
13962 JS_SetReservedSlot(
13963 obj.get(),
13964 DOM_OBJECT_SLOT,
13965 &PrivateValue(raw.as_ptr() as *const libc::c_void),
13966 );
13967
13968 let root = raw.reflect_with(obj.get());
13969
13970
13971
13972 DomRoot::from_ref(&*root)
13973}
13974
13975pub trait GPUCommandBufferMethods<D: DomTypes> {
13976 fn Label(&self, ) -> USVString;
13977 fn SetLabel(&self, r#value: USVString);
13978}
13979static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
13980
13981pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
13982 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
13983 JSPropertySpec {
13984 name: JSPropertySpec_Name { string_: c"label".as_ptr() },
13985 attributes_: (JSPROP_ENUMERATE),
13986 kind_: (JSPropertySpec_Kind::NativeAccessor),
13987 u: JSPropertySpec_AccessorsOrValue {
13988 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
13989 getter: JSPropertySpec_Accessor {
13990 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { label_getterinfo.get() } },
13991 },
13992 setter: JSPropertySpec_Accessor {
13993 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { label_setterinfo.get() } },
13994 }
13995 }
13996 }
13997 }
13998,
13999 JSPropertySpec::ZERO]))[..]
14000,
14001&Box::leak(Box::new([
14002 JSPropertySpec {
14003 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
14004 attributes_: (JSPROP_READONLY),
14005 kind_: (JSPropertySpec_Kind::Value),
14006 u: JSPropertySpec_AccessorsOrValue {
14007 value: JSPropertySpec_ValueWrapper {
14008 type_: JSPropertySpec_ValueWrapper_Type::String,
14009 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
14010 string: c"GPUCommandBuffer".as_ptr(),
14011 }
14012 }
14013 }
14014 }
14015,
14016 JSPropertySpec::ZERO]))[..]
14017])));
14018}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
14019
14020pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
14021 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
14022 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
14023}
14024pub fn GetProtoObject<D: DomTypes>
14025(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
14026 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUCommandBuffer), CreateInterfaceObjects::<D>, rval)
14028}
14029
14030
14031static PrototypeClass: JSClass = JSClass {
14032 name: c"GPUCommandBufferPrototype".as_ptr(),
14033 flags:
14034 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
14036 cOps: ptr::null(),
14037 spec: ptr::null(),
14038 ext: ptr::null(),
14039 oOps: ptr::null(),
14040};
14041
14042
14043static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
14044
14045pub(crate) fn init_interface_object<D: DomTypes>() {
14046 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
14047 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
14048 b"function GPUCommandBuffer() {\n [native code]\n}",
14049 PrototypeList::ID::GPUCommandBuffer,
14050 0,
14051 ));
14052}
14053
14054pub fn DefineDOMInterface<D: DomTypes>
14055(cx: SafeJSContext, global: HandleObject){
14056 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUCommandBuffer),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
14057}
14058
14059pub fn ConstructorEnabled<D: DomTypes>
14060(aCx: SafeJSContext, aObj: HandleObject) -> bool{
14061 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
14062 pref!(dom_webgpu_enabled)
14063}
14064
14065unsafe fn CreateInterfaceObjects<D: DomTypes>
14066(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
14067
14068 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
14069 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
14070 assert!(!prototype_proto.is_null());
14071
14072 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
14073 create_interface_prototype_object::<D>(cx,
14074 global,
14075 prototype_proto.handle(),
14076 &PrototypeClass,
14077 &[],
14078 sAttributes.get(),
14079 &[],
14080 &[],
14081 prototype.handle_mut());
14082 assert!(!prototype.is_null());
14083 assert!((*cache)[PrototypeList::ID::GPUCommandBuffer as usize].is_null());
14084 (*cache)[PrototypeList::ID::GPUCommandBuffer as usize] = prototype.get();
14085 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUCommandBuffer as isize),
14086 ptr::null_mut(),
14087 prototype.get());
14088
14089 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
14090 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
14091
14092 assert!(!interface_proto.is_null());
14093
14094 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
14095 create_noncallback_interface_object::<D>(cx,
14096 global,
14097 interface_proto.handle(),
14098 INTERFACE_OBJECT_CLASS.get(),
14099 &[],
14100 &[],
14101 &[],
14102 prototype.handle(),
14103 c"GPUCommandBuffer",
14104 0,
14105 &[],
14106 interface.handle_mut());
14107 assert!(!interface.is_null());
14108}
14109
14110
14111 pub(crate) fn init_statics<D: DomTypes>() {
14112 init_interface_object::<D>();
14113 init_domjs_class::<D>();
14114
14115 init_label_getterinfo::<D>();
14116 init_label_setterinfo::<D>();
14117
14118 init_sAttributes_specs::<D>();
14119init_sAttributes_prefs::<D>();
14120 }
14121 } pub use self::GPUCommandEncoder_Binding::{Wrap as GPUCommandEncoderWrap, GPUCommandEncoderMethods, GetProtoObject as GPUCommandEncoderGetProtoObject, DefineDOMInterface as GPUCommandEncoderDefineDOMInterface};
14125pub mod GPUCommandEncoder_Binding {
14126use crate::codegen::GenericBindings::WebGPUBinding::GPUCommandBufferDescriptor;
14127use crate::codegen::GenericBindings::WebGPUBinding::GPUComputePassDescriptor;
14128use crate::codegen::GenericBindings::WebGPUBinding::GPUExtent3DDict;
14129use crate::codegen::GenericBindings::WebGPUBinding::GPUImageCopyBuffer;
14130use crate::codegen::GenericBindings::WebGPUBinding::GPUImageCopyTexture;
14131use crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassColorAttachment;
14132use crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassDepthStencilAttachment;
14133use crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassDescriptor;
14134use crate::codegen::GenericBindings::WebGPUBinding::GPUTextureAspect;
14135use crate::codegen::GenericBindings::WebGPUBinding::GPUTextureAspectValues;
14136use crate::import::module::*;
14137
14138unsafe extern "C" fn beginComputePass<D: DomTypes>
14139(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
14140 let mut result = false;
14141 wrap_panic(&mut || result = (|| {
14142 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
14143 let this = &*(this as *const D::GPUCommandEncoder);
14144 let args = &*args;
14145 let argc = args.argc_;
14146 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPUComputePassDescriptor = if args.get(0).is_undefined() {
14147 crate::codegen::GenericBindings::WebGPUBinding::GPUComputePassDescriptor::empty()
14148 } else {
14149 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
14150 Ok(ConversionResult::Success(value)) => value,
14151 Ok(ConversionResult::Failure(error)) => {
14152 throw_type_error(cx.raw_cx(), &error);
14153 return false;
14154
14155 }
14156 _ => {
14157 return false;
14158
14159 },
14160 }
14161
14162 };
14163 let result: DomRoot<D::GPUComputePassEncoder> = this.BeginComputePass(&arg0);
14164
14165 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
14166 return true;
14167 })());
14168 result
14169}
14170
14171
14172static beginComputePass_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
14173
14174pub(crate) fn init_beginComputePass_methodinfo<D: DomTypes>() {
14175 beginComputePass_methodinfo.set(JSJitInfo {
14176 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
14177 method: Some(beginComputePass::<D>)
14178 },
14179 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
14180 protoID: PrototypeList::ID::GPUCommandEncoder as u16,
14181 },
14182 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
14183 _bitfield_align_1: [],
14184 _bitfield_1: __BindgenBitfieldUnit::new(
14185 new_jsjitinfo_bitfield_1!(
14186 JSJitInfo_OpType::Method as u8,
14187 JSJitInfo_AliasSet::AliasEverything as u8,
14188 JSValueType::JSVAL_TYPE_OBJECT as u8,
14189 false,
14190 false,
14191 false,
14192 false,
14193 false,
14194 false,
14195 0,
14196 ).to_ne_bytes()
14197 ),
14198});
14199}
14200unsafe extern "C" fn beginRenderPass<D: DomTypes>
14201(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
14202 let mut result = false;
14203 wrap_panic(&mut || result = (|| {
14204 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
14205 let this = &*(this as *const D::GPUCommandEncoder);
14206 let args = &*args;
14207 let argc = args.argc_;
14208
14209 if argc < 1 {
14210 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUCommandEncoder.beginRenderPass\".");
14211 return false;
14212 }
14213 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassDescriptor<D> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
14214 Ok(ConversionResult::Success(value)) => value,
14215 Ok(ConversionResult::Failure(error)) => {
14216 throw_type_error(cx.raw_cx(), &error);
14217 return false;
14218
14219 }
14220 _ => {
14221 return false;
14222
14223 },
14224 }
14225 ;
14226 let result: Result<DomRoot<D::GPURenderPassEncoder>, Error> = this.BeginRenderPass(&arg0);
14227 let result = match result {
14228 Ok(result) => result,
14229 Err(e) => {
14230 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
14231 return false;
14232 },
14233 };
14234
14235 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
14236 return true;
14237 })());
14238 result
14239}
14240
14241
14242static beginRenderPass_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
14243
14244pub(crate) fn init_beginRenderPass_methodinfo<D: DomTypes>() {
14245 beginRenderPass_methodinfo.set(JSJitInfo {
14246 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
14247 method: Some(beginRenderPass::<D>)
14248 },
14249 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
14250 protoID: PrototypeList::ID::GPUCommandEncoder as u16,
14251 },
14252 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
14253 _bitfield_align_1: [],
14254 _bitfield_1: __BindgenBitfieldUnit::new(
14255 new_jsjitinfo_bitfield_1!(
14256 JSJitInfo_OpType::Method as u8,
14257 JSJitInfo_AliasSet::AliasEverything as u8,
14258 JSValueType::JSVAL_TYPE_OBJECT as u8,
14259 false,
14260 false,
14261 false,
14262 false,
14263 false,
14264 false,
14265 0,
14266 ).to_ne_bytes()
14267 ),
14268});
14269}
14270unsafe extern "C" fn copyBufferToBuffer<D: DomTypes>
14271(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
14272 let mut result = false;
14273 wrap_panic(&mut || result = (|| {
14274 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
14275 let this = &*(this as *const D::GPUCommandEncoder);
14276 let args = &*args;
14277 let argc = args.argc_;
14278
14279 if argc < 5 {
14280 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUCommandEncoder.copyBufferToBuffer\".");
14281 return false;
14282 }
14283 let arg0: DomRoot<D::GPUBuffer> = if HandleValue::from_raw(args.get(0)).get().is_object() {
14284 match root_from_handlevalue(HandleValue::from_raw(args.get(0)), SafeJSContext::from_ptr(cx.raw_cx())) {
14285 Ok(val) => val,
14286 Err(()) => {
14287 throw_type_error(cx.raw_cx(), "value does not implement interface GPUBuffer.");
14288 return false;
14289
14290 }
14291 }
14292
14293 } else {
14294 throw_type_error(cx.raw_cx(), "Value is not an object.");
14295 return false;
14296
14297 };
14298 let arg1: u64 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
14299 Ok(ConversionResult::Success(value)) => value,
14300 Ok(ConversionResult::Failure(error)) => {
14301 throw_type_error(cx.raw_cx(), &error);
14302 return false;
14303
14304 }
14305 _ => {
14306 return false;
14307
14308 },
14309 }
14310 ;
14311 let arg2: DomRoot<D::GPUBuffer> = if HandleValue::from_raw(args.get(2)).get().is_object() {
14312 match root_from_handlevalue(HandleValue::from_raw(args.get(2)), SafeJSContext::from_ptr(cx.raw_cx())) {
14313 Ok(val) => val,
14314 Err(()) => {
14315 throw_type_error(cx.raw_cx(), "value does not implement interface GPUBuffer.");
14316 return false;
14317
14318 }
14319 }
14320
14321 } else {
14322 throw_type_error(cx.raw_cx(), "Value is not an object.");
14323 return false;
14324
14325 };
14326 let arg3: u64 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(3)), ConversionBehavior::EnforceRange) {
14327 Ok(ConversionResult::Success(value)) => value,
14328 Ok(ConversionResult::Failure(error)) => {
14329 throw_type_error(cx.raw_cx(), &error);
14330 return false;
14331
14332 }
14333 _ => {
14334 return false;
14335
14336 },
14337 }
14338 ;
14339 let arg4: u64 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(4)), ConversionBehavior::EnforceRange) {
14340 Ok(ConversionResult::Success(value)) => value,
14341 Ok(ConversionResult::Failure(error)) => {
14342 throw_type_error(cx.raw_cx(), &error);
14343 return false;
14344
14345 }
14346 _ => {
14347 return false;
14348
14349 },
14350 }
14351 ;
14352 let result: () = this.CopyBufferToBuffer(&arg0, arg1, &arg2, arg3, arg4);
14353
14354 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
14355 return true;
14356 })());
14357 result
14358}
14359
14360
14361static copyBufferToBuffer_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
14362
14363pub(crate) fn init_copyBufferToBuffer_methodinfo<D: DomTypes>() {
14364 copyBufferToBuffer_methodinfo.set(JSJitInfo {
14365 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
14366 method: Some(copyBufferToBuffer::<D>)
14367 },
14368 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
14369 protoID: PrototypeList::ID::GPUCommandEncoder as u16,
14370 },
14371 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
14372 _bitfield_align_1: [],
14373 _bitfield_1: __BindgenBitfieldUnit::new(
14374 new_jsjitinfo_bitfield_1!(
14375 JSJitInfo_OpType::Method as u8,
14376 JSJitInfo_AliasSet::AliasEverything as u8,
14377 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
14378 false,
14379 false,
14380 false,
14381 false,
14382 false,
14383 false,
14384 0,
14385 ).to_ne_bytes()
14386 ),
14387});
14388}
14389unsafe extern "C" fn copyBufferToTexture<D: DomTypes>
14390(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
14391 let mut result = false;
14392 wrap_panic(&mut || result = (|| {
14393 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
14394 let this = &*(this as *const D::GPUCommandEncoder);
14395 let args = &*args;
14396 let argc = args.argc_;
14397
14398 if argc < 3 {
14399 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUCommandEncoder.copyBufferToTexture\".");
14400 return false;
14401 }
14402 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPUImageCopyBuffer<D> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
14403 Ok(ConversionResult::Success(value)) => value,
14404 Ok(ConversionResult::Failure(error)) => {
14405 throw_type_error(cx.raw_cx(), &error);
14406 return false;
14407
14408 }
14409 _ => {
14410 return false;
14411
14412 },
14413 }
14414 ;
14415 let arg1: crate::codegen::GenericBindings::WebGPUBinding::GPUImageCopyTexture<D> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
14416 Ok(ConversionResult::Success(value)) => value,
14417 Ok(ConversionResult::Failure(error)) => {
14418 throw_type_error(cx.raw_cx(), &error);
14419 return false;
14420
14421 }
14422 _ => {
14423 return false;
14424
14425 },
14426 }
14427 ;
14428 let arg2: GenericUnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ()) {
14429 Ok(ConversionResult::Success(value)) => value,
14430 Ok(ConversionResult::Failure(error)) => {
14431 throw_type_error(cx.raw_cx(), &error);
14432 return false;
14433
14434 }
14435 _ => {
14436 return false;
14437
14438 },
14439 }
14440 ;
14441 let result: Result<(), Error> = this.CopyBufferToTexture(&arg0, &arg1, arg2);
14442 let result = match result {
14443 Ok(result) => result,
14444 Err(e) => {
14445 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
14446 return false;
14447 },
14448 };
14449
14450 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
14451 return true;
14452 })());
14453 result
14454}
14455
14456
14457static copyBufferToTexture_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
14458
14459pub(crate) fn init_copyBufferToTexture_methodinfo<D: DomTypes>() {
14460 copyBufferToTexture_methodinfo.set(JSJitInfo {
14461 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
14462 method: Some(copyBufferToTexture::<D>)
14463 },
14464 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
14465 protoID: PrototypeList::ID::GPUCommandEncoder as u16,
14466 },
14467 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
14468 _bitfield_align_1: [],
14469 _bitfield_1: __BindgenBitfieldUnit::new(
14470 new_jsjitinfo_bitfield_1!(
14471 JSJitInfo_OpType::Method as u8,
14472 JSJitInfo_AliasSet::AliasEverything as u8,
14473 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
14474 false,
14475 false,
14476 false,
14477 false,
14478 false,
14479 false,
14480 0,
14481 ).to_ne_bytes()
14482 ),
14483});
14484}
14485unsafe extern "C" fn copyTextureToBuffer<D: DomTypes>
14486(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
14487 let mut result = false;
14488 wrap_panic(&mut || result = (|| {
14489 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
14490 let this = &*(this as *const D::GPUCommandEncoder);
14491 let args = &*args;
14492 let argc = args.argc_;
14493
14494 if argc < 3 {
14495 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUCommandEncoder.copyTextureToBuffer\".");
14496 return false;
14497 }
14498 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPUImageCopyTexture<D> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
14499 Ok(ConversionResult::Success(value)) => value,
14500 Ok(ConversionResult::Failure(error)) => {
14501 throw_type_error(cx.raw_cx(), &error);
14502 return false;
14503
14504 }
14505 _ => {
14506 return false;
14507
14508 },
14509 }
14510 ;
14511 let arg1: crate::codegen::GenericBindings::WebGPUBinding::GPUImageCopyBuffer<D> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
14512 Ok(ConversionResult::Success(value)) => value,
14513 Ok(ConversionResult::Failure(error)) => {
14514 throw_type_error(cx.raw_cx(), &error);
14515 return false;
14516
14517 }
14518 _ => {
14519 return false;
14520
14521 },
14522 }
14523 ;
14524 let arg2: GenericUnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ()) {
14525 Ok(ConversionResult::Success(value)) => value,
14526 Ok(ConversionResult::Failure(error)) => {
14527 throw_type_error(cx.raw_cx(), &error);
14528 return false;
14529
14530 }
14531 _ => {
14532 return false;
14533
14534 },
14535 }
14536 ;
14537 let result: Result<(), Error> = this.CopyTextureToBuffer(&arg0, &arg1, arg2);
14538 let result = match result {
14539 Ok(result) => result,
14540 Err(e) => {
14541 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
14542 return false;
14543 },
14544 };
14545
14546 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
14547 return true;
14548 })());
14549 result
14550}
14551
14552
14553static copyTextureToBuffer_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
14554
14555pub(crate) fn init_copyTextureToBuffer_methodinfo<D: DomTypes>() {
14556 copyTextureToBuffer_methodinfo.set(JSJitInfo {
14557 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
14558 method: Some(copyTextureToBuffer::<D>)
14559 },
14560 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
14561 protoID: PrototypeList::ID::GPUCommandEncoder as u16,
14562 },
14563 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
14564 _bitfield_align_1: [],
14565 _bitfield_1: __BindgenBitfieldUnit::new(
14566 new_jsjitinfo_bitfield_1!(
14567 JSJitInfo_OpType::Method as u8,
14568 JSJitInfo_AliasSet::AliasEverything as u8,
14569 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
14570 false,
14571 false,
14572 false,
14573 false,
14574 false,
14575 false,
14576 0,
14577 ).to_ne_bytes()
14578 ),
14579});
14580}
14581unsafe extern "C" fn copyTextureToTexture<D: DomTypes>
14582(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
14583 let mut result = false;
14584 wrap_panic(&mut || result = (|| {
14585 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
14586 let this = &*(this as *const D::GPUCommandEncoder);
14587 let args = &*args;
14588 let argc = args.argc_;
14589
14590 if argc < 3 {
14591 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUCommandEncoder.copyTextureToTexture\".");
14592 return false;
14593 }
14594 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPUImageCopyTexture<D> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
14595 Ok(ConversionResult::Success(value)) => value,
14596 Ok(ConversionResult::Failure(error)) => {
14597 throw_type_error(cx.raw_cx(), &error);
14598 return false;
14599
14600 }
14601 _ => {
14602 return false;
14603
14604 },
14605 }
14606 ;
14607 let arg1: crate::codegen::GenericBindings::WebGPUBinding::GPUImageCopyTexture<D> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
14608 Ok(ConversionResult::Success(value)) => value,
14609 Ok(ConversionResult::Failure(error)) => {
14610 throw_type_error(cx.raw_cx(), &error);
14611 return false;
14612
14613 }
14614 _ => {
14615 return false;
14616
14617 },
14618 }
14619 ;
14620 let arg2: GenericUnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ()) {
14621 Ok(ConversionResult::Success(value)) => value,
14622 Ok(ConversionResult::Failure(error)) => {
14623 throw_type_error(cx.raw_cx(), &error);
14624 return false;
14625
14626 }
14627 _ => {
14628 return false;
14629
14630 },
14631 }
14632 ;
14633 let result: Result<(), Error> = this.CopyTextureToTexture(&arg0, &arg1, arg2);
14634 let result = match result {
14635 Ok(result) => result,
14636 Err(e) => {
14637 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
14638 return false;
14639 },
14640 };
14641
14642 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
14643 return true;
14644 })());
14645 result
14646}
14647
14648
14649static copyTextureToTexture_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
14650
14651pub(crate) fn init_copyTextureToTexture_methodinfo<D: DomTypes>() {
14652 copyTextureToTexture_methodinfo.set(JSJitInfo {
14653 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
14654 method: Some(copyTextureToTexture::<D>)
14655 },
14656 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
14657 protoID: PrototypeList::ID::GPUCommandEncoder as u16,
14658 },
14659 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
14660 _bitfield_align_1: [],
14661 _bitfield_1: __BindgenBitfieldUnit::new(
14662 new_jsjitinfo_bitfield_1!(
14663 JSJitInfo_OpType::Method as u8,
14664 JSJitInfo_AliasSet::AliasEverything as u8,
14665 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
14666 false,
14667 false,
14668 false,
14669 false,
14670 false,
14671 false,
14672 0,
14673 ).to_ne_bytes()
14674 ),
14675});
14676}
14677unsafe extern "C" fn finish<D: DomTypes>
14678(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
14679 let mut result = false;
14680 wrap_panic(&mut || result = (|| {
14681 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
14682 let this = &*(this as *const D::GPUCommandEncoder);
14683 let args = &*args;
14684 let argc = args.argc_;
14685 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPUCommandBufferDescriptor = if args.get(0).is_undefined() {
14686 crate::codegen::GenericBindings::WebGPUBinding::GPUCommandBufferDescriptor::empty()
14687 } else {
14688 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
14689 Ok(ConversionResult::Success(value)) => value,
14690 Ok(ConversionResult::Failure(error)) => {
14691 throw_type_error(cx.raw_cx(), &error);
14692 return false;
14693
14694 }
14695 _ => {
14696 return false;
14697
14698 },
14699 }
14700
14701 };
14702 let result: DomRoot<D::GPUCommandBuffer> = this.Finish(&arg0);
14703
14704 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
14705 return true;
14706 })());
14707 result
14708}
14709
14710
14711static finish_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
14712
14713pub(crate) fn init_finish_methodinfo<D: DomTypes>() {
14714 finish_methodinfo.set(JSJitInfo {
14715 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
14716 method: Some(finish::<D>)
14717 },
14718 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
14719 protoID: PrototypeList::ID::GPUCommandEncoder as u16,
14720 },
14721 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
14722 _bitfield_align_1: [],
14723 _bitfield_1: __BindgenBitfieldUnit::new(
14724 new_jsjitinfo_bitfield_1!(
14725 JSJitInfo_OpType::Method as u8,
14726 JSJitInfo_AliasSet::AliasEverything as u8,
14727 JSValueType::JSVAL_TYPE_OBJECT as u8,
14728 false,
14729 false,
14730 false,
14731 false,
14732 false,
14733 false,
14734 0,
14735 ).to_ne_bytes()
14736 ),
14737});
14738}
14739unsafe extern "C" fn get_label<D: DomTypes>
14740(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
14741 let mut result = false;
14742 wrap_panic(&mut || result = (|| {
14743 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
14744 let this = &*(this as *const D::GPUCommandEncoder);
14745 let result: USVString = this.Label();
14746
14747 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
14748 return true;
14749 })());
14750 result
14751}
14752
14753unsafe extern "C" fn set_label<D: DomTypes>
14754(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
14755 let mut result = false;
14756 wrap_panic(&mut || result = (|| {
14757 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
14758 let this = &*(this as *const D::GPUCommandEncoder);
14759 let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
14760 Ok(ConversionResult::Success(value)) => value,
14761 Ok(ConversionResult::Failure(error)) => {
14762 throw_type_error(cx.raw_cx(), &error);
14763 return false;
14764
14765 }
14766 _ => {
14767 return false;
14768
14769 },
14770 }
14771 ;
14772 let result: () = this.SetLabel(arg0);
14773
14774 true
14775 })());
14776 result
14777}
14778
14779
14780static label_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
14781
14782pub(crate) fn init_label_getterinfo<D: DomTypes>() {
14783 label_getterinfo.set(JSJitInfo {
14784 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
14785 getter: Some(get_label::<D>)
14786 },
14787 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
14788 protoID: PrototypeList::ID::GPUCommandEncoder as u16,
14789 },
14790 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
14791 _bitfield_align_1: [],
14792 _bitfield_1: __BindgenBitfieldUnit::new(
14793 new_jsjitinfo_bitfield_1!(
14794 JSJitInfo_OpType::Getter as u8,
14795 JSJitInfo_AliasSet::AliasEverything as u8,
14796 JSValueType::JSVAL_TYPE_STRING as u8,
14797 true,
14798 false,
14799 false,
14800 false,
14801 false,
14802 false,
14803 0,
14804 ).to_ne_bytes()
14805 ),
14806});
14807}
14808static label_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
14809
14810pub(crate) fn init_label_setterinfo<D: DomTypes>() {
14811 label_setterinfo.set(JSJitInfo {
14812 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
14813 setter: Some(set_label::<D>)
14814 },
14815 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
14816 protoID: PrototypeList::ID::GPUCommandEncoder as u16,
14817 },
14818 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
14819 _bitfield_align_1: [],
14820 _bitfield_1: __BindgenBitfieldUnit::new(
14821 new_jsjitinfo_bitfield_1!(
14822 JSJitInfo_OpType::Setter as u8,
14823 JSJitInfo_AliasSet::AliasEverything as u8,
14824 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
14825 false,
14826 false,
14827 false,
14828 false,
14829 false,
14830 false,
14831 0,
14832 ).to_ne_bytes()
14833 ),
14834});
14835}
14836unsafe extern "C" fn _finalize<D: DomTypes>
14837(_cx: *mut GCContext, obj: *mut JSObject){
14838 wrap_panic(&mut || {
14839
14840 let this = native_from_object_static::<D::GPUCommandEncoder>(obj).unwrap();
14841 finalize_common(this);
14842 })
14843}
14844
14845unsafe extern "C" fn _trace<D: DomTypes>
14846(trc: *mut JSTracer, obj: *mut JSObject){
14847 wrap_panic(&mut || {
14848
14849 let this = native_from_object_static::<D::GPUCommandEncoder>(obj).unwrap();
14850 if this.is_null() { return; } (*this).trace(trc);
14852 })
14853}
14854
14855
14856static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
14857
14858pub(crate) fn init_class_ops<D: DomTypes>() {
14859 CLASS_OPS.set(JSClassOps {
14860 addProperty: None,
14861 delProperty: None,
14862 enumerate: None,
14863 newEnumerate: None,
14864 resolve: None,
14865 mayResolve: None,
14866 finalize: Some(_finalize::<D>),
14867 call: None,
14868 construct: None,
14869 trace: Some(_trace::<D>),
14870 });
14871}
14872
14873pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
14874
14875pub(crate) fn init_domjs_class<D: DomTypes>() {
14876 init_class_ops::<D>();
14877 Class.set(DOMJSClass {
14878 base: JSClass {
14879 name: c"GPUCommandEncoder".as_ptr(),
14880 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
14881 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
14882 ,
14883 cOps: unsafe { CLASS_OPS.get() },
14884 spec: ptr::null(),
14885 ext: ptr::null(),
14886 oOps: ptr::null(),
14887 },
14888 dom_class:
14889DOMClass {
14890 interface_chain: [ PrototypeList::ID::GPUCommandEncoder, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
14891 depth: 0,
14892 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
14893 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUCommandEncoder> as unsafe fn(&mut _, _) -> _,
14894 global: Globals::EMPTY,
14895},
14896 });
14897}
14898
14899#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
14900(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUCommandEncoder>, _can_gc: CanGc) -> DomRoot<D::GPUCommandEncoder>{
14901
14902 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
14903
14904 let scope = scope.reflector().get_jsobject();
14905 assert!(!scope.get().is_null());
14906 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
14907 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
14908
14909 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
14910 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
14911 assert!(!canonical_proto.is_null());
14912
14913
14914 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
14915 if let Some(given) = given_proto {
14916 proto.set(*given);
14917 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
14918 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
14919 }
14920 } else {
14921 proto.set(*canonical_proto);
14922 }
14923 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
14924 cx.raw_cx(),
14925 &Class.get().base,
14926 proto.handle(),
14927 ));
14928 assert!(!obj.is_null());
14929 JS_SetReservedSlot(
14930 obj.get(),
14931 DOM_OBJECT_SLOT,
14932 &PrivateValue(raw.as_ptr() as *const libc::c_void),
14933 );
14934
14935 let root = raw.reflect_with(obj.get());
14936
14937
14938
14939 DomRoot::from_ref(&*root)
14940}
14941
14942pub trait GPUCommandEncoderMethods<D: DomTypes> {
14943 fn BeginComputePass(&self, r#descriptor: &crate::codegen::GenericBindings::WebGPUBinding::GPUComputePassDescriptor) -> DomRoot<D::GPUComputePassEncoder>;
14944 fn BeginRenderPass(&self, r#descriptor: &crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassDescriptor<D>) -> Fallible<DomRoot<D::GPURenderPassEncoder>>;
14945 fn CopyBufferToBuffer(&self, r#source: &D::GPUBuffer, r#sourceOffset: u64, r#destination: &D::GPUBuffer, r#destinationOffset: u64, r#size: u64);
14946 fn CopyBufferToTexture(&self, r#source: &crate::codegen::GenericBindings::WebGPUBinding::GPUImageCopyBuffer<D>, r#destination: &crate::codegen::GenericBindings::WebGPUBinding::GPUImageCopyTexture<D>, r#copySize: GenericUnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict) -> Fallible<()>;
14947 fn CopyTextureToBuffer(&self, r#source: &crate::codegen::GenericBindings::WebGPUBinding::GPUImageCopyTexture<D>, r#destination: &crate::codegen::GenericBindings::WebGPUBinding::GPUImageCopyBuffer<D>, r#copySize: GenericUnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict) -> Fallible<()>;
14948 fn CopyTextureToTexture(&self, r#source: &crate::codegen::GenericBindings::WebGPUBinding::GPUImageCopyTexture<D>, r#destination: &crate::codegen::GenericBindings::WebGPUBinding::GPUImageCopyTexture<D>, r#copySize: GenericUnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict) -> Fallible<()>;
14949 fn Finish(&self, r#descriptor: &crate::codegen::GenericBindings::WebGPUBinding::GPUCommandBufferDescriptor) -> DomRoot<D::GPUCommandBuffer>;
14950 fn Label(&self, ) -> USVString;
14951 fn SetLabel(&self, r#value: USVString);
14952}
14953static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
14954
14955pub(crate) fn init_sMethods_specs<D: DomTypes>() {
14956 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
14957 JSFunctionSpec {
14958 name: JSPropertySpec_Name { string_: c"beginComputePass".as_ptr() },
14959 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { beginComputePass_methodinfo.get() } as *const _ as *const JSJitInfo },
14960 nargs: 0,
14961 flags: (JSPROP_ENUMERATE) as u16,
14962 selfHostedName: ptr::null()
14963 },
14964 JSFunctionSpec {
14965 name: JSPropertySpec_Name { string_: c"beginRenderPass".as_ptr() },
14966 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { beginRenderPass_methodinfo.get() } as *const _ as *const JSJitInfo },
14967 nargs: 1,
14968 flags: (JSPROP_ENUMERATE) as u16,
14969 selfHostedName: ptr::null()
14970 },
14971 JSFunctionSpec {
14972 name: JSPropertySpec_Name { string_: c"copyBufferToBuffer".as_ptr() },
14973 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { copyBufferToBuffer_methodinfo.get() } as *const _ as *const JSJitInfo },
14974 nargs: 5,
14975 flags: (JSPROP_ENUMERATE) as u16,
14976 selfHostedName: ptr::null()
14977 },
14978 JSFunctionSpec {
14979 name: JSPropertySpec_Name { string_: c"copyBufferToTexture".as_ptr() },
14980 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { copyBufferToTexture_methodinfo.get() } as *const _ as *const JSJitInfo },
14981 nargs: 3,
14982 flags: (JSPROP_ENUMERATE) as u16,
14983 selfHostedName: ptr::null()
14984 },
14985 JSFunctionSpec {
14986 name: JSPropertySpec_Name { string_: c"copyTextureToBuffer".as_ptr() },
14987 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { copyTextureToBuffer_methodinfo.get() } as *const _ as *const JSJitInfo },
14988 nargs: 3,
14989 flags: (JSPROP_ENUMERATE) as u16,
14990 selfHostedName: ptr::null()
14991 },
14992 JSFunctionSpec {
14993 name: JSPropertySpec_Name { string_: c"copyTextureToTexture".as_ptr() },
14994 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { copyTextureToTexture_methodinfo.get() } as *const _ as *const JSJitInfo },
14995 nargs: 3,
14996 flags: (JSPROP_ENUMERATE) as u16,
14997 selfHostedName: ptr::null()
14998 },
14999 JSFunctionSpec {
15000 name: JSPropertySpec_Name { string_: c"finish".as_ptr() },
15001 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { finish_methodinfo.get() } as *const _ as *const JSJitInfo },
15002 nargs: 0,
15003 flags: (JSPROP_ENUMERATE) as u16,
15004 selfHostedName: ptr::null()
15005 },
15006 JSFunctionSpec {
15007 name: JSPropertySpec_Name { string_: ptr::null() },
15008 call: JSNativeWrapper { op: None, info: ptr::null() },
15009 nargs: 0,
15010 flags: 0,
15011 selfHostedName: ptr::null()
15012 }]))[..]
15013])));
15014}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
15015
15016pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
15017 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sMethods_specs.get() })[0])])));
15018}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
15019
15020pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
15021 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
15022 JSPropertySpec {
15023 name: JSPropertySpec_Name { string_: c"label".as_ptr() },
15024 attributes_: (JSPROP_ENUMERATE),
15025 kind_: (JSPropertySpec_Kind::NativeAccessor),
15026 u: JSPropertySpec_AccessorsOrValue {
15027 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
15028 getter: JSPropertySpec_Accessor {
15029 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { label_getterinfo.get() } },
15030 },
15031 setter: JSPropertySpec_Accessor {
15032 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { label_setterinfo.get() } },
15033 }
15034 }
15035 }
15036 }
15037,
15038 JSPropertySpec::ZERO]))[..]
15039,
15040&Box::leak(Box::new([
15041 JSPropertySpec {
15042 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
15043 attributes_: (JSPROP_READONLY),
15044 kind_: (JSPropertySpec_Kind::Value),
15045 u: JSPropertySpec_AccessorsOrValue {
15046 value: JSPropertySpec_ValueWrapper {
15047 type_: JSPropertySpec_ValueWrapper_Type::String,
15048 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
15049 string: c"GPUCommandEncoder".as_ptr(),
15050 }
15051 }
15052 }
15053 }
15054,
15055 JSPropertySpec::ZERO]))[..]
15056])));
15057}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
15058
15059pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
15060 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
15061 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
15062}
15063pub fn GetProtoObject<D: DomTypes>
15064(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
15065 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUCommandEncoder), CreateInterfaceObjects::<D>, rval)
15067}
15068
15069
15070static PrototypeClass: JSClass = JSClass {
15071 name: c"GPUCommandEncoderPrototype".as_ptr(),
15072 flags:
15073 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
15075 cOps: ptr::null(),
15076 spec: ptr::null(),
15077 ext: ptr::null(),
15078 oOps: ptr::null(),
15079};
15080
15081
15082static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
15083
15084pub(crate) fn init_interface_object<D: DomTypes>() {
15085 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
15086 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
15087 b"function GPUCommandEncoder() {\n [native code]\n}",
15088 PrototypeList::ID::GPUCommandEncoder,
15089 0,
15090 ));
15091}
15092
15093pub fn DefineDOMInterface<D: DomTypes>
15094(cx: SafeJSContext, global: HandleObject){
15095 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUCommandEncoder),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
15096}
15097
15098pub fn ConstructorEnabled<D: DomTypes>
15099(aCx: SafeJSContext, aObj: HandleObject) -> bool{
15100 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
15101 pref!(dom_webgpu_enabled)
15102}
15103
15104unsafe fn CreateInterfaceObjects<D: DomTypes>
15105(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
15106
15107 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
15108 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
15109 assert!(!prototype_proto.is_null());
15110
15111 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
15112 create_interface_prototype_object::<D>(cx,
15113 global,
15114 prototype_proto.handle(),
15115 &PrototypeClass,
15116 sMethods.get(),
15117 sAttributes.get(),
15118 &[],
15119 &[],
15120 prototype.handle_mut());
15121 assert!(!prototype.is_null());
15122 assert!((*cache)[PrototypeList::ID::GPUCommandEncoder as usize].is_null());
15123 (*cache)[PrototypeList::ID::GPUCommandEncoder as usize] = prototype.get();
15124 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUCommandEncoder as isize),
15125 ptr::null_mut(),
15126 prototype.get());
15127
15128 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
15129 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
15130
15131 assert!(!interface_proto.is_null());
15132
15133 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
15134 create_noncallback_interface_object::<D>(cx,
15135 global,
15136 interface_proto.handle(),
15137 INTERFACE_OBJECT_CLASS.get(),
15138 &[],
15139 &[],
15140 &[],
15141 prototype.handle(),
15142 c"GPUCommandEncoder",
15143 0,
15144 &[],
15145 interface.handle_mut());
15146 assert!(!interface.is_null());
15147}
15148
15149
15150 pub(crate) fn init_statics<D: DomTypes>() {
15151 init_interface_object::<D>();
15152 init_domjs_class::<D>();
15153 crate::codegen::GenericBindings::WebGPUBinding::GPUCommandEncoder_Binding::init_beginComputePass_methodinfo::<D>();
15154crate::codegen::GenericBindings::WebGPUBinding::GPUCommandEncoder_Binding::init_beginRenderPass_methodinfo::<D>();
15155crate::codegen::GenericBindings::WebGPUBinding::GPUCommandEncoder_Binding::init_copyBufferToBuffer_methodinfo::<D>();
15156crate::codegen::GenericBindings::WebGPUBinding::GPUCommandEncoder_Binding::init_copyBufferToTexture_methodinfo::<D>();
15157crate::codegen::GenericBindings::WebGPUBinding::GPUCommandEncoder_Binding::init_copyTextureToBuffer_methodinfo::<D>();
15158crate::codegen::GenericBindings::WebGPUBinding::GPUCommandEncoder_Binding::init_copyTextureToTexture_methodinfo::<D>();
15159crate::codegen::GenericBindings::WebGPUBinding::GPUCommandEncoder_Binding::init_finish_methodinfo::<D>();
15160 init_label_getterinfo::<D>();
15161 init_label_setterinfo::<D>();
15162
15163 init_sMethods_specs::<D>();
15164init_sMethods_prefs::<D>();
15165init_sAttributes_specs::<D>();
15166init_sAttributes_prefs::<D>();
15167 }
15168 } pub use self::GPUCompilationInfo_Binding::{Wrap as GPUCompilationInfoWrap, GPUCompilationInfoMethods, GetProtoObject as GPUCompilationInfoGetProtoObject, DefineDOMInterface as GPUCompilationInfoDefineDOMInterface};
15172pub mod GPUCompilationInfo_Binding {
15173use crate::import::module::*;
15174
15175unsafe extern "C" fn get_messages<D: DomTypes>
15176(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
15177 let mut result = false;
15178 wrap_panic(&mut || result = (|| {
15179 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
15180 let this = &*(this as *const D::GPUCompilationInfo);
15181 rooted!(&in(cx) let mut retval: JSVal);
15182 let result: () = this.Messages(SafeJSContext::from_ptr(cx.raw_cx()), CanGc::note(), retval.handle_mut());
15183
15184 (retval).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
15185 return true;
15186 })());
15187 result
15188}
15189
15190
15191static messages_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
15192
15193pub(crate) fn init_messages_getterinfo<D: DomTypes>() {
15194 messages_getterinfo.set(JSJitInfo {
15195 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
15196 getter: Some(get_messages::<D>)
15197 },
15198 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
15199 protoID: PrototypeList::ID::GPUCompilationInfo as u16,
15200 },
15201 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
15202 _bitfield_align_1: [],
15203 _bitfield_1: __BindgenBitfieldUnit::new(
15204 new_jsjitinfo_bitfield_1!(
15205 JSJitInfo_OpType::Getter as u8,
15206 JSJitInfo_AliasSet::AliasEverything as u8,
15207 JSValueType::JSVAL_TYPE_UNKNOWN as u8,
15208 true,
15209 false,
15210 false,
15211 false,
15212 false,
15213 false,
15214 0,
15215 ).to_ne_bytes()
15216 ),
15217});
15218}
15219unsafe extern "C" fn _finalize<D: DomTypes>
15220(_cx: *mut GCContext, obj: *mut JSObject){
15221 wrap_panic(&mut || {
15222
15223 let this = native_from_object_static::<D::GPUCompilationInfo>(obj).unwrap();
15224 finalize_common(this);
15225 })
15226}
15227
15228unsafe extern "C" fn _trace<D: DomTypes>
15229(trc: *mut JSTracer, obj: *mut JSObject){
15230 wrap_panic(&mut || {
15231
15232 let this = native_from_object_static::<D::GPUCompilationInfo>(obj).unwrap();
15233 if this.is_null() { return; } (*this).trace(trc);
15235 })
15236}
15237
15238
15239static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
15240
15241pub(crate) fn init_class_ops<D: DomTypes>() {
15242 CLASS_OPS.set(JSClassOps {
15243 addProperty: None,
15244 delProperty: None,
15245 enumerate: None,
15246 newEnumerate: None,
15247 resolve: None,
15248 mayResolve: None,
15249 finalize: Some(_finalize::<D>),
15250 call: None,
15251 construct: None,
15252 trace: Some(_trace::<D>),
15253 });
15254}
15255
15256pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
15257
15258pub(crate) fn init_domjs_class<D: DomTypes>() {
15259 init_class_ops::<D>();
15260 Class.set(DOMJSClass {
15261 base: JSClass {
15262 name: c"GPUCompilationInfo".as_ptr(),
15263 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
15264 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
15265 ,
15266 cOps: unsafe { CLASS_OPS.get() },
15267 spec: ptr::null(),
15268 ext: ptr::null(),
15269 oOps: ptr::null(),
15270 },
15271 dom_class:
15272DOMClass {
15273 interface_chain: [ PrototypeList::ID::GPUCompilationInfo, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
15274 depth: 0,
15275 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
15276 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUCompilationInfo> as unsafe fn(&mut _, _) -> _,
15277 global: Globals::EMPTY,
15278},
15279 });
15280}
15281
15282#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
15283(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUCompilationInfo>, _can_gc: CanGc) -> DomRoot<D::GPUCompilationInfo>{
15284
15285 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
15286
15287 let scope = scope.reflector().get_jsobject();
15288 assert!(!scope.get().is_null());
15289 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
15290 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
15291
15292 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
15293 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
15294 assert!(!canonical_proto.is_null());
15295
15296
15297 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
15298 if let Some(given) = given_proto {
15299 proto.set(*given);
15300 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
15301 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
15302 }
15303 } else {
15304 proto.set(*canonical_proto);
15305 }
15306 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
15307 cx.raw_cx(),
15308 &Class.get().base,
15309 proto.handle(),
15310 ));
15311 assert!(!obj.is_null());
15312 JS_SetReservedSlot(
15313 obj.get(),
15314 DOM_OBJECT_SLOT,
15315 &PrivateValue(raw.as_ptr() as *const libc::c_void),
15316 );
15317
15318 let root = raw.reflect_with(obj.get());
15319
15320
15321
15322 DomRoot::from_ref(&*root)
15323}
15324
15325pub trait GPUCompilationInfoMethods<D: DomTypes> {
15326 fn Messages(&self, r#cx: SafeJSContext, r#_can_gc: CanGc, r#retval: MutableHandleValue);
15327}
15328static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
15329
15330pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
15331 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
15332 JSPropertySpec {
15333 name: JSPropertySpec_Name { string_: c"messages".as_ptr() },
15334 attributes_: (JSPROP_ENUMERATE),
15335 kind_: (JSPropertySpec_Kind::NativeAccessor),
15336 u: JSPropertySpec_AccessorsOrValue {
15337 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
15338 getter: JSPropertySpec_Accessor {
15339 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { messages_getterinfo.get() } },
15340 },
15341 setter: JSPropertySpec_Accessor {
15342 native: JSNativeWrapper { op: None, info: ptr::null() },
15343 }
15344 }
15345 }
15346 }
15347,
15348 JSPropertySpec::ZERO]))[..]
15349,
15350&Box::leak(Box::new([
15351 JSPropertySpec {
15352 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
15353 attributes_: (JSPROP_READONLY),
15354 kind_: (JSPropertySpec_Kind::Value),
15355 u: JSPropertySpec_AccessorsOrValue {
15356 value: JSPropertySpec_ValueWrapper {
15357 type_: JSPropertySpec_ValueWrapper_Type::String,
15358 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
15359 string: c"GPUCompilationInfo".as_ptr(),
15360 }
15361 }
15362 }
15363 }
15364,
15365 JSPropertySpec::ZERO]))[..]
15366])));
15367}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
15368
15369pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
15370 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
15371 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
15372}
15373pub fn GetProtoObject<D: DomTypes>
15374(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
15375 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUCompilationInfo), CreateInterfaceObjects::<D>, rval)
15377}
15378
15379
15380static PrototypeClass: JSClass = JSClass {
15381 name: c"GPUCompilationInfoPrototype".as_ptr(),
15382 flags:
15383 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
15385 cOps: ptr::null(),
15386 spec: ptr::null(),
15387 ext: ptr::null(),
15388 oOps: ptr::null(),
15389};
15390
15391
15392static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
15393
15394pub(crate) fn init_interface_object<D: DomTypes>() {
15395 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
15396 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
15397 b"function GPUCompilationInfo() {\n [native code]\n}",
15398 PrototypeList::ID::GPUCompilationInfo,
15399 0,
15400 ));
15401}
15402
15403pub fn DefineDOMInterface<D: DomTypes>
15404(cx: SafeJSContext, global: HandleObject){
15405 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUCompilationInfo),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
15406}
15407
15408pub fn ConstructorEnabled<D: DomTypes>
15409(aCx: SafeJSContext, aObj: HandleObject) -> bool{
15410 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
15411 pref!(dom_webgpu_enabled)
15412}
15413
15414unsafe fn CreateInterfaceObjects<D: DomTypes>
15415(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
15416
15417 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
15418 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
15419 assert!(!prototype_proto.is_null());
15420
15421 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
15422 create_interface_prototype_object::<D>(cx,
15423 global,
15424 prototype_proto.handle(),
15425 &PrototypeClass,
15426 &[],
15427 sAttributes.get(),
15428 &[],
15429 &[],
15430 prototype.handle_mut());
15431 assert!(!prototype.is_null());
15432 assert!((*cache)[PrototypeList::ID::GPUCompilationInfo as usize].is_null());
15433 (*cache)[PrototypeList::ID::GPUCompilationInfo as usize] = prototype.get();
15434 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUCompilationInfo as isize),
15435 ptr::null_mut(),
15436 prototype.get());
15437
15438 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
15439 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
15440
15441 assert!(!interface_proto.is_null());
15442
15443 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
15444 create_noncallback_interface_object::<D>(cx,
15445 global,
15446 interface_proto.handle(),
15447 INTERFACE_OBJECT_CLASS.get(),
15448 &[],
15449 &[],
15450 &[],
15451 prototype.handle(),
15452 c"GPUCompilationInfo",
15453 0,
15454 &[],
15455 interface.handle_mut());
15456 assert!(!interface.is_null());
15457}
15458
15459
15460 pub(crate) fn init_statics<D: DomTypes>() {
15461 init_interface_object::<D>();
15462 init_domjs_class::<D>();
15463
15464 init_messages_getterinfo::<D>();
15465
15466
15467 init_sAttributes_specs::<D>();
15468init_sAttributes_prefs::<D>();
15469 }
15470 } pub use self::GPUCompilationMessage_Binding::{Wrap as GPUCompilationMessageWrap, GPUCompilationMessageMethods, GetProtoObject as GPUCompilationMessageGetProtoObject, DefineDOMInterface as GPUCompilationMessageDefineDOMInterface};
15474pub mod GPUCompilationMessage_Binding {
15475use crate::codegen::GenericBindings::WebGPUBinding::GPUCompilationMessageType;
15476use crate::codegen::GenericBindings::WebGPUBinding::GPUCompilationMessageTypeValues;
15477use crate::import::module::*;
15478
15479unsafe extern "C" fn get_message<D: DomTypes>
15480(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
15481 let mut result = false;
15482 wrap_panic(&mut || result = (|| {
15483 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
15484 let this = &*(this as *const D::GPUCompilationMessage);
15485 let result: DOMString = this.Message();
15486
15487 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
15488 return true;
15489 })());
15490 result
15491}
15492
15493
15494static message_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
15495
15496pub(crate) fn init_message_getterinfo<D: DomTypes>() {
15497 message_getterinfo.set(JSJitInfo {
15498 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
15499 getter: Some(get_message::<D>)
15500 },
15501 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
15502 protoID: PrototypeList::ID::GPUCompilationMessage as u16,
15503 },
15504 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
15505 _bitfield_align_1: [],
15506 _bitfield_1: __BindgenBitfieldUnit::new(
15507 new_jsjitinfo_bitfield_1!(
15508 JSJitInfo_OpType::Getter as u8,
15509 JSJitInfo_AliasSet::AliasEverything as u8,
15510 JSValueType::JSVAL_TYPE_STRING as u8,
15511 true,
15512 false,
15513 false,
15514 false,
15515 false,
15516 false,
15517 0,
15518 ).to_ne_bytes()
15519 ),
15520});
15521}
15522unsafe extern "C" fn get_type<D: DomTypes>
15523(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
15524 let mut result = false;
15525 wrap_panic(&mut || result = (|| {
15526 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
15527 let this = &*(this as *const D::GPUCompilationMessage);
15528 let result: GPUCompilationMessageType = this.Type();
15529
15530 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
15531 return true;
15532 })());
15533 result
15534}
15535
15536
15537static type_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
15538
15539pub(crate) fn init_type_getterinfo<D: DomTypes>() {
15540 type_getterinfo.set(JSJitInfo {
15541 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
15542 getter: Some(get_type::<D>)
15543 },
15544 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
15545 protoID: PrototypeList::ID::GPUCompilationMessage as u16,
15546 },
15547 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
15548 _bitfield_align_1: [],
15549 _bitfield_1: __BindgenBitfieldUnit::new(
15550 new_jsjitinfo_bitfield_1!(
15551 JSJitInfo_OpType::Getter as u8,
15552 JSJitInfo_AliasSet::AliasEverything as u8,
15553 JSValueType::JSVAL_TYPE_STRING as u8,
15554 true,
15555 false,
15556 false,
15557 false,
15558 false,
15559 false,
15560 0,
15561 ).to_ne_bytes()
15562 ),
15563});
15564}
15565unsafe extern "C" fn get_lineNum<D: DomTypes>
15566(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
15567 let mut result = false;
15568 wrap_panic(&mut || result = (|| {
15569 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
15570 let this = &*(this as *const D::GPUCompilationMessage);
15571 let result: u64 = this.LineNum();
15572
15573 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
15574 return true;
15575 })());
15576 result
15577}
15578
15579
15580static lineNum_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
15581
15582pub(crate) fn init_lineNum_getterinfo<D: DomTypes>() {
15583 lineNum_getterinfo.set(JSJitInfo {
15584 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
15585 getter: Some(get_lineNum::<D>)
15586 },
15587 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
15588 protoID: PrototypeList::ID::GPUCompilationMessage as u16,
15589 },
15590 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
15591 _bitfield_align_1: [],
15592 _bitfield_1: __BindgenBitfieldUnit::new(
15593 new_jsjitinfo_bitfield_1!(
15594 JSJitInfo_OpType::Getter as u8,
15595 JSJitInfo_AliasSet::AliasEverything as u8,
15596 JSValueType::JSVAL_TYPE_DOUBLE as u8,
15597 true,
15598 false,
15599 false,
15600 false,
15601 false,
15602 false,
15603 0,
15604 ).to_ne_bytes()
15605 ),
15606});
15607}
15608unsafe extern "C" fn get_linePos<D: DomTypes>
15609(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
15610 let mut result = false;
15611 wrap_panic(&mut || result = (|| {
15612 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
15613 let this = &*(this as *const D::GPUCompilationMessage);
15614 let result: u64 = this.LinePos();
15615
15616 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
15617 return true;
15618 })());
15619 result
15620}
15621
15622
15623static linePos_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
15624
15625pub(crate) fn init_linePos_getterinfo<D: DomTypes>() {
15626 linePos_getterinfo.set(JSJitInfo {
15627 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
15628 getter: Some(get_linePos::<D>)
15629 },
15630 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
15631 protoID: PrototypeList::ID::GPUCompilationMessage as u16,
15632 },
15633 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
15634 _bitfield_align_1: [],
15635 _bitfield_1: __BindgenBitfieldUnit::new(
15636 new_jsjitinfo_bitfield_1!(
15637 JSJitInfo_OpType::Getter as u8,
15638 JSJitInfo_AliasSet::AliasEverything as u8,
15639 JSValueType::JSVAL_TYPE_DOUBLE as u8,
15640 true,
15641 false,
15642 false,
15643 false,
15644 false,
15645 false,
15646 0,
15647 ).to_ne_bytes()
15648 ),
15649});
15650}
15651unsafe extern "C" fn get_offset<D: DomTypes>
15652(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
15653 let mut result = false;
15654 wrap_panic(&mut || result = (|| {
15655 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
15656 let this = &*(this as *const D::GPUCompilationMessage);
15657 let result: u64 = this.Offset();
15658
15659 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
15660 return true;
15661 })());
15662 result
15663}
15664
15665
15666static offset_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
15667
15668pub(crate) fn init_offset_getterinfo<D: DomTypes>() {
15669 offset_getterinfo.set(JSJitInfo {
15670 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
15671 getter: Some(get_offset::<D>)
15672 },
15673 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
15674 protoID: PrototypeList::ID::GPUCompilationMessage as u16,
15675 },
15676 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
15677 _bitfield_align_1: [],
15678 _bitfield_1: __BindgenBitfieldUnit::new(
15679 new_jsjitinfo_bitfield_1!(
15680 JSJitInfo_OpType::Getter as u8,
15681 JSJitInfo_AliasSet::AliasEverything as u8,
15682 JSValueType::JSVAL_TYPE_DOUBLE as u8,
15683 true,
15684 false,
15685 false,
15686 false,
15687 false,
15688 false,
15689 0,
15690 ).to_ne_bytes()
15691 ),
15692});
15693}
15694unsafe extern "C" fn get_length<D: DomTypes>
15695(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
15696 let mut result = false;
15697 wrap_panic(&mut || result = (|| {
15698 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
15699 let this = &*(this as *const D::GPUCompilationMessage);
15700 let result: u64 = this.Length();
15701
15702 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
15703 return true;
15704 })());
15705 result
15706}
15707
15708
15709static length_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
15710
15711pub(crate) fn init_length_getterinfo<D: DomTypes>() {
15712 length_getterinfo.set(JSJitInfo {
15713 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
15714 getter: Some(get_length::<D>)
15715 },
15716 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
15717 protoID: PrototypeList::ID::GPUCompilationMessage as u16,
15718 },
15719 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
15720 _bitfield_align_1: [],
15721 _bitfield_1: __BindgenBitfieldUnit::new(
15722 new_jsjitinfo_bitfield_1!(
15723 JSJitInfo_OpType::Getter as u8,
15724 JSJitInfo_AliasSet::AliasEverything as u8,
15725 JSValueType::JSVAL_TYPE_DOUBLE as u8,
15726 true,
15727 false,
15728 false,
15729 false,
15730 false,
15731 false,
15732 0,
15733 ).to_ne_bytes()
15734 ),
15735});
15736}
15737unsafe extern "C" fn _finalize<D: DomTypes>
15738(_cx: *mut GCContext, obj: *mut JSObject){
15739 wrap_panic(&mut || {
15740
15741 let this = native_from_object_static::<D::GPUCompilationMessage>(obj).unwrap();
15742 finalize_common(this);
15743 })
15744}
15745
15746unsafe extern "C" fn _trace<D: DomTypes>
15747(trc: *mut JSTracer, obj: *mut JSObject){
15748 wrap_panic(&mut || {
15749
15750 let this = native_from_object_static::<D::GPUCompilationMessage>(obj).unwrap();
15751 if this.is_null() { return; } (*this).trace(trc);
15753 })
15754}
15755
15756
15757static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
15758
15759pub(crate) fn init_class_ops<D: DomTypes>() {
15760 CLASS_OPS.set(JSClassOps {
15761 addProperty: None,
15762 delProperty: None,
15763 enumerate: None,
15764 newEnumerate: None,
15765 resolve: None,
15766 mayResolve: None,
15767 finalize: Some(_finalize::<D>),
15768 call: None,
15769 construct: None,
15770 trace: Some(_trace::<D>),
15771 });
15772}
15773
15774pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
15775
15776pub(crate) fn init_domjs_class<D: DomTypes>() {
15777 init_class_ops::<D>();
15778 Class.set(DOMJSClass {
15779 base: JSClass {
15780 name: c"GPUCompilationMessage".as_ptr(),
15781 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
15782 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
15783 ,
15784 cOps: unsafe { CLASS_OPS.get() },
15785 spec: ptr::null(),
15786 ext: ptr::null(),
15787 oOps: ptr::null(),
15788 },
15789 dom_class:
15790DOMClass {
15791 interface_chain: [ PrototypeList::ID::GPUCompilationMessage, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
15792 depth: 0,
15793 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
15794 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUCompilationMessage> as unsafe fn(&mut _, _) -> _,
15795 global: Globals::EMPTY,
15796},
15797 });
15798}
15799
15800#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
15801(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUCompilationMessage>, _can_gc: CanGc) -> DomRoot<D::GPUCompilationMessage>{
15802
15803 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
15804
15805 let scope = scope.reflector().get_jsobject();
15806 assert!(!scope.get().is_null());
15807 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
15808 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
15809
15810 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
15811 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
15812 assert!(!canonical_proto.is_null());
15813
15814
15815 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
15816 if let Some(given) = given_proto {
15817 proto.set(*given);
15818 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
15819 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
15820 }
15821 } else {
15822 proto.set(*canonical_proto);
15823 }
15824 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
15825 cx.raw_cx(),
15826 &Class.get().base,
15827 proto.handle(),
15828 ));
15829 assert!(!obj.is_null());
15830 JS_SetReservedSlot(
15831 obj.get(),
15832 DOM_OBJECT_SLOT,
15833 &PrivateValue(raw.as_ptr() as *const libc::c_void),
15834 );
15835
15836 let root = raw.reflect_with(obj.get());
15837
15838
15839
15840 DomRoot::from_ref(&*root)
15841}
15842
15843pub trait GPUCompilationMessageMethods<D: DomTypes> {
15844 fn Message(&self, ) -> DOMString;
15845 fn Type(&self, ) -> GPUCompilationMessageType;
15846 fn LineNum(&self, ) -> u64;
15847 fn LinePos(&self, ) -> u64;
15848 fn Offset(&self, ) -> u64;
15849 fn Length(&self, ) -> u64;
15850}
15851static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
15852
15853pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
15854 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
15855 JSPropertySpec {
15856 name: JSPropertySpec_Name { string_: c"message".as_ptr() },
15857 attributes_: (JSPROP_ENUMERATE),
15858 kind_: (JSPropertySpec_Kind::NativeAccessor),
15859 u: JSPropertySpec_AccessorsOrValue {
15860 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
15861 getter: JSPropertySpec_Accessor {
15862 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { message_getterinfo.get() } },
15863 },
15864 setter: JSPropertySpec_Accessor {
15865 native: JSNativeWrapper { op: None, info: ptr::null() },
15866 }
15867 }
15868 }
15869 }
15870,
15871 JSPropertySpec {
15872 name: JSPropertySpec_Name { string_: c"type".as_ptr() },
15873 attributes_: (JSPROP_ENUMERATE),
15874 kind_: (JSPropertySpec_Kind::NativeAccessor),
15875 u: JSPropertySpec_AccessorsOrValue {
15876 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
15877 getter: JSPropertySpec_Accessor {
15878 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { type_getterinfo.get() } },
15879 },
15880 setter: JSPropertySpec_Accessor {
15881 native: JSNativeWrapper { op: None, info: ptr::null() },
15882 }
15883 }
15884 }
15885 }
15886,
15887 JSPropertySpec {
15888 name: JSPropertySpec_Name { string_: c"lineNum".as_ptr() },
15889 attributes_: (JSPROP_ENUMERATE),
15890 kind_: (JSPropertySpec_Kind::NativeAccessor),
15891 u: JSPropertySpec_AccessorsOrValue {
15892 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
15893 getter: JSPropertySpec_Accessor {
15894 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { lineNum_getterinfo.get() } },
15895 },
15896 setter: JSPropertySpec_Accessor {
15897 native: JSNativeWrapper { op: None, info: ptr::null() },
15898 }
15899 }
15900 }
15901 }
15902,
15903 JSPropertySpec {
15904 name: JSPropertySpec_Name { string_: c"linePos".as_ptr() },
15905 attributes_: (JSPROP_ENUMERATE),
15906 kind_: (JSPropertySpec_Kind::NativeAccessor),
15907 u: JSPropertySpec_AccessorsOrValue {
15908 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
15909 getter: JSPropertySpec_Accessor {
15910 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { linePos_getterinfo.get() } },
15911 },
15912 setter: JSPropertySpec_Accessor {
15913 native: JSNativeWrapper { op: None, info: ptr::null() },
15914 }
15915 }
15916 }
15917 }
15918,
15919 JSPropertySpec {
15920 name: JSPropertySpec_Name { string_: c"offset".as_ptr() },
15921 attributes_: (JSPROP_ENUMERATE),
15922 kind_: (JSPropertySpec_Kind::NativeAccessor),
15923 u: JSPropertySpec_AccessorsOrValue {
15924 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
15925 getter: JSPropertySpec_Accessor {
15926 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { offset_getterinfo.get() } },
15927 },
15928 setter: JSPropertySpec_Accessor {
15929 native: JSNativeWrapper { op: None, info: ptr::null() },
15930 }
15931 }
15932 }
15933 }
15934,
15935 JSPropertySpec {
15936 name: JSPropertySpec_Name { string_: c"length".as_ptr() },
15937 attributes_: (JSPROP_ENUMERATE),
15938 kind_: (JSPropertySpec_Kind::NativeAccessor),
15939 u: JSPropertySpec_AccessorsOrValue {
15940 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
15941 getter: JSPropertySpec_Accessor {
15942 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { length_getterinfo.get() } },
15943 },
15944 setter: JSPropertySpec_Accessor {
15945 native: JSNativeWrapper { op: None, info: ptr::null() },
15946 }
15947 }
15948 }
15949 }
15950,
15951 JSPropertySpec::ZERO]))[..]
15952,
15953&Box::leak(Box::new([
15954 JSPropertySpec {
15955 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
15956 attributes_: (JSPROP_READONLY),
15957 kind_: (JSPropertySpec_Kind::Value),
15958 u: JSPropertySpec_AccessorsOrValue {
15959 value: JSPropertySpec_ValueWrapper {
15960 type_: JSPropertySpec_ValueWrapper_Type::String,
15961 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
15962 string: c"GPUCompilationMessage".as_ptr(),
15963 }
15964 }
15965 }
15966 }
15967,
15968 JSPropertySpec::ZERO]))[..]
15969])));
15970}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
15971
15972pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
15973 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
15974 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
15975}
15976pub fn GetProtoObject<D: DomTypes>
15977(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
15978 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUCompilationMessage), CreateInterfaceObjects::<D>, rval)
15980}
15981
15982
15983static PrototypeClass: JSClass = JSClass {
15984 name: c"GPUCompilationMessagePrototype".as_ptr(),
15985 flags:
15986 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
15988 cOps: ptr::null(),
15989 spec: ptr::null(),
15990 ext: ptr::null(),
15991 oOps: ptr::null(),
15992};
15993
15994
15995static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
15996
15997pub(crate) fn init_interface_object<D: DomTypes>() {
15998 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
15999 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
16000 b"function GPUCompilationMessage() {\n [native code]\n}",
16001 PrototypeList::ID::GPUCompilationMessage,
16002 0,
16003 ));
16004}
16005
16006pub fn DefineDOMInterface<D: DomTypes>
16007(cx: SafeJSContext, global: HandleObject){
16008 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUCompilationMessage),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
16009}
16010
16011pub fn ConstructorEnabled<D: DomTypes>
16012(aCx: SafeJSContext, aObj: HandleObject) -> bool{
16013 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
16014 pref!(dom_webgpu_enabled)
16015}
16016
16017unsafe fn CreateInterfaceObjects<D: DomTypes>
16018(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
16019
16020 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
16021 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
16022 assert!(!prototype_proto.is_null());
16023
16024 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
16025 create_interface_prototype_object::<D>(cx,
16026 global,
16027 prototype_proto.handle(),
16028 &PrototypeClass,
16029 &[],
16030 sAttributes.get(),
16031 &[],
16032 &[],
16033 prototype.handle_mut());
16034 assert!(!prototype.is_null());
16035 assert!((*cache)[PrototypeList::ID::GPUCompilationMessage as usize].is_null());
16036 (*cache)[PrototypeList::ID::GPUCompilationMessage as usize] = prototype.get();
16037 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUCompilationMessage as isize),
16038 ptr::null_mut(),
16039 prototype.get());
16040
16041 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
16042 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
16043
16044 assert!(!interface_proto.is_null());
16045
16046 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
16047 create_noncallback_interface_object::<D>(cx,
16048 global,
16049 interface_proto.handle(),
16050 INTERFACE_OBJECT_CLASS.get(),
16051 &[],
16052 &[],
16053 &[],
16054 prototype.handle(),
16055 c"GPUCompilationMessage",
16056 0,
16057 &[],
16058 interface.handle_mut());
16059 assert!(!interface.is_null());
16060}
16061
16062
16063 pub(crate) fn init_statics<D: DomTypes>() {
16064 init_interface_object::<D>();
16065 init_domjs_class::<D>();
16066
16067 init_message_getterinfo::<D>();
16068init_type_getterinfo::<D>();
16069init_lineNum_getterinfo::<D>();
16070init_linePos_getterinfo::<D>();
16071init_offset_getterinfo::<D>();
16072init_length_getterinfo::<D>();
16073
16074
16075 init_sAttributes_specs::<D>();
16076init_sAttributes_prefs::<D>();
16077 }
16078 } pub use self::GPUComputePassEncoder_Binding::{Wrap as GPUComputePassEncoderWrap, GPUComputePassEncoderMethods, GetProtoObject as GPUComputePassEncoderGetProtoObject, DefineDOMInterface as GPUComputePassEncoderDefineDOMInterface};
16082pub mod GPUComputePassEncoder_Binding {
16083use crate::import::module::*;
16084
16085unsafe extern "C" fn setPipeline<D: DomTypes>
16086(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
16087 let mut result = false;
16088 wrap_panic(&mut || result = (|| {
16089 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
16090 let this = &*(this as *const D::GPUComputePassEncoder);
16091 let args = &*args;
16092 let argc = args.argc_;
16093
16094 if argc < 1 {
16095 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUComputePassEncoder.setPipeline\".");
16096 return false;
16097 }
16098 let arg0: DomRoot<D::GPUComputePipeline> = if HandleValue::from_raw(args.get(0)).get().is_object() {
16099 match root_from_handlevalue(HandleValue::from_raw(args.get(0)), SafeJSContext::from_ptr(cx.raw_cx())) {
16100 Ok(val) => val,
16101 Err(()) => {
16102 throw_type_error(cx.raw_cx(), "value does not implement interface GPUComputePipeline.");
16103 return false;
16104
16105 }
16106 }
16107
16108 } else {
16109 throw_type_error(cx.raw_cx(), "Value is not an object.");
16110 return false;
16111
16112 };
16113 let result: () = this.SetPipeline(&arg0);
16114
16115 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
16116 return true;
16117 })());
16118 result
16119}
16120
16121
16122static setPipeline_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
16123
16124pub(crate) fn init_setPipeline_methodinfo<D: DomTypes>() {
16125 setPipeline_methodinfo.set(JSJitInfo {
16126 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
16127 method: Some(setPipeline::<D>)
16128 },
16129 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
16130 protoID: PrototypeList::ID::GPUComputePassEncoder as u16,
16131 },
16132 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
16133 _bitfield_align_1: [],
16134 _bitfield_1: __BindgenBitfieldUnit::new(
16135 new_jsjitinfo_bitfield_1!(
16136 JSJitInfo_OpType::Method as u8,
16137 JSJitInfo_AliasSet::AliasEverything as u8,
16138 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
16139 false,
16140 false,
16141 false,
16142 false,
16143 false,
16144 false,
16145 0,
16146 ).to_ne_bytes()
16147 ),
16148});
16149}
16150unsafe extern "C" fn dispatchWorkgroups<D: DomTypes>
16151(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
16152 let mut result = false;
16153 wrap_panic(&mut || result = (|| {
16154 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
16155 let this = &*(this as *const D::GPUComputePassEncoder);
16156 let args = &*args;
16157 let argc = args.argc_;
16158
16159 if argc < 1 {
16160 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUComputePassEncoder.dispatchWorkgroups\".");
16161 return false;
16162 }
16163 let arg0: u32 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
16164 Ok(ConversionResult::Success(value)) => value,
16165 Ok(ConversionResult::Failure(error)) => {
16166 throw_type_error(cx.raw_cx(), &error);
16167 return false;
16168
16169 }
16170 _ => {
16171 return false;
16172
16173 },
16174 }
16175 ;
16176 let arg1: u32 = if args.get(1).is_undefined() {
16177 1
16178 } else {
16179 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
16180 Ok(ConversionResult::Success(value)) => value,
16181 Ok(ConversionResult::Failure(error)) => {
16182 throw_type_error(cx.raw_cx(), &error);
16183 return false;
16184
16185 }
16186 _ => {
16187 return false;
16188
16189 },
16190 }
16191
16192 };
16193 let arg2: u32 = if args.get(2).is_undefined() {
16194 1
16195 } else {
16196 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
16197 Ok(ConversionResult::Success(value)) => value,
16198 Ok(ConversionResult::Failure(error)) => {
16199 throw_type_error(cx.raw_cx(), &error);
16200 return false;
16201
16202 }
16203 _ => {
16204 return false;
16205
16206 },
16207 }
16208
16209 };
16210 let result: () = this.DispatchWorkgroups(arg0, arg1, arg2);
16211
16212 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
16213 return true;
16214 })());
16215 result
16216}
16217
16218
16219static dispatchWorkgroups_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
16220
16221pub(crate) fn init_dispatchWorkgroups_methodinfo<D: DomTypes>() {
16222 dispatchWorkgroups_methodinfo.set(JSJitInfo {
16223 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
16224 method: Some(dispatchWorkgroups::<D>)
16225 },
16226 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
16227 protoID: PrototypeList::ID::GPUComputePassEncoder as u16,
16228 },
16229 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
16230 _bitfield_align_1: [],
16231 _bitfield_1: __BindgenBitfieldUnit::new(
16232 new_jsjitinfo_bitfield_1!(
16233 JSJitInfo_OpType::Method as u8,
16234 JSJitInfo_AliasSet::AliasEverything as u8,
16235 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
16236 false,
16237 false,
16238 false,
16239 false,
16240 false,
16241 false,
16242 0,
16243 ).to_ne_bytes()
16244 ),
16245});
16246}
16247unsafe extern "C" fn dispatchWorkgroupsIndirect<D: DomTypes>
16248(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
16249 let mut result = false;
16250 wrap_panic(&mut || result = (|| {
16251 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
16252 let this = &*(this as *const D::GPUComputePassEncoder);
16253 let args = &*args;
16254 let argc = args.argc_;
16255
16256 if argc < 2 {
16257 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUComputePassEncoder.dispatchWorkgroupsIndirect\".");
16258 return false;
16259 }
16260 let arg0: DomRoot<D::GPUBuffer> = if HandleValue::from_raw(args.get(0)).get().is_object() {
16261 match root_from_handlevalue(HandleValue::from_raw(args.get(0)), SafeJSContext::from_ptr(cx.raw_cx())) {
16262 Ok(val) => val,
16263 Err(()) => {
16264 throw_type_error(cx.raw_cx(), "value does not implement interface GPUBuffer.");
16265 return false;
16266
16267 }
16268 }
16269
16270 } else {
16271 throw_type_error(cx.raw_cx(), "Value is not an object.");
16272 return false;
16273
16274 };
16275 let arg1: u64 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
16276 Ok(ConversionResult::Success(value)) => value,
16277 Ok(ConversionResult::Failure(error)) => {
16278 throw_type_error(cx.raw_cx(), &error);
16279 return false;
16280
16281 }
16282 _ => {
16283 return false;
16284
16285 },
16286 }
16287 ;
16288 let result: () = this.DispatchWorkgroupsIndirect(&arg0, arg1);
16289
16290 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
16291 return true;
16292 })());
16293 result
16294}
16295
16296
16297static dispatchWorkgroupsIndirect_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
16298
16299pub(crate) fn init_dispatchWorkgroupsIndirect_methodinfo<D: DomTypes>() {
16300 dispatchWorkgroupsIndirect_methodinfo.set(JSJitInfo {
16301 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
16302 method: Some(dispatchWorkgroupsIndirect::<D>)
16303 },
16304 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
16305 protoID: PrototypeList::ID::GPUComputePassEncoder as u16,
16306 },
16307 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
16308 _bitfield_align_1: [],
16309 _bitfield_1: __BindgenBitfieldUnit::new(
16310 new_jsjitinfo_bitfield_1!(
16311 JSJitInfo_OpType::Method as u8,
16312 JSJitInfo_AliasSet::AliasEverything as u8,
16313 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
16314 false,
16315 false,
16316 false,
16317 false,
16318 false,
16319 false,
16320 0,
16321 ).to_ne_bytes()
16322 ),
16323});
16324}
16325unsafe extern "C" fn end<D: DomTypes>
16326(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
16327 let mut result = false;
16328 wrap_panic(&mut || result = (|| {
16329 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
16330 let this = &*(this as *const D::GPUComputePassEncoder);
16331 let args = &*args;
16332 let argc = args.argc_;
16333 let result: () = this.End();
16334
16335 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
16336 return true;
16337 })());
16338 result
16339}
16340
16341
16342static end_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
16343
16344pub(crate) fn init_end_methodinfo<D: DomTypes>() {
16345 end_methodinfo.set(JSJitInfo {
16346 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
16347 method: Some(end::<D>)
16348 },
16349 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
16350 protoID: PrototypeList::ID::GPUComputePassEncoder as u16,
16351 },
16352 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
16353 _bitfield_align_1: [],
16354 _bitfield_1: __BindgenBitfieldUnit::new(
16355 new_jsjitinfo_bitfield_1!(
16356 JSJitInfo_OpType::Method as u8,
16357 JSJitInfo_AliasSet::AliasEverything as u8,
16358 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
16359 true,
16360 false,
16361 false,
16362 false,
16363 false,
16364 false,
16365 0,
16366 ).to_ne_bytes()
16367 ),
16368});
16369}
16370unsafe extern "C" fn get_label<D: DomTypes>
16371(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
16372 let mut result = false;
16373 wrap_panic(&mut || result = (|| {
16374 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
16375 let this = &*(this as *const D::GPUComputePassEncoder);
16376 let result: USVString = this.Label();
16377
16378 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
16379 return true;
16380 })());
16381 result
16382}
16383
16384unsafe extern "C" fn set_label<D: DomTypes>
16385(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
16386 let mut result = false;
16387 wrap_panic(&mut || result = (|| {
16388 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
16389 let this = &*(this as *const D::GPUComputePassEncoder);
16390 let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
16391 Ok(ConversionResult::Success(value)) => value,
16392 Ok(ConversionResult::Failure(error)) => {
16393 throw_type_error(cx.raw_cx(), &error);
16394 return false;
16395
16396 }
16397 _ => {
16398 return false;
16399
16400 },
16401 }
16402 ;
16403 let result: () = this.SetLabel(arg0);
16404
16405 true
16406 })());
16407 result
16408}
16409
16410
16411static label_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
16412
16413pub(crate) fn init_label_getterinfo<D: DomTypes>() {
16414 label_getterinfo.set(JSJitInfo {
16415 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
16416 getter: Some(get_label::<D>)
16417 },
16418 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
16419 protoID: PrototypeList::ID::GPUComputePassEncoder as u16,
16420 },
16421 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
16422 _bitfield_align_1: [],
16423 _bitfield_1: __BindgenBitfieldUnit::new(
16424 new_jsjitinfo_bitfield_1!(
16425 JSJitInfo_OpType::Getter as u8,
16426 JSJitInfo_AliasSet::AliasEverything as u8,
16427 JSValueType::JSVAL_TYPE_STRING as u8,
16428 true,
16429 false,
16430 false,
16431 false,
16432 false,
16433 false,
16434 0,
16435 ).to_ne_bytes()
16436 ),
16437});
16438}
16439static label_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
16440
16441pub(crate) fn init_label_setterinfo<D: DomTypes>() {
16442 label_setterinfo.set(JSJitInfo {
16443 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
16444 setter: Some(set_label::<D>)
16445 },
16446 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
16447 protoID: PrototypeList::ID::GPUComputePassEncoder as u16,
16448 },
16449 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
16450 _bitfield_align_1: [],
16451 _bitfield_1: __BindgenBitfieldUnit::new(
16452 new_jsjitinfo_bitfield_1!(
16453 JSJitInfo_OpType::Setter as u8,
16454 JSJitInfo_AliasSet::AliasEverything as u8,
16455 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
16456 false,
16457 false,
16458 false,
16459 false,
16460 false,
16461 false,
16462 0,
16463 ).to_ne_bytes()
16464 ),
16465});
16466}
16467unsafe extern "C" fn setBindGroup<D: DomTypes>
16468(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
16469 let mut result = false;
16470 wrap_panic(&mut || result = (|| {
16471 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
16472 let this = &*(this as *const D::GPUComputePassEncoder);
16473 let args = &*args;
16474 let argc = args.argc_;
16475
16476 if argc < 2 {
16477 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUComputePassEncoder.setBindGroup\".");
16478 return false;
16479 }
16480 let arg0: u32 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
16481 Ok(ConversionResult::Success(value)) => value,
16482 Ok(ConversionResult::Failure(error)) => {
16483 throw_type_error(cx.raw_cx(), &error);
16484 return false;
16485
16486 }
16487 _ => {
16488 return false;
16489
16490 },
16491 }
16492 ;
16493 let arg1: DomRoot<D::GPUBindGroup> = if HandleValue::from_raw(args.get(1)).get().is_object() {
16494 match root_from_handlevalue(HandleValue::from_raw(args.get(1)), SafeJSContext::from_ptr(cx.raw_cx())) {
16495 Ok(val) => val,
16496 Err(()) => {
16497 throw_type_error(cx.raw_cx(), "value does not implement interface GPUBindGroup.");
16498 return false;
16499
16500 }
16501 }
16502
16503 } else {
16504 throw_type_error(cx.raw_cx(), "Value is not an object.");
16505 return false;
16506
16507 };
16508 let arg2: Vec<u32> = if args.get(2).is_undefined() {
16509 Vec::new()
16510 } else {
16511 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
16512 Ok(ConversionResult::Success(value)) => value,
16513 Ok(ConversionResult::Failure(error)) => {
16514 throw_type_error(cx.raw_cx(), &error);
16515 return false;
16516
16517 }
16518 _ => {
16519 return false;
16520
16521 },
16522 }
16523
16524 };
16525 let result: () = this.SetBindGroup(arg0, &arg1, arg2);
16526
16527 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
16528 return true;
16529 })());
16530 result
16531}
16532
16533
16534static setBindGroup_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
16535
16536pub(crate) fn init_setBindGroup_methodinfo<D: DomTypes>() {
16537 setBindGroup_methodinfo.set(JSJitInfo {
16538 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
16539 method: Some(setBindGroup::<D>)
16540 },
16541 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
16542 protoID: PrototypeList::ID::GPUComputePassEncoder as u16,
16543 },
16544 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
16545 _bitfield_align_1: [],
16546 _bitfield_1: __BindgenBitfieldUnit::new(
16547 new_jsjitinfo_bitfield_1!(
16548 JSJitInfo_OpType::Method as u8,
16549 JSJitInfo_AliasSet::AliasEverything as u8,
16550 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
16551 false,
16552 false,
16553 false,
16554 false,
16555 false,
16556 false,
16557 0,
16558 ).to_ne_bytes()
16559 ),
16560});
16561}
16562unsafe extern "C" fn _finalize<D: DomTypes>
16563(_cx: *mut GCContext, obj: *mut JSObject){
16564 wrap_panic(&mut || {
16565
16566 let this = native_from_object_static::<D::GPUComputePassEncoder>(obj).unwrap();
16567 finalize_common(this);
16568 })
16569}
16570
16571unsafe extern "C" fn _trace<D: DomTypes>
16572(trc: *mut JSTracer, obj: *mut JSObject){
16573 wrap_panic(&mut || {
16574
16575 let this = native_from_object_static::<D::GPUComputePassEncoder>(obj).unwrap();
16576 if this.is_null() { return; } (*this).trace(trc);
16578 })
16579}
16580
16581
16582static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
16583
16584pub(crate) fn init_class_ops<D: DomTypes>() {
16585 CLASS_OPS.set(JSClassOps {
16586 addProperty: None,
16587 delProperty: None,
16588 enumerate: None,
16589 newEnumerate: None,
16590 resolve: None,
16591 mayResolve: None,
16592 finalize: Some(_finalize::<D>),
16593 call: None,
16594 construct: None,
16595 trace: Some(_trace::<D>),
16596 });
16597}
16598
16599pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
16600
16601pub(crate) fn init_domjs_class<D: DomTypes>() {
16602 init_class_ops::<D>();
16603 Class.set(DOMJSClass {
16604 base: JSClass {
16605 name: c"GPUComputePassEncoder".as_ptr(),
16606 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
16607 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
16608 ,
16609 cOps: unsafe { CLASS_OPS.get() },
16610 spec: ptr::null(),
16611 ext: ptr::null(),
16612 oOps: ptr::null(),
16613 },
16614 dom_class:
16615DOMClass {
16616 interface_chain: [ PrototypeList::ID::GPUComputePassEncoder, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
16617 depth: 0,
16618 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
16619 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUComputePassEncoder> as unsafe fn(&mut _, _) -> _,
16620 global: Globals::EMPTY,
16621},
16622 });
16623}
16624
16625#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
16626(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUComputePassEncoder>, _can_gc: CanGc) -> DomRoot<D::GPUComputePassEncoder>{
16627
16628 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
16629
16630 let scope = scope.reflector().get_jsobject();
16631 assert!(!scope.get().is_null());
16632 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
16633 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
16634
16635 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
16636 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
16637 assert!(!canonical_proto.is_null());
16638
16639
16640 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
16641 if let Some(given) = given_proto {
16642 proto.set(*given);
16643 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
16644 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
16645 }
16646 } else {
16647 proto.set(*canonical_proto);
16648 }
16649 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
16650 cx.raw_cx(),
16651 &Class.get().base,
16652 proto.handle(),
16653 ));
16654 assert!(!obj.is_null());
16655 JS_SetReservedSlot(
16656 obj.get(),
16657 DOM_OBJECT_SLOT,
16658 &PrivateValue(raw.as_ptr() as *const libc::c_void),
16659 );
16660
16661 let root = raw.reflect_with(obj.get());
16662
16663
16664
16665 DomRoot::from_ref(&*root)
16666}
16667
16668pub trait GPUComputePassEncoderMethods<D: DomTypes> {
16669 fn SetPipeline(&self, r#pipeline: &D::GPUComputePipeline);
16670 fn DispatchWorkgroups(&self, r#x: u32, r#y: u32, r#z: u32);
16671 fn DispatchWorkgroupsIndirect(&self, r#indirectBuffer: &D::GPUBuffer, r#indirectOffset: u64);
16672 fn End(&self, );
16673 fn Label(&self, ) -> USVString;
16674 fn SetLabel(&self, r#value: USVString);
16675 fn SetBindGroup(&self, r#index: u32, r#bindGroup: &D::GPUBindGroup, r#dynamicOffsets: Vec<u32>);
16676}
16677static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
16678
16679pub(crate) fn init_sMethods_specs<D: DomTypes>() {
16680 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
16681 JSFunctionSpec {
16682 name: JSPropertySpec_Name { string_: c"setPipeline".as_ptr() },
16683 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { setPipeline_methodinfo.get() } as *const _ as *const JSJitInfo },
16684 nargs: 1,
16685 flags: (JSPROP_ENUMERATE) as u16,
16686 selfHostedName: ptr::null()
16687 },
16688 JSFunctionSpec {
16689 name: JSPropertySpec_Name { string_: c"dispatchWorkgroups".as_ptr() },
16690 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { dispatchWorkgroups_methodinfo.get() } as *const _ as *const JSJitInfo },
16691 nargs: 1,
16692 flags: (JSPROP_ENUMERATE) as u16,
16693 selfHostedName: ptr::null()
16694 },
16695 JSFunctionSpec {
16696 name: JSPropertySpec_Name { string_: c"dispatchWorkgroupsIndirect".as_ptr() },
16697 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { dispatchWorkgroupsIndirect_methodinfo.get() } as *const _ as *const JSJitInfo },
16698 nargs: 2,
16699 flags: (JSPROP_ENUMERATE) as u16,
16700 selfHostedName: ptr::null()
16701 },
16702 JSFunctionSpec {
16703 name: JSPropertySpec_Name { string_: c"end".as_ptr() },
16704 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { end_methodinfo.get() } as *const _ as *const JSJitInfo },
16705 nargs: 0,
16706 flags: (JSPROP_ENUMERATE) as u16,
16707 selfHostedName: ptr::null()
16708 },
16709 JSFunctionSpec {
16710 name: JSPropertySpec_Name { string_: c"setBindGroup".as_ptr() },
16711 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { setBindGroup_methodinfo.get() } as *const _ as *const JSJitInfo },
16712 nargs: 2,
16713 flags: (JSPROP_ENUMERATE) as u16,
16714 selfHostedName: ptr::null()
16715 },
16716 JSFunctionSpec {
16717 name: JSPropertySpec_Name { string_: ptr::null() },
16718 call: JSNativeWrapper { op: None, info: ptr::null() },
16719 nargs: 0,
16720 flags: 0,
16721 selfHostedName: ptr::null()
16722 }]))[..]
16723])));
16724}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
16725
16726pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
16727 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sMethods_specs.get() })[0])])));
16728}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
16729
16730pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
16731 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
16732 JSPropertySpec {
16733 name: JSPropertySpec_Name { string_: c"label".as_ptr() },
16734 attributes_: (JSPROP_ENUMERATE),
16735 kind_: (JSPropertySpec_Kind::NativeAccessor),
16736 u: JSPropertySpec_AccessorsOrValue {
16737 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
16738 getter: JSPropertySpec_Accessor {
16739 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { label_getterinfo.get() } },
16740 },
16741 setter: JSPropertySpec_Accessor {
16742 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { label_setterinfo.get() } },
16743 }
16744 }
16745 }
16746 }
16747,
16748 JSPropertySpec::ZERO]))[..]
16749,
16750&Box::leak(Box::new([
16751 JSPropertySpec {
16752 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
16753 attributes_: (JSPROP_READONLY),
16754 kind_: (JSPropertySpec_Kind::Value),
16755 u: JSPropertySpec_AccessorsOrValue {
16756 value: JSPropertySpec_ValueWrapper {
16757 type_: JSPropertySpec_ValueWrapper_Type::String,
16758 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
16759 string: c"GPUComputePassEncoder".as_ptr(),
16760 }
16761 }
16762 }
16763 }
16764,
16765 JSPropertySpec::ZERO]))[..]
16766])));
16767}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
16768
16769pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
16770 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
16771 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
16772}
16773pub fn GetProtoObject<D: DomTypes>
16774(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
16775 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUComputePassEncoder), CreateInterfaceObjects::<D>, rval)
16777}
16778
16779
16780static PrototypeClass: JSClass = JSClass {
16781 name: c"GPUComputePassEncoderPrototype".as_ptr(),
16782 flags:
16783 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
16785 cOps: ptr::null(),
16786 spec: ptr::null(),
16787 ext: ptr::null(),
16788 oOps: ptr::null(),
16789};
16790
16791
16792static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
16793
16794pub(crate) fn init_interface_object<D: DomTypes>() {
16795 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
16796 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
16797 b"function GPUComputePassEncoder() {\n [native code]\n}",
16798 PrototypeList::ID::GPUComputePassEncoder,
16799 0,
16800 ));
16801}
16802
16803pub fn DefineDOMInterface<D: DomTypes>
16804(cx: SafeJSContext, global: HandleObject){
16805 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUComputePassEncoder),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
16806}
16807
16808pub fn ConstructorEnabled<D: DomTypes>
16809(aCx: SafeJSContext, aObj: HandleObject) -> bool{
16810 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
16811 pref!(dom_webgpu_enabled)
16812}
16813
16814unsafe fn CreateInterfaceObjects<D: DomTypes>
16815(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
16816
16817 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
16818 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
16819 assert!(!prototype_proto.is_null());
16820
16821 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
16822 create_interface_prototype_object::<D>(cx,
16823 global,
16824 prototype_proto.handle(),
16825 &PrototypeClass,
16826 sMethods.get(),
16827 sAttributes.get(),
16828 &[],
16829 &[],
16830 prototype.handle_mut());
16831 assert!(!prototype.is_null());
16832 assert!((*cache)[PrototypeList::ID::GPUComputePassEncoder as usize].is_null());
16833 (*cache)[PrototypeList::ID::GPUComputePassEncoder as usize] = prototype.get();
16834 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUComputePassEncoder as isize),
16835 ptr::null_mut(),
16836 prototype.get());
16837
16838 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
16839 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
16840
16841 assert!(!interface_proto.is_null());
16842
16843 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
16844 create_noncallback_interface_object::<D>(cx,
16845 global,
16846 interface_proto.handle(),
16847 INTERFACE_OBJECT_CLASS.get(),
16848 &[],
16849 &[],
16850 &[],
16851 prototype.handle(),
16852 c"GPUComputePassEncoder",
16853 0,
16854 &[],
16855 interface.handle_mut());
16856 assert!(!interface.is_null());
16857}
16858
16859
16860 pub(crate) fn init_statics<D: DomTypes>() {
16861 init_interface_object::<D>();
16862 init_domjs_class::<D>();
16863 crate::codegen::GenericBindings::WebGPUBinding::GPUComputePassEncoder_Binding::init_setPipeline_methodinfo::<D>();
16864crate::codegen::GenericBindings::WebGPUBinding::GPUComputePassEncoder_Binding::init_dispatchWorkgroups_methodinfo::<D>();
16865crate::codegen::GenericBindings::WebGPUBinding::GPUComputePassEncoder_Binding::init_dispatchWorkgroupsIndirect_methodinfo::<D>();
16866crate::codegen::GenericBindings::WebGPUBinding::GPUComputePassEncoder_Binding::init_end_methodinfo::<D>();
16867crate::codegen::GenericBindings::WebGPUBinding::GPUComputePassEncoder_Binding::init_setBindGroup_methodinfo::<D>();
16868 init_label_getterinfo::<D>();
16869 init_label_setterinfo::<D>();
16870
16871 init_sMethods_specs::<D>();
16872init_sMethods_prefs::<D>();
16873init_sAttributes_specs::<D>();
16874init_sAttributes_prefs::<D>();
16875 }
16876 } pub use self::GPUComputePipeline_Binding::{Wrap as GPUComputePipelineWrap, GPUComputePipelineMethods, GetProtoObject as GPUComputePipelineGetProtoObject, DefineDOMInterface as GPUComputePipelineDefineDOMInterface};
16880pub mod GPUComputePipeline_Binding {
16881use crate::import::module::*;
16882
16883unsafe extern "C" fn get_label<D: DomTypes>
16884(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
16885 let mut result = false;
16886 wrap_panic(&mut || result = (|| {
16887 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
16888 let this = &*(this as *const D::GPUComputePipeline);
16889 let result: USVString = this.Label();
16890
16891 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
16892 return true;
16893 })());
16894 result
16895}
16896
16897unsafe extern "C" fn set_label<D: DomTypes>
16898(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
16899 let mut result = false;
16900 wrap_panic(&mut || result = (|| {
16901 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
16902 let this = &*(this as *const D::GPUComputePipeline);
16903 let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
16904 Ok(ConversionResult::Success(value)) => value,
16905 Ok(ConversionResult::Failure(error)) => {
16906 throw_type_error(cx.raw_cx(), &error);
16907 return false;
16908
16909 }
16910 _ => {
16911 return false;
16912
16913 },
16914 }
16915 ;
16916 let result: () = this.SetLabel(arg0);
16917
16918 true
16919 })());
16920 result
16921}
16922
16923
16924static label_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
16925
16926pub(crate) fn init_label_getterinfo<D: DomTypes>() {
16927 label_getterinfo.set(JSJitInfo {
16928 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
16929 getter: Some(get_label::<D>)
16930 },
16931 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
16932 protoID: PrototypeList::ID::GPUComputePipeline as u16,
16933 },
16934 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
16935 _bitfield_align_1: [],
16936 _bitfield_1: __BindgenBitfieldUnit::new(
16937 new_jsjitinfo_bitfield_1!(
16938 JSJitInfo_OpType::Getter as u8,
16939 JSJitInfo_AliasSet::AliasEverything as u8,
16940 JSValueType::JSVAL_TYPE_STRING as u8,
16941 true,
16942 false,
16943 false,
16944 false,
16945 false,
16946 false,
16947 0,
16948 ).to_ne_bytes()
16949 ),
16950});
16951}
16952static label_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
16953
16954pub(crate) fn init_label_setterinfo<D: DomTypes>() {
16955 label_setterinfo.set(JSJitInfo {
16956 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
16957 setter: Some(set_label::<D>)
16958 },
16959 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
16960 protoID: PrototypeList::ID::GPUComputePipeline as u16,
16961 },
16962 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
16963 _bitfield_align_1: [],
16964 _bitfield_1: __BindgenBitfieldUnit::new(
16965 new_jsjitinfo_bitfield_1!(
16966 JSJitInfo_OpType::Setter as u8,
16967 JSJitInfo_AliasSet::AliasEverything as u8,
16968 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
16969 false,
16970 false,
16971 false,
16972 false,
16973 false,
16974 false,
16975 0,
16976 ).to_ne_bytes()
16977 ),
16978});
16979}
16980unsafe extern "C" fn getBindGroupLayout<D: DomTypes>
16981(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
16982 let mut result = false;
16983 wrap_panic(&mut || result = (|| {
16984 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
16985 let this = &*(this as *const D::GPUComputePipeline);
16986 let args = &*args;
16987 let argc = args.argc_;
16988
16989 if argc < 1 {
16990 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUComputePipeline.getBindGroupLayout\".");
16991 return false;
16992 }
16993 let arg0: u32 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ConversionBehavior::Default) {
16994 Ok(ConversionResult::Success(value)) => value,
16995 Ok(ConversionResult::Failure(error)) => {
16996 throw_type_error(cx.raw_cx(), &error);
16997 return false;
16998
16999 }
17000 _ => {
17001 return false;
17002
17003 },
17004 }
17005 ;
17006 let result: Result<DomRoot<D::GPUBindGroupLayout>, Error> = this.GetBindGroupLayout(arg0);
17007 let result = match result {
17008 Ok(result) => result,
17009 Err(e) => {
17010 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
17011 return false;
17012 },
17013 };
17014
17015 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
17016 return true;
17017 })());
17018 result
17019}
17020
17021
17022static getBindGroupLayout_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
17023
17024pub(crate) fn init_getBindGroupLayout_methodinfo<D: DomTypes>() {
17025 getBindGroupLayout_methodinfo.set(JSJitInfo {
17026 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
17027 method: Some(getBindGroupLayout::<D>)
17028 },
17029 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
17030 protoID: PrototypeList::ID::GPUComputePipeline as u16,
17031 },
17032 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
17033 _bitfield_align_1: [],
17034 _bitfield_1: __BindgenBitfieldUnit::new(
17035 new_jsjitinfo_bitfield_1!(
17036 JSJitInfo_OpType::Method as u8,
17037 JSJitInfo_AliasSet::AliasEverything as u8,
17038 JSValueType::JSVAL_TYPE_OBJECT as u8,
17039 false,
17040 false,
17041 false,
17042 false,
17043 false,
17044 false,
17045 0,
17046 ).to_ne_bytes()
17047 ),
17048});
17049}
17050unsafe extern "C" fn _finalize<D: DomTypes>
17051(_cx: *mut GCContext, obj: *mut JSObject){
17052 wrap_panic(&mut || {
17053
17054 let this = native_from_object_static::<D::GPUComputePipeline>(obj).unwrap();
17055 finalize_common(this);
17056 })
17057}
17058
17059unsafe extern "C" fn _trace<D: DomTypes>
17060(trc: *mut JSTracer, obj: *mut JSObject){
17061 wrap_panic(&mut || {
17062
17063 let this = native_from_object_static::<D::GPUComputePipeline>(obj).unwrap();
17064 if this.is_null() { return; } (*this).trace(trc);
17066 })
17067}
17068
17069
17070static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
17071
17072pub(crate) fn init_class_ops<D: DomTypes>() {
17073 CLASS_OPS.set(JSClassOps {
17074 addProperty: None,
17075 delProperty: None,
17076 enumerate: None,
17077 newEnumerate: None,
17078 resolve: None,
17079 mayResolve: None,
17080 finalize: Some(_finalize::<D>),
17081 call: None,
17082 construct: None,
17083 trace: Some(_trace::<D>),
17084 });
17085}
17086
17087pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
17088
17089pub(crate) fn init_domjs_class<D: DomTypes>() {
17090 init_class_ops::<D>();
17091 Class.set(DOMJSClass {
17092 base: JSClass {
17093 name: c"GPUComputePipeline".as_ptr(),
17094 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
17095 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
17096 ,
17097 cOps: unsafe { CLASS_OPS.get() },
17098 spec: ptr::null(),
17099 ext: ptr::null(),
17100 oOps: ptr::null(),
17101 },
17102 dom_class:
17103DOMClass {
17104 interface_chain: [ PrototypeList::ID::GPUComputePipeline, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
17105 depth: 0,
17106 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
17107 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUComputePipeline> as unsafe fn(&mut _, _) -> _,
17108 global: Globals::EMPTY,
17109},
17110 });
17111}
17112
17113#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
17114(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUComputePipeline>, _can_gc: CanGc) -> DomRoot<D::GPUComputePipeline>{
17115
17116 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
17117
17118 let scope = scope.reflector().get_jsobject();
17119 assert!(!scope.get().is_null());
17120 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
17121 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
17122
17123 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
17124 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
17125 assert!(!canonical_proto.is_null());
17126
17127
17128 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
17129 if let Some(given) = given_proto {
17130 proto.set(*given);
17131 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
17132 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
17133 }
17134 } else {
17135 proto.set(*canonical_proto);
17136 }
17137 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
17138 cx.raw_cx(),
17139 &Class.get().base,
17140 proto.handle(),
17141 ));
17142 assert!(!obj.is_null());
17143 JS_SetReservedSlot(
17144 obj.get(),
17145 DOM_OBJECT_SLOT,
17146 &PrivateValue(raw.as_ptr() as *const libc::c_void),
17147 );
17148
17149 let root = raw.reflect_with(obj.get());
17150
17151
17152
17153 DomRoot::from_ref(&*root)
17154}
17155
17156pub trait GPUComputePipelineMethods<D: DomTypes> {
17157 fn Label(&self, ) -> USVString;
17158 fn SetLabel(&self, r#value: USVString);
17159 fn GetBindGroupLayout(&self, r#index: u32) -> Fallible<DomRoot<D::GPUBindGroupLayout>>;
17160}
17161static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
17162
17163pub(crate) fn init_sMethods_specs<D: DomTypes>() {
17164 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
17165 JSFunctionSpec {
17166 name: JSPropertySpec_Name { string_: c"getBindGroupLayout".as_ptr() },
17167 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { getBindGroupLayout_methodinfo.get() } as *const _ as *const JSJitInfo },
17168 nargs: 1,
17169 flags: (JSPROP_ENUMERATE) as u16,
17170 selfHostedName: ptr::null()
17171 },
17172 JSFunctionSpec {
17173 name: JSPropertySpec_Name { string_: ptr::null() },
17174 call: JSNativeWrapper { op: None, info: ptr::null() },
17175 nargs: 0,
17176 flags: 0,
17177 selfHostedName: ptr::null()
17178 }]))[..]
17179])));
17180}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
17181
17182pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
17183 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sMethods_specs.get() })[0])])));
17184}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
17185
17186pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
17187 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
17188 JSPropertySpec {
17189 name: JSPropertySpec_Name { string_: c"label".as_ptr() },
17190 attributes_: (JSPROP_ENUMERATE),
17191 kind_: (JSPropertySpec_Kind::NativeAccessor),
17192 u: JSPropertySpec_AccessorsOrValue {
17193 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
17194 getter: JSPropertySpec_Accessor {
17195 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { label_getterinfo.get() } },
17196 },
17197 setter: JSPropertySpec_Accessor {
17198 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { label_setterinfo.get() } },
17199 }
17200 }
17201 }
17202 }
17203,
17204 JSPropertySpec::ZERO]))[..]
17205,
17206&Box::leak(Box::new([
17207 JSPropertySpec {
17208 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
17209 attributes_: (JSPROP_READONLY),
17210 kind_: (JSPropertySpec_Kind::Value),
17211 u: JSPropertySpec_AccessorsOrValue {
17212 value: JSPropertySpec_ValueWrapper {
17213 type_: JSPropertySpec_ValueWrapper_Type::String,
17214 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
17215 string: c"GPUComputePipeline".as_ptr(),
17216 }
17217 }
17218 }
17219 }
17220,
17221 JSPropertySpec::ZERO]))[..]
17222])));
17223}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
17224
17225pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
17226 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
17227 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
17228}
17229pub fn GetProtoObject<D: DomTypes>
17230(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
17231 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUComputePipeline), CreateInterfaceObjects::<D>, rval)
17233}
17234
17235
17236static PrototypeClass: JSClass = JSClass {
17237 name: c"GPUComputePipelinePrototype".as_ptr(),
17238 flags:
17239 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
17241 cOps: ptr::null(),
17242 spec: ptr::null(),
17243 ext: ptr::null(),
17244 oOps: ptr::null(),
17245};
17246
17247
17248static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
17249
17250pub(crate) fn init_interface_object<D: DomTypes>() {
17251 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
17252 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
17253 b"function GPUComputePipeline() {\n [native code]\n}",
17254 PrototypeList::ID::GPUComputePipeline,
17255 0,
17256 ));
17257}
17258
17259pub fn DefineDOMInterface<D: DomTypes>
17260(cx: SafeJSContext, global: HandleObject){
17261 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUComputePipeline),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
17262}
17263
17264pub fn ConstructorEnabled<D: DomTypes>
17265(aCx: SafeJSContext, aObj: HandleObject) -> bool{
17266 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
17267 pref!(dom_webgpu_enabled)
17268}
17269
17270unsafe fn CreateInterfaceObjects<D: DomTypes>
17271(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
17272
17273 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
17274 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
17275 assert!(!prototype_proto.is_null());
17276
17277 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
17278 create_interface_prototype_object::<D>(cx,
17279 global,
17280 prototype_proto.handle(),
17281 &PrototypeClass,
17282 sMethods.get(),
17283 sAttributes.get(),
17284 &[],
17285 &[],
17286 prototype.handle_mut());
17287 assert!(!prototype.is_null());
17288 assert!((*cache)[PrototypeList::ID::GPUComputePipeline as usize].is_null());
17289 (*cache)[PrototypeList::ID::GPUComputePipeline as usize] = prototype.get();
17290 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUComputePipeline as isize),
17291 ptr::null_mut(),
17292 prototype.get());
17293
17294 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
17295 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
17296
17297 assert!(!interface_proto.is_null());
17298
17299 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
17300 create_noncallback_interface_object::<D>(cx,
17301 global,
17302 interface_proto.handle(),
17303 INTERFACE_OBJECT_CLASS.get(),
17304 &[],
17305 &[],
17306 &[],
17307 prototype.handle(),
17308 c"GPUComputePipeline",
17309 0,
17310 &[],
17311 interface.handle_mut());
17312 assert!(!interface.is_null());
17313}
17314
17315
17316 pub(crate) fn init_statics<D: DomTypes>() {
17317 init_interface_object::<D>();
17318 init_domjs_class::<D>();
17319 crate::codegen::GenericBindings::WebGPUBinding::GPUComputePipeline_Binding::init_getBindGroupLayout_methodinfo::<D>();
17320 init_label_getterinfo::<D>();
17321 init_label_setterinfo::<D>();
17322
17323 init_sMethods_specs::<D>();
17324init_sMethods_prefs::<D>();
17325init_sAttributes_specs::<D>();
17326init_sAttributes_prefs::<D>();
17327 }
17328 } pub use self::GPUDevice_Binding::{Wrap as GPUDeviceWrap, GPUDeviceMethods, GetProtoObject as GPUDeviceGetProtoObject, DefineDOMInterface as GPUDeviceDefineDOMInterface};
17332pub mod GPUDevice_Binding {
17333use crate::codegen::GenericBindings::EventHandlerBinding::EventHandlerNonNull;
17334use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
17335use crate::codegen::GenericBindings::WebGPUBinding::GPUAddressMode;
17336use crate::codegen::GenericBindings::WebGPUBinding::GPUAddressModeValues;
17337use crate::codegen::GenericBindings::WebGPUBinding::GPUBindGroupDescriptor;
17338use crate::codegen::GenericBindings::WebGPUBinding::GPUBindGroupEntry;
17339use crate::codegen::GenericBindings::WebGPUBinding::GPUBindGroupLayoutDescriptor;
17340use crate::codegen::GenericBindings::WebGPUBinding::GPUBindGroupLayoutEntry;
17341use crate::codegen::GenericBindings::WebGPUBinding::GPUBufferDescriptor;
17342use crate::codegen::GenericBindings::WebGPUBinding::GPUCommandEncoderDescriptor;
17343use crate::codegen::GenericBindings::WebGPUBinding::GPUCompareFunction;
17344use crate::codegen::GenericBindings::WebGPUBinding::GPUCompareFunctionValues;
17345use crate::codegen::GenericBindings::WebGPUBinding::GPUComputePipelineDescriptor;
17346use crate::codegen::GenericBindings::WebGPUBinding::GPUDepthStencilState;
17347use crate::codegen::GenericBindings::WebGPUBinding::GPUErrorFilter;
17348use crate::codegen::GenericBindings::WebGPUBinding::GPUErrorFilterValues;
17349use crate::codegen::GenericBindings::WebGPUBinding::GPUFilterMode;
17350use crate::codegen::GenericBindings::WebGPUBinding::GPUFilterModeValues;
17351use crate::codegen::GenericBindings::WebGPUBinding::GPUFragmentState;
17352use crate::codegen::GenericBindings::WebGPUBinding::GPUMultisampleState;
17353use crate::codegen::GenericBindings::WebGPUBinding::GPUPipelineLayoutDescriptor;
17354use crate::codegen::GenericBindings::WebGPUBinding::GPUPrimitiveState;
17355use crate::codegen::GenericBindings::WebGPUBinding::GPUProgrammableStage;
17356use crate::codegen::GenericBindings::WebGPUBinding::GPURenderBundleEncoderDescriptor;
17357use crate::codegen::GenericBindings::WebGPUBinding::GPURenderPipelineDescriptor;
17358use crate::codegen::GenericBindings::WebGPUBinding::GPUSamplerDescriptor;
17359use crate::codegen::GenericBindings::WebGPUBinding::GPUShaderModuleDescriptor;
17360use crate::codegen::GenericBindings::WebGPUBinding::GPUTextureDescriptor;
17361use crate::codegen::GenericBindings::WebGPUBinding::GPUTextureDimension;
17362use crate::codegen::GenericBindings::WebGPUBinding::GPUTextureDimensionValues;
17363use crate::codegen::GenericBindings::WebGPUBinding::GPUTextureFormat;
17364use crate::codegen::GenericBindings::WebGPUBinding::GPUTextureFormatValues;
17365use crate::codegen::GenericBindings::WebGPUBinding::GPUVertexState;
17366use crate::import::module::*;
17367
17368unsafe extern "C" fn get_features<D: DomTypes>
17369(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
17370 let mut result = false;
17371 wrap_panic(&mut || result = (|| {
17372 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
17373 let this = &*(this as *const D::GPUDevice);
17374 let result: DomRoot<D::GPUSupportedFeatures> = this.Features();
17375
17376 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
17377 return true;
17378 })());
17379 result
17380}
17381
17382
17383static features_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
17384
17385pub(crate) fn init_features_getterinfo<D: DomTypes>() {
17386 features_getterinfo.set(JSJitInfo {
17387 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
17388 getter: Some(get_features::<D>)
17389 },
17390 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
17391 protoID: PrototypeList::ID::GPUDevice as u16,
17392 },
17393 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
17394 _bitfield_align_1: [],
17395 _bitfield_1: __BindgenBitfieldUnit::new(
17396 new_jsjitinfo_bitfield_1!(
17397 JSJitInfo_OpType::Getter as u8,
17398 JSJitInfo_AliasSet::AliasNone as u8,
17399 JSValueType::JSVAL_TYPE_OBJECT as u8,
17400 true,
17401 true,
17402 false,
17403 false,
17404 false,
17405 false,
17406 0,
17407 ).to_ne_bytes()
17408 ),
17409});
17410}
17411unsafe extern "C" fn get_limits<D: DomTypes>
17412(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
17413 let mut result = false;
17414 wrap_panic(&mut || result = (|| {
17415 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
17416 let this = &*(this as *const D::GPUDevice);
17417 let result: DomRoot<D::GPUSupportedLimits> = this.Limits();
17418
17419 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
17420 return true;
17421 })());
17422 result
17423}
17424
17425
17426static limits_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
17427
17428pub(crate) fn init_limits_getterinfo<D: DomTypes>() {
17429 limits_getterinfo.set(JSJitInfo {
17430 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
17431 getter: Some(get_limits::<D>)
17432 },
17433 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
17434 protoID: PrototypeList::ID::GPUDevice as u16,
17435 },
17436 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
17437 _bitfield_align_1: [],
17438 _bitfield_1: __BindgenBitfieldUnit::new(
17439 new_jsjitinfo_bitfield_1!(
17440 JSJitInfo_OpType::Getter as u8,
17441 JSJitInfo_AliasSet::AliasNone as u8,
17442 JSValueType::JSVAL_TYPE_OBJECT as u8,
17443 true,
17444 true,
17445 false,
17446 false,
17447 false,
17448 false,
17449 0,
17450 ).to_ne_bytes()
17451 ),
17452});
17453}
17454unsafe extern "C" fn get_adapterInfo<D: DomTypes>
17455(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
17456 let mut result = false;
17457 wrap_panic(&mut || result = (|| {
17458 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
17459 let this = &*(this as *const D::GPUDevice);
17460 let result: DomRoot<D::GPUAdapterInfo> = this.AdapterInfo();
17461
17462 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
17463 return true;
17464 })());
17465 result
17466}
17467
17468
17469static adapterInfo_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
17470
17471pub(crate) fn init_adapterInfo_getterinfo<D: DomTypes>() {
17472 adapterInfo_getterinfo.set(JSJitInfo {
17473 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
17474 getter: Some(get_adapterInfo::<D>)
17475 },
17476 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
17477 protoID: PrototypeList::ID::GPUDevice as u16,
17478 },
17479 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
17480 _bitfield_align_1: [],
17481 _bitfield_1: __BindgenBitfieldUnit::new(
17482 new_jsjitinfo_bitfield_1!(
17483 JSJitInfo_OpType::Getter as u8,
17484 JSJitInfo_AliasSet::AliasNone as u8,
17485 JSValueType::JSVAL_TYPE_OBJECT as u8,
17486 true,
17487 true,
17488 false,
17489 false,
17490 false,
17491 false,
17492 0,
17493 ).to_ne_bytes()
17494 ),
17495});
17496}
17497unsafe extern "C" fn get_queue<D: DomTypes>
17498(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
17499 let mut result = false;
17500 wrap_panic(&mut || result = (|| {
17501 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
17502 let this = &*(this as *const D::GPUDevice);
17503 let result: DomRoot<D::GPUQueue> = this.GetQueue();
17504
17505 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
17506 return true;
17507 })());
17508 result
17509}
17510
17511
17512static queue_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
17513
17514pub(crate) fn init_queue_getterinfo<D: DomTypes>() {
17515 queue_getterinfo.set(JSJitInfo {
17516 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
17517 getter: Some(get_queue::<D>)
17518 },
17519 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
17520 protoID: PrototypeList::ID::GPUDevice as u16,
17521 },
17522 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
17523 _bitfield_align_1: [],
17524 _bitfield_1: __BindgenBitfieldUnit::new(
17525 new_jsjitinfo_bitfield_1!(
17526 JSJitInfo_OpType::Getter as u8,
17527 JSJitInfo_AliasSet::AliasNone as u8,
17528 JSValueType::JSVAL_TYPE_OBJECT as u8,
17529 true,
17530 true,
17531 false,
17532 false,
17533 false,
17534 false,
17535 0,
17536 ).to_ne_bytes()
17537 ),
17538});
17539}
17540unsafe extern "C" fn destroy<D: DomTypes>
17541(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
17542 let mut result = false;
17543 wrap_panic(&mut || result = (|| {
17544 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
17545 let this = &*(this as *const D::GPUDevice);
17546 let args = &*args;
17547 let argc = args.argc_;
17548 let result: () = this.Destroy();
17549
17550 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
17551 return true;
17552 })());
17553 result
17554}
17555
17556
17557static destroy_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
17558
17559pub(crate) fn init_destroy_methodinfo<D: DomTypes>() {
17560 destroy_methodinfo.set(JSJitInfo {
17561 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
17562 method: Some(destroy::<D>)
17563 },
17564 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
17565 protoID: PrototypeList::ID::GPUDevice as u16,
17566 },
17567 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
17568 _bitfield_align_1: [],
17569 _bitfield_1: __BindgenBitfieldUnit::new(
17570 new_jsjitinfo_bitfield_1!(
17571 JSJitInfo_OpType::Method as u8,
17572 JSJitInfo_AliasSet::AliasEverything as u8,
17573 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
17574 true,
17575 false,
17576 false,
17577 false,
17578 false,
17579 false,
17580 0,
17581 ).to_ne_bytes()
17582 ),
17583});
17584}
17585unsafe extern "C" fn createBuffer<D: DomTypes>
17586(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
17587 let mut result = false;
17588 wrap_panic(&mut || result = (|| {
17589 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
17590 let this = &*(this as *const D::GPUDevice);
17591 let args = &*args;
17592 let argc = args.argc_;
17593
17594 if argc < 1 {
17595 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUDevice.createBuffer\".");
17596 return false;
17597 }
17598 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPUBufferDescriptor = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
17599 Ok(ConversionResult::Success(value)) => value,
17600 Ok(ConversionResult::Failure(error)) => {
17601 throw_type_error(cx.raw_cx(), &error);
17602 return false;
17603
17604 }
17605 _ => {
17606 return false;
17607
17608 },
17609 }
17610 ;
17611 let result: Result<DomRoot<D::GPUBuffer>, Error> = this.CreateBuffer(&arg0);
17612 let result = match result {
17613 Ok(result) => result,
17614 Err(e) => {
17615 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
17616 return false;
17617 },
17618 };
17619
17620 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
17621 return true;
17622 })());
17623 result
17624}
17625
17626
17627static createBuffer_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
17628
17629pub(crate) fn init_createBuffer_methodinfo<D: DomTypes>() {
17630 createBuffer_methodinfo.set(JSJitInfo {
17631 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
17632 method: Some(createBuffer::<D>)
17633 },
17634 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
17635 protoID: PrototypeList::ID::GPUDevice as u16,
17636 },
17637 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
17638 _bitfield_align_1: [],
17639 _bitfield_1: __BindgenBitfieldUnit::new(
17640 new_jsjitinfo_bitfield_1!(
17641 JSJitInfo_OpType::Method as u8,
17642 JSJitInfo_AliasSet::AliasEverything as u8,
17643 JSValueType::JSVAL_TYPE_OBJECT as u8,
17644 false,
17645 false,
17646 false,
17647 false,
17648 false,
17649 false,
17650 0,
17651 ).to_ne_bytes()
17652 ),
17653});
17654}
17655unsafe extern "C" fn createTexture<D: DomTypes>
17656(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
17657 let mut result = false;
17658 wrap_panic(&mut || result = (|| {
17659 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
17660 let this = &*(this as *const D::GPUDevice);
17661 let args = &*args;
17662 let argc = args.argc_;
17663
17664 if argc < 1 {
17665 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUDevice.createTexture\".");
17666 return false;
17667 }
17668 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPUTextureDescriptor = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
17669 Ok(ConversionResult::Success(value)) => value,
17670 Ok(ConversionResult::Failure(error)) => {
17671 throw_type_error(cx.raw_cx(), &error);
17672 return false;
17673
17674 }
17675 _ => {
17676 return false;
17677
17678 },
17679 }
17680 ;
17681 let result: Result<DomRoot<D::GPUTexture>, Error> = this.CreateTexture(&arg0);
17682 let result = match result {
17683 Ok(result) => result,
17684 Err(e) => {
17685 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
17686 return false;
17687 },
17688 };
17689
17690 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
17691 return true;
17692 })());
17693 result
17694}
17695
17696
17697static createTexture_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
17698
17699pub(crate) fn init_createTexture_methodinfo<D: DomTypes>() {
17700 createTexture_methodinfo.set(JSJitInfo {
17701 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
17702 method: Some(createTexture::<D>)
17703 },
17704 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
17705 protoID: PrototypeList::ID::GPUDevice as u16,
17706 },
17707 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
17708 _bitfield_align_1: [],
17709 _bitfield_1: __BindgenBitfieldUnit::new(
17710 new_jsjitinfo_bitfield_1!(
17711 JSJitInfo_OpType::Method as u8,
17712 JSJitInfo_AliasSet::AliasEverything as u8,
17713 JSValueType::JSVAL_TYPE_OBJECT as u8,
17714 false,
17715 false,
17716 false,
17717 false,
17718 false,
17719 false,
17720 0,
17721 ).to_ne_bytes()
17722 ),
17723});
17724}
17725unsafe extern "C" fn createSampler<D: DomTypes>
17726(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
17727 let mut result = false;
17728 wrap_panic(&mut || result = (|| {
17729 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
17730 let this = &*(this as *const D::GPUDevice);
17731 let args = &*args;
17732 let argc = args.argc_;
17733 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPUSamplerDescriptor = if args.get(0).is_undefined() {
17734 crate::codegen::GenericBindings::WebGPUBinding::GPUSamplerDescriptor::empty()
17735 } else {
17736 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
17737 Ok(ConversionResult::Success(value)) => value,
17738 Ok(ConversionResult::Failure(error)) => {
17739 throw_type_error(cx.raw_cx(), &error);
17740 return false;
17741
17742 }
17743 _ => {
17744 return false;
17745
17746 },
17747 }
17748
17749 };
17750 let result: DomRoot<D::GPUSampler> = this.CreateSampler(&arg0);
17751
17752 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
17753 return true;
17754 })());
17755 result
17756}
17757
17758
17759static createSampler_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
17760
17761pub(crate) fn init_createSampler_methodinfo<D: DomTypes>() {
17762 createSampler_methodinfo.set(JSJitInfo {
17763 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
17764 method: Some(createSampler::<D>)
17765 },
17766 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
17767 protoID: PrototypeList::ID::GPUDevice as u16,
17768 },
17769 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
17770 _bitfield_align_1: [],
17771 _bitfield_1: __BindgenBitfieldUnit::new(
17772 new_jsjitinfo_bitfield_1!(
17773 JSJitInfo_OpType::Method as u8,
17774 JSJitInfo_AliasSet::AliasEverything as u8,
17775 JSValueType::JSVAL_TYPE_OBJECT as u8,
17776 false,
17777 false,
17778 false,
17779 false,
17780 false,
17781 false,
17782 0,
17783 ).to_ne_bytes()
17784 ),
17785});
17786}
17787unsafe extern "C" fn createBindGroupLayout<D: DomTypes>
17788(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
17789 let mut result = false;
17790 wrap_panic(&mut || result = (|| {
17791 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
17792 let this = &*(this as *const D::GPUDevice);
17793 let args = &*args;
17794 let argc = args.argc_;
17795
17796 if argc < 1 {
17797 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUDevice.createBindGroupLayout\".");
17798 return false;
17799 }
17800 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPUBindGroupLayoutDescriptor = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
17801 Ok(ConversionResult::Success(value)) => value,
17802 Ok(ConversionResult::Failure(error)) => {
17803 throw_type_error(cx.raw_cx(), &error);
17804 return false;
17805
17806 }
17807 _ => {
17808 return false;
17809
17810 },
17811 }
17812 ;
17813 let result: Result<DomRoot<D::GPUBindGroupLayout>, Error> = this.CreateBindGroupLayout(&arg0);
17814 let result = match result {
17815 Ok(result) => result,
17816 Err(e) => {
17817 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
17818 return false;
17819 },
17820 };
17821
17822 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
17823 return true;
17824 })());
17825 result
17826}
17827
17828
17829static createBindGroupLayout_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
17830
17831pub(crate) fn init_createBindGroupLayout_methodinfo<D: DomTypes>() {
17832 createBindGroupLayout_methodinfo.set(JSJitInfo {
17833 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
17834 method: Some(createBindGroupLayout::<D>)
17835 },
17836 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
17837 protoID: PrototypeList::ID::GPUDevice as u16,
17838 },
17839 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
17840 _bitfield_align_1: [],
17841 _bitfield_1: __BindgenBitfieldUnit::new(
17842 new_jsjitinfo_bitfield_1!(
17843 JSJitInfo_OpType::Method as u8,
17844 JSJitInfo_AliasSet::AliasEverything as u8,
17845 JSValueType::JSVAL_TYPE_OBJECT as u8,
17846 false,
17847 false,
17848 false,
17849 false,
17850 false,
17851 false,
17852 0,
17853 ).to_ne_bytes()
17854 ),
17855});
17856}
17857unsafe extern "C" fn createPipelineLayout<D: DomTypes>
17858(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
17859 let mut result = false;
17860 wrap_panic(&mut || result = (|| {
17861 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
17862 let this = &*(this as *const D::GPUDevice);
17863 let args = &*args;
17864 let argc = args.argc_;
17865
17866 if argc < 1 {
17867 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUDevice.createPipelineLayout\".");
17868 return false;
17869 }
17870 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPUPipelineLayoutDescriptor<D> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
17871 Ok(ConversionResult::Success(value)) => value,
17872 Ok(ConversionResult::Failure(error)) => {
17873 throw_type_error(cx.raw_cx(), &error);
17874 return false;
17875
17876 }
17877 _ => {
17878 return false;
17879
17880 },
17881 }
17882 ;
17883 let result: DomRoot<D::GPUPipelineLayout> = this.CreatePipelineLayout(&arg0);
17884
17885 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
17886 return true;
17887 })());
17888 result
17889}
17890
17891
17892static createPipelineLayout_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
17893
17894pub(crate) fn init_createPipelineLayout_methodinfo<D: DomTypes>() {
17895 createPipelineLayout_methodinfo.set(JSJitInfo {
17896 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
17897 method: Some(createPipelineLayout::<D>)
17898 },
17899 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
17900 protoID: PrototypeList::ID::GPUDevice as u16,
17901 },
17902 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
17903 _bitfield_align_1: [],
17904 _bitfield_1: __BindgenBitfieldUnit::new(
17905 new_jsjitinfo_bitfield_1!(
17906 JSJitInfo_OpType::Method as u8,
17907 JSJitInfo_AliasSet::AliasEverything as u8,
17908 JSValueType::JSVAL_TYPE_OBJECT as u8,
17909 false,
17910 false,
17911 false,
17912 false,
17913 false,
17914 false,
17915 0,
17916 ).to_ne_bytes()
17917 ),
17918});
17919}
17920unsafe extern "C" fn createBindGroup<D: DomTypes>
17921(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
17922 let mut result = false;
17923 wrap_panic(&mut || result = (|| {
17924 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
17925 let this = &*(this as *const D::GPUDevice);
17926 let args = &*args;
17927 let argc = args.argc_;
17928
17929 if argc < 1 {
17930 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUDevice.createBindGroup\".");
17931 return false;
17932 }
17933 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPUBindGroupDescriptor<D> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
17934 Ok(ConversionResult::Success(value)) => value,
17935 Ok(ConversionResult::Failure(error)) => {
17936 throw_type_error(cx.raw_cx(), &error);
17937 return false;
17938
17939 }
17940 _ => {
17941 return false;
17942
17943 },
17944 }
17945 ;
17946 let result: DomRoot<D::GPUBindGroup> = this.CreateBindGroup(&arg0);
17947
17948 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
17949 return true;
17950 })());
17951 result
17952}
17953
17954
17955static createBindGroup_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
17956
17957pub(crate) fn init_createBindGroup_methodinfo<D: DomTypes>() {
17958 createBindGroup_methodinfo.set(JSJitInfo {
17959 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
17960 method: Some(createBindGroup::<D>)
17961 },
17962 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
17963 protoID: PrototypeList::ID::GPUDevice as u16,
17964 },
17965 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
17966 _bitfield_align_1: [],
17967 _bitfield_1: __BindgenBitfieldUnit::new(
17968 new_jsjitinfo_bitfield_1!(
17969 JSJitInfo_OpType::Method as u8,
17970 JSJitInfo_AliasSet::AliasEverything as u8,
17971 JSValueType::JSVAL_TYPE_OBJECT as u8,
17972 false,
17973 false,
17974 false,
17975 false,
17976 false,
17977 false,
17978 0,
17979 ).to_ne_bytes()
17980 ),
17981});
17982}
17983unsafe extern "C" fn createShaderModule<D: DomTypes>
17984(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
17985 let mut result = false;
17986 wrap_panic(&mut || result = (|| {
17987 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
17988 let this = &*(this as *const D::GPUDevice);
17989 let args = &*args;
17990 let argc = args.argc_;
17991
17992 if argc < 1 {
17993 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUDevice.createShaderModule\".");
17994 return false;
17995 }
17996 let arg0: RootedTraceableBox<crate::codegen::GenericBindings::WebGPUBinding::GPUShaderModuleDescriptor> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
17997 Ok(ConversionResult::Success(value)) => value,
17998 Ok(ConversionResult::Failure(error)) => {
17999 throw_type_error(cx.raw_cx(), &error);
18000 return false;
18001
18002 }
18003 _ => {
18004 return false;
18005
18006 },
18007 }
18008 ;
18009 let result: DomRoot<D::GPUShaderModule> = this.CreateShaderModule(arg0, InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx()))), CanGc::note());
18010
18011 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
18012 return true;
18013 })());
18014 result
18015}
18016
18017
18018static createShaderModule_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
18019
18020pub(crate) fn init_createShaderModule_methodinfo<D: DomTypes>() {
18021 createShaderModule_methodinfo.set(JSJitInfo {
18022 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
18023 method: Some(createShaderModule::<D>)
18024 },
18025 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
18026 protoID: PrototypeList::ID::GPUDevice as u16,
18027 },
18028 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
18029 _bitfield_align_1: [],
18030 _bitfield_1: __BindgenBitfieldUnit::new(
18031 new_jsjitinfo_bitfield_1!(
18032 JSJitInfo_OpType::Method as u8,
18033 JSJitInfo_AliasSet::AliasEverything as u8,
18034 JSValueType::JSVAL_TYPE_OBJECT as u8,
18035 false,
18036 false,
18037 false,
18038 false,
18039 false,
18040 false,
18041 0,
18042 ).to_ne_bytes()
18043 ),
18044});
18045}
18046unsafe extern "C" fn createComputePipeline<D: DomTypes>
18047(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
18048 let mut result = false;
18049 wrap_panic(&mut || result = (|| {
18050 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
18051 let this = &*(this as *const D::GPUDevice);
18052 let args = &*args;
18053 let argc = args.argc_;
18054
18055 if argc < 1 {
18056 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUDevice.createComputePipeline\".");
18057 return false;
18058 }
18059 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPUComputePipelineDescriptor<D> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
18060 Ok(ConversionResult::Success(value)) => value,
18061 Ok(ConversionResult::Failure(error)) => {
18062 throw_type_error(cx.raw_cx(), &error);
18063 return false;
18064
18065 }
18066 _ => {
18067 return false;
18068
18069 },
18070 }
18071 ;
18072 let result: DomRoot<D::GPUComputePipeline> = this.CreateComputePipeline(&arg0);
18073
18074 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
18075 return true;
18076 })());
18077 result
18078}
18079
18080
18081static createComputePipeline_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
18082
18083pub(crate) fn init_createComputePipeline_methodinfo<D: DomTypes>() {
18084 createComputePipeline_methodinfo.set(JSJitInfo {
18085 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
18086 method: Some(createComputePipeline::<D>)
18087 },
18088 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
18089 protoID: PrototypeList::ID::GPUDevice as u16,
18090 },
18091 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
18092 _bitfield_align_1: [],
18093 _bitfield_1: __BindgenBitfieldUnit::new(
18094 new_jsjitinfo_bitfield_1!(
18095 JSJitInfo_OpType::Method as u8,
18096 JSJitInfo_AliasSet::AliasEverything as u8,
18097 JSValueType::JSVAL_TYPE_OBJECT as u8,
18098 false,
18099 false,
18100 false,
18101 false,
18102 false,
18103 false,
18104 0,
18105 ).to_ne_bytes()
18106 ),
18107});
18108}
18109unsafe extern "C" fn createRenderPipeline<D: DomTypes>
18110(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
18111 let mut result = false;
18112 wrap_panic(&mut || result = (|| {
18113 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
18114 let this = &*(this as *const D::GPUDevice);
18115 let args = &*args;
18116 let argc = args.argc_;
18117
18118 if argc < 1 {
18119 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUDevice.createRenderPipeline\".");
18120 return false;
18121 }
18122 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPURenderPipelineDescriptor<D> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
18123 Ok(ConversionResult::Success(value)) => value,
18124 Ok(ConversionResult::Failure(error)) => {
18125 throw_type_error(cx.raw_cx(), &error);
18126 return false;
18127
18128 }
18129 _ => {
18130 return false;
18131
18132 },
18133 }
18134 ;
18135 let result: Result<DomRoot<D::GPURenderPipeline>, Error> = this.CreateRenderPipeline(&arg0);
18136 let result = match result {
18137 Ok(result) => result,
18138 Err(e) => {
18139 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
18140 return false;
18141 },
18142 };
18143
18144 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
18145 return true;
18146 })());
18147 result
18148}
18149
18150
18151static createRenderPipeline_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
18152
18153pub(crate) fn init_createRenderPipeline_methodinfo<D: DomTypes>() {
18154 createRenderPipeline_methodinfo.set(JSJitInfo {
18155 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
18156 method: Some(createRenderPipeline::<D>)
18157 },
18158 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
18159 protoID: PrototypeList::ID::GPUDevice as u16,
18160 },
18161 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
18162 _bitfield_align_1: [],
18163 _bitfield_1: __BindgenBitfieldUnit::new(
18164 new_jsjitinfo_bitfield_1!(
18165 JSJitInfo_OpType::Method as u8,
18166 JSJitInfo_AliasSet::AliasEverything as u8,
18167 JSValueType::JSVAL_TYPE_OBJECT as u8,
18168 false,
18169 false,
18170 false,
18171 false,
18172 false,
18173 false,
18174 0,
18175 ).to_ne_bytes()
18176 ),
18177});
18178}
18179unsafe extern "C" fn createComputePipelineAsync<D: DomTypes>
18180(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
18181 let mut result = false;
18182 wrap_panic(&mut || result = (|| {
18183 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
18184 let this = &*(this as *const D::GPUDevice);
18185 let args = &*args;
18186 let argc = args.argc_;
18187
18188 if argc < 1 {
18189 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUDevice.createComputePipelineAsync\".");
18190 return false;
18191 }
18192 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPUComputePipelineDescriptor<D> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
18193 Ok(ConversionResult::Success(value)) => value,
18194 Ok(ConversionResult::Failure(error)) => {
18195 throw_type_error(cx.raw_cx(), &error);
18196 return false;
18197
18198 }
18199 _ => {
18200 return false;
18201
18202 },
18203 }
18204 ;
18205 let result: Rc<D::Promise> = this.CreateComputePipelineAsync(&arg0, InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx()))), CanGc::note());
18206
18207 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
18208 return true;
18209 })());
18210 result
18211}
18212
18213unsafe extern "C" fn createComputePipelineAsync_promise_wrapper<D: DomTypes>
18214(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
18215 let mut result = false;
18216 wrap_panic(&mut || result = (|| {
18217 let ok = createComputePipelineAsync::<D>(cx, _obj, this, args);
18218 if ok {
18219 return true;
18220 }
18221 return exception_to_promise(cx, (*args).rval(), CanGc::note());
18222
18223 })());
18224 result
18225}
18226
18227
18228static createComputePipelineAsync_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
18229
18230pub(crate) fn init_createComputePipelineAsync_methodinfo<D: DomTypes>() {
18231 createComputePipelineAsync_methodinfo.set(JSJitInfo {
18232 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
18233 method: Some(createComputePipelineAsync_promise_wrapper::<D>)
18234 },
18235 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
18236 protoID: PrototypeList::ID::GPUDevice as u16,
18237 },
18238 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
18239 _bitfield_align_1: [],
18240 _bitfield_1: __BindgenBitfieldUnit::new(
18241 new_jsjitinfo_bitfield_1!(
18242 JSJitInfo_OpType::Method as u8,
18243 JSJitInfo_AliasSet::AliasEverything as u8,
18244 JSValueType::JSVAL_TYPE_OBJECT as u8,
18245 false,
18246 false,
18247 false,
18248 false,
18249 false,
18250 false,
18251 0,
18252 ).to_ne_bytes()
18253 ),
18254});
18255}
18256unsafe extern "C" fn createRenderPipelineAsync<D: DomTypes>
18257(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
18258 let mut result = false;
18259 wrap_panic(&mut || result = (|| {
18260 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
18261 let this = &*(this as *const D::GPUDevice);
18262 let args = &*args;
18263 let argc = args.argc_;
18264
18265 if argc < 1 {
18266 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUDevice.createRenderPipelineAsync\".");
18267 return false;
18268 }
18269 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPURenderPipelineDescriptor<D> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
18270 Ok(ConversionResult::Success(value)) => value,
18271 Ok(ConversionResult::Failure(error)) => {
18272 throw_type_error(cx.raw_cx(), &error);
18273 return false;
18274
18275 }
18276 _ => {
18277 return false;
18278
18279 },
18280 }
18281 ;
18282 let result: Result<Rc<D::Promise>, Error> = this.CreateRenderPipelineAsync(&arg0, InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx()))), CanGc::note());
18283 let result = match result {
18284 Ok(result) => result,
18285 Err(e) => {
18286 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
18287 return false;
18288 },
18289 };
18290
18291 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
18292 return true;
18293 })());
18294 result
18295}
18296
18297unsafe extern "C" fn createRenderPipelineAsync_promise_wrapper<D: DomTypes>
18298(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
18299 let mut result = false;
18300 wrap_panic(&mut || result = (|| {
18301 let ok = createRenderPipelineAsync::<D>(cx, _obj, this, args);
18302 if ok {
18303 return true;
18304 }
18305 return exception_to_promise(cx, (*args).rval(), CanGc::note());
18306
18307 })());
18308 result
18309}
18310
18311
18312static createRenderPipelineAsync_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
18313
18314pub(crate) fn init_createRenderPipelineAsync_methodinfo<D: DomTypes>() {
18315 createRenderPipelineAsync_methodinfo.set(JSJitInfo {
18316 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
18317 method: Some(createRenderPipelineAsync_promise_wrapper::<D>)
18318 },
18319 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
18320 protoID: PrototypeList::ID::GPUDevice as u16,
18321 },
18322 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
18323 _bitfield_align_1: [],
18324 _bitfield_1: __BindgenBitfieldUnit::new(
18325 new_jsjitinfo_bitfield_1!(
18326 JSJitInfo_OpType::Method as u8,
18327 JSJitInfo_AliasSet::AliasEverything as u8,
18328 JSValueType::JSVAL_TYPE_OBJECT as u8,
18329 false,
18330 false,
18331 false,
18332 false,
18333 false,
18334 false,
18335 0,
18336 ).to_ne_bytes()
18337 ),
18338});
18339}
18340unsafe extern "C" fn createCommandEncoder<D: DomTypes>
18341(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
18342 let mut result = false;
18343 wrap_panic(&mut || result = (|| {
18344 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
18345 let this = &*(this as *const D::GPUDevice);
18346 let args = &*args;
18347 let argc = args.argc_;
18348 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPUCommandEncoderDescriptor = if args.get(0).is_undefined() {
18349 crate::codegen::GenericBindings::WebGPUBinding::GPUCommandEncoderDescriptor::empty()
18350 } else {
18351 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
18352 Ok(ConversionResult::Success(value)) => value,
18353 Ok(ConversionResult::Failure(error)) => {
18354 throw_type_error(cx.raw_cx(), &error);
18355 return false;
18356
18357 }
18358 _ => {
18359 return false;
18360
18361 },
18362 }
18363
18364 };
18365 let result: DomRoot<D::GPUCommandEncoder> = this.CreateCommandEncoder(&arg0);
18366
18367 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
18368 return true;
18369 })());
18370 result
18371}
18372
18373
18374static createCommandEncoder_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
18375
18376pub(crate) fn init_createCommandEncoder_methodinfo<D: DomTypes>() {
18377 createCommandEncoder_methodinfo.set(JSJitInfo {
18378 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
18379 method: Some(createCommandEncoder::<D>)
18380 },
18381 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
18382 protoID: PrototypeList::ID::GPUDevice as u16,
18383 },
18384 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
18385 _bitfield_align_1: [],
18386 _bitfield_1: __BindgenBitfieldUnit::new(
18387 new_jsjitinfo_bitfield_1!(
18388 JSJitInfo_OpType::Method as u8,
18389 JSJitInfo_AliasSet::AliasEverything as u8,
18390 JSValueType::JSVAL_TYPE_OBJECT as u8,
18391 false,
18392 false,
18393 false,
18394 false,
18395 false,
18396 false,
18397 0,
18398 ).to_ne_bytes()
18399 ),
18400});
18401}
18402unsafe extern "C" fn createRenderBundleEncoder<D: DomTypes>
18403(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
18404 let mut result = false;
18405 wrap_panic(&mut || result = (|| {
18406 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
18407 let this = &*(this as *const D::GPUDevice);
18408 let args = &*args;
18409 let argc = args.argc_;
18410
18411 if argc < 1 {
18412 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUDevice.createRenderBundleEncoder\".");
18413 return false;
18414 }
18415 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPURenderBundleEncoderDescriptor = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
18416 Ok(ConversionResult::Success(value)) => value,
18417 Ok(ConversionResult::Failure(error)) => {
18418 throw_type_error(cx.raw_cx(), &error);
18419 return false;
18420
18421 }
18422 _ => {
18423 return false;
18424
18425 },
18426 }
18427 ;
18428 let result: Result<DomRoot<D::GPURenderBundleEncoder>, Error> = this.CreateRenderBundleEncoder(&arg0);
18429 let result = match result {
18430 Ok(result) => result,
18431 Err(e) => {
18432 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
18433 return false;
18434 },
18435 };
18436
18437 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
18438 return true;
18439 })());
18440 result
18441}
18442
18443
18444static createRenderBundleEncoder_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
18445
18446pub(crate) fn init_createRenderBundleEncoder_methodinfo<D: DomTypes>() {
18447 createRenderBundleEncoder_methodinfo.set(JSJitInfo {
18448 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
18449 method: Some(createRenderBundleEncoder::<D>)
18450 },
18451 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
18452 protoID: PrototypeList::ID::GPUDevice as u16,
18453 },
18454 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
18455 _bitfield_align_1: [],
18456 _bitfield_1: __BindgenBitfieldUnit::new(
18457 new_jsjitinfo_bitfield_1!(
18458 JSJitInfo_OpType::Method as u8,
18459 JSJitInfo_AliasSet::AliasEverything as u8,
18460 JSValueType::JSVAL_TYPE_OBJECT as u8,
18461 false,
18462 false,
18463 false,
18464 false,
18465 false,
18466 false,
18467 0,
18468 ).to_ne_bytes()
18469 ),
18470});
18471}
18472unsafe extern "C" fn get_lost<D: DomTypes>
18473(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
18474 let mut result = false;
18475 wrap_panic(&mut || result = (|| {
18476 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
18477 let this = &*(this as *const D::GPUDevice);
18478 let result: Rc<D::Promise> = this.Lost();
18479
18480 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
18481 return true;
18482 })());
18483 result
18484}
18485
18486unsafe extern "C" fn get_lost_promise_wrapper<D: DomTypes>
18487(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
18488 let mut result = false;
18489 wrap_panic(&mut || result = (|| {
18490 let ok = get_lost::<D>(cx, _obj, this, args);
18491 if ok {
18492 return true;
18493 }
18494 return exception_to_promise(cx, args.rval(), CanGc::note());
18495
18496 })());
18497 result
18498}
18499
18500
18501static lost_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
18502
18503pub(crate) fn init_lost_getterinfo<D: DomTypes>() {
18504 lost_getterinfo.set(JSJitInfo {
18505 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
18506 getter: Some(get_lost_promise_wrapper::<D>)
18507 },
18508 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
18509 protoID: PrototypeList::ID::GPUDevice as u16,
18510 },
18511 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
18512 _bitfield_align_1: [],
18513 _bitfield_1: __BindgenBitfieldUnit::new(
18514 new_jsjitinfo_bitfield_1!(
18515 JSJitInfo_OpType::Getter as u8,
18516 JSJitInfo_AliasSet::AliasEverything as u8,
18517 JSValueType::JSVAL_TYPE_OBJECT as u8,
18518 true,
18519 false,
18520 false,
18521 false,
18522 false,
18523 false,
18524 0,
18525 ).to_ne_bytes()
18526 ),
18527});
18528}
18529unsafe extern "C" fn pushErrorScope<D: DomTypes>
18530(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
18531 let mut result = false;
18532 wrap_panic(&mut || result = (|| {
18533 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
18534 let this = &*(this as *const D::GPUDevice);
18535 let args = &*args;
18536 let argc = args.argc_;
18537
18538 if argc < 1 {
18539 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUDevice.pushErrorScope\".");
18540 return false;
18541 }
18542 let arg0: GPUErrorFilter = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
18543 Ok(ConversionResult::Success(value)) => value,
18544 Ok(ConversionResult::Failure(error)) => {
18545 throw_type_error(cx.raw_cx(), &error); return false;
18546
18547 }
18548 _ => {
18549 return false;
18550
18551 },
18552 }
18553 ;
18554 let result: () = this.PushErrorScope(arg0);
18555
18556 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
18557 return true;
18558 })());
18559 result
18560}
18561
18562
18563static pushErrorScope_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
18564
18565pub(crate) fn init_pushErrorScope_methodinfo<D: DomTypes>() {
18566 pushErrorScope_methodinfo.set(JSJitInfo {
18567 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
18568 method: Some(pushErrorScope::<D>)
18569 },
18570 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
18571 protoID: PrototypeList::ID::GPUDevice as u16,
18572 },
18573 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
18574 _bitfield_align_1: [],
18575 _bitfield_1: __BindgenBitfieldUnit::new(
18576 new_jsjitinfo_bitfield_1!(
18577 JSJitInfo_OpType::Method as u8,
18578 JSJitInfo_AliasSet::AliasEverything as u8,
18579 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
18580 false,
18581 false,
18582 false,
18583 false,
18584 false,
18585 false,
18586 0,
18587 ).to_ne_bytes()
18588 ),
18589});
18590}
18591unsafe extern "C" fn popErrorScope<D: DomTypes>
18592(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
18593 let mut result = false;
18594 wrap_panic(&mut || result = (|| {
18595 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
18596 let this = &*(this as *const D::GPUDevice);
18597 let args = &*args;
18598 let argc = args.argc_;
18599 let result: Rc<D::Promise> = this.PopErrorScope(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx()))), CanGc::note());
18600
18601 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
18602 return true;
18603 })());
18604 result
18605}
18606
18607unsafe extern "C" fn popErrorScope_promise_wrapper<D: DomTypes>
18608(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
18609 let mut result = false;
18610 wrap_panic(&mut || result = (|| {
18611 let ok = popErrorScope::<D>(cx, _obj, this, args);
18612 if ok {
18613 return true;
18614 }
18615 return exception_to_promise(cx, (*args).rval(), CanGc::note());
18616
18617 })());
18618 result
18619}
18620
18621
18622static popErrorScope_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
18623
18624pub(crate) fn init_popErrorScope_methodinfo<D: DomTypes>() {
18625 popErrorScope_methodinfo.set(JSJitInfo {
18626 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
18627 method: Some(popErrorScope_promise_wrapper::<D>)
18628 },
18629 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
18630 protoID: PrototypeList::ID::GPUDevice as u16,
18631 },
18632 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
18633 _bitfield_align_1: [],
18634 _bitfield_1: __BindgenBitfieldUnit::new(
18635 new_jsjitinfo_bitfield_1!(
18636 JSJitInfo_OpType::Method as u8,
18637 JSJitInfo_AliasSet::AliasEverything as u8,
18638 JSValueType::JSVAL_TYPE_OBJECT as u8,
18639 true,
18640 false,
18641 false,
18642 false,
18643 false,
18644 false,
18645 0,
18646 ).to_ne_bytes()
18647 ),
18648});
18649}
18650unsafe extern "C" fn get_onuncapturederror<D: DomTypes>
18651(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
18652 let mut result = false;
18653 wrap_panic(&mut || result = (|| {
18654 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
18655 let this = &*(this as *const D::GPUDevice);
18656 let result: Option<Rc<crate::codegen::GenericBindings::EventHandlerBinding::EventHandlerNonNull<D>>> = this.GetOnuncapturederror();
18657
18658 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
18659 return true;
18660 })());
18661 result
18662}
18663
18664unsafe extern "C" fn set_onuncapturederror<D: DomTypes>
18665(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
18666 let mut result = false;
18667 wrap_panic(&mut || result = {
18668 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
18669 let this = &*(this as *const D::GPUDevice);
18670 let arg0: Option<Rc<EventHandlerNonNull<D>>> = if HandleValue::from_raw(args.get(0)).get().is_object() {
18671 Some(EventHandlerNonNull::<D>::new(SafeJSContext::from_ptr(cx.raw_cx()), HandleValue::from_raw(args.get(0)).get().to_object()))
18672 } else {
18673 None
18674 };
18675 let result: () = this.SetOnuncapturederror(arg0);
18676
18677 true
18678 });
18679 result
18680}
18681
18682
18683static onuncapturederror_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
18684
18685pub(crate) fn init_onuncapturederror_getterinfo<D: DomTypes>() {
18686 onuncapturederror_getterinfo.set(JSJitInfo {
18687 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
18688 getter: Some(get_onuncapturederror::<D>)
18689 },
18690 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
18691 protoID: PrototypeList::ID::GPUDevice as u16,
18692 },
18693 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
18694 _bitfield_align_1: [],
18695 _bitfield_1: __BindgenBitfieldUnit::new(
18696 new_jsjitinfo_bitfield_1!(
18697 JSJitInfo_OpType::Getter as u8,
18698 JSJitInfo_AliasSet::AliasEverything as u8,
18699 JSValueType::JSVAL_TYPE_UNKNOWN as u8,
18700 true,
18701 false,
18702 false,
18703 false,
18704 false,
18705 false,
18706 0,
18707 ).to_ne_bytes()
18708 ),
18709});
18710}
18711static onuncapturederror_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
18712
18713pub(crate) fn init_onuncapturederror_setterinfo<D: DomTypes>() {
18714 onuncapturederror_setterinfo.set(JSJitInfo {
18715 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
18716 setter: Some(set_onuncapturederror::<D>)
18717 },
18718 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
18719 protoID: PrototypeList::ID::GPUDevice as u16,
18720 },
18721 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
18722 _bitfield_align_1: [],
18723 _bitfield_1: __BindgenBitfieldUnit::new(
18724 new_jsjitinfo_bitfield_1!(
18725 JSJitInfo_OpType::Setter as u8,
18726 JSJitInfo_AliasSet::AliasEverything as u8,
18727 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
18728 false,
18729 false,
18730 false,
18731 false,
18732 false,
18733 false,
18734 0,
18735 ).to_ne_bytes()
18736 ),
18737});
18738}
18739unsafe extern "C" fn get_label<D: DomTypes>
18740(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
18741 let mut result = false;
18742 wrap_panic(&mut || result = (|| {
18743 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
18744 let this = &*(this as *const D::GPUDevice);
18745 let result: USVString = this.Label();
18746
18747 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
18748 return true;
18749 })());
18750 result
18751}
18752
18753unsafe extern "C" fn set_label<D: DomTypes>
18754(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
18755 let mut result = false;
18756 wrap_panic(&mut || result = (|| {
18757 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
18758 let this = &*(this as *const D::GPUDevice);
18759 let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
18760 Ok(ConversionResult::Success(value)) => value,
18761 Ok(ConversionResult::Failure(error)) => {
18762 throw_type_error(cx.raw_cx(), &error);
18763 return false;
18764
18765 }
18766 _ => {
18767 return false;
18768
18769 },
18770 }
18771 ;
18772 let result: () = this.SetLabel(arg0);
18773
18774 true
18775 })());
18776 result
18777}
18778
18779
18780static label_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
18781
18782pub(crate) fn init_label_getterinfo<D: DomTypes>() {
18783 label_getterinfo.set(JSJitInfo {
18784 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
18785 getter: Some(get_label::<D>)
18786 },
18787 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
18788 protoID: PrototypeList::ID::GPUDevice as u16,
18789 },
18790 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
18791 _bitfield_align_1: [],
18792 _bitfield_1: __BindgenBitfieldUnit::new(
18793 new_jsjitinfo_bitfield_1!(
18794 JSJitInfo_OpType::Getter as u8,
18795 JSJitInfo_AliasSet::AliasEverything as u8,
18796 JSValueType::JSVAL_TYPE_STRING as u8,
18797 true,
18798 false,
18799 false,
18800 false,
18801 false,
18802 false,
18803 0,
18804 ).to_ne_bytes()
18805 ),
18806});
18807}
18808static label_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
18809
18810pub(crate) fn init_label_setterinfo<D: DomTypes>() {
18811 label_setterinfo.set(JSJitInfo {
18812 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
18813 setter: Some(set_label::<D>)
18814 },
18815 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
18816 protoID: PrototypeList::ID::GPUDevice as u16,
18817 },
18818 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
18819 _bitfield_align_1: [],
18820 _bitfield_1: __BindgenBitfieldUnit::new(
18821 new_jsjitinfo_bitfield_1!(
18822 JSJitInfo_OpType::Setter as u8,
18823 JSJitInfo_AliasSet::AliasEverything as u8,
18824 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
18825 false,
18826 false,
18827 false,
18828 false,
18829 false,
18830 false,
18831 0,
18832 ).to_ne_bytes()
18833 ),
18834});
18835}
18836unsafe extern "C" fn _finalize<D: DomTypes>
18837(_cx: *mut GCContext, obj: *mut JSObject){
18838 wrap_panic(&mut || {
18839
18840 let this = native_from_object_static::<D::GPUDevice>(obj).unwrap();
18841 finalize_weak_referenceable(obj, this);
18842 })
18843}
18844
18845unsafe extern "C" fn _trace<D: DomTypes>
18846(trc: *mut JSTracer, obj: *mut JSObject){
18847 wrap_panic(&mut || {
18848
18849 let this = native_from_object_static::<D::GPUDevice>(obj).unwrap();
18850 if this.is_null() { return; } (*this).trace(trc);
18852 })
18853}
18854
18855
18856static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
18857
18858pub(crate) fn init_class_ops<D: DomTypes>() {
18859 CLASS_OPS.set(JSClassOps {
18860 addProperty: None,
18861 delProperty: None,
18862 enumerate: None,
18863 newEnumerate: None,
18864 resolve: None,
18865 mayResolve: None,
18866 finalize: Some(_finalize::<D>),
18867 call: None,
18868 construct: None,
18869 trace: Some(_trace::<D>),
18870 });
18871}
18872
18873pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
18874
18875pub(crate) fn init_domjs_class<D: DomTypes>() {
18876 init_class_ops::<D>();
18877 Class.set(DOMJSClass {
18878 base: JSClass {
18879 name: c"GPUDevice".as_ptr(),
18880 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
18881 (((2) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
18882 ,
18883 cOps: unsafe { CLASS_OPS.get() },
18884 spec: ptr::null(),
18885 ext: ptr::null(),
18886 oOps: ptr::null(),
18887 },
18888 dom_class:
18889DOMClass {
18890 interface_chain: [ PrototypeList::ID::EventTarget, PrototypeList::ID::GPUDevice, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
18891 depth: 1,
18892 type_id: crate::codegen::InheritTypes::TopTypeId { eventtarget: (crate::codegen::InheritTypes::EventTargetTypeId::GPUDevice) },
18893 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUDevice> as unsafe fn(&mut _, _) -> _,
18894 global: Globals::EMPTY,
18895},
18896 });
18897}
18898
18899#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
18900(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUDevice>, _can_gc: CanGc) -> DomRoot<D::GPUDevice>{
18901
18902 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
18903
18904 let scope = scope.reflector().get_jsobject();
18905 assert!(!scope.get().is_null());
18906 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
18907 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
18908
18909 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
18910 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
18911 assert!(!canonical_proto.is_null());
18912
18913
18914 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
18915 if let Some(given) = given_proto {
18916 proto.set(*given);
18917 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
18918 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
18919 }
18920 } else {
18921 proto.set(*canonical_proto);
18922 }
18923 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
18924 cx.raw_cx(),
18925 &Class.get().base,
18926 proto.handle(),
18927 ));
18928 assert!(!obj.is_null());
18929 JS_SetReservedSlot(
18930 obj.get(),
18931 DOM_OBJECT_SLOT,
18932 &PrivateValue(raw.as_ptr() as *const libc::c_void),
18933 );
18934
18935 let val = PrivateValue(ptr::null());
18936 JS_SetReservedSlot(obj.get(), DOM_WEAK_SLOT, &val);
18937
18938 let root = raw.reflect_with(obj.get());
18939
18940
18941
18942 DomRoot::from_ref(&*root)
18943}
18944
18945pub trait GPUDeviceMethods<D: DomTypes> {
18946 fn Features(&self, ) -> DomRoot<D::GPUSupportedFeatures>;
18947 fn Limits(&self, ) -> DomRoot<D::GPUSupportedLimits>;
18948 fn AdapterInfo(&self, ) -> DomRoot<D::GPUAdapterInfo>;
18949 fn GetQueue(&self, ) -> DomRoot<D::GPUQueue>;
18950 fn Destroy(&self, );
18951 fn CreateBuffer(&self, r#descriptor: &crate::codegen::GenericBindings::WebGPUBinding::GPUBufferDescriptor) -> Fallible<DomRoot<D::GPUBuffer>>;
18952 fn CreateTexture(&self, r#descriptor: &crate::codegen::GenericBindings::WebGPUBinding::GPUTextureDescriptor) -> Fallible<DomRoot<D::GPUTexture>>;
18953 fn CreateSampler(&self, r#descriptor: &crate::codegen::GenericBindings::WebGPUBinding::GPUSamplerDescriptor) -> DomRoot<D::GPUSampler>;
18954 fn CreateBindGroupLayout(&self, r#descriptor: &crate::codegen::GenericBindings::WebGPUBinding::GPUBindGroupLayoutDescriptor) -> Fallible<DomRoot<D::GPUBindGroupLayout>>;
18955 fn CreatePipelineLayout(&self, r#descriptor: &crate::codegen::GenericBindings::WebGPUBinding::GPUPipelineLayoutDescriptor<D>) -> DomRoot<D::GPUPipelineLayout>;
18956 fn CreateBindGroup(&self, r#descriptor: &crate::codegen::GenericBindings::WebGPUBinding::GPUBindGroupDescriptor<D>) -> DomRoot<D::GPUBindGroup>;
18957 fn CreateShaderModule(&self, r#descriptor: RootedTraceableBox<crate::codegen::GenericBindings::WebGPUBinding::GPUShaderModuleDescriptor>, r#_comp: InRealm, r#_can_gc: CanGc) -> DomRoot<D::GPUShaderModule>;
18958 fn CreateComputePipeline(&self, r#descriptor: &crate::codegen::GenericBindings::WebGPUBinding::GPUComputePipelineDescriptor<D>) -> DomRoot<D::GPUComputePipeline>;
18959 fn CreateRenderPipeline(&self, r#descriptor: &crate::codegen::GenericBindings::WebGPUBinding::GPURenderPipelineDescriptor<D>) -> Fallible<DomRoot<D::GPURenderPipeline>>;
18960 fn CreateComputePipelineAsync(&self, r#descriptor: &crate::codegen::GenericBindings::WebGPUBinding::GPUComputePipelineDescriptor<D>, r#_comp: InRealm, r#_can_gc: CanGc) -> Rc<D::Promise>;
18961 fn CreateRenderPipelineAsync(&self, r#descriptor: &crate::codegen::GenericBindings::WebGPUBinding::GPURenderPipelineDescriptor<D>, r#_comp: InRealm, r#_can_gc: CanGc) -> Fallible<Rc<D::Promise>>;
18962 fn CreateCommandEncoder(&self, r#descriptor: &crate::codegen::GenericBindings::WebGPUBinding::GPUCommandEncoderDescriptor) -> DomRoot<D::GPUCommandEncoder>;
18963 fn CreateRenderBundleEncoder(&self, r#descriptor: &crate::codegen::GenericBindings::WebGPUBinding::GPURenderBundleEncoderDescriptor) -> Fallible<DomRoot<D::GPURenderBundleEncoder>>;
18964 fn Lost(&self, ) -> Rc<D::Promise>;
18965 fn PushErrorScope(&self, r#filter: GPUErrorFilter);
18966 fn PopErrorScope(&self, r#_comp: InRealm, r#_can_gc: CanGc) -> Rc<D::Promise>;
18967 fn GetOnuncapturederror(&self, ) -> Option<Rc<crate::codegen::GenericBindings::EventHandlerBinding::EventHandlerNonNull<D>>>;
18968 fn SetOnuncapturederror(&self, r#value: Option<Rc<EventHandlerNonNull<D>>>);
18969 fn Label(&self, ) -> USVString;
18970 fn SetLabel(&self, r#value: USVString);
18971}
18972static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
18973
18974pub(crate) fn init_sMethods_specs<D: DomTypes>() {
18975 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
18976 JSFunctionSpec {
18977 name: JSPropertySpec_Name { string_: c"destroy".as_ptr() },
18978 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { destroy_methodinfo.get() } as *const _ as *const JSJitInfo },
18979 nargs: 0,
18980 flags: (JSPROP_ENUMERATE) as u16,
18981 selfHostedName: ptr::null()
18982 },
18983 JSFunctionSpec {
18984 name: JSPropertySpec_Name { string_: c"createBuffer".as_ptr() },
18985 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { createBuffer_methodinfo.get() } as *const _ as *const JSJitInfo },
18986 nargs: 1,
18987 flags: (JSPROP_ENUMERATE) as u16,
18988 selfHostedName: ptr::null()
18989 },
18990 JSFunctionSpec {
18991 name: JSPropertySpec_Name { string_: c"createTexture".as_ptr() },
18992 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { createTexture_methodinfo.get() } as *const _ as *const JSJitInfo },
18993 nargs: 1,
18994 flags: (JSPROP_ENUMERATE) as u16,
18995 selfHostedName: ptr::null()
18996 },
18997 JSFunctionSpec {
18998 name: JSPropertySpec_Name { string_: c"createSampler".as_ptr() },
18999 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { createSampler_methodinfo.get() } as *const _ as *const JSJitInfo },
19000 nargs: 0,
19001 flags: (JSPROP_ENUMERATE) as u16,
19002 selfHostedName: ptr::null()
19003 },
19004 JSFunctionSpec {
19005 name: JSPropertySpec_Name { string_: c"createBindGroupLayout".as_ptr() },
19006 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { createBindGroupLayout_methodinfo.get() } as *const _ as *const JSJitInfo },
19007 nargs: 1,
19008 flags: (JSPROP_ENUMERATE) as u16,
19009 selfHostedName: ptr::null()
19010 },
19011 JSFunctionSpec {
19012 name: JSPropertySpec_Name { string_: c"createPipelineLayout".as_ptr() },
19013 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { createPipelineLayout_methodinfo.get() } as *const _ as *const JSJitInfo },
19014 nargs: 1,
19015 flags: (JSPROP_ENUMERATE) as u16,
19016 selfHostedName: ptr::null()
19017 },
19018 JSFunctionSpec {
19019 name: JSPropertySpec_Name { string_: c"createBindGroup".as_ptr() },
19020 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { createBindGroup_methodinfo.get() } as *const _ as *const JSJitInfo },
19021 nargs: 1,
19022 flags: (JSPROP_ENUMERATE) as u16,
19023 selfHostedName: ptr::null()
19024 },
19025 JSFunctionSpec {
19026 name: JSPropertySpec_Name { string_: c"createShaderModule".as_ptr() },
19027 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { createShaderModule_methodinfo.get() } as *const _ as *const JSJitInfo },
19028 nargs: 1,
19029 flags: (JSPROP_ENUMERATE) as u16,
19030 selfHostedName: ptr::null()
19031 },
19032 JSFunctionSpec {
19033 name: JSPropertySpec_Name { string_: c"createComputePipeline".as_ptr() },
19034 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { createComputePipeline_methodinfo.get() } as *const _ as *const JSJitInfo },
19035 nargs: 1,
19036 flags: (JSPROP_ENUMERATE) as u16,
19037 selfHostedName: ptr::null()
19038 },
19039 JSFunctionSpec {
19040 name: JSPropertySpec_Name { string_: c"createRenderPipeline".as_ptr() },
19041 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { createRenderPipeline_methodinfo.get() } as *const _ as *const JSJitInfo },
19042 nargs: 1,
19043 flags: (JSPROP_ENUMERATE) as u16,
19044 selfHostedName: ptr::null()
19045 },
19046 JSFunctionSpec {
19047 name: JSPropertySpec_Name { string_: c"createComputePipelineAsync".as_ptr() },
19048 call: JSNativeWrapper { op: Some(generic_method::<true>), info: unsafe { createComputePipelineAsync_methodinfo.get() } as *const _ as *const JSJitInfo },
19049 nargs: 1,
19050 flags: (JSPROP_ENUMERATE) as u16,
19051 selfHostedName: ptr::null()
19052 },
19053 JSFunctionSpec {
19054 name: JSPropertySpec_Name { string_: c"createRenderPipelineAsync".as_ptr() },
19055 call: JSNativeWrapper { op: Some(generic_method::<true>), info: unsafe { createRenderPipelineAsync_methodinfo.get() } as *const _ as *const JSJitInfo },
19056 nargs: 1,
19057 flags: (JSPROP_ENUMERATE) as u16,
19058 selfHostedName: ptr::null()
19059 },
19060 JSFunctionSpec {
19061 name: JSPropertySpec_Name { string_: c"createCommandEncoder".as_ptr() },
19062 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { createCommandEncoder_methodinfo.get() } as *const _ as *const JSJitInfo },
19063 nargs: 0,
19064 flags: (JSPROP_ENUMERATE) as u16,
19065 selfHostedName: ptr::null()
19066 },
19067 JSFunctionSpec {
19068 name: JSPropertySpec_Name { string_: c"createRenderBundleEncoder".as_ptr() },
19069 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { createRenderBundleEncoder_methodinfo.get() } as *const _ as *const JSJitInfo },
19070 nargs: 1,
19071 flags: (JSPROP_ENUMERATE) as u16,
19072 selfHostedName: ptr::null()
19073 },
19074 JSFunctionSpec {
19075 name: JSPropertySpec_Name { string_: c"pushErrorScope".as_ptr() },
19076 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { pushErrorScope_methodinfo.get() } as *const _ as *const JSJitInfo },
19077 nargs: 1,
19078 flags: (JSPROP_ENUMERATE) as u16,
19079 selfHostedName: ptr::null()
19080 },
19081 JSFunctionSpec {
19082 name: JSPropertySpec_Name { string_: c"popErrorScope".as_ptr() },
19083 call: JSNativeWrapper { op: Some(generic_method::<true>), info: unsafe { popErrorScope_methodinfo.get() } as *const _ as *const JSJitInfo },
19084 nargs: 0,
19085 flags: (JSPROP_ENUMERATE) as u16,
19086 selfHostedName: ptr::null()
19087 },
19088 JSFunctionSpec {
19089 name: JSPropertySpec_Name { string_: ptr::null() },
19090 call: JSNativeWrapper { op: None, info: ptr::null() },
19091 nargs: 0,
19092 flags: 0,
19093 selfHostedName: ptr::null()
19094 }]))[..]
19095])));
19096}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
19097
19098pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
19099 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sMethods_specs.get() })[0])])));
19100}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
19101
19102pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
19103 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
19104 JSPropertySpec {
19105 name: JSPropertySpec_Name { string_: c"features".as_ptr() },
19106 attributes_: (JSPROP_ENUMERATE),
19107 kind_: (JSPropertySpec_Kind::NativeAccessor),
19108 u: JSPropertySpec_AccessorsOrValue {
19109 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
19110 getter: JSPropertySpec_Accessor {
19111 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { features_getterinfo.get() } },
19112 },
19113 setter: JSPropertySpec_Accessor {
19114 native: JSNativeWrapper { op: None, info: ptr::null() },
19115 }
19116 }
19117 }
19118 }
19119,
19120 JSPropertySpec {
19121 name: JSPropertySpec_Name { string_: c"limits".as_ptr() },
19122 attributes_: (JSPROP_ENUMERATE),
19123 kind_: (JSPropertySpec_Kind::NativeAccessor),
19124 u: JSPropertySpec_AccessorsOrValue {
19125 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
19126 getter: JSPropertySpec_Accessor {
19127 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { limits_getterinfo.get() } },
19128 },
19129 setter: JSPropertySpec_Accessor {
19130 native: JSNativeWrapper { op: None, info: ptr::null() },
19131 }
19132 }
19133 }
19134 }
19135,
19136 JSPropertySpec {
19137 name: JSPropertySpec_Name { string_: c"adapterInfo".as_ptr() },
19138 attributes_: (JSPROP_ENUMERATE),
19139 kind_: (JSPropertySpec_Kind::NativeAccessor),
19140 u: JSPropertySpec_AccessorsOrValue {
19141 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
19142 getter: JSPropertySpec_Accessor {
19143 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { adapterInfo_getterinfo.get() } },
19144 },
19145 setter: JSPropertySpec_Accessor {
19146 native: JSNativeWrapper { op: None, info: ptr::null() },
19147 }
19148 }
19149 }
19150 }
19151,
19152 JSPropertySpec {
19153 name: JSPropertySpec_Name { string_: c"queue".as_ptr() },
19154 attributes_: (JSPROP_ENUMERATE),
19155 kind_: (JSPropertySpec_Kind::NativeAccessor),
19156 u: JSPropertySpec_AccessorsOrValue {
19157 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
19158 getter: JSPropertySpec_Accessor {
19159 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { queue_getterinfo.get() } },
19160 },
19161 setter: JSPropertySpec_Accessor {
19162 native: JSNativeWrapper { op: None, info: ptr::null() },
19163 }
19164 }
19165 }
19166 }
19167,
19168 JSPropertySpec {
19169 name: JSPropertySpec_Name { string_: c"lost".as_ptr() },
19170 attributes_: (JSPROP_ENUMERATE),
19171 kind_: (JSPropertySpec_Kind::NativeAccessor),
19172 u: JSPropertySpec_AccessorsOrValue {
19173 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
19174 getter: JSPropertySpec_Accessor {
19175 native: JSNativeWrapper { op: Some(generic_getter::<true>), info: unsafe { lost_getterinfo.get() } },
19176 },
19177 setter: JSPropertySpec_Accessor {
19178 native: JSNativeWrapper { op: None, info: ptr::null() },
19179 }
19180 }
19181 }
19182 }
19183,
19184 JSPropertySpec {
19185 name: JSPropertySpec_Name { string_: c"onuncapturederror".as_ptr() },
19186 attributes_: (JSPROP_ENUMERATE),
19187 kind_: (JSPropertySpec_Kind::NativeAccessor),
19188 u: JSPropertySpec_AccessorsOrValue {
19189 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
19190 getter: JSPropertySpec_Accessor {
19191 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { onuncapturederror_getterinfo.get() } },
19192 },
19193 setter: JSPropertySpec_Accessor {
19194 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { onuncapturederror_setterinfo.get() } },
19195 }
19196 }
19197 }
19198 }
19199,
19200 JSPropertySpec {
19201 name: JSPropertySpec_Name { string_: c"label".as_ptr() },
19202 attributes_: (JSPROP_ENUMERATE),
19203 kind_: (JSPropertySpec_Kind::NativeAccessor),
19204 u: JSPropertySpec_AccessorsOrValue {
19205 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
19206 getter: JSPropertySpec_Accessor {
19207 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { label_getterinfo.get() } },
19208 },
19209 setter: JSPropertySpec_Accessor {
19210 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { label_setterinfo.get() } },
19211 }
19212 }
19213 }
19214 }
19215,
19216 JSPropertySpec::ZERO]))[..]
19217,
19218&Box::leak(Box::new([
19219 JSPropertySpec {
19220 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
19221 attributes_: (JSPROP_READONLY),
19222 kind_: (JSPropertySpec_Kind::Value),
19223 u: JSPropertySpec_AccessorsOrValue {
19224 value: JSPropertySpec_ValueWrapper {
19225 type_: JSPropertySpec_ValueWrapper_Type::String,
19226 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
19227 string: c"GPUDevice".as_ptr(),
19228 }
19229 }
19230 }
19231 }
19232,
19233 JSPropertySpec::ZERO]))[..]
19234])));
19235}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
19236
19237pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
19238 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
19239 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
19240}
19241pub fn GetProtoObject<D: DomTypes>
19242(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
19243 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUDevice), CreateInterfaceObjects::<D>, rval)
19245}
19246
19247
19248static PrototypeClass: JSClass = JSClass {
19249 name: c"GPUDevicePrototype".as_ptr(),
19250 flags:
19251 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
19253 cOps: ptr::null(),
19254 spec: ptr::null(),
19255 ext: ptr::null(),
19256 oOps: ptr::null(),
19257};
19258
19259
19260static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
19261
19262pub(crate) fn init_interface_object<D: DomTypes>() {
19263 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
19264 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
19265 b"function GPUDevice() {\n [native code]\n}",
19266 PrototypeList::ID::GPUDevice,
19267 1,
19268 ));
19269}
19270
19271pub fn DefineDOMInterface<D: DomTypes>
19272(cx: SafeJSContext, global: HandleObject){
19273 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUDevice),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
19274}
19275
19276pub fn ConstructorEnabled<D: DomTypes>
19277(aCx: SafeJSContext, aObj: HandleObject) -> bool{
19278 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
19279 pref!(dom_webgpu_enabled)
19280}
19281
19282unsafe fn CreateInterfaceObjects<D: DomTypes>
19283(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
19284
19285 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
19286 EventTarget_Binding::GetProtoObject::<D>(cx, global, prototype_proto.handle_mut());
19287 assert!(!prototype_proto.is_null());
19288
19289 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
19290 create_interface_prototype_object::<D>(cx,
19291 global,
19292 prototype_proto.handle(),
19293 &PrototypeClass,
19294 sMethods.get(),
19295 sAttributes.get(),
19296 &[],
19297 &[],
19298 prototype.handle_mut());
19299 assert!(!prototype.is_null());
19300 assert!((*cache)[PrototypeList::ID::GPUDevice as usize].is_null());
19301 (*cache)[PrototypeList::ID::GPUDevice as usize] = prototype.get();
19302 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUDevice as isize),
19303 ptr::null_mut(),
19304 prototype.get());
19305
19306 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
19307
19308 EventTarget_Binding::GetConstructorObject::<D>(cx, global, interface_proto.handle_mut());
19309
19310 assert!(!interface_proto.is_null());
19311
19312 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
19313 create_noncallback_interface_object::<D>(cx,
19314 global,
19315 interface_proto.handle(),
19316 INTERFACE_OBJECT_CLASS.get(),
19317 &[],
19318 &[],
19319 &[],
19320 prototype.handle(),
19321 c"GPUDevice",
19322 0,
19323 &[],
19324 interface.handle_mut());
19325 assert!(!interface.is_null());
19326}
19327
19328
19329 pub(crate) fn init_statics<D: DomTypes>() {
19330 init_interface_object::<D>();
19331 init_domjs_class::<D>();
19332 crate::codegen::GenericBindings::WebGPUBinding::GPUDevice_Binding::init_destroy_methodinfo::<D>();
19333crate::codegen::GenericBindings::WebGPUBinding::GPUDevice_Binding::init_createBuffer_methodinfo::<D>();
19334crate::codegen::GenericBindings::WebGPUBinding::GPUDevice_Binding::init_createTexture_methodinfo::<D>();
19335crate::codegen::GenericBindings::WebGPUBinding::GPUDevice_Binding::init_createSampler_methodinfo::<D>();
19336crate::codegen::GenericBindings::WebGPUBinding::GPUDevice_Binding::init_createBindGroupLayout_methodinfo::<D>();
19337crate::codegen::GenericBindings::WebGPUBinding::GPUDevice_Binding::init_createPipelineLayout_methodinfo::<D>();
19338crate::codegen::GenericBindings::WebGPUBinding::GPUDevice_Binding::init_createBindGroup_methodinfo::<D>();
19339crate::codegen::GenericBindings::WebGPUBinding::GPUDevice_Binding::init_createShaderModule_methodinfo::<D>();
19340crate::codegen::GenericBindings::WebGPUBinding::GPUDevice_Binding::init_createComputePipeline_methodinfo::<D>();
19341crate::codegen::GenericBindings::WebGPUBinding::GPUDevice_Binding::init_createRenderPipeline_methodinfo::<D>();
19342crate::codegen::GenericBindings::WebGPUBinding::GPUDevice_Binding::init_createComputePipelineAsync_methodinfo::<D>();
19343crate::codegen::GenericBindings::WebGPUBinding::GPUDevice_Binding::init_createRenderPipelineAsync_methodinfo::<D>();
19344crate::codegen::GenericBindings::WebGPUBinding::GPUDevice_Binding::init_createCommandEncoder_methodinfo::<D>();
19345crate::codegen::GenericBindings::WebGPUBinding::GPUDevice_Binding::init_createRenderBundleEncoder_methodinfo::<D>();
19346crate::codegen::GenericBindings::WebGPUBinding::GPUDevice_Binding::init_pushErrorScope_methodinfo::<D>();
19347crate::codegen::GenericBindings::WebGPUBinding::GPUDevice_Binding::init_popErrorScope_methodinfo::<D>();
19348 init_features_getterinfo::<D>();
19349init_limits_getterinfo::<D>();
19350init_adapterInfo_getterinfo::<D>();
19351init_queue_getterinfo::<D>();
19352init_lost_getterinfo::<D>();
19353init_onuncapturederror_getterinfo::<D>();
19354init_label_getterinfo::<D>();
19355 init_onuncapturederror_setterinfo::<D>();
19356init_label_setterinfo::<D>();
19357
19358 init_sMethods_specs::<D>();
19359init_sMethods_prefs::<D>();
19360init_sAttributes_specs::<D>();
19361init_sAttributes_prefs::<D>();
19362 }
19363 } pub use self::GPUDeviceLostInfo_Binding::{Wrap as GPUDeviceLostInfoWrap, GPUDeviceLostInfoMethods, GetProtoObject as GPUDeviceLostInfoGetProtoObject, DefineDOMInterface as GPUDeviceLostInfoDefineDOMInterface};
19367pub mod GPUDeviceLostInfo_Binding {
19368use crate::codegen::GenericBindings::WebGPUBinding::GPUDeviceLostReason;
19369use crate::codegen::GenericBindings::WebGPUBinding::GPUDeviceLostReasonValues;
19370use crate::import::module::*;
19371
19372unsafe extern "C" fn get_reason<D: DomTypes>
19373(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
19374 let mut result = false;
19375 wrap_panic(&mut || result = (|| {
19376 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
19377 let this = &*(this as *const D::GPUDeviceLostInfo);
19378 let result: GPUDeviceLostReason = this.Reason();
19379
19380 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
19381 return true;
19382 })());
19383 result
19384}
19385
19386
19387static reason_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
19388
19389pub(crate) fn init_reason_getterinfo<D: DomTypes>() {
19390 reason_getterinfo.set(JSJitInfo {
19391 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
19392 getter: Some(get_reason::<D>)
19393 },
19394 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
19395 protoID: PrototypeList::ID::GPUDeviceLostInfo as u16,
19396 },
19397 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
19398 _bitfield_align_1: [],
19399 _bitfield_1: __BindgenBitfieldUnit::new(
19400 new_jsjitinfo_bitfield_1!(
19401 JSJitInfo_OpType::Getter as u8,
19402 JSJitInfo_AliasSet::AliasEverything as u8,
19403 JSValueType::JSVAL_TYPE_STRING as u8,
19404 true,
19405 false,
19406 false,
19407 false,
19408 false,
19409 false,
19410 0,
19411 ).to_ne_bytes()
19412 ),
19413});
19414}
19415unsafe extern "C" fn get_message<D: DomTypes>
19416(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
19417 let mut result = false;
19418 wrap_panic(&mut || result = (|| {
19419 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
19420 let this = &*(this as *const D::GPUDeviceLostInfo);
19421 let result: DOMString = this.Message();
19422
19423 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
19424 return true;
19425 })());
19426 result
19427}
19428
19429
19430static message_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
19431
19432pub(crate) fn init_message_getterinfo<D: DomTypes>() {
19433 message_getterinfo.set(JSJitInfo {
19434 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
19435 getter: Some(get_message::<D>)
19436 },
19437 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
19438 protoID: PrototypeList::ID::GPUDeviceLostInfo as u16,
19439 },
19440 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
19441 _bitfield_align_1: [],
19442 _bitfield_1: __BindgenBitfieldUnit::new(
19443 new_jsjitinfo_bitfield_1!(
19444 JSJitInfo_OpType::Getter as u8,
19445 JSJitInfo_AliasSet::AliasEverything as u8,
19446 JSValueType::JSVAL_TYPE_STRING as u8,
19447 true,
19448 false,
19449 false,
19450 false,
19451 false,
19452 false,
19453 0,
19454 ).to_ne_bytes()
19455 ),
19456});
19457}
19458unsafe extern "C" fn _finalize<D: DomTypes>
19459(_cx: *mut GCContext, obj: *mut JSObject){
19460 wrap_panic(&mut || {
19461
19462 let this = native_from_object_static::<D::GPUDeviceLostInfo>(obj).unwrap();
19463 finalize_common(this);
19464 })
19465}
19466
19467unsafe extern "C" fn _trace<D: DomTypes>
19468(trc: *mut JSTracer, obj: *mut JSObject){
19469 wrap_panic(&mut || {
19470
19471 let this = native_from_object_static::<D::GPUDeviceLostInfo>(obj).unwrap();
19472 if this.is_null() { return; } (*this).trace(trc);
19474 })
19475}
19476
19477
19478static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
19479
19480pub(crate) fn init_class_ops<D: DomTypes>() {
19481 CLASS_OPS.set(JSClassOps {
19482 addProperty: None,
19483 delProperty: None,
19484 enumerate: None,
19485 newEnumerate: None,
19486 resolve: None,
19487 mayResolve: None,
19488 finalize: Some(_finalize::<D>),
19489 call: None,
19490 construct: None,
19491 trace: Some(_trace::<D>),
19492 });
19493}
19494
19495pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
19496
19497pub(crate) fn init_domjs_class<D: DomTypes>() {
19498 init_class_ops::<D>();
19499 Class.set(DOMJSClass {
19500 base: JSClass {
19501 name: c"GPUDeviceLostInfo".as_ptr(),
19502 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
19503 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
19504 ,
19505 cOps: unsafe { CLASS_OPS.get() },
19506 spec: ptr::null(),
19507 ext: ptr::null(),
19508 oOps: ptr::null(),
19509 },
19510 dom_class:
19511DOMClass {
19512 interface_chain: [ PrototypeList::ID::GPUDeviceLostInfo, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
19513 depth: 0,
19514 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
19515 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUDeviceLostInfo> as unsafe fn(&mut _, _) -> _,
19516 global: Globals::EMPTY,
19517},
19518 });
19519}
19520
19521#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
19522(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUDeviceLostInfo>, _can_gc: CanGc) -> DomRoot<D::GPUDeviceLostInfo>{
19523
19524 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
19525
19526 let scope = scope.reflector().get_jsobject();
19527 assert!(!scope.get().is_null());
19528 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
19529 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
19530
19531 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
19532 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
19533 assert!(!canonical_proto.is_null());
19534
19535
19536 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
19537 if let Some(given) = given_proto {
19538 proto.set(*given);
19539 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
19540 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
19541 }
19542 } else {
19543 proto.set(*canonical_proto);
19544 }
19545 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
19546 cx.raw_cx(),
19547 &Class.get().base,
19548 proto.handle(),
19549 ));
19550 assert!(!obj.is_null());
19551 JS_SetReservedSlot(
19552 obj.get(),
19553 DOM_OBJECT_SLOT,
19554 &PrivateValue(raw.as_ptr() as *const libc::c_void),
19555 );
19556
19557 let root = raw.reflect_with(obj.get());
19558
19559
19560
19561 DomRoot::from_ref(&*root)
19562}
19563
19564pub trait GPUDeviceLostInfoMethods<D: DomTypes> {
19565 fn Reason(&self, ) -> GPUDeviceLostReason;
19566 fn Message(&self, ) -> DOMString;
19567}
19568static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
19569
19570pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
19571 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
19572 JSPropertySpec {
19573 name: JSPropertySpec_Name { string_: c"reason".as_ptr() },
19574 attributes_: (JSPROP_ENUMERATE),
19575 kind_: (JSPropertySpec_Kind::NativeAccessor),
19576 u: JSPropertySpec_AccessorsOrValue {
19577 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
19578 getter: JSPropertySpec_Accessor {
19579 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { reason_getterinfo.get() } },
19580 },
19581 setter: JSPropertySpec_Accessor {
19582 native: JSNativeWrapper { op: None, info: ptr::null() },
19583 }
19584 }
19585 }
19586 }
19587,
19588 JSPropertySpec {
19589 name: JSPropertySpec_Name { string_: c"message".as_ptr() },
19590 attributes_: (JSPROP_ENUMERATE),
19591 kind_: (JSPropertySpec_Kind::NativeAccessor),
19592 u: JSPropertySpec_AccessorsOrValue {
19593 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
19594 getter: JSPropertySpec_Accessor {
19595 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { message_getterinfo.get() } },
19596 },
19597 setter: JSPropertySpec_Accessor {
19598 native: JSNativeWrapper { op: None, info: ptr::null() },
19599 }
19600 }
19601 }
19602 }
19603,
19604 JSPropertySpec::ZERO]))[..]
19605,
19606&Box::leak(Box::new([
19607 JSPropertySpec {
19608 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
19609 attributes_: (JSPROP_READONLY),
19610 kind_: (JSPropertySpec_Kind::Value),
19611 u: JSPropertySpec_AccessorsOrValue {
19612 value: JSPropertySpec_ValueWrapper {
19613 type_: JSPropertySpec_ValueWrapper_Type::String,
19614 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
19615 string: c"GPUDeviceLostInfo".as_ptr(),
19616 }
19617 }
19618 }
19619 }
19620,
19621 JSPropertySpec::ZERO]))[..]
19622])));
19623}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
19624
19625pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
19626 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::SERVICE_WORKER_GLOBAL_SCOPE),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
19627 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
19628}
19629pub fn GetProtoObject<D: DomTypes>
19630(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
19631 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUDeviceLostInfo), CreateInterfaceObjects::<D>, rval)
19633}
19634
19635
19636static PrototypeClass: JSClass = JSClass {
19637 name: c"GPUDeviceLostInfoPrototype".as_ptr(),
19638 flags:
19639 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
19641 cOps: ptr::null(),
19642 spec: ptr::null(),
19643 ext: ptr::null(),
19644 oOps: ptr::null(),
19645};
19646
19647
19648static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
19649
19650pub(crate) fn init_interface_object<D: DomTypes>() {
19651 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
19652 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
19653 b"function GPUDeviceLostInfo() {\n [native code]\n}",
19654 PrototypeList::ID::GPUDeviceLostInfo,
19655 0,
19656 ));
19657}
19658
19659pub fn DefineDOMInterface<D: DomTypes>
19660(cx: SafeJSContext, global: HandleObject){
19661 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUDeviceLostInfo),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
19662}
19663
19664pub fn ConstructorEnabled<D: DomTypes>
19665(aCx: SafeJSContext, aObj: HandleObject) -> bool{
19666 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::SERVICE_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
19667 pref!(dom_webgpu_enabled)
19668}
19669
19670unsafe fn CreateInterfaceObjects<D: DomTypes>
19671(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
19672
19673 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
19674 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
19675 assert!(!prototype_proto.is_null());
19676
19677 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
19678 create_interface_prototype_object::<D>(cx,
19679 global,
19680 prototype_proto.handle(),
19681 &PrototypeClass,
19682 &[],
19683 sAttributes.get(),
19684 &[],
19685 &[],
19686 prototype.handle_mut());
19687 assert!(!prototype.is_null());
19688 assert!((*cache)[PrototypeList::ID::GPUDeviceLostInfo as usize].is_null());
19689 (*cache)[PrototypeList::ID::GPUDeviceLostInfo as usize] = prototype.get();
19690 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUDeviceLostInfo as isize),
19691 ptr::null_mut(),
19692 prototype.get());
19693
19694 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
19695 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
19696
19697 assert!(!interface_proto.is_null());
19698
19699 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
19700 create_noncallback_interface_object::<D>(cx,
19701 global,
19702 interface_proto.handle(),
19703 INTERFACE_OBJECT_CLASS.get(),
19704 &[],
19705 &[],
19706 &[],
19707 prototype.handle(),
19708 c"GPUDeviceLostInfo",
19709 0,
19710 &[],
19711 interface.handle_mut());
19712 assert!(!interface.is_null());
19713}
19714
19715
19716 pub(crate) fn init_statics<D: DomTypes>() {
19717 init_interface_object::<D>();
19718 init_domjs_class::<D>();
19719
19720 init_reason_getterinfo::<D>();
19721init_message_getterinfo::<D>();
19722
19723
19724 init_sAttributes_specs::<D>();
19725init_sAttributes_prefs::<D>();
19726 }
19727 } pub use self::GPUError_Binding::{Wrap as GPUErrorWrap, GPUErrorMethods, GetProtoObject as GPUErrorGetProtoObject, GetConstructorObject as GPUErrorGetConstructorObject, DefineDOMInterface as GPUErrorDefineDOMInterface};
19731pub mod GPUError_Binding {
19732use crate::import::module::*;
19733
19734unsafe extern "C" fn get_message<D: DomTypes>
19735(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
19736 let mut result = false;
19737 wrap_panic(&mut || result = (|| {
19738 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
19739 let this = &*(this as *const D::GPUError);
19740 let result: DOMString = this.Message();
19741
19742 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
19743 return true;
19744 })());
19745 result
19746}
19747
19748
19749static message_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
19750
19751pub(crate) fn init_message_getterinfo<D: DomTypes>() {
19752 message_getterinfo.set(JSJitInfo {
19753 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
19754 getter: Some(get_message::<D>)
19755 },
19756 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
19757 protoID: PrototypeList::ID::GPUError as u16,
19758 },
19759 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
19760 _bitfield_align_1: [],
19761 _bitfield_1: __BindgenBitfieldUnit::new(
19762 new_jsjitinfo_bitfield_1!(
19763 JSJitInfo_OpType::Getter as u8,
19764 JSJitInfo_AliasSet::AliasEverything as u8,
19765 JSValueType::JSVAL_TYPE_STRING as u8,
19766 true,
19767 false,
19768 false,
19769 false,
19770 false,
19771 false,
19772 0,
19773 ).to_ne_bytes()
19774 ),
19775});
19776}
19777unsafe extern "C" fn _finalize<D: DomTypes>
19778(_cx: *mut GCContext, obj: *mut JSObject){
19779 wrap_panic(&mut || {
19780
19781 let this = native_from_object_static::<D::GPUError>(obj).unwrap();
19782 finalize_common(this);
19783 })
19784}
19785
19786unsafe extern "C" fn _trace<D: DomTypes>
19787(trc: *mut JSTracer, obj: *mut JSObject){
19788 wrap_panic(&mut || {
19789
19790 let this = native_from_object_static::<D::GPUError>(obj).unwrap();
19791 if this.is_null() { return; } (*this).trace(trc);
19793 })
19794}
19795
19796
19797static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
19798
19799pub(crate) fn init_class_ops<D: DomTypes>() {
19800 CLASS_OPS.set(JSClassOps {
19801 addProperty: None,
19802 delProperty: None,
19803 enumerate: None,
19804 newEnumerate: None,
19805 resolve: None,
19806 mayResolve: None,
19807 finalize: Some(_finalize::<D>),
19808 call: None,
19809 construct: None,
19810 trace: Some(_trace::<D>),
19811 });
19812}
19813
19814pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
19815
19816pub(crate) fn init_domjs_class<D: DomTypes>() {
19817 init_class_ops::<D>();
19818 Class.set(DOMJSClass {
19819 base: JSClass {
19820 name: c"GPUError".as_ptr(),
19821 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
19822 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
19823 ,
19824 cOps: unsafe { CLASS_OPS.get() },
19825 spec: ptr::null(),
19826 ext: ptr::null(),
19827 oOps: ptr::null(),
19828 },
19829 dom_class:
19830DOMClass {
19831 interface_chain: [ PrototypeList::ID::GPUError, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
19832 depth: 0,
19833 type_id: crate::codegen::InheritTypes::TopTypeId { gpuerror: (crate::codegen::InheritTypes::GPUErrorTypeId::GPUError) },
19834 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUError> as unsafe fn(&mut _, _) -> _,
19835 global: Globals::EMPTY,
19836},
19837 });
19838}
19839
19840#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
19841(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUError>, _can_gc: CanGc) -> DomRoot<D::GPUError>{
19842
19843 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
19844
19845 let scope = scope.reflector().get_jsobject();
19846 assert!(!scope.get().is_null());
19847 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
19848 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
19849
19850 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
19851 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
19852 assert!(!canonical_proto.is_null());
19853
19854
19855 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
19856 if let Some(given) = given_proto {
19857 proto.set(*given);
19858 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
19859 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
19860 }
19861 } else {
19862 proto.set(*canonical_proto);
19863 }
19864 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
19865 cx.raw_cx(),
19866 &Class.get().base,
19867 proto.handle(),
19868 ));
19869 assert!(!obj.is_null());
19870 JS_SetReservedSlot(
19871 obj.get(),
19872 DOM_OBJECT_SLOT,
19873 &PrivateValue(raw.as_ptr() as *const libc::c_void),
19874 );
19875
19876 let root = raw.reflect_with(obj.get());
19877
19878
19879
19880 DomRoot::from_ref(&*root)
19881}
19882
19883pub trait GPUErrorMethods<D: DomTypes> {
19884 fn Message(&self, ) -> DOMString;
19885}
19886static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
19887
19888pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
19889 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
19890 JSPropertySpec {
19891 name: JSPropertySpec_Name { string_: c"message".as_ptr() },
19892 attributes_: (JSPROP_ENUMERATE),
19893 kind_: (JSPropertySpec_Kind::NativeAccessor),
19894 u: JSPropertySpec_AccessorsOrValue {
19895 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
19896 getter: JSPropertySpec_Accessor {
19897 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { message_getterinfo.get() } },
19898 },
19899 setter: JSPropertySpec_Accessor {
19900 native: JSNativeWrapper { op: None, info: ptr::null() },
19901 }
19902 }
19903 }
19904 }
19905,
19906 JSPropertySpec::ZERO]))[..]
19907,
19908&Box::leak(Box::new([
19909 JSPropertySpec {
19910 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
19911 attributes_: (JSPROP_READONLY),
19912 kind_: (JSPropertySpec_Kind::Value),
19913 u: JSPropertySpec_AccessorsOrValue {
19914 value: JSPropertySpec_ValueWrapper {
19915 type_: JSPropertySpec_ValueWrapper_Type::String,
19916 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
19917 string: c"GPUError".as_ptr(),
19918 }
19919 }
19920 }
19921 }
19922,
19923 JSPropertySpec::ZERO]))[..]
19924])));
19925}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
19926
19927pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
19928 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::SERVICE_WORKER_GLOBAL_SCOPE),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
19929 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
19930}
19931pub fn GetProtoObject<D: DomTypes>
19932(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
19933 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUError), CreateInterfaceObjects::<D>, rval)
19935}
19936
19937
19938static PrototypeClass: JSClass = JSClass {
19939 name: c"GPUErrorPrototype".as_ptr(),
19940 flags:
19941 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
19943 cOps: ptr::null(),
19944 spec: ptr::null(),
19945 ext: ptr::null(),
19946 oOps: ptr::null(),
19947};
19948
19949
19950static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
19951
19952pub(crate) fn init_interface_object<D: DomTypes>() {
19953 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
19954 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
19955 b"function GPUError() {\n [native code]\n}",
19956 PrototypeList::ID::GPUError,
19957 0,
19958 ));
19959}
19960
19961pub fn GetConstructorObject<D: DomTypes>
19962(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
19963 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::Constructor(PrototypeList::Constructor::GPUError), CreateInterfaceObjects::<D>, rval)
19965}
19966
19967pub fn DefineDOMInterface<D: DomTypes>
19968(cx: SafeJSContext, global: HandleObject){
19969 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUError),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
19970}
19971
19972pub fn ConstructorEnabled<D: DomTypes>
19973(aCx: SafeJSContext, aObj: HandleObject) -> bool{
19974 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::SERVICE_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
19975 pref!(dom_webgpu_enabled)
19976}
19977
19978unsafe fn CreateInterfaceObjects<D: DomTypes>
19979(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
19980
19981 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
19982 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
19983 assert!(!prototype_proto.is_null());
19984
19985 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
19986 create_interface_prototype_object::<D>(cx,
19987 global,
19988 prototype_proto.handle(),
19989 &PrototypeClass,
19990 &[],
19991 sAttributes.get(),
19992 &[],
19993 &[],
19994 prototype.handle_mut());
19995 assert!(!prototype.is_null());
19996 assert!((*cache)[PrototypeList::ID::GPUError as usize].is_null());
19997 (*cache)[PrototypeList::ID::GPUError as usize] = prototype.get();
19998 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUError as isize),
19999 ptr::null_mut(),
20000 prototype.get());
20001
20002 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
20003 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
20004
20005 assert!(!interface_proto.is_null());
20006
20007 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
20008 create_noncallback_interface_object::<D>(cx,
20009 global,
20010 interface_proto.handle(),
20011 INTERFACE_OBJECT_CLASS.get(),
20012 &[],
20013 &[],
20014 &[],
20015 prototype.handle(),
20016 c"GPUError",
20017 0,
20018 &[],
20019 interface.handle_mut());
20020 assert!(!interface.is_null());
20021
20022 assert!((*cache)[PrototypeList::Constructor::GPUError as usize].is_null());
20023 (*cache)[PrototypeList::Constructor::GPUError as usize] = interface.get();
20024 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::Constructor::GPUError as isize),
20025 ptr::null_mut(),
20026 interface.get());
20027
20028}
20029
20030
20031 pub(crate) fn init_statics<D: DomTypes>() {
20032 init_interface_object::<D>();
20033 init_domjs_class::<D>();
20034
20035 init_message_getterinfo::<D>();
20036
20037
20038 init_sAttributes_specs::<D>();
20039init_sAttributes_prefs::<D>();
20040 }
20041 } pub use self::GPUInternalError_Binding::{Wrap as GPUInternalErrorWrap, GPUInternalErrorMethods, GetProtoObject as GPUInternalErrorGetProtoObject, DefineDOMInterface as GPUInternalErrorDefineDOMInterface};
20045pub mod GPUInternalError_Binding {
20046use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
20047use crate::codegen::GenericBindings::WebGPUBinding::GPUError_Binding;
20048use crate::codegen::GenericBindings::WorkerGlobalScopeBinding::WorkerGlobalScope_Binding;
20049use crate::import::module::*;
20050
20051unsafe extern "C" fn _finalize<D: DomTypes>
20052(_cx: *mut GCContext, obj: *mut JSObject){
20053 wrap_panic(&mut || {
20054
20055 let this = native_from_object_static::<D::GPUInternalError>(obj).unwrap();
20056 finalize_common(this);
20057 })
20058}
20059
20060unsafe extern "C" fn _trace<D: DomTypes>
20061(trc: *mut JSTracer, obj: *mut JSObject){
20062 wrap_panic(&mut || {
20063
20064 let this = native_from_object_static::<D::GPUInternalError>(obj).unwrap();
20065 if this.is_null() { return; } (*this).trace(trc);
20067 })
20068}
20069
20070
20071static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
20072
20073pub(crate) fn init_class_ops<D: DomTypes>() {
20074 CLASS_OPS.set(JSClassOps {
20075 addProperty: None,
20076 delProperty: None,
20077 enumerate: None,
20078 newEnumerate: None,
20079 resolve: None,
20080 mayResolve: None,
20081 finalize: Some(_finalize::<D>),
20082 call: None,
20083 construct: None,
20084 trace: Some(_trace::<D>),
20085 });
20086}
20087
20088pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
20089
20090pub(crate) fn init_domjs_class<D: DomTypes>() {
20091 init_class_ops::<D>();
20092 Class.set(DOMJSClass {
20093 base: JSClass {
20094 name: c"GPUInternalError".as_ptr(),
20095 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
20096 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
20097 ,
20098 cOps: unsafe { CLASS_OPS.get() },
20099 spec: ptr::null(),
20100 ext: ptr::null(),
20101 oOps: ptr::null(),
20102 },
20103 dom_class:
20104DOMClass {
20105 interface_chain: [ PrototypeList::ID::GPUError, PrototypeList::ID::GPUInternalError, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
20106 depth: 1,
20107 type_id: crate::codegen::InheritTypes::TopTypeId { gpuerror: (crate::codegen::InheritTypes::GPUErrorTypeId::GPUInternalError) },
20108 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUInternalError> as unsafe fn(&mut _, _) -> _,
20109 global: Globals::EMPTY,
20110},
20111 });
20112}
20113
20114#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
20115(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUInternalError>, _can_gc: CanGc) -> DomRoot<D::GPUInternalError>{
20116
20117 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
20118
20119 let scope = scope.reflector().get_jsobject();
20120 assert!(!scope.get().is_null());
20121 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
20122 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
20123
20124 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
20125 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
20126 assert!(!canonical_proto.is_null());
20127
20128
20129 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
20130 if let Some(given) = given_proto {
20131 proto.set(*given);
20132 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
20133 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
20134 }
20135 } else {
20136 proto.set(*canonical_proto);
20137 }
20138 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
20139 cx.raw_cx(),
20140 &Class.get().base,
20141 proto.handle(),
20142 ));
20143 assert!(!obj.is_null());
20144 JS_SetReservedSlot(
20145 obj.get(),
20146 DOM_OBJECT_SLOT,
20147 &PrivateValue(raw.as_ptr() as *const libc::c_void),
20148 );
20149
20150 let root = raw.reflect_with(obj.get());
20151
20152
20153
20154 DomRoot::from_ref(&*root)
20155}
20156
20157pub trait GPUInternalErrorMethods<D: DomTypes> {
20158 fn Constructor(r#global: &D::GlobalScope, r#proto: Option<HandleObject>, r#can_gc: CanGc, r#message: DOMString) -> DomRoot<D::GPUInternalError>;
20159}
20160static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
20161
20162pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
20163 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
20164 JSPropertySpec {
20165 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
20166 attributes_: (JSPROP_READONLY),
20167 kind_: (JSPropertySpec_Kind::Value),
20168 u: JSPropertySpec_AccessorsOrValue {
20169 value: JSPropertySpec_ValueWrapper {
20170 type_: JSPropertySpec_ValueWrapper_Type::String,
20171 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
20172 string: c"GPUInternalError".as_ptr(),
20173 }
20174 }
20175 }
20176 }
20177,
20178 JSPropertySpec::ZERO]))[..]
20179])));
20180}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
20181
20182pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
20183 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[0])])));
20184}
20185pub fn GetProtoObject<D: DomTypes>
20186(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
20187 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUInternalError), CreateInterfaceObjects::<D>, rval)
20189}
20190
20191
20192static PrototypeClass: JSClass = JSClass {
20193 name: c"GPUInternalErrorPrototype".as_ptr(),
20194 flags:
20195 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
20197 cOps: ptr::null(),
20198 spec: ptr::null(),
20199 ext: ptr::null(),
20200 oOps: ptr::null(),
20201};
20202
20203unsafe extern "C" fn _constructor<D: DomTypes>
20204(cx: *mut RawJSContext, argc: u32, vp: *mut JSVal) -> bool{
20205 let mut result = false;
20206 wrap_panic(&mut || result = {
20207 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
20208 let args = CallArgs::from_vp(vp, argc);
20209 let global = D::GlobalScope::from_object(JS_CALLEE(cx.raw_cx(), vp).to_object());
20210
20211 call_default_constructor::<D>(
20212 SafeJSContext::from_ptr(cx.raw_cx()),
20213 &args,
20214 &global,
20215 PrototypeList::ID::GPUInternalError,
20216 "GPUInternalError",
20217 CreateInterfaceObjects::<D>,
20218 |cx: SafeJSContext, args: &CallArgs, global: &D::GlobalScope, desired_proto: HandleObject| {
20219
20220 if argc < 1 {
20221 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUInternalError.constructor\".");
20222 return false;
20223 }
20224 let arg0: DOMString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
20225 Ok(ConversionResult::Success(value)) => value,
20226 Ok(ConversionResult::Failure(error)) => {
20227 throw_type_error(cx.raw_cx(), &error);
20228 return false;
20229
20230 }
20231 _ => {
20232 return false;
20233
20234 },
20235 }
20236 ;
20237 let result: DomRoot<D::GPUInternalError> = <D::GPUInternalError>::Constructor(global, Some(desired_proto), CanGc::note(), arg0);
20238
20239 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
20240 return true;
20241 }
20242 )
20243
20244 });
20245 result
20246}
20247
20248
20249static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
20250
20251pub(crate) fn init_interface_object<D: DomTypes>() {
20252 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
20253 Box::leak(Box::new(InterfaceConstructorBehavior::call(_constructor::<D>))),
20254 b"function GPUInternalError() {\n [native code]\n}",
20255 PrototypeList::ID::GPUInternalError,
20256 1,
20257 ));
20258}
20259
20260pub fn DefineDOMInterface<D: DomTypes>
20261(cx: SafeJSContext, global: HandleObject){
20262 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUInternalError),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
20263}
20264
20265pub fn ConstructorEnabled<D: DomTypes>
20266(aCx: SafeJSContext, aObj: HandleObject) -> bool{
20267 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::SERVICE_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
20268 pref!(dom_webgpu_enabled)
20269}
20270
20271unsafe fn CreateInterfaceObjects<D: DomTypes>
20272(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
20273
20274 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
20275 GPUError_Binding::GetProtoObject::<D>(cx, global, prototype_proto.handle_mut());
20276 assert!(!prototype_proto.is_null());
20277
20278 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
20279 create_interface_prototype_object::<D>(cx,
20280 global,
20281 prototype_proto.handle(),
20282 &PrototypeClass,
20283 &[],
20284 sAttributes.get(),
20285 &[],
20286 &[],
20287 prototype.handle_mut());
20288 assert!(!prototype.is_null());
20289 assert!((*cache)[PrototypeList::ID::GPUInternalError as usize].is_null());
20290 (*cache)[PrototypeList::ID::GPUInternalError as usize] = prototype.get();
20291 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUInternalError as isize),
20292 ptr::null_mut(),
20293 prototype.get());
20294
20295 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
20296
20297 GPUError_Binding::GetConstructorObject::<D>(cx, global, interface_proto.handle_mut());
20298
20299 assert!(!interface_proto.is_null());
20300
20301 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
20302 create_noncallback_interface_object::<D>(cx,
20303 global,
20304 interface_proto.handle(),
20305 INTERFACE_OBJECT_CLASS.get(),
20306 &[],
20307 &[],
20308 &[],
20309 prototype.handle(),
20310 c"GPUInternalError",
20311 1,
20312 &[],
20313 interface.handle_mut());
20314 assert!(!interface.is_null());
20315}
20316
20317
20318 pub(crate) fn init_statics<D: DomTypes>() {
20319 init_interface_object::<D>();
20320 init_domjs_class::<D>();
20321
20322
20323
20324
20325 init_sAttributes_specs::<D>();
20326init_sAttributes_prefs::<D>();
20327 }
20328 } pub use self::GPUMapMode_Binding::{GPUMapModeConstants, GetConstructorObject as GPUMapModeGetConstructorObject, DefineDOMInterface as GPUMapModeDefineDOMInterface};
20332pub mod GPUMapMode_Binding {
20333use crate::import::module::*;
20334
20335pub mod GPUMapModeConstants {
20336 pub const READ: u32 = 1;
20337 pub const WRITE: u32 = 2;
20338} pub trait GPUMapModeMethods<D: DomTypes> {
20340}
20341static sConstants_specs: ThreadUnsafeOnceLock<&[&[ConstantSpec]]> = ThreadUnsafeOnceLock::new();
20342
20343pub(crate) fn init_sConstants_specs<D: DomTypes>() {
20344 sConstants_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
20345 ConstantSpec { name: c"READ", value: ConstantVal::Uint(1) },
20346 ConstantSpec { name: c"WRITE", value: ConstantVal::Uint(2) }]))[..]
20347])));
20348}static sConstants: ThreadUnsafeOnceLock<&[Guard<&[ConstantSpec]>]> = ThreadUnsafeOnceLock::new();
20349
20350pub(crate) fn init_sConstants_prefs<D: DomTypes>() {
20351 sConstants.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sConstants_specs.get() })[0])])));
20352}
20353
20354static NAMESPACE_OBJECT_CLASS: NamespaceObjectClass = unsafe {
20355 NamespaceObjectClass::new(c"Object")
20356};
20357
20358pub fn GetConstructorObject<D: DomTypes>
20359(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
20360 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::Constructor(PrototypeList::Constructor::GPUMapMode), CreateInterfaceObjects::<D>, rval)
20362}
20363
20364pub fn DefineDOMInterface<D: DomTypes>
20365(cx: SafeJSContext, global: HandleObject){
20366 define_dom_interface(cx, global, ProtoOrIfaceIndex::Constructor(PrototypeList::Constructor::GPUMapMode),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
20367}
20368
20369pub fn ConstructorEnabled<D: DomTypes>
20370(aCx: SafeJSContext, aObj: HandleObject) -> bool{
20371 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
20372 pref!(dom_webgpu_enabled)
20373}
20374
20375unsafe fn CreateInterfaceObjects<D: DomTypes>
20376(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
20377
20378 rooted!(&in(cx) let proto = JS_NewPlainObject(cx.raw_cx()));
20379 assert!(!proto.is_null());
20380 rooted!(&in(cx) let mut namespace = ptr::null_mut::<JSObject>());
20381 create_namespace_object::<D>(cx, global, proto.handle(), &NAMESPACE_OBJECT_CLASS,
20382 &[], sConstants.get(), c"GPUMapMode", namespace.handle_mut());
20383 assert!(!namespace.is_null());
20384 assert!((*cache)[PrototypeList::Constructor::GPUMapMode as usize].is_null());
20385 (*cache)[PrototypeList::Constructor::GPUMapMode as usize] = namespace.get();
20386 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::Constructor::GPUMapMode as isize),
20387 ptr::null_mut(),
20388 namespace.get());
20389
20390}
20391
20392
20393 pub(crate) fn init_statics<D: DomTypes>() {
20394
20395
20396
20397
20398
20399
20400 init_sConstants_specs::<D>();
20401init_sConstants_prefs::<D>();
20402 }
20403 } pub use self::GPUOutOfMemoryError_Binding::{Wrap as GPUOutOfMemoryErrorWrap, GPUOutOfMemoryErrorMethods, GetProtoObject as GPUOutOfMemoryErrorGetProtoObject, DefineDOMInterface as GPUOutOfMemoryErrorDefineDOMInterface};
20407pub mod GPUOutOfMemoryError_Binding {
20408use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
20409use crate::codegen::GenericBindings::WebGPUBinding::GPUError_Binding;
20410use crate::codegen::GenericBindings::WorkerGlobalScopeBinding::WorkerGlobalScope_Binding;
20411use crate::import::module::*;
20412
20413unsafe extern "C" fn _finalize<D: DomTypes>
20414(_cx: *mut GCContext, obj: *mut JSObject){
20415 wrap_panic(&mut || {
20416
20417 let this = native_from_object_static::<D::GPUOutOfMemoryError>(obj).unwrap();
20418 finalize_common(this);
20419 })
20420}
20421
20422unsafe extern "C" fn _trace<D: DomTypes>
20423(trc: *mut JSTracer, obj: *mut JSObject){
20424 wrap_panic(&mut || {
20425
20426 let this = native_from_object_static::<D::GPUOutOfMemoryError>(obj).unwrap();
20427 if this.is_null() { return; } (*this).trace(trc);
20429 })
20430}
20431
20432
20433static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
20434
20435pub(crate) fn init_class_ops<D: DomTypes>() {
20436 CLASS_OPS.set(JSClassOps {
20437 addProperty: None,
20438 delProperty: None,
20439 enumerate: None,
20440 newEnumerate: None,
20441 resolve: None,
20442 mayResolve: None,
20443 finalize: Some(_finalize::<D>),
20444 call: None,
20445 construct: None,
20446 trace: Some(_trace::<D>),
20447 });
20448}
20449
20450pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
20451
20452pub(crate) fn init_domjs_class<D: DomTypes>() {
20453 init_class_ops::<D>();
20454 Class.set(DOMJSClass {
20455 base: JSClass {
20456 name: c"GPUOutOfMemoryError".as_ptr(),
20457 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
20458 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
20459 ,
20460 cOps: unsafe { CLASS_OPS.get() },
20461 spec: ptr::null(),
20462 ext: ptr::null(),
20463 oOps: ptr::null(),
20464 },
20465 dom_class:
20466DOMClass {
20467 interface_chain: [ PrototypeList::ID::GPUError, PrototypeList::ID::GPUOutOfMemoryError, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
20468 depth: 1,
20469 type_id: crate::codegen::InheritTypes::TopTypeId { gpuerror: (crate::codegen::InheritTypes::GPUErrorTypeId::GPUOutOfMemoryError) },
20470 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUOutOfMemoryError> as unsafe fn(&mut _, _) -> _,
20471 global: Globals::EMPTY,
20472},
20473 });
20474}
20475
20476#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
20477(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUOutOfMemoryError>, _can_gc: CanGc) -> DomRoot<D::GPUOutOfMemoryError>{
20478
20479 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
20480
20481 let scope = scope.reflector().get_jsobject();
20482 assert!(!scope.get().is_null());
20483 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
20484 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
20485
20486 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
20487 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
20488 assert!(!canonical_proto.is_null());
20489
20490
20491 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
20492 if let Some(given) = given_proto {
20493 proto.set(*given);
20494 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
20495 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
20496 }
20497 } else {
20498 proto.set(*canonical_proto);
20499 }
20500 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
20501 cx.raw_cx(),
20502 &Class.get().base,
20503 proto.handle(),
20504 ));
20505 assert!(!obj.is_null());
20506 JS_SetReservedSlot(
20507 obj.get(),
20508 DOM_OBJECT_SLOT,
20509 &PrivateValue(raw.as_ptr() as *const libc::c_void),
20510 );
20511
20512 let root = raw.reflect_with(obj.get());
20513
20514
20515
20516 DomRoot::from_ref(&*root)
20517}
20518
20519pub trait GPUOutOfMemoryErrorMethods<D: DomTypes> {
20520 fn Constructor(r#global: &D::GlobalScope, r#proto: Option<HandleObject>, r#can_gc: CanGc, r#message: DOMString) -> DomRoot<D::GPUOutOfMemoryError>;
20521}
20522static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
20523
20524pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
20525 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
20526 JSPropertySpec {
20527 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
20528 attributes_: (JSPROP_READONLY),
20529 kind_: (JSPropertySpec_Kind::Value),
20530 u: JSPropertySpec_AccessorsOrValue {
20531 value: JSPropertySpec_ValueWrapper {
20532 type_: JSPropertySpec_ValueWrapper_Type::String,
20533 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
20534 string: c"GPUOutOfMemoryError".as_ptr(),
20535 }
20536 }
20537 }
20538 }
20539,
20540 JSPropertySpec::ZERO]))[..]
20541])));
20542}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
20543
20544pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
20545 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[0])])));
20546}
20547pub fn GetProtoObject<D: DomTypes>
20548(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
20549 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUOutOfMemoryError), CreateInterfaceObjects::<D>, rval)
20551}
20552
20553
20554static PrototypeClass: JSClass = JSClass {
20555 name: c"GPUOutOfMemoryErrorPrototype".as_ptr(),
20556 flags:
20557 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
20559 cOps: ptr::null(),
20560 spec: ptr::null(),
20561 ext: ptr::null(),
20562 oOps: ptr::null(),
20563};
20564
20565unsafe extern "C" fn _constructor<D: DomTypes>
20566(cx: *mut RawJSContext, argc: u32, vp: *mut JSVal) -> bool{
20567 let mut result = false;
20568 wrap_panic(&mut || result = {
20569 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
20570 let args = CallArgs::from_vp(vp, argc);
20571 let global = D::GlobalScope::from_object(JS_CALLEE(cx.raw_cx(), vp).to_object());
20572
20573 call_default_constructor::<D>(
20574 SafeJSContext::from_ptr(cx.raw_cx()),
20575 &args,
20576 &global,
20577 PrototypeList::ID::GPUOutOfMemoryError,
20578 "GPUOutOfMemoryError",
20579 CreateInterfaceObjects::<D>,
20580 |cx: SafeJSContext, args: &CallArgs, global: &D::GlobalScope, desired_proto: HandleObject| {
20581
20582 if argc < 1 {
20583 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUOutOfMemoryError.constructor\".");
20584 return false;
20585 }
20586 let arg0: DOMString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
20587 Ok(ConversionResult::Success(value)) => value,
20588 Ok(ConversionResult::Failure(error)) => {
20589 throw_type_error(cx.raw_cx(), &error);
20590 return false;
20591
20592 }
20593 _ => {
20594 return false;
20595
20596 },
20597 }
20598 ;
20599 let result: DomRoot<D::GPUOutOfMemoryError> = <D::GPUOutOfMemoryError>::Constructor(global, Some(desired_proto), CanGc::note(), arg0);
20600
20601 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
20602 return true;
20603 }
20604 )
20605
20606 });
20607 result
20608}
20609
20610
20611static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
20612
20613pub(crate) fn init_interface_object<D: DomTypes>() {
20614 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
20615 Box::leak(Box::new(InterfaceConstructorBehavior::call(_constructor::<D>))),
20616 b"function GPUOutOfMemoryError() {\n [native code]\n}",
20617 PrototypeList::ID::GPUOutOfMemoryError,
20618 1,
20619 ));
20620}
20621
20622pub fn DefineDOMInterface<D: DomTypes>
20623(cx: SafeJSContext, global: HandleObject){
20624 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUOutOfMemoryError),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
20625}
20626
20627pub fn ConstructorEnabled<D: DomTypes>
20628(aCx: SafeJSContext, aObj: HandleObject) -> bool{
20629 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::SERVICE_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
20630 pref!(dom_webgpu_enabled)
20631}
20632
20633unsafe fn CreateInterfaceObjects<D: DomTypes>
20634(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
20635
20636 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
20637 GPUError_Binding::GetProtoObject::<D>(cx, global, prototype_proto.handle_mut());
20638 assert!(!prototype_proto.is_null());
20639
20640 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
20641 create_interface_prototype_object::<D>(cx,
20642 global,
20643 prototype_proto.handle(),
20644 &PrototypeClass,
20645 &[],
20646 sAttributes.get(),
20647 &[],
20648 &[],
20649 prototype.handle_mut());
20650 assert!(!prototype.is_null());
20651 assert!((*cache)[PrototypeList::ID::GPUOutOfMemoryError as usize].is_null());
20652 (*cache)[PrototypeList::ID::GPUOutOfMemoryError as usize] = prototype.get();
20653 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUOutOfMemoryError as isize),
20654 ptr::null_mut(),
20655 prototype.get());
20656
20657 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
20658
20659 GPUError_Binding::GetConstructorObject::<D>(cx, global, interface_proto.handle_mut());
20660
20661 assert!(!interface_proto.is_null());
20662
20663 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
20664 create_noncallback_interface_object::<D>(cx,
20665 global,
20666 interface_proto.handle(),
20667 INTERFACE_OBJECT_CLASS.get(),
20668 &[],
20669 &[],
20670 &[],
20671 prototype.handle(),
20672 c"GPUOutOfMemoryError",
20673 1,
20674 &[],
20675 interface.handle_mut());
20676 assert!(!interface.is_null());
20677}
20678
20679
20680 pub(crate) fn init_statics<D: DomTypes>() {
20681 init_interface_object::<D>();
20682 init_domjs_class::<D>();
20683
20684
20685
20686
20687 init_sAttributes_specs::<D>();
20688init_sAttributes_prefs::<D>();
20689 }
20690 } pub use self::GPUPipelineError_Binding::{Wrap as GPUPipelineErrorWrap, GPUPipelineErrorMethods, GetProtoObject as GPUPipelineErrorGetProtoObject, DefineDOMInterface as GPUPipelineErrorDefineDOMInterface};
20694pub mod GPUPipelineError_Binding {
20695use crate::codegen::GenericBindings::DOMExceptionBinding::DOMException_Binding;
20696use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
20697use crate::codegen::GenericBindings::WebGPUBinding::GPUPipelineErrorInit;
20698use crate::codegen::GenericBindings::WebGPUBinding::GPUPipelineErrorReason;
20699use crate::codegen::GenericBindings::WebGPUBinding::GPUPipelineErrorReasonValues;
20700use crate::codegen::GenericBindings::WorkerGlobalScopeBinding::WorkerGlobalScope_Binding;
20701use crate::import::module::*;
20702
20703unsafe extern "C" fn get_reason<D: DomTypes>
20704(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
20705 let mut result = false;
20706 wrap_panic(&mut || result = (|| {
20707 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
20708 let this = &*(this as *const D::GPUPipelineError);
20709 let result: GPUPipelineErrorReason = this.Reason();
20710
20711 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
20712 return true;
20713 })());
20714 result
20715}
20716
20717
20718static reason_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
20719
20720pub(crate) fn init_reason_getterinfo<D: DomTypes>() {
20721 reason_getterinfo.set(JSJitInfo {
20722 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
20723 getter: Some(get_reason::<D>)
20724 },
20725 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
20726 protoID: PrototypeList::ID::GPUPipelineError as u16,
20727 },
20728 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
20729 _bitfield_align_1: [],
20730 _bitfield_1: __BindgenBitfieldUnit::new(
20731 new_jsjitinfo_bitfield_1!(
20732 JSJitInfo_OpType::Getter as u8,
20733 JSJitInfo_AliasSet::AliasEverything as u8,
20734 JSValueType::JSVAL_TYPE_STRING as u8,
20735 true,
20736 false,
20737 false,
20738 false,
20739 false,
20740 false,
20741 0,
20742 ).to_ne_bytes()
20743 ),
20744});
20745}
20746unsafe extern "C" fn _finalize<D: DomTypes>
20747(_cx: *mut GCContext, obj: *mut JSObject){
20748 wrap_panic(&mut || {
20749
20750 let this = native_from_object_static::<D::GPUPipelineError>(obj).unwrap();
20751 finalize_common(this);
20752 })
20753}
20754
20755unsafe extern "C" fn _trace<D: DomTypes>
20756(trc: *mut JSTracer, obj: *mut JSObject){
20757 wrap_panic(&mut || {
20758
20759 let this = native_from_object_static::<D::GPUPipelineError>(obj).unwrap();
20760 if this.is_null() { return; } (*this).trace(trc);
20762 })
20763}
20764
20765
20766static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
20767
20768pub(crate) fn init_class_ops<D: DomTypes>() {
20769 CLASS_OPS.set(JSClassOps {
20770 addProperty: None,
20771 delProperty: None,
20772 enumerate: None,
20773 newEnumerate: None,
20774 resolve: None,
20775 mayResolve: None,
20776 finalize: Some(_finalize::<D>),
20777 call: None,
20778 construct: None,
20779 trace: Some(_trace::<D>),
20780 });
20781}
20782
20783pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
20784
20785pub(crate) fn init_domjs_class<D: DomTypes>() {
20786 init_class_ops::<D>();
20787 Class.set(DOMJSClass {
20788 base: JSClass {
20789 name: c"GPUPipelineError".as_ptr(),
20790 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
20791 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
20792 ,
20793 cOps: unsafe { CLASS_OPS.get() },
20794 spec: ptr::null(),
20795 ext: ptr::null(),
20796 oOps: ptr::null(),
20797 },
20798 dom_class:
20799DOMClass {
20800 interface_chain: [ PrototypeList::ID::DOMException, PrototypeList::ID::GPUPipelineError, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
20801 depth: 1,
20802 type_id: crate::codegen::InheritTypes::TopTypeId { domexception: (crate::codegen::InheritTypes::DOMExceptionTypeId::GPUPipelineError) },
20803 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUPipelineError> as unsafe fn(&mut _, _) -> _,
20804 global: Globals::EMPTY,
20805},
20806 });
20807}
20808
20809#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
20810(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUPipelineError>, _can_gc: CanGc) -> DomRoot<D::GPUPipelineError>{
20811
20812 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
20813
20814 let scope = scope.reflector().get_jsobject();
20815 assert!(!scope.get().is_null());
20816 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
20817 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
20818
20819 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
20820 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
20821 assert!(!canonical_proto.is_null());
20822
20823
20824 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
20825 if let Some(given) = given_proto {
20826 proto.set(*given);
20827 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
20828 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
20829 }
20830 } else {
20831 proto.set(*canonical_proto);
20832 }
20833 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
20834 cx.raw_cx(),
20835 &Class.get().base,
20836 proto.handle(),
20837 ));
20838 assert!(!obj.is_null());
20839 JS_SetReservedSlot(
20840 obj.get(),
20841 DOM_OBJECT_SLOT,
20842 &PrivateValue(raw.as_ptr() as *const libc::c_void),
20843 );
20844
20845 let root = raw.reflect_with(obj.get());
20846
20847
20848
20849 DomRoot::from_ref(&*root)
20850}
20851
20852pub trait GPUPipelineErrorMethods<D: DomTypes> {
20853 fn Reason(&self, ) -> GPUPipelineErrorReason;
20854 fn Constructor(r#global: &D::GlobalScope, r#proto: Option<HandleObject>, r#can_gc: CanGc, r#message: DOMString, r#options: &crate::codegen::GenericBindings::WebGPUBinding::GPUPipelineErrorInit) -> DomRoot<D::GPUPipelineError>;
20855}
20856static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
20857
20858pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
20859 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
20860 JSPropertySpec {
20861 name: JSPropertySpec_Name { string_: c"reason".as_ptr() },
20862 attributes_: (JSPROP_ENUMERATE),
20863 kind_: (JSPropertySpec_Kind::NativeAccessor),
20864 u: JSPropertySpec_AccessorsOrValue {
20865 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
20866 getter: JSPropertySpec_Accessor {
20867 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { reason_getterinfo.get() } },
20868 },
20869 setter: JSPropertySpec_Accessor {
20870 native: JSNativeWrapper { op: None, info: ptr::null() },
20871 }
20872 }
20873 }
20874 }
20875,
20876 JSPropertySpec::ZERO]))[..]
20877,
20878&Box::leak(Box::new([
20879 JSPropertySpec {
20880 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
20881 attributes_: (JSPROP_READONLY),
20882 kind_: (JSPropertySpec_Kind::Value),
20883 u: JSPropertySpec_AccessorsOrValue {
20884 value: JSPropertySpec_ValueWrapper {
20885 type_: JSPropertySpec_ValueWrapper_Type::String,
20886 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
20887 string: c"GPUPipelineError".as_ptr(),
20888 }
20889 }
20890 }
20891 }
20892,
20893 JSPropertySpec::ZERO]))[..]
20894])));
20895}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
20896
20897pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
20898 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::SERVICE_WORKER_GLOBAL_SCOPE),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
20899 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
20900}
20901pub fn GetProtoObject<D: DomTypes>
20902(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
20903 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUPipelineError), CreateInterfaceObjects::<D>, rval)
20905}
20906
20907
20908static PrototypeClass: JSClass = JSClass {
20909 name: c"GPUPipelineErrorPrototype".as_ptr(),
20910 flags:
20911 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
20913 cOps: ptr::null(),
20914 spec: ptr::null(),
20915 ext: ptr::null(),
20916 oOps: ptr::null(),
20917};
20918
20919unsafe extern "C" fn _constructor<D: DomTypes>
20920(cx: *mut RawJSContext, argc: u32, vp: *mut JSVal) -> bool{
20921 let mut result = false;
20922 wrap_panic(&mut || result = {
20923 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
20924 let args = CallArgs::from_vp(vp, argc);
20925 let global = D::GlobalScope::from_object(JS_CALLEE(cx.raw_cx(), vp).to_object());
20926
20927 call_default_constructor::<D>(
20928 SafeJSContext::from_ptr(cx.raw_cx()),
20929 &args,
20930 &global,
20931 PrototypeList::ID::GPUPipelineError,
20932 "GPUPipelineError",
20933 CreateInterfaceObjects::<D>,
20934 |cx: SafeJSContext, args: &CallArgs, global: &D::GlobalScope, desired_proto: HandleObject| {
20935
20936 if argc < 2 {
20937 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUPipelineError.constructor\".");
20938 return false;
20939 }
20940 let arg0: DOMString = if args.get(0).is_undefined() {
20941 DOMString::from("")
20942 } else {
20943 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
20944 Ok(ConversionResult::Success(value)) => value,
20945 Ok(ConversionResult::Failure(error)) => {
20946 throw_type_error(cx.raw_cx(), &error);
20947 return false;
20948
20949 }
20950 _ => {
20951 return false;
20952
20953 },
20954 }
20955
20956 };
20957 let arg1: crate::codegen::GenericBindings::WebGPUBinding::GPUPipelineErrorInit = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
20958 Ok(ConversionResult::Success(value)) => value,
20959 Ok(ConversionResult::Failure(error)) => {
20960 throw_type_error(cx.raw_cx(), &error);
20961 return false;
20962
20963 }
20964 _ => {
20965 return false;
20966
20967 },
20968 }
20969 ;
20970 let result: DomRoot<D::GPUPipelineError> = <D::GPUPipelineError>::Constructor(global, Some(desired_proto), CanGc::note(), arg0, &arg1);
20971
20972 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
20973 return true;
20974 }
20975 )
20976
20977 });
20978 result
20979}
20980
20981
20982static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
20983
20984pub(crate) fn init_interface_object<D: DomTypes>() {
20985 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
20986 Box::leak(Box::new(InterfaceConstructorBehavior::call(_constructor::<D>))),
20987 b"function GPUPipelineError() {\n [native code]\n}",
20988 PrototypeList::ID::GPUPipelineError,
20989 1,
20990 ));
20991}
20992
20993pub fn DefineDOMInterface<D: DomTypes>
20994(cx: SafeJSContext, global: HandleObject){
20995 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUPipelineError),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
20996}
20997
20998pub fn ConstructorEnabled<D: DomTypes>
20999(aCx: SafeJSContext, aObj: HandleObject) -> bool{
21000 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::SERVICE_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
21001 pref!(dom_webgpu_enabled)
21002}
21003
21004unsafe fn CreateInterfaceObjects<D: DomTypes>
21005(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
21006
21007 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
21008 DOMException_Binding::GetProtoObject::<D>(cx, global, prototype_proto.handle_mut());
21009 assert!(!prototype_proto.is_null());
21010
21011 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
21012 create_interface_prototype_object::<D>(cx,
21013 global,
21014 prototype_proto.handle(),
21015 &PrototypeClass,
21016 &[],
21017 sAttributes.get(),
21018 &[],
21019 &[],
21020 prototype.handle_mut());
21021 assert!(!prototype.is_null());
21022 assert!((*cache)[PrototypeList::ID::GPUPipelineError as usize].is_null());
21023 (*cache)[PrototypeList::ID::GPUPipelineError as usize] = prototype.get();
21024 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUPipelineError as isize),
21025 ptr::null_mut(),
21026 prototype.get());
21027
21028 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
21029
21030 DOMException_Binding::GetConstructorObject::<D>(cx, global, interface_proto.handle_mut());
21031
21032 assert!(!interface_proto.is_null());
21033
21034 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
21035 create_noncallback_interface_object::<D>(cx,
21036 global,
21037 interface_proto.handle(),
21038 INTERFACE_OBJECT_CLASS.get(),
21039 &[],
21040 &[],
21041 &[],
21042 prototype.handle(),
21043 c"GPUPipelineError",
21044 1,
21045 &[],
21046 interface.handle_mut());
21047 assert!(!interface.is_null());
21048}
21049
21050
21051 pub(crate) fn init_statics<D: DomTypes>() {
21052 init_interface_object::<D>();
21053 init_domjs_class::<D>();
21054
21055 init_reason_getterinfo::<D>();
21056
21057
21058 init_sAttributes_specs::<D>();
21059init_sAttributes_prefs::<D>();
21060 }
21061 } pub use self::GPUPipelineLayout_Binding::{Wrap as GPUPipelineLayoutWrap, GPUPipelineLayoutMethods, GetProtoObject as GPUPipelineLayoutGetProtoObject, DefineDOMInterface as GPUPipelineLayoutDefineDOMInterface};
21065pub mod GPUPipelineLayout_Binding {
21066use crate::import::module::*;
21067
21068unsafe extern "C" fn get_label<D: DomTypes>
21069(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
21070 let mut result = false;
21071 wrap_panic(&mut || result = (|| {
21072 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
21073 let this = &*(this as *const D::GPUPipelineLayout);
21074 let result: USVString = this.Label();
21075
21076 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
21077 return true;
21078 })());
21079 result
21080}
21081
21082unsafe extern "C" fn set_label<D: DomTypes>
21083(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
21084 let mut result = false;
21085 wrap_panic(&mut || result = (|| {
21086 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
21087 let this = &*(this as *const D::GPUPipelineLayout);
21088 let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
21089 Ok(ConversionResult::Success(value)) => value,
21090 Ok(ConversionResult::Failure(error)) => {
21091 throw_type_error(cx.raw_cx(), &error);
21092 return false;
21093
21094 }
21095 _ => {
21096 return false;
21097
21098 },
21099 }
21100 ;
21101 let result: () = this.SetLabel(arg0);
21102
21103 true
21104 })());
21105 result
21106}
21107
21108
21109static label_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
21110
21111pub(crate) fn init_label_getterinfo<D: DomTypes>() {
21112 label_getterinfo.set(JSJitInfo {
21113 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
21114 getter: Some(get_label::<D>)
21115 },
21116 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
21117 protoID: PrototypeList::ID::GPUPipelineLayout as u16,
21118 },
21119 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
21120 _bitfield_align_1: [],
21121 _bitfield_1: __BindgenBitfieldUnit::new(
21122 new_jsjitinfo_bitfield_1!(
21123 JSJitInfo_OpType::Getter as u8,
21124 JSJitInfo_AliasSet::AliasEverything as u8,
21125 JSValueType::JSVAL_TYPE_STRING as u8,
21126 true,
21127 false,
21128 false,
21129 false,
21130 false,
21131 false,
21132 0,
21133 ).to_ne_bytes()
21134 ),
21135});
21136}
21137static label_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
21138
21139pub(crate) fn init_label_setterinfo<D: DomTypes>() {
21140 label_setterinfo.set(JSJitInfo {
21141 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
21142 setter: Some(set_label::<D>)
21143 },
21144 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
21145 protoID: PrototypeList::ID::GPUPipelineLayout as u16,
21146 },
21147 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
21148 _bitfield_align_1: [],
21149 _bitfield_1: __BindgenBitfieldUnit::new(
21150 new_jsjitinfo_bitfield_1!(
21151 JSJitInfo_OpType::Setter as u8,
21152 JSJitInfo_AliasSet::AliasEverything as u8,
21153 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
21154 false,
21155 false,
21156 false,
21157 false,
21158 false,
21159 false,
21160 0,
21161 ).to_ne_bytes()
21162 ),
21163});
21164}
21165unsafe extern "C" fn _finalize<D: DomTypes>
21166(_cx: *mut GCContext, obj: *mut JSObject){
21167 wrap_panic(&mut || {
21168
21169 let this = native_from_object_static::<D::GPUPipelineLayout>(obj).unwrap();
21170 finalize_common(this);
21171 })
21172}
21173
21174unsafe extern "C" fn _trace<D: DomTypes>
21175(trc: *mut JSTracer, obj: *mut JSObject){
21176 wrap_panic(&mut || {
21177
21178 let this = native_from_object_static::<D::GPUPipelineLayout>(obj).unwrap();
21179 if this.is_null() { return; } (*this).trace(trc);
21181 })
21182}
21183
21184
21185static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
21186
21187pub(crate) fn init_class_ops<D: DomTypes>() {
21188 CLASS_OPS.set(JSClassOps {
21189 addProperty: None,
21190 delProperty: None,
21191 enumerate: None,
21192 newEnumerate: None,
21193 resolve: None,
21194 mayResolve: None,
21195 finalize: Some(_finalize::<D>),
21196 call: None,
21197 construct: None,
21198 trace: Some(_trace::<D>),
21199 });
21200}
21201
21202pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
21203
21204pub(crate) fn init_domjs_class<D: DomTypes>() {
21205 init_class_ops::<D>();
21206 Class.set(DOMJSClass {
21207 base: JSClass {
21208 name: c"GPUPipelineLayout".as_ptr(),
21209 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
21210 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
21211 ,
21212 cOps: unsafe { CLASS_OPS.get() },
21213 spec: ptr::null(),
21214 ext: ptr::null(),
21215 oOps: ptr::null(),
21216 },
21217 dom_class:
21218DOMClass {
21219 interface_chain: [ PrototypeList::ID::GPUPipelineLayout, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
21220 depth: 0,
21221 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
21222 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUPipelineLayout> as unsafe fn(&mut _, _) -> _,
21223 global: Globals::EMPTY,
21224},
21225 });
21226}
21227
21228#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
21229(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUPipelineLayout>, _can_gc: CanGc) -> DomRoot<D::GPUPipelineLayout>{
21230
21231 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
21232
21233 let scope = scope.reflector().get_jsobject();
21234 assert!(!scope.get().is_null());
21235 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
21236 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
21237
21238 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
21239 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
21240 assert!(!canonical_proto.is_null());
21241
21242
21243 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
21244 if let Some(given) = given_proto {
21245 proto.set(*given);
21246 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
21247 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
21248 }
21249 } else {
21250 proto.set(*canonical_proto);
21251 }
21252 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
21253 cx.raw_cx(),
21254 &Class.get().base,
21255 proto.handle(),
21256 ));
21257 assert!(!obj.is_null());
21258 JS_SetReservedSlot(
21259 obj.get(),
21260 DOM_OBJECT_SLOT,
21261 &PrivateValue(raw.as_ptr() as *const libc::c_void),
21262 );
21263
21264 let root = raw.reflect_with(obj.get());
21265
21266
21267
21268 DomRoot::from_ref(&*root)
21269}
21270
21271pub trait GPUPipelineLayoutMethods<D: DomTypes> {
21272 fn Label(&self, ) -> USVString;
21273 fn SetLabel(&self, r#value: USVString);
21274}
21275static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
21276
21277pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
21278 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
21279 JSPropertySpec {
21280 name: JSPropertySpec_Name { string_: c"label".as_ptr() },
21281 attributes_: (JSPROP_ENUMERATE),
21282 kind_: (JSPropertySpec_Kind::NativeAccessor),
21283 u: JSPropertySpec_AccessorsOrValue {
21284 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
21285 getter: JSPropertySpec_Accessor {
21286 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { label_getterinfo.get() } },
21287 },
21288 setter: JSPropertySpec_Accessor {
21289 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { label_setterinfo.get() } },
21290 }
21291 }
21292 }
21293 }
21294,
21295 JSPropertySpec::ZERO]))[..]
21296,
21297&Box::leak(Box::new([
21298 JSPropertySpec {
21299 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
21300 attributes_: (JSPROP_READONLY),
21301 kind_: (JSPropertySpec_Kind::Value),
21302 u: JSPropertySpec_AccessorsOrValue {
21303 value: JSPropertySpec_ValueWrapper {
21304 type_: JSPropertySpec_ValueWrapper_Type::String,
21305 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
21306 string: c"GPUPipelineLayout".as_ptr(),
21307 }
21308 }
21309 }
21310 }
21311,
21312 JSPropertySpec::ZERO]))[..]
21313])));
21314}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
21315
21316pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
21317 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
21318 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
21319}
21320pub fn GetProtoObject<D: DomTypes>
21321(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
21322 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUPipelineLayout), CreateInterfaceObjects::<D>, rval)
21324}
21325
21326
21327static PrototypeClass: JSClass = JSClass {
21328 name: c"GPUPipelineLayoutPrototype".as_ptr(),
21329 flags:
21330 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
21332 cOps: ptr::null(),
21333 spec: ptr::null(),
21334 ext: ptr::null(),
21335 oOps: ptr::null(),
21336};
21337
21338
21339static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
21340
21341pub(crate) fn init_interface_object<D: DomTypes>() {
21342 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
21343 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
21344 b"function GPUPipelineLayout() {\n [native code]\n}",
21345 PrototypeList::ID::GPUPipelineLayout,
21346 0,
21347 ));
21348}
21349
21350pub fn DefineDOMInterface<D: DomTypes>
21351(cx: SafeJSContext, global: HandleObject){
21352 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUPipelineLayout),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
21353}
21354
21355pub fn ConstructorEnabled<D: DomTypes>
21356(aCx: SafeJSContext, aObj: HandleObject) -> bool{
21357 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
21358 pref!(dom_webgpu_enabled)
21359}
21360
21361unsafe fn CreateInterfaceObjects<D: DomTypes>
21362(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
21363
21364 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
21365 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
21366 assert!(!prototype_proto.is_null());
21367
21368 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
21369 create_interface_prototype_object::<D>(cx,
21370 global,
21371 prototype_proto.handle(),
21372 &PrototypeClass,
21373 &[],
21374 sAttributes.get(),
21375 &[],
21376 &[],
21377 prototype.handle_mut());
21378 assert!(!prototype.is_null());
21379 assert!((*cache)[PrototypeList::ID::GPUPipelineLayout as usize].is_null());
21380 (*cache)[PrototypeList::ID::GPUPipelineLayout as usize] = prototype.get();
21381 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUPipelineLayout as isize),
21382 ptr::null_mut(),
21383 prototype.get());
21384
21385 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
21386 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
21387
21388 assert!(!interface_proto.is_null());
21389
21390 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
21391 create_noncallback_interface_object::<D>(cx,
21392 global,
21393 interface_proto.handle(),
21394 INTERFACE_OBJECT_CLASS.get(),
21395 &[],
21396 &[],
21397 &[],
21398 prototype.handle(),
21399 c"GPUPipelineLayout",
21400 0,
21401 &[],
21402 interface.handle_mut());
21403 assert!(!interface.is_null());
21404}
21405
21406
21407 pub(crate) fn init_statics<D: DomTypes>() {
21408 init_interface_object::<D>();
21409 init_domjs_class::<D>();
21410
21411 init_label_getterinfo::<D>();
21412 init_label_setterinfo::<D>();
21413
21414 init_sAttributes_specs::<D>();
21415init_sAttributes_prefs::<D>();
21416 }
21417 } pub use self::GPUQuerySet_Binding::{Wrap as GPUQuerySetWrap, GPUQuerySetMethods, GetProtoObject as GPUQuerySetGetProtoObject, DefineDOMInterface as GPUQuerySetDefineDOMInterface};
21421pub mod GPUQuerySet_Binding {
21422use crate::import::module::*;
21423
21424unsafe extern "C" fn destroy<D: DomTypes>
21425(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
21426 let mut result = false;
21427 wrap_panic(&mut || result = (|| {
21428 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
21429 let this = &*(this as *const D::GPUQuerySet);
21430 let args = &*args;
21431 let argc = args.argc_;
21432 let result: () = this.Destroy();
21433
21434 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
21435 return true;
21436 })());
21437 result
21438}
21439
21440
21441static destroy_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
21442
21443pub(crate) fn init_destroy_methodinfo<D: DomTypes>() {
21444 destroy_methodinfo.set(JSJitInfo {
21445 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
21446 method: Some(destroy::<D>)
21447 },
21448 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
21449 protoID: PrototypeList::ID::GPUQuerySet as u16,
21450 },
21451 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
21452 _bitfield_align_1: [],
21453 _bitfield_1: __BindgenBitfieldUnit::new(
21454 new_jsjitinfo_bitfield_1!(
21455 JSJitInfo_OpType::Method as u8,
21456 JSJitInfo_AliasSet::AliasEverything as u8,
21457 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
21458 true,
21459 false,
21460 false,
21461 false,
21462 false,
21463 false,
21464 0,
21465 ).to_ne_bytes()
21466 ),
21467});
21468}
21469unsafe extern "C" fn get_label<D: DomTypes>
21470(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
21471 let mut result = false;
21472 wrap_panic(&mut || result = (|| {
21473 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
21474 let this = &*(this as *const D::GPUQuerySet);
21475 let result: USVString = this.Label();
21476
21477 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
21478 return true;
21479 })());
21480 result
21481}
21482
21483unsafe extern "C" fn set_label<D: DomTypes>
21484(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
21485 let mut result = false;
21486 wrap_panic(&mut || result = (|| {
21487 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
21488 let this = &*(this as *const D::GPUQuerySet);
21489 let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
21490 Ok(ConversionResult::Success(value)) => value,
21491 Ok(ConversionResult::Failure(error)) => {
21492 throw_type_error(cx.raw_cx(), &error);
21493 return false;
21494
21495 }
21496 _ => {
21497 return false;
21498
21499 },
21500 }
21501 ;
21502 let result: () = this.SetLabel(arg0);
21503
21504 true
21505 })());
21506 result
21507}
21508
21509
21510static label_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
21511
21512pub(crate) fn init_label_getterinfo<D: DomTypes>() {
21513 label_getterinfo.set(JSJitInfo {
21514 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
21515 getter: Some(get_label::<D>)
21516 },
21517 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
21518 protoID: PrototypeList::ID::GPUQuerySet as u16,
21519 },
21520 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
21521 _bitfield_align_1: [],
21522 _bitfield_1: __BindgenBitfieldUnit::new(
21523 new_jsjitinfo_bitfield_1!(
21524 JSJitInfo_OpType::Getter as u8,
21525 JSJitInfo_AliasSet::AliasEverything as u8,
21526 JSValueType::JSVAL_TYPE_STRING as u8,
21527 true,
21528 false,
21529 false,
21530 false,
21531 false,
21532 false,
21533 0,
21534 ).to_ne_bytes()
21535 ),
21536});
21537}
21538static label_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
21539
21540pub(crate) fn init_label_setterinfo<D: DomTypes>() {
21541 label_setterinfo.set(JSJitInfo {
21542 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
21543 setter: Some(set_label::<D>)
21544 },
21545 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
21546 protoID: PrototypeList::ID::GPUQuerySet as u16,
21547 },
21548 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
21549 _bitfield_align_1: [],
21550 _bitfield_1: __BindgenBitfieldUnit::new(
21551 new_jsjitinfo_bitfield_1!(
21552 JSJitInfo_OpType::Setter as u8,
21553 JSJitInfo_AliasSet::AliasEverything as u8,
21554 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
21555 false,
21556 false,
21557 false,
21558 false,
21559 false,
21560 false,
21561 0,
21562 ).to_ne_bytes()
21563 ),
21564});
21565}
21566unsafe extern "C" fn _finalize<D: DomTypes>
21567(_cx: *mut GCContext, obj: *mut JSObject){
21568 wrap_panic(&mut || {
21569
21570 let this = native_from_object_static::<D::GPUQuerySet>(obj).unwrap();
21571 finalize_common(this);
21572 })
21573}
21574
21575unsafe extern "C" fn _trace<D: DomTypes>
21576(trc: *mut JSTracer, obj: *mut JSObject){
21577 wrap_panic(&mut || {
21578
21579 let this = native_from_object_static::<D::GPUQuerySet>(obj).unwrap();
21580 if this.is_null() { return; } (*this).trace(trc);
21582 })
21583}
21584
21585
21586static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
21587
21588pub(crate) fn init_class_ops<D: DomTypes>() {
21589 CLASS_OPS.set(JSClassOps {
21590 addProperty: None,
21591 delProperty: None,
21592 enumerate: None,
21593 newEnumerate: None,
21594 resolve: None,
21595 mayResolve: None,
21596 finalize: Some(_finalize::<D>),
21597 call: None,
21598 construct: None,
21599 trace: Some(_trace::<D>),
21600 });
21601}
21602
21603pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
21604
21605pub(crate) fn init_domjs_class<D: DomTypes>() {
21606 init_class_ops::<D>();
21607 Class.set(DOMJSClass {
21608 base: JSClass {
21609 name: c"GPUQuerySet".as_ptr(),
21610 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
21611 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
21612 ,
21613 cOps: unsafe { CLASS_OPS.get() },
21614 spec: ptr::null(),
21615 ext: ptr::null(),
21616 oOps: ptr::null(),
21617 },
21618 dom_class:
21619DOMClass {
21620 interface_chain: [ PrototypeList::ID::GPUQuerySet, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
21621 depth: 0,
21622 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
21623 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUQuerySet> as unsafe fn(&mut _, _) -> _,
21624 global: Globals::EMPTY,
21625},
21626 });
21627}
21628
21629#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
21630(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUQuerySet>, _can_gc: CanGc) -> DomRoot<D::GPUQuerySet>{
21631
21632 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
21633
21634 let scope = scope.reflector().get_jsobject();
21635 assert!(!scope.get().is_null());
21636 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
21637 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
21638
21639 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
21640 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
21641 assert!(!canonical_proto.is_null());
21642
21643
21644 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
21645 if let Some(given) = given_proto {
21646 proto.set(*given);
21647 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
21648 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
21649 }
21650 } else {
21651 proto.set(*canonical_proto);
21652 }
21653 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
21654 cx.raw_cx(),
21655 &Class.get().base,
21656 proto.handle(),
21657 ));
21658 assert!(!obj.is_null());
21659 JS_SetReservedSlot(
21660 obj.get(),
21661 DOM_OBJECT_SLOT,
21662 &PrivateValue(raw.as_ptr() as *const libc::c_void),
21663 );
21664
21665 let root = raw.reflect_with(obj.get());
21666
21667
21668
21669 DomRoot::from_ref(&*root)
21670}
21671
21672pub trait GPUQuerySetMethods<D: DomTypes> {
21673 fn Destroy(&self, );
21674 fn Label(&self, ) -> USVString;
21675 fn SetLabel(&self, r#value: USVString);
21676}
21677static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
21678
21679pub(crate) fn init_sMethods_specs<D: DomTypes>() {
21680 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
21681 JSFunctionSpec {
21682 name: JSPropertySpec_Name { string_: c"destroy".as_ptr() },
21683 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { destroy_methodinfo.get() } as *const _ as *const JSJitInfo },
21684 nargs: 0,
21685 flags: (JSPROP_ENUMERATE) as u16,
21686 selfHostedName: ptr::null()
21687 },
21688 JSFunctionSpec {
21689 name: JSPropertySpec_Name { string_: ptr::null() },
21690 call: JSNativeWrapper { op: None, info: ptr::null() },
21691 nargs: 0,
21692 flags: 0,
21693 selfHostedName: ptr::null()
21694 }]))[..]
21695])));
21696}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
21697
21698pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
21699 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sMethods_specs.get() })[0])])));
21700}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
21701
21702pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
21703 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
21704 JSPropertySpec {
21705 name: JSPropertySpec_Name { string_: c"label".as_ptr() },
21706 attributes_: (JSPROP_ENUMERATE),
21707 kind_: (JSPropertySpec_Kind::NativeAccessor),
21708 u: JSPropertySpec_AccessorsOrValue {
21709 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
21710 getter: JSPropertySpec_Accessor {
21711 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { label_getterinfo.get() } },
21712 },
21713 setter: JSPropertySpec_Accessor {
21714 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { label_setterinfo.get() } },
21715 }
21716 }
21717 }
21718 }
21719,
21720 JSPropertySpec::ZERO]))[..]
21721,
21722&Box::leak(Box::new([
21723 JSPropertySpec {
21724 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
21725 attributes_: (JSPROP_READONLY),
21726 kind_: (JSPropertySpec_Kind::Value),
21727 u: JSPropertySpec_AccessorsOrValue {
21728 value: JSPropertySpec_ValueWrapper {
21729 type_: JSPropertySpec_ValueWrapper_Type::String,
21730 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
21731 string: c"GPUQuerySet".as_ptr(),
21732 }
21733 }
21734 }
21735 }
21736,
21737 JSPropertySpec::ZERO]))[..]
21738])));
21739}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
21740
21741pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
21742 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
21743 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
21744}
21745pub fn GetProtoObject<D: DomTypes>
21746(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
21747 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUQuerySet), CreateInterfaceObjects::<D>, rval)
21749}
21750
21751
21752static PrototypeClass: JSClass = JSClass {
21753 name: c"GPUQuerySetPrototype".as_ptr(),
21754 flags:
21755 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
21757 cOps: ptr::null(),
21758 spec: ptr::null(),
21759 ext: ptr::null(),
21760 oOps: ptr::null(),
21761};
21762
21763
21764static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
21765
21766pub(crate) fn init_interface_object<D: DomTypes>() {
21767 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
21768 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
21769 b"function GPUQuerySet() {\n [native code]\n}",
21770 PrototypeList::ID::GPUQuerySet,
21771 0,
21772 ));
21773}
21774
21775pub fn DefineDOMInterface<D: DomTypes>
21776(cx: SafeJSContext, global: HandleObject){
21777 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUQuerySet),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
21778}
21779
21780pub fn ConstructorEnabled<D: DomTypes>
21781(aCx: SafeJSContext, aObj: HandleObject) -> bool{
21782 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
21783 pref!(dom_webgpu_enabled)
21784}
21785
21786unsafe fn CreateInterfaceObjects<D: DomTypes>
21787(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
21788
21789 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
21790 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
21791 assert!(!prototype_proto.is_null());
21792
21793 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
21794 create_interface_prototype_object::<D>(cx,
21795 global,
21796 prototype_proto.handle(),
21797 &PrototypeClass,
21798 sMethods.get(),
21799 sAttributes.get(),
21800 &[],
21801 &[],
21802 prototype.handle_mut());
21803 assert!(!prototype.is_null());
21804 assert!((*cache)[PrototypeList::ID::GPUQuerySet as usize].is_null());
21805 (*cache)[PrototypeList::ID::GPUQuerySet as usize] = prototype.get();
21806 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUQuerySet as isize),
21807 ptr::null_mut(),
21808 prototype.get());
21809
21810 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
21811 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
21812
21813 assert!(!interface_proto.is_null());
21814
21815 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
21816 create_noncallback_interface_object::<D>(cx,
21817 global,
21818 interface_proto.handle(),
21819 INTERFACE_OBJECT_CLASS.get(),
21820 &[],
21821 &[],
21822 &[],
21823 prototype.handle(),
21824 c"GPUQuerySet",
21825 0,
21826 &[],
21827 interface.handle_mut());
21828 assert!(!interface.is_null());
21829}
21830
21831
21832 pub(crate) fn init_statics<D: DomTypes>() {
21833 init_interface_object::<D>();
21834 init_domjs_class::<D>();
21835 crate::codegen::GenericBindings::WebGPUBinding::GPUQuerySet_Binding::init_destroy_methodinfo::<D>();
21836 init_label_getterinfo::<D>();
21837 init_label_setterinfo::<D>();
21838
21839 init_sMethods_specs::<D>();
21840init_sMethods_prefs::<D>();
21841init_sAttributes_specs::<D>();
21842init_sAttributes_prefs::<D>();
21843 }
21844 } pub use self::GPUQueue_Binding::{Wrap as GPUQueueWrap, GPUQueueMethods, GetProtoObject as GPUQueueGetProtoObject, DefineDOMInterface as GPUQueueDefineDOMInterface};
21848pub mod GPUQueue_Binding {
21849use crate::codegen::GenericBindings::WebGPUBinding::GPUExtent3DDict;
21850use crate::codegen::GenericBindings::WebGPUBinding::GPUImageCopyTexture;
21851use crate::codegen::GenericBindings::WebGPUBinding::GPUImageDataLayout;
21852use crate::codegen::GenericBindings::WebGPUBinding::GPUTextureAspect;
21853use crate::codegen::GenericBindings::WebGPUBinding::GPUTextureAspectValues;
21854use crate::import::module::*;
21855
21856unsafe extern "C" fn submit<D: DomTypes>
21857(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
21858 let mut result = false;
21859 wrap_panic(&mut || result = (|| {
21860 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
21861 let this = &*(this as *const D::GPUQueue);
21862 let args = &*args;
21863 let argc = args.argc_;
21864
21865 if argc < 1 {
21866 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUQueue.submit\".");
21867 return false;
21868 }
21869 let arg0: Vec<DomRoot<D::GPUCommandBuffer>> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
21870 Ok(ConversionResult::Success(value)) => value,
21871 Ok(ConversionResult::Failure(error)) => {
21872 throw_type_error(cx.raw_cx(), &error);
21873 return false;
21874
21875 }
21876 _ => {
21877 return false;
21878
21879 },
21880 }
21881 ;
21882 let result: () = this.Submit(arg0);
21883
21884 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
21885 return true;
21886 })());
21887 result
21888}
21889
21890
21891static submit_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
21892
21893pub(crate) fn init_submit_methodinfo<D: DomTypes>() {
21894 submit_methodinfo.set(JSJitInfo {
21895 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
21896 method: Some(submit::<D>)
21897 },
21898 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
21899 protoID: PrototypeList::ID::GPUQueue as u16,
21900 },
21901 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
21902 _bitfield_align_1: [],
21903 _bitfield_1: __BindgenBitfieldUnit::new(
21904 new_jsjitinfo_bitfield_1!(
21905 JSJitInfo_OpType::Method as u8,
21906 JSJitInfo_AliasSet::AliasEverything as u8,
21907 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
21908 false,
21909 false,
21910 false,
21911 false,
21912 false,
21913 false,
21914 0,
21915 ).to_ne_bytes()
21916 ),
21917});
21918}
21919unsafe extern "C" fn onSubmittedWorkDone<D: DomTypes>
21920(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
21921 let mut result = false;
21922 wrap_panic(&mut || result = (|| {
21923 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
21924 let this = &*(this as *const D::GPUQueue);
21925 let args = &*args;
21926 let argc = args.argc_;
21927 let result: Rc<D::Promise> = this.OnSubmittedWorkDone(CanGc::note());
21928
21929 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
21930 return true;
21931 })());
21932 result
21933}
21934
21935unsafe extern "C" fn onSubmittedWorkDone_promise_wrapper<D: DomTypes>
21936(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
21937 let mut result = false;
21938 wrap_panic(&mut || result = (|| {
21939 let ok = onSubmittedWorkDone::<D>(cx, _obj, this, args);
21940 if ok {
21941 return true;
21942 }
21943 return exception_to_promise(cx, (*args).rval(), CanGc::note());
21944
21945 })());
21946 result
21947}
21948
21949
21950static onSubmittedWorkDone_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
21951
21952pub(crate) fn init_onSubmittedWorkDone_methodinfo<D: DomTypes>() {
21953 onSubmittedWorkDone_methodinfo.set(JSJitInfo {
21954 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
21955 method: Some(onSubmittedWorkDone_promise_wrapper::<D>)
21956 },
21957 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
21958 protoID: PrototypeList::ID::GPUQueue as u16,
21959 },
21960 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
21961 _bitfield_align_1: [],
21962 _bitfield_1: __BindgenBitfieldUnit::new(
21963 new_jsjitinfo_bitfield_1!(
21964 JSJitInfo_OpType::Method as u8,
21965 JSJitInfo_AliasSet::AliasEverything as u8,
21966 JSValueType::JSVAL_TYPE_OBJECT as u8,
21967 true,
21968 false,
21969 false,
21970 false,
21971 false,
21972 false,
21973 0,
21974 ).to_ne_bytes()
21975 ),
21976});
21977}
21978unsafe extern "C" fn writeBuffer<D: DomTypes>
21979(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
21980 let mut result = false;
21981 wrap_panic(&mut || result = (|| {
21982 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
21983 let this = &*(this as *const D::GPUQueue);
21984 let args = &*args;
21985 let argc = args.argc_;
21986
21987 if argc < 3 {
21988 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUQueue.writeBuffer\".");
21989 return false;
21990 }
21991 let arg0: DomRoot<D::GPUBuffer> = if HandleValue::from_raw(args.get(0)).get().is_object() {
21992 match root_from_handlevalue(HandleValue::from_raw(args.get(0)), SafeJSContext::from_ptr(cx.raw_cx())) {
21993 Ok(val) => val,
21994 Err(()) => {
21995 throw_type_error(cx.raw_cx(), "value does not implement interface GPUBuffer.");
21996 return false;
21997
21998 }
21999 }
22000
22001 } else {
22002 throw_type_error(cx.raw_cx(), "Value is not an object.");
22003 return false;
22004
22005 };
22006 let arg1: u64 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
22007 Ok(ConversionResult::Success(value)) => value,
22008 Ok(ConversionResult::Failure(error)) => {
22009 throw_type_error(cx.raw_cx(), &error);
22010 return false;
22011
22012 }
22013 _ => {
22014 return false;
22015
22016 },
22017 }
22018 ;
22019 let arg2: GenericUnionTypes::ArrayBufferViewOrArrayBuffer = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ()) {
22020 Ok(ConversionResult::Success(value)) => value,
22021 Ok(ConversionResult::Failure(error)) => {
22022 throw_type_error(cx.raw_cx(), &error);
22023 return false;
22024
22025 }
22026 _ => {
22027 return false;
22028
22029 },
22030 }
22031 ;
22032 let arg3: u64 = if args.get(3).is_undefined() {
22033 0
22034 } else {
22035 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(3)), ConversionBehavior::EnforceRange) {
22036 Ok(ConversionResult::Success(value)) => value,
22037 Ok(ConversionResult::Failure(error)) => {
22038 throw_type_error(cx.raw_cx(), &error);
22039 return false;
22040
22041 }
22042 _ => {
22043 return false;
22044
22045 },
22046 }
22047
22048 };
22049 let arg4: Option<u64> = if args.get(4).is_undefined() {
22050 None
22051 } else {
22052 Some(match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(4)), ConversionBehavior::EnforceRange) {
22053 Ok(ConversionResult::Success(value)) => value,
22054 Ok(ConversionResult::Failure(error)) => {
22055 throw_type_error(cx.raw_cx(), &error);
22056 return false;
22057
22058 }
22059 _ => {
22060 return false;
22061
22062 },
22063 }
22064 )
22065 };
22066 let result: Result<(), Error> = this.WriteBuffer(&arg0, arg1, arg2, arg3, arg4);
22067 let result = match result {
22068 Ok(result) => result,
22069 Err(e) => {
22070 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
22071 return false;
22072 },
22073 };
22074
22075 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
22076 return true;
22077 })());
22078 result
22079}
22080
22081
22082static writeBuffer_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
22083
22084pub(crate) fn init_writeBuffer_methodinfo<D: DomTypes>() {
22085 writeBuffer_methodinfo.set(JSJitInfo {
22086 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
22087 method: Some(writeBuffer::<D>)
22088 },
22089 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
22090 protoID: PrototypeList::ID::GPUQueue as u16,
22091 },
22092 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
22093 _bitfield_align_1: [],
22094 _bitfield_1: __BindgenBitfieldUnit::new(
22095 new_jsjitinfo_bitfield_1!(
22096 JSJitInfo_OpType::Method as u8,
22097 JSJitInfo_AliasSet::AliasEverything as u8,
22098 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
22099 false,
22100 false,
22101 false,
22102 false,
22103 false,
22104 false,
22105 0,
22106 ).to_ne_bytes()
22107 ),
22108});
22109}
22110unsafe extern "C" fn writeTexture<D: DomTypes>
22111(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
22112 let mut result = false;
22113 wrap_panic(&mut || result = (|| {
22114 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
22115 let this = &*(this as *const D::GPUQueue);
22116 let args = &*args;
22117 let argc = args.argc_;
22118
22119 if argc < 4 {
22120 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUQueue.writeTexture\".");
22121 return false;
22122 }
22123 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPUImageCopyTexture<D> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
22124 Ok(ConversionResult::Success(value)) => value,
22125 Ok(ConversionResult::Failure(error)) => {
22126 throw_type_error(cx.raw_cx(), &error);
22127 return false;
22128
22129 }
22130 _ => {
22131 return false;
22132
22133 },
22134 }
22135 ;
22136 let arg1: GenericUnionTypes::ArrayBufferViewOrArrayBuffer = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
22137 Ok(ConversionResult::Success(value)) => value,
22138 Ok(ConversionResult::Failure(error)) => {
22139 throw_type_error(cx.raw_cx(), &error);
22140 return false;
22141
22142 }
22143 _ => {
22144 return false;
22145
22146 },
22147 }
22148 ;
22149 let arg2: crate::codegen::GenericBindings::WebGPUBinding::GPUImageDataLayout = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ()) {
22150 Ok(ConversionResult::Success(value)) => value,
22151 Ok(ConversionResult::Failure(error)) => {
22152 throw_type_error(cx.raw_cx(), &error);
22153 return false;
22154
22155 }
22156 _ => {
22157 return false;
22158
22159 },
22160 }
22161 ;
22162 let arg3: GenericUnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(3)), ()) {
22163 Ok(ConversionResult::Success(value)) => value,
22164 Ok(ConversionResult::Failure(error)) => {
22165 throw_type_error(cx.raw_cx(), &error);
22166 return false;
22167
22168 }
22169 _ => {
22170 return false;
22171
22172 },
22173 }
22174 ;
22175 let result: Result<(), Error> = this.WriteTexture(&arg0, arg1, &arg2, arg3);
22176 let result = match result {
22177 Ok(result) => result,
22178 Err(e) => {
22179 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
22180 return false;
22181 },
22182 };
22183
22184 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
22185 return true;
22186 })());
22187 result
22188}
22189
22190
22191static writeTexture_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
22192
22193pub(crate) fn init_writeTexture_methodinfo<D: DomTypes>() {
22194 writeTexture_methodinfo.set(JSJitInfo {
22195 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
22196 method: Some(writeTexture::<D>)
22197 },
22198 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
22199 protoID: PrototypeList::ID::GPUQueue as u16,
22200 },
22201 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
22202 _bitfield_align_1: [],
22203 _bitfield_1: __BindgenBitfieldUnit::new(
22204 new_jsjitinfo_bitfield_1!(
22205 JSJitInfo_OpType::Method as u8,
22206 JSJitInfo_AliasSet::AliasEverything as u8,
22207 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
22208 false,
22209 false,
22210 false,
22211 false,
22212 false,
22213 false,
22214 0,
22215 ).to_ne_bytes()
22216 ),
22217});
22218}
22219unsafe extern "C" fn get_label<D: DomTypes>
22220(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
22221 let mut result = false;
22222 wrap_panic(&mut || result = (|| {
22223 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
22224 let this = &*(this as *const D::GPUQueue);
22225 let result: USVString = this.Label();
22226
22227 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
22228 return true;
22229 })());
22230 result
22231}
22232
22233unsafe extern "C" fn set_label<D: DomTypes>
22234(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
22235 let mut result = false;
22236 wrap_panic(&mut || result = (|| {
22237 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
22238 let this = &*(this as *const D::GPUQueue);
22239 let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
22240 Ok(ConversionResult::Success(value)) => value,
22241 Ok(ConversionResult::Failure(error)) => {
22242 throw_type_error(cx.raw_cx(), &error);
22243 return false;
22244
22245 }
22246 _ => {
22247 return false;
22248
22249 },
22250 }
22251 ;
22252 let result: () = this.SetLabel(arg0);
22253
22254 true
22255 })());
22256 result
22257}
22258
22259
22260static label_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
22261
22262pub(crate) fn init_label_getterinfo<D: DomTypes>() {
22263 label_getterinfo.set(JSJitInfo {
22264 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
22265 getter: Some(get_label::<D>)
22266 },
22267 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
22268 protoID: PrototypeList::ID::GPUQueue as u16,
22269 },
22270 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
22271 _bitfield_align_1: [],
22272 _bitfield_1: __BindgenBitfieldUnit::new(
22273 new_jsjitinfo_bitfield_1!(
22274 JSJitInfo_OpType::Getter as u8,
22275 JSJitInfo_AliasSet::AliasEverything as u8,
22276 JSValueType::JSVAL_TYPE_STRING as u8,
22277 true,
22278 false,
22279 false,
22280 false,
22281 false,
22282 false,
22283 0,
22284 ).to_ne_bytes()
22285 ),
22286});
22287}
22288static label_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
22289
22290pub(crate) fn init_label_setterinfo<D: DomTypes>() {
22291 label_setterinfo.set(JSJitInfo {
22292 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
22293 setter: Some(set_label::<D>)
22294 },
22295 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
22296 protoID: PrototypeList::ID::GPUQueue as u16,
22297 },
22298 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
22299 _bitfield_align_1: [],
22300 _bitfield_1: __BindgenBitfieldUnit::new(
22301 new_jsjitinfo_bitfield_1!(
22302 JSJitInfo_OpType::Setter as u8,
22303 JSJitInfo_AliasSet::AliasEverything as u8,
22304 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
22305 false,
22306 false,
22307 false,
22308 false,
22309 false,
22310 false,
22311 0,
22312 ).to_ne_bytes()
22313 ),
22314});
22315}
22316unsafe extern "C" fn _finalize<D: DomTypes>
22317(_cx: *mut GCContext, obj: *mut JSObject){
22318 wrap_panic(&mut || {
22319
22320 let this = native_from_object_static::<D::GPUQueue>(obj).unwrap();
22321 finalize_common(this);
22322 })
22323}
22324
22325unsafe extern "C" fn _trace<D: DomTypes>
22326(trc: *mut JSTracer, obj: *mut JSObject){
22327 wrap_panic(&mut || {
22328
22329 let this = native_from_object_static::<D::GPUQueue>(obj).unwrap();
22330 if this.is_null() { return; } (*this).trace(trc);
22332 })
22333}
22334
22335
22336static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
22337
22338pub(crate) fn init_class_ops<D: DomTypes>() {
22339 CLASS_OPS.set(JSClassOps {
22340 addProperty: None,
22341 delProperty: None,
22342 enumerate: None,
22343 newEnumerate: None,
22344 resolve: None,
22345 mayResolve: None,
22346 finalize: Some(_finalize::<D>),
22347 call: None,
22348 construct: None,
22349 trace: Some(_trace::<D>),
22350 });
22351}
22352
22353pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
22354
22355pub(crate) fn init_domjs_class<D: DomTypes>() {
22356 init_class_ops::<D>();
22357 Class.set(DOMJSClass {
22358 base: JSClass {
22359 name: c"GPUQueue".as_ptr(),
22360 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
22361 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
22362 ,
22363 cOps: unsafe { CLASS_OPS.get() },
22364 spec: ptr::null(),
22365 ext: ptr::null(),
22366 oOps: ptr::null(),
22367 },
22368 dom_class:
22369DOMClass {
22370 interface_chain: [ PrototypeList::ID::GPUQueue, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
22371 depth: 0,
22372 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
22373 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUQueue> as unsafe fn(&mut _, _) -> _,
22374 global: Globals::EMPTY,
22375},
22376 });
22377}
22378
22379#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
22380(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUQueue>, _can_gc: CanGc) -> DomRoot<D::GPUQueue>{
22381
22382 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
22383
22384 let scope = scope.reflector().get_jsobject();
22385 assert!(!scope.get().is_null());
22386 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
22387 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
22388
22389 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
22390 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
22391 assert!(!canonical_proto.is_null());
22392
22393
22394 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
22395 if let Some(given) = given_proto {
22396 proto.set(*given);
22397 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
22398 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
22399 }
22400 } else {
22401 proto.set(*canonical_proto);
22402 }
22403 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
22404 cx.raw_cx(),
22405 &Class.get().base,
22406 proto.handle(),
22407 ));
22408 assert!(!obj.is_null());
22409 JS_SetReservedSlot(
22410 obj.get(),
22411 DOM_OBJECT_SLOT,
22412 &PrivateValue(raw.as_ptr() as *const libc::c_void),
22413 );
22414
22415 let root = raw.reflect_with(obj.get());
22416
22417
22418
22419 DomRoot::from_ref(&*root)
22420}
22421
22422pub trait GPUQueueMethods<D: DomTypes> {
22423 fn Submit(&self, r#buffers: Vec<DomRoot<D::GPUCommandBuffer>>);
22424 fn OnSubmittedWorkDone(&self, r#_can_gc: CanGc) -> Rc<D::Promise>;
22425 fn WriteBuffer(&self, r#buffer: &D::GPUBuffer, r#bufferOffset: u64, r#data: GenericUnionTypes::ArrayBufferViewOrArrayBuffer, r#dataOffset: u64, r#size: Option<u64>) -> Fallible<()>;
22426 fn WriteTexture(&self, r#destination: &crate::codegen::GenericBindings::WebGPUBinding::GPUImageCopyTexture<D>, r#data: GenericUnionTypes::ArrayBufferViewOrArrayBuffer, r#dataLayout: &crate::codegen::GenericBindings::WebGPUBinding::GPUImageDataLayout, r#size: GenericUnionTypes::RangeEnforcedUnsignedLongSequenceOrGPUExtent3DDict) -> Fallible<()>;
22427 fn Label(&self, ) -> USVString;
22428 fn SetLabel(&self, r#value: USVString);
22429}
22430static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
22431
22432pub(crate) fn init_sMethods_specs<D: DomTypes>() {
22433 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
22434 JSFunctionSpec {
22435 name: JSPropertySpec_Name { string_: c"submit".as_ptr() },
22436 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { submit_methodinfo.get() } as *const _ as *const JSJitInfo },
22437 nargs: 1,
22438 flags: (JSPROP_ENUMERATE) as u16,
22439 selfHostedName: ptr::null()
22440 },
22441 JSFunctionSpec {
22442 name: JSPropertySpec_Name { string_: c"onSubmittedWorkDone".as_ptr() },
22443 call: JSNativeWrapper { op: Some(generic_method::<true>), info: unsafe { onSubmittedWorkDone_methodinfo.get() } as *const _ as *const JSJitInfo },
22444 nargs: 0,
22445 flags: (JSPROP_ENUMERATE) as u16,
22446 selfHostedName: ptr::null()
22447 },
22448 JSFunctionSpec {
22449 name: JSPropertySpec_Name { string_: c"writeBuffer".as_ptr() },
22450 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { writeBuffer_methodinfo.get() } as *const _ as *const JSJitInfo },
22451 nargs: 3,
22452 flags: (JSPROP_ENUMERATE) as u16,
22453 selfHostedName: ptr::null()
22454 },
22455 JSFunctionSpec {
22456 name: JSPropertySpec_Name { string_: c"writeTexture".as_ptr() },
22457 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { writeTexture_methodinfo.get() } as *const _ as *const JSJitInfo },
22458 nargs: 4,
22459 flags: (JSPROP_ENUMERATE) as u16,
22460 selfHostedName: ptr::null()
22461 },
22462 JSFunctionSpec {
22463 name: JSPropertySpec_Name { string_: ptr::null() },
22464 call: JSNativeWrapper { op: None, info: ptr::null() },
22465 nargs: 0,
22466 flags: 0,
22467 selfHostedName: ptr::null()
22468 }]))[..]
22469])));
22470}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
22471
22472pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
22473 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sMethods_specs.get() })[0])])));
22474}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
22475
22476pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
22477 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
22478 JSPropertySpec {
22479 name: JSPropertySpec_Name { string_: c"label".as_ptr() },
22480 attributes_: (JSPROP_ENUMERATE),
22481 kind_: (JSPropertySpec_Kind::NativeAccessor),
22482 u: JSPropertySpec_AccessorsOrValue {
22483 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
22484 getter: JSPropertySpec_Accessor {
22485 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { label_getterinfo.get() } },
22486 },
22487 setter: JSPropertySpec_Accessor {
22488 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { label_setterinfo.get() } },
22489 }
22490 }
22491 }
22492 }
22493,
22494 JSPropertySpec::ZERO]))[..]
22495,
22496&Box::leak(Box::new([
22497 JSPropertySpec {
22498 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
22499 attributes_: (JSPROP_READONLY),
22500 kind_: (JSPropertySpec_Kind::Value),
22501 u: JSPropertySpec_AccessorsOrValue {
22502 value: JSPropertySpec_ValueWrapper {
22503 type_: JSPropertySpec_ValueWrapper_Type::String,
22504 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
22505 string: c"GPUQueue".as_ptr(),
22506 }
22507 }
22508 }
22509 }
22510,
22511 JSPropertySpec::ZERO]))[..]
22512])));
22513}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
22514
22515pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
22516 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
22517 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
22518}
22519pub fn GetProtoObject<D: DomTypes>
22520(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
22521 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUQueue), CreateInterfaceObjects::<D>, rval)
22523}
22524
22525
22526static PrototypeClass: JSClass = JSClass {
22527 name: c"GPUQueuePrototype".as_ptr(),
22528 flags:
22529 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
22531 cOps: ptr::null(),
22532 spec: ptr::null(),
22533 ext: ptr::null(),
22534 oOps: ptr::null(),
22535};
22536
22537
22538static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
22539
22540pub(crate) fn init_interface_object<D: DomTypes>() {
22541 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
22542 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
22543 b"function GPUQueue() {\n [native code]\n}",
22544 PrototypeList::ID::GPUQueue,
22545 0,
22546 ));
22547}
22548
22549pub fn DefineDOMInterface<D: DomTypes>
22550(cx: SafeJSContext, global: HandleObject){
22551 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUQueue),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
22552}
22553
22554pub fn ConstructorEnabled<D: DomTypes>
22555(aCx: SafeJSContext, aObj: HandleObject) -> bool{
22556 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
22557 pref!(dom_webgpu_enabled)
22558}
22559
22560unsafe fn CreateInterfaceObjects<D: DomTypes>
22561(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
22562
22563 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
22564 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
22565 assert!(!prototype_proto.is_null());
22566
22567 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
22568 create_interface_prototype_object::<D>(cx,
22569 global,
22570 prototype_proto.handle(),
22571 &PrototypeClass,
22572 sMethods.get(),
22573 sAttributes.get(),
22574 &[],
22575 &[],
22576 prototype.handle_mut());
22577 assert!(!prototype.is_null());
22578 assert!((*cache)[PrototypeList::ID::GPUQueue as usize].is_null());
22579 (*cache)[PrototypeList::ID::GPUQueue as usize] = prototype.get();
22580 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUQueue as isize),
22581 ptr::null_mut(),
22582 prototype.get());
22583
22584 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
22585 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
22586
22587 assert!(!interface_proto.is_null());
22588
22589 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
22590 create_noncallback_interface_object::<D>(cx,
22591 global,
22592 interface_proto.handle(),
22593 INTERFACE_OBJECT_CLASS.get(),
22594 &[],
22595 &[],
22596 &[],
22597 prototype.handle(),
22598 c"GPUQueue",
22599 0,
22600 &[],
22601 interface.handle_mut());
22602 assert!(!interface.is_null());
22603}
22604
22605
22606 pub(crate) fn init_statics<D: DomTypes>() {
22607 init_interface_object::<D>();
22608 init_domjs_class::<D>();
22609 crate::codegen::GenericBindings::WebGPUBinding::GPUQueue_Binding::init_submit_methodinfo::<D>();
22610crate::codegen::GenericBindings::WebGPUBinding::GPUQueue_Binding::init_onSubmittedWorkDone_methodinfo::<D>();
22611crate::codegen::GenericBindings::WebGPUBinding::GPUQueue_Binding::init_writeBuffer_methodinfo::<D>();
22612crate::codegen::GenericBindings::WebGPUBinding::GPUQueue_Binding::init_writeTexture_methodinfo::<D>();
22613 init_label_getterinfo::<D>();
22614 init_label_setterinfo::<D>();
22615
22616 init_sMethods_specs::<D>();
22617init_sMethods_prefs::<D>();
22618init_sAttributes_specs::<D>();
22619init_sAttributes_prefs::<D>();
22620 }
22621 } pub use self::GPURenderBundle_Binding::{Wrap as GPURenderBundleWrap, GPURenderBundleMethods, GetProtoObject as GPURenderBundleGetProtoObject, DefineDOMInterface as GPURenderBundleDefineDOMInterface};
22625pub mod GPURenderBundle_Binding {
22626use crate::import::module::*;
22627
22628unsafe extern "C" fn get_label<D: DomTypes>
22629(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
22630 let mut result = false;
22631 wrap_panic(&mut || result = (|| {
22632 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
22633 let this = &*(this as *const D::GPURenderBundle);
22634 let result: USVString = this.Label();
22635
22636 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
22637 return true;
22638 })());
22639 result
22640}
22641
22642unsafe extern "C" fn set_label<D: DomTypes>
22643(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
22644 let mut result = false;
22645 wrap_panic(&mut || result = (|| {
22646 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
22647 let this = &*(this as *const D::GPURenderBundle);
22648 let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
22649 Ok(ConversionResult::Success(value)) => value,
22650 Ok(ConversionResult::Failure(error)) => {
22651 throw_type_error(cx.raw_cx(), &error);
22652 return false;
22653
22654 }
22655 _ => {
22656 return false;
22657
22658 },
22659 }
22660 ;
22661 let result: () = this.SetLabel(arg0);
22662
22663 true
22664 })());
22665 result
22666}
22667
22668
22669static label_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
22670
22671pub(crate) fn init_label_getterinfo<D: DomTypes>() {
22672 label_getterinfo.set(JSJitInfo {
22673 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
22674 getter: Some(get_label::<D>)
22675 },
22676 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
22677 protoID: PrototypeList::ID::GPURenderBundle as u16,
22678 },
22679 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
22680 _bitfield_align_1: [],
22681 _bitfield_1: __BindgenBitfieldUnit::new(
22682 new_jsjitinfo_bitfield_1!(
22683 JSJitInfo_OpType::Getter as u8,
22684 JSJitInfo_AliasSet::AliasEverything as u8,
22685 JSValueType::JSVAL_TYPE_STRING as u8,
22686 true,
22687 false,
22688 false,
22689 false,
22690 false,
22691 false,
22692 0,
22693 ).to_ne_bytes()
22694 ),
22695});
22696}
22697static label_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
22698
22699pub(crate) fn init_label_setterinfo<D: DomTypes>() {
22700 label_setterinfo.set(JSJitInfo {
22701 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
22702 setter: Some(set_label::<D>)
22703 },
22704 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
22705 protoID: PrototypeList::ID::GPURenderBundle as u16,
22706 },
22707 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
22708 _bitfield_align_1: [],
22709 _bitfield_1: __BindgenBitfieldUnit::new(
22710 new_jsjitinfo_bitfield_1!(
22711 JSJitInfo_OpType::Setter as u8,
22712 JSJitInfo_AliasSet::AliasEverything as u8,
22713 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
22714 false,
22715 false,
22716 false,
22717 false,
22718 false,
22719 false,
22720 0,
22721 ).to_ne_bytes()
22722 ),
22723});
22724}
22725unsafe extern "C" fn _finalize<D: DomTypes>
22726(_cx: *mut GCContext, obj: *mut JSObject){
22727 wrap_panic(&mut || {
22728
22729 let this = native_from_object_static::<D::GPURenderBundle>(obj).unwrap();
22730 finalize_common(this);
22731 })
22732}
22733
22734unsafe extern "C" fn _trace<D: DomTypes>
22735(trc: *mut JSTracer, obj: *mut JSObject){
22736 wrap_panic(&mut || {
22737
22738 let this = native_from_object_static::<D::GPURenderBundle>(obj).unwrap();
22739 if this.is_null() { return; } (*this).trace(trc);
22741 })
22742}
22743
22744
22745static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
22746
22747pub(crate) fn init_class_ops<D: DomTypes>() {
22748 CLASS_OPS.set(JSClassOps {
22749 addProperty: None,
22750 delProperty: None,
22751 enumerate: None,
22752 newEnumerate: None,
22753 resolve: None,
22754 mayResolve: None,
22755 finalize: Some(_finalize::<D>),
22756 call: None,
22757 construct: None,
22758 trace: Some(_trace::<D>),
22759 });
22760}
22761
22762pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
22763
22764pub(crate) fn init_domjs_class<D: DomTypes>() {
22765 init_class_ops::<D>();
22766 Class.set(DOMJSClass {
22767 base: JSClass {
22768 name: c"GPURenderBundle".as_ptr(),
22769 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
22770 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
22771 ,
22772 cOps: unsafe { CLASS_OPS.get() },
22773 spec: ptr::null(),
22774 ext: ptr::null(),
22775 oOps: ptr::null(),
22776 },
22777 dom_class:
22778DOMClass {
22779 interface_chain: [ PrototypeList::ID::GPURenderBundle, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
22780 depth: 0,
22781 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
22782 malloc_size_of: malloc_size_of_including_raw_self::<D::GPURenderBundle> as unsafe fn(&mut _, _) -> _,
22783 global: Globals::EMPTY,
22784},
22785 });
22786}
22787
22788#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
22789(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPURenderBundle>, _can_gc: CanGc) -> DomRoot<D::GPURenderBundle>{
22790
22791 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
22792
22793 let scope = scope.reflector().get_jsobject();
22794 assert!(!scope.get().is_null());
22795 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
22796 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
22797
22798 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
22799 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
22800 assert!(!canonical_proto.is_null());
22801
22802
22803 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
22804 if let Some(given) = given_proto {
22805 proto.set(*given);
22806 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
22807 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
22808 }
22809 } else {
22810 proto.set(*canonical_proto);
22811 }
22812 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
22813 cx.raw_cx(),
22814 &Class.get().base,
22815 proto.handle(),
22816 ));
22817 assert!(!obj.is_null());
22818 JS_SetReservedSlot(
22819 obj.get(),
22820 DOM_OBJECT_SLOT,
22821 &PrivateValue(raw.as_ptr() as *const libc::c_void),
22822 );
22823
22824 let root = raw.reflect_with(obj.get());
22825
22826
22827
22828 DomRoot::from_ref(&*root)
22829}
22830
22831pub trait GPURenderBundleMethods<D: DomTypes> {
22832 fn Label(&self, ) -> USVString;
22833 fn SetLabel(&self, r#value: USVString);
22834}
22835static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
22836
22837pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
22838 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
22839 JSPropertySpec {
22840 name: JSPropertySpec_Name { string_: c"label".as_ptr() },
22841 attributes_: (JSPROP_ENUMERATE),
22842 kind_: (JSPropertySpec_Kind::NativeAccessor),
22843 u: JSPropertySpec_AccessorsOrValue {
22844 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
22845 getter: JSPropertySpec_Accessor {
22846 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { label_getterinfo.get() } },
22847 },
22848 setter: JSPropertySpec_Accessor {
22849 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { label_setterinfo.get() } },
22850 }
22851 }
22852 }
22853 }
22854,
22855 JSPropertySpec::ZERO]))[..]
22856,
22857&Box::leak(Box::new([
22858 JSPropertySpec {
22859 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
22860 attributes_: (JSPROP_READONLY),
22861 kind_: (JSPropertySpec_Kind::Value),
22862 u: JSPropertySpec_AccessorsOrValue {
22863 value: JSPropertySpec_ValueWrapper {
22864 type_: JSPropertySpec_ValueWrapper_Type::String,
22865 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
22866 string: c"GPURenderBundle".as_ptr(),
22867 }
22868 }
22869 }
22870 }
22871,
22872 JSPropertySpec::ZERO]))[..]
22873])));
22874}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
22875
22876pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
22877 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
22878 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
22879}
22880pub fn GetProtoObject<D: DomTypes>
22881(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
22882 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPURenderBundle), CreateInterfaceObjects::<D>, rval)
22884}
22885
22886
22887static PrototypeClass: JSClass = JSClass {
22888 name: c"GPURenderBundlePrototype".as_ptr(),
22889 flags:
22890 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
22892 cOps: ptr::null(),
22893 spec: ptr::null(),
22894 ext: ptr::null(),
22895 oOps: ptr::null(),
22896};
22897
22898
22899static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
22900
22901pub(crate) fn init_interface_object<D: DomTypes>() {
22902 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
22903 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
22904 b"function GPURenderBundle() {\n [native code]\n}",
22905 PrototypeList::ID::GPURenderBundle,
22906 0,
22907 ));
22908}
22909
22910pub fn DefineDOMInterface<D: DomTypes>
22911(cx: SafeJSContext, global: HandleObject){
22912 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPURenderBundle),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
22913}
22914
22915pub fn ConstructorEnabled<D: DomTypes>
22916(aCx: SafeJSContext, aObj: HandleObject) -> bool{
22917 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
22918 pref!(dom_webgpu_enabled)
22919}
22920
22921unsafe fn CreateInterfaceObjects<D: DomTypes>
22922(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
22923
22924 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
22925 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
22926 assert!(!prototype_proto.is_null());
22927
22928 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
22929 create_interface_prototype_object::<D>(cx,
22930 global,
22931 prototype_proto.handle(),
22932 &PrototypeClass,
22933 &[],
22934 sAttributes.get(),
22935 &[],
22936 &[],
22937 prototype.handle_mut());
22938 assert!(!prototype.is_null());
22939 assert!((*cache)[PrototypeList::ID::GPURenderBundle as usize].is_null());
22940 (*cache)[PrototypeList::ID::GPURenderBundle as usize] = prototype.get();
22941 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPURenderBundle as isize),
22942 ptr::null_mut(),
22943 prototype.get());
22944
22945 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
22946 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
22947
22948 assert!(!interface_proto.is_null());
22949
22950 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
22951 create_noncallback_interface_object::<D>(cx,
22952 global,
22953 interface_proto.handle(),
22954 INTERFACE_OBJECT_CLASS.get(),
22955 &[],
22956 &[],
22957 &[],
22958 prototype.handle(),
22959 c"GPURenderBundle",
22960 0,
22961 &[],
22962 interface.handle_mut());
22963 assert!(!interface.is_null());
22964}
22965
22966
22967 pub(crate) fn init_statics<D: DomTypes>() {
22968 init_interface_object::<D>();
22969 init_domjs_class::<D>();
22970
22971 init_label_getterinfo::<D>();
22972 init_label_setterinfo::<D>();
22973
22974 init_sAttributes_specs::<D>();
22975init_sAttributes_prefs::<D>();
22976 }
22977 } pub use self::GPURenderBundleEncoder_Binding::{Wrap as GPURenderBundleEncoderWrap, GPURenderBundleEncoderMethods, GetProtoObject as GPURenderBundleEncoderGetProtoObject, DefineDOMInterface as GPURenderBundleEncoderDefineDOMInterface};
22981pub mod GPURenderBundleEncoder_Binding {
22982use crate::codegen::GenericBindings::WebGPUBinding::GPUIndexFormat;
22983use crate::codegen::GenericBindings::WebGPUBinding::GPUIndexFormatValues;
22984use crate::codegen::GenericBindings::WebGPUBinding::GPURenderBundleDescriptor;
22985use crate::import::module::*;
22986
22987unsafe extern "C" fn finish<D: DomTypes>
22988(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
22989 let mut result = false;
22990 wrap_panic(&mut || result = (|| {
22991 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
22992 let this = &*(this as *const D::GPURenderBundleEncoder);
22993 let args = &*args;
22994 let argc = args.argc_;
22995 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPURenderBundleDescriptor = if args.get(0).is_undefined() {
22996 crate::codegen::GenericBindings::WebGPUBinding::GPURenderBundleDescriptor::empty()
22997 } else {
22998 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
22999 Ok(ConversionResult::Success(value)) => value,
23000 Ok(ConversionResult::Failure(error)) => {
23001 throw_type_error(cx.raw_cx(), &error);
23002 return false;
23003
23004 }
23005 _ => {
23006 return false;
23007
23008 },
23009 }
23010
23011 };
23012 let result: DomRoot<D::GPURenderBundle> = this.Finish(&arg0);
23013
23014 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
23015 return true;
23016 })());
23017 result
23018}
23019
23020
23021static finish_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
23022
23023pub(crate) fn init_finish_methodinfo<D: DomTypes>() {
23024 finish_methodinfo.set(JSJitInfo {
23025 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
23026 method: Some(finish::<D>)
23027 },
23028 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
23029 protoID: PrototypeList::ID::GPURenderBundleEncoder as u16,
23030 },
23031 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
23032 _bitfield_align_1: [],
23033 _bitfield_1: __BindgenBitfieldUnit::new(
23034 new_jsjitinfo_bitfield_1!(
23035 JSJitInfo_OpType::Method as u8,
23036 JSJitInfo_AliasSet::AliasEverything as u8,
23037 JSValueType::JSVAL_TYPE_OBJECT as u8,
23038 false,
23039 false,
23040 false,
23041 false,
23042 false,
23043 false,
23044 0,
23045 ).to_ne_bytes()
23046 ),
23047});
23048}
23049unsafe extern "C" fn get_label<D: DomTypes>
23050(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
23051 let mut result = false;
23052 wrap_panic(&mut || result = (|| {
23053 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
23054 let this = &*(this as *const D::GPURenderBundleEncoder);
23055 let result: USVString = this.Label();
23056
23057 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
23058 return true;
23059 })());
23060 result
23061}
23062
23063unsafe extern "C" fn set_label<D: DomTypes>
23064(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
23065 let mut result = false;
23066 wrap_panic(&mut || result = (|| {
23067 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
23068 let this = &*(this as *const D::GPURenderBundleEncoder);
23069 let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
23070 Ok(ConversionResult::Success(value)) => value,
23071 Ok(ConversionResult::Failure(error)) => {
23072 throw_type_error(cx.raw_cx(), &error);
23073 return false;
23074
23075 }
23076 _ => {
23077 return false;
23078
23079 },
23080 }
23081 ;
23082 let result: () = this.SetLabel(arg0);
23083
23084 true
23085 })());
23086 result
23087}
23088
23089
23090static label_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
23091
23092pub(crate) fn init_label_getterinfo<D: DomTypes>() {
23093 label_getterinfo.set(JSJitInfo {
23094 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
23095 getter: Some(get_label::<D>)
23096 },
23097 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
23098 protoID: PrototypeList::ID::GPURenderBundleEncoder as u16,
23099 },
23100 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
23101 _bitfield_align_1: [],
23102 _bitfield_1: __BindgenBitfieldUnit::new(
23103 new_jsjitinfo_bitfield_1!(
23104 JSJitInfo_OpType::Getter as u8,
23105 JSJitInfo_AliasSet::AliasEverything as u8,
23106 JSValueType::JSVAL_TYPE_STRING as u8,
23107 true,
23108 false,
23109 false,
23110 false,
23111 false,
23112 false,
23113 0,
23114 ).to_ne_bytes()
23115 ),
23116});
23117}
23118static label_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
23119
23120pub(crate) fn init_label_setterinfo<D: DomTypes>() {
23121 label_setterinfo.set(JSJitInfo {
23122 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
23123 setter: Some(set_label::<D>)
23124 },
23125 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
23126 protoID: PrototypeList::ID::GPURenderBundleEncoder as u16,
23127 },
23128 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
23129 _bitfield_align_1: [],
23130 _bitfield_1: __BindgenBitfieldUnit::new(
23131 new_jsjitinfo_bitfield_1!(
23132 JSJitInfo_OpType::Setter as u8,
23133 JSJitInfo_AliasSet::AliasEverything as u8,
23134 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
23135 false,
23136 false,
23137 false,
23138 false,
23139 false,
23140 false,
23141 0,
23142 ).to_ne_bytes()
23143 ),
23144});
23145}
23146unsafe extern "C" fn setBindGroup<D: DomTypes>
23147(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
23148 let mut result = false;
23149 wrap_panic(&mut || result = (|| {
23150 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
23151 let this = &*(this as *const D::GPURenderBundleEncoder);
23152 let args = &*args;
23153 let argc = args.argc_;
23154
23155 if argc < 2 {
23156 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPURenderBundleEncoder.setBindGroup\".");
23157 return false;
23158 }
23159 let arg0: u32 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
23160 Ok(ConversionResult::Success(value)) => value,
23161 Ok(ConversionResult::Failure(error)) => {
23162 throw_type_error(cx.raw_cx(), &error);
23163 return false;
23164
23165 }
23166 _ => {
23167 return false;
23168
23169 },
23170 }
23171 ;
23172 let arg1: DomRoot<D::GPUBindGroup> = if HandleValue::from_raw(args.get(1)).get().is_object() {
23173 match root_from_handlevalue(HandleValue::from_raw(args.get(1)), SafeJSContext::from_ptr(cx.raw_cx())) {
23174 Ok(val) => val,
23175 Err(()) => {
23176 throw_type_error(cx.raw_cx(), "value does not implement interface GPUBindGroup.");
23177 return false;
23178
23179 }
23180 }
23181
23182 } else {
23183 throw_type_error(cx.raw_cx(), "Value is not an object.");
23184 return false;
23185
23186 };
23187 let arg2: Vec<u32> = if args.get(2).is_undefined() {
23188 Vec::new()
23189 } else {
23190 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
23191 Ok(ConversionResult::Success(value)) => value,
23192 Ok(ConversionResult::Failure(error)) => {
23193 throw_type_error(cx.raw_cx(), &error);
23194 return false;
23195
23196 }
23197 _ => {
23198 return false;
23199
23200 },
23201 }
23202
23203 };
23204 let result: () = this.SetBindGroup(arg0, &arg1, arg2);
23205
23206 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
23207 return true;
23208 })());
23209 result
23210}
23211
23212
23213static setBindGroup_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
23214
23215pub(crate) fn init_setBindGroup_methodinfo<D: DomTypes>() {
23216 setBindGroup_methodinfo.set(JSJitInfo {
23217 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
23218 method: Some(setBindGroup::<D>)
23219 },
23220 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
23221 protoID: PrototypeList::ID::GPURenderBundleEncoder as u16,
23222 },
23223 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
23224 _bitfield_align_1: [],
23225 _bitfield_1: __BindgenBitfieldUnit::new(
23226 new_jsjitinfo_bitfield_1!(
23227 JSJitInfo_OpType::Method as u8,
23228 JSJitInfo_AliasSet::AliasEverything as u8,
23229 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
23230 false,
23231 false,
23232 false,
23233 false,
23234 false,
23235 false,
23236 0,
23237 ).to_ne_bytes()
23238 ),
23239});
23240}
23241unsafe extern "C" fn setPipeline<D: DomTypes>
23242(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
23243 let mut result = false;
23244 wrap_panic(&mut || result = (|| {
23245 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
23246 let this = &*(this as *const D::GPURenderBundleEncoder);
23247 let args = &*args;
23248 let argc = args.argc_;
23249
23250 if argc < 1 {
23251 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPURenderBundleEncoder.setPipeline\".");
23252 return false;
23253 }
23254 let arg0: DomRoot<D::GPURenderPipeline> = if HandleValue::from_raw(args.get(0)).get().is_object() {
23255 match root_from_handlevalue(HandleValue::from_raw(args.get(0)), SafeJSContext::from_ptr(cx.raw_cx())) {
23256 Ok(val) => val,
23257 Err(()) => {
23258 throw_type_error(cx.raw_cx(), "value does not implement interface GPURenderPipeline.");
23259 return false;
23260
23261 }
23262 }
23263
23264 } else {
23265 throw_type_error(cx.raw_cx(), "Value is not an object.");
23266 return false;
23267
23268 };
23269 let result: () = this.SetPipeline(&arg0);
23270
23271 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
23272 return true;
23273 })());
23274 result
23275}
23276
23277
23278static setPipeline_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
23279
23280pub(crate) fn init_setPipeline_methodinfo<D: DomTypes>() {
23281 setPipeline_methodinfo.set(JSJitInfo {
23282 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
23283 method: Some(setPipeline::<D>)
23284 },
23285 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
23286 protoID: PrototypeList::ID::GPURenderBundleEncoder as u16,
23287 },
23288 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
23289 _bitfield_align_1: [],
23290 _bitfield_1: __BindgenBitfieldUnit::new(
23291 new_jsjitinfo_bitfield_1!(
23292 JSJitInfo_OpType::Method as u8,
23293 JSJitInfo_AliasSet::AliasEverything as u8,
23294 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
23295 false,
23296 false,
23297 false,
23298 false,
23299 false,
23300 false,
23301 0,
23302 ).to_ne_bytes()
23303 ),
23304});
23305}
23306unsafe extern "C" fn setIndexBuffer<D: DomTypes>
23307(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
23308 let mut result = false;
23309 wrap_panic(&mut || result = (|| {
23310 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
23311 let this = &*(this as *const D::GPURenderBundleEncoder);
23312 let args = &*args;
23313 let argc = args.argc_;
23314
23315 if argc < 2 {
23316 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPURenderBundleEncoder.setIndexBuffer\".");
23317 return false;
23318 }
23319 let arg0: DomRoot<D::GPUBuffer> = if HandleValue::from_raw(args.get(0)).get().is_object() {
23320 match root_from_handlevalue(HandleValue::from_raw(args.get(0)), SafeJSContext::from_ptr(cx.raw_cx())) {
23321 Ok(val) => val,
23322 Err(()) => {
23323 throw_type_error(cx.raw_cx(), "value does not implement interface GPUBuffer.");
23324 return false;
23325
23326 }
23327 }
23328
23329 } else {
23330 throw_type_error(cx.raw_cx(), "Value is not an object.");
23331 return false;
23332
23333 };
23334 let arg1: GPUIndexFormat = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
23335 Ok(ConversionResult::Success(value)) => value,
23336 Ok(ConversionResult::Failure(error)) => {
23337 throw_type_error(cx.raw_cx(), &error); return false;
23338
23339 }
23340 _ => {
23341 return false;
23342
23343 },
23344 }
23345 ;
23346 let arg2: u64 = if args.get(2).is_undefined() {
23347 0
23348 } else {
23349 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
23350 Ok(ConversionResult::Success(value)) => value,
23351 Ok(ConversionResult::Failure(error)) => {
23352 throw_type_error(cx.raw_cx(), &error);
23353 return false;
23354
23355 }
23356 _ => {
23357 return false;
23358
23359 },
23360 }
23361
23362 };
23363 let arg3: u64 = if args.get(3).is_undefined() {
23364 0
23365 } else {
23366 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(3)), ConversionBehavior::EnforceRange) {
23367 Ok(ConversionResult::Success(value)) => value,
23368 Ok(ConversionResult::Failure(error)) => {
23369 throw_type_error(cx.raw_cx(), &error);
23370 return false;
23371
23372 }
23373 _ => {
23374 return false;
23375
23376 },
23377 }
23378
23379 };
23380 let result: () = this.SetIndexBuffer(&arg0, arg1, arg2, arg3);
23381
23382 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
23383 return true;
23384 })());
23385 result
23386}
23387
23388
23389static setIndexBuffer_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
23390
23391pub(crate) fn init_setIndexBuffer_methodinfo<D: DomTypes>() {
23392 setIndexBuffer_methodinfo.set(JSJitInfo {
23393 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
23394 method: Some(setIndexBuffer::<D>)
23395 },
23396 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
23397 protoID: PrototypeList::ID::GPURenderBundleEncoder as u16,
23398 },
23399 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
23400 _bitfield_align_1: [],
23401 _bitfield_1: __BindgenBitfieldUnit::new(
23402 new_jsjitinfo_bitfield_1!(
23403 JSJitInfo_OpType::Method as u8,
23404 JSJitInfo_AliasSet::AliasEverything as u8,
23405 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
23406 false,
23407 false,
23408 false,
23409 false,
23410 false,
23411 false,
23412 0,
23413 ).to_ne_bytes()
23414 ),
23415});
23416}
23417unsafe extern "C" fn setVertexBuffer<D: DomTypes>
23418(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
23419 let mut result = false;
23420 wrap_panic(&mut || result = (|| {
23421 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
23422 let this = &*(this as *const D::GPURenderBundleEncoder);
23423 let args = &*args;
23424 let argc = args.argc_;
23425
23426 if argc < 2 {
23427 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPURenderBundleEncoder.setVertexBuffer\".");
23428 return false;
23429 }
23430 let arg0: u32 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
23431 Ok(ConversionResult::Success(value)) => value,
23432 Ok(ConversionResult::Failure(error)) => {
23433 throw_type_error(cx.raw_cx(), &error);
23434 return false;
23435
23436 }
23437 _ => {
23438 return false;
23439
23440 },
23441 }
23442 ;
23443 let arg1: DomRoot<D::GPUBuffer> = if HandleValue::from_raw(args.get(1)).get().is_object() {
23444 match root_from_handlevalue(HandleValue::from_raw(args.get(1)), SafeJSContext::from_ptr(cx.raw_cx())) {
23445 Ok(val) => val,
23446 Err(()) => {
23447 throw_type_error(cx.raw_cx(), "value does not implement interface GPUBuffer.");
23448 return false;
23449
23450 }
23451 }
23452
23453 } else {
23454 throw_type_error(cx.raw_cx(), "Value is not an object.");
23455 return false;
23456
23457 };
23458 let arg2: u64 = if args.get(2).is_undefined() {
23459 0
23460 } else {
23461 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
23462 Ok(ConversionResult::Success(value)) => value,
23463 Ok(ConversionResult::Failure(error)) => {
23464 throw_type_error(cx.raw_cx(), &error);
23465 return false;
23466
23467 }
23468 _ => {
23469 return false;
23470
23471 },
23472 }
23473
23474 };
23475 let arg3: u64 = if args.get(3).is_undefined() {
23476 0
23477 } else {
23478 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(3)), ConversionBehavior::EnforceRange) {
23479 Ok(ConversionResult::Success(value)) => value,
23480 Ok(ConversionResult::Failure(error)) => {
23481 throw_type_error(cx.raw_cx(), &error);
23482 return false;
23483
23484 }
23485 _ => {
23486 return false;
23487
23488 },
23489 }
23490
23491 };
23492 let result: () = this.SetVertexBuffer(arg0, &arg1, arg2, arg3);
23493
23494 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
23495 return true;
23496 })());
23497 result
23498}
23499
23500
23501static setVertexBuffer_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
23502
23503pub(crate) fn init_setVertexBuffer_methodinfo<D: DomTypes>() {
23504 setVertexBuffer_methodinfo.set(JSJitInfo {
23505 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
23506 method: Some(setVertexBuffer::<D>)
23507 },
23508 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
23509 protoID: PrototypeList::ID::GPURenderBundleEncoder as u16,
23510 },
23511 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
23512 _bitfield_align_1: [],
23513 _bitfield_1: __BindgenBitfieldUnit::new(
23514 new_jsjitinfo_bitfield_1!(
23515 JSJitInfo_OpType::Method as u8,
23516 JSJitInfo_AliasSet::AliasEverything as u8,
23517 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
23518 false,
23519 false,
23520 false,
23521 false,
23522 false,
23523 false,
23524 0,
23525 ).to_ne_bytes()
23526 ),
23527});
23528}
23529unsafe extern "C" fn draw<D: DomTypes>
23530(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
23531 let mut result = false;
23532 wrap_panic(&mut || result = (|| {
23533 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
23534 let this = &*(this as *const D::GPURenderBundleEncoder);
23535 let args = &*args;
23536 let argc = args.argc_;
23537
23538 if argc < 1 {
23539 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPURenderBundleEncoder.draw\".");
23540 return false;
23541 }
23542 let arg0: u32 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
23543 Ok(ConversionResult::Success(value)) => value,
23544 Ok(ConversionResult::Failure(error)) => {
23545 throw_type_error(cx.raw_cx(), &error);
23546 return false;
23547
23548 }
23549 _ => {
23550 return false;
23551
23552 },
23553 }
23554 ;
23555 let arg1: u32 = if args.get(1).is_undefined() {
23556 1
23557 } else {
23558 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
23559 Ok(ConversionResult::Success(value)) => value,
23560 Ok(ConversionResult::Failure(error)) => {
23561 throw_type_error(cx.raw_cx(), &error);
23562 return false;
23563
23564 }
23565 _ => {
23566 return false;
23567
23568 },
23569 }
23570
23571 };
23572 let arg2: u32 = if args.get(2).is_undefined() {
23573 0
23574 } else {
23575 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
23576 Ok(ConversionResult::Success(value)) => value,
23577 Ok(ConversionResult::Failure(error)) => {
23578 throw_type_error(cx.raw_cx(), &error);
23579 return false;
23580
23581 }
23582 _ => {
23583 return false;
23584
23585 },
23586 }
23587
23588 };
23589 let arg3: u32 = if args.get(3).is_undefined() {
23590 0
23591 } else {
23592 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(3)), ConversionBehavior::EnforceRange) {
23593 Ok(ConversionResult::Success(value)) => value,
23594 Ok(ConversionResult::Failure(error)) => {
23595 throw_type_error(cx.raw_cx(), &error);
23596 return false;
23597
23598 }
23599 _ => {
23600 return false;
23601
23602 },
23603 }
23604
23605 };
23606 let result: () = this.Draw(arg0, arg1, arg2, arg3);
23607
23608 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
23609 return true;
23610 })());
23611 result
23612}
23613
23614
23615static draw_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
23616
23617pub(crate) fn init_draw_methodinfo<D: DomTypes>() {
23618 draw_methodinfo.set(JSJitInfo {
23619 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
23620 method: Some(draw::<D>)
23621 },
23622 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
23623 protoID: PrototypeList::ID::GPURenderBundleEncoder as u16,
23624 },
23625 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
23626 _bitfield_align_1: [],
23627 _bitfield_1: __BindgenBitfieldUnit::new(
23628 new_jsjitinfo_bitfield_1!(
23629 JSJitInfo_OpType::Method as u8,
23630 JSJitInfo_AliasSet::AliasEverything as u8,
23631 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
23632 false,
23633 false,
23634 false,
23635 false,
23636 false,
23637 false,
23638 0,
23639 ).to_ne_bytes()
23640 ),
23641});
23642}
23643unsafe extern "C" fn drawIndexed<D: DomTypes>
23644(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
23645 let mut result = false;
23646 wrap_panic(&mut || result = (|| {
23647 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
23648 let this = &*(this as *const D::GPURenderBundleEncoder);
23649 let args = &*args;
23650 let argc = args.argc_;
23651
23652 if argc < 1 {
23653 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPURenderBundleEncoder.drawIndexed\".");
23654 return false;
23655 }
23656 let arg0: u32 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
23657 Ok(ConversionResult::Success(value)) => value,
23658 Ok(ConversionResult::Failure(error)) => {
23659 throw_type_error(cx.raw_cx(), &error);
23660 return false;
23661
23662 }
23663 _ => {
23664 return false;
23665
23666 },
23667 }
23668 ;
23669 let arg1: u32 = if args.get(1).is_undefined() {
23670 1
23671 } else {
23672 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
23673 Ok(ConversionResult::Success(value)) => value,
23674 Ok(ConversionResult::Failure(error)) => {
23675 throw_type_error(cx.raw_cx(), &error);
23676 return false;
23677
23678 }
23679 _ => {
23680 return false;
23681
23682 },
23683 }
23684
23685 };
23686 let arg2: u32 = if args.get(2).is_undefined() {
23687 0
23688 } else {
23689 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
23690 Ok(ConversionResult::Success(value)) => value,
23691 Ok(ConversionResult::Failure(error)) => {
23692 throw_type_error(cx.raw_cx(), &error);
23693 return false;
23694
23695 }
23696 _ => {
23697 return false;
23698
23699 },
23700 }
23701
23702 };
23703 let arg3: i32 = if args.get(3).is_undefined() {
23704 0
23705 } else {
23706 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(3)), ConversionBehavior::EnforceRange) {
23707 Ok(ConversionResult::Success(value)) => value,
23708 Ok(ConversionResult::Failure(error)) => {
23709 throw_type_error(cx.raw_cx(), &error);
23710 return false;
23711
23712 }
23713 _ => {
23714 return false;
23715
23716 },
23717 }
23718
23719 };
23720 let arg4: u32 = if args.get(4).is_undefined() {
23721 0
23722 } else {
23723 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(4)), ConversionBehavior::EnforceRange) {
23724 Ok(ConversionResult::Success(value)) => value,
23725 Ok(ConversionResult::Failure(error)) => {
23726 throw_type_error(cx.raw_cx(), &error);
23727 return false;
23728
23729 }
23730 _ => {
23731 return false;
23732
23733 },
23734 }
23735
23736 };
23737 let result: () = this.DrawIndexed(arg0, arg1, arg2, arg3, arg4);
23738
23739 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
23740 return true;
23741 })());
23742 result
23743}
23744
23745
23746static drawIndexed_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
23747
23748pub(crate) fn init_drawIndexed_methodinfo<D: DomTypes>() {
23749 drawIndexed_methodinfo.set(JSJitInfo {
23750 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
23751 method: Some(drawIndexed::<D>)
23752 },
23753 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
23754 protoID: PrototypeList::ID::GPURenderBundleEncoder as u16,
23755 },
23756 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
23757 _bitfield_align_1: [],
23758 _bitfield_1: __BindgenBitfieldUnit::new(
23759 new_jsjitinfo_bitfield_1!(
23760 JSJitInfo_OpType::Method as u8,
23761 JSJitInfo_AliasSet::AliasEverything as u8,
23762 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
23763 false,
23764 false,
23765 false,
23766 false,
23767 false,
23768 false,
23769 0,
23770 ).to_ne_bytes()
23771 ),
23772});
23773}
23774unsafe extern "C" fn drawIndirect<D: DomTypes>
23775(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
23776 let mut result = false;
23777 wrap_panic(&mut || result = (|| {
23778 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
23779 let this = &*(this as *const D::GPURenderBundleEncoder);
23780 let args = &*args;
23781 let argc = args.argc_;
23782
23783 if argc < 2 {
23784 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPURenderBundleEncoder.drawIndirect\".");
23785 return false;
23786 }
23787 let arg0: DomRoot<D::GPUBuffer> = if HandleValue::from_raw(args.get(0)).get().is_object() {
23788 match root_from_handlevalue(HandleValue::from_raw(args.get(0)), SafeJSContext::from_ptr(cx.raw_cx())) {
23789 Ok(val) => val,
23790 Err(()) => {
23791 throw_type_error(cx.raw_cx(), "value does not implement interface GPUBuffer.");
23792 return false;
23793
23794 }
23795 }
23796
23797 } else {
23798 throw_type_error(cx.raw_cx(), "Value is not an object.");
23799 return false;
23800
23801 };
23802 let arg1: u64 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
23803 Ok(ConversionResult::Success(value)) => value,
23804 Ok(ConversionResult::Failure(error)) => {
23805 throw_type_error(cx.raw_cx(), &error);
23806 return false;
23807
23808 }
23809 _ => {
23810 return false;
23811
23812 },
23813 }
23814 ;
23815 let result: () = this.DrawIndirect(&arg0, arg1);
23816
23817 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
23818 return true;
23819 })());
23820 result
23821}
23822
23823
23824static drawIndirect_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
23825
23826pub(crate) fn init_drawIndirect_methodinfo<D: DomTypes>() {
23827 drawIndirect_methodinfo.set(JSJitInfo {
23828 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
23829 method: Some(drawIndirect::<D>)
23830 },
23831 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
23832 protoID: PrototypeList::ID::GPURenderBundleEncoder as u16,
23833 },
23834 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
23835 _bitfield_align_1: [],
23836 _bitfield_1: __BindgenBitfieldUnit::new(
23837 new_jsjitinfo_bitfield_1!(
23838 JSJitInfo_OpType::Method as u8,
23839 JSJitInfo_AliasSet::AliasEverything as u8,
23840 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
23841 false,
23842 false,
23843 false,
23844 false,
23845 false,
23846 false,
23847 0,
23848 ).to_ne_bytes()
23849 ),
23850});
23851}
23852unsafe extern "C" fn drawIndexedIndirect<D: DomTypes>
23853(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
23854 let mut result = false;
23855 wrap_panic(&mut || result = (|| {
23856 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
23857 let this = &*(this as *const D::GPURenderBundleEncoder);
23858 let args = &*args;
23859 let argc = args.argc_;
23860
23861 if argc < 2 {
23862 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPURenderBundleEncoder.drawIndexedIndirect\".");
23863 return false;
23864 }
23865 let arg0: DomRoot<D::GPUBuffer> = if HandleValue::from_raw(args.get(0)).get().is_object() {
23866 match root_from_handlevalue(HandleValue::from_raw(args.get(0)), SafeJSContext::from_ptr(cx.raw_cx())) {
23867 Ok(val) => val,
23868 Err(()) => {
23869 throw_type_error(cx.raw_cx(), "value does not implement interface GPUBuffer.");
23870 return false;
23871
23872 }
23873 }
23874
23875 } else {
23876 throw_type_error(cx.raw_cx(), "Value is not an object.");
23877 return false;
23878
23879 };
23880 let arg1: u64 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
23881 Ok(ConversionResult::Success(value)) => value,
23882 Ok(ConversionResult::Failure(error)) => {
23883 throw_type_error(cx.raw_cx(), &error);
23884 return false;
23885
23886 }
23887 _ => {
23888 return false;
23889
23890 },
23891 }
23892 ;
23893 let result: () = this.DrawIndexedIndirect(&arg0, arg1);
23894
23895 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
23896 return true;
23897 })());
23898 result
23899}
23900
23901
23902static drawIndexedIndirect_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
23903
23904pub(crate) fn init_drawIndexedIndirect_methodinfo<D: DomTypes>() {
23905 drawIndexedIndirect_methodinfo.set(JSJitInfo {
23906 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
23907 method: Some(drawIndexedIndirect::<D>)
23908 },
23909 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
23910 protoID: PrototypeList::ID::GPURenderBundleEncoder as u16,
23911 },
23912 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
23913 _bitfield_align_1: [],
23914 _bitfield_1: __BindgenBitfieldUnit::new(
23915 new_jsjitinfo_bitfield_1!(
23916 JSJitInfo_OpType::Method as u8,
23917 JSJitInfo_AliasSet::AliasEverything as u8,
23918 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
23919 false,
23920 false,
23921 false,
23922 false,
23923 false,
23924 false,
23925 0,
23926 ).to_ne_bytes()
23927 ),
23928});
23929}
23930unsafe extern "C" fn _finalize<D: DomTypes>
23931(_cx: *mut GCContext, obj: *mut JSObject){
23932 wrap_panic(&mut || {
23933
23934 let this = native_from_object_static::<D::GPURenderBundleEncoder>(obj).unwrap();
23935 finalize_common(this);
23936 })
23937}
23938
23939unsafe extern "C" fn _trace<D: DomTypes>
23940(trc: *mut JSTracer, obj: *mut JSObject){
23941 wrap_panic(&mut || {
23942
23943 let this = native_from_object_static::<D::GPURenderBundleEncoder>(obj).unwrap();
23944 if this.is_null() { return; } (*this).trace(trc);
23946 })
23947}
23948
23949
23950static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
23951
23952pub(crate) fn init_class_ops<D: DomTypes>() {
23953 CLASS_OPS.set(JSClassOps {
23954 addProperty: None,
23955 delProperty: None,
23956 enumerate: None,
23957 newEnumerate: None,
23958 resolve: None,
23959 mayResolve: None,
23960 finalize: Some(_finalize::<D>),
23961 call: None,
23962 construct: None,
23963 trace: Some(_trace::<D>),
23964 });
23965}
23966
23967pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
23968
23969pub(crate) fn init_domjs_class<D: DomTypes>() {
23970 init_class_ops::<D>();
23971 Class.set(DOMJSClass {
23972 base: JSClass {
23973 name: c"GPURenderBundleEncoder".as_ptr(),
23974 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
23975 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
23976 ,
23977 cOps: unsafe { CLASS_OPS.get() },
23978 spec: ptr::null(),
23979 ext: ptr::null(),
23980 oOps: ptr::null(),
23981 },
23982 dom_class:
23983DOMClass {
23984 interface_chain: [ PrototypeList::ID::GPURenderBundleEncoder, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
23985 depth: 0,
23986 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
23987 malloc_size_of: malloc_size_of_including_raw_self::<D::GPURenderBundleEncoder> as unsafe fn(&mut _, _) -> _,
23988 global: Globals::EMPTY,
23989},
23990 });
23991}
23992
23993#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
23994(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPURenderBundleEncoder>, _can_gc: CanGc) -> DomRoot<D::GPURenderBundleEncoder>{
23995
23996 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
23997
23998 let scope = scope.reflector().get_jsobject();
23999 assert!(!scope.get().is_null());
24000 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
24001 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
24002
24003 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
24004 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
24005 assert!(!canonical_proto.is_null());
24006
24007
24008 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
24009 if let Some(given) = given_proto {
24010 proto.set(*given);
24011 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
24012 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
24013 }
24014 } else {
24015 proto.set(*canonical_proto);
24016 }
24017 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
24018 cx.raw_cx(),
24019 &Class.get().base,
24020 proto.handle(),
24021 ));
24022 assert!(!obj.is_null());
24023 JS_SetReservedSlot(
24024 obj.get(),
24025 DOM_OBJECT_SLOT,
24026 &PrivateValue(raw.as_ptr() as *const libc::c_void),
24027 );
24028
24029 let root = raw.reflect_with(obj.get());
24030
24031
24032
24033 DomRoot::from_ref(&*root)
24034}
24035
24036pub trait GPURenderBundleEncoderMethods<D: DomTypes> {
24037 fn Finish(&self, r#descriptor: &crate::codegen::GenericBindings::WebGPUBinding::GPURenderBundleDescriptor) -> DomRoot<D::GPURenderBundle>;
24038 fn Label(&self, ) -> USVString;
24039 fn SetLabel(&self, r#value: USVString);
24040 fn SetBindGroup(&self, r#index: u32, r#bindGroup: &D::GPUBindGroup, r#dynamicOffsets: Vec<u32>);
24041 fn SetPipeline(&self, r#pipeline: &D::GPURenderPipeline);
24042 fn SetIndexBuffer(&self, r#buffer: &D::GPUBuffer, r#indexFormat: GPUIndexFormat, r#offset: u64, r#size: u64);
24043 fn SetVertexBuffer(&self, r#slot: u32, r#buffer: &D::GPUBuffer, r#offset: u64, r#size: u64);
24044 fn Draw(&self, r#vertexCount: u32, r#instanceCount: u32, r#firstVertex: u32, r#firstInstance: u32);
24045 fn DrawIndexed(&self, r#indexCount: u32, r#instanceCount: u32, r#firstIndex: u32, r#baseVertex: i32, r#firstInstance: u32);
24046 fn DrawIndirect(&self, r#indirectBuffer: &D::GPUBuffer, r#indirectOffset: u64);
24047 fn DrawIndexedIndirect(&self, r#indirectBuffer: &D::GPUBuffer, r#indirectOffset: u64);
24048}
24049static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
24050
24051pub(crate) fn init_sMethods_specs<D: DomTypes>() {
24052 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
24053 JSFunctionSpec {
24054 name: JSPropertySpec_Name { string_: c"finish".as_ptr() },
24055 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { finish_methodinfo.get() } as *const _ as *const JSJitInfo },
24056 nargs: 0,
24057 flags: (JSPROP_ENUMERATE) as u16,
24058 selfHostedName: ptr::null()
24059 },
24060 JSFunctionSpec {
24061 name: JSPropertySpec_Name { string_: c"setBindGroup".as_ptr() },
24062 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { setBindGroup_methodinfo.get() } as *const _ as *const JSJitInfo },
24063 nargs: 2,
24064 flags: (JSPROP_ENUMERATE) as u16,
24065 selfHostedName: ptr::null()
24066 },
24067 JSFunctionSpec {
24068 name: JSPropertySpec_Name { string_: c"setPipeline".as_ptr() },
24069 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { setPipeline_methodinfo.get() } as *const _ as *const JSJitInfo },
24070 nargs: 1,
24071 flags: (JSPROP_ENUMERATE) as u16,
24072 selfHostedName: ptr::null()
24073 },
24074 JSFunctionSpec {
24075 name: JSPropertySpec_Name { string_: c"setIndexBuffer".as_ptr() },
24076 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { setIndexBuffer_methodinfo.get() } as *const _ as *const JSJitInfo },
24077 nargs: 2,
24078 flags: (JSPROP_ENUMERATE) as u16,
24079 selfHostedName: ptr::null()
24080 },
24081 JSFunctionSpec {
24082 name: JSPropertySpec_Name { string_: c"setVertexBuffer".as_ptr() },
24083 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { setVertexBuffer_methodinfo.get() } as *const _ as *const JSJitInfo },
24084 nargs: 2,
24085 flags: (JSPROP_ENUMERATE) as u16,
24086 selfHostedName: ptr::null()
24087 },
24088 JSFunctionSpec {
24089 name: JSPropertySpec_Name { string_: c"draw".as_ptr() },
24090 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { draw_methodinfo.get() } as *const _ as *const JSJitInfo },
24091 nargs: 1,
24092 flags: (JSPROP_ENUMERATE) as u16,
24093 selfHostedName: ptr::null()
24094 },
24095 JSFunctionSpec {
24096 name: JSPropertySpec_Name { string_: c"drawIndexed".as_ptr() },
24097 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { drawIndexed_methodinfo.get() } as *const _ as *const JSJitInfo },
24098 nargs: 1,
24099 flags: (JSPROP_ENUMERATE) as u16,
24100 selfHostedName: ptr::null()
24101 },
24102 JSFunctionSpec {
24103 name: JSPropertySpec_Name { string_: c"drawIndirect".as_ptr() },
24104 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { drawIndirect_methodinfo.get() } as *const _ as *const JSJitInfo },
24105 nargs: 2,
24106 flags: (JSPROP_ENUMERATE) as u16,
24107 selfHostedName: ptr::null()
24108 },
24109 JSFunctionSpec {
24110 name: JSPropertySpec_Name { string_: c"drawIndexedIndirect".as_ptr() },
24111 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { drawIndexedIndirect_methodinfo.get() } as *const _ as *const JSJitInfo },
24112 nargs: 2,
24113 flags: (JSPROP_ENUMERATE) as u16,
24114 selfHostedName: ptr::null()
24115 },
24116 JSFunctionSpec {
24117 name: JSPropertySpec_Name { string_: ptr::null() },
24118 call: JSNativeWrapper { op: None, info: ptr::null() },
24119 nargs: 0,
24120 flags: 0,
24121 selfHostedName: ptr::null()
24122 }]))[..]
24123])));
24124}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
24125
24126pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
24127 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sMethods_specs.get() })[0])])));
24128}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
24129
24130pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
24131 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
24132 JSPropertySpec {
24133 name: JSPropertySpec_Name { string_: c"label".as_ptr() },
24134 attributes_: (JSPROP_ENUMERATE),
24135 kind_: (JSPropertySpec_Kind::NativeAccessor),
24136 u: JSPropertySpec_AccessorsOrValue {
24137 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
24138 getter: JSPropertySpec_Accessor {
24139 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { label_getterinfo.get() } },
24140 },
24141 setter: JSPropertySpec_Accessor {
24142 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { label_setterinfo.get() } },
24143 }
24144 }
24145 }
24146 }
24147,
24148 JSPropertySpec::ZERO]))[..]
24149,
24150&Box::leak(Box::new([
24151 JSPropertySpec {
24152 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
24153 attributes_: (JSPROP_READONLY),
24154 kind_: (JSPropertySpec_Kind::Value),
24155 u: JSPropertySpec_AccessorsOrValue {
24156 value: JSPropertySpec_ValueWrapper {
24157 type_: JSPropertySpec_ValueWrapper_Type::String,
24158 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
24159 string: c"GPURenderBundleEncoder".as_ptr(),
24160 }
24161 }
24162 }
24163 }
24164,
24165 JSPropertySpec::ZERO]))[..]
24166])));
24167}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
24168
24169pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
24170 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
24171 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
24172}
24173pub fn GetProtoObject<D: DomTypes>
24174(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
24175 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPURenderBundleEncoder), CreateInterfaceObjects::<D>, rval)
24177}
24178
24179
24180static PrototypeClass: JSClass = JSClass {
24181 name: c"GPURenderBundleEncoderPrototype".as_ptr(),
24182 flags:
24183 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
24185 cOps: ptr::null(),
24186 spec: ptr::null(),
24187 ext: ptr::null(),
24188 oOps: ptr::null(),
24189};
24190
24191
24192static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
24193
24194pub(crate) fn init_interface_object<D: DomTypes>() {
24195 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
24196 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
24197 b"function GPURenderBundleEncoder() {\n [native code]\n}",
24198 PrototypeList::ID::GPURenderBundleEncoder,
24199 0,
24200 ));
24201}
24202
24203pub fn DefineDOMInterface<D: DomTypes>
24204(cx: SafeJSContext, global: HandleObject){
24205 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPURenderBundleEncoder),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
24206}
24207
24208pub fn ConstructorEnabled<D: DomTypes>
24209(aCx: SafeJSContext, aObj: HandleObject) -> bool{
24210 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
24211 pref!(dom_webgpu_enabled)
24212}
24213
24214unsafe fn CreateInterfaceObjects<D: DomTypes>
24215(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
24216
24217 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
24218 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
24219 assert!(!prototype_proto.is_null());
24220
24221 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
24222 create_interface_prototype_object::<D>(cx,
24223 global,
24224 prototype_proto.handle(),
24225 &PrototypeClass,
24226 sMethods.get(),
24227 sAttributes.get(),
24228 &[],
24229 &[],
24230 prototype.handle_mut());
24231 assert!(!prototype.is_null());
24232 assert!((*cache)[PrototypeList::ID::GPURenderBundleEncoder as usize].is_null());
24233 (*cache)[PrototypeList::ID::GPURenderBundleEncoder as usize] = prototype.get();
24234 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPURenderBundleEncoder as isize),
24235 ptr::null_mut(),
24236 prototype.get());
24237
24238 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
24239 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
24240
24241 assert!(!interface_proto.is_null());
24242
24243 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
24244 create_noncallback_interface_object::<D>(cx,
24245 global,
24246 interface_proto.handle(),
24247 INTERFACE_OBJECT_CLASS.get(),
24248 &[],
24249 &[],
24250 &[],
24251 prototype.handle(),
24252 c"GPURenderBundleEncoder",
24253 0,
24254 &[],
24255 interface.handle_mut());
24256 assert!(!interface.is_null());
24257}
24258
24259
24260 pub(crate) fn init_statics<D: DomTypes>() {
24261 init_interface_object::<D>();
24262 init_domjs_class::<D>();
24263 crate::codegen::GenericBindings::WebGPUBinding::GPURenderBundleEncoder_Binding::init_finish_methodinfo::<D>();
24264crate::codegen::GenericBindings::WebGPUBinding::GPURenderBundleEncoder_Binding::init_setBindGroup_methodinfo::<D>();
24265crate::codegen::GenericBindings::WebGPUBinding::GPURenderBundleEncoder_Binding::init_setPipeline_methodinfo::<D>();
24266crate::codegen::GenericBindings::WebGPUBinding::GPURenderBundleEncoder_Binding::init_setIndexBuffer_methodinfo::<D>();
24267crate::codegen::GenericBindings::WebGPUBinding::GPURenderBundleEncoder_Binding::init_setVertexBuffer_methodinfo::<D>();
24268crate::codegen::GenericBindings::WebGPUBinding::GPURenderBundleEncoder_Binding::init_draw_methodinfo::<D>();
24269crate::codegen::GenericBindings::WebGPUBinding::GPURenderBundleEncoder_Binding::init_drawIndexed_methodinfo::<D>();
24270crate::codegen::GenericBindings::WebGPUBinding::GPURenderBundleEncoder_Binding::init_drawIndirect_methodinfo::<D>();
24271crate::codegen::GenericBindings::WebGPUBinding::GPURenderBundleEncoder_Binding::init_drawIndexedIndirect_methodinfo::<D>();
24272 init_label_getterinfo::<D>();
24273 init_label_setterinfo::<D>();
24274
24275 init_sMethods_specs::<D>();
24276init_sMethods_prefs::<D>();
24277init_sAttributes_specs::<D>();
24278init_sAttributes_prefs::<D>();
24279 }
24280 } pub use self::GPURenderPassEncoder_Binding::{Wrap as GPURenderPassEncoderWrap, GPURenderPassEncoderMethods, GetProtoObject as GPURenderPassEncoderGetProtoObject, DefineDOMInterface as GPURenderPassEncoderDefineDOMInterface};
24284pub mod GPURenderPassEncoder_Binding {
24285use crate::codegen::GenericBindings::WebGPUBinding::GPUColorDict;
24286use crate::codegen::GenericBindings::WebGPUBinding::GPUIndexFormat;
24287use crate::codegen::GenericBindings::WebGPUBinding::GPUIndexFormatValues;
24288use crate::import::module::*;
24289
24290unsafe extern "C" fn setViewport<D: DomTypes>
24291(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
24292 let mut result = false;
24293 wrap_panic(&mut || result = (|| {
24294 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
24295 let this = &*(this as *const D::GPURenderPassEncoder);
24296 let args = &*args;
24297 let argc = args.argc_;
24298
24299 if argc < 6 {
24300 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPURenderPassEncoder.setViewport\".");
24301 return false;
24302 }
24303 let arg0: Finite<f32> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
24304 Ok(ConversionResult::Success(value)) => value,
24305 Ok(ConversionResult::Failure(error)) => {
24306 throw_type_error(cx.raw_cx(), &error);
24307 return false;
24308
24309 }
24310 _ => {
24311 return false;
24312
24313 },
24314 }
24315 ;
24316 let arg1: Finite<f32> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
24317 Ok(ConversionResult::Success(value)) => value,
24318 Ok(ConversionResult::Failure(error)) => {
24319 throw_type_error(cx.raw_cx(), &error);
24320 return false;
24321
24322 }
24323 _ => {
24324 return false;
24325
24326 },
24327 }
24328 ;
24329 let arg2: Finite<f32> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ()) {
24330 Ok(ConversionResult::Success(value)) => value,
24331 Ok(ConversionResult::Failure(error)) => {
24332 throw_type_error(cx.raw_cx(), &error);
24333 return false;
24334
24335 }
24336 _ => {
24337 return false;
24338
24339 },
24340 }
24341 ;
24342 let arg3: Finite<f32> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(3)), ()) {
24343 Ok(ConversionResult::Success(value)) => value,
24344 Ok(ConversionResult::Failure(error)) => {
24345 throw_type_error(cx.raw_cx(), &error);
24346 return false;
24347
24348 }
24349 _ => {
24350 return false;
24351
24352 },
24353 }
24354 ;
24355 let arg4: Finite<f32> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(4)), ()) {
24356 Ok(ConversionResult::Success(value)) => value,
24357 Ok(ConversionResult::Failure(error)) => {
24358 throw_type_error(cx.raw_cx(), &error);
24359 return false;
24360
24361 }
24362 _ => {
24363 return false;
24364
24365 },
24366 }
24367 ;
24368 let arg5: Finite<f32> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(5)), ()) {
24369 Ok(ConversionResult::Success(value)) => value,
24370 Ok(ConversionResult::Failure(error)) => {
24371 throw_type_error(cx.raw_cx(), &error);
24372 return false;
24373
24374 }
24375 _ => {
24376 return false;
24377
24378 },
24379 }
24380 ;
24381 let result: () = this.SetViewport(arg0, arg1, arg2, arg3, arg4, arg5);
24382
24383 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
24384 return true;
24385 })());
24386 result
24387}
24388
24389
24390static setViewport_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
24391
24392pub(crate) fn init_setViewport_methodinfo<D: DomTypes>() {
24393 setViewport_methodinfo.set(JSJitInfo {
24394 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
24395 method: Some(setViewport::<D>)
24396 },
24397 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
24398 protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
24399 },
24400 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
24401 _bitfield_align_1: [],
24402 _bitfield_1: __BindgenBitfieldUnit::new(
24403 new_jsjitinfo_bitfield_1!(
24404 JSJitInfo_OpType::Method as u8,
24405 JSJitInfo_AliasSet::AliasEverything as u8,
24406 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
24407 false,
24408 false,
24409 false,
24410 false,
24411 false,
24412 false,
24413 0,
24414 ).to_ne_bytes()
24415 ),
24416});
24417}
24418unsafe extern "C" fn setScissorRect<D: DomTypes>
24419(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
24420 let mut result = false;
24421 wrap_panic(&mut || result = (|| {
24422 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
24423 let this = &*(this as *const D::GPURenderPassEncoder);
24424 let args = &*args;
24425 let argc = args.argc_;
24426
24427 if argc < 4 {
24428 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPURenderPassEncoder.setScissorRect\".");
24429 return false;
24430 }
24431 let arg0: u32 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
24432 Ok(ConversionResult::Success(value)) => value,
24433 Ok(ConversionResult::Failure(error)) => {
24434 throw_type_error(cx.raw_cx(), &error);
24435 return false;
24436
24437 }
24438 _ => {
24439 return false;
24440
24441 },
24442 }
24443 ;
24444 let arg1: u32 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
24445 Ok(ConversionResult::Success(value)) => value,
24446 Ok(ConversionResult::Failure(error)) => {
24447 throw_type_error(cx.raw_cx(), &error);
24448 return false;
24449
24450 }
24451 _ => {
24452 return false;
24453
24454 },
24455 }
24456 ;
24457 let arg2: u32 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
24458 Ok(ConversionResult::Success(value)) => value,
24459 Ok(ConversionResult::Failure(error)) => {
24460 throw_type_error(cx.raw_cx(), &error);
24461 return false;
24462
24463 }
24464 _ => {
24465 return false;
24466
24467 },
24468 }
24469 ;
24470 let arg3: u32 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(3)), ConversionBehavior::EnforceRange) {
24471 Ok(ConversionResult::Success(value)) => value,
24472 Ok(ConversionResult::Failure(error)) => {
24473 throw_type_error(cx.raw_cx(), &error);
24474 return false;
24475
24476 }
24477 _ => {
24478 return false;
24479
24480 },
24481 }
24482 ;
24483 let result: () = this.SetScissorRect(arg0, arg1, arg2, arg3);
24484
24485 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
24486 return true;
24487 })());
24488 result
24489}
24490
24491
24492static setScissorRect_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
24493
24494pub(crate) fn init_setScissorRect_methodinfo<D: DomTypes>() {
24495 setScissorRect_methodinfo.set(JSJitInfo {
24496 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
24497 method: Some(setScissorRect::<D>)
24498 },
24499 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
24500 protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
24501 },
24502 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
24503 _bitfield_align_1: [],
24504 _bitfield_1: __BindgenBitfieldUnit::new(
24505 new_jsjitinfo_bitfield_1!(
24506 JSJitInfo_OpType::Method as u8,
24507 JSJitInfo_AliasSet::AliasEverything as u8,
24508 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
24509 false,
24510 false,
24511 false,
24512 false,
24513 false,
24514 false,
24515 0,
24516 ).to_ne_bytes()
24517 ),
24518});
24519}
24520unsafe extern "C" fn setBlendConstant<D: DomTypes>
24521(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
24522 let mut result = false;
24523 wrap_panic(&mut || result = (|| {
24524 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
24525 let this = &*(this as *const D::GPURenderPassEncoder);
24526 let args = &*args;
24527 let argc = args.argc_;
24528
24529 if argc < 1 {
24530 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPURenderPassEncoder.setBlendConstant\".");
24531 return false;
24532 }
24533 let arg0: GenericUnionTypes::DoubleSequenceOrGPUColorDict = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
24534 Ok(ConversionResult::Success(value)) => value,
24535 Ok(ConversionResult::Failure(error)) => {
24536 throw_type_error(cx.raw_cx(), &error);
24537 return false;
24538
24539 }
24540 _ => {
24541 return false;
24542
24543 },
24544 }
24545 ;
24546 let result: Result<(), Error> = this.SetBlendConstant(arg0);
24547 let result = match result {
24548 Ok(result) => result,
24549 Err(e) => {
24550 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
24551 return false;
24552 },
24553 };
24554
24555 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
24556 return true;
24557 })());
24558 result
24559}
24560
24561
24562static setBlendConstant_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
24563
24564pub(crate) fn init_setBlendConstant_methodinfo<D: DomTypes>() {
24565 setBlendConstant_methodinfo.set(JSJitInfo {
24566 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
24567 method: Some(setBlendConstant::<D>)
24568 },
24569 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
24570 protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
24571 },
24572 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
24573 _bitfield_align_1: [],
24574 _bitfield_1: __BindgenBitfieldUnit::new(
24575 new_jsjitinfo_bitfield_1!(
24576 JSJitInfo_OpType::Method as u8,
24577 JSJitInfo_AliasSet::AliasEverything as u8,
24578 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
24579 false,
24580 false,
24581 false,
24582 false,
24583 false,
24584 false,
24585 0,
24586 ).to_ne_bytes()
24587 ),
24588});
24589}
24590unsafe extern "C" fn setStencilReference<D: DomTypes>
24591(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
24592 let mut result = false;
24593 wrap_panic(&mut || result = (|| {
24594 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
24595 let this = &*(this as *const D::GPURenderPassEncoder);
24596 let args = &*args;
24597 let argc = args.argc_;
24598
24599 if argc < 1 {
24600 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPURenderPassEncoder.setStencilReference\".");
24601 return false;
24602 }
24603 let arg0: u32 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
24604 Ok(ConversionResult::Success(value)) => value,
24605 Ok(ConversionResult::Failure(error)) => {
24606 throw_type_error(cx.raw_cx(), &error);
24607 return false;
24608
24609 }
24610 _ => {
24611 return false;
24612
24613 },
24614 }
24615 ;
24616 let result: () = this.SetStencilReference(arg0);
24617
24618 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
24619 return true;
24620 })());
24621 result
24622}
24623
24624
24625static setStencilReference_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
24626
24627pub(crate) fn init_setStencilReference_methodinfo<D: DomTypes>() {
24628 setStencilReference_methodinfo.set(JSJitInfo {
24629 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
24630 method: Some(setStencilReference::<D>)
24631 },
24632 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
24633 protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
24634 },
24635 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
24636 _bitfield_align_1: [],
24637 _bitfield_1: __BindgenBitfieldUnit::new(
24638 new_jsjitinfo_bitfield_1!(
24639 JSJitInfo_OpType::Method as u8,
24640 JSJitInfo_AliasSet::AliasEverything as u8,
24641 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
24642 false,
24643 false,
24644 false,
24645 false,
24646 false,
24647 false,
24648 0,
24649 ).to_ne_bytes()
24650 ),
24651});
24652}
24653unsafe extern "C" fn executeBundles<D: DomTypes>
24654(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
24655 let mut result = false;
24656 wrap_panic(&mut || result = (|| {
24657 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
24658 let this = &*(this as *const D::GPURenderPassEncoder);
24659 let args = &*args;
24660 let argc = args.argc_;
24661
24662 if argc < 1 {
24663 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPURenderPassEncoder.executeBundles\".");
24664 return false;
24665 }
24666 let arg0: Vec<DomRoot<D::GPURenderBundle>> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
24667 Ok(ConversionResult::Success(value)) => value,
24668 Ok(ConversionResult::Failure(error)) => {
24669 throw_type_error(cx.raw_cx(), &error);
24670 return false;
24671
24672 }
24673 _ => {
24674 return false;
24675
24676 },
24677 }
24678 ;
24679 let result: () = this.ExecuteBundles(arg0);
24680
24681 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
24682 return true;
24683 })());
24684 result
24685}
24686
24687
24688static executeBundles_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
24689
24690pub(crate) fn init_executeBundles_methodinfo<D: DomTypes>() {
24691 executeBundles_methodinfo.set(JSJitInfo {
24692 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
24693 method: Some(executeBundles::<D>)
24694 },
24695 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
24696 protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
24697 },
24698 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
24699 _bitfield_align_1: [],
24700 _bitfield_1: __BindgenBitfieldUnit::new(
24701 new_jsjitinfo_bitfield_1!(
24702 JSJitInfo_OpType::Method as u8,
24703 JSJitInfo_AliasSet::AliasEverything as u8,
24704 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
24705 false,
24706 false,
24707 false,
24708 false,
24709 false,
24710 false,
24711 0,
24712 ).to_ne_bytes()
24713 ),
24714});
24715}
24716unsafe extern "C" fn end<D: DomTypes>
24717(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
24718 let mut result = false;
24719 wrap_panic(&mut || result = (|| {
24720 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
24721 let this = &*(this as *const D::GPURenderPassEncoder);
24722 let args = &*args;
24723 let argc = args.argc_;
24724 let result: () = this.End();
24725
24726 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
24727 return true;
24728 })());
24729 result
24730}
24731
24732
24733static end_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
24734
24735pub(crate) fn init_end_methodinfo<D: DomTypes>() {
24736 end_methodinfo.set(JSJitInfo {
24737 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
24738 method: Some(end::<D>)
24739 },
24740 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
24741 protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
24742 },
24743 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
24744 _bitfield_align_1: [],
24745 _bitfield_1: __BindgenBitfieldUnit::new(
24746 new_jsjitinfo_bitfield_1!(
24747 JSJitInfo_OpType::Method as u8,
24748 JSJitInfo_AliasSet::AliasEverything as u8,
24749 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
24750 true,
24751 false,
24752 false,
24753 false,
24754 false,
24755 false,
24756 0,
24757 ).to_ne_bytes()
24758 ),
24759});
24760}
24761unsafe extern "C" fn get_label<D: DomTypes>
24762(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
24763 let mut result = false;
24764 wrap_panic(&mut || result = (|| {
24765 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
24766 let this = &*(this as *const D::GPURenderPassEncoder);
24767 let result: USVString = this.Label();
24768
24769 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
24770 return true;
24771 })());
24772 result
24773}
24774
24775unsafe extern "C" fn set_label<D: DomTypes>
24776(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
24777 let mut result = false;
24778 wrap_panic(&mut || result = (|| {
24779 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
24780 let this = &*(this as *const D::GPURenderPassEncoder);
24781 let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
24782 Ok(ConversionResult::Success(value)) => value,
24783 Ok(ConversionResult::Failure(error)) => {
24784 throw_type_error(cx.raw_cx(), &error);
24785 return false;
24786
24787 }
24788 _ => {
24789 return false;
24790
24791 },
24792 }
24793 ;
24794 let result: () = this.SetLabel(arg0);
24795
24796 true
24797 })());
24798 result
24799}
24800
24801
24802static label_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
24803
24804pub(crate) fn init_label_getterinfo<D: DomTypes>() {
24805 label_getterinfo.set(JSJitInfo {
24806 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
24807 getter: Some(get_label::<D>)
24808 },
24809 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
24810 protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
24811 },
24812 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
24813 _bitfield_align_1: [],
24814 _bitfield_1: __BindgenBitfieldUnit::new(
24815 new_jsjitinfo_bitfield_1!(
24816 JSJitInfo_OpType::Getter as u8,
24817 JSJitInfo_AliasSet::AliasEverything as u8,
24818 JSValueType::JSVAL_TYPE_STRING as u8,
24819 true,
24820 false,
24821 false,
24822 false,
24823 false,
24824 false,
24825 0,
24826 ).to_ne_bytes()
24827 ),
24828});
24829}
24830static label_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
24831
24832pub(crate) fn init_label_setterinfo<D: DomTypes>() {
24833 label_setterinfo.set(JSJitInfo {
24834 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
24835 setter: Some(set_label::<D>)
24836 },
24837 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
24838 protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
24839 },
24840 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
24841 _bitfield_align_1: [],
24842 _bitfield_1: __BindgenBitfieldUnit::new(
24843 new_jsjitinfo_bitfield_1!(
24844 JSJitInfo_OpType::Setter as u8,
24845 JSJitInfo_AliasSet::AliasEverything as u8,
24846 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
24847 false,
24848 false,
24849 false,
24850 false,
24851 false,
24852 false,
24853 0,
24854 ).to_ne_bytes()
24855 ),
24856});
24857}
24858unsafe extern "C" fn setBindGroup<D: DomTypes>
24859(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
24860 let mut result = false;
24861 wrap_panic(&mut || result = (|| {
24862 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
24863 let this = &*(this as *const D::GPURenderPassEncoder);
24864 let args = &*args;
24865 let argc = args.argc_;
24866
24867 if argc < 2 {
24868 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPURenderPassEncoder.setBindGroup\".");
24869 return false;
24870 }
24871 let arg0: u32 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
24872 Ok(ConversionResult::Success(value)) => value,
24873 Ok(ConversionResult::Failure(error)) => {
24874 throw_type_error(cx.raw_cx(), &error);
24875 return false;
24876
24877 }
24878 _ => {
24879 return false;
24880
24881 },
24882 }
24883 ;
24884 let arg1: DomRoot<D::GPUBindGroup> = if HandleValue::from_raw(args.get(1)).get().is_object() {
24885 match root_from_handlevalue(HandleValue::from_raw(args.get(1)), SafeJSContext::from_ptr(cx.raw_cx())) {
24886 Ok(val) => val,
24887 Err(()) => {
24888 throw_type_error(cx.raw_cx(), "value does not implement interface GPUBindGroup.");
24889 return false;
24890
24891 }
24892 }
24893
24894 } else {
24895 throw_type_error(cx.raw_cx(), "Value is not an object.");
24896 return false;
24897
24898 };
24899 let arg2: Vec<u32> = if args.get(2).is_undefined() {
24900 Vec::new()
24901 } else {
24902 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
24903 Ok(ConversionResult::Success(value)) => value,
24904 Ok(ConversionResult::Failure(error)) => {
24905 throw_type_error(cx.raw_cx(), &error);
24906 return false;
24907
24908 }
24909 _ => {
24910 return false;
24911
24912 },
24913 }
24914
24915 };
24916 let result: () = this.SetBindGroup(arg0, &arg1, arg2);
24917
24918 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
24919 return true;
24920 })());
24921 result
24922}
24923
24924
24925static setBindGroup_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
24926
24927pub(crate) fn init_setBindGroup_methodinfo<D: DomTypes>() {
24928 setBindGroup_methodinfo.set(JSJitInfo {
24929 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
24930 method: Some(setBindGroup::<D>)
24931 },
24932 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
24933 protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
24934 },
24935 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
24936 _bitfield_align_1: [],
24937 _bitfield_1: __BindgenBitfieldUnit::new(
24938 new_jsjitinfo_bitfield_1!(
24939 JSJitInfo_OpType::Method as u8,
24940 JSJitInfo_AliasSet::AliasEverything as u8,
24941 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
24942 false,
24943 false,
24944 false,
24945 false,
24946 false,
24947 false,
24948 0,
24949 ).to_ne_bytes()
24950 ),
24951});
24952}
24953unsafe extern "C" fn setPipeline<D: DomTypes>
24954(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
24955 let mut result = false;
24956 wrap_panic(&mut || result = (|| {
24957 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
24958 let this = &*(this as *const D::GPURenderPassEncoder);
24959 let args = &*args;
24960 let argc = args.argc_;
24961
24962 if argc < 1 {
24963 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPURenderPassEncoder.setPipeline\".");
24964 return false;
24965 }
24966 let arg0: DomRoot<D::GPURenderPipeline> = if HandleValue::from_raw(args.get(0)).get().is_object() {
24967 match root_from_handlevalue(HandleValue::from_raw(args.get(0)), SafeJSContext::from_ptr(cx.raw_cx())) {
24968 Ok(val) => val,
24969 Err(()) => {
24970 throw_type_error(cx.raw_cx(), "value does not implement interface GPURenderPipeline.");
24971 return false;
24972
24973 }
24974 }
24975
24976 } else {
24977 throw_type_error(cx.raw_cx(), "Value is not an object.");
24978 return false;
24979
24980 };
24981 let result: () = this.SetPipeline(&arg0);
24982
24983 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
24984 return true;
24985 })());
24986 result
24987}
24988
24989
24990static setPipeline_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
24991
24992pub(crate) fn init_setPipeline_methodinfo<D: DomTypes>() {
24993 setPipeline_methodinfo.set(JSJitInfo {
24994 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
24995 method: Some(setPipeline::<D>)
24996 },
24997 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
24998 protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
24999 },
25000 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
25001 _bitfield_align_1: [],
25002 _bitfield_1: __BindgenBitfieldUnit::new(
25003 new_jsjitinfo_bitfield_1!(
25004 JSJitInfo_OpType::Method as u8,
25005 JSJitInfo_AliasSet::AliasEverything as u8,
25006 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
25007 false,
25008 false,
25009 false,
25010 false,
25011 false,
25012 false,
25013 0,
25014 ).to_ne_bytes()
25015 ),
25016});
25017}
25018unsafe extern "C" fn setIndexBuffer<D: DomTypes>
25019(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
25020 let mut result = false;
25021 wrap_panic(&mut || result = (|| {
25022 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
25023 let this = &*(this as *const D::GPURenderPassEncoder);
25024 let args = &*args;
25025 let argc = args.argc_;
25026
25027 if argc < 2 {
25028 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPURenderPassEncoder.setIndexBuffer\".");
25029 return false;
25030 }
25031 let arg0: DomRoot<D::GPUBuffer> = if HandleValue::from_raw(args.get(0)).get().is_object() {
25032 match root_from_handlevalue(HandleValue::from_raw(args.get(0)), SafeJSContext::from_ptr(cx.raw_cx())) {
25033 Ok(val) => val,
25034 Err(()) => {
25035 throw_type_error(cx.raw_cx(), "value does not implement interface GPUBuffer.");
25036 return false;
25037
25038 }
25039 }
25040
25041 } else {
25042 throw_type_error(cx.raw_cx(), "Value is not an object.");
25043 return false;
25044
25045 };
25046 let arg1: GPUIndexFormat = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
25047 Ok(ConversionResult::Success(value)) => value,
25048 Ok(ConversionResult::Failure(error)) => {
25049 throw_type_error(cx.raw_cx(), &error); return false;
25050
25051 }
25052 _ => {
25053 return false;
25054
25055 },
25056 }
25057 ;
25058 let arg2: u64 = if args.get(2).is_undefined() {
25059 0
25060 } else {
25061 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
25062 Ok(ConversionResult::Success(value)) => value,
25063 Ok(ConversionResult::Failure(error)) => {
25064 throw_type_error(cx.raw_cx(), &error);
25065 return false;
25066
25067 }
25068 _ => {
25069 return false;
25070
25071 },
25072 }
25073
25074 };
25075 let arg3: u64 = if args.get(3).is_undefined() {
25076 0
25077 } else {
25078 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(3)), ConversionBehavior::EnforceRange) {
25079 Ok(ConversionResult::Success(value)) => value,
25080 Ok(ConversionResult::Failure(error)) => {
25081 throw_type_error(cx.raw_cx(), &error);
25082 return false;
25083
25084 }
25085 _ => {
25086 return false;
25087
25088 },
25089 }
25090
25091 };
25092 let result: () = this.SetIndexBuffer(&arg0, arg1, arg2, arg3);
25093
25094 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
25095 return true;
25096 })());
25097 result
25098}
25099
25100
25101static setIndexBuffer_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
25102
25103pub(crate) fn init_setIndexBuffer_methodinfo<D: DomTypes>() {
25104 setIndexBuffer_methodinfo.set(JSJitInfo {
25105 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
25106 method: Some(setIndexBuffer::<D>)
25107 },
25108 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
25109 protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
25110 },
25111 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
25112 _bitfield_align_1: [],
25113 _bitfield_1: __BindgenBitfieldUnit::new(
25114 new_jsjitinfo_bitfield_1!(
25115 JSJitInfo_OpType::Method as u8,
25116 JSJitInfo_AliasSet::AliasEverything as u8,
25117 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
25118 false,
25119 false,
25120 false,
25121 false,
25122 false,
25123 false,
25124 0,
25125 ).to_ne_bytes()
25126 ),
25127});
25128}
25129unsafe extern "C" fn setVertexBuffer<D: DomTypes>
25130(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
25131 let mut result = false;
25132 wrap_panic(&mut || result = (|| {
25133 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
25134 let this = &*(this as *const D::GPURenderPassEncoder);
25135 let args = &*args;
25136 let argc = args.argc_;
25137
25138 if argc < 2 {
25139 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPURenderPassEncoder.setVertexBuffer\".");
25140 return false;
25141 }
25142 let arg0: u32 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
25143 Ok(ConversionResult::Success(value)) => value,
25144 Ok(ConversionResult::Failure(error)) => {
25145 throw_type_error(cx.raw_cx(), &error);
25146 return false;
25147
25148 }
25149 _ => {
25150 return false;
25151
25152 },
25153 }
25154 ;
25155 let arg1: DomRoot<D::GPUBuffer> = if HandleValue::from_raw(args.get(1)).get().is_object() {
25156 match root_from_handlevalue(HandleValue::from_raw(args.get(1)), SafeJSContext::from_ptr(cx.raw_cx())) {
25157 Ok(val) => val,
25158 Err(()) => {
25159 throw_type_error(cx.raw_cx(), "value does not implement interface GPUBuffer.");
25160 return false;
25161
25162 }
25163 }
25164
25165 } else {
25166 throw_type_error(cx.raw_cx(), "Value is not an object.");
25167 return false;
25168
25169 };
25170 let arg2: u64 = if args.get(2).is_undefined() {
25171 0
25172 } else {
25173 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
25174 Ok(ConversionResult::Success(value)) => value,
25175 Ok(ConversionResult::Failure(error)) => {
25176 throw_type_error(cx.raw_cx(), &error);
25177 return false;
25178
25179 }
25180 _ => {
25181 return false;
25182
25183 },
25184 }
25185
25186 };
25187 let arg3: u64 = if args.get(3).is_undefined() {
25188 0
25189 } else {
25190 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(3)), ConversionBehavior::EnforceRange) {
25191 Ok(ConversionResult::Success(value)) => value,
25192 Ok(ConversionResult::Failure(error)) => {
25193 throw_type_error(cx.raw_cx(), &error);
25194 return false;
25195
25196 }
25197 _ => {
25198 return false;
25199
25200 },
25201 }
25202
25203 };
25204 let result: () = this.SetVertexBuffer(arg0, &arg1, arg2, arg3);
25205
25206 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
25207 return true;
25208 })());
25209 result
25210}
25211
25212
25213static setVertexBuffer_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
25214
25215pub(crate) fn init_setVertexBuffer_methodinfo<D: DomTypes>() {
25216 setVertexBuffer_methodinfo.set(JSJitInfo {
25217 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
25218 method: Some(setVertexBuffer::<D>)
25219 },
25220 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
25221 protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
25222 },
25223 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
25224 _bitfield_align_1: [],
25225 _bitfield_1: __BindgenBitfieldUnit::new(
25226 new_jsjitinfo_bitfield_1!(
25227 JSJitInfo_OpType::Method as u8,
25228 JSJitInfo_AliasSet::AliasEverything as u8,
25229 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
25230 false,
25231 false,
25232 false,
25233 false,
25234 false,
25235 false,
25236 0,
25237 ).to_ne_bytes()
25238 ),
25239});
25240}
25241unsafe extern "C" fn draw<D: DomTypes>
25242(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
25243 let mut result = false;
25244 wrap_panic(&mut || result = (|| {
25245 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
25246 let this = &*(this as *const D::GPURenderPassEncoder);
25247 let args = &*args;
25248 let argc = args.argc_;
25249
25250 if argc < 1 {
25251 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPURenderPassEncoder.draw\".");
25252 return false;
25253 }
25254 let arg0: u32 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
25255 Ok(ConversionResult::Success(value)) => value,
25256 Ok(ConversionResult::Failure(error)) => {
25257 throw_type_error(cx.raw_cx(), &error);
25258 return false;
25259
25260 }
25261 _ => {
25262 return false;
25263
25264 },
25265 }
25266 ;
25267 let arg1: u32 = if args.get(1).is_undefined() {
25268 1
25269 } else {
25270 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
25271 Ok(ConversionResult::Success(value)) => value,
25272 Ok(ConversionResult::Failure(error)) => {
25273 throw_type_error(cx.raw_cx(), &error);
25274 return false;
25275
25276 }
25277 _ => {
25278 return false;
25279
25280 },
25281 }
25282
25283 };
25284 let arg2: u32 = if args.get(2).is_undefined() {
25285 0
25286 } else {
25287 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
25288 Ok(ConversionResult::Success(value)) => value,
25289 Ok(ConversionResult::Failure(error)) => {
25290 throw_type_error(cx.raw_cx(), &error);
25291 return false;
25292
25293 }
25294 _ => {
25295 return false;
25296
25297 },
25298 }
25299
25300 };
25301 let arg3: u32 = if args.get(3).is_undefined() {
25302 0
25303 } else {
25304 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(3)), ConversionBehavior::EnforceRange) {
25305 Ok(ConversionResult::Success(value)) => value,
25306 Ok(ConversionResult::Failure(error)) => {
25307 throw_type_error(cx.raw_cx(), &error);
25308 return false;
25309
25310 }
25311 _ => {
25312 return false;
25313
25314 },
25315 }
25316
25317 };
25318 let result: () = this.Draw(arg0, arg1, arg2, arg3);
25319
25320 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
25321 return true;
25322 })());
25323 result
25324}
25325
25326
25327static draw_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
25328
25329pub(crate) fn init_draw_methodinfo<D: DomTypes>() {
25330 draw_methodinfo.set(JSJitInfo {
25331 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
25332 method: Some(draw::<D>)
25333 },
25334 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
25335 protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
25336 },
25337 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
25338 _bitfield_align_1: [],
25339 _bitfield_1: __BindgenBitfieldUnit::new(
25340 new_jsjitinfo_bitfield_1!(
25341 JSJitInfo_OpType::Method as u8,
25342 JSJitInfo_AliasSet::AliasEverything as u8,
25343 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
25344 false,
25345 false,
25346 false,
25347 false,
25348 false,
25349 false,
25350 0,
25351 ).to_ne_bytes()
25352 ),
25353});
25354}
25355unsafe extern "C" fn drawIndexed<D: DomTypes>
25356(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
25357 let mut result = false;
25358 wrap_panic(&mut || result = (|| {
25359 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
25360 let this = &*(this as *const D::GPURenderPassEncoder);
25361 let args = &*args;
25362 let argc = args.argc_;
25363
25364 if argc < 1 {
25365 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPURenderPassEncoder.drawIndexed\".");
25366 return false;
25367 }
25368 let arg0: u32 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ConversionBehavior::EnforceRange) {
25369 Ok(ConversionResult::Success(value)) => value,
25370 Ok(ConversionResult::Failure(error)) => {
25371 throw_type_error(cx.raw_cx(), &error);
25372 return false;
25373
25374 }
25375 _ => {
25376 return false;
25377
25378 },
25379 }
25380 ;
25381 let arg1: u32 = if args.get(1).is_undefined() {
25382 1
25383 } else {
25384 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
25385 Ok(ConversionResult::Success(value)) => value,
25386 Ok(ConversionResult::Failure(error)) => {
25387 throw_type_error(cx.raw_cx(), &error);
25388 return false;
25389
25390 }
25391 _ => {
25392 return false;
25393
25394 },
25395 }
25396
25397 };
25398 let arg2: u32 = if args.get(2).is_undefined() {
25399 0
25400 } else {
25401 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(2)), ConversionBehavior::EnforceRange) {
25402 Ok(ConversionResult::Success(value)) => value,
25403 Ok(ConversionResult::Failure(error)) => {
25404 throw_type_error(cx.raw_cx(), &error);
25405 return false;
25406
25407 }
25408 _ => {
25409 return false;
25410
25411 },
25412 }
25413
25414 };
25415 let arg3: i32 = if args.get(3).is_undefined() {
25416 0
25417 } else {
25418 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(3)), ConversionBehavior::EnforceRange) {
25419 Ok(ConversionResult::Success(value)) => value,
25420 Ok(ConversionResult::Failure(error)) => {
25421 throw_type_error(cx.raw_cx(), &error);
25422 return false;
25423
25424 }
25425 _ => {
25426 return false;
25427
25428 },
25429 }
25430
25431 };
25432 let arg4: u32 = if args.get(4).is_undefined() {
25433 0
25434 } else {
25435 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(4)), ConversionBehavior::EnforceRange) {
25436 Ok(ConversionResult::Success(value)) => value,
25437 Ok(ConversionResult::Failure(error)) => {
25438 throw_type_error(cx.raw_cx(), &error);
25439 return false;
25440
25441 }
25442 _ => {
25443 return false;
25444
25445 },
25446 }
25447
25448 };
25449 let result: () = this.DrawIndexed(arg0, arg1, arg2, arg3, arg4);
25450
25451 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
25452 return true;
25453 })());
25454 result
25455}
25456
25457
25458static drawIndexed_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
25459
25460pub(crate) fn init_drawIndexed_methodinfo<D: DomTypes>() {
25461 drawIndexed_methodinfo.set(JSJitInfo {
25462 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
25463 method: Some(drawIndexed::<D>)
25464 },
25465 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
25466 protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
25467 },
25468 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
25469 _bitfield_align_1: [],
25470 _bitfield_1: __BindgenBitfieldUnit::new(
25471 new_jsjitinfo_bitfield_1!(
25472 JSJitInfo_OpType::Method as u8,
25473 JSJitInfo_AliasSet::AliasEverything as u8,
25474 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
25475 false,
25476 false,
25477 false,
25478 false,
25479 false,
25480 false,
25481 0,
25482 ).to_ne_bytes()
25483 ),
25484});
25485}
25486unsafe extern "C" fn drawIndirect<D: DomTypes>
25487(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
25488 let mut result = false;
25489 wrap_panic(&mut || result = (|| {
25490 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
25491 let this = &*(this as *const D::GPURenderPassEncoder);
25492 let args = &*args;
25493 let argc = args.argc_;
25494
25495 if argc < 2 {
25496 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPURenderPassEncoder.drawIndirect\".");
25497 return false;
25498 }
25499 let arg0: DomRoot<D::GPUBuffer> = if HandleValue::from_raw(args.get(0)).get().is_object() {
25500 match root_from_handlevalue(HandleValue::from_raw(args.get(0)), SafeJSContext::from_ptr(cx.raw_cx())) {
25501 Ok(val) => val,
25502 Err(()) => {
25503 throw_type_error(cx.raw_cx(), "value does not implement interface GPUBuffer.");
25504 return false;
25505
25506 }
25507 }
25508
25509 } else {
25510 throw_type_error(cx.raw_cx(), "Value is not an object.");
25511 return false;
25512
25513 };
25514 let arg1: u64 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
25515 Ok(ConversionResult::Success(value)) => value,
25516 Ok(ConversionResult::Failure(error)) => {
25517 throw_type_error(cx.raw_cx(), &error);
25518 return false;
25519
25520 }
25521 _ => {
25522 return false;
25523
25524 },
25525 }
25526 ;
25527 let result: () = this.DrawIndirect(&arg0, arg1);
25528
25529 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
25530 return true;
25531 })());
25532 result
25533}
25534
25535
25536static drawIndirect_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
25537
25538pub(crate) fn init_drawIndirect_methodinfo<D: DomTypes>() {
25539 drawIndirect_methodinfo.set(JSJitInfo {
25540 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
25541 method: Some(drawIndirect::<D>)
25542 },
25543 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
25544 protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
25545 },
25546 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
25547 _bitfield_align_1: [],
25548 _bitfield_1: __BindgenBitfieldUnit::new(
25549 new_jsjitinfo_bitfield_1!(
25550 JSJitInfo_OpType::Method as u8,
25551 JSJitInfo_AliasSet::AliasEverything as u8,
25552 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
25553 false,
25554 false,
25555 false,
25556 false,
25557 false,
25558 false,
25559 0,
25560 ).to_ne_bytes()
25561 ),
25562});
25563}
25564unsafe extern "C" fn drawIndexedIndirect<D: DomTypes>
25565(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
25566 let mut result = false;
25567 wrap_panic(&mut || result = (|| {
25568 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
25569 let this = &*(this as *const D::GPURenderPassEncoder);
25570 let args = &*args;
25571 let argc = args.argc_;
25572
25573 if argc < 2 {
25574 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPURenderPassEncoder.drawIndexedIndirect\".");
25575 return false;
25576 }
25577 let arg0: DomRoot<D::GPUBuffer> = if HandleValue::from_raw(args.get(0)).get().is_object() {
25578 match root_from_handlevalue(HandleValue::from_raw(args.get(0)), SafeJSContext::from_ptr(cx.raw_cx())) {
25579 Ok(val) => val,
25580 Err(()) => {
25581 throw_type_error(cx.raw_cx(), "value does not implement interface GPUBuffer.");
25582 return false;
25583
25584 }
25585 }
25586
25587 } else {
25588 throw_type_error(cx.raw_cx(), "Value is not an object.");
25589 return false;
25590
25591 };
25592 let arg1: u64 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ConversionBehavior::EnforceRange) {
25593 Ok(ConversionResult::Success(value)) => value,
25594 Ok(ConversionResult::Failure(error)) => {
25595 throw_type_error(cx.raw_cx(), &error);
25596 return false;
25597
25598 }
25599 _ => {
25600 return false;
25601
25602 },
25603 }
25604 ;
25605 let result: () = this.DrawIndexedIndirect(&arg0, arg1);
25606
25607 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
25608 return true;
25609 })());
25610 result
25611}
25612
25613
25614static drawIndexedIndirect_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
25615
25616pub(crate) fn init_drawIndexedIndirect_methodinfo<D: DomTypes>() {
25617 drawIndexedIndirect_methodinfo.set(JSJitInfo {
25618 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
25619 method: Some(drawIndexedIndirect::<D>)
25620 },
25621 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
25622 protoID: PrototypeList::ID::GPURenderPassEncoder as u16,
25623 },
25624 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
25625 _bitfield_align_1: [],
25626 _bitfield_1: __BindgenBitfieldUnit::new(
25627 new_jsjitinfo_bitfield_1!(
25628 JSJitInfo_OpType::Method as u8,
25629 JSJitInfo_AliasSet::AliasEverything as u8,
25630 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
25631 false,
25632 false,
25633 false,
25634 false,
25635 false,
25636 false,
25637 0,
25638 ).to_ne_bytes()
25639 ),
25640});
25641}
25642unsafe extern "C" fn _finalize<D: DomTypes>
25643(_cx: *mut GCContext, obj: *mut JSObject){
25644 wrap_panic(&mut || {
25645
25646 let this = native_from_object_static::<D::GPURenderPassEncoder>(obj).unwrap();
25647 finalize_common(this);
25648 })
25649}
25650
25651unsafe extern "C" fn _trace<D: DomTypes>
25652(trc: *mut JSTracer, obj: *mut JSObject){
25653 wrap_panic(&mut || {
25654
25655 let this = native_from_object_static::<D::GPURenderPassEncoder>(obj).unwrap();
25656 if this.is_null() { return; } (*this).trace(trc);
25658 })
25659}
25660
25661
25662static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
25663
25664pub(crate) fn init_class_ops<D: DomTypes>() {
25665 CLASS_OPS.set(JSClassOps {
25666 addProperty: None,
25667 delProperty: None,
25668 enumerate: None,
25669 newEnumerate: None,
25670 resolve: None,
25671 mayResolve: None,
25672 finalize: Some(_finalize::<D>),
25673 call: None,
25674 construct: None,
25675 trace: Some(_trace::<D>),
25676 });
25677}
25678
25679pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
25680
25681pub(crate) fn init_domjs_class<D: DomTypes>() {
25682 init_class_ops::<D>();
25683 Class.set(DOMJSClass {
25684 base: JSClass {
25685 name: c"GPURenderPassEncoder".as_ptr(),
25686 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
25687 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
25688 ,
25689 cOps: unsafe { CLASS_OPS.get() },
25690 spec: ptr::null(),
25691 ext: ptr::null(),
25692 oOps: ptr::null(),
25693 },
25694 dom_class:
25695DOMClass {
25696 interface_chain: [ PrototypeList::ID::GPURenderPassEncoder, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
25697 depth: 0,
25698 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
25699 malloc_size_of: malloc_size_of_including_raw_self::<D::GPURenderPassEncoder> as unsafe fn(&mut _, _) -> _,
25700 global: Globals::EMPTY,
25701},
25702 });
25703}
25704
25705#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
25706(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPURenderPassEncoder>, _can_gc: CanGc) -> DomRoot<D::GPURenderPassEncoder>{
25707
25708 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
25709
25710 let scope = scope.reflector().get_jsobject();
25711 assert!(!scope.get().is_null());
25712 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
25713 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
25714
25715 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
25716 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
25717 assert!(!canonical_proto.is_null());
25718
25719
25720 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
25721 if let Some(given) = given_proto {
25722 proto.set(*given);
25723 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
25724 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
25725 }
25726 } else {
25727 proto.set(*canonical_proto);
25728 }
25729 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
25730 cx.raw_cx(),
25731 &Class.get().base,
25732 proto.handle(),
25733 ));
25734 assert!(!obj.is_null());
25735 JS_SetReservedSlot(
25736 obj.get(),
25737 DOM_OBJECT_SLOT,
25738 &PrivateValue(raw.as_ptr() as *const libc::c_void),
25739 );
25740
25741 let root = raw.reflect_with(obj.get());
25742
25743
25744
25745 DomRoot::from_ref(&*root)
25746}
25747
25748pub trait GPURenderPassEncoderMethods<D: DomTypes> {
25749 fn SetViewport(&self, r#x: Finite<f32>, r#y: Finite<f32>, r#width: Finite<f32>, r#height: Finite<f32>, r#minDepth: Finite<f32>, r#maxDepth: Finite<f32>);
25750 fn SetScissorRect(&self, r#x: u32, r#y: u32, r#width: u32, r#height: u32);
25751 fn SetBlendConstant(&self, r#color: GenericUnionTypes::DoubleSequenceOrGPUColorDict) -> Fallible<()>;
25752 fn SetStencilReference(&self, r#reference: u32);
25753 fn ExecuteBundles(&self, r#bundles: Vec<DomRoot<D::GPURenderBundle>>);
25754 fn End(&self, );
25755 fn Label(&self, ) -> USVString;
25756 fn SetLabel(&self, r#value: USVString);
25757 fn SetBindGroup(&self, r#index: u32, r#bindGroup: &D::GPUBindGroup, r#dynamicOffsets: Vec<u32>);
25758 fn SetPipeline(&self, r#pipeline: &D::GPURenderPipeline);
25759 fn SetIndexBuffer(&self, r#buffer: &D::GPUBuffer, r#indexFormat: GPUIndexFormat, r#offset: u64, r#size: u64);
25760 fn SetVertexBuffer(&self, r#slot: u32, r#buffer: &D::GPUBuffer, r#offset: u64, r#size: u64);
25761 fn Draw(&self, r#vertexCount: u32, r#instanceCount: u32, r#firstVertex: u32, r#firstInstance: u32);
25762 fn DrawIndexed(&self, r#indexCount: u32, r#instanceCount: u32, r#firstIndex: u32, r#baseVertex: i32, r#firstInstance: u32);
25763 fn DrawIndirect(&self, r#indirectBuffer: &D::GPUBuffer, r#indirectOffset: u64);
25764 fn DrawIndexedIndirect(&self, r#indirectBuffer: &D::GPUBuffer, r#indirectOffset: u64);
25765}
25766static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
25767
25768pub(crate) fn init_sMethods_specs<D: DomTypes>() {
25769 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
25770 JSFunctionSpec {
25771 name: JSPropertySpec_Name { string_: c"setViewport".as_ptr() },
25772 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { setViewport_methodinfo.get() } as *const _ as *const JSJitInfo },
25773 nargs: 6,
25774 flags: (JSPROP_ENUMERATE) as u16,
25775 selfHostedName: ptr::null()
25776 },
25777 JSFunctionSpec {
25778 name: JSPropertySpec_Name { string_: c"setScissorRect".as_ptr() },
25779 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { setScissorRect_methodinfo.get() } as *const _ as *const JSJitInfo },
25780 nargs: 4,
25781 flags: (JSPROP_ENUMERATE) as u16,
25782 selfHostedName: ptr::null()
25783 },
25784 JSFunctionSpec {
25785 name: JSPropertySpec_Name { string_: c"setBlendConstant".as_ptr() },
25786 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { setBlendConstant_methodinfo.get() } as *const _ as *const JSJitInfo },
25787 nargs: 1,
25788 flags: (JSPROP_ENUMERATE) as u16,
25789 selfHostedName: ptr::null()
25790 },
25791 JSFunctionSpec {
25792 name: JSPropertySpec_Name { string_: c"setStencilReference".as_ptr() },
25793 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { setStencilReference_methodinfo.get() } as *const _ as *const JSJitInfo },
25794 nargs: 1,
25795 flags: (JSPROP_ENUMERATE) as u16,
25796 selfHostedName: ptr::null()
25797 },
25798 JSFunctionSpec {
25799 name: JSPropertySpec_Name { string_: c"executeBundles".as_ptr() },
25800 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { executeBundles_methodinfo.get() } as *const _ as *const JSJitInfo },
25801 nargs: 1,
25802 flags: (JSPROP_ENUMERATE) as u16,
25803 selfHostedName: ptr::null()
25804 },
25805 JSFunctionSpec {
25806 name: JSPropertySpec_Name { string_: c"end".as_ptr() },
25807 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { end_methodinfo.get() } as *const _ as *const JSJitInfo },
25808 nargs: 0,
25809 flags: (JSPROP_ENUMERATE) as u16,
25810 selfHostedName: ptr::null()
25811 },
25812 JSFunctionSpec {
25813 name: JSPropertySpec_Name { string_: c"setBindGroup".as_ptr() },
25814 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { setBindGroup_methodinfo.get() } as *const _ as *const JSJitInfo },
25815 nargs: 2,
25816 flags: (JSPROP_ENUMERATE) as u16,
25817 selfHostedName: ptr::null()
25818 },
25819 JSFunctionSpec {
25820 name: JSPropertySpec_Name { string_: c"setPipeline".as_ptr() },
25821 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { setPipeline_methodinfo.get() } as *const _ as *const JSJitInfo },
25822 nargs: 1,
25823 flags: (JSPROP_ENUMERATE) as u16,
25824 selfHostedName: ptr::null()
25825 },
25826 JSFunctionSpec {
25827 name: JSPropertySpec_Name { string_: c"setIndexBuffer".as_ptr() },
25828 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { setIndexBuffer_methodinfo.get() } as *const _ as *const JSJitInfo },
25829 nargs: 2,
25830 flags: (JSPROP_ENUMERATE) as u16,
25831 selfHostedName: ptr::null()
25832 },
25833 JSFunctionSpec {
25834 name: JSPropertySpec_Name { string_: c"setVertexBuffer".as_ptr() },
25835 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { setVertexBuffer_methodinfo.get() } as *const _ as *const JSJitInfo },
25836 nargs: 2,
25837 flags: (JSPROP_ENUMERATE) as u16,
25838 selfHostedName: ptr::null()
25839 },
25840 JSFunctionSpec {
25841 name: JSPropertySpec_Name { string_: c"draw".as_ptr() },
25842 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { draw_methodinfo.get() } as *const _ as *const JSJitInfo },
25843 nargs: 1,
25844 flags: (JSPROP_ENUMERATE) as u16,
25845 selfHostedName: ptr::null()
25846 },
25847 JSFunctionSpec {
25848 name: JSPropertySpec_Name { string_: c"drawIndexed".as_ptr() },
25849 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { drawIndexed_methodinfo.get() } as *const _ as *const JSJitInfo },
25850 nargs: 1,
25851 flags: (JSPROP_ENUMERATE) as u16,
25852 selfHostedName: ptr::null()
25853 },
25854 JSFunctionSpec {
25855 name: JSPropertySpec_Name { string_: c"drawIndirect".as_ptr() },
25856 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { drawIndirect_methodinfo.get() } as *const _ as *const JSJitInfo },
25857 nargs: 2,
25858 flags: (JSPROP_ENUMERATE) as u16,
25859 selfHostedName: ptr::null()
25860 },
25861 JSFunctionSpec {
25862 name: JSPropertySpec_Name { string_: c"drawIndexedIndirect".as_ptr() },
25863 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { drawIndexedIndirect_methodinfo.get() } as *const _ as *const JSJitInfo },
25864 nargs: 2,
25865 flags: (JSPROP_ENUMERATE) as u16,
25866 selfHostedName: ptr::null()
25867 },
25868 JSFunctionSpec {
25869 name: JSPropertySpec_Name { string_: ptr::null() },
25870 call: JSNativeWrapper { op: None, info: ptr::null() },
25871 nargs: 0,
25872 flags: 0,
25873 selfHostedName: ptr::null()
25874 }]))[..]
25875])));
25876}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
25877
25878pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
25879 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sMethods_specs.get() })[0])])));
25880}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
25881
25882pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
25883 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
25884 JSPropertySpec {
25885 name: JSPropertySpec_Name { string_: c"label".as_ptr() },
25886 attributes_: (JSPROP_ENUMERATE),
25887 kind_: (JSPropertySpec_Kind::NativeAccessor),
25888 u: JSPropertySpec_AccessorsOrValue {
25889 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
25890 getter: JSPropertySpec_Accessor {
25891 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { label_getterinfo.get() } },
25892 },
25893 setter: JSPropertySpec_Accessor {
25894 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { label_setterinfo.get() } },
25895 }
25896 }
25897 }
25898 }
25899,
25900 JSPropertySpec::ZERO]))[..]
25901,
25902&Box::leak(Box::new([
25903 JSPropertySpec {
25904 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
25905 attributes_: (JSPROP_READONLY),
25906 kind_: (JSPropertySpec_Kind::Value),
25907 u: JSPropertySpec_AccessorsOrValue {
25908 value: JSPropertySpec_ValueWrapper {
25909 type_: JSPropertySpec_ValueWrapper_Type::String,
25910 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
25911 string: c"GPURenderPassEncoder".as_ptr(),
25912 }
25913 }
25914 }
25915 }
25916,
25917 JSPropertySpec::ZERO]))[..]
25918])));
25919}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
25920
25921pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
25922 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
25923 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
25924}
25925pub fn GetProtoObject<D: DomTypes>
25926(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
25927 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPURenderPassEncoder), CreateInterfaceObjects::<D>, rval)
25929}
25930
25931
25932static PrototypeClass: JSClass = JSClass {
25933 name: c"GPURenderPassEncoderPrototype".as_ptr(),
25934 flags:
25935 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
25937 cOps: ptr::null(),
25938 spec: ptr::null(),
25939 ext: ptr::null(),
25940 oOps: ptr::null(),
25941};
25942
25943
25944static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
25945
25946pub(crate) fn init_interface_object<D: DomTypes>() {
25947 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
25948 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
25949 b"function GPURenderPassEncoder() {\n [native code]\n}",
25950 PrototypeList::ID::GPURenderPassEncoder,
25951 0,
25952 ));
25953}
25954
25955pub fn DefineDOMInterface<D: DomTypes>
25956(cx: SafeJSContext, global: HandleObject){
25957 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPURenderPassEncoder),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
25958}
25959
25960pub fn ConstructorEnabled<D: DomTypes>
25961(aCx: SafeJSContext, aObj: HandleObject) -> bool{
25962 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
25963 pref!(dom_webgpu_enabled)
25964}
25965
25966unsafe fn CreateInterfaceObjects<D: DomTypes>
25967(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
25968
25969 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
25970 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
25971 assert!(!prototype_proto.is_null());
25972
25973 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
25974 create_interface_prototype_object::<D>(cx,
25975 global,
25976 prototype_proto.handle(),
25977 &PrototypeClass,
25978 sMethods.get(),
25979 sAttributes.get(),
25980 &[],
25981 &[],
25982 prototype.handle_mut());
25983 assert!(!prototype.is_null());
25984 assert!((*cache)[PrototypeList::ID::GPURenderPassEncoder as usize].is_null());
25985 (*cache)[PrototypeList::ID::GPURenderPassEncoder as usize] = prototype.get();
25986 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPURenderPassEncoder as isize),
25987 ptr::null_mut(),
25988 prototype.get());
25989
25990 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
25991 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
25992
25993 assert!(!interface_proto.is_null());
25994
25995 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
25996 create_noncallback_interface_object::<D>(cx,
25997 global,
25998 interface_proto.handle(),
25999 INTERFACE_OBJECT_CLASS.get(),
26000 &[],
26001 &[],
26002 &[],
26003 prototype.handle(),
26004 c"GPURenderPassEncoder",
26005 0,
26006 &[],
26007 interface.handle_mut());
26008 assert!(!interface.is_null());
26009}
26010
26011
26012 pub(crate) fn init_statics<D: DomTypes>() {
26013 init_interface_object::<D>();
26014 init_domjs_class::<D>();
26015 crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassEncoder_Binding::init_setViewport_methodinfo::<D>();
26016crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassEncoder_Binding::init_setScissorRect_methodinfo::<D>();
26017crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassEncoder_Binding::init_setBlendConstant_methodinfo::<D>();
26018crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassEncoder_Binding::init_setStencilReference_methodinfo::<D>();
26019crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassEncoder_Binding::init_executeBundles_methodinfo::<D>();
26020crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassEncoder_Binding::init_end_methodinfo::<D>();
26021crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassEncoder_Binding::init_setBindGroup_methodinfo::<D>();
26022crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassEncoder_Binding::init_setPipeline_methodinfo::<D>();
26023crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassEncoder_Binding::init_setIndexBuffer_methodinfo::<D>();
26024crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassEncoder_Binding::init_setVertexBuffer_methodinfo::<D>();
26025crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassEncoder_Binding::init_draw_methodinfo::<D>();
26026crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassEncoder_Binding::init_drawIndexed_methodinfo::<D>();
26027crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassEncoder_Binding::init_drawIndirect_methodinfo::<D>();
26028crate::codegen::GenericBindings::WebGPUBinding::GPURenderPassEncoder_Binding::init_drawIndexedIndirect_methodinfo::<D>();
26029 init_label_getterinfo::<D>();
26030 init_label_setterinfo::<D>();
26031
26032 init_sMethods_specs::<D>();
26033init_sMethods_prefs::<D>();
26034init_sAttributes_specs::<D>();
26035init_sAttributes_prefs::<D>();
26036 }
26037 } pub use self::GPURenderPipeline_Binding::{Wrap as GPURenderPipelineWrap, GPURenderPipelineMethods, GetProtoObject as GPURenderPipelineGetProtoObject, DefineDOMInterface as GPURenderPipelineDefineDOMInterface};
26041pub mod GPURenderPipeline_Binding {
26042use crate::import::module::*;
26043
26044unsafe extern "C" fn get_label<D: DomTypes>
26045(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
26046 let mut result = false;
26047 wrap_panic(&mut || result = (|| {
26048 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
26049 let this = &*(this as *const D::GPURenderPipeline);
26050 let result: USVString = this.Label();
26051
26052 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
26053 return true;
26054 })());
26055 result
26056}
26057
26058unsafe extern "C" fn set_label<D: DomTypes>
26059(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
26060 let mut result = false;
26061 wrap_panic(&mut || result = (|| {
26062 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
26063 let this = &*(this as *const D::GPURenderPipeline);
26064 let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
26065 Ok(ConversionResult::Success(value)) => value,
26066 Ok(ConversionResult::Failure(error)) => {
26067 throw_type_error(cx.raw_cx(), &error);
26068 return false;
26069
26070 }
26071 _ => {
26072 return false;
26073
26074 },
26075 }
26076 ;
26077 let result: () = this.SetLabel(arg0);
26078
26079 true
26080 })());
26081 result
26082}
26083
26084
26085static label_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
26086
26087pub(crate) fn init_label_getterinfo<D: DomTypes>() {
26088 label_getterinfo.set(JSJitInfo {
26089 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
26090 getter: Some(get_label::<D>)
26091 },
26092 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
26093 protoID: PrototypeList::ID::GPURenderPipeline as u16,
26094 },
26095 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
26096 _bitfield_align_1: [],
26097 _bitfield_1: __BindgenBitfieldUnit::new(
26098 new_jsjitinfo_bitfield_1!(
26099 JSJitInfo_OpType::Getter as u8,
26100 JSJitInfo_AliasSet::AliasEverything as u8,
26101 JSValueType::JSVAL_TYPE_STRING as u8,
26102 true,
26103 false,
26104 false,
26105 false,
26106 false,
26107 false,
26108 0,
26109 ).to_ne_bytes()
26110 ),
26111});
26112}
26113static label_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
26114
26115pub(crate) fn init_label_setterinfo<D: DomTypes>() {
26116 label_setterinfo.set(JSJitInfo {
26117 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
26118 setter: Some(set_label::<D>)
26119 },
26120 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
26121 protoID: PrototypeList::ID::GPURenderPipeline as u16,
26122 },
26123 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
26124 _bitfield_align_1: [],
26125 _bitfield_1: __BindgenBitfieldUnit::new(
26126 new_jsjitinfo_bitfield_1!(
26127 JSJitInfo_OpType::Setter as u8,
26128 JSJitInfo_AliasSet::AliasEverything as u8,
26129 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
26130 false,
26131 false,
26132 false,
26133 false,
26134 false,
26135 false,
26136 0,
26137 ).to_ne_bytes()
26138 ),
26139});
26140}
26141unsafe extern "C" fn getBindGroupLayout<D: DomTypes>
26142(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
26143 let mut result = false;
26144 wrap_panic(&mut || result = (|| {
26145 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
26146 let this = &*(this as *const D::GPURenderPipeline);
26147 let args = &*args;
26148 let argc = args.argc_;
26149
26150 if argc < 1 {
26151 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPURenderPipeline.getBindGroupLayout\".");
26152 return false;
26153 }
26154 let arg0: u32 = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ConversionBehavior::Default) {
26155 Ok(ConversionResult::Success(value)) => value,
26156 Ok(ConversionResult::Failure(error)) => {
26157 throw_type_error(cx.raw_cx(), &error);
26158 return false;
26159
26160 }
26161 _ => {
26162 return false;
26163
26164 },
26165 }
26166 ;
26167 let result: Result<DomRoot<D::GPUBindGroupLayout>, Error> = this.GetBindGroupLayout(arg0);
26168 let result = match result {
26169 Ok(result) => result,
26170 Err(e) => {
26171 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
26172 return false;
26173 },
26174 };
26175
26176 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
26177 return true;
26178 })());
26179 result
26180}
26181
26182
26183static getBindGroupLayout_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
26184
26185pub(crate) fn init_getBindGroupLayout_methodinfo<D: DomTypes>() {
26186 getBindGroupLayout_methodinfo.set(JSJitInfo {
26187 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
26188 method: Some(getBindGroupLayout::<D>)
26189 },
26190 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
26191 protoID: PrototypeList::ID::GPURenderPipeline as u16,
26192 },
26193 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
26194 _bitfield_align_1: [],
26195 _bitfield_1: __BindgenBitfieldUnit::new(
26196 new_jsjitinfo_bitfield_1!(
26197 JSJitInfo_OpType::Method as u8,
26198 JSJitInfo_AliasSet::AliasEverything as u8,
26199 JSValueType::JSVAL_TYPE_OBJECT as u8,
26200 false,
26201 false,
26202 false,
26203 false,
26204 false,
26205 false,
26206 0,
26207 ).to_ne_bytes()
26208 ),
26209});
26210}
26211unsafe extern "C" fn _finalize<D: DomTypes>
26212(_cx: *mut GCContext, obj: *mut JSObject){
26213 wrap_panic(&mut || {
26214
26215 let this = native_from_object_static::<D::GPURenderPipeline>(obj).unwrap();
26216 finalize_common(this);
26217 })
26218}
26219
26220unsafe extern "C" fn _trace<D: DomTypes>
26221(trc: *mut JSTracer, obj: *mut JSObject){
26222 wrap_panic(&mut || {
26223
26224 let this = native_from_object_static::<D::GPURenderPipeline>(obj).unwrap();
26225 if this.is_null() { return; } (*this).trace(trc);
26227 })
26228}
26229
26230
26231static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
26232
26233pub(crate) fn init_class_ops<D: DomTypes>() {
26234 CLASS_OPS.set(JSClassOps {
26235 addProperty: None,
26236 delProperty: None,
26237 enumerate: None,
26238 newEnumerate: None,
26239 resolve: None,
26240 mayResolve: None,
26241 finalize: Some(_finalize::<D>),
26242 call: None,
26243 construct: None,
26244 trace: Some(_trace::<D>),
26245 });
26246}
26247
26248pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
26249
26250pub(crate) fn init_domjs_class<D: DomTypes>() {
26251 init_class_ops::<D>();
26252 Class.set(DOMJSClass {
26253 base: JSClass {
26254 name: c"GPURenderPipeline".as_ptr(),
26255 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
26256 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
26257 ,
26258 cOps: unsafe { CLASS_OPS.get() },
26259 spec: ptr::null(),
26260 ext: ptr::null(),
26261 oOps: ptr::null(),
26262 },
26263 dom_class:
26264DOMClass {
26265 interface_chain: [ PrototypeList::ID::GPURenderPipeline, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
26266 depth: 0,
26267 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
26268 malloc_size_of: malloc_size_of_including_raw_self::<D::GPURenderPipeline> as unsafe fn(&mut _, _) -> _,
26269 global: Globals::EMPTY,
26270},
26271 });
26272}
26273
26274#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
26275(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPURenderPipeline>, _can_gc: CanGc) -> DomRoot<D::GPURenderPipeline>{
26276
26277 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
26278
26279 let scope = scope.reflector().get_jsobject();
26280 assert!(!scope.get().is_null());
26281 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
26282 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
26283
26284 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
26285 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
26286 assert!(!canonical_proto.is_null());
26287
26288
26289 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
26290 if let Some(given) = given_proto {
26291 proto.set(*given);
26292 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
26293 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
26294 }
26295 } else {
26296 proto.set(*canonical_proto);
26297 }
26298 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
26299 cx.raw_cx(),
26300 &Class.get().base,
26301 proto.handle(),
26302 ));
26303 assert!(!obj.is_null());
26304 JS_SetReservedSlot(
26305 obj.get(),
26306 DOM_OBJECT_SLOT,
26307 &PrivateValue(raw.as_ptr() as *const libc::c_void),
26308 );
26309
26310 let root = raw.reflect_with(obj.get());
26311
26312
26313
26314 DomRoot::from_ref(&*root)
26315}
26316
26317pub trait GPURenderPipelineMethods<D: DomTypes> {
26318 fn Label(&self, ) -> USVString;
26319 fn SetLabel(&self, r#value: USVString);
26320 fn GetBindGroupLayout(&self, r#index: u32) -> Fallible<DomRoot<D::GPUBindGroupLayout>>;
26321}
26322static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
26323
26324pub(crate) fn init_sMethods_specs<D: DomTypes>() {
26325 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
26326 JSFunctionSpec {
26327 name: JSPropertySpec_Name { string_: c"getBindGroupLayout".as_ptr() },
26328 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { getBindGroupLayout_methodinfo.get() } as *const _ as *const JSJitInfo },
26329 nargs: 1,
26330 flags: (JSPROP_ENUMERATE) as u16,
26331 selfHostedName: ptr::null()
26332 },
26333 JSFunctionSpec {
26334 name: JSPropertySpec_Name { string_: ptr::null() },
26335 call: JSNativeWrapper { op: None, info: ptr::null() },
26336 nargs: 0,
26337 flags: 0,
26338 selfHostedName: ptr::null()
26339 }]))[..]
26340])));
26341}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
26342
26343pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
26344 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sMethods_specs.get() })[0])])));
26345}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
26346
26347pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
26348 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
26349 JSPropertySpec {
26350 name: JSPropertySpec_Name { string_: c"label".as_ptr() },
26351 attributes_: (JSPROP_ENUMERATE),
26352 kind_: (JSPropertySpec_Kind::NativeAccessor),
26353 u: JSPropertySpec_AccessorsOrValue {
26354 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
26355 getter: JSPropertySpec_Accessor {
26356 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { label_getterinfo.get() } },
26357 },
26358 setter: JSPropertySpec_Accessor {
26359 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { label_setterinfo.get() } },
26360 }
26361 }
26362 }
26363 }
26364,
26365 JSPropertySpec::ZERO]))[..]
26366,
26367&Box::leak(Box::new([
26368 JSPropertySpec {
26369 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
26370 attributes_: (JSPROP_READONLY),
26371 kind_: (JSPropertySpec_Kind::Value),
26372 u: JSPropertySpec_AccessorsOrValue {
26373 value: JSPropertySpec_ValueWrapper {
26374 type_: JSPropertySpec_ValueWrapper_Type::String,
26375 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
26376 string: c"GPURenderPipeline".as_ptr(),
26377 }
26378 }
26379 }
26380 }
26381,
26382 JSPropertySpec::ZERO]))[..]
26383])));
26384}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
26385
26386pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
26387 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
26388 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
26389}
26390pub fn GetProtoObject<D: DomTypes>
26391(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
26392 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPURenderPipeline), CreateInterfaceObjects::<D>, rval)
26394}
26395
26396
26397static PrototypeClass: JSClass = JSClass {
26398 name: c"GPURenderPipelinePrototype".as_ptr(),
26399 flags:
26400 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
26402 cOps: ptr::null(),
26403 spec: ptr::null(),
26404 ext: ptr::null(),
26405 oOps: ptr::null(),
26406};
26407
26408
26409static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
26410
26411pub(crate) fn init_interface_object<D: DomTypes>() {
26412 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
26413 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
26414 b"function GPURenderPipeline() {\n [native code]\n}",
26415 PrototypeList::ID::GPURenderPipeline,
26416 0,
26417 ));
26418}
26419
26420pub fn DefineDOMInterface<D: DomTypes>
26421(cx: SafeJSContext, global: HandleObject){
26422 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPURenderPipeline),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
26423}
26424
26425pub fn ConstructorEnabled<D: DomTypes>
26426(aCx: SafeJSContext, aObj: HandleObject) -> bool{
26427 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
26428 pref!(dom_webgpu_enabled)
26429}
26430
26431unsafe fn CreateInterfaceObjects<D: DomTypes>
26432(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
26433
26434 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
26435 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
26436 assert!(!prototype_proto.is_null());
26437
26438 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
26439 create_interface_prototype_object::<D>(cx,
26440 global,
26441 prototype_proto.handle(),
26442 &PrototypeClass,
26443 sMethods.get(),
26444 sAttributes.get(),
26445 &[],
26446 &[],
26447 prototype.handle_mut());
26448 assert!(!prototype.is_null());
26449 assert!((*cache)[PrototypeList::ID::GPURenderPipeline as usize].is_null());
26450 (*cache)[PrototypeList::ID::GPURenderPipeline as usize] = prototype.get();
26451 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPURenderPipeline as isize),
26452 ptr::null_mut(),
26453 prototype.get());
26454
26455 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
26456 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
26457
26458 assert!(!interface_proto.is_null());
26459
26460 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
26461 create_noncallback_interface_object::<D>(cx,
26462 global,
26463 interface_proto.handle(),
26464 INTERFACE_OBJECT_CLASS.get(),
26465 &[],
26466 &[],
26467 &[],
26468 prototype.handle(),
26469 c"GPURenderPipeline",
26470 0,
26471 &[],
26472 interface.handle_mut());
26473 assert!(!interface.is_null());
26474}
26475
26476
26477 pub(crate) fn init_statics<D: DomTypes>() {
26478 init_interface_object::<D>();
26479 init_domjs_class::<D>();
26480 crate::codegen::GenericBindings::WebGPUBinding::GPURenderPipeline_Binding::init_getBindGroupLayout_methodinfo::<D>();
26481 init_label_getterinfo::<D>();
26482 init_label_setterinfo::<D>();
26483
26484 init_sMethods_specs::<D>();
26485init_sMethods_prefs::<D>();
26486init_sAttributes_specs::<D>();
26487init_sAttributes_prefs::<D>();
26488 }
26489 } pub use self::GPUSampler_Binding::{Wrap as GPUSamplerWrap, GPUSamplerMethods, GetProtoObject as GPUSamplerGetProtoObject, DefineDOMInterface as GPUSamplerDefineDOMInterface};
26493pub mod GPUSampler_Binding {
26494use crate::import::module::*;
26495
26496unsafe extern "C" fn get_label<D: DomTypes>
26497(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
26498 let mut result = false;
26499 wrap_panic(&mut || result = (|| {
26500 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
26501 let this = &*(this as *const D::GPUSampler);
26502 let result: USVString = this.Label();
26503
26504 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
26505 return true;
26506 })());
26507 result
26508}
26509
26510unsafe extern "C" fn set_label<D: DomTypes>
26511(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
26512 let mut result = false;
26513 wrap_panic(&mut || result = (|| {
26514 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
26515 let this = &*(this as *const D::GPUSampler);
26516 let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
26517 Ok(ConversionResult::Success(value)) => value,
26518 Ok(ConversionResult::Failure(error)) => {
26519 throw_type_error(cx.raw_cx(), &error);
26520 return false;
26521
26522 }
26523 _ => {
26524 return false;
26525
26526 },
26527 }
26528 ;
26529 let result: () = this.SetLabel(arg0);
26530
26531 true
26532 })());
26533 result
26534}
26535
26536
26537static label_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
26538
26539pub(crate) fn init_label_getterinfo<D: DomTypes>() {
26540 label_getterinfo.set(JSJitInfo {
26541 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
26542 getter: Some(get_label::<D>)
26543 },
26544 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
26545 protoID: PrototypeList::ID::GPUSampler as u16,
26546 },
26547 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
26548 _bitfield_align_1: [],
26549 _bitfield_1: __BindgenBitfieldUnit::new(
26550 new_jsjitinfo_bitfield_1!(
26551 JSJitInfo_OpType::Getter as u8,
26552 JSJitInfo_AliasSet::AliasEverything as u8,
26553 JSValueType::JSVAL_TYPE_STRING as u8,
26554 true,
26555 false,
26556 false,
26557 false,
26558 false,
26559 false,
26560 0,
26561 ).to_ne_bytes()
26562 ),
26563});
26564}
26565static label_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
26566
26567pub(crate) fn init_label_setterinfo<D: DomTypes>() {
26568 label_setterinfo.set(JSJitInfo {
26569 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
26570 setter: Some(set_label::<D>)
26571 },
26572 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
26573 protoID: PrototypeList::ID::GPUSampler as u16,
26574 },
26575 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
26576 _bitfield_align_1: [],
26577 _bitfield_1: __BindgenBitfieldUnit::new(
26578 new_jsjitinfo_bitfield_1!(
26579 JSJitInfo_OpType::Setter as u8,
26580 JSJitInfo_AliasSet::AliasEverything as u8,
26581 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
26582 false,
26583 false,
26584 false,
26585 false,
26586 false,
26587 false,
26588 0,
26589 ).to_ne_bytes()
26590 ),
26591});
26592}
26593unsafe extern "C" fn _finalize<D: DomTypes>
26594(_cx: *mut GCContext, obj: *mut JSObject){
26595 wrap_panic(&mut || {
26596
26597 let this = native_from_object_static::<D::GPUSampler>(obj).unwrap();
26598 finalize_common(this);
26599 })
26600}
26601
26602unsafe extern "C" fn _trace<D: DomTypes>
26603(trc: *mut JSTracer, obj: *mut JSObject){
26604 wrap_panic(&mut || {
26605
26606 let this = native_from_object_static::<D::GPUSampler>(obj).unwrap();
26607 if this.is_null() { return; } (*this).trace(trc);
26609 })
26610}
26611
26612
26613static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
26614
26615pub(crate) fn init_class_ops<D: DomTypes>() {
26616 CLASS_OPS.set(JSClassOps {
26617 addProperty: None,
26618 delProperty: None,
26619 enumerate: None,
26620 newEnumerate: None,
26621 resolve: None,
26622 mayResolve: None,
26623 finalize: Some(_finalize::<D>),
26624 call: None,
26625 construct: None,
26626 trace: Some(_trace::<D>),
26627 });
26628}
26629
26630pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
26631
26632pub(crate) fn init_domjs_class<D: DomTypes>() {
26633 init_class_ops::<D>();
26634 Class.set(DOMJSClass {
26635 base: JSClass {
26636 name: c"GPUSampler".as_ptr(),
26637 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
26638 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
26639 ,
26640 cOps: unsafe { CLASS_OPS.get() },
26641 spec: ptr::null(),
26642 ext: ptr::null(),
26643 oOps: ptr::null(),
26644 },
26645 dom_class:
26646DOMClass {
26647 interface_chain: [ PrototypeList::ID::GPUSampler, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
26648 depth: 0,
26649 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
26650 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUSampler> as unsafe fn(&mut _, _) -> _,
26651 global: Globals::EMPTY,
26652},
26653 });
26654}
26655
26656#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
26657(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUSampler>, _can_gc: CanGc) -> DomRoot<D::GPUSampler>{
26658
26659 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
26660
26661 let scope = scope.reflector().get_jsobject();
26662 assert!(!scope.get().is_null());
26663 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
26664 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
26665
26666 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
26667 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
26668 assert!(!canonical_proto.is_null());
26669
26670
26671 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
26672 if let Some(given) = given_proto {
26673 proto.set(*given);
26674 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
26675 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
26676 }
26677 } else {
26678 proto.set(*canonical_proto);
26679 }
26680 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
26681 cx.raw_cx(),
26682 &Class.get().base,
26683 proto.handle(),
26684 ));
26685 assert!(!obj.is_null());
26686 JS_SetReservedSlot(
26687 obj.get(),
26688 DOM_OBJECT_SLOT,
26689 &PrivateValue(raw.as_ptr() as *const libc::c_void),
26690 );
26691
26692 let root = raw.reflect_with(obj.get());
26693
26694
26695
26696 DomRoot::from_ref(&*root)
26697}
26698
26699pub trait GPUSamplerMethods<D: DomTypes> {
26700 fn Label(&self, ) -> USVString;
26701 fn SetLabel(&self, r#value: USVString);
26702}
26703static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
26704
26705pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
26706 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
26707 JSPropertySpec {
26708 name: JSPropertySpec_Name { string_: c"label".as_ptr() },
26709 attributes_: (JSPROP_ENUMERATE),
26710 kind_: (JSPropertySpec_Kind::NativeAccessor),
26711 u: JSPropertySpec_AccessorsOrValue {
26712 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
26713 getter: JSPropertySpec_Accessor {
26714 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { label_getterinfo.get() } },
26715 },
26716 setter: JSPropertySpec_Accessor {
26717 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { label_setterinfo.get() } },
26718 }
26719 }
26720 }
26721 }
26722,
26723 JSPropertySpec::ZERO]))[..]
26724,
26725&Box::leak(Box::new([
26726 JSPropertySpec {
26727 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
26728 attributes_: (JSPROP_READONLY),
26729 kind_: (JSPropertySpec_Kind::Value),
26730 u: JSPropertySpec_AccessorsOrValue {
26731 value: JSPropertySpec_ValueWrapper {
26732 type_: JSPropertySpec_ValueWrapper_Type::String,
26733 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
26734 string: c"GPUSampler".as_ptr(),
26735 }
26736 }
26737 }
26738 }
26739,
26740 JSPropertySpec::ZERO]))[..]
26741])));
26742}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
26743
26744pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
26745 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
26746 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
26747}
26748pub fn GetProtoObject<D: DomTypes>
26749(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
26750 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUSampler), CreateInterfaceObjects::<D>, rval)
26752}
26753
26754
26755static PrototypeClass: JSClass = JSClass {
26756 name: c"GPUSamplerPrototype".as_ptr(),
26757 flags:
26758 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
26760 cOps: ptr::null(),
26761 spec: ptr::null(),
26762 ext: ptr::null(),
26763 oOps: ptr::null(),
26764};
26765
26766
26767static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
26768
26769pub(crate) fn init_interface_object<D: DomTypes>() {
26770 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
26771 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
26772 b"function GPUSampler() {\n [native code]\n}",
26773 PrototypeList::ID::GPUSampler,
26774 0,
26775 ));
26776}
26777
26778pub fn DefineDOMInterface<D: DomTypes>
26779(cx: SafeJSContext, global: HandleObject){
26780 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUSampler),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
26781}
26782
26783pub fn ConstructorEnabled<D: DomTypes>
26784(aCx: SafeJSContext, aObj: HandleObject) -> bool{
26785 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
26786 pref!(dom_webgpu_enabled)
26787}
26788
26789unsafe fn CreateInterfaceObjects<D: DomTypes>
26790(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
26791
26792 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
26793 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
26794 assert!(!prototype_proto.is_null());
26795
26796 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
26797 create_interface_prototype_object::<D>(cx,
26798 global,
26799 prototype_proto.handle(),
26800 &PrototypeClass,
26801 &[],
26802 sAttributes.get(),
26803 &[],
26804 &[],
26805 prototype.handle_mut());
26806 assert!(!prototype.is_null());
26807 assert!((*cache)[PrototypeList::ID::GPUSampler as usize].is_null());
26808 (*cache)[PrototypeList::ID::GPUSampler as usize] = prototype.get();
26809 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUSampler as isize),
26810 ptr::null_mut(),
26811 prototype.get());
26812
26813 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
26814 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
26815
26816 assert!(!interface_proto.is_null());
26817
26818 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
26819 create_noncallback_interface_object::<D>(cx,
26820 global,
26821 interface_proto.handle(),
26822 INTERFACE_OBJECT_CLASS.get(),
26823 &[],
26824 &[],
26825 &[],
26826 prototype.handle(),
26827 c"GPUSampler",
26828 0,
26829 &[],
26830 interface.handle_mut());
26831 assert!(!interface.is_null());
26832}
26833
26834
26835 pub(crate) fn init_statics<D: DomTypes>() {
26836 init_interface_object::<D>();
26837 init_domjs_class::<D>();
26838
26839 init_label_getterinfo::<D>();
26840 init_label_setterinfo::<D>();
26841
26842 init_sAttributes_specs::<D>();
26843init_sAttributes_prefs::<D>();
26844 }
26845 } pub use self::GPUShaderModule_Binding::{Wrap as GPUShaderModuleWrap, GPUShaderModuleMethods, GetProtoObject as GPUShaderModuleGetProtoObject, DefineDOMInterface as GPUShaderModuleDefineDOMInterface};
26849pub mod GPUShaderModule_Binding {
26850use crate::import::module::*;
26851
26852unsafe extern "C" fn getCompilationInfo<D: DomTypes>
26853(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
26854 let mut result = false;
26855 wrap_panic(&mut || result = (|| {
26856 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
26857 let this = &*(this as *const D::GPUShaderModule);
26858 let args = &*args;
26859 let argc = args.argc_;
26860 let result: Rc<D::Promise> = this.GetCompilationInfo();
26861
26862 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
26863 return true;
26864 })());
26865 result
26866}
26867
26868unsafe extern "C" fn getCompilationInfo_promise_wrapper<D: DomTypes>
26869(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
26870 let mut result = false;
26871 wrap_panic(&mut || result = (|| {
26872 let ok = getCompilationInfo::<D>(cx, _obj, this, args);
26873 if ok {
26874 return true;
26875 }
26876 return exception_to_promise(cx, (*args).rval(), CanGc::note());
26877
26878 })());
26879 result
26880}
26881
26882
26883static getCompilationInfo_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
26884
26885pub(crate) fn init_getCompilationInfo_methodinfo<D: DomTypes>() {
26886 getCompilationInfo_methodinfo.set(JSJitInfo {
26887 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
26888 method: Some(getCompilationInfo_promise_wrapper::<D>)
26889 },
26890 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
26891 protoID: PrototypeList::ID::GPUShaderModule as u16,
26892 },
26893 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
26894 _bitfield_align_1: [],
26895 _bitfield_1: __BindgenBitfieldUnit::new(
26896 new_jsjitinfo_bitfield_1!(
26897 JSJitInfo_OpType::Method as u8,
26898 JSJitInfo_AliasSet::AliasEverything as u8,
26899 JSValueType::JSVAL_TYPE_OBJECT as u8,
26900 true,
26901 false,
26902 false,
26903 false,
26904 false,
26905 false,
26906 0,
26907 ).to_ne_bytes()
26908 ),
26909});
26910}
26911unsafe extern "C" fn get_label<D: DomTypes>
26912(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
26913 let mut result = false;
26914 wrap_panic(&mut || result = (|| {
26915 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
26916 let this = &*(this as *const D::GPUShaderModule);
26917 let result: USVString = this.Label();
26918
26919 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
26920 return true;
26921 })());
26922 result
26923}
26924
26925unsafe extern "C" fn set_label<D: DomTypes>
26926(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
26927 let mut result = false;
26928 wrap_panic(&mut || result = (|| {
26929 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
26930 let this = &*(this as *const D::GPUShaderModule);
26931 let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
26932 Ok(ConversionResult::Success(value)) => value,
26933 Ok(ConversionResult::Failure(error)) => {
26934 throw_type_error(cx.raw_cx(), &error);
26935 return false;
26936
26937 }
26938 _ => {
26939 return false;
26940
26941 },
26942 }
26943 ;
26944 let result: () = this.SetLabel(arg0);
26945
26946 true
26947 })());
26948 result
26949}
26950
26951
26952static label_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
26953
26954pub(crate) fn init_label_getterinfo<D: DomTypes>() {
26955 label_getterinfo.set(JSJitInfo {
26956 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
26957 getter: Some(get_label::<D>)
26958 },
26959 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
26960 protoID: PrototypeList::ID::GPUShaderModule as u16,
26961 },
26962 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
26963 _bitfield_align_1: [],
26964 _bitfield_1: __BindgenBitfieldUnit::new(
26965 new_jsjitinfo_bitfield_1!(
26966 JSJitInfo_OpType::Getter as u8,
26967 JSJitInfo_AliasSet::AliasEverything as u8,
26968 JSValueType::JSVAL_TYPE_STRING as u8,
26969 true,
26970 false,
26971 false,
26972 false,
26973 false,
26974 false,
26975 0,
26976 ).to_ne_bytes()
26977 ),
26978});
26979}
26980static label_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
26981
26982pub(crate) fn init_label_setterinfo<D: DomTypes>() {
26983 label_setterinfo.set(JSJitInfo {
26984 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
26985 setter: Some(set_label::<D>)
26986 },
26987 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
26988 protoID: PrototypeList::ID::GPUShaderModule as u16,
26989 },
26990 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
26991 _bitfield_align_1: [],
26992 _bitfield_1: __BindgenBitfieldUnit::new(
26993 new_jsjitinfo_bitfield_1!(
26994 JSJitInfo_OpType::Setter as u8,
26995 JSJitInfo_AliasSet::AliasEverything as u8,
26996 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
26997 false,
26998 false,
26999 false,
27000 false,
27001 false,
27002 false,
27003 0,
27004 ).to_ne_bytes()
27005 ),
27006});
27007}
27008unsafe extern "C" fn _finalize<D: DomTypes>
27009(_cx: *mut GCContext, obj: *mut JSObject){
27010 wrap_panic(&mut || {
27011
27012 let this = native_from_object_static::<D::GPUShaderModule>(obj).unwrap();
27013 finalize_common(this);
27014 })
27015}
27016
27017unsafe extern "C" fn _trace<D: DomTypes>
27018(trc: *mut JSTracer, obj: *mut JSObject){
27019 wrap_panic(&mut || {
27020
27021 let this = native_from_object_static::<D::GPUShaderModule>(obj).unwrap();
27022 if this.is_null() { return; } (*this).trace(trc);
27024 })
27025}
27026
27027
27028static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
27029
27030pub(crate) fn init_class_ops<D: DomTypes>() {
27031 CLASS_OPS.set(JSClassOps {
27032 addProperty: None,
27033 delProperty: None,
27034 enumerate: None,
27035 newEnumerate: None,
27036 resolve: None,
27037 mayResolve: None,
27038 finalize: Some(_finalize::<D>),
27039 call: None,
27040 construct: None,
27041 trace: Some(_trace::<D>),
27042 });
27043}
27044
27045pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
27046
27047pub(crate) fn init_domjs_class<D: DomTypes>() {
27048 init_class_ops::<D>();
27049 Class.set(DOMJSClass {
27050 base: JSClass {
27051 name: c"GPUShaderModule".as_ptr(),
27052 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
27053 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
27054 ,
27055 cOps: unsafe { CLASS_OPS.get() },
27056 spec: ptr::null(),
27057 ext: ptr::null(),
27058 oOps: ptr::null(),
27059 },
27060 dom_class:
27061DOMClass {
27062 interface_chain: [ PrototypeList::ID::GPUShaderModule, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
27063 depth: 0,
27064 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
27065 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUShaderModule> as unsafe fn(&mut _, _) -> _,
27066 global: Globals::EMPTY,
27067},
27068 });
27069}
27070
27071#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
27072(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUShaderModule>, _can_gc: CanGc) -> DomRoot<D::GPUShaderModule>{
27073
27074 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
27075
27076 let scope = scope.reflector().get_jsobject();
27077 assert!(!scope.get().is_null());
27078 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
27079 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
27080
27081 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
27082 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
27083 assert!(!canonical_proto.is_null());
27084
27085
27086 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
27087 if let Some(given) = given_proto {
27088 proto.set(*given);
27089 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
27090 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
27091 }
27092 } else {
27093 proto.set(*canonical_proto);
27094 }
27095 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
27096 cx.raw_cx(),
27097 &Class.get().base,
27098 proto.handle(),
27099 ));
27100 assert!(!obj.is_null());
27101 JS_SetReservedSlot(
27102 obj.get(),
27103 DOM_OBJECT_SLOT,
27104 &PrivateValue(raw.as_ptr() as *const libc::c_void),
27105 );
27106
27107 let root = raw.reflect_with(obj.get());
27108
27109
27110
27111 DomRoot::from_ref(&*root)
27112}
27113
27114pub trait GPUShaderModuleMethods<D: DomTypes> {
27115 fn GetCompilationInfo(&self, ) -> Rc<D::Promise>;
27116 fn Label(&self, ) -> USVString;
27117 fn SetLabel(&self, r#value: USVString);
27118}
27119static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
27120
27121pub(crate) fn init_sMethods_specs<D: DomTypes>() {
27122 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
27123 JSFunctionSpec {
27124 name: JSPropertySpec_Name { string_: c"getCompilationInfo".as_ptr() },
27125 call: JSNativeWrapper { op: Some(generic_method::<true>), info: unsafe { getCompilationInfo_methodinfo.get() } as *const _ as *const JSJitInfo },
27126 nargs: 0,
27127 flags: (JSPROP_ENUMERATE) as u16,
27128 selfHostedName: ptr::null()
27129 },
27130 JSFunctionSpec {
27131 name: JSPropertySpec_Name { string_: ptr::null() },
27132 call: JSNativeWrapper { op: None, info: ptr::null() },
27133 nargs: 0,
27134 flags: 0,
27135 selfHostedName: ptr::null()
27136 }]))[..]
27137])));
27138}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
27139
27140pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
27141 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sMethods_specs.get() })[0])])));
27142}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
27143
27144pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
27145 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
27146 JSPropertySpec {
27147 name: JSPropertySpec_Name { string_: c"label".as_ptr() },
27148 attributes_: (JSPROP_ENUMERATE),
27149 kind_: (JSPropertySpec_Kind::NativeAccessor),
27150 u: JSPropertySpec_AccessorsOrValue {
27151 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
27152 getter: JSPropertySpec_Accessor {
27153 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { label_getterinfo.get() } },
27154 },
27155 setter: JSPropertySpec_Accessor {
27156 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { label_setterinfo.get() } },
27157 }
27158 }
27159 }
27160 }
27161,
27162 JSPropertySpec::ZERO]))[..]
27163,
27164&Box::leak(Box::new([
27165 JSPropertySpec {
27166 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
27167 attributes_: (JSPROP_READONLY),
27168 kind_: (JSPropertySpec_Kind::Value),
27169 u: JSPropertySpec_AccessorsOrValue {
27170 value: JSPropertySpec_ValueWrapper {
27171 type_: JSPropertySpec_ValueWrapper_Type::String,
27172 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
27173 string: c"GPUShaderModule".as_ptr(),
27174 }
27175 }
27176 }
27177 }
27178,
27179 JSPropertySpec::ZERO]))[..]
27180])));
27181}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
27182
27183pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
27184 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
27185 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
27186}
27187pub fn GetProtoObject<D: DomTypes>
27188(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
27189 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUShaderModule), CreateInterfaceObjects::<D>, rval)
27191}
27192
27193
27194static PrototypeClass: JSClass = JSClass {
27195 name: c"GPUShaderModulePrototype".as_ptr(),
27196 flags:
27197 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
27199 cOps: ptr::null(),
27200 spec: ptr::null(),
27201 ext: ptr::null(),
27202 oOps: ptr::null(),
27203};
27204
27205
27206static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
27207
27208pub(crate) fn init_interface_object<D: DomTypes>() {
27209 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
27210 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
27211 b"function GPUShaderModule() {\n [native code]\n}",
27212 PrototypeList::ID::GPUShaderModule,
27213 0,
27214 ));
27215}
27216
27217pub fn DefineDOMInterface<D: DomTypes>
27218(cx: SafeJSContext, global: HandleObject){
27219 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUShaderModule),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
27220}
27221
27222pub fn ConstructorEnabled<D: DomTypes>
27223(aCx: SafeJSContext, aObj: HandleObject) -> bool{
27224 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
27225 pref!(dom_webgpu_enabled)
27226}
27227
27228unsafe fn CreateInterfaceObjects<D: DomTypes>
27229(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
27230
27231 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
27232 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
27233 assert!(!prototype_proto.is_null());
27234
27235 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
27236 create_interface_prototype_object::<D>(cx,
27237 global,
27238 prototype_proto.handle(),
27239 &PrototypeClass,
27240 sMethods.get(),
27241 sAttributes.get(),
27242 &[],
27243 &[],
27244 prototype.handle_mut());
27245 assert!(!prototype.is_null());
27246 assert!((*cache)[PrototypeList::ID::GPUShaderModule as usize].is_null());
27247 (*cache)[PrototypeList::ID::GPUShaderModule as usize] = prototype.get();
27248 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUShaderModule as isize),
27249 ptr::null_mut(),
27250 prototype.get());
27251
27252 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
27253 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
27254
27255 assert!(!interface_proto.is_null());
27256
27257 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
27258 create_noncallback_interface_object::<D>(cx,
27259 global,
27260 interface_proto.handle(),
27261 INTERFACE_OBJECT_CLASS.get(),
27262 &[],
27263 &[],
27264 &[],
27265 prototype.handle(),
27266 c"GPUShaderModule",
27267 0,
27268 &[],
27269 interface.handle_mut());
27270 assert!(!interface.is_null());
27271}
27272
27273
27274 pub(crate) fn init_statics<D: DomTypes>() {
27275 init_interface_object::<D>();
27276 init_domjs_class::<D>();
27277 crate::codegen::GenericBindings::WebGPUBinding::GPUShaderModule_Binding::init_getCompilationInfo_methodinfo::<D>();
27278 init_label_getterinfo::<D>();
27279 init_label_setterinfo::<D>();
27280
27281 init_sMethods_specs::<D>();
27282init_sMethods_prefs::<D>();
27283init_sAttributes_specs::<D>();
27284init_sAttributes_prefs::<D>();
27285 }
27286 } pub use self::GPUShaderStage_Binding::{GPUShaderStageConstants, Wrap as GPUShaderStageWrap, GetProtoObject as GPUShaderStageGetProtoObject, DefineDOMInterface as GPUShaderStageDefineDOMInterface};
27290pub mod GPUShaderStage_Binding {
27291use crate::import::module::*;
27292
27293unsafe extern "C" fn _finalize<D: DomTypes>
27294(_cx: *mut GCContext, obj: *mut JSObject){
27295 wrap_panic(&mut || {
27296
27297 let this = native_from_object_static::<D::GPUShaderStage>(obj).unwrap();
27298 finalize_common(this);
27299 })
27300}
27301
27302unsafe extern "C" fn _trace<D: DomTypes>
27303(trc: *mut JSTracer, obj: *mut JSObject){
27304 wrap_panic(&mut || {
27305
27306 let this = native_from_object_static::<D::GPUShaderStage>(obj).unwrap();
27307 if this.is_null() { return; } (*this).trace(trc);
27309 })
27310}
27311
27312pub mod GPUShaderStageConstants {
27313 pub const VERTEX: u32 = 1;
27314 pub const FRAGMENT: u32 = 2;
27315 pub const COMPUTE: u32 = 4;
27316} static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
27319
27320pub(crate) fn init_class_ops<D: DomTypes>() {
27321 CLASS_OPS.set(JSClassOps {
27322 addProperty: None,
27323 delProperty: None,
27324 enumerate: None,
27325 newEnumerate: None,
27326 resolve: None,
27327 mayResolve: None,
27328 finalize: Some(_finalize::<D>),
27329 call: None,
27330 construct: None,
27331 trace: Some(_trace::<D>),
27332 });
27333}
27334
27335pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
27336
27337pub(crate) fn init_domjs_class<D: DomTypes>() {
27338 init_class_ops::<D>();
27339 Class.set(DOMJSClass {
27340 base: JSClass {
27341 name: c"GPUShaderStage".as_ptr(),
27342 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
27343 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
27344 ,
27345 cOps: unsafe { CLASS_OPS.get() },
27346 spec: ptr::null(),
27347 ext: ptr::null(),
27348 oOps: ptr::null(),
27349 },
27350 dom_class:
27351DOMClass {
27352 interface_chain: [ PrototypeList::ID::GPUShaderStage, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
27353 depth: 0,
27354 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
27355 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUShaderStage> as unsafe fn(&mut _, _) -> _,
27356 global: Globals::EMPTY,
27357},
27358 });
27359}
27360
27361#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
27362(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUShaderStage>, _can_gc: CanGc) -> DomRoot<D::GPUShaderStage>{
27363
27364 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
27365
27366 let scope = scope.reflector().get_jsobject();
27367 assert!(!scope.get().is_null());
27368 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
27369 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
27370
27371 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
27372 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
27373 assert!(!canonical_proto.is_null());
27374
27375
27376 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
27377 if let Some(given) = given_proto {
27378 proto.set(*given);
27379 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
27380 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
27381 }
27382 } else {
27383 proto.set(*canonical_proto);
27384 }
27385 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
27386 cx.raw_cx(),
27387 &Class.get().base,
27388 proto.handle(),
27389 ));
27390 assert!(!obj.is_null());
27391 JS_SetReservedSlot(
27392 obj.get(),
27393 DOM_OBJECT_SLOT,
27394 &PrivateValue(raw.as_ptr() as *const libc::c_void),
27395 );
27396
27397 let root = raw.reflect_with(obj.get());
27398
27399
27400
27401 DomRoot::from_ref(&*root)
27402}
27403
27404pub trait GPUShaderStageMethods<D: DomTypes> {
27405}
27406static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
27407
27408pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
27409 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
27410 JSPropertySpec {
27411 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
27412 attributes_: (JSPROP_READONLY),
27413 kind_: (JSPropertySpec_Kind::Value),
27414 u: JSPropertySpec_AccessorsOrValue {
27415 value: JSPropertySpec_ValueWrapper {
27416 type_: JSPropertySpec_ValueWrapper_Type::String,
27417 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
27418 string: c"GPUShaderStage".as_ptr(),
27419 }
27420 }
27421 }
27422 }
27423,
27424 JSPropertySpec::ZERO]))[..]
27425])));
27426}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
27427
27428pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
27429 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[0])])));
27430}static sConstants_specs: ThreadUnsafeOnceLock<&[&[ConstantSpec]]> = ThreadUnsafeOnceLock::new();
27431
27432pub(crate) fn init_sConstants_specs<D: DomTypes>() {
27433 sConstants_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
27434 ConstantSpec { name: c"VERTEX", value: ConstantVal::Uint(1) },
27435 ConstantSpec { name: c"FRAGMENT", value: ConstantVal::Uint(2) },
27436 ConstantSpec { name: c"COMPUTE", value: ConstantVal::Uint(4) }]))[..]
27437])));
27438}static sConstants: ThreadUnsafeOnceLock<&[Guard<&[ConstantSpec]>]> = ThreadUnsafeOnceLock::new();
27439
27440pub(crate) fn init_sConstants_prefs<D: DomTypes>() {
27441 sConstants.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sConstants_specs.get() })[0])])));
27442}
27443pub fn GetProtoObject<D: DomTypes>
27444(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
27445 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUShaderStage), CreateInterfaceObjects::<D>, rval)
27447}
27448
27449
27450static PrototypeClass: JSClass = JSClass {
27451 name: c"GPUShaderStagePrototype".as_ptr(),
27452 flags:
27453 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
27455 cOps: ptr::null(),
27456 spec: ptr::null(),
27457 ext: ptr::null(),
27458 oOps: ptr::null(),
27459};
27460
27461
27462static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
27463
27464pub(crate) fn init_interface_object<D: DomTypes>() {
27465 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
27466 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
27467 b"function GPUShaderStage() {\n [native code]\n}",
27468 PrototypeList::ID::GPUShaderStage,
27469 0,
27470 ));
27471}
27472
27473pub fn DefineDOMInterface<D: DomTypes>
27474(cx: SafeJSContext, global: HandleObject){
27475 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUShaderStage),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
27476}
27477
27478pub fn ConstructorEnabled<D: DomTypes>
27479(aCx: SafeJSContext, aObj: HandleObject) -> bool{
27480 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
27481 pref!(dom_webgpu_enabled)
27482}
27483
27484unsafe fn CreateInterfaceObjects<D: DomTypes>
27485(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
27486
27487 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
27488 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
27489 assert!(!prototype_proto.is_null());
27490
27491 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
27492 create_interface_prototype_object::<D>(cx,
27493 global,
27494 prototype_proto.handle(),
27495 &PrototypeClass,
27496 &[],
27497 sAttributes.get(),
27498 sConstants.get(),
27499 &[],
27500 prototype.handle_mut());
27501 assert!(!prototype.is_null());
27502 assert!((*cache)[PrototypeList::ID::GPUShaderStage as usize].is_null());
27503 (*cache)[PrototypeList::ID::GPUShaderStage as usize] = prototype.get();
27504 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUShaderStage as isize),
27505 ptr::null_mut(),
27506 prototype.get());
27507
27508 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
27509 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
27510
27511 assert!(!interface_proto.is_null());
27512
27513 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
27514 create_noncallback_interface_object::<D>(cx,
27515 global,
27516 interface_proto.handle(),
27517 INTERFACE_OBJECT_CLASS.get(),
27518 &[],
27519 &[],
27520 sConstants.get(),
27521 prototype.handle(),
27522 c"GPUShaderStage",
27523 0,
27524 &[],
27525 interface.handle_mut());
27526 assert!(!interface.is_null());
27527}
27528
27529
27530 pub(crate) fn init_statics<D: DomTypes>() {
27531 init_interface_object::<D>();
27532 init_domjs_class::<D>();
27533
27534
27535
27536
27537 init_sAttributes_specs::<D>();
27538init_sAttributes_prefs::<D>();
27539init_sConstants_specs::<D>();
27540init_sConstants_prefs::<D>();
27541 }
27542 } pub use self::GPUSupportedFeatures_Binding::{Wrap as GPUSupportedFeaturesWrap, GPUSupportedFeaturesMethods, GetProtoObject as GPUSupportedFeaturesGetProtoObject, DefineDOMInterface as GPUSupportedFeaturesDefineDOMInterface};
27546pub mod GPUSupportedFeatures_Binding {
27547use crate::import::module::*;
27548
27549unsafe extern "C" fn get_size<D: DomTypes>
27550(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
27551 let mut result = false;
27552 wrap_panic(&mut || result = (|| {
27553 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
27554 let this = &*(this as *const D::GPUSupportedFeatures);
27555 let result: u32 = this.Size();
27556
27557 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
27558 return true;
27559 })());
27560 result
27561}
27562
27563
27564static size_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
27565
27566pub(crate) fn init_size_getterinfo<D: DomTypes>() {
27567 size_getterinfo.set(JSJitInfo {
27568 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
27569 getter: Some(get_size::<D>)
27570 },
27571 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
27572 protoID: PrototypeList::ID::GPUSupportedFeatures as u16,
27573 },
27574 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
27575 _bitfield_align_1: [],
27576 _bitfield_1: __BindgenBitfieldUnit::new(
27577 new_jsjitinfo_bitfield_1!(
27578 JSJitInfo_OpType::Getter as u8,
27579 JSJitInfo_AliasSet::AliasEverything as u8,
27580 JSValueType::JSVAL_TYPE_DOUBLE as u8,
27581 true,
27582 false,
27583 false,
27584 false,
27585 false,
27586 false,
27587 0,
27588 ).to_ne_bytes()
27589 ),
27590});
27591}
27592unsafe extern "C" fn entries<D: DomTypes>
27593(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
27594 let mut result = false;
27595 wrap_panic(&mut || result = (|| {
27596 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
27597 let this = &*(this as *const D::GPUSupportedFeatures);
27598 let args = &*args;
27599 let argc = args.argc_;
27600 let realm = AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx()));
27601 let result = crate::iterable::IterableIterator::new(this, IteratorType::Entries, InRealm::already(&realm));
27602
27603
27604 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
27605 return true;
27606 })());
27607 result
27608}
27609
27610const entries_methodinfo_argTypes: [i32; 1] = [ JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
27611static entries_methodinfo: ThreadUnsafeOnceLock<JSTypedMethodJitInfo> = ThreadUnsafeOnceLock::new();
27612
27613pub(crate) fn init_entries_methodinfo<D: DomTypes>() {
27614 entries_methodinfo.set(JSTypedMethodJitInfo {
27615 base: JSJitInfo {
27616 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
27617 method: Some(entries::<D>)
27618 },
27619 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
27620 protoID: PrototypeList::ID::GPUSupportedFeatures as u16,
27621 },
27622 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
27623 _bitfield_align_1: [],
27624 _bitfield_1: __BindgenBitfieldUnit::new(
27625 new_jsjitinfo_bitfield_1!(
27626 JSJitInfo_OpType::Method as u8,
27627 JSJitInfo_AliasSet::AliasEverything as u8,
27628 JSValueType::JSVAL_TYPE_OBJECT as u8,
27629 false,
27630 false,
27631 false,
27632 false,
27633 false,
27634 true,
27635 0,
27636 ).to_ne_bytes()
27637 ),
27638 },
27639 argTypes: &entries_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
27640 });
27641}
27642
27643unsafe extern "C" fn keys<D: DomTypes>
27644(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
27645 let mut result = false;
27646 wrap_panic(&mut || result = (|| {
27647 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
27648 let this = &*(this as *const D::GPUSupportedFeatures);
27649 let args = &*args;
27650 let argc = args.argc_;
27651 let realm = AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx()));
27652 let result = crate::iterable::IterableIterator::new(this, IteratorType::Keys, InRealm::already(&realm));
27653
27654
27655 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
27656 return true;
27657 })());
27658 result
27659}
27660
27661const keys_methodinfo_argTypes: [i32; 1] = [ JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
27662static keys_methodinfo: ThreadUnsafeOnceLock<JSTypedMethodJitInfo> = ThreadUnsafeOnceLock::new();
27663
27664pub(crate) fn init_keys_methodinfo<D: DomTypes>() {
27665 keys_methodinfo.set(JSTypedMethodJitInfo {
27666 base: JSJitInfo {
27667 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
27668 method: Some(keys::<D>)
27669 },
27670 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
27671 protoID: PrototypeList::ID::GPUSupportedFeatures as u16,
27672 },
27673 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
27674 _bitfield_align_1: [],
27675 _bitfield_1: __BindgenBitfieldUnit::new(
27676 new_jsjitinfo_bitfield_1!(
27677 JSJitInfo_OpType::Method as u8,
27678 JSJitInfo_AliasSet::AliasEverything as u8,
27679 JSValueType::JSVAL_TYPE_OBJECT as u8,
27680 false,
27681 false,
27682 false,
27683 false,
27684 false,
27685 true,
27686 0,
27687 ).to_ne_bytes()
27688 ),
27689 },
27690 argTypes: &keys_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
27691 });
27692}
27693
27694unsafe extern "C" fn values<D: DomTypes>
27695(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
27696 let mut result = false;
27697 wrap_panic(&mut || result = (|| {
27698 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
27699 let this = &*(this as *const D::GPUSupportedFeatures);
27700 let args = &*args;
27701 let argc = args.argc_;
27702 let realm = AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx()));
27703 let result = crate::iterable::IterableIterator::new(this, IteratorType::Values, InRealm::already(&realm));
27704
27705
27706 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
27707 return true;
27708 })());
27709 result
27710}
27711
27712const values_methodinfo_argTypes: [i32; 1] = [ JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
27713static values_methodinfo: ThreadUnsafeOnceLock<JSTypedMethodJitInfo> = ThreadUnsafeOnceLock::new();
27714
27715pub(crate) fn init_values_methodinfo<D: DomTypes>() {
27716 values_methodinfo.set(JSTypedMethodJitInfo {
27717 base: JSJitInfo {
27718 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
27719 method: Some(values::<D>)
27720 },
27721 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
27722 protoID: PrototypeList::ID::GPUSupportedFeatures as u16,
27723 },
27724 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
27725 _bitfield_align_1: [],
27726 _bitfield_1: __BindgenBitfieldUnit::new(
27727 new_jsjitinfo_bitfield_1!(
27728 JSJitInfo_OpType::Method as u8,
27729 JSJitInfo_AliasSet::AliasEverything as u8,
27730 JSValueType::JSVAL_TYPE_OBJECT as u8,
27731 false,
27732 false,
27733 false,
27734 false,
27735 false,
27736 true,
27737 0,
27738 ).to_ne_bytes()
27739 ),
27740 },
27741 argTypes: &values_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
27742 });
27743}
27744
27745unsafe extern "C" fn forEach<D: DomTypes>
27746(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
27747 let mut result = false;
27748 wrap_panic(&mut || result = (|| {
27749 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
27750 let this = &*(this as *const D::GPUSupportedFeatures);
27751 let args = &*args;
27752 let argc = args.argc_;
27753
27754 if argc < 1 {
27755 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUSupportedFeatures.forEach\".");
27756 return false;
27757 }
27758 let arg0: *mut JSObject = if HandleValue::from_raw(args.get(0)).get().is_object() {
27759 HandleValue::from_raw(args.get(0)).get().to_object()
27760 } else {
27761 throw_type_error(cx.raw_cx(), "Value is not an object.");
27762 return false;
27763
27764 };
27765 let arg1: HandleValue = if args.get(1).is_undefined() {
27766 HandleValue::undefined()
27767 } else {
27768 HandleValue::from_raw(args.get(1))
27769 };
27770 if !IsCallable(arg0) {
27771 throw_type_error(cx.raw_cx(), "Argument 1 of GPUSupportedFeatures.forEach is not callable.");
27772 return false;
27773 }
27774 rooted!(&in(cx) let arg0 = ObjectValue(arg0));
27775 rooted!(&in(cx) let mut call_arg1 = UndefinedValue());
27776 rooted!(&in(cx) let mut call_arg2 = UndefinedValue());
27777 rooted_vec!(let mut call_args);
27778 call_args.push(UndefinedValue());
27779 call_args.push(UndefinedValue());
27780 call_args.push(ObjectValue(*_obj));
27781 rooted!(&in(cx) let mut ignoredReturnVal = UndefinedValue());
27782
27783 let mut i = 0;
27791 while i < (*this).get_iterable_length() {
27792 (*this).get_value_at_index(i).to_jsval(cx.raw_cx(), call_arg1.handle_mut());
27793 (*this).get_key_at_index(i).to_jsval(cx.raw_cx(), call_arg2.handle_mut());
27794 call_args[0] = call_arg1.handle().get();
27795 call_args[1] = call_arg2.handle().get();
27796 let call_args_handle = HandleValueArray::from(&call_args);
27797 if !Call(cx.raw_cx(), arg1, arg0.handle(), &call_args_handle,
27798 ignoredReturnVal.handle_mut()) {
27799 return false;
27800 }
27801
27802 i += 1;
27803 }
27804
27805 let result = ();
27806
27807
27808 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
27809 return true;
27810 })());
27811 result
27812}
27813
27814
27815static forEach_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
27816
27817pub(crate) fn init_forEach_methodinfo<D: DomTypes>() {
27818 forEach_methodinfo.set(JSJitInfo {
27819 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
27820 method: Some(forEach::<D>)
27821 },
27822 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
27823 protoID: PrototypeList::ID::GPUSupportedFeatures as u16,
27824 },
27825 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
27826 _bitfield_align_1: [],
27827 _bitfield_1: __BindgenBitfieldUnit::new(
27828 new_jsjitinfo_bitfield_1!(
27829 JSJitInfo_OpType::Method as u8,
27830 JSJitInfo_AliasSet::AliasEverything as u8,
27831 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
27832 false,
27833 false,
27834 false,
27835 false,
27836 false,
27837 false,
27838 0,
27839 ).to_ne_bytes()
27840 ),
27841});
27842}
27843unsafe extern "C" fn has<D: DomTypes>
27844(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
27845 let mut result = false;
27846 wrap_panic(&mut || result = (|| {
27847 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
27848 let this = &*(this as *const D::GPUSupportedFeatures);
27849 let args = &*args;
27850 let argc = args.argc_;
27851
27852 if argc < 1 {
27853 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUSupportedFeatures.has\".");
27854 return false;
27855 }
27856 let arg0: DOMString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
27857 Ok(ConversionResult::Success(value)) => value,
27858 Ok(ConversionResult::Failure(error)) => {
27859 throw_type_error(cx.raw_cx(), &error);
27860 return false;
27861
27862 }
27863 _ => {
27864 return false;
27865
27866 },
27867 }
27868 ;
27869 let result = Setlike::has(this, arg0);
27870
27871
27872 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
27873 return true;
27874 })());
27875 result
27876}
27877
27878const has_methodinfo_argTypes: [i32; 2] = [ JSJitInfo_ArgType::String as i32, JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
27879static has_methodinfo: ThreadUnsafeOnceLock<JSTypedMethodJitInfo> = ThreadUnsafeOnceLock::new();
27880
27881pub(crate) fn init_has_methodinfo<D: DomTypes>() {
27882 has_methodinfo.set(JSTypedMethodJitInfo {
27883 base: JSJitInfo {
27884 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
27885 method: Some(has::<D>)
27886 },
27887 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
27888 protoID: PrototypeList::ID::GPUSupportedFeatures as u16,
27889 },
27890 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
27891 _bitfield_align_1: [],
27892 _bitfield_1: __BindgenBitfieldUnit::new(
27893 new_jsjitinfo_bitfield_1!(
27894 JSJitInfo_OpType::Method as u8,
27895 JSJitInfo_AliasSet::AliasDOMSets as u8,
27896 JSValueType::JSVAL_TYPE_BOOLEAN as u8,
27897 false,
27898 false,
27899 false,
27900 false,
27901 false,
27902 true,
27903 0,
27904 ).to_ne_bytes()
27905 ),
27906 },
27907 argTypes: &has_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
27908 });
27909}
27910
27911unsafe extern "C" fn _finalize<D: DomTypes>
27912(_cx: *mut GCContext, obj: *mut JSObject){
27913 wrap_panic(&mut || {
27914
27915 let this = native_from_object_static::<D::GPUSupportedFeatures>(obj).unwrap();
27916 finalize_common(this);
27917 })
27918}
27919
27920unsafe extern "C" fn _trace<D: DomTypes>
27921(trc: *mut JSTracer, obj: *mut JSObject){
27922 wrap_panic(&mut || {
27923
27924 let this = native_from_object_static::<D::GPUSupportedFeatures>(obj).unwrap();
27925 if this.is_null() { return; } (*this).trace(trc);
27927 })
27928}
27929
27930
27931static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
27932
27933pub(crate) fn init_class_ops<D: DomTypes>() {
27934 CLASS_OPS.set(JSClassOps {
27935 addProperty: None,
27936 delProperty: None,
27937 enumerate: None,
27938 newEnumerate: None,
27939 resolve: None,
27940 mayResolve: None,
27941 finalize: Some(_finalize::<D>),
27942 call: None,
27943 construct: None,
27944 trace: Some(_trace::<D>),
27945 });
27946}
27947
27948pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
27949
27950pub(crate) fn init_domjs_class<D: DomTypes>() {
27951 init_class_ops::<D>();
27952 Class.set(DOMJSClass {
27953 base: JSClass {
27954 name: c"GPUSupportedFeatures".as_ptr(),
27955 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
27956 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
27957 ,
27958 cOps: unsafe { CLASS_OPS.get() },
27959 spec: ptr::null(),
27960 ext: ptr::null(),
27961 oOps: ptr::null(),
27962 },
27963 dom_class:
27964DOMClass {
27965 interface_chain: [ PrototypeList::ID::GPUSupportedFeatures, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
27966 depth: 0,
27967 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
27968 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUSupportedFeatures> as unsafe fn(&mut _, _) -> _,
27969 global: Globals::EMPTY,
27970},
27971 });
27972}
27973
27974#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
27975(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUSupportedFeatures>, _can_gc: CanGc) -> DomRoot<D::GPUSupportedFeatures>{
27976
27977 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
27978
27979 let scope = scope.reflector().get_jsobject();
27980 assert!(!scope.get().is_null());
27981 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
27982 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
27983
27984 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
27985 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
27986 assert!(!canonical_proto.is_null());
27987
27988
27989 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
27990 if let Some(given) = given_proto {
27991 proto.set(*given);
27992 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
27993 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
27994 }
27995 } else {
27996 proto.set(*canonical_proto);
27997 }
27998 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
27999 cx.raw_cx(),
28000 &Class.get().base,
28001 proto.handle(),
28002 ));
28003 assert!(!obj.is_null());
28004 JS_SetReservedSlot(
28005 obj.get(),
28006 DOM_OBJECT_SLOT,
28007 &PrivateValue(raw.as_ptr() as *const libc::c_void),
28008 );
28009
28010 let root = raw.reflect_with(obj.get());
28011
28012
28013
28014 DomRoot::from_ref(&*root)
28015}
28016
28017pub trait GPUSupportedFeaturesMethods<D: DomTypes> {
28018 fn Size(&self, ) -> u32;
28019}
28020static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
28021
28022pub(crate) fn init_sMethods_specs<D: DomTypes>() {
28023 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
28024 JSFunctionSpec {
28025 name: JSPropertySpec_Name { string_: c"entries".as_ptr() },
28026 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { entries_methodinfo.get() } as *const _ as *const JSJitInfo },
28027 nargs: 0,
28028 flags: (JSPROP_ENUMERATE) as u16,
28029 selfHostedName: ptr::null()
28030 },
28031 JSFunctionSpec {
28032 name: JSPropertySpec_Name { string_: c"keys".as_ptr() },
28033 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { keys_methodinfo.get() } as *const _ as *const JSJitInfo },
28034 nargs: 0,
28035 flags: (JSPROP_ENUMERATE) as u16,
28036 selfHostedName: ptr::null()
28037 },
28038 JSFunctionSpec {
28039 name: JSPropertySpec_Name { string_: c"values".as_ptr() },
28040 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { values_methodinfo.get() } as *const _ as *const JSJitInfo },
28041 nargs: 0,
28042 flags: (JSPROP_ENUMERATE) as u16,
28043 selfHostedName: ptr::null()
28044 },
28045 JSFunctionSpec {
28046 name: JSPropertySpec_Name { string_: c"forEach".as_ptr() },
28047 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { forEach_methodinfo.get() } as *const _ as *const JSJitInfo },
28048 nargs: 1,
28049 flags: (JSPROP_ENUMERATE) as u16,
28050 selfHostedName: ptr::null()
28051 },
28052 JSFunctionSpec {
28053 name: JSPropertySpec_Name { string_: c"has".as_ptr() },
28054 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { has_methodinfo.get() } as *const _ as *const JSJitInfo },
28055 nargs: 1,
28056 flags: (JSPROP_ENUMERATE) as u16,
28057 selfHostedName: ptr::null()
28058 },
28059 JSFunctionSpec {
28060 name: JSPropertySpec_Name { string_: ptr::null() },
28061 call: JSNativeWrapper { op: None, info: ptr::null() },
28062 nargs: 0,
28063 flags: 0,
28064 selfHostedName: ptr::null()
28065 }]))[..]
28066])));
28067}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
28068
28069pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
28070 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sMethods_specs.get() })[0])])));
28071}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
28072
28073pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
28074 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
28075 JSPropertySpec {
28076 name: JSPropertySpec_Name { string_: c"size".as_ptr() },
28077 attributes_: (JSPROP_ENUMERATE),
28078 kind_: (JSPropertySpec_Kind::NativeAccessor),
28079 u: JSPropertySpec_AccessorsOrValue {
28080 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
28081 getter: JSPropertySpec_Accessor {
28082 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { size_getterinfo.get() } },
28083 },
28084 setter: JSPropertySpec_Accessor {
28085 native: JSNativeWrapper { op: None, info: ptr::null() },
28086 }
28087 }
28088 }
28089 }
28090,
28091 JSPropertySpec::ZERO]))[..]
28092,
28093&Box::leak(Box::new([
28094 JSPropertySpec {
28095 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
28096 attributes_: (JSPROP_READONLY),
28097 kind_: (JSPropertySpec_Kind::Value),
28098 u: JSPropertySpec_AccessorsOrValue {
28099 value: JSPropertySpec_ValueWrapper {
28100 type_: JSPropertySpec_ValueWrapper_Type::String,
28101 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
28102 string: c"GPUSupportedFeatures".as_ptr(),
28103 }
28104 }
28105 }
28106 }
28107,
28108 JSPropertySpec::ZERO]))[..]
28109])));
28110}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
28111
28112pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
28113 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
28114 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
28115}
28116pub fn GetProtoObject<D: DomTypes>
28117(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
28118 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUSupportedFeatures), CreateInterfaceObjects::<D>, rval)
28120}
28121
28122
28123static PrototypeClass: JSClass = JSClass {
28124 name: c"GPUSupportedFeaturesPrototype".as_ptr(),
28125 flags:
28126 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
28128 cOps: ptr::null(),
28129 spec: ptr::null(),
28130 ext: ptr::null(),
28131 oOps: ptr::null(),
28132};
28133
28134
28135static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
28136
28137pub(crate) fn init_interface_object<D: DomTypes>() {
28138 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
28139 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
28140 b"function GPUSupportedFeatures() {\n [native code]\n}",
28141 PrototypeList::ID::GPUSupportedFeatures,
28142 0,
28143 ));
28144}
28145
28146pub fn DefineDOMInterface<D: DomTypes>
28147(cx: SafeJSContext, global: HandleObject){
28148 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUSupportedFeatures),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
28149}
28150
28151pub fn ConstructorEnabled<D: DomTypes>
28152(aCx: SafeJSContext, aObj: HandleObject) -> bool{
28153 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
28154 pref!(dom_webgpu_enabled)
28155}
28156
28157unsafe fn CreateInterfaceObjects<D: DomTypes>
28158(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
28159
28160 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
28161 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
28162 assert!(!prototype_proto.is_null());
28163
28164 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
28165 create_interface_prototype_object::<D>(cx,
28166 global,
28167 prototype_proto.handle(),
28168 &PrototypeClass,
28169 sMethods.get(),
28170 sAttributes.get(),
28171 &[],
28172 &[],
28173 prototype.handle_mut());
28174 assert!(!prototype.is_null());
28175 assert!((*cache)[PrototypeList::ID::GPUSupportedFeatures as usize].is_null());
28176 (*cache)[PrototypeList::ID::GPUSupportedFeatures as usize] = prototype.get();
28177 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUSupportedFeatures as isize),
28178 ptr::null_mut(),
28179 prototype.get());
28180
28181 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
28182 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
28183
28184 assert!(!interface_proto.is_null());
28185
28186 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
28187 create_noncallback_interface_object::<D>(cx,
28188 global,
28189 interface_proto.handle(),
28190 INTERFACE_OBJECT_CLASS.get(),
28191 &[],
28192 &[],
28193 &[],
28194 prototype.handle(),
28195 c"GPUSupportedFeatures",
28196 0,
28197 &[],
28198 interface.handle_mut());
28199 assert!(!interface.is_null());
28200 rooted!(&in(cx) let mut aliasedVal = UndefinedValue());
28203
28204 assert!(JS_GetProperty(cx.raw_cx(), prototype.handle(),
28205 c"values".as_ptr() as *const u8 as *const _,
28206 aliasedVal.handle_mut()));
28207 rooted!(&in(cx) let mut iteratorId: jsid);
28208 RUST_SYMBOL_TO_JSID(GetWellKnownSymbol(cx.raw_cx(), SymbolCode::iterator), iteratorId.handle_mut());
28209
28210 assert!(JS_DefinePropertyById2(cx.raw_cx(), prototype.handle(), iteratorId.handle(), aliasedVal.handle(), 0));
28211
28212}
28213
28214
28215 pub(crate) fn init_statics<D: DomTypes>() {
28216 init_interface_object::<D>();
28217 init_domjs_class::<D>();
28218 crate::codegen::GenericBindings::WebGPUBinding::GPUSupportedFeatures_Binding::init_entries_methodinfo::<D>();
28219crate::codegen::GenericBindings::WebGPUBinding::GPUSupportedFeatures_Binding::init_keys_methodinfo::<D>();
28220crate::codegen::GenericBindings::WebGPUBinding::GPUSupportedFeatures_Binding::init_values_methodinfo::<D>();
28221crate::codegen::GenericBindings::WebGPUBinding::GPUSupportedFeatures_Binding::init_forEach_methodinfo::<D>();
28222crate::codegen::GenericBindings::WebGPUBinding::GPUSupportedFeatures_Binding::init_has_methodinfo::<D>();
28223 init_size_getterinfo::<D>();
28224
28225
28226 init_sMethods_specs::<D>();
28227init_sMethods_prefs::<D>();
28228init_sAttributes_specs::<D>();
28229init_sAttributes_prefs::<D>();
28230 }
28231 } pub use self::GPUSupportedLimits_Binding::{Wrap as GPUSupportedLimitsWrap, GPUSupportedLimitsMethods, GetProtoObject as GPUSupportedLimitsGetProtoObject, DefineDOMInterface as GPUSupportedLimitsDefineDOMInterface};
28235pub mod GPUSupportedLimits_Binding {
28236use crate::import::module::*;
28237
28238unsafe extern "C" fn get_maxTextureDimension1D<D: DomTypes>
28239(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
28240 let mut result = false;
28241 wrap_panic(&mut || result = (|| {
28242 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
28243 let this = &*(this as *const D::GPUSupportedLimits);
28244 let result: u32 = this.MaxTextureDimension1D();
28245
28246 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
28247 return true;
28248 })());
28249 result
28250}
28251
28252
28253static maxTextureDimension1D_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
28254
28255pub(crate) fn init_maxTextureDimension1D_getterinfo<D: DomTypes>() {
28256 maxTextureDimension1D_getterinfo.set(JSJitInfo {
28257 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
28258 getter: Some(get_maxTextureDimension1D::<D>)
28259 },
28260 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
28261 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
28262 },
28263 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
28264 _bitfield_align_1: [],
28265 _bitfield_1: __BindgenBitfieldUnit::new(
28266 new_jsjitinfo_bitfield_1!(
28267 JSJitInfo_OpType::Getter as u8,
28268 JSJitInfo_AliasSet::AliasEverything as u8,
28269 JSValueType::JSVAL_TYPE_DOUBLE as u8,
28270 true,
28271 false,
28272 false,
28273 false,
28274 false,
28275 false,
28276 0,
28277 ).to_ne_bytes()
28278 ),
28279});
28280}
28281unsafe extern "C" fn get_maxTextureDimension2D<D: DomTypes>
28282(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
28283 let mut result = false;
28284 wrap_panic(&mut || result = (|| {
28285 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
28286 let this = &*(this as *const D::GPUSupportedLimits);
28287 let result: u32 = this.MaxTextureDimension2D();
28288
28289 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
28290 return true;
28291 })());
28292 result
28293}
28294
28295
28296static maxTextureDimension2D_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
28297
28298pub(crate) fn init_maxTextureDimension2D_getterinfo<D: DomTypes>() {
28299 maxTextureDimension2D_getterinfo.set(JSJitInfo {
28300 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
28301 getter: Some(get_maxTextureDimension2D::<D>)
28302 },
28303 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
28304 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
28305 },
28306 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
28307 _bitfield_align_1: [],
28308 _bitfield_1: __BindgenBitfieldUnit::new(
28309 new_jsjitinfo_bitfield_1!(
28310 JSJitInfo_OpType::Getter as u8,
28311 JSJitInfo_AliasSet::AliasEverything as u8,
28312 JSValueType::JSVAL_TYPE_DOUBLE as u8,
28313 true,
28314 false,
28315 false,
28316 false,
28317 false,
28318 false,
28319 0,
28320 ).to_ne_bytes()
28321 ),
28322});
28323}
28324unsafe extern "C" fn get_maxTextureDimension3D<D: DomTypes>
28325(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
28326 let mut result = false;
28327 wrap_panic(&mut || result = (|| {
28328 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
28329 let this = &*(this as *const D::GPUSupportedLimits);
28330 let result: u32 = this.MaxTextureDimension3D();
28331
28332 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
28333 return true;
28334 })());
28335 result
28336}
28337
28338
28339static maxTextureDimension3D_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
28340
28341pub(crate) fn init_maxTextureDimension3D_getterinfo<D: DomTypes>() {
28342 maxTextureDimension3D_getterinfo.set(JSJitInfo {
28343 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
28344 getter: Some(get_maxTextureDimension3D::<D>)
28345 },
28346 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
28347 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
28348 },
28349 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
28350 _bitfield_align_1: [],
28351 _bitfield_1: __BindgenBitfieldUnit::new(
28352 new_jsjitinfo_bitfield_1!(
28353 JSJitInfo_OpType::Getter as u8,
28354 JSJitInfo_AliasSet::AliasEverything as u8,
28355 JSValueType::JSVAL_TYPE_DOUBLE as u8,
28356 true,
28357 false,
28358 false,
28359 false,
28360 false,
28361 false,
28362 0,
28363 ).to_ne_bytes()
28364 ),
28365});
28366}
28367unsafe extern "C" fn get_maxTextureArrayLayers<D: DomTypes>
28368(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
28369 let mut result = false;
28370 wrap_panic(&mut || result = (|| {
28371 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
28372 let this = &*(this as *const D::GPUSupportedLimits);
28373 let result: u32 = this.MaxTextureArrayLayers();
28374
28375 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
28376 return true;
28377 })());
28378 result
28379}
28380
28381
28382static maxTextureArrayLayers_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
28383
28384pub(crate) fn init_maxTextureArrayLayers_getterinfo<D: DomTypes>() {
28385 maxTextureArrayLayers_getterinfo.set(JSJitInfo {
28386 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
28387 getter: Some(get_maxTextureArrayLayers::<D>)
28388 },
28389 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
28390 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
28391 },
28392 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
28393 _bitfield_align_1: [],
28394 _bitfield_1: __BindgenBitfieldUnit::new(
28395 new_jsjitinfo_bitfield_1!(
28396 JSJitInfo_OpType::Getter as u8,
28397 JSJitInfo_AliasSet::AliasEverything as u8,
28398 JSValueType::JSVAL_TYPE_DOUBLE as u8,
28399 true,
28400 false,
28401 false,
28402 false,
28403 false,
28404 false,
28405 0,
28406 ).to_ne_bytes()
28407 ),
28408});
28409}
28410unsafe extern "C" fn get_maxBindGroups<D: DomTypes>
28411(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
28412 let mut result = false;
28413 wrap_panic(&mut || result = (|| {
28414 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
28415 let this = &*(this as *const D::GPUSupportedLimits);
28416 let result: u32 = this.MaxBindGroups();
28417
28418 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
28419 return true;
28420 })());
28421 result
28422}
28423
28424
28425static maxBindGroups_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
28426
28427pub(crate) fn init_maxBindGroups_getterinfo<D: DomTypes>() {
28428 maxBindGroups_getterinfo.set(JSJitInfo {
28429 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
28430 getter: Some(get_maxBindGroups::<D>)
28431 },
28432 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
28433 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
28434 },
28435 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
28436 _bitfield_align_1: [],
28437 _bitfield_1: __BindgenBitfieldUnit::new(
28438 new_jsjitinfo_bitfield_1!(
28439 JSJitInfo_OpType::Getter as u8,
28440 JSJitInfo_AliasSet::AliasEverything as u8,
28441 JSValueType::JSVAL_TYPE_DOUBLE as u8,
28442 true,
28443 false,
28444 false,
28445 false,
28446 false,
28447 false,
28448 0,
28449 ).to_ne_bytes()
28450 ),
28451});
28452}
28453unsafe extern "C" fn get_maxBindGroupsPlusVertexBuffers<D: DomTypes>
28454(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
28455 let mut result = false;
28456 wrap_panic(&mut || result = (|| {
28457 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
28458 let this = &*(this as *const D::GPUSupportedLimits);
28459 let result: u32 = this.MaxBindGroupsPlusVertexBuffers();
28460
28461 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
28462 return true;
28463 })());
28464 result
28465}
28466
28467
28468static maxBindGroupsPlusVertexBuffers_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
28469
28470pub(crate) fn init_maxBindGroupsPlusVertexBuffers_getterinfo<D: DomTypes>() {
28471 maxBindGroupsPlusVertexBuffers_getterinfo.set(JSJitInfo {
28472 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
28473 getter: Some(get_maxBindGroupsPlusVertexBuffers::<D>)
28474 },
28475 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
28476 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
28477 },
28478 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
28479 _bitfield_align_1: [],
28480 _bitfield_1: __BindgenBitfieldUnit::new(
28481 new_jsjitinfo_bitfield_1!(
28482 JSJitInfo_OpType::Getter as u8,
28483 JSJitInfo_AliasSet::AliasEverything as u8,
28484 JSValueType::JSVAL_TYPE_DOUBLE as u8,
28485 true,
28486 false,
28487 false,
28488 false,
28489 false,
28490 false,
28491 0,
28492 ).to_ne_bytes()
28493 ),
28494});
28495}
28496unsafe extern "C" fn get_maxBindingsPerBindGroup<D: DomTypes>
28497(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
28498 let mut result = false;
28499 wrap_panic(&mut || result = (|| {
28500 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
28501 let this = &*(this as *const D::GPUSupportedLimits);
28502 let result: u32 = this.MaxBindingsPerBindGroup();
28503
28504 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
28505 return true;
28506 })());
28507 result
28508}
28509
28510
28511static maxBindingsPerBindGroup_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
28512
28513pub(crate) fn init_maxBindingsPerBindGroup_getterinfo<D: DomTypes>() {
28514 maxBindingsPerBindGroup_getterinfo.set(JSJitInfo {
28515 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
28516 getter: Some(get_maxBindingsPerBindGroup::<D>)
28517 },
28518 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
28519 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
28520 },
28521 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
28522 _bitfield_align_1: [],
28523 _bitfield_1: __BindgenBitfieldUnit::new(
28524 new_jsjitinfo_bitfield_1!(
28525 JSJitInfo_OpType::Getter as u8,
28526 JSJitInfo_AliasSet::AliasEverything as u8,
28527 JSValueType::JSVAL_TYPE_DOUBLE as u8,
28528 true,
28529 false,
28530 false,
28531 false,
28532 false,
28533 false,
28534 0,
28535 ).to_ne_bytes()
28536 ),
28537});
28538}
28539unsafe extern "C" fn get_maxDynamicUniformBuffersPerPipelineLayout<D: DomTypes>
28540(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
28541 let mut result = false;
28542 wrap_panic(&mut || result = (|| {
28543 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
28544 let this = &*(this as *const D::GPUSupportedLimits);
28545 let result: u32 = this.MaxDynamicUniformBuffersPerPipelineLayout();
28546
28547 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
28548 return true;
28549 })());
28550 result
28551}
28552
28553
28554static maxDynamicUniformBuffersPerPipelineLayout_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
28555
28556pub(crate) fn init_maxDynamicUniformBuffersPerPipelineLayout_getterinfo<D: DomTypes>() {
28557 maxDynamicUniformBuffersPerPipelineLayout_getterinfo.set(JSJitInfo {
28558 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
28559 getter: Some(get_maxDynamicUniformBuffersPerPipelineLayout::<D>)
28560 },
28561 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
28562 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
28563 },
28564 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
28565 _bitfield_align_1: [],
28566 _bitfield_1: __BindgenBitfieldUnit::new(
28567 new_jsjitinfo_bitfield_1!(
28568 JSJitInfo_OpType::Getter as u8,
28569 JSJitInfo_AliasSet::AliasEverything as u8,
28570 JSValueType::JSVAL_TYPE_DOUBLE as u8,
28571 true,
28572 false,
28573 false,
28574 false,
28575 false,
28576 false,
28577 0,
28578 ).to_ne_bytes()
28579 ),
28580});
28581}
28582unsafe extern "C" fn get_maxDynamicStorageBuffersPerPipelineLayout<D: DomTypes>
28583(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
28584 let mut result = false;
28585 wrap_panic(&mut || result = (|| {
28586 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
28587 let this = &*(this as *const D::GPUSupportedLimits);
28588 let result: u32 = this.MaxDynamicStorageBuffersPerPipelineLayout();
28589
28590 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
28591 return true;
28592 })());
28593 result
28594}
28595
28596
28597static maxDynamicStorageBuffersPerPipelineLayout_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
28598
28599pub(crate) fn init_maxDynamicStorageBuffersPerPipelineLayout_getterinfo<D: DomTypes>() {
28600 maxDynamicStorageBuffersPerPipelineLayout_getterinfo.set(JSJitInfo {
28601 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
28602 getter: Some(get_maxDynamicStorageBuffersPerPipelineLayout::<D>)
28603 },
28604 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
28605 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
28606 },
28607 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
28608 _bitfield_align_1: [],
28609 _bitfield_1: __BindgenBitfieldUnit::new(
28610 new_jsjitinfo_bitfield_1!(
28611 JSJitInfo_OpType::Getter as u8,
28612 JSJitInfo_AliasSet::AliasEverything as u8,
28613 JSValueType::JSVAL_TYPE_DOUBLE as u8,
28614 true,
28615 false,
28616 false,
28617 false,
28618 false,
28619 false,
28620 0,
28621 ).to_ne_bytes()
28622 ),
28623});
28624}
28625unsafe extern "C" fn get_maxSampledTexturesPerShaderStage<D: DomTypes>
28626(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
28627 let mut result = false;
28628 wrap_panic(&mut || result = (|| {
28629 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
28630 let this = &*(this as *const D::GPUSupportedLimits);
28631 let result: u32 = this.MaxSampledTexturesPerShaderStage();
28632
28633 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
28634 return true;
28635 })());
28636 result
28637}
28638
28639
28640static maxSampledTexturesPerShaderStage_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
28641
28642pub(crate) fn init_maxSampledTexturesPerShaderStage_getterinfo<D: DomTypes>() {
28643 maxSampledTexturesPerShaderStage_getterinfo.set(JSJitInfo {
28644 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
28645 getter: Some(get_maxSampledTexturesPerShaderStage::<D>)
28646 },
28647 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
28648 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
28649 },
28650 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
28651 _bitfield_align_1: [],
28652 _bitfield_1: __BindgenBitfieldUnit::new(
28653 new_jsjitinfo_bitfield_1!(
28654 JSJitInfo_OpType::Getter as u8,
28655 JSJitInfo_AliasSet::AliasEverything as u8,
28656 JSValueType::JSVAL_TYPE_DOUBLE as u8,
28657 true,
28658 false,
28659 false,
28660 false,
28661 false,
28662 false,
28663 0,
28664 ).to_ne_bytes()
28665 ),
28666});
28667}
28668unsafe extern "C" fn get_maxSamplersPerShaderStage<D: DomTypes>
28669(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
28670 let mut result = false;
28671 wrap_panic(&mut || result = (|| {
28672 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
28673 let this = &*(this as *const D::GPUSupportedLimits);
28674 let result: u32 = this.MaxSamplersPerShaderStage();
28675
28676 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
28677 return true;
28678 })());
28679 result
28680}
28681
28682
28683static maxSamplersPerShaderStage_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
28684
28685pub(crate) fn init_maxSamplersPerShaderStage_getterinfo<D: DomTypes>() {
28686 maxSamplersPerShaderStage_getterinfo.set(JSJitInfo {
28687 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
28688 getter: Some(get_maxSamplersPerShaderStage::<D>)
28689 },
28690 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
28691 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
28692 },
28693 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
28694 _bitfield_align_1: [],
28695 _bitfield_1: __BindgenBitfieldUnit::new(
28696 new_jsjitinfo_bitfield_1!(
28697 JSJitInfo_OpType::Getter as u8,
28698 JSJitInfo_AliasSet::AliasEverything as u8,
28699 JSValueType::JSVAL_TYPE_DOUBLE as u8,
28700 true,
28701 false,
28702 false,
28703 false,
28704 false,
28705 false,
28706 0,
28707 ).to_ne_bytes()
28708 ),
28709});
28710}
28711unsafe extern "C" fn get_maxStorageBuffersPerShaderStage<D: DomTypes>
28712(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
28713 let mut result = false;
28714 wrap_panic(&mut || result = (|| {
28715 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
28716 let this = &*(this as *const D::GPUSupportedLimits);
28717 let result: u32 = this.MaxStorageBuffersPerShaderStage();
28718
28719 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
28720 return true;
28721 })());
28722 result
28723}
28724
28725
28726static maxStorageBuffersPerShaderStage_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
28727
28728pub(crate) fn init_maxStorageBuffersPerShaderStage_getterinfo<D: DomTypes>() {
28729 maxStorageBuffersPerShaderStage_getterinfo.set(JSJitInfo {
28730 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
28731 getter: Some(get_maxStorageBuffersPerShaderStage::<D>)
28732 },
28733 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
28734 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
28735 },
28736 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
28737 _bitfield_align_1: [],
28738 _bitfield_1: __BindgenBitfieldUnit::new(
28739 new_jsjitinfo_bitfield_1!(
28740 JSJitInfo_OpType::Getter as u8,
28741 JSJitInfo_AliasSet::AliasEverything as u8,
28742 JSValueType::JSVAL_TYPE_DOUBLE as u8,
28743 true,
28744 false,
28745 false,
28746 false,
28747 false,
28748 false,
28749 0,
28750 ).to_ne_bytes()
28751 ),
28752});
28753}
28754unsafe extern "C" fn get_maxStorageTexturesPerShaderStage<D: DomTypes>
28755(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
28756 let mut result = false;
28757 wrap_panic(&mut || result = (|| {
28758 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
28759 let this = &*(this as *const D::GPUSupportedLimits);
28760 let result: u32 = this.MaxStorageTexturesPerShaderStage();
28761
28762 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
28763 return true;
28764 })());
28765 result
28766}
28767
28768
28769static maxStorageTexturesPerShaderStage_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
28770
28771pub(crate) fn init_maxStorageTexturesPerShaderStage_getterinfo<D: DomTypes>() {
28772 maxStorageTexturesPerShaderStage_getterinfo.set(JSJitInfo {
28773 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
28774 getter: Some(get_maxStorageTexturesPerShaderStage::<D>)
28775 },
28776 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
28777 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
28778 },
28779 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
28780 _bitfield_align_1: [],
28781 _bitfield_1: __BindgenBitfieldUnit::new(
28782 new_jsjitinfo_bitfield_1!(
28783 JSJitInfo_OpType::Getter as u8,
28784 JSJitInfo_AliasSet::AliasEverything as u8,
28785 JSValueType::JSVAL_TYPE_DOUBLE as u8,
28786 true,
28787 false,
28788 false,
28789 false,
28790 false,
28791 false,
28792 0,
28793 ).to_ne_bytes()
28794 ),
28795});
28796}
28797unsafe extern "C" fn get_maxUniformBuffersPerShaderStage<D: DomTypes>
28798(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
28799 let mut result = false;
28800 wrap_panic(&mut || result = (|| {
28801 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
28802 let this = &*(this as *const D::GPUSupportedLimits);
28803 let result: u32 = this.MaxUniformBuffersPerShaderStage();
28804
28805 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
28806 return true;
28807 })());
28808 result
28809}
28810
28811
28812static maxUniformBuffersPerShaderStage_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
28813
28814pub(crate) fn init_maxUniformBuffersPerShaderStage_getterinfo<D: DomTypes>() {
28815 maxUniformBuffersPerShaderStage_getterinfo.set(JSJitInfo {
28816 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
28817 getter: Some(get_maxUniformBuffersPerShaderStage::<D>)
28818 },
28819 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
28820 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
28821 },
28822 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
28823 _bitfield_align_1: [],
28824 _bitfield_1: __BindgenBitfieldUnit::new(
28825 new_jsjitinfo_bitfield_1!(
28826 JSJitInfo_OpType::Getter as u8,
28827 JSJitInfo_AliasSet::AliasEverything as u8,
28828 JSValueType::JSVAL_TYPE_DOUBLE as u8,
28829 true,
28830 false,
28831 false,
28832 false,
28833 false,
28834 false,
28835 0,
28836 ).to_ne_bytes()
28837 ),
28838});
28839}
28840unsafe extern "C" fn get_maxUniformBufferBindingSize<D: DomTypes>
28841(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
28842 let mut result = false;
28843 wrap_panic(&mut || result = (|| {
28844 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
28845 let this = &*(this as *const D::GPUSupportedLimits);
28846 let result: u64 = this.MaxUniformBufferBindingSize();
28847
28848 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
28849 return true;
28850 })());
28851 result
28852}
28853
28854
28855static maxUniformBufferBindingSize_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
28856
28857pub(crate) fn init_maxUniformBufferBindingSize_getterinfo<D: DomTypes>() {
28858 maxUniformBufferBindingSize_getterinfo.set(JSJitInfo {
28859 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
28860 getter: Some(get_maxUniformBufferBindingSize::<D>)
28861 },
28862 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
28863 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
28864 },
28865 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
28866 _bitfield_align_1: [],
28867 _bitfield_1: __BindgenBitfieldUnit::new(
28868 new_jsjitinfo_bitfield_1!(
28869 JSJitInfo_OpType::Getter as u8,
28870 JSJitInfo_AliasSet::AliasEverything as u8,
28871 JSValueType::JSVAL_TYPE_DOUBLE as u8,
28872 true,
28873 false,
28874 false,
28875 false,
28876 false,
28877 false,
28878 0,
28879 ).to_ne_bytes()
28880 ),
28881});
28882}
28883unsafe extern "C" fn get_maxStorageBufferBindingSize<D: DomTypes>
28884(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
28885 let mut result = false;
28886 wrap_panic(&mut || result = (|| {
28887 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
28888 let this = &*(this as *const D::GPUSupportedLimits);
28889 let result: u64 = this.MaxStorageBufferBindingSize();
28890
28891 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
28892 return true;
28893 })());
28894 result
28895}
28896
28897
28898static maxStorageBufferBindingSize_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
28899
28900pub(crate) fn init_maxStorageBufferBindingSize_getterinfo<D: DomTypes>() {
28901 maxStorageBufferBindingSize_getterinfo.set(JSJitInfo {
28902 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
28903 getter: Some(get_maxStorageBufferBindingSize::<D>)
28904 },
28905 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
28906 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
28907 },
28908 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
28909 _bitfield_align_1: [],
28910 _bitfield_1: __BindgenBitfieldUnit::new(
28911 new_jsjitinfo_bitfield_1!(
28912 JSJitInfo_OpType::Getter as u8,
28913 JSJitInfo_AliasSet::AliasEverything as u8,
28914 JSValueType::JSVAL_TYPE_DOUBLE as u8,
28915 true,
28916 false,
28917 false,
28918 false,
28919 false,
28920 false,
28921 0,
28922 ).to_ne_bytes()
28923 ),
28924});
28925}
28926unsafe extern "C" fn get_minUniformBufferOffsetAlignment<D: DomTypes>
28927(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
28928 let mut result = false;
28929 wrap_panic(&mut || result = (|| {
28930 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
28931 let this = &*(this as *const D::GPUSupportedLimits);
28932 let result: u32 = this.MinUniformBufferOffsetAlignment();
28933
28934 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
28935 return true;
28936 })());
28937 result
28938}
28939
28940
28941static minUniformBufferOffsetAlignment_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
28942
28943pub(crate) fn init_minUniformBufferOffsetAlignment_getterinfo<D: DomTypes>() {
28944 minUniformBufferOffsetAlignment_getterinfo.set(JSJitInfo {
28945 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
28946 getter: Some(get_minUniformBufferOffsetAlignment::<D>)
28947 },
28948 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
28949 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
28950 },
28951 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
28952 _bitfield_align_1: [],
28953 _bitfield_1: __BindgenBitfieldUnit::new(
28954 new_jsjitinfo_bitfield_1!(
28955 JSJitInfo_OpType::Getter as u8,
28956 JSJitInfo_AliasSet::AliasEverything as u8,
28957 JSValueType::JSVAL_TYPE_DOUBLE as u8,
28958 true,
28959 false,
28960 false,
28961 false,
28962 false,
28963 false,
28964 0,
28965 ).to_ne_bytes()
28966 ),
28967});
28968}
28969unsafe extern "C" fn get_minStorageBufferOffsetAlignment<D: DomTypes>
28970(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
28971 let mut result = false;
28972 wrap_panic(&mut || result = (|| {
28973 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
28974 let this = &*(this as *const D::GPUSupportedLimits);
28975 let result: u32 = this.MinStorageBufferOffsetAlignment();
28976
28977 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
28978 return true;
28979 })());
28980 result
28981}
28982
28983
28984static minStorageBufferOffsetAlignment_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
28985
28986pub(crate) fn init_minStorageBufferOffsetAlignment_getterinfo<D: DomTypes>() {
28987 minStorageBufferOffsetAlignment_getterinfo.set(JSJitInfo {
28988 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
28989 getter: Some(get_minStorageBufferOffsetAlignment::<D>)
28990 },
28991 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
28992 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
28993 },
28994 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
28995 _bitfield_align_1: [],
28996 _bitfield_1: __BindgenBitfieldUnit::new(
28997 new_jsjitinfo_bitfield_1!(
28998 JSJitInfo_OpType::Getter as u8,
28999 JSJitInfo_AliasSet::AliasEverything as u8,
29000 JSValueType::JSVAL_TYPE_DOUBLE as u8,
29001 true,
29002 false,
29003 false,
29004 false,
29005 false,
29006 false,
29007 0,
29008 ).to_ne_bytes()
29009 ),
29010});
29011}
29012unsafe extern "C" fn get_maxVertexBuffers<D: DomTypes>
29013(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
29014 let mut result = false;
29015 wrap_panic(&mut || result = (|| {
29016 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
29017 let this = &*(this as *const D::GPUSupportedLimits);
29018 let result: u32 = this.MaxVertexBuffers();
29019
29020 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
29021 return true;
29022 })());
29023 result
29024}
29025
29026
29027static maxVertexBuffers_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
29028
29029pub(crate) fn init_maxVertexBuffers_getterinfo<D: DomTypes>() {
29030 maxVertexBuffers_getterinfo.set(JSJitInfo {
29031 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
29032 getter: Some(get_maxVertexBuffers::<D>)
29033 },
29034 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
29035 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
29036 },
29037 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
29038 _bitfield_align_1: [],
29039 _bitfield_1: __BindgenBitfieldUnit::new(
29040 new_jsjitinfo_bitfield_1!(
29041 JSJitInfo_OpType::Getter as u8,
29042 JSJitInfo_AliasSet::AliasEverything as u8,
29043 JSValueType::JSVAL_TYPE_DOUBLE as u8,
29044 true,
29045 false,
29046 false,
29047 false,
29048 false,
29049 false,
29050 0,
29051 ).to_ne_bytes()
29052 ),
29053});
29054}
29055unsafe extern "C" fn get_maxBufferSize<D: DomTypes>
29056(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
29057 let mut result = false;
29058 wrap_panic(&mut || result = (|| {
29059 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
29060 let this = &*(this as *const D::GPUSupportedLimits);
29061 let result: u64 = this.MaxBufferSize();
29062
29063 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
29064 return true;
29065 })());
29066 result
29067}
29068
29069
29070static maxBufferSize_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
29071
29072pub(crate) fn init_maxBufferSize_getterinfo<D: DomTypes>() {
29073 maxBufferSize_getterinfo.set(JSJitInfo {
29074 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
29075 getter: Some(get_maxBufferSize::<D>)
29076 },
29077 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
29078 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
29079 },
29080 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
29081 _bitfield_align_1: [],
29082 _bitfield_1: __BindgenBitfieldUnit::new(
29083 new_jsjitinfo_bitfield_1!(
29084 JSJitInfo_OpType::Getter as u8,
29085 JSJitInfo_AliasSet::AliasEverything as u8,
29086 JSValueType::JSVAL_TYPE_DOUBLE as u8,
29087 true,
29088 false,
29089 false,
29090 false,
29091 false,
29092 false,
29093 0,
29094 ).to_ne_bytes()
29095 ),
29096});
29097}
29098unsafe extern "C" fn get_maxVertexAttributes<D: DomTypes>
29099(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
29100 let mut result = false;
29101 wrap_panic(&mut || result = (|| {
29102 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
29103 let this = &*(this as *const D::GPUSupportedLimits);
29104 let result: u32 = this.MaxVertexAttributes();
29105
29106 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
29107 return true;
29108 })());
29109 result
29110}
29111
29112
29113static maxVertexAttributes_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
29114
29115pub(crate) fn init_maxVertexAttributes_getterinfo<D: DomTypes>() {
29116 maxVertexAttributes_getterinfo.set(JSJitInfo {
29117 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
29118 getter: Some(get_maxVertexAttributes::<D>)
29119 },
29120 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
29121 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
29122 },
29123 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
29124 _bitfield_align_1: [],
29125 _bitfield_1: __BindgenBitfieldUnit::new(
29126 new_jsjitinfo_bitfield_1!(
29127 JSJitInfo_OpType::Getter as u8,
29128 JSJitInfo_AliasSet::AliasEverything as u8,
29129 JSValueType::JSVAL_TYPE_DOUBLE as u8,
29130 true,
29131 false,
29132 false,
29133 false,
29134 false,
29135 false,
29136 0,
29137 ).to_ne_bytes()
29138 ),
29139});
29140}
29141unsafe extern "C" fn get_maxVertexBufferArrayStride<D: DomTypes>
29142(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
29143 let mut result = false;
29144 wrap_panic(&mut || result = (|| {
29145 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
29146 let this = &*(this as *const D::GPUSupportedLimits);
29147 let result: u32 = this.MaxVertexBufferArrayStride();
29148
29149 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
29150 return true;
29151 })());
29152 result
29153}
29154
29155
29156static maxVertexBufferArrayStride_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
29157
29158pub(crate) fn init_maxVertexBufferArrayStride_getterinfo<D: DomTypes>() {
29159 maxVertexBufferArrayStride_getterinfo.set(JSJitInfo {
29160 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
29161 getter: Some(get_maxVertexBufferArrayStride::<D>)
29162 },
29163 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
29164 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
29165 },
29166 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
29167 _bitfield_align_1: [],
29168 _bitfield_1: __BindgenBitfieldUnit::new(
29169 new_jsjitinfo_bitfield_1!(
29170 JSJitInfo_OpType::Getter as u8,
29171 JSJitInfo_AliasSet::AliasEverything as u8,
29172 JSValueType::JSVAL_TYPE_DOUBLE as u8,
29173 true,
29174 false,
29175 false,
29176 false,
29177 false,
29178 false,
29179 0,
29180 ).to_ne_bytes()
29181 ),
29182});
29183}
29184unsafe extern "C" fn get_maxInterStageShaderComponents<D: DomTypes>
29185(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
29186 let mut result = false;
29187 wrap_panic(&mut || result = (|| {
29188 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
29189 let this = &*(this as *const D::GPUSupportedLimits);
29190 let result: u32 = this.MaxInterStageShaderComponents();
29191
29192 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
29193 return true;
29194 })());
29195 result
29196}
29197
29198
29199static maxInterStageShaderComponents_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
29200
29201pub(crate) fn init_maxInterStageShaderComponents_getterinfo<D: DomTypes>() {
29202 maxInterStageShaderComponents_getterinfo.set(JSJitInfo {
29203 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
29204 getter: Some(get_maxInterStageShaderComponents::<D>)
29205 },
29206 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
29207 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
29208 },
29209 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
29210 _bitfield_align_1: [],
29211 _bitfield_1: __BindgenBitfieldUnit::new(
29212 new_jsjitinfo_bitfield_1!(
29213 JSJitInfo_OpType::Getter as u8,
29214 JSJitInfo_AliasSet::AliasEverything as u8,
29215 JSValueType::JSVAL_TYPE_DOUBLE as u8,
29216 true,
29217 false,
29218 false,
29219 false,
29220 false,
29221 false,
29222 0,
29223 ).to_ne_bytes()
29224 ),
29225});
29226}
29227unsafe extern "C" fn get_maxInterStageShaderVariables<D: DomTypes>
29228(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
29229 let mut result = false;
29230 wrap_panic(&mut || result = (|| {
29231 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
29232 let this = &*(this as *const D::GPUSupportedLimits);
29233 let result: u32 = this.MaxInterStageShaderVariables();
29234
29235 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
29236 return true;
29237 })());
29238 result
29239}
29240
29241
29242static maxInterStageShaderVariables_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
29243
29244pub(crate) fn init_maxInterStageShaderVariables_getterinfo<D: DomTypes>() {
29245 maxInterStageShaderVariables_getterinfo.set(JSJitInfo {
29246 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
29247 getter: Some(get_maxInterStageShaderVariables::<D>)
29248 },
29249 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
29250 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
29251 },
29252 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
29253 _bitfield_align_1: [],
29254 _bitfield_1: __BindgenBitfieldUnit::new(
29255 new_jsjitinfo_bitfield_1!(
29256 JSJitInfo_OpType::Getter as u8,
29257 JSJitInfo_AliasSet::AliasEverything as u8,
29258 JSValueType::JSVAL_TYPE_DOUBLE as u8,
29259 true,
29260 false,
29261 false,
29262 false,
29263 false,
29264 false,
29265 0,
29266 ).to_ne_bytes()
29267 ),
29268});
29269}
29270unsafe extern "C" fn get_maxColorAttachments<D: DomTypes>
29271(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
29272 let mut result = false;
29273 wrap_panic(&mut || result = (|| {
29274 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
29275 let this = &*(this as *const D::GPUSupportedLimits);
29276 let result: u32 = this.MaxColorAttachments();
29277
29278 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
29279 return true;
29280 })());
29281 result
29282}
29283
29284
29285static maxColorAttachments_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
29286
29287pub(crate) fn init_maxColorAttachments_getterinfo<D: DomTypes>() {
29288 maxColorAttachments_getterinfo.set(JSJitInfo {
29289 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
29290 getter: Some(get_maxColorAttachments::<D>)
29291 },
29292 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
29293 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
29294 },
29295 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
29296 _bitfield_align_1: [],
29297 _bitfield_1: __BindgenBitfieldUnit::new(
29298 new_jsjitinfo_bitfield_1!(
29299 JSJitInfo_OpType::Getter as u8,
29300 JSJitInfo_AliasSet::AliasEverything as u8,
29301 JSValueType::JSVAL_TYPE_DOUBLE as u8,
29302 true,
29303 false,
29304 false,
29305 false,
29306 false,
29307 false,
29308 0,
29309 ).to_ne_bytes()
29310 ),
29311});
29312}
29313unsafe extern "C" fn get_maxColorAttachmentBytesPerSample<D: DomTypes>
29314(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
29315 let mut result = false;
29316 wrap_panic(&mut || result = (|| {
29317 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
29318 let this = &*(this as *const D::GPUSupportedLimits);
29319 let result: u32 = this.MaxColorAttachmentBytesPerSample();
29320
29321 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
29322 return true;
29323 })());
29324 result
29325}
29326
29327
29328static maxColorAttachmentBytesPerSample_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
29329
29330pub(crate) fn init_maxColorAttachmentBytesPerSample_getterinfo<D: DomTypes>() {
29331 maxColorAttachmentBytesPerSample_getterinfo.set(JSJitInfo {
29332 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
29333 getter: Some(get_maxColorAttachmentBytesPerSample::<D>)
29334 },
29335 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
29336 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
29337 },
29338 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
29339 _bitfield_align_1: [],
29340 _bitfield_1: __BindgenBitfieldUnit::new(
29341 new_jsjitinfo_bitfield_1!(
29342 JSJitInfo_OpType::Getter as u8,
29343 JSJitInfo_AliasSet::AliasEverything as u8,
29344 JSValueType::JSVAL_TYPE_DOUBLE as u8,
29345 true,
29346 false,
29347 false,
29348 false,
29349 false,
29350 false,
29351 0,
29352 ).to_ne_bytes()
29353 ),
29354});
29355}
29356unsafe extern "C" fn get_maxComputeWorkgroupStorageSize<D: DomTypes>
29357(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
29358 let mut result = false;
29359 wrap_panic(&mut || result = (|| {
29360 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
29361 let this = &*(this as *const D::GPUSupportedLimits);
29362 let result: u32 = this.MaxComputeWorkgroupStorageSize();
29363
29364 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
29365 return true;
29366 })());
29367 result
29368}
29369
29370
29371static maxComputeWorkgroupStorageSize_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
29372
29373pub(crate) fn init_maxComputeWorkgroupStorageSize_getterinfo<D: DomTypes>() {
29374 maxComputeWorkgroupStorageSize_getterinfo.set(JSJitInfo {
29375 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
29376 getter: Some(get_maxComputeWorkgroupStorageSize::<D>)
29377 },
29378 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
29379 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
29380 },
29381 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
29382 _bitfield_align_1: [],
29383 _bitfield_1: __BindgenBitfieldUnit::new(
29384 new_jsjitinfo_bitfield_1!(
29385 JSJitInfo_OpType::Getter as u8,
29386 JSJitInfo_AliasSet::AliasEverything as u8,
29387 JSValueType::JSVAL_TYPE_DOUBLE as u8,
29388 true,
29389 false,
29390 false,
29391 false,
29392 false,
29393 false,
29394 0,
29395 ).to_ne_bytes()
29396 ),
29397});
29398}
29399unsafe extern "C" fn get_maxComputeInvocationsPerWorkgroup<D: DomTypes>
29400(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
29401 let mut result = false;
29402 wrap_panic(&mut || result = (|| {
29403 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
29404 let this = &*(this as *const D::GPUSupportedLimits);
29405 let result: u32 = this.MaxComputeInvocationsPerWorkgroup();
29406
29407 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
29408 return true;
29409 })());
29410 result
29411}
29412
29413
29414static maxComputeInvocationsPerWorkgroup_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
29415
29416pub(crate) fn init_maxComputeInvocationsPerWorkgroup_getterinfo<D: DomTypes>() {
29417 maxComputeInvocationsPerWorkgroup_getterinfo.set(JSJitInfo {
29418 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
29419 getter: Some(get_maxComputeInvocationsPerWorkgroup::<D>)
29420 },
29421 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
29422 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
29423 },
29424 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
29425 _bitfield_align_1: [],
29426 _bitfield_1: __BindgenBitfieldUnit::new(
29427 new_jsjitinfo_bitfield_1!(
29428 JSJitInfo_OpType::Getter as u8,
29429 JSJitInfo_AliasSet::AliasEverything as u8,
29430 JSValueType::JSVAL_TYPE_DOUBLE as u8,
29431 true,
29432 false,
29433 false,
29434 false,
29435 false,
29436 false,
29437 0,
29438 ).to_ne_bytes()
29439 ),
29440});
29441}
29442unsafe extern "C" fn get_maxComputeWorkgroupSizeX<D: DomTypes>
29443(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
29444 let mut result = false;
29445 wrap_panic(&mut || result = (|| {
29446 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
29447 let this = &*(this as *const D::GPUSupportedLimits);
29448 let result: u32 = this.MaxComputeWorkgroupSizeX();
29449
29450 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
29451 return true;
29452 })());
29453 result
29454}
29455
29456
29457static maxComputeWorkgroupSizeX_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
29458
29459pub(crate) fn init_maxComputeWorkgroupSizeX_getterinfo<D: DomTypes>() {
29460 maxComputeWorkgroupSizeX_getterinfo.set(JSJitInfo {
29461 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
29462 getter: Some(get_maxComputeWorkgroupSizeX::<D>)
29463 },
29464 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
29465 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
29466 },
29467 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
29468 _bitfield_align_1: [],
29469 _bitfield_1: __BindgenBitfieldUnit::new(
29470 new_jsjitinfo_bitfield_1!(
29471 JSJitInfo_OpType::Getter as u8,
29472 JSJitInfo_AliasSet::AliasEverything as u8,
29473 JSValueType::JSVAL_TYPE_DOUBLE as u8,
29474 true,
29475 false,
29476 false,
29477 false,
29478 false,
29479 false,
29480 0,
29481 ).to_ne_bytes()
29482 ),
29483});
29484}
29485unsafe extern "C" fn get_maxComputeWorkgroupSizeY<D: DomTypes>
29486(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
29487 let mut result = false;
29488 wrap_panic(&mut || result = (|| {
29489 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
29490 let this = &*(this as *const D::GPUSupportedLimits);
29491 let result: u32 = this.MaxComputeWorkgroupSizeY();
29492
29493 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
29494 return true;
29495 })());
29496 result
29497}
29498
29499
29500static maxComputeWorkgroupSizeY_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
29501
29502pub(crate) fn init_maxComputeWorkgroupSizeY_getterinfo<D: DomTypes>() {
29503 maxComputeWorkgroupSizeY_getterinfo.set(JSJitInfo {
29504 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
29505 getter: Some(get_maxComputeWorkgroupSizeY::<D>)
29506 },
29507 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
29508 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
29509 },
29510 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
29511 _bitfield_align_1: [],
29512 _bitfield_1: __BindgenBitfieldUnit::new(
29513 new_jsjitinfo_bitfield_1!(
29514 JSJitInfo_OpType::Getter as u8,
29515 JSJitInfo_AliasSet::AliasEverything as u8,
29516 JSValueType::JSVAL_TYPE_DOUBLE as u8,
29517 true,
29518 false,
29519 false,
29520 false,
29521 false,
29522 false,
29523 0,
29524 ).to_ne_bytes()
29525 ),
29526});
29527}
29528unsafe extern "C" fn get_maxComputeWorkgroupSizeZ<D: DomTypes>
29529(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
29530 let mut result = false;
29531 wrap_panic(&mut || result = (|| {
29532 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
29533 let this = &*(this as *const D::GPUSupportedLimits);
29534 let result: u32 = this.MaxComputeWorkgroupSizeZ();
29535
29536 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
29537 return true;
29538 })());
29539 result
29540}
29541
29542
29543static maxComputeWorkgroupSizeZ_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
29544
29545pub(crate) fn init_maxComputeWorkgroupSizeZ_getterinfo<D: DomTypes>() {
29546 maxComputeWorkgroupSizeZ_getterinfo.set(JSJitInfo {
29547 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
29548 getter: Some(get_maxComputeWorkgroupSizeZ::<D>)
29549 },
29550 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
29551 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
29552 },
29553 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
29554 _bitfield_align_1: [],
29555 _bitfield_1: __BindgenBitfieldUnit::new(
29556 new_jsjitinfo_bitfield_1!(
29557 JSJitInfo_OpType::Getter as u8,
29558 JSJitInfo_AliasSet::AliasEverything as u8,
29559 JSValueType::JSVAL_TYPE_DOUBLE as u8,
29560 true,
29561 false,
29562 false,
29563 false,
29564 false,
29565 false,
29566 0,
29567 ).to_ne_bytes()
29568 ),
29569});
29570}
29571unsafe extern "C" fn get_maxComputeWorkgroupsPerDimension<D: DomTypes>
29572(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
29573 let mut result = false;
29574 wrap_panic(&mut || result = (|| {
29575 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
29576 let this = &*(this as *const D::GPUSupportedLimits);
29577 let result: u32 = this.MaxComputeWorkgroupsPerDimension();
29578
29579 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
29580 return true;
29581 })());
29582 result
29583}
29584
29585
29586static maxComputeWorkgroupsPerDimension_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
29587
29588pub(crate) fn init_maxComputeWorkgroupsPerDimension_getterinfo<D: DomTypes>() {
29589 maxComputeWorkgroupsPerDimension_getterinfo.set(JSJitInfo {
29590 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
29591 getter: Some(get_maxComputeWorkgroupsPerDimension::<D>)
29592 },
29593 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
29594 protoID: PrototypeList::ID::GPUSupportedLimits as u16,
29595 },
29596 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
29597 _bitfield_align_1: [],
29598 _bitfield_1: __BindgenBitfieldUnit::new(
29599 new_jsjitinfo_bitfield_1!(
29600 JSJitInfo_OpType::Getter as u8,
29601 JSJitInfo_AliasSet::AliasEverything as u8,
29602 JSValueType::JSVAL_TYPE_DOUBLE as u8,
29603 true,
29604 false,
29605 false,
29606 false,
29607 false,
29608 false,
29609 0,
29610 ).to_ne_bytes()
29611 ),
29612});
29613}
29614unsafe extern "C" fn _finalize<D: DomTypes>
29615(_cx: *mut GCContext, obj: *mut JSObject){
29616 wrap_panic(&mut || {
29617
29618 let this = native_from_object_static::<D::GPUSupportedLimits>(obj).unwrap();
29619 finalize_common(this);
29620 })
29621}
29622
29623unsafe extern "C" fn _trace<D: DomTypes>
29624(trc: *mut JSTracer, obj: *mut JSObject){
29625 wrap_panic(&mut || {
29626
29627 let this = native_from_object_static::<D::GPUSupportedLimits>(obj).unwrap();
29628 if this.is_null() { return; } (*this).trace(trc);
29630 })
29631}
29632
29633
29634static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
29635
29636pub(crate) fn init_class_ops<D: DomTypes>() {
29637 CLASS_OPS.set(JSClassOps {
29638 addProperty: None,
29639 delProperty: None,
29640 enumerate: None,
29641 newEnumerate: None,
29642 resolve: None,
29643 mayResolve: None,
29644 finalize: Some(_finalize::<D>),
29645 call: None,
29646 construct: None,
29647 trace: Some(_trace::<D>),
29648 });
29649}
29650
29651pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
29652
29653pub(crate) fn init_domjs_class<D: DomTypes>() {
29654 init_class_ops::<D>();
29655 Class.set(DOMJSClass {
29656 base: JSClass {
29657 name: c"GPUSupportedLimits".as_ptr(),
29658 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
29659 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
29660 ,
29661 cOps: unsafe { CLASS_OPS.get() },
29662 spec: ptr::null(),
29663 ext: ptr::null(),
29664 oOps: ptr::null(),
29665 },
29666 dom_class:
29667DOMClass {
29668 interface_chain: [ PrototypeList::ID::GPUSupportedLimits, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
29669 depth: 0,
29670 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
29671 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUSupportedLimits> as unsafe fn(&mut _, _) -> _,
29672 global: Globals::EMPTY,
29673},
29674 });
29675}
29676
29677#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
29678(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUSupportedLimits>, _can_gc: CanGc) -> DomRoot<D::GPUSupportedLimits>{
29679
29680 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
29681
29682 let scope = scope.reflector().get_jsobject();
29683 assert!(!scope.get().is_null());
29684 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
29685 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
29686
29687 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
29688 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
29689 assert!(!canonical_proto.is_null());
29690
29691
29692 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
29693 if let Some(given) = given_proto {
29694 proto.set(*given);
29695 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
29696 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
29697 }
29698 } else {
29699 proto.set(*canonical_proto);
29700 }
29701 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
29702 cx.raw_cx(),
29703 &Class.get().base,
29704 proto.handle(),
29705 ));
29706 assert!(!obj.is_null());
29707 JS_SetReservedSlot(
29708 obj.get(),
29709 DOM_OBJECT_SLOT,
29710 &PrivateValue(raw.as_ptr() as *const libc::c_void),
29711 );
29712
29713 let root = raw.reflect_with(obj.get());
29714
29715
29716
29717 DomRoot::from_ref(&*root)
29718}
29719
29720pub trait GPUSupportedLimitsMethods<D: DomTypes> {
29721 fn MaxTextureDimension1D(&self, ) -> u32;
29722 fn MaxTextureDimension2D(&self, ) -> u32;
29723 fn MaxTextureDimension3D(&self, ) -> u32;
29724 fn MaxTextureArrayLayers(&self, ) -> u32;
29725 fn MaxBindGroups(&self, ) -> u32;
29726 fn MaxBindGroupsPlusVertexBuffers(&self, ) -> u32;
29727 fn MaxBindingsPerBindGroup(&self, ) -> u32;
29728 fn MaxDynamicUniformBuffersPerPipelineLayout(&self, ) -> u32;
29729 fn MaxDynamicStorageBuffersPerPipelineLayout(&self, ) -> u32;
29730 fn MaxSampledTexturesPerShaderStage(&self, ) -> u32;
29731 fn MaxSamplersPerShaderStage(&self, ) -> u32;
29732 fn MaxStorageBuffersPerShaderStage(&self, ) -> u32;
29733 fn MaxStorageTexturesPerShaderStage(&self, ) -> u32;
29734 fn MaxUniformBuffersPerShaderStage(&self, ) -> u32;
29735 fn MaxUniformBufferBindingSize(&self, ) -> u64;
29736 fn MaxStorageBufferBindingSize(&self, ) -> u64;
29737 fn MinUniformBufferOffsetAlignment(&self, ) -> u32;
29738 fn MinStorageBufferOffsetAlignment(&self, ) -> u32;
29739 fn MaxVertexBuffers(&self, ) -> u32;
29740 fn MaxBufferSize(&self, ) -> u64;
29741 fn MaxVertexAttributes(&self, ) -> u32;
29742 fn MaxVertexBufferArrayStride(&self, ) -> u32;
29743 fn MaxInterStageShaderComponents(&self, ) -> u32;
29744 fn MaxInterStageShaderVariables(&self, ) -> u32;
29745 fn MaxColorAttachments(&self, ) -> u32;
29746 fn MaxColorAttachmentBytesPerSample(&self, ) -> u32;
29747 fn MaxComputeWorkgroupStorageSize(&self, ) -> u32;
29748 fn MaxComputeInvocationsPerWorkgroup(&self, ) -> u32;
29749 fn MaxComputeWorkgroupSizeX(&self, ) -> u32;
29750 fn MaxComputeWorkgroupSizeY(&self, ) -> u32;
29751 fn MaxComputeWorkgroupSizeZ(&self, ) -> u32;
29752 fn MaxComputeWorkgroupsPerDimension(&self, ) -> u32;
29753}
29754static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
29755
29756pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
29757 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
29758 JSPropertySpec {
29759 name: JSPropertySpec_Name { string_: c"maxTextureDimension1D".as_ptr() },
29760 attributes_: (JSPROP_ENUMERATE),
29761 kind_: (JSPropertySpec_Kind::NativeAccessor),
29762 u: JSPropertySpec_AccessorsOrValue {
29763 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
29764 getter: JSPropertySpec_Accessor {
29765 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxTextureDimension1D_getterinfo.get() } },
29766 },
29767 setter: JSPropertySpec_Accessor {
29768 native: JSNativeWrapper { op: None, info: ptr::null() },
29769 }
29770 }
29771 }
29772 }
29773,
29774 JSPropertySpec {
29775 name: JSPropertySpec_Name { string_: c"maxTextureDimension2D".as_ptr() },
29776 attributes_: (JSPROP_ENUMERATE),
29777 kind_: (JSPropertySpec_Kind::NativeAccessor),
29778 u: JSPropertySpec_AccessorsOrValue {
29779 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
29780 getter: JSPropertySpec_Accessor {
29781 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxTextureDimension2D_getterinfo.get() } },
29782 },
29783 setter: JSPropertySpec_Accessor {
29784 native: JSNativeWrapper { op: None, info: ptr::null() },
29785 }
29786 }
29787 }
29788 }
29789,
29790 JSPropertySpec {
29791 name: JSPropertySpec_Name { string_: c"maxTextureDimension3D".as_ptr() },
29792 attributes_: (JSPROP_ENUMERATE),
29793 kind_: (JSPropertySpec_Kind::NativeAccessor),
29794 u: JSPropertySpec_AccessorsOrValue {
29795 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
29796 getter: JSPropertySpec_Accessor {
29797 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxTextureDimension3D_getterinfo.get() } },
29798 },
29799 setter: JSPropertySpec_Accessor {
29800 native: JSNativeWrapper { op: None, info: ptr::null() },
29801 }
29802 }
29803 }
29804 }
29805,
29806 JSPropertySpec {
29807 name: JSPropertySpec_Name { string_: c"maxTextureArrayLayers".as_ptr() },
29808 attributes_: (JSPROP_ENUMERATE),
29809 kind_: (JSPropertySpec_Kind::NativeAccessor),
29810 u: JSPropertySpec_AccessorsOrValue {
29811 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
29812 getter: JSPropertySpec_Accessor {
29813 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxTextureArrayLayers_getterinfo.get() } },
29814 },
29815 setter: JSPropertySpec_Accessor {
29816 native: JSNativeWrapper { op: None, info: ptr::null() },
29817 }
29818 }
29819 }
29820 }
29821,
29822 JSPropertySpec {
29823 name: JSPropertySpec_Name { string_: c"maxBindGroups".as_ptr() },
29824 attributes_: (JSPROP_ENUMERATE),
29825 kind_: (JSPropertySpec_Kind::NativeAccessor),
29826 u: JSPropertySpec_AccessorsOrValue {
29827 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
29828 getter: JSPropertySpec_Accessor {
29829 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxBindGroups_getterinfo.get() } },
29830 },
29831 setter: JSPropertySpec_Accessor {
29832 native: JSNativeWrapper { op: None, info: ptr::null() },
29833 }
29834 }
29835 }
29836 }
29837,
29838 JSPropertySpec {
29839 name: JSPropertySpec_Name { string_: c"maxBindGroupsPlusVertexBuffers".as_ptr() },
29840 attributes_: (JSPROP_ENUMERATE),
29841 kind_: (JSPropertySpec_Kind::NativeAccessor),
29842 u: JSPropertySpec_AccessorsOrValue {
29843 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
29844 getter: JSPropertySpec_Accessor {
29845 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxBindGroupsPlusVertexBuffers_getterinfo.get() } },
29846 },
29847 setter: JSPropertySpec_Accessor {
29848 native: JSNativeWrapper { op: None, info: ptr::null() },
29849 }
29850 }
29851 }
29852 }
29853,
29854 JSPropertySpec {
29855 name: JSPropertySpec_Name { string_: c"maxBindingsPerBindGroup".as_ptr() },
29856 attributes_: (JSPROP_ENUMERATE),
29857 kind_: (JSPropertySpec_Kind::NativeAccessor),
29858 u: JSPropertySpec_AccessorsOrValue {
29859 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
29860 getter: JSPropertySpec_Accessor {
29861 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxBindingsPerBindGroup_getterinfo.get() } },
29862 },
29863 setter: JSPropertySpec_Accessor {
29864 native: JSNativeWrapper { op: None, info: ptr::null() },
29865 }
29866 }
29867 }
29868 }
29869,
29870 JSPropertySpec {
29871 name: JSPropertySpec_Name { string_: c"maxDynamicUniformBuffersPerPipelineLayout".as_ptr() },
29872 attributes_: (JSPROP_ENUMERATE),
29873 kind_: (JSPropertySpec_Kind::NativeAccessor),
29874 u: JSPropertySpec_AccessorsOrValue {
29875 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
29876 getter: JSPropertySpec_Accessor {
29877 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxDynamicUniformBuffersPerPipelineLayout_getterinfo.get() } },
29878 },
29879 setter: JSPropertySpec_Accessor {
29880 native: JSNativeWrapper { op: None, info: ptr::null() },
29881 }
29882 }
29883 }
29884 }
29885,
29886 JSPropertySpec {
29887 name: JSPropertySpec_Name { string_: c"maxDynamicStorageBuffersPerPipelineLayout".as_ptr() },
29888 attributes_: (JSPROP_ENUMERATE),
29889 kind_: (JSPropertySpec_Kind::NativeAccessor),
29890 u: JSPropertySpec_AccessorsOrValue {
29891 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
29892 getter: JSPropertySpec_Accessor {
29893 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxDynamicStorageBuffersPerPipelineLayout_getterinfo.get() } },
29894 },
29895 setter: JSPropertySpec_Accessor {
29896 native: JSNativeWrapper { op: None, info: ptr::null() },
29897 }
29898 }
29899 }
29900 }
29901,
29902 JSPropertySpec {
29903 name: JSPropertySpec_Name { string_: c"maxSampledTexturesPerShaderStage".as_ptr() },
29904 attributes_: (JSPROP_ENUMERATE),
29905 kind_: (JSPropertySpec_Kind::NativeAccessor),
29906 u: JSPropertySpec_AccessorsOrValue {
29907 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
29908 getter: JSPropertySpec_Accessor {
29909 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxSampledTexturesPerShaderStage_getterinfo.get() } },
29910 },
29911 setter: JSPropertySpec_Accessor {
29912 native: JSNativeWrapper { op: None, info: ptr::null() },
29913 }
29914 }
29915 }
29916 }
29917,
29918 JSPropertySpec {
29919 name: JSPropertySpec_Name { string_: c"maxSamplersPerShaderStage".as_ptr() },
29920 attributes_: (JSPROP_ENUMERATE),
29921 kind_: (JSPropertySpec_Kind::NativeAccessor),
29922 u: JSPropertySpec_AccessorsOrValue {
29923 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
29924 getter: JSPropertySpec_Accessor {
29925 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxSamplersPerShaderStage_getterinfo.get() } },
29926 },
29927 setter: JSPropertySpec_Accessor {
29928 native: JSNativeWrapper { op: None, info: ptr::null() },
29929 }
29930 }
29931 }
29932 }
29933,
29934 JSPropertySpec {
29935 name: JSPropertySpec_Name { string_: c"maxStorageBuffersPerShaderStage".as_ptr() },
29936 attributes_: (JSPROP_ENUMERATE),
29937 kind_: (JSPropertySpec_Kind::NativeAccessor),
29938 u: JSPropertySpec_AccessorsOrValue {
29939 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
29940 getter: JSPropertySpec_Accessor {
29941 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxStorageBuffersPerShaderStage_getterinfo.get() } },
29942 },
29943 setter: JSPropertySpec_Accessor {
29944 native: JSNativeWrapper { op: None, info: ptr::null() },
29945 }
29946 }
29947 }
29948 }
29949,
29950 JSPropertySpec {
29951 name: JSPropertySpec_Name { string_: c"maxStorageTexturesPerShaderStage".as_ptr() },
29952 attributes_: (JSPROP_ENUMERATE),
29953 kind_: (JSPropertySpec_Kind::NativeAccessor),
29954 u: JSPropertySpec_AccessorsOrValue {
29955 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
29956 getter: JSPropertySpec_Accessor {
29957 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxStorageTexturesPerShaderStage_getterinfo.get() } },
29958 },
29959 setter: JSPropertySpec_Accessor {
29960 native: JSNativeWrapper { op: None, info: ptr::null() },
29961 }
29962 }
29963 }
29964 }
29965,
29966 JSPropertySpec {
29967 name: JSPropertySpec_Name { string_: c"maxUniformBuffersPerShaderStage".as_ptr() },
29968 attributes_: (JSPROP_ENUMERATE),
29969 kind_: (JSPropertySpec_Kind::NativeAccessor),
29970 u: JSPropertySpec_AccessorsOrValue {
29971 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
29972 getter: JSPropertySpec_Accessor {
29973 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxUniformBuffersPerShaderStage_getterinfo.get() } },
29974 },
29975 setter: JSPropertySpec_Accessor {
29976 native: JSNativeWrapper { op: None, info: ptr::null() },
29977 }
29978 }
29979 }
29980 }
29981,
29982 JSPropertySpec {
29983 name: JSPropertySpec_Name { string_: c"maxUniformBufferBindingSize".as_ptr() },
29984 attributes_: (JSPROP_ENUMERATE),
29985 kind_: (JSPropertySpec_Kind::NativeAccessor),
29986 u: JSPropertySpec_AccessorsOrValue {
29987 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
29988 getter: JSPropertySpec_Accessor {
29989 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxUniformBufferBindingSize_getterinfo.get() } },
29990 },
29991 setter: JSPropertySpec_Accessor {
29992 native: JSNativeWrapper { op: None, info: ptr::null() },
29993 }
29994 }
29995 }
29996 }
29997,
29998 JSPropertySpec {
29999 name: JSPropertySpec_Name { string_: c"maxStorageBufferBindingSize".as_ptr() },
30000 attributes_: (JSPROP_ENUMERATE),
30001 kind_: (JSPropertySpec_Kind::NativeAccessor),
30002 u: JSPropertySpec_AccessorsOrValue {
30003 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
30004 getter: JSPropertySpec_Accessor {
30005 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxStorageBufferBindingSize_getterinfo.get() } },
30006 },
30007 setter: JSPropertySpec_Accessor {
30008 native: JSNativeWrapper { op: None, info: ptr::null() },
30009 }
30010 }
30011 }
30012 }
30013,
30014 JSPropertySpec {
30015 name: JSPropertySpec_Name { string_: c"minUniformBufferOffsetAlignment".as_ptr() },
30016 attributes_: (JSPROP_ENUMERATE),
30017 kind_: (JSPropertySpec_Kind::NativeAccessor),
30018 u: JSPropertySpec_AccessorsOrValue {
30019 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
30020 getter: JSPropertySpec_Accessor {
30021 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { minUniformBufferOffsetAlignment_getterinfo.get() } },
30022 },
30023 setter: JSPropertySpec_Accessor {
30024 native: JSNativeWrapper { op: None, info: ptr::null() },
30025 }
30026 }
30027 }
30028 }
30029,
30030 JSPropertySpec {
30031 name: JSPropertySpec_Name { string_: c"minStorageBufferOffsetAlignment".as_ptr() },
30032 attributes_: (JSPROP_ENUMERATE),
30033 kind_: (JSPropertySpec_Kind::NativeAccessor),
30034 u: JSPropertySpec_AccessorsOrValue {
30035 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
30036 getter: JSPropertySpec_Accessor {
30037 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { minStorageBufferOffsetAlignment_getterinfo.get() } },
30038 },
30039 setter: JSPropertySpec_Accessor {
30040 native: JSNativeWrapper { op: None, info: ptr::null() },
30041 }
30042 }
30043 }
30044 }
30045,
30046 JSPropertySpec {
30047 name: JSPropertySpec_Name { string_: c"maxVertexBuffers".as_ptr() },
30048 attributes_: (JSPROP_ENUMERATE),
30049 kind_: (JSPropertySpec_Kind::NativeAccessor),
30050 u: JSPropertySpec_AccessorsOrValue {
30051 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
30052 getter: JSPropertySpec_Accessor {
30053 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxVertexBuffers_getterinfo.get() } },
30054 },
30055 setter: JSPropertySpec_Accessor {
30056 native: JSNativeWrapper { op: None, info: ptr::null() },
30057 }
30058 }
30059 }
30060 }
30061,
30062 JSPropertySpec {
30063 name: JSPropertySpec_Name { string_: c"maxBufferSize".as_ptr() },
30064 attributes_: (JSPROP_ENUMERATE),
30065 kind_: (JSPropertySpec_Kind::NativeAccessor),
30066 u: JSPropertySpec_AccessorsOrValue {
30067 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
30068 getter: JSPropertySpec_Accessor {
30069 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxBufferSize_getterinfo.get() } },
30070 },
30071 setter: JSPropertySpec_Accessor {
30072 native: JSNativeWrapper { op: None, info: ptr::null() },
30073 }
30074 }
30075 }
30076 }
30077,
30078 JSPropertySpec {
30079 name: JSPropertySpec_Name { string_: c"maxVertexAttributes".as_ptr() },
30080 attributes_: (JSPROP_ENUMERATE),
30081 kind_: (JSPropertySpec_Kind::NativeAccessor),
30082 u: JSPropertySpec_AccessorsOrValue {
30083 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
30084 getter: JSPropertySpec_Accessor {
30085 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxVertexAttributes_getterinfo.get() } },
30086 },
30087 setter: JSPropertySpec_Accessor {
30088 native: JSNativeWrapper { op: None, info: ptr::null() },
30089 }
30090 }
30091 }
30092 }
30093,
30094 JSPropertySpec {
30095 name: JSPropertySpec_Name { string_: c"maxVertexBufferArrayStride".as_ptr() },
30096 attributes_: (JSPROP_ENUMERATE),
30097 kind_: (JSPropertySpec_Kind::NativeAccessor),
30098 u: JSPropertySpec_AccessorsOrValue {
30099 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
30100 getter: JSPropertySpec_Accessor {
30101 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxVertexBufferArrayStride_getterinfo.get() } },
30102 },
30103 setter: JSPropertySpec_Accessor {
30104 native: JSNativeWrapper { op: None, info: ptr::null() },
30105 }
30106 }
30107 }
30108 }
30109,
30110 JSPropertySpec {
30111 name: JSPropertySpec_Name { string_: c"maxInterStageShaderComponents".as_ptr() },
30112 attributes_: (JSPROP_ENUMERATE),
30113 kind_: (JSPropertySpec_Kind::NativeAccessor),
30114 u: JSPropertySpec_AccessorsOrValue {
30115 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
30116 getter: JSPropertySpec_Accessor {
30117 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxInterStageShaderComponents_getterinfo.get() } },
30118 },
30119 setter: JSPropertySpec_Accessor {
30120 native: JSNativeWrapper { op: None, info: ptr::null() },
30121 }
30122 }
30123 }
30124 }
30125,
30126 JSPropertySpec {
30127 name: JSPropertySpec_Name { string_: c"maxInterStageShaderVariables".as_ptr() },
30128 attributes_: (JSPROP_ENUMERATE),
30129 kind_: (JSPropertySpec_Kind::NativeAccessor),
30130 u: JSPropertySpec_AccessorsOrValue {
30131 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
30132 getter: JSPropertySpec_Accessor {
30133 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxInterStageShaderVariables_getterinfo.get() } },
30134 },
30135 setter: JSPropertySpec_Accessor {
30136 native: JSNativeWrapper { op: None, info: ptr::null() },
30137 }
30138 }
30139 }
30140 }
30141,
30142 JSPropertySpec {
30143 name: JSPropertySpec_Name { string_: c"maxColorAttachments".as_ptr() },
30144 attributes_: (JSPROP_ENUMERATE),
30145 kind_: (JSPropertySpec_Kind::NativeAccessor),
30146 u: JSPropertySpec_AccessorsOrValue {
30147 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
30148 getter: JSPropertySpec_Accessor {
30149 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxColorAttachments_getterinfo.get() } },
30150 },
30151 setter: JSPropertySpec_Accessor {
30152 native: JSNativeWrapper { op: None, info: ptr::null() },
30153 }
30154 }
30155 }
30156 }
30157,
30158 JSPropertySpec {
30159 name: JSPropertySpec_Name { string_: c"maxColorAttachmentBytesPerSample".as_ptr() },
30160 attributes_: (JSPROP_ENUMERATE),
30161 kind_: (JSPropertySpec_Kind::NativeAccessor),
30162 u: JSPropertySpec_AccessorsOrValue {
30163 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
30164 getter: JSPropertySpec_Accessor {
30165 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxColorAttachmentBytesPerSample_getterinfo.get() } },
30166 },
30167 setter: JSPropertySpec_Accessor {
30168 native: JSNativeWrapper { op: None, info: ptr::null() },
30169 }
30170 }
30171 }
30172 }
30173,
30174 JSPropertySpec {
30175 name: JSPropertySpec_Name { string_: c"maxComputeWorkgroupStorageSize".as_ptr() },
30176 attributes_: (JSPROP_ENUMERATE),
30177 kind_: (JSPropertySpec_Kind::NativeAccessor),
30178 u: JSPropertySpec_AccessorsOrValue {
30179 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
30180 getter: JSPropertySpec_Accessor {
30181 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxComputeWorkgroupStorageSize_getterinfo.get() } },
30182 },
30183 setter: JSPropertySpec_Accessor {
30184 native: JSNativeWrapper { op: None, info: ptr::null() },
30185 }
30186 }
30187 }
30188 }
30189,
30190 JSPropertySpec {
30191 name: JSPropertySpec_Name { string_: c"maxComputeInvocationsPerWorkgroup".as_ptr() },
30192 attributes_: (JSPROP_ENUMERATE),
30193 kind_: (JSPropertySpec_Kind::NativeAccessor),
30194 u: JSPropertySpec_AccessorsOrValue {
30195 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
30196 getter: JSPropertySpec_Accessor {
30197 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxComputeInvocationsPerWorkgroup_getterinfo.get() } },
30198 },
30199 setter: JSPropertySpec_Accessor {
30200 native: JSNativeWrapper { op: None, info: ptr::null() },
30201 }
30202 }
30203 }
30204 }
30205,
30206 JSPropertySpec {
30207 name: JSPropertySpec_Name { string_: c"maxComputeWorkgroupSizeX".as_ptr() },
30208 attributes_: (JSPROP_ENUMERATE),
30209 kind_: (JSPropertySpec_Kind::NativeAccessor),
30210 u: JSPropertySpec_AccessorsOrValue {
30211 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
30212 getter: JSPropertySpec_Accessor {
30213 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxComputeWorkgroupSizeX_getterinfo.get() } },
30214 },
30215 setter: JSPropertySpec_Accessor {
30216 native: JSNativeWrapper { op: None, info: ptr::null() },
30217 }
30218 }
30219 }
30220 }
30221,
30222 JSPropertySpec {
30223 name: JSPropertySpec_Name { string_: c"maxComputeWorkgroupSizeY".as_ptr() },
30224 attributes_: (JSPROP_ENUMERATE),
30225 kind_: (JSPropertySpec_Kind::NativeAccessor),
30226 u: JSPropertySpec_AccessorsOrValue {
30227 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
30228 getter: JSPropertySpec_Accessor {
30229 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxComputeWorkgroupSizeY_getterinfo.get() } },
30230 },
30231 setter: JSPropertySpec_Accessor {
30232 native: JSNativeWrapper { op: None, info: ptr::null() },
30233 }
30234 }
30235 }
30236 }
30237,
30238 JSPropertySpec {
30239 name: JSPropertySpec_Name { string_: c"maxComputeWorkgroupSizeZ".as_ptr() },
30240 attributes_: (JSPROP_ENUMERATE),
30241 kind_: (JSPropertySpec_Kind::NativeAccessor),
30242 u: JSPropertySpec_AccessorsOrValue {
30243 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
30244 getter: JSPropertySpec_Accessor {
30245 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxComputeWorkgroupSizeZ_getterinfo.get() } },
30246 },
30247 setter: JSPropertySpec_Accessor {
30248 native: JSNativeWrapper { op: None, info: ptr::null() },
30249 }
30250 }
30251 }
30252 }
30253,
30254 JSPropertySpec {
30255 name: JSPropertySpec_Name { string_: c"maxComputeWorkgroupsPerDimension".as_ptr() },
30256 attributes_: (JSPROP_ENUMERATE),
30257 kind_: (JSPropertySpec_Kind::NativeAccessor),
30258 u: JSPropertySpec_AccessorsOrValue {
30259 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
30260 getter: JSPropertySpec_Accessor {
30261 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { maxComputeWorkgroupsPerDimension_getterinfo.get() } },
30262 },
30263 setter: JSPropertySpec_Accessor {
30264 native: JSNativeWrapper { op: None, info: ptr::null() },
30265 }
30266 }
30267 }
30268 }
30269,
30270 JSPropertySpec::ZERO]))[..]
30271,
30272&Box::leak(Box::new([
30273 JSPropertySpec {
30274 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
30275 attributes_: (JSPROP_READONLY),
30276 kind_: (JSPropertySpec_Kind::Value),
30277 u: JSPropertySpec_AccessorsOrValue {
30278 value: JSPropertySpec_ValueWrapper {
30279 type_: JSPropertySpec_ValueWrapper_Type::String,
30280 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
30281 string: c"GPUSupportedLimits".as_ptr(),
30282 }
30283 }
30284 }
30285 }
30286,
30287 JSPropertySpec::ZERO]))[..]
30288])));
30289}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
30290
30291pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
30292 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
30293 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
30294}
30295pub fn GetProtoObject<D: DomTypes>
30296(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
30297 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUSupportedLimits), CreateInterfaceObjects::<D>, rval)
30299}
30300
30301
30302static PrototypeClass: JSClass = JSClass {
30303 name: c"GPUSupportedLimitsPrototype".as_ptr(),
30304 flags:
30305 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
30307 cOps: ptr::null(),
30308 spec: ptr::null(),
30309 ext: ptr::null(),
30310 oOps: ptr::null(),
30311};
30312
30313
30314static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
30315
30316pub(crate) fn init_interface_object<D: DomTypes>() {
30317 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
30318 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
30319 b"function GPUSupportedLimits() {\n [native code]\n}",
30320 PrototypeList::ID::GPUSupportedLimits,
30321 0,
30322 ));
30323}
30324
30325pub fn DefineDOMInterface<D: DomTypes>
30326(cx: SafeJSContext, global: HandleObject){
30327 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUSupportedLimits),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
30328}
30329
30330pub fn ConstructorEnabled<D: DomTypes>
30331(aCx: SafeJSContext, aObj: HandleObject) -> bool{
30332 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
30333 pref!(dom_webgpu_enabled)
30334}
30335
30336unsafe fn CreateInterfaceObjects<D: DomTypes>
30337(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
30338
30339 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
30340 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
30341 assert!(!prototype_proto.is_null());
30342
30343 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
30344 create_interface_prototype_object::<D>(cx,
30345 global,
30346 prototype_proto.handle(),
30347 &PrototypeClass,
30348 &[],
30349 sAttributes.get(),
30350 &[],
30351 &[],
30352 prototype.handle_mut());
30353 assert!(!prototype.is_null());
30354 assert!((*cache)[PrototypeList::ID::GPUSupportedLimits as usize].is_null());
30355 (*cache)[PrototypeList::ID::GPUSupportedLimits as usize] = prototype.get();
30356 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUSupportedLimits as isize),
30357 ptr::null_mut(),
30358 prototype.get());
30359
30360 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
30361 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
30362
30363 assert!(!interface_proto.is_null());
30364
30365 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
30366 create_noncallback_interface_object::<D>(cx,
30367 global,
30368 interface_proto.handle(),
30369 INTERFACE_OBJECT_CLASS.get(),
30370 &[],
30371 &[],
30372 &[],
30373 prototype.handle(),
30374 c"GPUSupportedLimits",
30375 0,
30376 &[],
30377 interface.handle_mut());
30378 assert!(!interface.is_null());
30379}
30380
30381
30382 pub(crate) fn init_statics<D: DomTypes>() {
30383 init_interface_object::<D>();
30384 init_domjs_class::<D>();
30385
30386 init_maxTextureDimension1D_getterinfo::<D>();
30387init_maxTextureDimension2D_getterinfo::<D>();
30388init_maxTextureDimension3D_getterinfo::<D>();
30389init_maxTextureArrayLayers_getterinfo::<D>();
30390init_maxBindGroups_getterinfo::<D>();
30391init_maxBindGroupsPlusVertexBuffers_getterinfo::<D>();
30392init_maxBindingsPerBindGroup_getterinfo::<D>();
30393init_maxDynamicUniformBuffersPerPipelineLayout_getterinfo::<D>();
30394init_maxDynamicStorageBuffersPerPipelineLayout_getterinfo::<D>();
30395init_maxSampledTexturesPerShaderStage_getterinfo::<D>();
30396init_maxSamplersPerShaderStage_getterinfo::<D>();
30397init_maxStorageBuffersPerShaderStage_getterinfo::<D>();
30398init_maxStorageTexturesPerShaderStage_getterinfo::<D>();
30399init_maxUniformBuffersPerShaderStage_getterinfo::<D>();
30400init_maxUniformBufferBindingSize_getterinfo::<D>();
30401init_maxStorageBufferBindingSize_getterinfo::<D>();
30402init_minUniformBufferOffsetAlignment_getterinfo::<D>();
30403init_minStorageBufferOffsetAlignment_getterinfo::<D>();
30404init_maxVertexBuffers_getterinfo::<D>();
30405init_maxBufferSize_getterinfo::<D>();
30406init_maxVertexAttributes_getterinfo::<D>();
30407init_maxVertexBufferArrayStride_getterinfo::<D>();
30408init_maxInterStageShaderComponents_getterinfo::<D>();
30409init_maxInterStageShaderVariables_getterinfo::<D>();
30410init_maxColorAttachments_getterinfo::<D>();
30411init_maxColorAttachmentBytesPerSample_getterinfo::<D>();
30412init_maxComputeWorkgroupStorageSize_getterinfo::<D>();
30413init_maxComputeInvocationsPerWorkgroup_getterinfo::<D>();
30414init_maxComputeWorkgroupSizeX_getterinfo::<D>();
30415init_maxComputeWorkgroupSizeY_getterinfo::<D>();
30416init_maxComputeWorkgroupSizeZ_getterinfo::<D>();
30417init_maxComputeWorkgroupsPerDimension_getterinfo::<D>();
30418
30419
30420 init_sAttributes_specs::<D>();
30421init_sAttributes_prefs::<D>();
30422 }
30423 } pub use self::GPUTexture_Binding::{Wrap as GPUTextureWrap, GPUTextureMethods, GetProtoObject as GPUTextureGetProtoObject, DefineDOMInterface as GPUTextureDefineDOMInterface};
30427pub mod GPUTexture_Binding {
30428use crate::codegen::GenericBindings::WebGPUBinding::GPUTextureAspect;
30429use crate::codegen::GenericBindings::WebGPUBinding::GPUTextureAspectValues;
30430use crate::codegen::GenericBindings::WebGPUBinding::GPUTextureDimension;
30431use crate::codegen::GenericBindings::WebGPUBinding::GPUTextureDimensionValues;
30432use crate::codegen::GenericBindings::WebGPUBinding::GPUTextureFormat;
30433use crate::codegen::GenericBindings::WebGPUBinding::GPUTextureFormatValues;
30434use crate::codegen::GenericBindings::WebGPUBinding::GPUTextureViewDescriptor;
30435use crate::codegen::GenericBindings::WebGPUBinding::GPUTextureViewDimension;
30436use crate::codegen::GenericBindings::WebGPUBinding::GPUTextureViewDimensionValues;
30437use crate::import::module::*;
30438
30439unsafe extern "C" fn createView<D: DomTypes>
30440(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
30441 let mut result = false;
30442 wrap_panic(&mut || result = (|| {
30443 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
30444 let this = &*(this as *const D::GPUTexture);
30445 let args = &*args;
30446 let argc = args.argc_;
30447 let arg0: crate::codegen::GenericBindings::WebGPUBinding::GPUTextureViewDescriptor = if args.get(0).is_undefined() {
30448 crate::codegen::GenericBindings::WebGPUBinding::GPUTextureViewDescriptor::empty()
30449 } else {
30450 match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
30451 Ok(ConversionResult::Success(value)) => value,
30452 Ok(ConversionResult::Failure(error)) => {
30453 throw_type_error(cx.raw_cx(), &error);
30454 return false;
30455
30456 }
30457 _ => {
30458 return false;
30459
30460 },
30461 }
30462
30463 };
30464 let result: Result<DomRoot<D::GPUTextureView>, Error> = this.CreateView(&arg0);
30465 let result = match result {
30466 Ok(result) => result,
30467 Err(e) => {
30468 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
30469 return false;
30470 },
30471 };
30472
30473 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
30474 return true;
30475 })());
30476 result
30477}
30478
30479
30480static createView_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
30481
30482pub(crate) fn init_createView_methodinfo<D: DomTypes>() {
30483 createView_methodinfo.set(JSJitInfo {
30484 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
30485 method: Some(createView::<D>)
30486 },
30487 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
30488 protoID: PrototypeList::ID::GPUTexture as u16,
30489 },
30490 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
30491 _bitfield_align_1: [],
30492 _bitfield_1: __BindgenBitfieldUnit::new(
30493 new_jsjitinfo_bitfield_1!(
30494 JSJitInfo_OpType::Method as u8,
30495 JSJitInfo_AliasSet::AliasEverything as u8,
30496 JSValueType::JSVAL_TYPE_OBJECT as u8,
30497 false,
30498 false,
30499 false,
30500 false,
30501 false,
30502 false,
30503 0,
30504 ).to_ne_bytes()
30505 ),
30506});
30507}
30508unsafe extern "C" fn destroy<D: DomTypes>
30509(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
30510 let mut result = false;
30511 wrap_panic(&mut || result = (|| {
30512 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
30513 let this = &*(this as *const D::GPUTexture);
30514 let args = &*args;
30515 let argc = args.argc_;
30516 let result: () = this.Destroy();
30517
30518 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
30519 return true;
30520 })());
30521 result
30522}
30523
30524
30525static destroy_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
30526
30527pub(crate) fn init_destroy_methodinfo<D: DomTypes>() {
30528 destroy_methodinfo.set(JSJitInfo {
30529 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
30530 method: Some(destroy::<D>)
30531 },
30532 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
30533 protoID: PrototypeList::ID::GPUTexture as u16,
30534 },
30535 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
30536 _bitfield_align_1: [],
30537 _bitfield_1: __BindgenBitfieldUnit::new(
30538 new_jsjitinfo_bitfield_1!(
30539 JSJitInfo_OpType::Method as u8,
30540 JSJitInfo_AliasSet::AliasEverything as u8,
30541 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
30542 true,
30543 false,
30544 false,
30545 false,
30546 false,
30547 false,
30548 0,
30549 ).to_ne_bytes()
30550 ),
30551});
30552}
30553unsafe extern "C" fn get_width<D: DomTypes>
30554(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
30555 let mut result = false;
30556 wrap_panic(&mut || result = (|| {
30557 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
30558 let this = &*(this as *const D::GPUTexture);
30559 let result: u32 = this.Width();
30560
30561 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
30562 return true;
30563 })());
30564 result
30565}
30566
30567
30568static width_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
30569
30570pub(crate) fn init_width_getterinfo<D: DomTypes>() {
30571 width_getterinfo.set(JSJitInfo {
30572 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
30573 getter: Some(get_width::<D>)
30574 },
30575 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
30576 protoID: PrototypeList::ID::GPUTexture as u16,
30577 },
30578 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
30579 _bitfield_align_1: [],
30580 _bitfield_1: __BindgenBitfieldUnit::new(
30581 new_jsjitinfo_bitfield_1!(
30582 JSJitInfo_OpType::Getter as u8,
30583 JSJitInfo_AliasSet::AliasEverything as u8,
30584 JSValueType::JSVAL_TYPE_DOUBLE as u8,
30585 true,
30586 false,
30587 false,
30588 false,
30589 false,
30590 false,
30591 0,
30592 ).to_ne_bytes()
30593 ),
30594});
30595}
30596unsafe extern "C" fn get_height<D: DomTypes>
30597(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
30598 let mut result = false;
30599 wrap_panic(&mut || result = (|| {
30600 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
30601 let this = &*(this as *const D::GPUTexture);
30602 let result: u32 = this.Height();
30603
30604 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
30605 return true;
30606 })());
30607 result
30608}
30609
30610
30611static height_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
30612
30613pub(crate) fn init_height_getterinfo<D: DomTypes>() {
30614 height_getterinfo.set(JSJitInfo {
30615 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
30616 getter: Some(get_height::<D>)
30617 },
30618 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
30619 protoID: PrototypeList::ID::GPUTexture as u16,
30620 },
30621 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
30622 _bitfield_align_1: [],
30623 _bitfield_1: __BindgenBitfieldUnit::new(
30624 new_jsjitinfo_bitfield_1!(
30625 JSJitInfo_OpType::Getter as u8,
30626 JSJitInfo_AliasSet::AliasEverything as u8,
30627 JSValueType::JSVAL_TYPE_DOUBLE as u8,
30628 true,
30629 false,
30630 false,
30631 false,
30632 false,
30633 false,
30634 0,
30635 ).to_ne_bytes()
30636 ),
30637});
30638}
30639unsafe extern "C" fn get_depthOrArrayLayers<D: DomTypes>
30640(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
30641 let mut result = false;
30642 wrap_panic(&mut || result = (|| {
30643 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
30644 let this = &*(this as *const D::GPUTexture);
30645 let result: u32 = this.DepthOrArrayLayers();
30646
30647 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
30648 return true;
30649 })());
30650 result
30651}
30652
30653
30654static depthOrArrayLayers_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
30655
30656pub(crate) fn init_depthOrArrayLayers_getterinfo<D: DomTypes>() {
30657 depthOrArrayLayers_getterinfo.set(JSJitInfo {
30658 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
30659 getter: Some(get_depthOrArrayLayers::<D>)
30660 },
30661 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
30662 protoID: PrototypeList::ID::GPUTexture as u16,
30663 },
30664 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
30665 _bitfield_align_1: [],
30666 _bitfield_1: __BindgenBitfieldUnit::new(
30667 new_jsjitinfo_bitfield_1!(
30668 JSJitInfo_OpType::Getter as u8,
30669 JSJitInfo_AliasSet::AliasEverything as u8,
30670 JSValueType::JSVAL_TYPE_DOUBLE as u8,
30671 true,
30672 false,
30673 false,
30674 false,
30675 false,
30676 false,
30677 0,
30678 ).to_ne_bytes()
30679 ),
30680});
30681}
30682unsafe extern "C" fn get_mipLevelCount<D: DomTypes>
30683(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
30684 let mut result = false;
30685 wrap_panic(&mut || result = (|| {
30686 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
30687 let this = &*(this as *const D::GPUTexture);
30688 let result: u32 = this.MipLevelCount();
30689
30690 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
30691 return true;
30692 })());
30693 result
30694}
30695
30696
30697static mipLevelCount_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
30698
30699pub(crate) fn init_mipLevelCount_getterinfo<D: DomTypes>() {
30700 mipLevelCount_getterinfo.set(JSJitInfo {
30701 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
30702 getter: Some(get_mipLevelCount::<D>)
30703 },
30704 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
30705 protoID: PrototypeList::ID::GPUTexture as u16,
30706 },
30707 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
30708 _bitfield_align_1: [],
30709 _bitfield_1: __BindgenBitfieldUnit::new(
30710 new_jsjitinfo_bitfield_1!(
30711 JSJitInfo_OpType::Getter as u8,
30712 JSJitInfo_AliasSet::AliasEverything as u8,
30713 JSValueType::JSVAL_TYPE_DOUBLE as u8,
30714 true,
30715 false,
30716 false,
30717 false,
30718 false,
30719 false,
30720 0,
30721 ).to_ne_bytes()
30722 ),
30723});
30724}
30725unsafe extern "C" fn get_sampleCount<D: DomTypes>
30726(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
30727 let mut result = false;
30728 wrap_panic(&mut || result = (|| {
30729 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
30730 let this = &*(this as *const D::GPUTexture);
30731 let result: u32 = this.SampleCount();
30732
30733 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
30734 return true;
30735 })());
30736 result
30737}
30738
30739
30740static sampleCount_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
30741
30742pub(crate) fn init_sampleCount_getterinfo<D: DomTypes>() {
30743 sampleCount_getterinfo.set(JSJitInfo {
30744 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
30745 getter: Some(get_sampleCount::<D>)
30746 },
30747 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
30748 protoID: PrototypeList::ID::GPUTexture as u16,
30749 },
30750 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
30751 _bitfield_align_1: [],
30752 _bitfield_1: __BindgenBitfieldUnit::new(
30753 new_jsjitinfo_bitfield_1!(
30754 JSJitInfo_OpType::Getter as u8,
30755 JSJitInfo_AliasSet::AliasEverything as u8,
30756 JSValueType::JSVAL_TYPE_DOUBLE as u8,
30757 true,
30758 false,
30759 false,
30760 false,
30761 false,
30762 false,
30763 0,
30764 ).to_ne_bytes()
30765 ),
30766});
30767}
30768unsafe extern "C" fn get_dimension<D: DomTypes>
30769(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
30770 let mut result = false;
30771 wrap_panic(&mut || result = (|| {
30772 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
30773 let this = &*(this as *const D::GPUTexture);
30774 let result: GPUTextureDimension = this.Dimension();
30775
30776 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
30777 return true;
30778 })());
30779 result
30780}
30781
30782
30783static dimension_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
30784
30785pub(crate) fn init_dimension_getterinfo<D: DomTypes>() {
30786 dimension_getterinfo.set(JSJitInfo {
30787 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
30788 getter: Some(get_dimension::<D>)
30789 },
30790 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
30791 protoID: PrototypeList::ID::GPUTexture as u16,
30792 },
30793 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
30794 _bitfield_align_1: [],
30795 _bitfield_1: __BindgenBitfieldUnit::new(
30796 new_jsjitinfo_bitfield_1!(
30797 JSJitInfo_OpType::Getter as u8,
30798 JSJitInfo_AliasSet::AliasEverything as u8,
30799 JSValueType::JSVAL_TYPE_STRING as u8,
30800 true,
30801 false,
30802 false,
30803 false,
30804 false,
30805 false,
30806 0,
30807 ).to_ne_bytes()
30808 ),
30809});
30810}
30811unsafe extern "C" fn get_format<D: DomTypes>
30812(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
30813 let mut result = false;
30814 wrap_panic(&mut || result = (|| {
30815 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
30816 let this = &*(this as *const D::GPUTexture);
30817 let result: GPUTextureFormat = this.Format();
30818
30819 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
30820 return true;
30821 })());
30822 result
30823}
30824
30825
30826static format_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
30827
30828pub(crate) fn init_format_getterinfo<D: DomTypes>() {
30829 format_getterinfo.set(JSJitInfo {
30830 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
30831 getter: Some(get_format::<D>)
30832 },
30833 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
30834 protoID: PrototypeList::ID::GPUTexture as u16,
30835 },
30836 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
30837 _bitfield_align_1: [],
30838 _bitfield_1: __BindgenBitfieldUnit::new(
30839 new_jsjitinfo_bitfield_1!(
30840 JSJitInfo_OpType::Getter as u8,
30841 JSJitInfo_AliasSet::AliasEverything as u8,
30842 JSValueType::JSVAL_TYPE_STRING as u8,
30843 true,
30844 false,
30845 false,
30846 false,
30847 false,
30848 false,
30849 0,
30850 ).to_ne_bytes()
30851 ),
30852});
30853}
30854unsafe extern "C" fn get_usage<D: DomTypes>
30855(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
30856 let mut result = false;
30857 wrap_panic(&mut || result = (|| {
30858 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
30859 let this = &*(this as *const D::GPUTexture);
30860 let result: u32 = this.Usage();
30861
30862 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
30863 return true;
30864 })());
30865 result
30866}
30867
30868
30869static usage_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
30870
30871pub(crate) fn init_usage_getterinfo<D: DomTypes>() {
30872 usage_getterinfo.set(JSJitInfo {
30873 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
30874 getter: Some(get_usage::<D>)
30875 },
30876 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
30877 protoID: PrototypeList::ID::GPUTexture as u16,
30878 },
30879 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
30880 _bitfield_align_1: [],
30881 _bitfield_1: __BindgenBitfieldUnit::new(
30882 new_jsjitinfo_bitfield_1!(
30883 JSJitInfo_OpType::Getter as u8,
30884 JSJitInfo_AliasSet::AliasEverything as u8,
30885 JSValueType::JSVAL_TYPE_DOUBLE as u8,
30886 true,
30887 false,
30888 false,
30889 false,
30890 false,
30891 false,
30892 0,
30893 ).to_ne_bytes()
30894 ),
30895});
30896}
30897unsafe extern "C" fn get_label<D: DomTypes>
30898(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
30899 let mut result = false;
30900 wrap_panic(&mut || result = (|| {
30901 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
30902 let this = &*(this as *const D::GPUTexture);
30903 let result: USVString = this.Label();
30904
30905 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
30906 return true;
30907 })());
30908 result
30909}
30910
30911unsafe extern "C" fn set_label<D: DomTypes>
30912(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
30913 let mut result = false;
30914 wrap_panic(&mut || result = (|| {
30915 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
30916 let this = &*(this as *const D::GPUTexture);
30917 let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
30918 Ok(ConversionResult::Success(value)) => value,
30919 Ok(ConversionResult::Failure(error)) => {
30920 throw_type_error(cx.raw_cx(), &error);
30921 return false;
30922
30923 }
30924 _ => {
30925 return false;
30926
30927 },
30928 }
30929 ;
30930 let result: () = this.SetLabel(arg0);
30931
30932 true
30933 })());
30934 result
30935}
30936
30937
30938static label_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
30939
30940pub(crate) fn init_label_getterinfo<D: DomTypes>() {
30941 label_getterinfo.set(JSJitInfo {
30942 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
30943 getter: Some(get_label::<D>)
30944 },
30945 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
30946 protoID: PrototypeList::ID::GPUTexture as u16,
30947 },
30948 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
30949 _bitfield_align_1: [],
30950 _bitfield_1: __BindgenBitfieldUnit::new(
30951 new_jsjitinfo_bitfield_1!(
30952 JSJitInfo_OpType::Getter as u8,
30953 JSJitInfo_AliasSet::AliasEverything as u8,
30954 JSValueType::JSVAL_TYPE_STRING as u8,
30955 true,
30956 false,
30957 false,
30958 false,
30959 false,
30960 false,
30961 0,
30962 ).to_ne_bytes()
30963 ),
30964});
30965}
30966static label_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
30967
30968pub(crate) fn init_label_setterinfo<D: DomTypes>() {
30969 label_setterinfo.set(JSJitInfo {
30970 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
30971 setter: Some(set_label::<D>)
30972 },
30973 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
30974 protoID: PrototypeList::ID::GPUTexture as u16,
30975 },
30976 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
30977 _bitfield_align_1: [],
30978 _bitfield_1: __BindgenBitfieldUnit::new(
30979 new_jsjitinfo_bitfield_1!(
30980 JSJitInfo_OpType::Setter as u8,
30981 JSJitInfo_AliasSet::AliasEverything as u8,
30982 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
30983 false,
30984 false,
30985 false,
30986 false,
30987 false,
30988 false,
30989 0,
30990 ).to_ne_bytes()
30991 ),
30992});
30993}
30994unsafe extern "C" fn _finalize<D: DomTypes>
30995(_cx: *mut GCContext, obj: *mut JSObject){
30996 wrap_panic(&mut || {
30997
30998 let this = native_from_object_static::<D::GPUTexture>(obj).unwrap();
30999 finalize_common(this);
31000 })
31001}
31002
31003unsafe extern "C" fn _trace<D: DomTypes>
31004(trc: *mut JSTracer, obj: *mut JSObject){
31005 wrap_panic(&mut || {
31006
31007 let this = native_from_object_static::<D::GPUTexture>(obj).unwrap();
31008 if this.is_null() { return; } (*this).trace(trc);
31010 })
31011}
31012
31013
31014static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
31015
31016pub(crate) fn init_class_ops<D: DomTypes>() {
31017 CLASS_OPS.set(JSClassOps {
31018 addProperty: None,
31019 delProperty: None,
31020 enumerate: None,
31021 newEnumerate: None,
31022 resolve: None,
31023 mayResolve: None,
31024 finalize: Some(_finalize::<D>),
31025 call: None,
31026 construct: None,
31027 trace: Some(_trace::<D>),
31028 });
31029}
31030
31031pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
31032
31033pub(crate) fn init_domjs_class<D: DomTypes>() {
31034 init_class_ops::<D>();
31035 Class.set(DOMJSClass {
31036 base: JSClass {
31037 name: c"GPUTexture".as_ptr(),
31038 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
31039 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
31040 ,
31041 cOps: unsafe { CLASS_OPS.get() },
31042 spec: ptr::null(),
31043 ext: ptr::null(),
31044 oOps: ptr::null(),
31045 },
31046 dom_class:
31047DOMClass {
31048 interface_chain: [ PrototypeList::ID::GPUTexture, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
31049 depth: 0,
31050 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
31051 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUTexture> as unsafe fn(&mut _, _) -> _,
31052 global: Globals::EMPTY,
31053},
31054 });
31055}
31056
31057#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
31058(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUTexture>, _can_gc: CanGc) -> DomRoot<D::GPUTexture>{
31059
31060 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
31061
31062 let scope = scope.reflector().get_jsobject();
31063 assert!(!scope.get().is_null());
31064 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
31065 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
31066
31067 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
31068 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
31069 assert!(!canonical_proto.is_null());
31070
31071
31072 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
31073 if let Some(given) = given_proto {
31074 proto.set(*given);
31075 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
31076 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
31077 }
31078 } else {
31079 proto.set(*canonical_proto);
31080 }
31081 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
31082 cx.raw_cx(),
31083 &Class.get().base,
31084 proto.handle(),
31085 ));
31086 assert!(!obj.is_null());
31087 JS_SetReservedSlot(
31088 obj.get(),
31089 DOM_OBJECT_SLOT,
31090 &PrivateValue(raw.as_ptr() as *const libc::c_void),
31091 );
31092
31093 let root = raw.reflect_with(obj.get());
31094
31095
31096
31097 DomRoot::from_ref(&*root)
31098}
31099
31100pub trait GPUTextureMethods<D: DomTypes> {
31101 fn CreateView(&self, r#descriptor: &crate::codegen::GenericBindings::WebGPUBinding::GPUTextureViewDescriptor) -> Fallible<DomRoot<D::GPUTextureView>>;
31102 fn Destroy(&self, );
31103 fn Width(&self, ) -> u32;
31104 fn Height(&self, ) -> u32;
31105 fn DepthOrArrayLayers(&self, ) -> u32;
31106 fn MipLevelCount(&self, ) -> u32;
31107 fn SampleCount(&self, ) -> u32;
31108 fn Dimension(&self, ) -> GPUTextureDimension;
31109 fn Format(&self, ) -> GPUTextureFormat;
31110 fn Usage(&self, ) -> u32;
31111 fn Label(&self, ) -> USVString;
31112 fn SetLabel(&self, r#value: USVString);
31113}
31114static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
31115
31116pub(crate) fn init_sMethods_specs<D: DomTypes>() {
31117 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
31118 JSFunctionSpec {
31119 name: JSPropertySpec_Name { string_: c"createView".as_ptr() },
31120 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { createView_methodinfo.get() } as *const _ as *const JSJitInfo },
31121 nargs: 0,
31122 flags: (JSPROP_ENUMERATE) as u16,
31123 selfHostedName: ptr::null()
31124 },
31125 JSFunctionSpec {
31126 name: JSPropertySpec_Name { string_: c"destroy".as_ptr() },
31127 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { destroy_methodinfo.get() } as *const _ as *const JSJitInfo },
31128 nargs: 0,
31129 flags: (JSPROP_ENUMERATE) as u16,
31130 selfHostedName: ptr::null()
31131 },
31132 JSFunctionSpec {
31133 name: JSPropertySpec_Name { string_: ptr::null() },
31134 call: JSNativeWrapper { op: None, info: ptr::null() },
31135 nargs: 0,
31136 flags: 0,
31137 selfHostedName: ptr::null()
31138 }]))[..]
31139])));
31140}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
31141
31142pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
31143 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sMethods_specs.get() })[0])])));
31144}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
31145
31146pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
31147 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
31148 JSPropertySpec {
31149 name: JSPropertySpec_Name { string_: c"width".as_ptr() },
31150 attributes_: (JSPROP_ENUMERATE),
31151 kind_: (JSPropertySpec_Kind::NativeAccessor),
31152 u: JSPropertySpec_AccessorsOrValue {
31153 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
31154 getter: JSPropertySpec_Accessor {
31155 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { width_getterinfo.get() } },
31156 },
31157 setter: JSPropertySpec_Accessor {
31158 native: JSNativeWrapper { op: None, info: ptr::null() },
31159 }
31160 }
31161 }
31162 }
31163,
31164 JSPropertySpec {
31165 name: JSPropertySpec_Name { string_: c"height".as_ptr() },
31166 attributes_: (JSPROP_ENUMERATE),
31167 kind_: (JSPropertySpec_Kind::NativeAccessor),
31168 u: JSPropertySpec_AccessorsOrValue {
31169 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
31170 getter: JSPropertySpec_Accessor {
31171 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { height_getterinfo.get() } },
31172 },
31173 setter: JSPropertySpec_Accessor {
31174 native: JSNativeWrapper { op: None, info: ptr::null() },
31175 }
31176 }
31177 }
31178 }
31179,
31180 JSPropertySpec {
31181 name: JSPropertySpec_Name { string_: c"depthOrArrayLayers".as_ptr() },
31182 attributes_: (JSPROP_ENUMERATE),
31183 kind_: (JSPropertySpec_Kind::NativeAccessor),
31184 u: JSPropertySpec_AccessorsOrValue {
31185 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
31186 getter: JSPropertySpec_Accessor {
31187 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { depthOrArrayLayers_getterinfo.get() } },
31188 },
31189 setter: JSPropertySpec_Accessor {
31190 native: JSNativeWrapper { op: None, info: ptr::null() },
31191 }
31192 }
31193 }
31194 }
31195,
31196 JSPropertySpec {
31197 name: JSPropertySpec_Name { string_: c"mipLevelCount".as_ptr() },
31198 attributes_: (JSPROP_ENUMERATE),
31199 kind_: (JSPropertySpec_Kind::NativeAccessor),
31200 u: JSPropertySpec_AccessorsOrValue {
31201 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
31202 getter: JSPropertySpec_Accessor {
31203 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { mipLevelCount_getterinfo.get() } },
31204 },
31205 setter: JSPropertySpec_Accessor {
31206 native: JSNativeWrapper { op: None, info: ptr::null() },
31207 }
31208 }
31209 }
31210 }
31211,
31212 JSPropertySpec {
31213 name: JSPropertySpec_Name { string_: c"sampleCount".as_ptr() },
31214 attributes_: (JSPROP_ENUMERATE),
31215 kind_: (JSPropertySpec_Kind::NativeAccessor),
31216 u: JSPropertySpec_AccessorsOrValue {
31217 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
31218 getter: JSPropertySpec_Accessor {
31219 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { sampleCount_getterinfo.get() } },
31220 },
31221 setter: JSPropertySpec_Accessor {
31222 native: JSNativeWrapper { op: None, info: ptr::null() },
31223 }
31224 }
31225 }
31226 }
31227,
31228 JSPropertySpec {
31229 name: JSPropertySpec_Name { string_: c"dimension".as_ptr() },
31230 attributes_: (JSPROP_ENUMERATE),
31231 kind_: (JSPropertySpec_Kind::NativeAccessor),
31232 u: JSPropertySpec_AccessorsOrValue {
31233 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
31234 getter: JSPropertySpec_Accessor {
31235 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { dimension_getterinfo.get() } },
31236 },
31237 setter: JSPropertySpec_Accessor {
31238 native: JSNativeWrapper { op: None, info: ptr::null() },
31239 }
31240 }
31241 }
31242 }
31243,
31244 JSPropertySpec {
31245 name: JSPropertySpec_Name { string_: c"format".as_ptr() },
31246 attributes_: (JSPROP_ENUMERATE),
31247 kind_: (JSPropertySpec_Kind::NativeAccessor),
31248 u: JSPropertySpec_AccessorsOrValue {
31249 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
31250 getter: JSPropertySpec_Accessor {
31251 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { format_getterinfo.get() } },
31252 },
31253 setter: JSPropertySpec_Accessor {
31254 native: JSNativeWrapper { op: None, info: ptr::null() },
31255 }
31256 }
31257 }
31258 }
31259,
31260 JSPropertySpec {
31261 name: JSPropertySpec_Name { string_: c"usage".as_ptr() },
31262 attributes_: (JSPROP_ENUMERATE),
31263 kind_: (JSPropertySpec_Kind::NativeAccessor),
31264 u: JSPropertySpec_AccessorsOrValue {
31265 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
31266 getter: JSPropertySpec_Accessor {
31267 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { usage_getterinfo.get() } },
31268 },
31269 setter: JSPropertySpec_Accessor {
31270 native: JSNativeWrapper { op: None, info: ptr::null() },
31271 }
31272 }
31273 }
31274 }
31275,
31276 JSPropertySpec {
31277 name: JSPropertySpec_Name { string_: c"label".as_ptr() },
31278 attributes_: (JSPROP_ENUMERATE),
31279 kind_: (JSPropertySpec_Kind::NativeAccessor),
31280 u: JSPropertySpec_AccessorsOrValue {
31281 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
31282 getter: JSPropertySpec_Accessor {
31283 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { label_getterinfo.get() } },
31284 },
31285 setter: JSPropertySpec_Accessor {
31286 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { label_setterinfo.get() } },
31287 }
31288 }
31289 }
31290 }
31291,
31292 JSPropertySpec::ZERO]))[..]
31293,
31294&Box::leak(Box::new([
31295 JSPropertySpec {
31296 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
31297 attributes_: (JSPROP_READONLY),
31298 kind_: (JSPropertySpec_Kind::Value),
31299 u: JSPropertySpec_AccessorsOrValue {
31300 value: JSPropertySpec_ValueWrapper {
31301 type_: JSPropertySpec_ValueWrapper_Type::String,
31302 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
31303 string: c"GPUTexture".as_ptr(),
31304 }
31305 }
31306 }
31307 }
31308,
31309 JSPropertySpec::ZERO]))[..]
31310])));
31311}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
31312
31313pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
31314 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
31315 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
31316}
31317pub fn GetProtoObject<D: DomTypes>
31318(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
31319 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUTexture), CreateInterfaceObjects::<D>, rval)
31321}
31322
31323
31324static PrototypeClass: JSClass = JSClass {
31325 name: c"GPUTexturePrototype".as_ptr(),
31326 flags:
31327 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
31329 cOps: ptr::null(),
31330 spec: ptr::null(),
31331 ext: ptr::null(),
31332 oOps: ptr::null(),
31333};
31334
31335
31336static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
31337
31338pub(crate) fn init_interface_object<D: DomTypes>() {
31339 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
31340 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
31341 b"function GPUTexture() {\n [native code]\n}",
31342 PrototypeList::ID::GPUTexture,
31343 0,
31344 ));
31345}
31346
31347pub fn DefineDOMInterface<D: DomTypes>
31348(cx: SafeJSContext, global: HandleObject){
31349 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUTexture),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
31350}
31351
31352pub fn ConstructorEnabled<D: DomTypes>
31353(aCx: SafeJSContext, aObj: HandleObject) -> bool{
31354 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
31355 pref!(dom_webgpu_enabled)
31356}
31357
31358unsafe fn CreateInterfaceObjects<D: DomTypes>
31359(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
31360
31361 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
31362 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
31363 assert!(!prototype_proto.is_null());
31364
31365 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
31366 create_interface_prototype_object::<D>(cx,
31367 global,
31368 prototype_proto.handle(),
31369 &PrototypeClass,
31370 sMethods.get(),
31371 sAttributes.get(),
31372 &[],
31373 &[],
31374 prototype.handle_mut());
31375 assert!(!prototype.is_null());
31376 assert!((*cache)[PrototypeList::ID::GPUTexture as usize].is_null());
31377 (*cache)[PrototypeList::ID::GPUTexture as usize] = prototype.get();
31378 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUTexture as isize),
31379 ptr::null_mut(),
31380 prototype.get());
31381
31382 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
31383 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
31384
31385 assert!(!interface_proto.is_null());
31386
31387 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
31388 create_noncallback_interface_object::<D>(cx,
31389 global,
31390 interface_proto.handle(),
31391 INTERFACE_OBJECT_CLASS.get(),
31392 &[],
31393 &[],
31394 &[],
31395 prototype.handle(),
31396 c"GPUTexture",
31397 0,
31398 &[],
31399 interface.handle_mut());
31400 assert!(!interface.is_null());
31401}
31402
31403
31404 pub(crate) fn init_statics<D: DomTypes>() {
31405 init_interface_object::<D>();
31406 init_domjs_class::<D>();
31407 crate::codegen::GenericBindings::WebGPUBinding::GPUTexture_Binding::init_createView_methodinfo::<D>();
31408crate::codegen::GenericBindings::WebGPUBinding::GPUTexture_Binding::init_destroy_methodinfo::<D>();
31409 init_width_getterinfo::<D>();
31410init_height_getterinfo::<D>();
31411init_depthOrArrayLayers_getterinfo::<D>();
31412init_mipLevelCount_getterinfo::<D>();
31413init_sampleCount_getterinfo::<D>();
31414init_dimension_getterinfo::<D>();
31415init_format_getterinfo::<D>();
31416init_usage_getterinfo::<D>();
31417init_label_getterinfo::<D>();
31418 init_label_setterinfo::<D>();
31419
31420 init_sMethods_specs::<D>();
31421init_sMethods_prefs::<D>();
31422init_sAttributes_specs::<D>();
31423init_sAttributes_prefs::<D>();
31424 }
31425 } pub use self::GPUTextureUsage_Binding::{GPUTextureUsageConstants, Wrap as GPUTextureUsageWrap, GetProtoObject as GPUTextureUsageGetProtoObject, DefineDOMInterface as GPUTextureUsageDefineDOMInterface};
31429pub mod GPUTextureUsage_Binding {
31430use crate::import::module::*;
31431
31432unsafe extern "C" fn _finalize<D: DomTypes>
31433(_cx: *mut GCContext, obj: *mut JSObject){
31434 wrap_panic(&mut || {
31435
31436 let this = native_from_object_static::<D::GPUTextureUsage>(obj).unwrap();
31437 finalize_common(this);
31438 })
31439}
31440
31441unsafe extern "C" fn _trace<D: DomTypes>
31442(trc: *mut JSTracer, obj: *mut JSObject){
31443 wrap_panic(&mut || {
31444
31445 let this = native_from_object_static::<D::GPUTextureUsage>(obj).unwrap();
31446 if this.is_null() { return; } (*this).trace(trc);
31448 })
31449}
31450
31451pub mod GPUTextureUsageConstants {
31452 pub const COPY_SRC: u32 = 1;
31453 pub const COPY_DST: u32 = 2;
31454 pub const TEXTURE_BINDING: u32 = 4;
31455 pub const STORAGE_BINDING: u32 = 8;
31456 pub const RENDER_ATTACHMENT: u32 = 16;
31457} static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
31460
31461pub(crate) fn init_class_ops<D: DomTypes>() {
31462 CLASS_OPS.set(JSClassOps {
31463 addProperty: None,
31464 delProperty: None,
31465 enumerate: None,
31466 newEnumerate: None,
31467 resolve: None,
31468 mayResolve: None,
31469 finalize: Some(_finalize::<D>),
31470 call: None,
31471 construct: None,
31472 trace: Some(_trace::<D>),
31473 });
31474}
31475
31476pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
31477
31478pub(crate) fn init_domjs_class<D: DomTypes>() {
31479 init_class_ops::<D>();
31480 Class.set(DOMJSClass {
31481 base: JSClass {
31482 name: c"GPUTextureUsage".as_ptr(),
31483 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
31484 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
31485 ,
31486 cOps: unsafe { CLASS_OPS.get() },
31487 spec: ptr::null(),
31488 ext: ptr::null(),
31489 oOps: ptr::null(),
31490 },
31491 dom_class:
31492DOMClass {
31493 interface_chain: [ PrototypeList::ID::GPUTextureUsage, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
31494 depth: 0,
31495 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
31496 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUTextureUsage> as unsafe fn(&mut _, _) -> _,
31497 global: Globals::EMPTY,
31498},
31499 });
31500}
31501
31502#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
31503(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUTextureUsage>, _can_gc: CanGc) -> DomRoot<D::GPUTextureUsage>{
31504
31505 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
31506
31507 let scope = scope.reflector().get_jsobject();
31508 assert!(!scope.get().is_null());
31509 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
31510 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
31511
31512 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
31513 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
31514 assert!(!canonical_proto.is_null());
31515
31516
31517 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
31518 if let Some(given) = given_proto {
31519 proto.set(*given);
31520 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
31521 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
31522 }
31523 } else {
31524 proto.set(*canonical_proto);
31525 }
31526 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
31527 cx.raw_cx(),
31528 &Class.get().base,
31529 proto.handle(),
31530 ));
31531 assert!(!obj.is_null());
31532 JS_SetReservedSlot(
31533 obj.get(),
31534 DOM_OBJECT_SLOT,
31535 &PrivateValue(raw.as_ptr() as *const libc::c_void),
31536 );
31537
31538 let root = raw.reflect_with(obj.get());
31539
31540
31541
31542 DomRoot::from_ref(&*root)
31543}
31544
31545pub trait GPUTextureUsageMethods<D: DomTypes> {
31546}
31547static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
31548
31549pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
31550 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
31551 JSPropertySpec {
31552 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
31553 attributes_: (JSPROP_READONLY),
31554 kind_: (JSPropertySpec_Kind::Value),
31555 u: JSPropertySpec_AccessorsOrValue {
31556 value: JSPropertySpec_ValueWrapper {
31557 type_: JSPropertySpec_ValueWrapper_Type::String,
31558 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
31559 string: c"GPUTextureUsage".as_ptr(),
31560 }
31561 }
31562 }
31563 }
31564,
31565 JSPropertySpec::ZERO]))[..]
31566])));
31567}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
31568
31569pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
31570 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[0])])));
31571}static sConstants_specs: ThreadUnsafeOnceLock<&[&[ConstantSpec]]> = ThreadUnsafeOnceLock::new();
31572
31573pub(crate) fn init_sConstants_specs<D: DomTypes>() {
31574 sConstants_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
31575 ConstantSpec { name: c"COPY_SRC", value: ConstantVal::Uint(1) },
31576 ConstantSpec { name: c"COPY_DST", value: ConstantVal::Uint(2) },
31577 ConstantSpec { name: c"TEXTURE_BINDING", value: ConstantVal::Uint(4) },
31578 ConstantSpec { name: c"STORAGE_BINDING", value: ConstantVal::Uint(8) },
31579 ConstantSpec { name: c"RENDER_ATTACHMENT", value: ConstantVal::Uint(16) }]))[..]
31580])));
31581}static sConstants: ThreadUnsafeOnceLock<&[Guard<&[ConstantSpec]>]> = ThreadUnsafeOnceLock::new();
31582
31583pub(crate) fn init_sConstants_prefs<D: DomTypes>() {
31584 sConstants.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sConstants_specs.get() })[0])])));
31585}
31586pub fn GetProtoObject<D: DomTypes>
31587(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
31588 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUTextureUsage), CreateInterfaceObjects::<D>, rval)
31590}
31591
31592
31593static PrototypeClass: JSClass = JSClass {
31594 name: c"GPUTextureUsagePrototype".as_ptr(),
31595 flags:
31596 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
31598 cOps: ptr::null(),
31599 spec: ptr::null(),
31600 ext: ptr::null(),
31601 oOps: ptr::null(),
31602};
31603
31604
31605static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
31606
31607pub(crate) fn init_interface_object<D: DomTypes>() {
31608 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
31609 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
31610 b"function GPUTextureUsage() {\n [native code]\n}",
31611 PrototypeList::ID::GPUTextureUsage,
31612 0,
31613 ));
31614}
31615
31616pub fn DefineDOMInterface<D: DomTypes>
31617(cx: SafeJSContext, global: HandleObject){
31618 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUTextureUsage),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
31619}
31620
31621pub fn ConstructorEnabled<D: DomTypes>
31622(aCx: SafeJSContext, aObj: HandleObject) -> bool{
31623 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
31624 pref!(dom_webgpu_enabled)
31625}
31626
31627unsafe fn CreateInterfaceObjects<D: DomTypes>
31628(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
31629
31630 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
31631 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
31632 assert!(!prototype_proto.is_null());
31633
31634 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
31635 create_interface_prototype_object::<D>(cx,
31636 global,
31637 prototype_proto.handle(),
31638 &PrototypeClass,
31639 &[],
31640 sAttributes.get(),
31641 sConstants.get(),
31642 &[],
31643 prototype.handle_mut());
31644 assert!(!prototype.is_null());
31645 assert!((*cache)[PrototypeList::ID::GPUTextureUsage as usize].is_null());
31646 (*cache)[PrototypeList::ID::GPUTextureUsage as usize] = prototype.get();
31647 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUTextureUsage as isize),
31648 ptr::null_mut(),
31649 prototype.get());
31650
31651 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
31652 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
31653
31654 assert!(!interface_proto.is_null());
31655
31656 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
31657 create_noncallback_interface_object::<D>(cx,
31658 global,
31659 interface_proto.handle(),
31660 INTERFACE_OBJECT_CLASS.get(),
31661 &[],
31662 &[],
31663 sConstants.get(),
31664 prototype.handle(),
31665 c"GPUTextureUsage",
31666 0,
31667 &[],
31668 interface.handle_mut());
31669 assert!(!interface.is_null());
31670}
31671
31672
31673 pub(crate) fn init_statics<D: DomTypes>() {
31674 init_interface_object::<D>();
31675 init_domjs_class::<D>();
31676
31677
31678
31679
31680 init_sAttributes_specs::<D>();
31681init_sAttributes_prefs::<D>();
31682init_sConstants_specs::<D>();
31683init_sConstants_prefs::<D>();
31684 }
31685 } pub use self::GPUTextureView_Binding::{Wrap as GPUTextureViewWrap, GPUTextureViewMethods, GetProtoObject as GPUTextureViewGetProtoObject, DefineDOMInterface as GPUTextureViewDefineDOMInterface};
31689pub mod GPUTextureView_Binding {
31690use crate::import::module::*;
31691
31692unsafe extern "C" fn get_label<D: DomTypes>
31693(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
31694 let mut result = false;
31695 wrap_panic(&mut || result = (|| {
31696 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
31697 let this = &*(this as *const D::GPUTextureView);
31698 let result: USVString = this.Label();
31699
31700 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
31701 return true;
31702 })());
31703 result
31704}
31705
31706unsafe extern "C" fn set_label<D: DomTypes>
31707(cx: *mut RawJSContext, obj: RawHandleObject, this: *mut libc::c_void, args: JSJitSetterCallArgs) -> bool{
31708 let mut result = false;
31709 wrap_panic(&mut || result = (|| {
31710 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
31711 let this = &*(this as *const D::GPUTextureView);
31712 let arg0: USVString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), ()) {
31713 Ok(ConversionResult::Success(value)) => value,
31714 Ok(ConversionResult::Failure(error)) => {
31715 throw_type_error(cx.raw_cx(), &error);
31716 return false;
31717
31718 }
31719 _ => {
31720 return false;
31721
31722 },
31723 }
31724 ;
31725 let result: () = this.SetLabel(arg0);
31726
31727 true
31728 })());
31729 result
31730}
31731
31732
31733static label_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
31734
31735pub(crate) fn init_label_getterinfo<D: DomTypes>() {
31736 label_getterinfo.set(JSJitInfo {
31737 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
31738 getter: Some(get_label::<D>)
31739 },
31740 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
31741 protoID: PrototypeList::ID::GPUTextureView as u16,
31742 },
31743 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
31744 _bitfield_align_1: [],
31745 _bitfield_1: __BindgenBitfieldUnit::new(
31746 new_jsjitinfo_bitfield_1!(
31747 JSJitInfo_OpType::Getter as u8,
31748 JSJitInfo_AliasSet::AliasEverything as u8,
31749 JSValueType::JSVAL_TYPE_STRING as u8,
31750 true,
31751 false,
31752 false,
31753 false,
31754 false,
31755 false,
31756 0,
31757 ).to_ne_bytes()
31758 ),
31759});
31760}
31761static label_setterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
31762
31763pub(crate) fn init_label_setterinfo<D: DomTypes>() {
31764 label_setterinfo.set(JSJitInfo {
31765 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
31766 setter: Some(set_label::<D>)
31767 },
31768 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
31769 protoID: PrototypeList::ID::GPUTextureView as u16,
31770 },
31771 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
31772 _bitfield_align_1: [],
31773 _bitfield_1: __BindgenBitfieldUnit::new(
31774 new_jsjitinfo_bitfield_1!(
31775 JSJitInfo_OpType::Setter as u8,
31776 JSJitInfo_AliasSet::AliasEverything as u8,
31777 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
31778 false,
31779 false,
31780 false,
31781 false,
31782 false,
31783 false,
31784 0,
31785 ).to_ne_bytes()
31786 ),
31787});
31788}
31789unsafe extern "C" fn _finalize<D: DomTypes>
31790(_cx: *mut GCContext, obj: *mut JSObject){
31791 wrap_panic(&mut || {
31792
31793 let this = native_from_object_static::<D::GPUTextureView>(obj).unwrap();
31794 finalize_common(this);
31795 })
31796}
31797
31798unsafe extern "C" fn _trace<D: DomTypes>
31799(trc: *mut JSTracer, obj: *mut JSObject){
31800 wrap_panic(&mut || {
31801
31802 let this = native_from_object_static::<D::GPUTextureView>(obj).unwrap();
31803 if this.is_null() { return; } (*this).trace(trc);
31805 })
31806}
31807
31808
31809static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
31810
31811pub(crate) fn init_class_ops<D: DomTypes>() {
31812 CLASS_OPS.set(JSClassOps {
31813 addProperty: None,
31814 delProperty: None,
31815 enumerate: None,
31816 newEnumerate: None,
31817 resolve: None,
31818 mayResolve: None,
31819 finalize: Some(_finalize::<D>),
31820 call: None,
31821 construct: None,
31822 trace: Some(_trace::<D>),
31823 });
31824}
31825
31826pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
31827
31828pub(crate) fn init_domjs_class<D: DomTypes>() {
31829 init_class_ops::<D>();
31830 Class.set(DOMJSClass {
31831 base: JSClass {
31832 name: c"GPUTextureView".as_ptr(),
31833 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
31834 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
31835 ,
31836 cOps: unsafe { CLASS_OPS.get() },
31837 spec: ptr::null(),
31838 ext: ptr::null(),
31839 oOps: ptr::null(),
31840 },
31841 dom_class:
31842DOMClass {
31843 interface_chain: [ PrototypeList::ID::GPUTextureView, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
31844 depth: 0,
31845 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
31846 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUTextureView> as unsafe fn(&mut _, _) -> _,
31847 global: Globals::EMPTY,
31848},
31849 });
31850}
31851
31852#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
31853(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUTextureView>, _can_gc: CanGc) -> DomRoot<D::GPUTextureView>{
31854
31855 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
31856
31857 let scope = scope.reflector().get_jsobject();
31858 assert!(!scope.get().is_null());
31859 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
31860 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
31861
31862 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
31863 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
31864 assert!(!canonical_proto.is_null());
31865
31866
31867 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
31868 if let Some(given) = given_proto {
31869 proto.set(*given);
31870 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
31871 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
31872 }
31873 } else {
31874 proto.set(*canonical_proto);
31875 }
31876 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
31877 cx.raw_cx(),
31878 &Class.get().base,
31879 proto.handle(),
31880 ));
31881 assert!(!obj.is_null());
31882 JS_SetReservedSlot(
31883 obj.get(),
31884 DOM_OBJECT_SLOT,
31885 &PrivateValue(raw.as_ptr() as *const libc::c_void),
31886 );
31887
31888 let root = raw.reflect_with(obj.get());
31889
31890
31891
31892 DomRoot::from_ref(&*root)
31893}
31894
31895pub trait GPUTextureViewMethods<D: DomTypes> {
31896 fn Label(&self, ) -> USVString;
31897 fn SetLabel(&self, r#value: USVString);
31898}
31899static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
31900
31901pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
31902 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
31903 JSPropertySpec {
31904 name: JSPropertySpec_Name { string_: c"label".as_ptr() },
31905 attributes_: (JSPROP_ENUMERATE),
31906 kind_: (JSPropertySpec_Kind::NativeAccessor),
31907 u: JSPropertySpec_AccessorsOrValue {
31908 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
31909 getter: JSPropertySpec_Accessor {
31910 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { label_getterinfo.get() } },
31911 },
31912 setter: JSPropertySpec_Accessor {
31913 native: JSNativeWrapper { op: Some(generic_setter), info: unsafe { label_setterinfo.get() } },
31914 }
31915 }
31916 }
31917 }
31918,
31919 JSPropertySpec::ZERO]))[..]
31920,
31921&Box::leak(Box::new([
31922 JSPropertySpec {
31923 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
31924 attributes_: (JSPROP_READONLY),
31925 kind_: (JSPropertySpec_Kind::Value),
31926 u: JSPropertySpec_AccessorsOrValue {
31927 value: JSPropertySpec_ValueWrapper {
31928 type_: JSPropertySpec_ValueWrapper_Type::String,
31929 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
31930 string: c"GPUTextureView".as_ptr(),
31931 }
31932 }
31933 }
31934 }
31935,
31936 JSPropertySpec::ZERO]))[..]
31937])));
31938}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
31939
31940pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
31941 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
31942 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
31943}
31944pub fn GetProtoObject<D: DomTypes>
31945(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
31946 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUTextureView), CreateInterfaceObjects::<D>, rval)
31948}
31949
31950
31951static PrototypeClass: JSClass = JSClass {
31952 name: c"GPUTextureViewPrototype".as_ptr(),
31953 flags:
31954 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
31956 cOps: ptr::null(),
31957 spec: ptr::null(),
31958 ext: ptr::null(),
31959 oOps: ptr::null(),
31960};
31961
31962
31963static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
31964
31965pub(crate) fn init_interface_object<D: DomTypes>() {
31966 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
31967 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
31968 b"function GPUTextureView() {\n [native code]\n}",
31969 PrototypeList::ID::GPUTextureView,
31970 0,
31971 ));
31972}
31973
31974pub fn DefineDOMInterface<D: DomTypes>
31975(cx: SafeJSContext, global: HandleObject){
31976 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUTextureView),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
31977}
31978
31979pub fn ConstructorEnabled<D: DomTypes>
31980(aCx: SafeJSContext, aObj: HandleObject) -> bool{
31981 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
31982 pref!(dom_webgpu_enabled)
31983}
31984
31985unsafe fn CreateInterfaceObjects<D: DomTypes>
31986(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
31987
31988 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
31989 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
31990 assert!(!prototype_proto.is_null());
31991
31992 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
31993 create_interface_prototype_object::<D>(cx,
31994 global,
31995 prototype_proto.handle(),
31996 &PrototypeClass,
31997 &[],
31998 sAttributes.get(),
31999 &[],
32000 &[],
32001 prototype.handle_mut());
32002 assert!(!prototype.is_null());
32003 assert!((*cache)[PrototypeList::ID::GPUTextureView as usize].is_null());
32004 (*cache)[PrototypeList::ID::GPUTextureView as usize] = prototype.get();
32005 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUTextureView as isize),
32006 ptr::null_mut(),
32007 prototype.get());
32008
32009 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
32010 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
32011
32012 assert!(!interface_proto.is_null());
32013
32014 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
32015 create_noncallback_interface_object::<D>(cx,
32016 global,
32017 interface_proto.handle(),
32018 INTERFACE_OBJECT_CLASS.get(),
32019 &[],
32020 &[],
32021 &[],
32022 prototype.handle(),
32023 c"GPUTextureView",
32024 0,
32025 &[],
32026 interface.handle_mut());
32027 assert!(!interface.is_null());
32028}
32029
32030
32031 pub(crate) fn init_statics<D: DomTypes>() {
32032 init_interface_object::<D>();
32033 init_domjs_class::<D>();
32034
32035 init_label_getterinfo::<D>();
32036 init_label_setterinfo::<D>();
32037
32038 init_sAttributes_specs::<D>();
32039init_sAttributes_prefs::<D>();
32040 }
32041 } pub use self::GPUUncapturedErrorEvent_Binding::{Wrap as GPUUncapturedErrorEventWrap, GPUUncapturedErrorEventMethods, GetProtoObject as GPUUncapturedErrorEventGetProtoObject, DefineDOMInterface as GPUUncapturedErrorEventDefineDOMInterface};
32045pub mod GPUUncapturedErrorEvent_Binding {
32046use crate::codegen::GenericBindings::EventBinding::Event_Binding;
32047use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
32048use crate::codegen::GenericBindings::WebGPUBinding::GPUUncapturedErrorEventInit;
32049use crate::codegen::GenericBindings::WorkerGlobalScopeBinding::WorkerGlobalScope_Binding;
32050use crate::import::module::*;
32051
32052unsafe extern "C" fn get_error<D: DomTypes>
32053(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
32054 let mut result = false;
32055 wrap_panic(&mut || result = (|| {
32056 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
32057 let this = &*(this as *const D::GPUUncapturedErrorEvent);
32058 let result: DomRoot<D::GPUError> = this.Error();
32059
32060 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
32061 return true;
32062 })());
32063 result
32064}
32065
32066
32067static error_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
32068
32069pub(crate) fn init_error_getterinfo<D: DomTypes>() {
32070 error_getterinfo.set(JSJitInfo {
32071 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
32072 getter: Some(get_error::<D>)
32073 },
32074 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
32075 protoID: PrototypeList::ID::GPUUncapturedErrorEvent as u16,
32076 },
32077 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
32078 _bitfield_align_1: [],
32079 _bitfield_1: __BindgenBitfieldUnit::new(
32080 new_jsjitinfo_bitfield_1!(
32081 JSJitInfo_OpType::Getter as u8,
32082 JSJitInfo_AliasSet::AliasEverything as u8,
32083 JSValueType::JSVAL_TYPE_OBJECT as u8,
32084 true,
32085 false,
32086 false,
32087 false,
32088 false,
32089 false,
32090 0,
32091 ).to_ne_bytes()
32092 ),
32093});
32094}
32095unsafe extern "C" fn get_isTrusted<D: DomTypes>
32096(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
32097 let mut result = false;
32098 wrap_panic(&mut || result = (|| {
32099 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
32100 let this = &*(this as *const D::GPUUncapturedErrorEvent);
32101 let result: bool = this.IsTrusted();
32102
32103 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
32104 return true;
32105 })());
32106 result
32107}
32108
32109
32110static isTrusted_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
32111
32112pub(crate) fn init_isTrusted_getterinfo<D: DomTypes>() {
32113 isTrusted_getterinfo.set(JSJitInfo {
32114 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
32115 getter: Some(get_isTrusted::<D>)
32116 },
32117 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
32118 protoID: PrototypeList::ID::GPUUncapturedErrorEvent as u16,
32119 },
32120 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 1 },
32121 _bitfield_align_1: [],
32122 _bitfield_1: __BindgenBitfieldUnit::new(
32123 new_jsjitinfo_bitfield_1!(
32124 JSJitInfo_OpType::Getter as u8,
32125 JSJitInfo_AliasSet::AliasEverything as u8,
32126 JSValueType::JSVAL_TYPE_BOOLEAN as u8,
32127 true,
32128 false,
32129 false,
32130 false,
32131 false,
32132 false,
32133 0,
32134 ).to_ne_bytes()
32135 ),
32136});
32137}
32138unsafe extern "C" fn _finalize<D: DomTypes>
32139(_cx: *mut GCContext, obj: *mut JSObject){
32140 wrap_panic(&mut || {
32141
32142 let this = native_from_object_static::<D::GPUUncapturedErrorEvent>(obj).unwrap();
32143 finalize_common(this);
32144 })
32145}
32146
32147unsafe extern "C" fn _trace<D: DomTypes>
32148(trc: *mut JSTracer, obj: *mut JSObject){
32149 wrap_panic(&mut || {
32150
32151 let this = native_from_object_static::<D::GPUUncapturedErrorEvent>(obj).unwrap();
32152 if this.is_null() { return; } (*this).trace(trc);
32154 })
32155}
32156
32157
32158static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
32159
32160pub(crate) fn init_class_ops<D: DomTypes>() {
32161 CLASS_OPS.set(JSClassOps {
32162 addProperty: None,
32163 delProperty: None,
32164 enumerate: None,
32165 newEnumerate: None,
32166 resolve: None,
32167 mayResolve: None,
32168 finalize: Some(_finalize::<D>),
32169 call: None,
32170 construct: None,
32171 trace: Some(_trace::<D>),
32172 });
32173}
32174
32175pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
32176
32177pub(crate) fn init_domjs_class<D: DomTypes>() {
32178 init_class_ops::<D>();
32179 Class.set(DOMJSClass {
32180 base: JSClass {
32181 name: c"GPUUncapturedErrorEvent".as_ptr(),
32182 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
32183 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
32184 ,
32185 cOps: unsafe { CLASS_OPS.get() },
32186 spec: ptr::null(),
32187 ext: ptr::null(),
32188 oOps: ptr::null(),
32189 },
32190 dom_class:
32191DOMClass {
32192 interface_chain: [ PrototypeList::ID::Event, PrototypeList::ID::GPUUncapturedErrorEvent, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
32193 depth: 1,
32194 type_id: crate::codegen::InheritTypes::TopTypeId { event: (crate::codegen::InheritTypes::EventTypeId::GPUUncapturedErrorEvent) },
32195 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUUncapturedErrorEvent> as unsafe fn(&mut _, _) -> _,
32196 global: Globals::EMPTY,
32197},
32198 });
32199}
32200
32201#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
32202(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUUncapturedErrorEvent>, _can_gc: CanGc) -> DomRoot<D::GPUUncapturedErrorEvent>{
32203
32204 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
32205
32206 let scope = scope.reflector().get_jsobject();
32207 assert!(!scope.get().is_null());
32208 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
32209 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
32210
32211 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
32212 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
32213 assert!(!canonical_proto.is_null());
32214
32215
32216 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
32217 if let Some(given) = given_proto {
32218 proto.set(*given);
32219 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
32220 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
32221 }
32222 } else {
32223 proto.set(*canonical_proto);
32224 }
32225 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
32226 cx.raw_cx(),
32227 &Class.get().base,
32228 proto.handle(),
32229 ));
32230 assert!(!obj.is_null());
32231 JS_SetReservedSlot(
32232 obj.get(),
32233 DOM_OBJECT_SLOT,
32234 &PrivateValue(raw.as_ptr() as *const libc::c_void),
32235 );
32236
32237 let root = raw.reflect_with(obj.get());
32238
32239
32240 let mut slot = UndefinedValue();
32241 JS_GetReservedSlot(canonical_proto.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, &mut slot);
32242 rooted!(&in(cx) let mut unforgeable_holder = ptr::null_mut::<JSObject>());
32243 unforgeable_holder.handle_mut().set(slot.to_object());
32244 assert!(JS_InitializePropertiesFromCompatibleNativeObject(cx.raw_cx(), obj.handle(), unforgeable_holder.handle()));
32245
32246
32247 DomRoot::from_ref(&*root)
32248}
32249
32250pub trait GPUUncapturedErrorEventMethods<D: DomTypes> {
32251 fn Error(&self, ) -> DomRoot<D::GPUError>;
32252 fn IsTrusted(&self, ) -> bool;
32253 fn Constructor(r#global: &D::GlobalScope, r#proto: Option<HandleObject>, r#can_gc: CanGc, r#type_: DOMString, r#gpuUncapturedErrorEventInitDict: &crate::codegen::GenericBindings::WebGPUBinding::GPUUncapturedErrorEventInit<D>) -> DomRoot<D::GPUUncapturedErrorEvent>;
32254}
32255static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
32256
32257pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
32258 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
32259 JSPropertySpec {
32260 name: JSPropertySpec_Name { string_: c"error".as_ptr() },
32261 attributes_: (JSPROP_ENUMERATE),
32262 kind_: (JSPropertySpec_Kind::NativeAccessor),
32263 u: JSPropertySpec_AccessorsOrValue {
32264 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
32265 getter: JSPropertySpec_Accessor {
32266 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { error_getterinfo.get() } },
32267 },
32268 setter: JSPropertySpec_Accessor {
32269 native: JSNativeWrapper { op: None, info: ptr::null() },
32270 }
32271 }
32272 }
32273 }
32274,
32275 JSPropertySpec::ZERO]))[..]
32276,
32277&Box::leak(Box::new([
32278 JSPropertySpec {
32279 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
32280 attributes_: (JSPROP_READONLY),
32281 kind_: (JSPropertySpec_Kind::Value),
32282 u: JSPropertySpec_AccessorsOrValue {
32283 value: JSPropertySpec_ValueWrapper {
32284 type_: JSPropertySpec_ValueWrapper_Type::String,
32285 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
32286 string: c"GPUUncapturedErrorEvent".as_ptr(),
32287 }
32288 }
32289 }
32290 }
32291,
32292 JSPropertySpec::ZERO]))[..]
32293])));
32294}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
32295
32296pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
32297 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::SERVICE_WORKER_GLOBAL_SCOPE),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
32298 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
32299}static sLegacyUnforgeableAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
32300
32301pub(crate) fn init_sLegacyUnforgeableAttributes_specs<D: DomTypes>() {
32302 sLegacyUnforgeableAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
32303 JSPropertySpec {
32304 name: JSPropertySpec_Name { string_: c"isTrusted".as_ptr() },
32305 attributes_: (JSPROP_ENUMERATE | JSPROP_PERMANENT),
32306 kind_: (JSPropertySpec_Kind::NativeAccessor),
32307 u: JSPropertySpec_AccessorsOrValue {
32308 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
32309 getter: JSPropertySpec_Accessor {
32310 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { isTrusted_getterinfo.get() } },
32311 },
32312 setter: JSPropertySpec_Accessor {
32313 native: JSNativeWrapper { op: None, info: ptr::null() },
32314 }
32315 }
32316 }
32317 }
32318,
32319 JSPropertySpec::ZERO]))[..]
32320])));
32321}static sLegacyUnforgeableAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
32322
32323pub(crate) fn init_sLegacyUnforgeableAttributes_prefs<D: DomTypes>() {
32324 sLegacyUnforgeableAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::SERVICE_WORKER_GLOBAL_SCOPE),Condition::Exposed(Globals::PAINT_WORKLET_GLOBAL_SCOPE),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE),Condition::Exposed(Globals::DEBUGGER_GLOBAL_SCOPE),Condition::Exposed(Globals::DISSIMILAR_ORIGIN_WINDOW),Condition::Exposed(Globals::TEST_WORKLET_GLOBAL_SCOPE)], (unsafe { sLegacyUnforgeableAttributes_specs.get() })[0])])));
32325}
32326pub fn GetProtoObject<D: DomTypes>
32327(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
32328 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUUncapturedErrorEvent), CreateInterfaceObjects::<D>, rval)
32330}
32331
32332
32333static PrototypeClass: JSClass = JSClass {
32334 name: c"GPUUncapturedErrorEventPrototype".as_ptr(),
32335 flags:
32336 (1 & JSCLASS_RESERVED_SLOTS_MASK ) << JSCLASS_RESERVED_SLOTS_SHIFT,
32338 cOps: ptr::null(),
32339 spec: ptr::null(),
32340 ext: ptr::null(),
32341 oOps: ptr::null(),
32342};
32343
32344unsafe extern "C" fn _constructor<D: DomTypes>
32345(cx: *mut RawJSContext, argc: u32, vp: *mut JSVal) -> bool{
32346 let mut result = false;
32347 wrap_panic(&mut || result = {
32348 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
32349 let args = CallArgs::from_vp(vp, argc);
32350 let global = D::GlobalScope::from_object(JS_CALLEE(cx.raw_cx(), vp).to_object());
32351
32352 call_default_constructor::<D>(
32353 SafeJSContext::from_ptr(cx.raw_cx()),
32354 &args,
32355 &global,
32356 PrototypeList::ID::GPUUncapturedErrorEvent,
32357 "GPUUncapturedErrorEvent",
32358 CreateInterfaceObjects::<D>,
32359 |cx: SafeJSContext, args: &CallArgs, global: &D::GlobalScope, desired_proto: HandleObject| {
32360
32361 if argc < 2 {
32362 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUUncapturedErrorEvent.constructor\".");
32363 return false;
32364 }
32365 let arg0: DOMString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
32366 Ok(ConversionResult::Success(value)) => value,
32367 Ok(ConversionResult::Failure(error)) => {
32368 throw_type_error(cx.raw_cx(), &error);
32369 return false;
32370
32371 }
32372 _ => {
32373 return false;
32374
32375 },
32376 }
32377 ;
32378 let arg1: crate::codegen::GenericBindings::WebGPUBinding::GPUUncapturedErrorEventInit<D> = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(1)), ()) {
32379 Ok(ConversionResult::Success(value)) => value,
32380 Ok(ConversionResult::Failure(error)) => {
32381 throw_type_error(cx.raw_cx(), &error);
32382 return false;
32383
32384 }
32385 _ => {
32386 return false;
32387
32388 },
32389 }
32390 ;
32391 let result: DomRoot<D::GPUUncapturedErrorEvent> = <D::GPUUncapturedErrorEvent>::Constructor(global, Some(desired_proto), CanGc::note(), arg0, &arg1);
32392
32393 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
32394 return true;
32395 }
32396 )
32397
32398 });
32399 result
32400}
32401
32402
32403static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
32404
32405pub(crate) fn init_interface_object<D: DomTypes>() {
32406 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
32407 Box::leak(Box::new(InterfaceConstructorBehavior::call(_constructor::<D>))),
32408 b"function GPUUncapturedErrorEvent() {\n [native code]\n}",
32409 PrototypeList::ID::GPUUncapturedErrorEvent,
32410 1,
32411 ));
32412}
32413
32414pub fn DefineDOMInterface<D: DomTypes>
32415(cx: SafeJSContext, global: HandleObject){
32416 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUUncapturedErrorEvent),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
32417}
32418
32419pub fn ConstructorEnabled<D: DomTypes>
32420(aCx: SafeJSContext, aObj: HandleObject) -> bool{
32421 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::SERVICE_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
32422 pref!(dom_webgpu_enabled)
32423}
32424
32425unsafe fn CreateInterfaceObjects<D: DomTypes>
32426(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
32427
32428 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
32429 Event_Binding::GetProtoObject::<D>(cx, global, prototype_proto.handle_mut());
32430 assert!(!prototype_proto.is_null());
32431
32432 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
32433 create_interface_prototype_object::<D>(cx,
32434 global,
32435 prototype_proto.handle(),
32436 &PrototypeClass,
32437 &[],
32438 sAttributes.get(),
32439 &[],
32440 &[],
32441 prototype.handle_mut());
32442 assert!(!prototype.is_null());
32443 assert!((*cache)[PrototypeList::ID::GPUUncapturedErrorEvent as usize].is_null());
32444 (*cache)[PrototypeList::ID::GPUUncapturedErrorEvent as usize] = prototype.get();
32445 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUUncapturedErrorEvent as isize),
32446 ptr::null_mut(),
32447 prototype.get());
32448
32449 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
32450
32451 Event_Binding::GetConstructorObject::<D>(cx, global, interface_proto.handle_mut());
32452
32453 assert!(!interface_proto.is_null());
32454
32455 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
32456 create_noncallback_interface_object::<D>(cx,
32457 global,
32458 interface_proto.handle(),
32459 INTERFACE_OBJECT_CLASS.get(),
32460 &[],
32461 &[],
32462 &[],
32463 prototype.handle(),
32464 c"GPUUncapturedErrorEvent",
32465 2,
32466 &[],
32467 interface.handle_mut());
32468 assert!(!interface.is_null());
32469
32470 rooted!(&in(cx) let mut unforgeable_holder = ptr::null_mut::<JSObject>());
32471 unforgeable_holder.handle_mut().set(
32472 JS_NewObjectWithoutMetadata(cx.raw_cx(), &Class.get().base as *const JSClass, prototype.handle()));
32473 assert!(!unforgeable_holder.is_null());
32474
32475 define_guarded_properties::<D>(cx, unforgeable_holder.handle(), unsafe { sLegacyUnforgeableAttributes.get() }, global);
32476 let val = ObjectValue(unforgeable_holder.get());
32477 JS_SetReservedSlot(prototype.get(), DOM_PROTO_UNFORGEABLE_HOLDER_SLOT, &val)
32478}
32479
32480
32481 pub(crate) fn init_statics<D: DomTypes>() {
32482 init_interface_object::<D>();
32483 init_domjs_class::<D>();
32484
32485 init_error_getterinfo::<D>();
32486init_isTrusted_getterinfo::<D>();
32487
32488
32489 init_sAttributes_specs::<D>();
32490init_sAttributes_prefs::<D>();
32491init_sLegacyUnforgeableAttributes_specs::<D>();
32492init_sLegacyUnforgeableAttributes_prefs::<D>();
32493 }
32494 } pub use self::GPUValidationError_Binding::{Wrap as GPUValidationErrorWrap, GPUValidationErrorMethods, GetProtoObject as GPUValidationErrorGetProtoObject, DefineDOMInterface as GPUValidationErrorDefineDOMInterface};
32498pub mod GPUValidationError_Binding {
32499use crate::codegen::GenericBindings::EventTargetBinding::EventTarget_Binding;
32500use crate::codegen::GenericBindings::WebGPUBinding::GPUError_Binding;
32501use crate::codegen::GenericBindings::WorkerGlobalScopeBinding::WorkerGlobalScope_Binding;
32502use crate::import::module::*;
32503
32504unsafe extern "C" fn _finalize<D: DomTypes>
32505(_cx: *mut GCContext, obj: *mut JSObject){
32506 wrap_panic(&mut || {
32507
32508 let this = native_from_object_static::<D::GPUValidationError>(obj).unwrap();
32509 finalize_common(this);
32510 })
32511}
32512
32513unsafe extern "C" fn _trace<D: DomTypes>
32514(trc: *mut JSTracer, obj: *mut JSObject){
32515 wrap_panic(&mut || {
32516
32517 let this = native_from_object_static::<D::GPUValidationError>(obj).unwrap();
32518 if this.is_null() { return; } (*this).trace(trc);
32520 })
32521}
32522
32523
32524static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
32525
32526pub(crate) fn init_class_ops<D: DomTypes>() {
32527 CLASS_OPS.set(JSClassOps {
32528 addProperty: None,
32529 delProperty: None,
32530 enumerate: None,
32531 newEnumerate: None,
32532 resolve: None,
32533 mayResolve: None,
32534 finalize: Some(_finalize::<D>),
32535 call: None,
32536 construct: None,
32537 trace: Some(_trace::<D>),
32538 });
32539}
32540
32541pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
32542
32543pub(crate) fn init_domjs_class<D: DomTypes>() {
32544 init_class_ops::<D>();
32545 Class.set(DOMJSClass {
32546 base: JSClass {
32547 name: c"GPUValidationError".as_ptr(),
32548 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
32549 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
32550 ,
32551 cOps: unsafe { CLASS_OPS.get() },
32552 spec: ptr::null(),
32553 ext: ptr::null(),
32554 oOps: ptr::null(),
32555 },
32556 dom_class:
32557DOMClass {
32558 interface_chain: [ PrototypeList::ID::GPUError, PrototypeList::ID::GPUValidationError, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
32559 depth: 1,
32560 type_id: crate::codegen::InheritTypes::TopTypeId { gpuerror: (crate::codegen::InheritTypes::GPUErrorTypeId::GPUValidationError) },
32561 malloc_size_of: malloc_size_of_including_raw_self::<D::GPUValidationError> as unsafe fn(&mut _, _) -> _,
32562 global: Globals::EMPTY,
32563},
32564 });
32565}
32566
32567#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
32568(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::GPUValidationError>, _can_gc: CanGc) -> DomRoot<D::GPUValidationError>{
32569
32570 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
32571
32572 let scope = scope.reflector().get_jsobject();
32573 assert!(!scope.get().is_null());
32574 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
32575 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
32576
32577 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
32578 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
32579 assert!(!canonical_proto.is_null());
32580
32581
32582 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
32583 if let Some(given) = given_proto {
32584 proto.set(*given);
32585 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
32586 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
32587 }
32588 } else {
32589 proto.set(*canonical_proto);
32590 }
32591 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
32592 cx.raw_cx(),
32593 &Class.get().base,
32594 proto.handle(),
32595 ));
32596 assert!(!obj.is_null());
32597 JS_SetReservedSlot(
32598 obj.get(),
32599 DOM_OBJECT_SLOT,
32600 &PrivateValue(raw.as_ptr() as *const libc::c_void),
32601 );
32602
32603 let root = raw.reflect_with(obj.get());
32604
32605
32606
32607 DomRoot::from_ref(&*root)
32608}
32609
32610pub trait GPUValidationErrorMethods<D: DomTypes> {
32611 fn Constructor(r#global: &D::GlobalScope, r#proto: Option<HandleObject>, r#can_gc: CanGc, r#message: DOMString) -> DomRoot<D::GPUValidationError>;
32612}
32613static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
32614
32615pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
32616 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
32617 JSPropertySpec {
32618 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
32619 attributes_: (JSPROP_READONLY),
32620 kind_: (JSPropertySpec_Kind::Value),
32621 u: JSPropertySpec_AccessorsOrValue {
32622 value: JSPropertySpec_ValueWrapper {
32623 type_: JSPropertySpec_ValueWrapper_Type::String,
32624 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
32625 string: c"GPUValidationError".as_ptr(),
32626 }
32627 }
32628 }
32629 }
32630,
32631 JSPropertySpec::ZERO]))[..]
32632])));
32633}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
32634
32635pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
32636 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[0])])));
32637}
32638pub fn GetProtoObject<D: DomTypes>
32639(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
32640 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUValidationError), CreateInterfaceObjects::<D>, rval)
32642}
32643
32644
32645static PrototypeClass: JSClass = JSClass {
32646 name: c"GPUValidationErrorPrototype".as_ptr(),
32647 flags:
32648 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
32650 cOps: ptr::null(),
32651 spec: ptr::null(),
32652 ext: ptr::null(),
32653 oOps: ptr::null(),
32654};
32655
32656unsafe extern "C" fn _constructor<D: DomTypes>
32657(cx: *mut RawJSContext, argc: u32, vp: *mut JSVal) -> bool{
32658 let mut result = false;
32659 wrap_panic(&mut || result = {
32660 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
32661 let args = CallArgs::from_vp(vp, argc);
32662 let global = D::GlobalScope::from_object(JS_CALLEE(cx.raw_cx(), vp).to_object());
32663
32664 call_default_constructor::<D>(
32665 SafeJSContext::from_ptr(cx.raw_cx()),
32666 &args,
32667 &global,
32668 PrototypeList::ID::GPUValidationError,
32669 "GPUValidationError",
32670 CreateInterfaceObjects::<D>,
32671 |cx: SafeJSContext, args: &CallArgs, global: &D::GlobalScope, desired_proto: HandleObject| {
32672
32673 if argc < 1 {
32674 throw_type_error(cx.raw_cx(), "Not enough arguments to \"GPUValidationError.constructor\".");
32675 return false;
32676 }
32677 let arg0: DOMString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
32678 Ok(ConversionResult::Success(value)) => value,
32679 Ok(ConversionResult::Failure(error)) => {
32680 throw_type_error(cx.raw_cx(), &error);
32681 return false;
32682
32683 }
32684 _ => {
32685 return false;
32686
32687 },
32688 }
32689 ;
32690 let result: DomRoot<D::GPUValidationError> = <D::GPUValidationError>::Constructor(global, Some(desired_proto), CanGc::note(), arg0);
32691
32692 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
32693 return true;
32694 }
32695 )
32696
32697 });
32698 result
32699}
32700
32701
32702static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
32703
32704pub(crate) fn init_interface_object<D: DomTypes>() {
32705 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
32706 Box::leak(Box::new(InterfaceConstructorBehavior::call(_constructor::<D>))),
32707 b"function GPUValidationError() {\n [native code]\n}",
32708 PrototypeList::ID::GPUValidationError,
32709 1,
32710 ));
32711}
32712
32713pub fn DefineDOMInterface<D: DomTypes>
32714(cx: SafeJSContext, global: HandleObject){
32715 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUValidationError),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
32716}
32717
32718pub fn ConstructorEnabled<D: DomTypes>
32719(aCx: SafeJSContext, aObj: HandleObject) -> bool{
32720 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::SERVICE_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
32721 pref!(dom_webgpu_enabled)
32722}
32723
32724unsafe fn CreateInterfaceObjects<D: DomTypes>
32725(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
32726
32727 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
32728 GPUError_Binding::GetProtoObject::<D>(cx, global, prototype_proto.handle_mut());
32729 assert!(!prototype_proto.is_null());
32730
32731 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
32732 create_interface_prototype_object::<D>(cx,
32733 global,
32734 prototype_proto.handle(),
32735 &PrototypeClass,
32736 &[],
32737 sAttributes.get(),
32738 &[],
32739 &[],
32740 prototype.handle_mut());
32741 assert!(!prototype.is_null());
32742 assert!((*cache)[PrototypeList::ID::GPUValidationError as usize].is_null());
32743 (*cache)[PrototypeList::ID::GPUValidationError as usize] = prototype.get();
32744 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUValidationError as isize),
32745 ptr::null_mut(),
32746 prototype.get());
32747
32748 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
32749
32750 GPUError_Binding::GetConstructorObject::<D>(cx, global, interface_proto.handle_mut());
32751
32752 assert!(!interface_proto.is_null());
32753
32754 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
32755 create_noncallback_interface_object::<D>(cx,
32756 global,
32757 interface_proto.handle(),
32758 INTERFACE_OBJECT_CLASS.get(),
32759 &[],
32760 &[],
32761 &[],
32762 prototype.handle(),
32763 c"GPUValidationError",
32764 1,
32765 &[],
32766 interface.handle_mut());
32767 assert!(!interface.is_null());
32768}
32769
32770
32771 pub(crate) fn init_statics<D: DomTypes>() {
32772 init_interface_object::<D>();
32773 init_domjs_class::<D>();
32774
32775
32776
32777
32778 init_sAttributes_specs::<D>();
32779init_sAttributes_prefs::<D>();
32780 }
32781 } pub use self::WGSLLanguageFeatures_Binding::{Wrap as WGSLLanguageFeaturesWrap, WGSLLanguageFeaturesMethods, GetProtoObject as WGSLLanguageFeaturesGetProtoObject, DefineDOMInterface as WGSLLanguageFeaturesDefineDOMInterface};
32785pub mod WGSLLanguageFeatures_Binding {
32786use crate::import::module::*;
32787
32788unsafe extern "C" fn get_size<D: DomTypes>
32789(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: JSJitGetterCallArgs) -> bool{
32790 let mut result = false;
32791 wrap_panic(&mut || result = (|| {
32792 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
32793 let this = &*(this as *const D::WGSLLanguageFeatures);
32794 let result: u32 = this.Size();
32795
32796 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
32797 return true;
32798 })());
32799 result
32800}
32801
32802
32803static size_getterinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
32804
32805pub(crate) fn init_size_getterinfo<D: DomTypes>() {
32806 size_getterinfo.set(JSJitInfo {
32807 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
32808 getter: Some(get_size::<D>)
32809 },
32810 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
32811 protoID: PrototypeList::ID::WGSLLanguageFeatures as u16,
32812 },
32813 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
32814 _bitfield_align_1: [],
32815 _bitfield_1: __BindgenBitfieldUnit::new(
32816 new_jsjitinfo_bitfield_1!(
32817 JSJitInfo_OpType::Getter as u8,
32818 JSJitInfo_AliasSet::AliasEverything as u8,
32819 JSValueType::JSVAL_TYPE_DOUBLE as u8,
32820 true,
32821 false,
32822 false,
32823 false,
32824 false,
32825 false,
32826 0,
32827 ).to_ne_bytes()
32828 ),
32829});
32830}
32831unsafe extern "C" fn entries<D: DomTypes>
32832(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
32833 let mut result = false;
32834 wrap_panic(&mut || result = (|| {
32835 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
32836 let this = &*(this as *const D::WGSLLanguageFeatures);
32837 let args = &*args;
32838 let argc = args.argc_;
32839 let realm = AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx()));
32840 let result = crate::iterable::IterableIterator::new(this, IteratorType::Entries, InRealm::already(&realm));
32841
32842
32843 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
32844 return true;
32845 })());
32846 result
32847}
32848
32849const entries_methodinfo_argTypes: [i32; 1] = [ JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
32850static entries_methodinfo: ThreadUnsafeOnceLock<JSTypedMethodJitInfo> = ThreadUnsafeOnceLock::new();
32851
32852pub(crate) fn init_entries_methodinfo<D: DomTypes>() {
32853 entries_methodinfo.set(JSTypedMethodJitInfo {
32854 base: JSJitInfo {
32855 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
32856 method: Some(entries::<D>)
32857 },
32858 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
32859 protoID: PrototypeList::ID::WGSLLanguageFeatures as u16,
32860 },
32861 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
32862 _bitfield_align_1: [],
32863 _bitfield_1: __BindgenBitfieldUnit::new(
32864 new_jsjitinfo_bitfield_1!(
32865 JSJitInfo_OpType::Method as u8,
32866 JSJitInfo_AliasSet::AliasEverything as u8,
32867 JSValueType::JSVAL_TYPE_OBJECT as u8,
32868 false,
32869 false,
32870 false,
32871 false,
32872 false,
32873 true,
32874 0,
32875 ).to_ne_bytes()
32876 ),
32877 },
32878 argTypes: &entries_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
32879 });
32880}
32881
32882unsafe extern "C" fn keys<D: DomTypes>
32883(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
32884 let mut result = false;
32885 wrap_panic(&mut || result = (|| {
32886 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
32887 let this = &*(this as *const D::WGSLLanguageFeatures);
32888 let args = &*args;
32889 let argc = args.argc_;
32890 let realm = AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx()));
32891 let result = crate::iterable::IterableIterator::new(this, IteratorType::Keys, InRealm::already(&realm));
32892
32893
32894 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
32895 return true;
32896 })());
32897 result
32898}
32899
32900const keys_methodinfo_argTypes: [i32; 1] = [ JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
32901static keys_methodinfo: ThreadUnsafeOnceLock<JSTypedMethodJitInfo> = ThreadUnsafeOnceLock::new();
32902
32903pub(crate) fn init_keys_methodinfo<D: DomTypes>() {
32904 keys_methodinfo.set(JSTypedMethodJitInfo {
32905 base: JSJitInfo {
32906 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
32907 method: Some(keys::<D>)
32908 },
32909 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
32910 protoID: PrototypeList::ID::WGSLLanguageFeatures as u16,
32911 },
32912 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
32913 _bitfield_align_1: [],
32914 _bitfield_1: __BindgenBitfieldUnit::new(
32915 new_jsjitinfo_bitfield_1!(
32916 JSJitInfo_OpType::Method as u8,
32917 JSJitInfo_AliasSet::AliasEverything as u8,
32918 JSValueType::JSVAL_TYPE_OBJECT as u8,
32919 false,
32920 false,
32921 false,
32922 false,
32923 false,
32924 true,
32925 0,
32926 ).to_ne_bytes()
32927 ),
32928 },
32929 argTypes: &keys_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
32930 });
32931}
32932
32933unsafe extern "C" fn values<D: DomTypes>
32934(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
32935 let mut result = false;
32936 wrap_panic(&mut || result = (|| {
32937 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
32938 let this = &*(this as *const D::WGSLLanguageFeatures);
32939 let args = &*args;
32940 let argc = args.argc_;
32941 let realm = AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx()));
32942 let result = crate::iterable::IterableIterator::new(this, IteratorType::Values, InRealm::already(&realm));
32943
32944
32945 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
32946 return true;
32947 })());
32948 result
32949}
32950
32951const values_methodinfo_argTypes: [i32; 1] = [ JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
32952static values_methodinfo: ThreadUnsafeOnceLock<JSTypedMethodJitInfo> = ThreadUnsafeOnceLock::new();
32953
32954pub(crate) fn init_values_methodinfo<D: DomTypes>() {
32955 values_methodinfo.set(JSTypedMethodJitInfo {
32956 base: JSJitInfo {
32957 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
32958 method: Some(values::<D>)
32959 },
32960 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
32961 protoID: PrototypeList::ID::WGSLLanguageFeatures as u16,
32962 },
32963 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
32964 _bitfield_align_1: [],
32965 _bitfield_1: __BindgenBitfieldUnit::new(
32966 new_jsjitinfo_bitfield_1!(
32967 JSJitInfo_OpType::Method as u8,
32968 JSJitInfo_AliasSet::AliasEverything as u8,
32969 JSValueType::JSVAL_TYPE_OBJECT as u8,
32970 false,
32971 false,
32972 false,
32973 false,
32974 false,
32975 true,
32976 0,
32977 ).to_ne_bytes()
32978 ),
32979 },
32980 argTypes: &values_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
32981 });
32982}
32983
32984unsafe extern "C" fn forEach<D: DomTypes>
32985(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
32986 let mut result = false;
32987 wrap_panic(&mut || result = (|| {
32988 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
32989 let this = &*(this as *const D::WGSLLanguageFeatures);
32990 let args = &*args;
32991 let argc = args.argc_;
32992
32993 if argc < 1 {
32994 throw_type_error(cx.raw_cx(), "Not enough arguments to \"WGSLLanguageFeatures.forEach\".");
32995 return false;
32996 }
32997 let arg0: *mut JSObject = if HandleValue::from_raw(args.get(0)).get().is_object() {
32998 HandleValue::from_raw(args.get(0)).get().to_object()
32999 } else {
33000 throw_type_error(cx.raw_cx(), "Value is not an object.");
33001 return false;
33002
33003 };
33004 let arg1: HandleValue = if args.get(1).is_undefined() {
33005 HandleValue::undefined()
33006 } else {
33007 HandleValue::from_raw(args.get(1))
33008 };
33009 if !IsCallable(arg0) {
33010 throw_type_error(cx.raw_cx(), "Argument 1 of WGSLLanguageFeatures.forEach is not callable.");
33011 return false;
33012 }
33013 rooted!(&in(cx) let arg0 = ObjectValue(arg0));
33014 rooted!(&in(cx) let mut call_arg1 = UndefinedValue());
33015 rooted!(&in(cx) let mut call_arg2 = UndefinedValue());
33016 rooted_vec!(let mut call_args);
33017 call_args.push(UndefinedValue());
33018 call_args.push(UndefinedValue());
33019 call_args.push(ObjectValue(*_obj));
33020 rooted!(&in(cx) let mut ignoredReturnVal = UndefinedValue());
33021
33022 let mut i = 0;
33030 while i < (*this).get_iterable_length() {
33031 (*this).get_value_at_index(i).to_jsval(cx.raw_cx(), call_arg1.handle_mut());
33032 (*this).get_key_at_index(i).to_jsval(cx.raw_cx(), call_arg2.handle_mut());
33033 call_args[0] = call_arg1.handle().get();
33034 call_args[1] = call_arg2.handle().get();
33035 let call_args_handle = HandleValueArray::from(&call_args);
33036 if !Call(cx.raw_cx(), arg1, arg0.handle(), &call_args_handle,
33037 ignoredReturnVal.handle_mut()) {
33038 return false;
33039 }
33040
33041 i += 1;
33042 }
33043
33044 let result = ();
33045
33046
33047 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
33048 return true;
33049 })());
33050 result
33051}
33052
33053
33054static forEach_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
33055
33056pub(crate) fn init_forEach_methodinfo<D: DomTypes>() {
33057 forEach_methodinfo.set(JSJitInfo {
33058 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
33059 method: Some(forEach::<D>)
33060 },
33061 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
33062 protoID: PrototypeList::ID::WGSLLanguageFeatures as u16,
33063 },
33064 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
33065 _bitfield_align_1: [],
33066 _bitfield_1: __BindgenBitfieldUnit::new(
33067 new_jsjitinfo_bitfield_1!(
33068 JSJitInfo_OpType::Method as u8,
33069 JSJitInfo_AliasSet::AliasEverything as u8,
33070 JSValueType::JSVAL_TYPE_UNDEFINED as u8,
33071 false,
33072 false,
33073 false,
33074 false,
33075 false,
33076 false,
33077 0,
33078 ).to_ne_bytes()
33079 ),
33080});
33081}
33082unsafe extern "C" fn has<D: DomTypes>
33083(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
33084 let mut result = false;
33085 wrap_panic(&mut || result = (|| {
33086 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
33087 let this = &*(this as *const D::WGSLLanguageFeatures);
33088 let args = &*args;
33089 let argc = args.argc_;
33090
33091 if argc < 1 {
33092 throw_type_error(cx.raw_cx(), "Not enough arguments to \"WGSLLanguageFeatures.has\".");
33093 return false;
33094 }
33095 let arg0: DOMString = match FromJSValConvertible::from_jsval(cx.raw_cx(), HandleValue::from_raw(args.get(0)), StringificationBehavior::Default) {
33096 Ok(ConversionResult::Success(value)) => value,
33097 Ok(ConversionResult::Failure(error)) => {
33098 throw_type_error(cx.raw_cx(), &error);
33099 return false;
33100
33101 }
33102 _ => {
33103 return false;
33104
33105 },
33106 }
33107 ;
33108 let result = Setlike::has(this, arg0);
33109
33110
33111 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
33112 return true;
33113 })());
33114 result
33115}
33116
33117const has_methodinfo_argTypes: [i32; 2] = [ JSJitInfo_ArgType::String as i32, JSJitInfo_ArgType::ArgTypeListEnd as i32 ];
33118static has_methodinfo: ThreadUnsafeOnceLock<JSTypedMethodJitInfo> = ThreadUnsafeOnceLock::new();
33119
33120pub(crate) fn init_has_methodinfo<D: DomTypes>() {
33121 has_methodinfo.set(JSTypedMethodJitInfo {
33122 base: JSJitInfo {
33123 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
33124 method: Some(has::<D>)
33125 },
33126 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
33127 protoID: PrototypeList::ID::WGSLLanguageFeatures as u16,
33128 },
33129 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
33130 _bitfield_align_1: [],
33131 _bitfield_1: __BindgenBitfieldUnit::new(
33132 new_jsjitinfo_bitfield_1!(
33133 JSJitInfo_OpType::Method as u8,
33134 JSJitInfo_AliasSet::AliasDOMSets as u8,
33135 JSValueType::JSVAL_TYPE_BOOLEAN as u8,
33136 false,
33137 false,
33138 false,
33139 false,
33140 false,
33141 true,
33142 0,
33143 ).to_ne_bytes()
33144 ),
33145 },
33146 argTypes: &has_methodinfo_argTypes as *const _ as *const JSJitInfo_ArgType,
33147 });
33148}
33149
33150unsafe extern "C" fn _finalize<D: DomTypes>
33151(_cx: *mut GCContext, obj: *mut JSObject){
33152 wrap_panic(&mut || {
33153
33154 let this = native_from_object_static::<D::WGSLLanguageFeatures>(obj).unwrap();
33155 finalize_common(this);
33156 })
33157}
33158
33159unsafe extern "C" fn _trace<D: DomTypes>
33160(trc: *mut JSTracer, obj: *mut JSObject){
33161 wrap_panic(&mut || {
33162
33163 let this = native_from_object_static::<D::WGSLLanguageFeatures>(obj).unwrap();
33164 if this.is_null() { return; } (*this).trace(trc);
33166 })
33167}
33168
33169
33170static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
33171
33172pub(crate) fn init_class_ops<D: DomTypes>() {
33173 CLASS_OPS.set(JSClassOps {
33174 addProperty: None,
33175 delProperty: None,
33176 enumerate: None,
33177 newEnumerate: None,
33178 resolve: None,
33179 mayResolve: None,
33180 finalize: Some(_finalize::<D>),
33181 call: None,
33182 construct: None,
33183 trace: Some(_trace::<D>),
33184 });
33185}
33186
33187pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
33188
33189pub(crate) fn init_domjs_class<D: DomTypes>() {
33190 init_class_ops::<D>();
33191 Class.set(DOMJSClass {
33192 base: JSClass {
33193 name: c"WGSLLanguageFeatures".as_ptr(),
33194 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
33195 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
33196 ,
33197 cOps: unsafe { CLASS_OPS.get() },
33198 spec: ptr::null(),
33199 ext: ptr::null(),
33200 oOps: ptr::null(),
33201 },
33202 dom_class:
33203DOMClass {
33204 interface_chain: [ PrototypeList::ID::WGSLLanguageFeatures, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
33205 depth: 0,
33206 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
33207 malloc_size_of: malloc_size_of_including_raw_self::<D::WGSLLanguageFeatures> as unsafe fn(&mut _, _) -> _,
33208 global: Globals::EMPTY,
33209},
33210 });
33211}
33212
33213#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
33214(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<D::WGSLLanguageFeatures>, _can_gc: CanGc) -> DomRoot<D::WGSLLanguageFeatures>{
33215
33216 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
33217
33218 let scope = scope.reflector().get_jsobject();
33219 assert!(!scope.get().is_null());
33220 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
33221 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
33222
33223 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
33224 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
33225 assert!(!canonical_proto.is_null());
33226
33227
33228 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
33229 if let Some(given) = given_proto {
33230 proto.set(*given);
33231 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
33232 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
33233 }
33234 } else {
33235 proto.set(*canonical_proto);
33236 }
33237 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
33238 cx.raw_cx(),
33239 &Class.get().base,
33240 proto.handle(),
33241 ));
33242 assert!(!obj.is_null());
33243 JS_SetReservedSlot(
33244 obj.get(),
33245 DOM_OBJECT_SLOT,
33246 &PrivateValue(raw.as_ptr() as *const libc::c_void),
33247 );
33248
33249 let root = raw.reflect_with(obj.get());
33250
33251
33252
33253 DomRoot::from_ref(&*root)
33254}
33255
33256pub trait WGSLLanguageFeaturesMethods<D: DomTypes> {
33257 fn Size(&self, ) -> u32;
33258}
33259static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
33260
33261pub(crate) fn init_sMethods_specs<D: DomTypes>() {
33262 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
33263 JSFunctionSpec {
33264 name: JSPropertySpec_Name { string_: c"entries".as_ptr() },
33265 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { entries_methodinfo.get() } as *const _ as *const JSJitInfo },
33266 nargs: 0,
33267 flags: (JSPROP_ENUMERATE) as u16,
33268 selfHostedName: ptr::null()
33269 },
33270 JSFunctionSpec {
33271 name: JSPropertySpec_Name { string_: c"keys".as_ptr() },
33272 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { keys_methodinfo.get() } as *const _ as *const JSJitInfo },
33273 nargs: 0,
33274 flags: (JSPROP_ENUMERATE) as u16,
33275 selfHostedName: ptr::null()
33276 },
33277 JSFunctionSpec {
33278 name: JSPropertySpec_Name { string_: c"values".as_ptr() },
33279 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { values_methodinfo.get() } as *const _ as *const JSJitInfo },
33280 nargs: 0,
33281 flags: (JSPROP_ENUMERATE) as u16,
33282 selfHostedName: ptr::null()
33283 },
33284 JSFunctionSpec {
33285 name: JSPropertySpec_Name { string_: c"forEach".as_ptr() },
33286 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { forEach_methodinfo.get() } as *const _ as *const JSJitInfo },
33287 nargs: 1,
33288 flags: (JSPROP_ENUMERATE) as u16,
33289 selfHostedName: ptr::null()
33290 },
33291 JSFunctionSpec {
33292 name: JSPropertySpec_Name { string_: c"has".as_ptr() },
33293 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { has_methodinfo.get() } as *const _ as *const JSJitInfo },
33294 nargs: 1,
33295 flags: (JSPROP_ENUMERATE) as u16,
33296 selfHostedName: ptr::null()
33297 },
33298 JSFunctionSpec {
33299 name: JSPropertySpec_Name { string_: ptr::null() },
33300 call: JSNativeWrapper { op: None, info: ptr::null() },
33301 nargs: 0,
33302 flags: 0,
33303 selfHostedName: ptr::null()
33304 }]))[..]
33305])));
33306}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
33307
33308pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
33309 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sMethods_specs.get() })[0])])));
33310}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
33311
33312pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
33313 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
33314 JSPropertySpec {
33315 name: JSPropertySpec_Name { string_: c"size".as_ptr() },
33316 attributes_: (JSPROP_ENUMERATE),
33317 kind_: (JSPropertySpec_Kind::NativeAccessor),
33318 u: JSPropertySpec_AccessorsOrValue {
33319 accessors: JSPropertySpec_AccessorsOrValue_Accessors {
33320 getter: JSPropertySpec_Accessor {
33321 native: JSNativeWrapper { op: Some(generic_getter::<false>), info: unsafe { size_getterinfo.get() } },
33322 },
33323 setter: JSPropertySpec_Accessor {
33324 native: JSNativeWrapper { op: None, info: ptr::null() },
33325 }
33326 }
33327 }
33328 }
33329,
33330 JSPropertySpec::ZERO]))[..]
33331,
33332&Box::leak(Box::new([
33333 JSPropertySpec {
33334 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
33335 attributes_: (JSPROP_READONLY),
33336 kind_: (JSPropertySpec_Kind::Value),
33337 u: JSPropertySpec_AccessorsOrValue {
33338 value: JSPropertySpec_ValueWrapper {
33339 type_: JSPropertySpec_ValueWrapper_Type::String,
33340 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
33341 string: c"WGSLLanguageFeatures".as_ptr(),
33342 }
33343 }
33344 }
33345 }
33346,
33347 JSPropertySpec::ZERO]))[..]
33348])));
33349}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
33350
33351pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
33352 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sAttributes_specs.get() })[0]),
33353 Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[1])])));
33354}
33355pub fn GetProtoObject<D: DomTypes>
33356(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
33357 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::WGSLLanguageFeatures), CreateInterfaceObjects::<D>, rval)
33359}
33360
33361
33362static PrototypeClass: JSClass = JSClass {
33363 name: c"WGSLLanguageFeaturesPrototype".as_ptr(),
33364 flags:
33365 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
33367 cOps: ptr::null(),
33368 spec: ptr::null(),
33369 ext: ptr::null(),
33370 oOps: ptr::null(),
33371};
33372
33373
33374static INTERFACE_OBJECT_CLASS: ThreadUnsafeOnceLock<NonCallbackInterfaceObjectClass> = ThreadUnsafeOnceLock::new();
33375
33376pub(crate) fn init_interface_object<D: DomTypes>() {
33377 INTERFACE_OBJECT_CLASS.set(NonCallbackInterfaceObjectClass::new(
33378 Box::leak(Box::new(InterfaceConstructorBehavior::throw())),
33379 b"function WGSLLanguageFeatures() {\n [native code]\n}",
33380 PrototypeList::ID::WGSLLanguageFeatures,
33381 0,
33382 ));
33383}
33384
33385pub fn DefineDOMInterface<D: DomTypes>
33386(cx: SafeJSContext, global: HandleObject){
33387 define_dom_interface(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::WGSLLanguageFeatures),CreateInterfaceObjects::<D>, ConstructorEnabled::<D>)
33388}
33389
33390pub fn ConstructorEnabled<D: DomTypes>
33391(aCx: SafeJSContext, aObj: HandleObject) -> bool{
33392 is_exposed_in(aObj, Globals::DEDICATED_WORKER_GLOBAL_SCOPE | Globals::WINDOW) &&
33393 pref!(dom_webgpu_enabled)
33394}
33395
33396unsafe fn CreateInterfaceObjects<D: DomTypes>
33397(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
33398
33399 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
33400 prototype_proto.set(GetRealmObjectPrototype(cx.raw_cx()));
33401 assert!(!prototype_proto.is_null());
33402
33403 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
33404 create_interface_prototype_object::<D>(cx,
33405 global,
33406 prototype_proto.handle(),
33407 &PrototypeClass,
33408 sMethods.get(),
33409 sAttributes.get(),
33410 &[],
33411 &[],
33412 prototype.handle_mut());
33413 assert!(!prototype.is_null());
33414 assert!((*cache)[PrototypeList::ID::WGSLLanguageFeatures as usize].is_null());
33415 (*cache)[PrototypeList::ID::WGSLLanguageFeatures as usize] = prototype.get();
33416 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::WGSLLanguageFeatures as isize),
33417 ptr::null_mut(),
33418 prototype.get());
33419
33420 rooted!(&in(cx) let mut interface_proto = ptr::null_mut::<JSObject>());
33421 interface_proto.set(GetRealmFunctionPrototype(cx.raw_cx()));
33422
33423 assert!(!interface_proto.is_null());
33424
33425 rooted!(&in(cx) let mut interface = ptr::null_mut::<JSObject>());
33426 create_noncallback_interface_object::<D>(cx,
33427 global,
33428 interface_proto.handle(),
33429 INTERFACE_OBJECT_CLASS.get(),
33430 &[],
33431 &[],
33432 &[],
33433 prototype.handle(),
33434 c"WGSLLanguageFeatures",
33435 0,
33436 &[],
33437 interface.handle_mut());
33438 assert!(!interface.is_null());
33439 rooted!(&in(cx) let mut aliasedVal = UndefinedValue());
33442
33443 assert!(JS_GetProperty(cx.raw_cx(), prototype.handle(),
33444 c"values".as_ptr() as *const u8 as *const _,
33445 aliasedVal.handle_mut()));
33446 rooted!(&in(cx) let mut iteratorId: jsid);
33447 RUST_SYMBOL_TO_JSID(GetWellKnownSymbol(cx.raw_cx(), SymbolCode::iterator), iteratorId.handle_mut());
33448
33449 assert!(JS_DefinePropertyById2(cx.raw_cx(), prototype.handle(), iteratorId.handle(), aliasedVal.handle(), 0));
33450
33451}
33452
33453
33454 pub(crate) fn init_statics<D: DomTypes>() {
33455 init_interface_object::<D>();
33456 init_domjs_class::<D>();
33457 crate::codegen::GenericBindings::WebGPUBinding::WGSLLanguageFeatures_Binding::init_entries_methodinfo::<D>();
33458crate::codegen::GenericBindings::WebGPUBinding::WGSLLanguageFeatures_Binding::init_keys_methodinfo::<D>();
33459crate::codegen::GenericBindings::WebGPUBinding::WGSLLanguageFeatures_Binding::init_values_methodinfo::<D>();
33460crate::codegen::GenericBindings::WebGPUBinding::WGSLLanguageFeatures_Binding::init_forEach_methodinfo::<D>();
33461crate::codegen::GenericBindings::WebGPUBinding::WGSLLanguageFeatures_Binding::init_has_methodinfo::<D>();
33462 init_size_getterinfo::<D>();
33463
33464
33465 init_sMethods_specs::<D>();
33466init_sMethods_prefs::<D>();
33467init_sAttributes_specs::<D>();
33468init_sAttributes_prefs::<D>();
33469 }
33470 } pub use self::GPUSupportedFeaturesSetlike_Binding::{Wrap as GPUSupportedFeaturesSetlikeWrap, GPUSupportedFeaturesSetlikeMethods, GetProtoObject as GPUSupportedFeaturesSetlikeGetProtoObject};
33474pub mod GPUSupportedFeaturesSetlike_Binding {
33475use crate::import::module::*;
33476
33477unsafe extern "C" fn next<D: DomTypes>
33478(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
33479 let mut result = false;
33480 wrap_panic(&mut || result = (|| {
33481 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
33482 let this = &*(this as *const crate::iterable::IterableIterator<D, D::GPUSupportedFeatures>);
33483 let args = &*args;
33484 let argc = args.argc_;
33485 let result: Result<NonNull<JSObject>, Error> = this.Next(SafeJSContext::from_ptr(cx.raw_cx()));
33486 let result = match result {
33487 Ok(result) => result,
33488 Err(e) => {
33489 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
33490 return false;
33491 },
33492 };
33493
33494 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
33495 return true;
33496 })());
33497 result
33498}
33499
33500
33501static next_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
33502
33503pub(crate) fn init_next_methodinfo<D: DomTypes>() {
33504 next_methodinfo.set(JSJitInfo {
33505 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
33506 method: Some(next::<D>)
33507 },
33508 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
33509 protoID: PrototypeList::ID::GPUSupportedFeaturesSetlike as u16,
33510 },
33511 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
33512 _bitfield_align_1: [],
33513 _bitfield_1: __BindgenBitfieldUnit::new(
33514 new_jsjitinfo_bitfield_1!(
33515 JSJitInfo_OpType::Method as u8,
33516 JSJitInfo_AliasSet::AliasEverything as u8,
33517 JSValueType::JSVAL_TYPE_OBJECT as u8,
33518 false,
33519 false,
33520 false,
33521 false,
33522 false,
33523 false,
33524 0,
33525 ).to_ne_bytes()
33526 ),
33527});
33528}
33529unsafe extern "C" fn _finalize<D: DomTypes>
33530(_cx: *mut GCContext, obj: *mut JSObject){
33531 wrap_panic(&mut || {
33532
33533 let this = native_from_object_static::<crate::iterable::IterableIterator<D, D::GPUSupportedFeatures>>(obj).unwrap();
33534 finalize_common(this);
33535 })
33536}
33537
33538unsafe extern "C" fn _trace<D: DomTypes>
33539(trc: *mut JSTracer, obj: *mut JSObject){
33540 wrap_panic(&mut || {
33541
33542 let this = native_from_object_static::<crate::iterable::IterableIterator<D, D::GPUSupportedFeatures>>(obj).unwrap();
33543 if this.is_null() { return; } (*this).trace(trc);
33545 })
33546}
33547
33548
33549static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
33550
33551pub(crate) fn init_class_ops<D: DomTypes>() {
33552 CLASS_OPS.set(JSClassOps {
33553 addProperty: None,
33554 delProperty: None,
33555 enumerate: None,
33556 newEnumerate: None,
33557 resolve: None,
33558 mayResolve: None,
33559 finalize: Some(_finalize::<D>),
33560 call: None,
33561 construct: None,
33562 trace: Some(_trace::<D>),
33563 });
33564}
33565
33566pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
33567
33568pub(crate) fn init_domjs_class<D: DomTypes>() {
33569 init_class_ops::<D>();
33570 Class.set(DOMJSClass {
33571 base: JSClass {
33572 name: c"GPUSupportedFeaturesSetlike".as_ptr(),
33573 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
33574 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
33575 ,
33576 cOps: unsafe { CLASS_OPS.get() },
33577 spec: ptr::null(),
33578 ext: ptr::null(),
33579 oOps: ptr::null(),
33580 },
33581 dom_class:
33582DOMClass {
33583 interface_chain: [ PrototypeList::ID::GPUSupportedFeaturesSetlike, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
33584 depth: 0,
33585 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
33586 malloc_size_of: malloc_size_of_including_raw_self::<crate::iterable::IterableIterator<D, D::GPUSupportedFeatures>> as unsafe fn(&mut _, _) -> _,
33587 global: Globals::EMPTY,
33588},
33589 });
33590}
33591
33592#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
33593(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<crate::iterable::IterableIterator<D, D::GPUSupportedFeatures>>, _can_gc: CanGc) -> DomRoot<crate::iterable::IterableIterator<D, D::GPUSupportedFeatures>>{
33594
33595 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
33596
33597 let scope = scope.reflector().get_jsobject();
33598 assert!(!scope.get().is_null());
33599 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
33600 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
33601
33602 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
33603 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
33604 assert!(!canonical_proto.is_null());
33605
33606
33607 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
33608 if let Some(given) = given_proto {
33609 proto.set(*given);
33610 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
33611 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
33612 }
33613 } else {
33614 proto.set(*canonical_proto);
33615 }
33616 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
33617 cx.raw_cx(),
33618 &Class.get().base,
33619 proto.handle(),
33620 ));
33621 assert!(!obj.is_null());
33622 JS_SetReservedSlot(
33623 obj.get(),
33624 DOM_OBJECT_SLOT,
33625 &PrivateValue(raw.as_ptr() as *const libc::c_void),
33626 );
33627
33628 let root = raw.reflect_with(obj.get());
33629
33630
33631
33632 DomRoot::from_ref(&*root)
33633}
33634
33635pub trait GPUSupportedFeaturesSetlikeMethods<D: DomTypes> {
33636 fn Next(&self, r#cx: SafeJSContext) -> Fallible<NonNull<JSObject>>;
33637}
33638static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
33639
33640pub(crate) fn init_sMethods_specs<D: DomTypes>() {
33641 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
33642 JSFunctionSpec {
33643 name: JSPropertySpec_Name { string_: c"next".as_ptr() },
33644 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { next_methodinfo.get() } as *const _ as *const JSJitInfo },
33645 nargs: 0,
33646 flags: (JSPROP_ENUMERATE) as u16,
33647 selfHostedName: ptr::null()
33648 },
33649 JSFunctionSpec {
33650 name: JSPropertySpec_Name { string_: ptr::null() },
33651 call: JSNativeWrapper { op: None, info: ptr::null() },
33652 nargs: 0,
33653 flags: 0,
33654 selfHostedName: ptr::null()
33655 }]))[..]
33656])));
33657}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
33658
33659pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
33660 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sMethods_specs.get() })[0])])));
33661}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
33662
33663pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
33664 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
33665 JSPropertySpec {
33666 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
33667 attributes_: (JSPROP_READONLY),
33668 kind_: (JSPropertySpec_Kind::Value),
33669 u: JSPropertySpec_AccessorsOrValue {
33670 value: JSPropertySpec_ValueWrapper {
33671 type_: JSPropertySpec_ValueWrapper_Type::String,
33672 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
33673 string: c"GPUSupportedFeatures Setlike".as_ptr(),
33674 }
33675 }
33676 }
33677 }
33678,
33679 JSPropertySpec::ZERO]))[..]
33680])));
33681}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
33682
33683pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
33684 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[0])])));
33685}
33686pub fn GetProtoObject<D: DomTypes>
33687(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
33688 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::GPUSupportedFeaturesSetlike), CreateInterfaceObjects::<D>, rval)
33690}
33691
33692
33693static PrototypeClass: JSClass = JSClass {
33694 name: c"GPUSupportedFeaturesSetlikePrototype".as_ptr(),
33695 flags:
33696 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
33698 cOps: ptr::null(),
33699 spec: ptr::null(),
33700 ext: ptr::null(),
33701 oOps: ptr::null(),
33702};
33703
33704unsafe fn CreateInterfaceObjects<D: DomTypes>
33705(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
33706
33707 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
33708 prototype_proto.set(GetRealmIteratorPrototype(cx.raw_cx()));
33709 assert!(!prototype_proto.is_null());
33710
33711 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
33712 create_interface_prototype_object::<D>(cx,
33713 global,
33714 prototype_proto.handle(),
33715 &PrototypeClass,
33716 sMethods.get(),
33717 sAttributes.get(),
33718 &[],
33719 &[],
33720 prototype.handle_mut());
33721 assert!(!prototype.is_null());
33722 assert!((*cache)[PrototypeList::ID::GPUSupportedFeaturesSetlike as usize].is_null());
33723 (*cache)[PrototypeList::ID::GPUSupportedFeaturesSetlike as usize] = prototype.get();
33724 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::GPUSupportedFeaturesSetlike as isize),
33725 ptr::null_mut(),
33726 prototype.get());
33727
33728}
33729
33730
33731 pub(crate) fn init_statics<D: DomTypes>() {
33732
33733 init_domjs_class::<D>();
33734 crate::codegen::GenericBindings::WebGPUBinding::GPUSupportedFeaturesSetlike_Binding::init_next_methodinfo::<D>();
33735
33736
33737
33738 init_sMethods_specs::<D>();
33739init_sMethods_prefs::<D>();
33740init_sAttributes_specs::<D>();
33741init_sAttributes_prefs::<D>();
33742 }
33743 } pub use self::WGSLLanguageFeaturesSetlike_Binding::{Wrap as WGSLLanguageFeaturesSetlikeWrap, WGSLLanguageFeaturesSetlikeMethods, GetProtoObject as WGSLLanguageFeaturesSetlikeGetProtoObject};
33747pub mod WGSLLanguageFeaturesSetlike_Binding {
33748use crate::import::module::*;
33749
33750unsafe extern "C" fn next<D: DomTypes>
33751(cx: *mut RawJSContext, _obj: RawHandleObject, this: *mut libc::c_void, args: *const JSJitMethodCallArgs) -> bool{
33752 let mut result = false;
33753 wrap_panic(&mut || result = (|| {
33754 let mut cx = JSContext::from_ptr(ptr::NonNull::new(cx).unwrap());
33755 let this = &*(this as *const crate::iterable::IterableIterator<D, D::WGSLLanguageFeatures>);
33756 let args = &*args;
33757 let argc = args.argc_;
33758 let result: Result<NonNull<JSObject>, Error> = this.Next(SafeJSContext::from_ptr(cx.raw_cx()));
33759 let result = match result {
33760 Ok(result) => result,
33761 Err(e) => {
33762 <D as DomHelpers<D>>::throw_dom_exception(SafeJSContext::from_ptr(cx.raw_cx()), &this.global_(InRealm::already(&AlreadyInRealm::assert_for_cx(SafeJSContext::from_ptr(cx.raw_cx())))), e, CanGc::note());
33763 return false;
33764 },
33765 };
33766
33767 (result).to_jsval(cx.raw_cx(), MutableHandleValue::from_raw(args.rval()));
33768 return true;
33769 })());
33770 result
33771}
33772
33773
33774static next_methodinfo: ThreadUnsafeOnceLock<JSJitInfo> = ThreadUnsafeOnceLock::new();
33775
33776pub(crate) fn init_next_methodinfo<D: DomTypes>() {
33777 next_methodinfo.set(JSJitInfo {
33778 __bindgen_anon_1: JSJitInfo__bindgen_ty_1 {
33779 method: Some(next::<D>)
33780 },
33781 __bindgen_anon_2: JSJitInfo__bindgen_ty_2 {
33782 protoID: PrototypeList::ID::WGSLLanguageFeaturesSetlike as u16,
33783 },
33784 __bindgen_anon_3: JSJitInfo__bindgen_ty_3 { depth: 0 },
33785 _bitfield_align_1: [],
33786 _bitfield_1: __BindgenBitfieldUnit::new(
33787 new_jsjitinfo_bitfield_1!(
33788 JSJitInfo_OpType::Method as u8,
33789 JSJitInfo_AliasSet::AliasEverything as u8,
33790 JSValueType::JSVAL_TYPE_OBJECT as u8,
33791 false,
33792 false,
33793 false,
33794 false,
33795 false,
33796 false,
33797 0,
33798 ).to_ne_bytes()
33799 ),
33800});
33801}
33802unsafe extern "C" fn _finalize<D: DomTypes>
33803(_cx: *mut GCContext, obj: *mut JSObject){
33804 wrap_panic(&mut || {
33805
33806 let this = native_from_object_static::<crate::iterable::IterableIterator<D, D::WGSLLanguageFeatures>>(obj).unwrap();
33807 finalize_common(this);
33808 })
33809}
33810
33811unsafe extern "C" fn _trace<D: DomTypes>
33812(trc: *mut JSTracer, obj: *mut JSObject){
33813 wrap_panic(&mut || {
33814
33815 let this = native_from_object_static::<crate::iterable::IterableIterator<D, D::WGSLLanguageFeatures>>(obj).unwrap();
33816 if this.is_null() { return; } (*this).trace(trc);
33818 })
33819}
33820
33821
33822static CLASS_OPS: ThreadUnsafeOnceLock<JSClassOps> = ThreadUnsafeOnceLock::new();
33823
33824pub(crate) fn init_class_ops<D: DomTypes>() {
33825 CLASS_OPS.set(JSClassOps {
33826 addProperty: None,
33827 delProperty: None,
33828 enumerate: None,
33829 newEnumerate: None,
33830 resolve: None,
33831 mayResolve: None,
33832 finalize: Some(_finalize::<D>),
33833 call: None,
33834 construct: None,
33835 trace: Some(_trace::<D>),
33836 });
33837}
33838
33839pub static Class: ThreadUnsafeOnceLock<DOMJSClass> = ThreadUnsafeOnceLock::new();
33840
33841pub(crate) fn init_domjs_class<D: DomTypes>() {
33842 init_class_ops::<D>();
33843 Class.set(DOMJSClass {
33844 base: JSClass {
33845 name: c"WGSLLanguageFeaturesSetlike".as_ptr(),
33846 flags: JSCLASS_IS_DOMJSCLASS | JSCLASS_FOREGROUND_FINALIZE |
33847 (((1) & JSCLASS_RESERVED_SLOTS_MASK) << JSCLASS_RESERVED_SLOTS_SHIFT)
33848 ,
33849 cOps: unsafe { CLASS_OPS.get() },
33850 spec: ptr::null(),
33851 ext: ptr::null(),
33852 oOps: ptr::null(),
33853 },
33854 dom_class:
33855DOMClass {
33856 interface_chain: [ PrototypeList::ID::WGSLLanguageFeaturesSetlike, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last, PrototypeList::ID::Last ],
33857 depth: 0,
33858 type_id: crate::codegen::InheritTypes::TopTypeId { alone: () },
33859 malloc_size_of: malloc_size_of_including_raw_self::<crate::iterable::IterableIterator<D, D::WGSLLanguageFeatures>> as unsafe fn(&mut _, _) -> _,
33860 global: Globals::EMPTY,
33861},
33862 });
33863}
33864
33865#[cfg_attr(crown, allow(crown::unrooted_must_root))] pub unsafe fn Wrap<D: DomTypes>
33866(cx: SafeJSContext, scope: &D::GlobalScope, given_proto: Option<HandleObject>, object: Box<crate::iterable::IterableIterator<D, D::WGSLLanguageFeatures>>, _can_gc: CanGc) -> DomRoot<crate::iterable::IterableIterator<D, D::WGSLLanguageFeatures>>{
33867
33868 let raw = Root::new(MaybeUnreflectedDom::from_box(object));
33869
33870 let scope = scope.reflector().get_jsobject();
33871 assert!(!scope.get().is_null());
33872 assert!(((*get_object_class(scope.get())).flags & JSCLASS_IS_GLOBAL) != 0);
33873 let _ac = JSAutoRealm::new(cx.raw_cx(), scope.get());
33874
33875 rooted!(&in(cx) let mut canonical_proto = ptr::null_mut::<JSObject>());
33876 GetProtoObject::<D>(cx, scope, canonical_proto.handle_mut());
33877 assert!(!canonical_proto.is_null());
33878
33879
33880 rooted!(&in(cx) let mut proto = ptr::null_mut::<JSObject>());
33881 if let Some(given) = given_proto {
33882 proto.set(*given);
33883 if get_context_realm(cx.raw_cx()) != get_object_realm(*given) {
33884 assert!(JS_WrapObject(cx.raw_cx(), proto.handle_mut()));
33885 }
33886 } else {
33887 proto.set(*canonical_proto);
33888 }
33889 rooted!(&in(cx) let obj = JS_NewObjectWithGivenProto(
33890 cx.raw_cx(),
33891 &Class.get().base,
33892 proto.handle(),
33893 ));
33894 assert!(!obj.is_null());
33895 JS_SetReservedSlot(
33896 obj.get(),
33897 DOM_OBJECT_SLOT,
33898 &PrivateValue(raw.as_ptr() as *const libc::c_void),
33899 );
33900
33901 let root = raw.reflect_with(obj.get());
33902
33903
33904
33905 DomRoot::from_ref(&*root)
33906}
33907
33908pub trait WGSLLanguageFeaturesSetlikeMethods<D: DomTypes> {
33909 fn Next(&self, r#cx: SafeJSContext) -> Fallible<NonNull<JSObject>>;
33910}
33911static sMethods_specs: ThreadUnsafeOnceLock<&[&[JSFunctionSpec]]> = ThreadUnsafeOnceLock::new();
33912
33913pub(crate) fn init_sMethods_specs<D: DomTypes>() {
33914 sMethods_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
33915 JSFunctionSpec {
33916 name: JSPropertySpec_Name { string_: c"next".as_ptr() },
33917 call: JSNativeWrapper { op: Some(generic_method::<false>), info: unsafe { next_methodinfo.get() } as *const _ as *const JSJitInfo },
33918 nargs: 0,
33919 flags: (JSPROP_ENUMERATE) as u16,
33920 selfHostedName: ptr::null()
33921 },
33922 JSFunctionSpec {
33923 name: JSPropertySpec_Name { string_: ptr::null() },
33924 call: JSNativeWrapper { op: None, info: ptr::null() },
33925 nargs: 0,
33926 flags: 0,
33927 selfHostedName: ptr::null()
33928 }]))[..]
33929])));
33930}static sMethods: ThreadUnsafeOnceLock<&[Guard<&[JSFunctionSpec]>]> = ThreadUnsafeOnceLock::new();
33931
33932pub(crate) fn init_sMethods_prefs<D: DomTypes>() {
33933 sMethods.set(Box::leak(Box::new([ Guard::new(&[Condition::Exposed(Globals::WINDOW),Condition::Exposed(Globals::DEDICATED_WORKER_GLOBAL_SCOPE)], (unsafe { sMethods_specs.get() })[0])])));
33934}static sAttributes_specs: ThreadUnsafeOnceLock<&[&[JSPropertySpec]]> = ThreadUnsafeOnceLock::new();
33935
33936pub(crate) fn init_sAttributes_specs<D: DomTypes>() {
33937 sAttributes_specs.set(Box::leak(Box::new([&Box::leak(Box::new([
33938 JSPropertySpec {
33939 name: JSPropertySpec_Name { symbol_: SymbolCode::toStringTag as usize + 1 },
33940 attributes_: (JSPROP_READONLY),
33941 kind_: (JSPropertySpec_Kind::Value),
33942 u: JSPropertySpec_AccessorsOrValue {
33943 value: JSPropertySpec_ValueWrapper {
33944 type_: JSPropertySpec_ValueWrapper_Type::String,
33945 __bindgen_anon_1: JSPropertySpec_ValueWrapper__bindgen_ty_1 {
33946 string: c"WGSLLanguageFeatures Setlike".as_ptr(),
33947 }
33948 }
33949 }
33950 }
33951,
33952 JSPropertySpec::ZERO]))[..]
33953])));
33954}static sAttributes: ThreadUnsafeOnceLock<&[Guard<&[JSPropertySpec]>]> = ThreadUnsafeOnceLock::new();
33955
33956pub(crate) fn init_sAttributes_prefs<D: DomTypes>() {
33957 sAttributes.set(Box::leak(Box::new([ Guard::new(&[Condition::Satisfied], (unsafe { sAttributes_specs.get() })[0])])));
33958}
33959pub fn GetProtoObject<D: DomTypes>
33960(cx: SafeJSContext, global: HandleObject, mut rval: MutableHandleObject){
33961 get_per_interface_object_handle(cx, global, ProtoOrIfaceIndex::ID(PrototypeList::ID::WGSLLanguageFeaturesSetlike), CreateInterfaceObjects::<D>, rval)
33963}
33964
33965
33966static PrototypeClass: JSClass = JSClass {
33967 name: c"WGSLLanguageFeaturesSetlikePrototype".as_ptr(),
33968 flags:
33969 (0 ) << JSCLASS_RESERVED_SLOTS_SHIFT,
33971 cOps: ptr::null(),
33972 spec: ptr::null(),
33973 ext: ptr::null(),
33974 oOps: ptr::null(),
33975};
33976
33977unsafe fn CreateInterfaceObjects<D: DomTypes>
33978(cx: SafeJSContext, global: HandleObject, cache: *mut ProtoOrIfaceArray){
33979
33980 rooted!(&in(cx) let mut prototype_proto = ptr::null_mut::<JSObject>());
33981 prototype_proto.set(GetRealmIteratorPrototype(cx.raw_cx()));
33982 assert!(!prototype_proto.is_null());
33983
33984 rooted!(&in(cx) let mut prototype = ptr::null_mut::<JSObject>());
33985 create_interface_prototype_object::<D>(cx,
33986 global,
33987 prototype_proto.handle(),
33988 &PrototypeClass,
33989 sMethods.get(),
33990 sAttributes.get(),
33991 &[],
33992 &[],
33993 prototype.handle_mut());
33994 assert!(!prototype.is_null());
33995 assert!((*cache)[PrototypeList::ID::WGSLLanguageFeaturesSetlike as usize].is_null());
33996 (*cache)[PrototypeList::ID::WGSLLanguageFeaturesSetlike as usize] = prototype.get();
33997 <*mut JSObject>::post_barrier((*cache).as_mut_ptr().offset(PrototypeList::ID::WGSLLanguageFeaturesSetlike as isize),
33998 ptr::null_mut(),
33999 prototype.get());
34000
34001}
34002
34003
34004 pub(crate) fn init_statics<D: DomTypes>() {
34005
34006 init_domjs_class::<D>();
34007 crate::codegen::GenericBindings::WebGPUBinding::WGSLLanguageFeaturesSetlike_Binding::init_next_methodinfo::<D>();
34008
34009
34010
34011 init_sMethods_specs::<D>();
34012init_sMethods_prefs::<D>();
34013init_sAttributes_specs::<D>();
34014init_sAttributes_prefs::<D>();
34015 }
34016 }