Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/mozilla/dom/WebGPUBinding.h
Line
Count
Source (jump to first uncovered line)
1
/* THIS FILE IS AUTOGENERATED FROM WebGPU.webidl BY Codegen.py - DO NOT EDIT */
2
3
#ifndef mozilla_dom_WebGPUBinding_h
4
#define mozilla_dom_WebGPUBinding_h
5
6
#include "GeckoProfiler.h"
7
#include "WebGPUBinding.h"
8
#include "WebGPUExtrasBinding.h"
9
#include "js/RootingAPI.h"
10
#include "jspubtd.h"
11
#include "mozilla/ErrorResult.h"
12
#include "mozilla/dom/BindingDeclarations.h"
13
#include "mozilla/dom/CallbackFunction.h"
14
#include "mozilla/dom/FakeString.h"
15
#include "mozilla/dom/Nullable.h"
16
#include "mozilla/dom/PrototypeList.h"
17
#include "mozilla/dom/ToJSValue.h"
18
#include "mozilla/dom/TypedArray.h"
19
#include "mozilla/dom/UnionMember.h"
20
#include "mozilla/webgpu/AttachmentState.h"
21
#include "mozilla/webgpu/BindGroupLayout.h"
22
#include "mozilla/webgpu/BlendState.h"
23
#include "mozilla/webgpu/DepthStencilState.h"
24
#include "mozilla/webgpu/InputState.h"
25
#include "mozilla/webgpu/PipelineLayout.h"
26
#include "mozilla/webgpu/ShaderModule.h"
27
#include "mozilla/webgpu/TextureView.h"
28
29
namespace mozilla {
30
31
namespace dom {
32
33
struct NativePropertyHooks;
34
class OwningWebGPUBufferOrWebGPUTexture;
35
class OwningWebGPUComputePipelineOrWebGPURenderPipeline;
36
class OwningWebGPUSamplerOrWebGPUTextureViewOrWebGPUBufferBinding;
37
class ProtoAndIfaceCache;
38
struct WebGPUAdapterDescriptorAtoms;
39
struct WebGPUAttachmentStateDescriptorAtoms;
40
struct WebGPUBindGroupBinding;
41
struct WebGPUBindGroupBindingAtoms;
42
struct WebGPUBindGroupDescriptorAtoms;
43
struct WebGPUBindGroupLayoutDescriptorAtoms;
44
struct WebGPUBinding;
45
struct WebGPUBindingAtoms;
46
class WebGPUBindingType;
47
struct WebGPUBindingTypeAtoms;
48
struct WebGPUBlendDescriptor;
49
struct WebGPUBlendDescriptorAtoms;
50
class WebGPUBlendFactor;
51
struct WebGPUBlendFactorAtoms;
52
class WebGPUBlendOperation;
53
struct WebGPUBlendOperationAtoms;
54
struct WebGPUBlendStateDescriptorAtoms;
55
struct WebGPUBufferDescriptorAtoms;
56
class WebGPUBufferUsage;
57
struct WebGPUBufferUsageAtoms;
58
class WebGPUColorWriteBits;
59
struct WebGPUColorWriteBitsAtoms;
60
class WebGPUCompareFunction;
61
struct WebGPUCompareFunctionAtoms;
62
struct WebGPUDepthStencilStateDescriptorAtoms;
63
struct WebGPUDeviceDescriptorAtoms;
64
struct WebGPUExtensions;
65
struct WebGPUExtensionsAtoms;
66
class WebGPUFilterMode;
67
struct WebGPUFilterModeAtoms;
68
class WebGPUIndexFormat;
69
struct WebGPUIndexFormatAtoms;
70
struct WebGPUInputStateDescriptorAtoms;
71
class WebGPUInputStepMode;
72
struct WebGPUInputStepModeAtoms;
73
struct WebGPULimitsAtoms;
74
class WebGPULoadOp;
75
struct WebGPULoadOpAtoms;
76
class WebGPULogCallback;
77
struct WebGPUPipelineDescriptorBaseAtoms;
78
struct WebGPUPipelineLayoutDescriptorAtoms;
79
struct WebGPUPipelineStageDescriptor;
80
struct WebGPUPipelineStageDescriptorAtoms;
81
class WebGPUPrimitiveTopology;
82
struct WebGPUPrimitiveTopologyAtoms;
83
struct WebGPURenderPassAttachmentDescriptor;
84
struct WebGPURenderPassAttachmentDescriptorAtoms;
85
struct WebGPURenderPassDescriptorAtoms;
86
struct WebGPURenderPipelineDescriptorAtoms;
87
struct WebGPUSamplerDescriptorAtoms;
88
class WebGPUSamplerOrWebGPUTextureViewOrWebGPUBufferBinding;
89
struct WebGPUShaderModuleDescriptorAtoms;
90
class WebGPUShaderStage;
91
struct WebGPUShaderStageAtoms;
92
class WebGPUShaderStageBit;
93
struct WebGPUShaderStageBitAtoms;
94
class WebGPUStencilOperation;
95
struct WebGPUStencilOperationAtoms;
96
struct WebGPUStencilStateFaceDescriptor;
97
struct WebGPUStencilStateFaceDescriptorAtoms;
98
class WebGPUStoreOp;
99
struct WebGPUStoreOpAtoms;
100
struct WebGPUSwapChainDescriptorAtoms;
101
struct WebGPUTextureDescriptorAtoms;
102
class WebGPUTextureDimension;
103
struct WebGPUTextureDimensionAtoms;
104
class WebGPUTextureFormat;
105
struct WebGPUTextureFormatAtoms;
106
class WebGPUTextureUsage;
107
struct WebGPUTextureUsageAtoms;
108
struct WebGPUVertexAttributeDescriptor;
109
struct WebGPUVertexAttributeDescriptorAtoms;
110
class WebGPUVertexFormat;
111
struct WebGPUVertexFormatAtoms;
112
struct WebGPUVertexInputDescriptor;
113
struct WebGPUVertexInputDescriptorAtoms;
114
115
} // namespace dom
116
117
namespace webgpu {
118
119
class Adapter;
120
struct AdapterAtoms;
121
class AttachmentState;
122
struct AttachmentStateAtoms;
123
class BindGroup;
124
struct BindGroupAtoms;
125
class BindGroupLayout;
126
struct BindGroupLayoutAtoms;
127
class BlendState;
128
struct BlendStateAtoms;
129
class Buffer;
130
struct BufferAtoms;
131
class CommandBuffer;
132
struct CommandBufferAtoms;
133
class CommandEncoder;
134
struct CommandEncoderAtoms;
135
class ComputePipeline;
136
struct ComputePipelineAtoms;
137
class DepthStencilState;
138
struct DepthStencilStateAtoms;
139
class Device;
140
struct DeviceAtoms;
141
class Fence;
142
struct FenceAtoms;
143
class InputState;
144
struct InputStateAtoms;
145
class Instance;
146
struct InstanceAtoms;
147
class LogEntry;
148
struct LogEntryAtoms;
149
class PipelineLayout;
150
struct PipelineLayoutAtoms;
151
class Queue;
152
struct QueueAtoms;
153
class RenderPipeline;
154
struct RenderPipelineAtoms;
155
class Sampler;
156
struct SamplerAtoms;
157
class ShaderModule;
158
struct ShaderModuleAtoms;
159
class SwapChain;
160
struct SwapChainAtoms;
161
class Texture;
162
struct TextureAtoms;
163
class TextureView;
164
struct TextureViewAtoms;
165
166
} // namespace webgpu
167
168
} // namespace mozilla
169
170
namespace mozilla {
171
namespace dom {
172
173
enum class WebGPULogEntryType : uint8_t {
174
  Device_lost,
175
  Validation_error,
176
  Recoverable_out_of_memory,
177
  EndGuard_
178
};
179
180
namespace WebGPULogEntryTypeValues {
181
extern const EnumEntry strings[4];
182
} // namespace WebGPULogEntryTypeValues
183
184
bool
185
ToJSValue(JSContext* aCx, WebGPULogEntryType aArgument, JS::MutableHandle<JS::Value> aValue);
186
187
188
enum class WebGPUObjectStatus : uint8_t {
189
  Valid,
190
  Out_of_memory,
191
  Invalid,
192
  EndGuard_
193
};
194
195
namespace WebGPUObjectStatusValues {
196
extern const EnumEntry strings[4];
197
} // namespace WebGPUObjectStatusValues
198
199
bool
200
ToJSValue(JSContext* aCx, WebGPUObjectStatus aArgument, JS::MutableHandle<JS::Value> aValue);
201
202
203
enum class WebGPUPowerPreference : uint8_t {
204
  Default,
205
  Low_power,
206
  High_performance,
207
  EndGuard_
208
};
209
210
namespace WebGPUPowerPreferenceValues {
211
extern const EnumEntry strings[4];
212
} // namespace WebGPUPowerPreferenceValues
213
214
bool
215
ToJSValue(JSContext* aCx, WebGPUPowerPreference aArgument, JS::MutableHandle<JS::Value> aValue);
216
217
218
void
219
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningWebGPUBufferOrWebGPUTexture& aUnion, const char* aName, uint32_t aFlags = 0);
220
221
222
void
223
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningWebGPUComputePipelineOrWebGPURenderPipeline& aUnion, const char* aName, uint32_t aFlags = 0);
224
225
226
void
227
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& aCallback, OwningWebGPUSamplerOrWebGPUTextureViewOrWebGPUBufferBinding& aUnion, const char* aName, uint32_t aFlags = 0);
228
229
230
void
231
ImplCycleCollectionUnlink(OwningWebGPUBufferOrWebGPUTexture& aUnion);
232
233
234
void
235
ImplCycleCollectionUnlink(OwningWebGPUComputePipelineOrWebGPURenderPipeline& aUnion);
236
237
238
void
239
ImplCycleCollectionUnlink(OwningWebGPUSamplerOrWebGPUTextureViewOrWebGPUBufferBinding& aUnion);
240
241
242
struct WebGPUAdapterDescriptor : public DictionaryBase
243
{
244
  MOZ_INIT_OUTSIDE_CTOR Optional<WebGPUPowerPreference> mPowerPreference;
245
246
  WebGPUAdapterDescriptor();
247
248
  explicit inline WebGPUAdapterDescriptor(const FastDictionaryInitializer& )
249
0
  {
250
0
    // Do nothing here; this is used by our "Fast" subclass
251
0
  }
252
253
  explicit inline WebGPUAdapterDescriptor(const WebGPUAdapterDescriptor& aOther)
254
0
  {
255
0
    *this = aOther;
256
0
  }
257
258
  bool
259
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
260
261
  bool
262
  Init(const nsAString& aJSON);
263
264
  bool
265
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
266
267
  bool
268
  ToJSON(nsAString& aJSON) const;
269
270
  void
271
  TraceDictionary(JSTracer* trc);
272
273
  WebGPUAdapterDescriptor&
274
  operator=(const WebGPUAdapterDescriptor& aOther);
275
276
private:
277
  static bool
278
  InitIds(JSContext* cx, WebGPUAdapterDescriptorAtoms* atomsCache);
279
};
280
281
namespace binding_detail {
282
struct FastWebGPUAdapterDescriptor : public WebGPUAdapterDescriptor
283
{
284
  inline FastWebGPUAdapterDescriptor()
285
    : WebGPUAdapterDescriptor(FastDictionaryInitializer())
286
0
  {
287
0
    // Doesn't matter what int we pass to the parent constructor
288
0
  }
289
};
290
} // namespace binding_detail
291
292
293
struct WebGPUAttachmentStateDescriptor : public DictionaryBase
294
{
295
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<uint32_t>> mFormats;
296
297
  WebGPUAttachmentStateDescriptor();
298
299
  explicit inline WebGPUAttachmentStateDescriptor(const FastDictionaryInitializer& )
300
0
  {
301
0
    // Do nothing here; this is used by our "Fast" subclass
302
0
  }
303
304
  explicit inline WebGPUAttachmentStateDescriptor(const WebGPUAttachmentStateDescriptor& aOther)
305
0
  {
306
0
    *this = aOther;
307
0
  }
308
309
  bool
310
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
311
312
  bool
313
  Init(const nsAString& aJSON);
314
315
  bool
316
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
317
318
  bool
319
  ToJSON(nsAString& aJSON) const;
320
321
  void
322
  TraceDictionary(JSTracer* trc);
323
324
  WebGPUAttachmentStateDescriptor&
325
  operator=(const WebGPUAttachmentStateDescriptor& aOther);
326
327
private:
328
  static bool
329
  InitIds(JSContext* cx, WebGPUAttachmentStateDescriptorAtoms* atomsCache);
330
};
331
332
namespace binding_detail {
333
struct FastWebGPUAttachmentStateDescriptor : public WebGPUAttachmentStateDescriptor
334
{
335
  inline FastWebGPUAttachmentStateDescriptor()
336
    : WebGPUAttachmentStateDescriptor(FastDictionaryInitializer())
337
0
  {
338
0
    // Doesn't matter what int we pass to the parent constructor
339
0
  }
340
};
341
} // namespace binding_detail
342
343
344
struct WebGPUBindGroupBinding : public DictionaryBase
345
{
346
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mCount;
347
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mStart;
348
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mType;
349
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mVisibility;
350
351
  WebGPUBindGroupBinding();
352
353
  explicit inline WebGPUBindGroupBinding(const FastDictionaryInitializer& )
354
0
  {
355
0
    // Do nothing here; this is used by our "Fast" subclass
356
0
  }
357
358
  explicit inline WebGPUBindGroupBinding(const WebGPUBindGroupBinding& aOther)
359
0
  {
360
0
    *this = aOther;
361
0
  }
362
363
  bool
364
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
365
366
  bool
367
  Init(const nsAString& aJSON);
368
369
  bool
370
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
371
372
  bool
373
  ToJSON(nsAString& aJSON) const;
374
375
  void
376
  TraceDictionary(JSTracer* trc);
377
378
  WebGPUBindGroupBinding&
379
  operator=(const WebGPUBindGroupBinding& aOther);
380
381
private:
382
  static bool
383
  InitIds(JSContext* cx, WebGPUBindGroupBindingAtoms* atomsCache);
384
};
385
386
namespace binding_detail {
387
struct FastWebGPUBindGroupBinding : public WebGPUBindGroupBinding
388
{
389
  inline FastWebGPUBindGroupBinding()
390
    : WebGPUBindGroupBinding(FastDictionaryInitializer())
391
0
  {
392
0
    // Doesn't matter what int we pass to the parent constructor
393
0
  }
394
};
395
} // namespace binding_detail
396
397
398
struct WebGPUBlendDescriptor : public DictionaryBase
399
{
400
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mDstFactor;
401
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mOperation;
402
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mSrcFactor;
403
404
  WebGPUBlendDescriptor();
405
406
  explicit inline WebGPUBlendDescriptor(const FastDictionaryInitializer& )
407
0
  {
408
0
    // Do nothing here; this is used by our "Fast" subclass
409
0
  }
410
411
  explicit inline WebGPUBlendDescriptor(const WebGPUBlendDescriptor& aOther)
412
0
  {
413
0
    *this = aOther;
414
0
  }
415
416
  bool
417
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
418
419
  bool
420
  Init(const nsAString& aJSON);
421
422
  bool
423
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
424
425
  bool
426
  ToJSON(nsAString& aJSON) const;
427
428
  void
429
  TraceDictionary(JSTracer* trc);
430
431
  WebGPUBlendDescriptor&
432
  operator=(const WebGPUBlendDescriptor& aOther);
433
434
private:
435
  static bool
436
  InitIds(JSContext* cx, WebGPUBlendDescriptorAtoms* atomsCache);
437
};
438
439
namespace binding_detail {
440
struct FastWebGPUBlendDescriptor : public WebGPUBlendDescriptor
441
{
442
  inline FastWebGPUBlendDescriptor()
443
    : WebGPUBlendDescriptor(FastDictionaryInitializer())
444
0
  {
445
0
    // Doesn't matter what int we pass to the parent constructor
446
0
  }
447
};
448
} // namespace binding_detail
449
450
451
struct WebGPUBufferDescriptor : public DictionaryBase
452
{
453
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mSize;
454
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mUsage;
455
456
  WebGPUBufferDescriptor();
457
458
  explicit inline WebGPUBufferDescriptor(const FastDictionaryInitializer& )
459
0
  {
460
0
    // Do nothing here; this is used by our "Fast" subclass
461
0
  }
462
463
  explicit inline WebGPUBufferDescriptor(const WebGPUBufferDescriptor& aOther)
464
0
  {
465
0
    *this = aOther;
466
0
  }
467
468
  bool
469
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
470
471
  bool
472
  Init(const nsAString& aJSON);
473
474
  bool
475
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
476
477
  bool
478
  ToJSON(nsAString& aJSON) const;
479
480
  void
481
  TraceDictionary(JSTracer* trc);
482
483
  WebGPUBufferDescriptor&
484
  operator=(const WebGPUBufferDescriptor& aOther);
485
486
private:
487
  static bool
488
  InitIds(JSContext* cx, WebGPUBufferDescriptorAtoms* atomsCache);
489
};
490
491
namespace binding_detail {
492
struct FastWebGPUBufferDescriptor : public WebGPUBufferDescriptor
493
{
494
  inline FastWebGPUBufferDescriptor()
495
    : WebGPUBufferDescriptor(FastDictionaryInitializer())
496
0
  {
497
0
    // Doesn't matter what int we pass to the parent constructor
498
0
  }
499
};
500
} // namespace binding_detail
501
502
503
class WebGPUBufferOrWebGPUTexture
504
{
505
  friend class WebGPUBufferOrWebGPUTextureArgument;
506
  enum Type
507
  {
508
    eUninitialized,
509
    eWebGPUBuffer,
510
    eWebGPUTexture
511
  };
512
513
  union Value
514
  {
515
    UnionMember<NonNull<mozilla::webgpu::Buffer> > mWebGPUBuffer;
516
    UnionMember<NonNull<mozilla::webgpu::Texture> > mWebGPUTexture;
517
518
  };
519
520
  Type mType;
521
  Value mValue;
522
523
  WebGPUBufferOrWebGPUTexture(const WebGPUBufferOrWebGPUTexture&) = delete;
524
  WebGPUBufferOrWebGPUTexture& operator=(const WebGPUBufferOrWebGPUTexture&) = delete;
525
public:
526
  explicit inline WebGPUBufferOrWebGPUTexture()
527
    : mType(eUninitialized)
528
0
  {
529
0
  }
530
531
  inline ~WebGPUBufferOrWebGPUTexture()
532
0
  {
533
0
    Uninit();
534
0
  }
535
536
  inline NonNull<mozilla::webgpu::Buffer>&
537
  RawSetAsWebGPUBuffer()
538
0
  {
539
0
    if (mType == eWebGPUBuffer) {
540
0
      return mValue.mWebGPUBuffer.Value();
541
0
    }
542
0
    MOZ_ASSERT(mType == eUninitialized);
543
0
    mType = eWebGPUBuffer;
544
0
    return mValue.mWebGPUBuffer.SetValue();
545
0
  }
546
547
  inline NonNull<mozilla::webgpu::Buffer>&
548
  SetAsWebGPUBuffer()
549
0
  {
550
0
    if (mType == eWebGPUBuffer) {
551
0
      return mValue.mWebGPUBuffer.Value();
552
0
    }
553
0
    Uninit();
554
0
    mType = eWebGPUBuffer;
555
0
    return mValue.mWebGPUBuffer.SetValue();
556
0
  }
557
558
  inline bool
559
  IsWebGPUBuffer() const
560
0
  {
561
0
    return mType == eWebGPUBuffer;
562
0
  }
563
564
  inline NonNull<mozilla::webgpu::Buffer>&
565
  GetAsWebGPUBuffer()
566
0
  {
567
0
    MOZ_ASSERT(IsWebGPUBuffer(), "Wrong type!");
568
0
    return mValue.mWebGPUBuffer.Value();
569
0
  }
570
571
  inline mozilla::webgpu::Buffer&
572
  GetAsWebGPUBuffer() const
573
0
  {
574
0
    MOZ_ASSERT(IsWebGPUBuffer(), "Wrong type!");
575
0
    return mValue.mWebGPUBuffer.Value();
576
0
  }
577
578
  inline NonNull<mozilla::webgpu::Texture>&
579
  RawSetAsWebGPUTexture()
580
0
  {
581
0
    if (mType == eWebGPUTexture) {
582
0
      return mValue.mWebGPUTexture.Value();
583
0
    }
584
0
    MOZ_ASSERT(mType == eUninitialized);
585
0
    mType = eWebGPUTexture;
586
0
    return mValue.mWebGPUTexture.SetValue();
587
0
  }
588
589
  inline NonNull<mozilla::webgpu::Texture>&
590
  SetAsWebGPUTexture()
591
0
  {
592
0
    if (mType == eWebGPUTexture) {
593
0
      return mValue.mWebGPUTexture.Value();
594
0
    }
595
0
    Uninit();
596
0
    mType = eWebGPUTexture;
597
0
    return mValue.mWebGPUTexture.SetValue();
598
0
  }
599
600
  inline bool
601
  IsWebGPUTexture() const
602
0
  {
603
0
    return mType == eWebGPUTexture;
604
0
  }
605
606
  inline NonNull<mozilla::webgpu::Texture>&
607
  GetAsWebGPUTexture()
608
0
  {
609
0
    MOZ_ASSERT(IsWebGPUTexture(), "Wrong type!");
610
0
    return mValue.mWebGPUTexture.Value();
611
0
  }
612
613
  inline mozilla::webgpu::Texture&
614
  GetAsWebGPUTexture() const
615
0
  {
616
0
    MOZ_ASSERT(IsWebGPUTexture(), "Wrong type!");
617
0
    return mValue.mWebGPUTexture.Value();
618
0
  }
619
620
  inline void
621
  Uninit()
622
  {
623
    switch (mType) {
624
      case eUninitialized: {
625
        break;
626
      }
627
      case eWebGPUBuffer: {
628
        DestroyWebGPUBuffer();
629
        break;
630
      }
631
      case eWebGPUTexture: {
632
        DestroyWebGPUTexture();
633
        break;
634
      }
635
    }
636
  }
637
638
  bool
639
  ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
640
641
private:
642
  inline void
643
  DestroyWebGPUBuffer()
644
0
  {
645
0
    MOZ_ASSERT(IsWebGPUBuffer(), "Wrong type!");
646
0
    mValue.mWebGPUBuffer.Destroy();
647
0
    mType = eUninitialized;
648
0
  }
649
650
  inline void
651
  DestroyWebGPUTexture()
652
0
  {
653
0
    MOZ_ASSERT(IsWebGPUTexture(), "Wrong type!");
654
0
    mValue.mWebGPUTexture.Destroy();
655
0
    mType = eUninitialized;
656
0
  }
657
};
658
659
660
class OwningWebGPUBufferOrWebGPUTexture : public AllOwningUnionBase
661
{
662
  friend void ImplCycleCollectionUnlink(OwningWebGPUBufferOrWebGPUTexture& aUnion);
663
  enum Type
664
  {
665
    eUninitialized,
666
    eWebGPUBuffer,
667
    eWebGPUTexture
668
  };
669
670
  union Value
671
  {
672
    UnionMember<OwningNonNull<mozilla::webgpu::Buffer> > mWebGPUBuffer;
673
    UnionMember<OwningNonNull<mozilla::webgpu::Texture> > mWebGPUTexture;
674
675
  };
676
677
  Type mType;
678
  Value mValue;
679
680
public:
681
  explicit inline OwningWebGPUBufferOrWebGPUTexture()
682
    : mType(eUninitialized)
683
0
  {
684
0
  }
685
686
  explicit inline OwningWebGPUBufferOrWebGPUTexture(const OwningWebGPUBufferOrWebGPUTexture& aOther)
687
    : mType(eUninitialized)
688
0
  {
689
0
    *this = aOther;
690
0
  }
691
692
  inline ~OwningWebGPUBufferOrWebGPUTexture()
693
0
  {
694
0
    Uninit();
695
0
  }
696
697
  OwningNonNull<mozilla::webgpu::Buffer>&
698
  RawSetAsWebGPUBuffer();
699
700
  OwningNonNull<mozilla::webgpu::Buffer>&
701
  SetAsWebGPUBuffer();
702
703
  bool
704
  TrySetToWebGPUBuffer(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
705
706
  inline bool
707
  IsWebGPUBuffer() const
708
0
  {
709
0
    return mType == eWebGPUBuffer;
710
0
  }
711
712
  inline OwningNonNull<mozilla::webgpu::Buffer>&
713
  GetAsWebGPUBuffer()
714
0
  {
715
0
    MOZ_ASSERT(IsWebGPUBuffer(), "Wrong type!");
716
0
    return mValue.mWebGPUBuffer.Value();
717
0
  }
718
719
  inline OwningNonNull<mozilla::webgpu::Buffer> const &
720
  GetAsWebGPUBuffer() const
721
0
  {
722
0
    MOZ_ASSERT(IsWebGPUBuffer(), "Wrong type!");
723
0
    return mValue.mWebGPUBuffer.Value();
724
0
  }
725
726
  OwningNonNull<mozilla::webgpu::Texture>&
727
  RawSetAsWebGPUTexture();
728
729
  OwningNonNull<mozilla::webgpu::Texture>&
730
  SetAsWebGPUTexture();
731
732
  bool
733
  TrySetToWebGPUTexture(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
734
735
  inline bool
736
  IsWebGPUTexture() const
737
0
  {
738
0
    return mType == eWebGPUTexture;
739
0
  }
740
741
  inline OwningNonNull<mozilla::webgpu::Texture>&
742
  GetAsWebGPUTexture()
743
0
  {
744
0
    MOZ_ASSERT(IsWebGPUTexture(), "Wrong type!");
745
0
    return mValue.mWebGPUTexture.Value();
746
0
  }
747
748
  inline OwningNonNull<mozilla::webgpu::Texture> const &
749
  GetAsWebGPUTexture() const
750
0
  {
751
0
    MOZ_ASSERT(IsWebGPUTexture(), "Wrong type!");
752
0
    return mValue.mWebGPUTexture.Value();
753
0
  }
754
755
  void
756
  Uninit();
757
758
  bool
759
  ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
760
761
  void
762
  TraceUnion(JSTracer* trc);
763
764
  OwningWebGPUBufferOrWebGPUTexture&
765
  operator=(const OwningWebGPUBufferOrWebGPUTexture& aOther);
766
767
private:
768
  void
769
  DestroyWebGPUBuffer();
770
771
  void
772
  DestroyWebGPUTexture();
773
};
774
775
776
struct WebGPUCommandEncoderDescriptor : public DictionaryBase
777
{
778
  WebGPUCommandEncoderDescriptor();
779
780
  explicit inline WebGPUCommandEncoderDescriptor(const FastDictionaryInitializer& )
781
0
  {
782
0
    // Do nothing here; this is used by our "Fast" subclass
783
0
  }
784
785
  explicit inline WebGPUCommandEncoderDescriptor(const WebGPUCommandEncoderDescriptor& aOther)
786
0
  {
787
0
    *this = aOther;
788
0
  }
789
790
  bool
791
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
792
793
  bool
794
  Init(const nsAString& aJSON);
795
796
  bool
797
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
798
799
  bool
800
  ToJSON(nsAString& aJSON) const;
801
802
  void
803
  TraceDictionary(JSTracer* trc);
804
805
  WebGPUCommandEncoderDescriptor&
806
  operator=(const WebGPUCommandEncoderDescriptor& aOther);
807
};
808
809
namespace binding_detail {
810
struct FastWebGPUCommandEncoderDescriptor : public WebGPUCommandEncoderDescriptor
811
{
812
  inline FastWebGPUCommandEncoderDescriptor()
813
    : WebGPUCommandEncoderDescriptor(FastDictionaryInitializer())
814
0
  {
815
0
    // Doesn't matter what int we pass to the parent constructor
816
0
  }
817
};
818
} // namespace binding_detail
819
820
821
class WebGPUComputePipelineOrWebGPURenderPipeline
822
{
823
  friend class WebGPUComputePipelineOrWebGPURenderPipelineArgument;
824
  enum Type
825
  {
826
    eUninitialized,
827
    eWebGPUComputePipeline,
828
    eWebGPURenderPipeline
829
  };
830
831
  union Value
832
  {
833
    UnionMember<NonNull<mozilla::webgpu::ComputePipeline> > mWebGPUComputePipeline;
834
    UnionMember<NonNull<mozilla::webgpu::RenderPipeline> > mWebGPURenderPipeline;
835
836
  };
837
838
  Type mType;
839
  Value mValue;
840
841
  WebGPUComputePipelineOrWebGPURenderPipeline(const WebGPUComputePipelineOrWebGPURenderPipeline&) = delete;
842
  WebGPUComputePipelineOrWebGPURenderPipeline& operator=(const WebGPUComputePipelineOrWebGPURenderPipeline&) = delete;
843
public:
844
  explicit inline WebGPUComputePipelineOrWebGPURenderPipeline()
845
    : mType(eUninitialized)
846
0
  {
847
0
  }
848
849
  inline ~WebGPUComputePipelineOrWebGPURenderPipeline()
850
0
  {
851
0
    Uninit();
852
0
  }
853
854
  inline NonNull<mozilla::webgpu::ComputePipeline>&
855
  RawSetAsWebGPUComputePipeline()
856
0
  {
857
0
    if (mType == eWebGPUComputePipeline) {
858
0
      return mValue.mWebGPUComputePipeline.Value();
859
0
    }
860
0
    MOZ_ASSERT(mType == eUninitialized);
861
0
    mType = eWebGPUComputePipeline;
862
0
    return mValue.mWebGPUComputePipeline.SetValue();
863
0
  }
864
865
  inline NonNull<mozilla::webgpu::ComputePipeline>&
866
  SetAsWebGPUComputePipeline()
867
0
  {
868
0
    if (mType == eWebGPUComputePipeline) {
869
0
      return mValue.mWebGPUComputePipeline.Value();
870
0
    }
871
0
    Uninit();
872
0
    mType = eWebGPUComputePipeline;
873
0
    return mValue.mWebGPUComputePipeline.SetValue();
874
0
  }
875
876
  inline bool
877
  IsWebGPUComputePipeline() const
878
0
  {
879
0
    return mType == eWebGPUComputePipeline;
880
0
  }
881
882
  inline NonNull<mozilla::webgpu::ComputePipeline>&
883
  GetAsWebGPUComputePipeline()
884
0
  {
885
0
    MOZ_ASSERT(IsWebGPUComputePipeline(), "Wrong type!");
886
0
    return mValue.mWebGPUComputePipeline.Value();
887
0
  }
888
889
  inline mozilla::webgpu::ComputePipeline&
890
  GetAsWebGPUComputePipeline() const
891
0
  {
892
0
    MOZ_ASSERT(IsWebGPUComputePipeline(), "Wrong type!");
893
0
    return mValue.mWebGPUComputePipeline.Value();
894
0
  }
895
896
  inline NonNull<mozilla::webgpu::RenderPipeline>&
897
  RawSetAsWebGPURenderPipeline()
898
0
  {
899
0
    if (mType == eWebGPURenderPipeline) {
900
0
      return mValue.mWebGPURenderPipeline.Value();
901
0
    }
902
0
    MOZ_ASSERT(mType == eUninitialized);
903
0
    mType = eWebGPURenderPipeline;
904
0
    return mValue.mWebGPURenderPipeline.SetValue();
905
0
  }
906
907
  inline NonNull<mozilla::webgpu::RenderPipeline>&
908
  SetAsWebGPURenderPipeline()
909
0
  {
910
0
    if (mType == eWebGPURenderPipeline) {
911
0
      return mValue.mWebGPURenderPipeline.Value();
912
0
    }
913
0
    Uninit();
914
0
    mType = eWebGPURenderPipeline;
915
0
    return mValue.mWebGPURenderPipeline.SetValue();
916
0
  }
917
918
  inline bool
919
  IsWebGPURenderPipeline() const
920
0
  {
921
0
    return mType == eWebGPURenderPipeline;
922
0
  }
923
924
  inline NonNull<mozilla::webgpu::RenderPipeline>&
925
  GetAsWebGPURenderPipeline()
926
0
  {
927
0
    MOZ_ASSERT(IsWebGPURenderPipeline(), "Wrong type!");
928
0
    return mValue.mWebGPURenderPipeline.Value();
929
0
  }
930
931
  inline mozilla::webgpu::RenderPipeline&
932
  GetAsWebGPURenderPipeline() const
933
0
  {
934
0
    MOZ_ASSERT(IsWebGPURenderPipeline(), "Wrong type!");
935
0
    return mValue.mWebGPURenderPipeline.Value();
936
0
  }
937
938
  inline void
939
  Uninit()
940
  {
941
    switch (mType) {
942
      case eUninitialized: {
943
        break;
944
      }
945
      case eWebGPUComputePipeline: {
946
        DestroyWebGPUComputePipeline();
947
        break;
948
      }
949
      case eWebGPURenderPipeline: {
950
        DestroyWebGPURenderPipeline();
951
        break;
952
      }
953
    }
954
  }
955
956
  bool
957
  ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
958
959
private:
960
  inline void
961
  DestroyWebGPUComputePipeline()
962
0
  {
963
0
    MOZ_ASSERT(IsWebGPUComputePipeline(), "Wrong type!");
964
0
    mValue.mWebGPUComputePipeline.Destroy();
965
0
    mType = eUninitialized;
966
0
  }
967
968
  inline void
969
  DestroyWebGPURenderPipeline()
970
0
  {
971
0
    MOZ_ASSERT(IsWebGPURenderPipeline(), "Wrong type!");
972
0
    mValue.mWebGPURenderPipeline.Destroy();
973
0
    mType = eUninitialized;
974
0
  }
975
};
976
977
978
class OwningWebGPUComputePipelineOrWebGPURenderPipeline : public AllOwningUnionBase
979
{
980
  friend void ImplCycleCollectionUnlink(OwningWebGPUComputePipelineOrWebGPURenderPipeline& aUnion);
981
  enum Type
982
  {
983
    eUninitialized,
984
    eWebGPUComputePipeline,
985
    eWebGPURenderPipeline
986
  };
987
988
  union Value
989
  {
990
    UnionMember<OwningNonNull<mozilla::webgpu::ComputePipeline> > mWebGPUComputePipeline;
991
    UnionMember<OwningNonNull<mozilla::webgpu::RenderPipeline> > mWebGPURenderPipeline;
992
993
  };
994
995
  Type mType;
996
  Value mValue;
997
998
public:
999
  explicit inline OwningWebGPUComputePipelineOrWebGPURenderPipeline()
1000
    : mType(eUninitialized)
1001
0
  {
1002
0
  }
1003
1004
  explicit inline OwningWebGPUComputePipelineOrWebGPURenderPipeline(const OwningWebGPUComputePipelineOrWebGPURenderPipeline& aOther)
1005
    : mType(eUninitialized)
1006
0
  {
1007
0
    *this = aOther;
1008
0
  }
1009
1010
  inline ~OwningWebGPUComputePipelineOrWebGPURenderPipeline()
1011
0
  {
1012
0
    Uninit();
1013
0
  }
1014
1015
  OwningNonNull<mozilla::webgpu::ComputePipeline>&
1016
  RawSetAsWebGPUComputePipeline();
1017
1018
  OwningNonNull<mozilla::webgpu::ComputePipeline>&
1019
  SetAsWebGPUComputePipeline();
1020
1021
  bool
1022
  TrySetToWebGPUComputePipeline(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
1023
1024
  inline bool
1025
  IsWebGPUComputePipeline() const
1026
0
  {
1027
0
    return mType == eWebGPUComputePipeline;
1028
0
  }
1029
1030
  inline OwningNonNull<mozilla::webgpu::ComputePipeline>&
1031
  GetAsWebGPUComputePipeline()
1032
0
  {
1033
0
    MOZ_ASSERT(IsWebGPUComputePipeline(), "Wrong type!");
1034
0
    return mValue.mWebGPUComputePipeline.Value();
1035
0
  }
1036
1037
  inline OwningNonNull<mozilla::webgpu::ComputePipeline> const &
1038
  GetAsWebGPUComputePipeline() const
1039
0
  {
1040
0
    MOZ_ASSERT(IsWebGPUComputePipeline(), "Wrong type!");
1041
0
    return mValue.mWebGPUComputePipeline.Value();
1042
0
  }
1043
1044
  OwningNonNull<mozilla::webgpu::RenderPipeline>&
1045
  RawSetAsWebGPURenderPipeline();
1046
1047
  OwningNonNull<mozilla::webgpu::RenderPipeline>&
1048
  SetAsWebGPURenderPipeline();
1049
1050
  bool
1051
  TrySetToWebGPURenderPipeline(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
1052
1053
  inline bool
1054
  IsWebGPURenderPipeline() const
1055
0
  {
1056
0
    return mType == eWebGPURenderPipeline;
1057
0
  }
1058
1059
  inline OwningNonNull<mozilla::webgpu::RenderPipeline>&
1060
  GetAsWebGPURenderPipeline()
1061
0
  {
1062
0
    MOZ_ASSERT(IsWebGPURenderPipeline(), "Wrong type!");
1063
0
    return mValue.mWebGPURenderPipeline.Value();
1064
0
  }
1065
1066
  inline OwningNonNull<mozilla::webgpu::RenderPipeline> const &
1067
  GetAsWebGPURenderPipeline() const
1068
0
  {
1069
0
    MOZ_ASSERT(IsWebGPURenderPipeline(), "Wrong type!");
1070
0
    return mValue.mWebGPURenderPipeline.Value();
1071
0
  }
1072
1073
  void
1074
  Uninit();
1075
1076
  bool
1077
  ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
1078
1079
  void
1080
  TraceUnion(JSTracer* trc);
1081
1082
  OwningWebGPUComputePipelineOrWebGPURenderPipeline&
1083
  operator=(const OwningWebGPUComputePipelineOrWebGPURenderPipeline& aOther);
1084
1085
private:
1086
  void
1087
  DestroyWebGPUComputePipeline();
1088
1089
  void
1090
  DestroyWebGPURenderPipeline();
1091
};
1092
1093
1094
struct WebGPUExtensions : public DictionaryBase
1095
{
1096
  MOZ_INIT_OUTSIDE_CTOR Optional<bool> mAnisotropicFiltering;
1097
  MOZ_INIT_OUTSIDE_CTOR Optional<bool> mLogicOp;
1098
1099
  WebGPUExtensions();
1100
1101
  explicit inline WebGPUExtensions(const FastDictionaryInitializer& )
1102
0
  {
1103
0
    // Do nothing here; this is used by our "Fast" subclass
1104
0
  }
1105
1106
  explicit inline WebGPUExtensions(const WebGPUExtensions& aOther)
1107
0
  {
1108
0
    *this = aOther;
1109
0
  }
1110
1111
  bool
1112
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
1113
1114
  bool
1115
  Init(const nsAString& aJSON);
1116
1117
  bool
1118
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
1119
1120
  bool
1121
  ToJSON(nsAString& aJSON) const;
1122
1123
  void
1124
  TraceDictionary(JSTracer* trc);
1125
1126
  WebGPUExtensions&
1127
  operator=(const WebGPUExtensions& aOther);
1128
1129
private:
1130
  static bool
1131
  InitIds(JSContext* cx, WebGPUExtensionsAtoms* atomsCache);
1132
};
1133
1134
namespace binding_detail {
1135
struct FastWebGPUExtensions : public WebGPUExtensions
1136
{
1137
  inline FastWebGPUExtensions()
1138
    : WebGPUExtensions(FastDictionaryInitializer())
1139
0
  {
1140
0
    // Doesn't matter what int we pass to the parent constructor
1141
0
  }
1142
};
1143
} // namespace binding_detail
1144
1145
1146
struct WebGPULimits : public DictionaryBase
1147
{
1148
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mMaxBindGroups;
1149
1150
  WebGPULimits();
1151
1152
  explicit inline WebGPULimits(const FastDictionaryInitializer& )
1153
0
  {
1154
0
    // Do nothing here; this is used by our "Fast" subclass
1155
0
  }
1156
1157
  explicit inline WebGPULimits(const WebGPULimits& aOther)
1158
0
  {
1159
0
    *this = aOther;
1160
0
  }
1161
1162
  bool
1163
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
1164
1165
  bool
1166
  Init(const nsAString& aJSON);
1167
1168
  bool
1169
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
1170
1171
  bool
1172
  ToJSON(nsAString& aJSON) const;
1173
1174
  void
1175
  TraceDictionary(JSTracer* trc);
1176
1177
  WebGPULimits&
1178
  operator=(const WebGPULimits& aOther);
1179
1180
private:
1181
  static bool
1182
  InitIds(JSContext* cx, WebGPULimitsAtoms* atomsCache);
1183
};
1184
1185
namespace binding_detail {
1186
struct FastWebGPULimits : public WebGPULimits
1187
{
1188
  inline FastWebGPULimits()
1189
    : WebGPULimits(FastDictionaryInitializer())
1190
0
  {
1191
0
    // Doesn't matter what int we pass to the parent constructor
1192
0
  }
1193
};
1194
} // namespace binding_detail
1195
1196
1197
struct WebGPUPipelineLayoutDescriptor : public DictionaryBase
1198
{
1199
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<OwningNonNull<mozilla::webgpu::BindGroupLayout>>> mBindGroupLayouts;
1200
1201
  WebGPUPipelineLayoutDescriptor();
1202
1203
  explicit inline WebGPUPipelineLayoutDescriptor(const FastDictionaryInitializer& )
1204
0
  {
1205
0
    // Do nothing here; this is used by our "Fast" subclass
1206
0
  }
1207
1208
  explicit inline WebGPUPipelineLayoutDescriptor(const WebGPUPipelineLayoutDescriptor& aOther)
1209
0
  {
1210
0
    *this = aOther;
1211
0
  }
1212
1213
  bool
1214
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
1215
1216
  bool
1217
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
1218
1219
  void
1220
  TraceDictionary(JSTracer* trc);
1221
1222
  inline void
1223
  TraverseForCC(nsCycleCollectionTraversalCallback& aCallback, uint32_t aFlags)
1224
0
  {
1225
0
    ImplCycleCollectionTraverse(aCallback, mBindGroupLayouts, "mBindGroupLayouts", aFlags);
1226
0
  }
1227
1228
  inline void
1229
  UnlinkForCC()
1230
0
  {
1231
0
    ImplCycleCollectionUnlink(mBindGroupLayouts);
1232
0
  }
1233
1234
  WebGPUPipelineLayoutDescriptor&
1235
  operator=(const WebGPUPipelineLayoutDescriptor& aOther);
1236
1237
private:
1238
  static bool
1239
  InitIds(JSContext* cx, WebGPUPipelineLayoutDescriptorAtoms* atomsCache);
1240
};
1241
1242
namespace binding_detail {
1243
struct FastWebGPUPipelineLayoutDescriptor : public WebGPUPipelineLayoutDescriptor
1244
{
1245
  inline FastWebGPUPipelineLayoutDescriptor()
1246
    : WebGPUPipelineLayoutDescriptor(FastDictionaryInitializer())
1247
0
  {
1248
0
    // Doesn't matter what int we pass to the parent constructor
1249
0
  }
1250
};
1251
} // namespace binding_detail
1252
1253
1254
struct WebGPUPipelineStageDescriptor : public DictionaryBase
1255
{
1256
  MOZ_INIT_OUTSIDE_CTOR nsString mEntryPoint;
1257
  MOZ_INIT_OUTSIDE_CTOR OwningNonNull<mozilla::webgpu::ShaderModule> mShaderModule;
1258
  MOZ_INIT_OUTSIDE_CTOR uint32_t mStage;
1259
1260
  WebGPUPipelineStageDescriptor();
1261
1262
  explicit inline WebGPUPipelineStageDescriptor(const FastDictionaryInitializer& )
1263
0
  {
1264
0
    // Do nothing here; this is used by our "Fast" subclass
1265
0
  }
1266
1267
  explicit inline WebGPUPipelineStageDescriptor(const WebGPUPipelineStageDescriptor& aOther)
1268
0
  {
1269
0
    *this = aOther;
1270
0
  }
1271
1272
  bool
1273
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
1274
1275
  bool
1276
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
1277
1278
  void
1279
  TraceDictionary(JSTracer* trc);
1280
1281
  inline void
1282
  TraverseForCC(nsCycleCollectionTraversalCallback& aCallback, uint32_t aFlags)
1283
0
  {
1284
0
    ImplCycleCollectionTraverse(aCallback, mShaderModule, "mShaderModule", aFlags);
1285
0
  }
1286
1287
  inline void
1288
  UnlinkForCC()
1289
0
  {
1290
0
    ImplCycleCollectionUnlink(mShaderModule);
1291
0
  }
1292
1293
  WebGPUPipelineStageDescriptor&
1294
  operator=(const WebGPUPipelineStageDescriptor& aOther);
1295
1296
private:
1297
  static bool
1298
  InitIds(JSContext* cx, WebGPUPipelineStageDescriptorAtoms* atomsCache);
1299
};
1300
1301
namespace binding_detail {
1302
struct FastWebGPUPipelineStageDescriptor : public WebGPUPipelineStageDescriptor
1303
{
1304
  inline FastWebGPUPipelineStageDescriptor()
1305
    : WebGPUPipelineStageDescriptor(FastDictionaryInitializer())
1306
0
  {
1307
0
    // Doesn't matter what int we pass to the parent constructor
1308
0
  }
1309
};
1310
} // namespace binding_detail
1311
1312
1313
struct WebGPURenderPassAttachmentDescriptor : public DictionaryBase
1314
{
1315
  MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<mozilla::webgpu::TextureView>> mAttachment;
1316
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mLoadOp;
1317
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mStoreOp;
1318
1319
  WebGPURenderPassAttachmentDescriptor();
1320
1321
  explicit inline WebGPURenderPassAttachmentDescriptor(const FastDictionaryInitializer& )
1322
0
  {
1323
0
    // Do nothing here; this is used by our "Fast" subclass
1324
0
  }
1325
1326
  explicit inline WebGPURenderPassAttachmentDescriptor(const WebGPURenderPassAttachmentDescriptor& aOther)
1327
0
  {
1328
0
    *this = aOther;
1329
0
  }
1330
1331
  bool
1332
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
1333
1334
  bool
1335
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
1336
1337
  void
1338
  TraceDictionary(JSTracer* trc);
1339
1340
  inline void
1341
  TraverseForCC(nsCycleCollectionTraversalCallback& aCallback, uint32_t aFlags)
1342
0
  {
1343
0
    ImplCycleCollectionTraverse(aCallback, mAttachment, "mAttachment", aFlags);
1344
0
  }
1345
1346
  inline void
1347
  UnlinkForCC()
1348
0
  {
1349
0
    ImplCycleCollectionUnlink(mAttachment);
1350
0
  }
1351
1352
  WebGPURenderPassAttachmentDescriptor&
1353
  operator=(const WebGPURenderPassAttachmentDescriptor& aOther);
1354
1355
private:
1356
  static bool
1357
  InitIds(JSContext* cx, WebGPURenderPassAttachmentDescriptorAtoms* atomsCache);
1358
};
1359
1360
namespace binding_detail {
1361
struct FastWebGPURenderPassAttachmentDescriptor : public WebGPURenderPassAttachmentDescriptor
1362
{
1363
  inline FastWebGPURenderPassAttachmentDescriptor()
1364
    : WebGPURenderPassAttachmentDescriptor(FastDictionaryInitializer())
1365
0
  {
1366
0
    // Doesn't matter what int we pass to the parent constructor
1367
0
  }
1368
};
1369
} // namespace binding_detail
1370
1371
1372
struct WebGPUSamplerDescriptor : public DictionaryBase
1373
{
1374
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mMagFilter;
1375
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mMinFilter;
1376
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mMipmapFilter;
1377
1378
  WebGPUSamplerDescriptor();
1379
1380
  explicit inline WebGPUSamplerDescriptor(const FastDictionaryInitializer& )
1381
0
  {
1382
0
    // Do nothing here; this is used by our "Fast" subclass
1383
0
  }
1384
1385
  explicit inline WebGPUSamplerDescriptor(const WebGPUSamplerDescriptor& aOther)
1386
0
  {
1387
0
    *this = aOther;
1388
0
  }
1389
1390
  bool
1391
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
1392
1393
  bool
1394
  Init(const nsAString& aJSON);
1395
1396
  bool
1397
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
1398
1399
  bool
1400
  ToJSON(nsAString& aJSON) const;
1401
1402
  void
1403
  TraceDictionary(JSTracer* trc);
1404
1405
  WebGPUSamplerDescriptor&
1406
  operator=(const WebGPUSamplerDescriptor& aOther);
1407
1408
private:
1409
  static bool
1410
  InitIds(JSContext* cx, WebGPUSamplerDescriptorAtoms* atomsCache);
1411
};
1412
1413
namespace binding_detail {
1414
struct FastWebGPUSamplerDescriptor : public WebGPUSamplerDescriptor
1415
{
1416
  inline FastWebGPUSamplerDescriptor()
1417
    : WebGPUSamplerDescriptor(FastDictionaryInitializer())
1418
0
  {
1419
0
    // Doesn't matter what int we pass to the parent constructor
1420
0
  }
1421
};
1422
} // namespace binding_detail
1423
1424
1425
class WebGPUSamplerOrWebGPUTextureViewOrWebGPUBufferBinding
1426
{
1427
  friend class WebGPUSamplerOrWebGPUTextureViewOrWebGPUBufferBindingArgument;
1428
  enum Type
1429
  {
1430
    eUninitialized,
1431
    eWebGPUSampler,
1432
    eWebGPUTextureView,
1433
    eWebGPUBufferBinding
1434
  };
1435
1436
  union Value
1437
  {
1438
    UnionMember<NonNull<mozilla::webgpu::Sampler> > mWebGPUSampler;
1439
    UnionMember<NonNull<mozilla::webgpu::TextureView> > mWebGPUTextureView;
1440
    UnionMember<binding_detail::FastWebGPUBufferBinding > mWebGPUBufferBinding;
1441
1442
  };
1443
1444
  Type mType;
1445
  Value mValue;
1446
1447
  WebGPUSamplerOrWebGPUTextureViewOrWebGPUBufferBinding(const WebGPUSamplerOrWebGPUTextureViewOrWebGPUBufferBinding&) = delete;
1448
  WebGPUSamplerOrWebGPUTextureViewOrWebGPUBufferBinding& operator=(const WebGPUSamplerOrWebGPUTextureViewOrWebGPUBufferBinding&) = delete;
1449
public:
1450
  explicit inline WebGPUSamplerOrWebGPUTextureViewOrWebGPUBufferBinding()
1451
    : mType(eUninitialized)
1452
0
  {
1453
0
  }
1454
1455
  inline ~WebGPUSamplerOrWebGPUTextureViewOrWebGPUBufferBinding()
1456
0
  {
1457
0
    Uninit();
1458
0
  }
1459
1460
  inline NonNull<mozilla::webgpu::Sampler>&
1461
  RawSetAsWebGPUSampler()
1462
0
  {
1463
0
    if (mType == eWebGPUSampler) {
1464
0
      return mValue.mWebGPUSampler.Value();
1465
0
    }
1466
0
    MOZ_ASSERT(mType == eUninitialized);
1467
0
    mType = eWebGPUSampler;
1468
0
    return mValue.mWebGPUSampler.SetValue();
1469
0
  }
1470
1471
  inline NonNull<mozilla::webgpu::Sampler>&
1472
  SetAsWebGPUSampler()
1473
0
  {
1474
0
    if (mType == eWebGPUSampler) {
1475
0
      return mValue.mWebGPUSampler.Value();
1476
0
    }
1477
0
    Uninit();
1478
0
    mType = eWebGPUSampler;
1479
0
    return mValue.mWebGPUSampler.SetValue();
1480
0
  }
1481
1482
  inline bool
1483
  IsWebGPUSampler() const
1484
0
  {
1485
0
    return mType == eWebGPUSampler;
1486
0
  }
1487
1488
  inline NonNull<mozilla::webgpu::Sampler>&
1489
  GetAsWebGPUSampler()
1490
0
  {
1491
0
    MOZ_ASSERT(IsWebGPUSampler(), "Wrong type!");
1492
0
    return mValue.mWebGPUSampler.Value();
1493
0
  }
1494
1495
  inline mozilla::webgpu::Sampler&
1496
  GetAsWebGPUSampler() const
1497
0
  {
1498
0
    MOZ_ASSERT(IsWebGPUSampler(), "Wrong type!");
1499
0
    return mValue.mWebGPUSampler.Value();
1500
0
  }
1501
1502
  inline NonNull<mozilla::webgpu::TextureView>&
1503
  RawSetAsWebGPUTextureView()
1504
0
  {
1505
0
    if (mType == eWebGPUTextureView) {
1506
0
      return mValue.mWebGPUTextureView.Value();
1507
0
    }
1508
0
    MOZ_ASSERT(mType == eUninitialized);
1509
0
    mType = eWebGPUTextureView;
1510
0
    return mValue.mWebGPUTextureView.SetValue();
1511
0
  }
1512
1513
  inline NonNull<mozilla::webgpu::TextureView>&
1514
  SetAsWebGPUTextureView()
1515
0
  {
1516
0
    if (mType == eWebGPUTextureView) {
1517
0
      return mValue.mWebGPUTextureView.Value();
1518
0
    }
1519
0
    Uninit();
1520
0
    mType = eWebGPUTextureView;
1521
0
    return mValue.mWebGPUTextureView.SetValue();
1522
0
  }
1523
1524
  inline bool
1525
  IsWebGPUTextureView() const
1526
0
  {
1527
0
    return mType == eWebGPUTextureView;
1528
0
  }
1529
1530
  inline NonNull<mozilla::webgpu::TextureView>&
1531
  GetAsWebGPUTextureView()
1532
0
  {
1533
0
    MOZ_ASSERT(IsWebGPUTextureView(), "Wrong type!");
1534
0
    return mValue.mWebGPUTextureView.Value();
1535
0
  }
1536
1537
  inline mozilla::webgpu::TextureView&
1538
  GetAsWebGPUTextureView() const
1539
0
  {
1540
0
    MOZ_ASSERT(IsWebGPUTextureView(), "Wrong type!");
1541
0
    return mValue.mWebGPUTextureView.Value();
1542
0
  }
1543
1544
  inline binding_detail::FastWebGPUBufferBinding&
1545
  RawSetAsWebGPUBufferBinding()
1546
0
  {
1547
0
    if (mType == eWebGPUBufferBinding) {
1548
0
      return mValue.mWebGPUBufferBinding.Value();
1549
0
    }
1550
0
    MOZ_ASSERT(mType == eUninitialized);
1551
0
    mType = eWebGPUBufferBinding;
1552
0
    return mValue.mWebGPUBufferBinding.SetValue();
1553
0
  }
1554
1555
  inline binding_detail::FastWebGPUBufferBinding&
1556
  SetAsWebGPUBufferBinding()
1557
0
  {
1558
0
    if (mType == eWebGPUBufferBinding) {
1559
0
      return mValue.mWebGPUBufferBinding.Value();
1560
0
    }
1561
0
    Uninit();
1562
0
    mType = eWebGPUBufferBinding;
1563
0
    return mValue.mWebGPUBufferBinding.SetValue();
1564
0
  }
1565
1566
  inline bool
1567
  IsWebGPUBufferBinding() const
1568
0
  {
1569
0
    return mType == eWebGPUBufferBinding;
1570
0
  }
1571
1572
  inline binding_detail::FastWebGPUBufferBinding&
1573
  GetAsWebGPUBufferBinding()
1574
0
  {
1575
0
    MOZ_ASSERT(IsWebGPUBufferBinding(), "Wrong type!");
1576
0
    return mValue.mWebGPUBufferBinding.Value();
1577
0
  }
1578
1579
  inline const WebGPUBufferBinding&
1580
  GetAsWebGPUBufferBinding() const
1581
0
  {
1582
0
    MOZ_ASSERT(IsWebGPUBufferBinding(), "Wrong type!");
1583
0
    return mValue.mWebGPUBufferBinding.Value();
1584
0
  }
1585
1586
  inline void
1587
  Uninit()
1588
0
  {
1589
0
    switch (mType) {
1590
0
      case eUninitialized: {
1591
0
        break;
1592
0
      }
1593
0
      case eWebGPUSampler: {
1594
0
        DestroyWebGPUSampler();
1595
0
        break;
1596
0
      }
1597
0
      case eWebGPUTextureView: {
1598
0
        DestroyWebGPUTextureView();
1599
0
        break;
1600
0
      }
1601
0
      case eWebGPUBufferBinding: {
1602
0
        DestroyWebGPUBufferBinding();
1603
0
        break;
1604
0
      }
1605
0
    }
1606
0
  }
1607
1608
  bool
1609
  ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
1610
1611
private:
1612
  inline void
1613
  DestroyWebGPUSampler()
1614
0
  {
1615
0
    MOZ_ASSERT(IsWebGPUSampler(), "Wrong type!");
1616
0
    mValue.mWebGPUSampler.Destroy();
1617
0
    mType = eUninitialized;
1618
0
  }
1619
1620
  inline void
1621
  DestroyWebGPUTextureView()
1622
0
  {
1623
0
    MOZ_ASSERT(IsWebGPUTextureView(), "Wrong type!");
1624
0
    mValue.mWebGPUTextureView.Destroy();
1625
0
    mType = eUninitialized;
1626
0
  }
1627
1628
  inline void
1629
  DestroyWebGPUBufferBinding()
1630
0
  {
1631
0
    MOZ_ASSERT(IsWebGPUBufferBinding(), "Wrong type!");
1632
0
    mValue.mWebGPUBufferBinding.Destroy();
1633
0
    mType = eUninitialized;
1634
0
  }
1635
};
1636
1637
1638
class OwningWebGPUSamplerOrWebGPUTextureViewOrWebGPUBufferBinding : public AllOwningUnionBase
1639
{
1640
  friend void ImplCycleCollectionUnlink(OwningWebGPUSamplerOrWebGPUTextureViewOrWebGPUBufferBinding& aUnion);
1641
  enum Type
1642
  {
1643
    eUninitialized,
1644
    eWebGPUSampler,
1645
    eWebGPUTextureView,
1646
    eWebGPUBufferBinding
1647
  };
1648
1649
  union Value
1650
  {
1651
    UnionMember<OwningNonNull<mozilla::webgpu::Sampler> > mWebGPUSampler;
1652
    UnionMember<OwningNonNull<mozilla::webgpu::TextureView> > mWebGPUTextureView;
1653
    UnionMember<WebGPUBufferBinding > mWebGPUBufferBinding;
1654
1655
  };
1656
1657
  Type mType;
1658
  Value mValue;
1659
1660
public:
1661
  explicit inline OwningWebGPUSamplerOrWebGPUTextureViewOrWebGPUBufferBinding()
1662
    : mType(eUninitialized)
1663
0
  {
1664
0
  }
1665
1666
  explicit inline OwningWebGPUSamplerOrWebGPUTextureViewOrWebGPUBufferBinding(const OwningWebGPUSamplerOrWebGPUTextureViewOrWebGPUBufferBinding& aOther)
1667
    : mType(eUninitialized)
1668
0
  {
1669
0
    *this = aOther;
1670
0
  }
1671
1672
  inline ~OwningWebGPUSamplerOrWebGPUTextureViewOrWebGPUBufferBinding()
1673
0
  {
1674
0
    Uninit();
1675
0
  }
1676
1677
  OwningNonNull<mozilla::webgpu::Sampler>&
1678
  RawSetAsWebGPUSampler();
1679
1680
  OwningNonNull<mozilla::webgpu::Sampler>&
1681
  SetAsWebGPUSampler();
1682
1683
  bool
1684
  TrySetToWebGPUSampler(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
1685
1686
  inline bool
1687
  IsWebGPUSampler() const
1688
0
  {
1689
0
    return mType == eWebGPUSampler;
1690
0
  }
1691
1692
  inline OwningNonNull<mozilla::webgpu::Sampler>&
1693
  GetAsWebGPUSampler()
1694
0
  {
1695
0
    MOZ_ASSERT(IsWebGPUSampler(), "Wrong type!");
1696
0
    return mValue.mWebGPUSampler.Value();
1697
0
  }
1698
1699
  inline OwningNonNull<mozilla::webgpu::Sampler> const &
1700
  GetAsWebGPUSampler() const
1701
0
  {
1702
0
    MOZ_ASSERT(IsWebGPUSampler(), "Wrong type!");
1703
0
    return mValue.mWebGPUSampler.Value();
1704
0
  }
1705
1706
  OwningNonNull<mozilla::webgpu::TextureView>&
1707
  RawSetAsWebGPUTextureView();
1708
1709
  OwningNonNull<mozilla::webgpu::TextureView>&
1710
  SetAsWebGPUTextureView();
1711
1712
  bool
1713
  TrySetToWebGPUTextureView(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
1714
1715
  inline bool
1716
  IsWebGPUTextureView() const
1717
0
  {
1718
0
    return mType == eWebGPUTextureView;
1719
0
  }
1720
1721
  inline OwningNonNull<mozilla::webgpu::TextureView>&
1722
  GetAsWebGPUTextureView()
1723
0
  {
1724
0
    MOZ_ASSERT(IsWebGPUTextureView(), "Wrong type!");
1725
0
    return mValue.mWebGPUTextureView.Value();
1726
0
  }
1727
1728
  inline OwningNonNull<mozilla::webgpu::TextureView> const &
1729
  GetAsWebGPUTextureView() const
1730
0
  {
1731
0
    MOZ_ASSERT(IsWebGPUTextureView(), "Wrong type!");
1732
0
    return mValue.mWebGPUTextureView.Value();
1733
0
  }
1734
1735
  WebGPUBufferBinding&
1736
  RawSetAsWebGPUBufferBinding();
1737
1738
  WebGPUBufferBinding&
1739
  SetAsWebGPUBufferBinding();
1740
1741
  bool
1742
  TrySetToWebGPUBufferBinding(JSContext* cx, JS::Handle<JS::Value> value, bool& tryNext, bool passedToJSImpl = false);
1743
1744
  inline bool
1745
  IsWebGPUBufferBinding() const
1746
0
  {
1747
0
    return mType == eWebGPUBufferBinding;
1748
0
  }
1749
1750
  inline WebGPUBufferBinding&
1751
  GetAsWebGPUBufferBinding()
1752
0
  {
1753
0
    MOZ_ASSERT(IsWebGPUBufferBinding(), "Wrong type!");
1754
0
    return mValue.mWebGPUBufferBinding.Value();
1755
0
  }
1756
1757
  inline WebGPUBufferBinding const &
1758
  GetAsWebGPUBufferBinding() const
1759
0
  {
1760
0
    MOZ_ASSERT(IsWebGPUBufferBinding(), "Wrong type!");
1761
0
    return mValue.mWebGPUBufferBinding.Value();
1762
0
  }
1763
1764
  void
1765
  Uninit();
1766
1767
  bool
1768
  ToJSVal(JSContext* cx, JS::Handle<JSObject*> scopeObj, JS::MutableHandle<JS::Value> rval) const;
1769
1770
  void
1771
  TraceUnion(JSTracer* trc);
1772
1773
  OwningWebGPUSamplerOrWebGPUTextureViewOrWebGPUBufferBinding&
1774
  operator=(const OwningWebGPUSamplerOrWebGPUTextureViewOrWebGPUBufferBinding& aOther);
1775
1776
private:
1777
  void
1778
  DestroyWebGPUSampler();
1779
1780
  void
1781
  DestroyWebGPUTextureView();
1782
1783
  void
1784
  DestroyWebGPUBufferBinding();
1785
};
1786
1787
1788
struct WebGPUShaderModuleDescriptor : public DictionaryBase
1789
{
1790
  MOZ_INIT_OUTSIDE_CTOR ArrayBuffer mCode;
1791
1792
  WebGPUShaderModuleDescriptor();
1793
1794
  explicit inline WebGPUShaderModuleDescriptor(const FastDictionaryInitializer& )
1795
0
  {
1796
0
    // Do nothing here; this is used by our "Fast" subclass
1797
0
  }
1798
1799
private:
1800
  WebGPUShaderModuleDescriptor(const WebGPUShaderModuleDescriptor&) = delete;
1801
  WebGPUShaderModuleDescriptor& operator=(const WebGPUShaderModuleDescriptor&) = delete;
1802
1803
  static bool
1804
  InitIds(JSContext* cx, WebGPUShaderModuleDescriptorAtoms* atomsCache);
1805
1806
public:
1807
  bool
1808
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
1809
1810
  bool
1811
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
1812
1813
  void
1814
  TraceDictionary(JSTracer* trc);
1815
};
1816
1817
namespace binding_detail {
1818
struct FastWebGPUShaderModuleDescriptor : public WebGPUShaderModuleDescriptor
1819
{
1820
  inline FastWebGPUShaderModuleDescriptor()
1821
    : WebGPUShaderModuleDescriptor(FastDictionaryInitializer())
1822
0
  {
1823
0
    // Doesn't matter what int we pass to the parent constructor
1824
0
  }
1825
};
1826
} // namespace binding_detail
1827
1828
1829
struct WebGPUStencilStateFaceDescriptor : public DictionaryBase
1830
{
1831
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mCompare;
1832
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mDepthFailOp;
1833
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mPassOp;
1834
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mStencilFailOp;
1835
1836
  WebGPUStencilStateFaceDescriptor();
1837
1838
  explicit inline WebGPUStencilStateFaceDescriptor(const FastDictionaryInitializer& )
1839
0
  {
1840
0
    // Do nothing here; this is used by our "Fast" subclass
1841
0
  }
1842
1843
  explicit inline WebGPUStencilStateFaceDescriptor(const WebGPUStencilStateFaceDescriptor& aOther)
1844
0
  {
1845
0
    *this = aOther;
1846
0
  }
1847
1848
  bool
1849
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
1850
1851
  bool
1852
  Init(const nsAString& aJSON);
1853
1854
  bool
1855
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
1856
1857
  bool
1858
  ToJSON(nsAString& aJSON) const;
1859
1860
  void
1861
  TraceDictionary(JSTracer* trc);
1862
1863
  WebGPUStencilStateFaceDescriptor&
1864
  operator=(const WebGPUStencilStateFaceDescriptor& aOther);
1865
1866
private:
1867
  static bool
1868
  InitIds(JSContext* cx, WebGPUStencilStateFaceDescriptorAtoms* atomsCache);
1869
};
1870
1871
namespace binding_detail {
1872
struct FastWebGPUStencilStateFaceDescriptor : public WebGPUStencilStateFaceDescriptor
1873
{
1874
  inline FastWebGPUStencilStateFaceDescriptor()
1875
    : WebGPUStencilStateFaceDescriptor(FastDictionaryInitializer())
1876
0
  {
1877
0
    // Doesn't matter what int we pass to the parent constructor
1878
0
  }
1879
};
1880
} // namespace binding_detail
1881
1882
1883
struct WebGPUSwapChainDescriptor : public DictionaryBase
1884
{
1885
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mFormat;
1886
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mHeight;
1887
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mUsage;
1888
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mWidth;
1889
1890
  WebGPUSwapChainDescriptor();
1891
1892
  explicit inline WebGPUSwapChainDescriptor(const FastDictionaryInitializer& )
1893
0
  {
1894
0
    // Do nothing here; this is used by our "Fast" subclass
1895
0
  }
1896
1897
  explicit inline WebGPUSwapChainDescriptor(const WebGPUSwapChainDescriptor& aOther)
1898
0
  {
1899
0
    *this = aOther;
1900
0
  }
1901
1902
  bool
1903
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
1904
1905
  bool
1906
  Init(const nsAString& aJSON);
1907
1908
  bool
1909
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
1910
1911
  bool
1912
  ToJSON(nsAString& aJSON) const;
1913
1914
  void
1915
  TraceDictionary(JSTracer* trc);
1916
1917
  WebGPUSwapChainDescriptor&
1918
  operator=(const WebGPUSwapChainDescriptor& aOther);
1919
1920
private:
1921
  static bool
1922
  InitIds(JSContext* cx, WebGPUSwapChainDescriptorAtoms* atomsCache);
1923
};
1924
1925
namespace binding_detail {
1926
struct FastWebGPUSwapChainDescriptor : public WebGPUSwapChainDescriptor
1927
{
1928
  inline FastWebGPUSwapChainDescriptor()
1929
    : WebGPUSwapChainDescriptor(FastDictionaryInitializer())
1930
0
  {
1931
0
    // Doesn't matter what int we pass to the parent constructor
1932
0
  }
1933
};
1934
} // namespace binding_detail
1935
1936
1937
struct WebGPUTextureDescriptor : public DictionaryBase
1938
{
1939
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mArraySize;
1940
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mDepth;
1941
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mDimension;
1942
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mFormat;
1943
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mHeight;
1944
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mUsage;
1945
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mWidth;
1946
1947
  WebGPUTextureDescriptor();
1948
1949
  explicit inline WebGPUTextureDescriptor(const FastDictionaryInitializer& )
1950
0
  {
1951
0
    // Do nothing here; this is used by our "Fast" subclass
1952
0
  }
1953
1954
  explicit inline WebGPUTextureDescriptor(const WebGPUTextureDescriptor& aOther)
1955
0
  {
1956
0
    *this = aOther;
1957
0
  }
1958
1959
  bool
1960
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
1961
1962
  bool
1963
  Init(const nsAString& aJSON);
1964
1965
  bool
1966
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
1967
1968
  bool
1969
  ToJSON(nsAString& aJSON) const;
1970
1971
  void
1972
  TraceDictionary(JSTracer* trc);
1973
1974
  WebGPUTextureDescriptor&
1975
  operator=(const WebGPUTextureDescriptor& aOther);
1976
1977
private:
1978
  static bool
1979
  InitIds(JSContext* cx, WebGPUTextureDescriptorAtoms* atomsCache);
1980
};
1981
1982
namespace binding_detail {
1983
struct FastWebGPUTextureDescriptor : public WebGPUTextureDescriptor
1984
{
1985
  inline FastWebGPUTextureDescriptor()
1986
    : WebGPUTextureDescriptor(FastDictionaryInitializer())
1987
0
  {
1988
0
    // Doesn't matter what int we pass to the parent constructor
1989
0
  }
1990
};
1991
} // namespace binding_detail
1992
1993
1994
struct WebGPUTextureViewDescriptor : public DictionaryBase
1995
{
1996
  WebGPUTextureViewDescriptor();
1997
1998
  explicit inline WebGPUTextureViewDescriptor(const FastDictionaryInitializer& )
1999
0
  {
2000
0
    // Do nothing here; this is used by our "Fast" subclass
2001
0
  }
2002
2003
  explicit inline WebGPUTextureViewDescriptor(const WebGPUTextureViewDescriptor& aOther)
2004
0
  {
2005
0
    *this = aOther;
2006
0
  }
2007
2008
  bool
2009
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
2010
2011
  bool
2012
  Init(const nsAString& aJSON);
2013
2014
  bool
2015
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
2016
2017
  bool
2018
  ToJSON(nsAString& aJSON) const;
2019
2020
  void
2021
  TraceDictionary(JSTracer* trc);
2022
2023
  WebGPUTextureViewDescriptor&
2024
  operator=(const WebGPUTextureViewDescriptor& aOther);
2025
};
2026
2027
namespace binding_detail {
2028
struct FastWebGPUTextureViewDescriptor : public WebGPUTextureViewDescriptor
2029
{
2030
  inline FastWebGPUTextureViewDescriptor()
2031
    : WebGPUTextureViewDescriptor(FastDictionaryInitializer())
2032
0
  {
2033
0
    // Doesn't matter what int we pass to the parent constructor
2034
0
  }
2035
};
2036
} // namespace binding_detail
2037
2038
2039
struct WebGPUVertexAttributeDescriptor : public DictionaryBase
2040
{
2041
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mFormat;
2042
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mInputSlot;
2043
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mOffset;
2044
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mShaderLocation;
2045
2046
  WebGPUVertexAttributeDescriptor();
2047
2048
  explicit inline WebGPUVertexAttributeDescriptor(const FastDictionaryInitializer& )
2049
0
  {
2050
0
    // Do nothing here; this is used by our "Fast" subclass
2051
0
  }
2052
2053
  explicit inline WebGPUVertexAttributeDescriptor(const WebGPUVertexAttributeDescriptor& aOther)
2054
0
  {
2055
0
    *this = aOther;
2056
0
  }
2057
2058
  bool
2059
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
2060
2061
  bool
2062
  Init(const nsAString& aJSON);
2063
2064
  bool
2065
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
2066
2067
  bool
2068
  ToJSON(nsAString& aJSON) const;
2069
2070
  void
2071
  TraceDictionary(JSTracer* trc);
2072
2073
  WebGPUVertexAttributeDescriptor&
2074
  operator=(const WebGPUVertexAttributeDescriptor& aOther);
2075
2076
private:
2077
  static bool
2078
  InitIds(JSContext* cx, WebGPUVertexAttributeDescriptorAtoms* atomsCache);
2079
};
2080
2081
namespace binding_detail {
2082
struct FastWebGPUVertexAttributeDescriptor : public WebGPUVertexAttributeDescriptor
2083
{
2084
  inline FastWebGPUVertexAttributeDescriptor()
2085
    : WebGPUVertexAttributeDescriptor(FastDictionaryInitializer())
2086
0
  {
2087
0
    // Doesn't matter what int we pass to the parent constructor
2088
0
  }
2089
};
2090
} // namespace binding_detail
2091
2092
2093
struct WebGPUVertexInputDescriptor : public DictionaryBase
2094
{
2095
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mInputSlot;
2096
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mStepMode;
2097
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mStride;
2098
2099
  WebGPUVertexInputDescriptor();
2100
2101
  explicit inline WebGPUVertexInputDescriptor(const FastDictionaryInitializer& )
2102
0
  {
2103
0
    // Do nothing here; this is used by our "Fast" subclass
2104
0
  }
2105
2106
  explicit inline WebGPUVertexInputDescriptor(const WebGPUVertexInputDescriptor& aOther)
2107
0
  {
2108
0
    *this = aOther;
2109
0
  }
2110
2111
  bool
2112
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
2113
2114
  bool
2115
  Init(const nsAString& aJSON);
2116
2117
  bool
2118
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
2119
2120
  bool
2121
  ToJSON(nsAString& aJSON) const;
2122
2123
  void
2124
  TraceDictionary(JSTracer* trc);
2125
2126
  WebGPUVertexInputDescriptor&
2127
  operator=(const WebGPUVertexInputDescriptor& aOther);
2128
2129
private:
2130
  static bool
2131
  InitIds(JSContext* cx, WebGPUVertexInputDescriptorAtoms* atomsCache);
2132
};
2133
2134
namespace binding_detail {
2135
struct FastWebGPUVertexInputDescriptor : public WebGPUVertexInputDescriptor
2136
{
2137
  inline FastWebGPUVertexInputDescriptor()
2138
    : WebGPUVertexInputDescriptor(FastDictionaryInitializer())
2139
0
  {
2140
0
    // Doesn't matter what int we pass to the parent constructor
2141
0
  }
2142
};
2143
} // namespace binding_detail
2144
2145
2146
struct WebGPUBindGroupLayoutDescriptor : public DictionaryBase
2147
{
2148
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<WebGPUBindGroupBinding>> mBindingTypes;
2149
2150
  WebGPUBindGroupLayoutDescriptor();
2151
2152
  explicit inline WebGPUBindGroupLayoutDescriptor(const FastDictionaryInitializer& )
2153
0
  {
2154
0
    // Do nothing here; this is used by our "Fast" subclass
2155
0
  }
2156
2157
  explicit inline WebGPUBindGroupLayoutDescriptor(const WebGPUBindGroupLayoutDescriptor& aOther)
2158
0
  {
2159
0
    *this = aOther;
2160
0
  }
2161
2162
  bool
2163
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
2164
2165
  bool
2166
  Init(const nsAString& aJSON);
2167
2168
  bool
2169
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
2170
2171
  bool
2172
  ToJSON(nsAString& aJSON) const;
2173
2174
  void
2175
  TraceDictionary(JSTracer* trc);
2176
2177
  WebGPUBindGroupLayoutDescriptor&
2178
  operator=(const WebGPUBindGroupLayoutDescriptor& aOther);
2179
2180
private:
2181
  static bool
2182
  InitIds(JSContext* cx, WebGPUBindGroupLayoutDescriptorAtoms* atomsCache);
2183
};
2184
2185
namespace binding_detail {
2186
struct FastWebGPUBindGroupLayoutDescriptor : public WebGPUBindGroupLayoutDescriptor
2187
{
2188
  inline FastWebGPUBindGroupLayoutDescriptor()
2189
    : WebGPUBindGroupLayoutDescriptor(FastDictionaryInitializer())
2190
0
  {
2191
0
    // Doesn't matter what int we pass to the parent constructor
2192
0
  }
2193
};
2194
} // namespace binding_detail
2195
2196
2197
struct WebGPUBinding : public DictionaryBase
2198
{
2199
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mCount;
2200
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<OwningWebGPUSamplerOrWebGPUTextureViewOrWebGPUBufferBinding>> mResources;
2201
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mStart;
2202
2203
  WebGPUBinding();
2204
2205
  explicit inline WebGPUBinding(const FastDictionaryInitializer& )
2206
0
  {
2207
0
    // Do nothing here; this is used by our "Fast" subclass
2208
0
  }
2209
2210
  explicit inline WebGPUBinding(const WebGPUBinding& aOther)
2211
0
  {
2212
0
    *this = aOther;
2213
0
  }
2214
2215
  bool
2216
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
2217
2218
  bool
2219
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
2220
2221
  void
2222
  TraceDictionary(JSTracer* trc);
2223
2224
  inline void
2225
  TraverseForCC(nsCycleCollectionTraversalCallback& aCallback, uint32_t aFlags)
2226
0
  {
2227
0
    ImplCycleCollectionTraverse(aCallback, mResources, "mResources", aFlags);
2228
0
  }
2229
2230
  inline void
2231
  UnlinkForCC()
2232
0
  {
2233
0
    ImplCycleCollectionUnlink(mResources);
2234
0
  }
2235
2236
  WebGPUBinding&
2237
  operator=(const WebGPUBinding& aOther);
2238
2239
private:
2240
  static bool
2241
  InitIds(JSContext* cx, WebGPUBindingAtoms* atomsCache);
2242
};
2243
2244
namespace binding_detail {
2245
struct FastWebGPUBinding : public WebGPUBinding
2246
{
2247
  inline FastWebGPUBinding()
2248
    : WebGPUBinding(FastDictionaryInitializer())
2249
0
  {
2250
0
    // Doesn't matter what int we pass to the parent constructor
2251
0
  }
2252
};
2253
} // namespace binding_detail
2254
2255
2256
struct WebGPUBlendStateDescriptor : public DictionaryBase
2257
{
2258
  MOZ_INIT_OUTSIDE_CTOR WebGPUBlendDescriptor mAlpha;
2259
  MOZ_INIT_OUTSIDE_CTOR Optional<bool> mBlendEnabled;
2260
  MOZ_INIT_OUTSIDE_CTOR WebGPUBlendDescriptor mColor;
2261
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mWriteMask;
2262
2263
  WebGPUBlendStateDescriptor();
2264
2265
  explicit inline WebGPUBlendStateDescriptor(const FastDictionaryInitializer& )
2266
    : mAlpha(FastDictionaryInitializer()),
2267
      mColor(FastDictionaryInitializer())
2268
0
  {
2269
0
    // Do nothing here; this is used by our "Fast" subclass
2270
0
  }
2271
2272
  explicit inline WebGPUBlendStateDescriptor(const WebGPUBlendStateDescriptor& aOther)
2273
    : mAlpha(FastDictionaryInitializer()),
2274
      mColor(FastDictionaryInitializer())
2275
0
  {
2276
0
    *this = aOther;
2277
0
  }
2278
2279
  bool
2280
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
2281
2282
  bool
2283
  Init(const nsAString& aJSON);
2284
2285
  bool
2286
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
2287
2288
  bool
2289
  ToJSON(nsAString& aJSON) const;
2290
2291
  void
2292
  TraceDictionary(JSTracer* trc);
2293
2294
  WebGPUBlendStateDescriptor&
2295
  operator=(const WebGPUBlendStateDescriptor& aOther);
2296
2297
private:
2298
  static bool
2299
  InitIds(JSContext* cx, WebGPUBlendStateDescriptorAtoms* atomsCache);
2300
};
2301
2302
namespace binding_detail {
2303
struct FastWebGPUBlendStateDescriptor : public WebGPUBlendStateDescriptor
2304
{
2305
  inline FastWebGPUBlendStateDescriptor()
2306
    : WebGPUBlendStateDescriptor(FastDictionaryInitializer())
2307
0
  {
2308
0
    // Doesn't matter what int we pass to the parent constructor
2309
0
  }
2310
};
2311
} // namespace binding_detail
2312
2313
2314
struct WebGPUDepthStencilStateDescriptor : public DictionaryBase
2315
{
2316
  MOZ_INIT_OUTSIDE_CTOR WebGPUStencilStateFaceDescriptor mBack;
2317
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mDepthCompare;
2318
  MOZ_INIT_OUTSIDE_CTOR Optional<bool> mDepthWriteEnabled;
2319
  MOZ_INIT_OUTSIDE_CTOR WebGPUStencilStateFaceDescriptor mFront;
2320
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mStencilReadMask;
2321
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mStencilWriteMask;
2322
2323
  WebGPUDepthStencilStateDescriptor();
2324
2325
  explicit inline WebGPUDepthStencilStateDescriptor(const FastDictionaryInitializer& )
2326
    : mBack(FastDictionaryInitializer()),
2327
      mFront(FastDictionaryInitializer())
2328
0
  {
2329
0
    // Do nothing here; this is used by our "Fast" subclass
2330
0
  }
2331
2332
  explicit inline WebGPUDepthStencilStateDescriptor(const WebGPUDepthStencilStateDescriptor& aOther)
2333
    : mBack(FastDictionaryInitializer()),
2334
      mFront(FastDictionaryInitializer())
2335
0
  {
2336
0
    *this = aOther;
2337
0
  }
2338
2339
  bool
2340
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
2341
2342
  bool
2343
  Init(const nsAString& aJSON);
2344
2345
  bool
2346
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
2347
2348
  bool
2349
  ToJSON(nsAString& aJSON) const;
2350
2351
  void
2352
  TraceDictionary(JSTracer* trc);
2353
2354
  WebGPUDepthStencilStateDescriptor&
2355
  operator=(const WebGPUDepthStencilStateDescriptor& aOther);
2356
2357
private:
2358
  static bool
2359
  InitIds(JSContext* cx, WebGPUDepthStencilStateDescriptorAtoms* atomsCache);
2360
};
2361
2362
namespace binding_detail {
2363
struct FastWebGPUDepthStencilStateDescriptor : public WebGPUDepthStencilStateDescriptor
2364
{
2365
  inline FastWebGPUDepthStencilStateDescriptor()
2366
    : WebGPUDepthStencilStateDescriptor(FastDictionaryInitializer())
2367
0
  {
2368
0
    // Doesn't matter what int we pass to the parent constructor
2369
0
  }
2370
};
2371
} // namespace binding_detail
2372
2373
2374
struct WebGPUDeviceDescriptor : public DictionaryBase
2375
{
2376
  MOZ_INIT_OUTSIDE_CTOR WebGPUExtensions mExtensions;
2377
2378
  WebGPUDeviceDescriptor();
2379
2380
  explicit inline WebGPUDeviceDescriptor(const FastDictionaryInitializer& )
2381
    : mExtensions(FastDictionaryInitializer())
2382
0
  {
2383
0
    // Do nothing here; this is used by our "Fast" subclass
2384
0
  }
2385
2386
  explicit inline WebGPUDeviceDescriptor(const WebGPUDeviceDescriptor& aOther)
2387
    : mExtensions(FastDictionaryInitializer())
2388
0
  {
2389
0
    *this = aOther;
2390
0
  }
2391
2392
  bool
2393
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
2394
2395
  bool
2396
  Init(const nsAString& aJSON);
2397
2398
  bool
2399
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
2400
2401
  bool
2402
  ToJSON(nsAString& aJSON) const;
2403
2404
  void
2405
  TraceDictionary(JSTracer* trc);
2406
2407
  WebGPUDeviceDescriptor&
2408
  operator=(const WebGPUDeviceDescriptor& aOther);
2409
2410
private:
2411
  static bool
2412
  InitIds(JSContext* cx, WebGPUDeviceDescriptorAtoms* atomsCache);
2413
};
2414
2415
namespace binding_detail {
2416
struct FastWebGPUDeviceDescriptor : public WebGPUDeviceDescriptor
2417
{
2418
  inline FastWebGPUDeviceDescriptor()
2419
    : WebGPUDeviceDescriptor(FastDictionaryInitializer())
2420
0
  {
2421
0
    // Doesn't matter what int we pass to the parent constructor
2422
0
  }
2423
};
2424
} // namespace binding_detail
2425
2426
2427
struct WebGPUInputStateDescriptor : public DictionaryBase
2428
{
2429
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<WebGPUVertexAttributeDescriptor>> mAttributes;
2430
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mIndexFormat;
2431
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<WebGPUVertexInputDescriptor>> mInputs;
2432
2433
  WebGPUInputStateDescriptor();
2434
2435
  explicit inline WebGPUInputStateDescriptor(const FastDictionaryInitializer& )
2436
0
  {
2437
0
    // Do nothing here; this is used by our "Fast" subclass
2438
0
  }
2439
2440
  explicit inline WebGPUInputStateDescriptor(const WebGPUInputStateDescriptor& aOther)
2441
0
  {
2442
0
    *this = aOther;
2443
0
  }
2444
2445
  bool
2446
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
2447
2448
  bool
2449
  Init(const nsAString& aJSON);
2450
2451
  bool
2452
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
2453
2454
  bool
2455
  ToJSON(nsAString& aJSON) const;
2456
2457
  void
2458
  TraceDictionary(JSTracer* trc);
2459
2460
  WebGPUInputStateDescriptor&
2461
  operator=(const WebGPUInputStateDescriptor& aOther);
2462
2463
private:
2464
  static bool
2465
  InitIds(JSContext* cx, WebGPUInputStateDescriptorAtoms* atomsCache);
2466
};
2467
2468
namespace binding_detail {
2469
struct FastWebGPUInputStateDescriptor : public WebGPUInputStateDescriptor
2470
{
2471
  inline FastWebGPUInputStateDescriptor()
2472
    : WebGPUInputStateDescriptor(FastDictionaryInitializer())
2473
0
  {
2474
0
    // Doesn't matter what int we pass to the parent constructor
2475
0
  }
2476
};
2477
} // namespace binding_detail
2478
2479
2480
struct WebGPUPipelineDescriptorBase : public DictionaryBase
2481
{
2482
  MOZ_INIT_OUTSIDE_CTOR OwningNonNull<mozilla::webgpu::PipelineLayout> mLayout;
2483
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<WebGPUPipelineStageDescriptor>> mStages;
2484
2485
  WebGPUPipelineDescriptorBase();
2486
2487
  explicit inline WebGPUPipelineDescriptorBase(const FastDictionaryInitializer& )
2488
0
  {
2489
0
    // Do nothing here; this is used by our "Fast" subclass
2490
0
  }
2491
2492
  explicit inline WebGPUPipelineDescriptorBase(const WebGPUPipelineDescriptorBase& aOther)
2493
0
  {
2494
0
    *this = aOther;
2495
0
  }
2496
2497
  bool
2498
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
2499
2500
  bool
2501
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
2502
2503
  void
2504
  TraceDictionary(JSTracer* trc);
2505
2506
  inline void
2507
  TraverseForCC(nsCycleCollectionTraversalCallback& aCallback, uint32_t aFlags)
2508
0
  {
2509
0
    ImplCycleCollectionTraverse(aCallback, mLayout, "mLayout", aFlags);
2510
0
    ImplCycleCollectionTraverse(aCallback, mStages, "mStages", aFlags);
2511
0
  }
2512
2513
  inline void
2514
  UnlinkForCC()
2515
0
  {
2516
0
    ImplCycleCollectionUnlink(mLayout);
2517
0
    ImplCycleCollectionUnlink(mStages);
2518
0
  }
2519
2520
  WebGPUPipelineDescriptorBase&
2521
  operator=(const WebGPUPipelineDescriptorBase& aOther);
2522
2523
private:
2524
  static bool
2525
  InitIds(JSContext* cx, WebGPUPipelineDescriptorBaseAtoms* atomsCache);
2526
};
2527
2528
namespace binding_detail {
2529
struct FastWebGPUPipelineDescriptorBase : public WebGPUPipelineDescriptorBase
2530
{
2531
  inline FastWebGPUPipelineDescriptorBase()
2532
    : WebGPUPipelineDescriptorBase(FastDictionaryInitializer())
2533
0
  {
2534
0
    // Doesn't matter what int we pass to the parent constructor
2535
0
  }
2536
};
2537
} // namespace binding_detail
2538
2539
2540
struct WebGPURenderPassDescriptor : public DictionaryBase
2541
{
2542
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<WebGPURenderPassAttachmentDescriptor>> mColorAttachments;
2543
  MOZ_INIT_OUTSIDE_CTOR WebGPURenderPassAttachmentDescriptor mDepthStencilAttachment;
2544
2545
  WebGPURenderPassDescriptor();
2546
2547
  explicit inline WebGPURenderPassDescriptor(const FastDictionaryInitializer& )
2548
    : mDepthStencilAttachment(FastDictionaryInitializer())
2549
0
  {
2550
0
    // Do nothing here; this is used by our "Fast" subclass
2551
0
  }
2552
2553
  explicit inline WebGPURenderPassDescriptor(const WebGPURenderPassDescriptor& aOther)
2554
    : mDepthStencilAttachment(FastDictionaryInitializer())
2555
0
  {
2556
0
    *this = aOther;
2557
0
  }
2558
2559
  bool
2560
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
2561
2562
  bool
2563
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
2564
2565
  void
2566
  TraceDictionary(JSTracer* trc);
2567
2568
  inline void
2569
  TraverseForCC(nsCycleCollectionTraversalCallback& aCallback, uint32_t aFlags)
2570
0
  {
2571
0
    ImplCycleCollectionTraverse(aCallback, mColorAttachments, "mColorAttachments", aFlags);
2572
0
    ImplCycleCollectionTraverse(aCallback, mDepthStencilAttachment, "mDepthStencilAttachment", aFlags);
2573
0
  }
2574
2575
  inline void
2576
  UnlinkForCC()
2577
0
  {
2578
0
    ImplCycleCollectionUnlink(mColorAttachments);
2579
0
    ImplCycleCollectionUnlink(mDepthStencilAttachment);
2580
0
  }
2581
2582
  WebGPURenderPassDescriptor&
2583
  operator=(const WebGPURenderPassDescriptor& aOther);
2584
2585
private:
2586
  static bool
2587
  InitIds(JSContext* cx, WebGPURenderPassDescriptorAtoms* atomsCache);
2588
};
2589
2590
namespace binding_detail {
2591
struct FastWebGPURenderPassDescriptor : public WebGPURenderPassDescriptor
2592
{
2593
  inline FastWebGPURenderPassDescriptor()
2594
    : WebGPURenderPassDescriptor(FastDictionaryInitializer())
2595
0
  {
2596
0
    // Doesn't matter what int we pass to the parent constructor
2597
0
  }
2598
};
2599
} // namespace binding_detail
2600
2601
2602
struct WebGPUBindGroupDescriptor : public DictionaryBase
2603
{
2604
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<WebGPUBinding>> mBindings;
2605
  MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<mozilla::webgpu::BindGroupLayout>> mLayout;
2606
2607
  WebGPUBindGroupDescriptor();
2608
2609
  explicit inline WebGPUBindGroupDescriptor(const FastDictionaryInitializer& )
2610
0
  {
2611
0
    // Do nothing here; this is used by our "Fast" subclass
2612
0
  }
2613
2614
  explicit inline WebGPUBindGroupDescriptor(const WebGPUBindGroupDescriptor& aOther)
2615
0
  {
2616
0
    *this = aOther;
2617
0
  }
2618
2619
  bool
2620
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
2621
2622
  bool
2623
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
2624
2625
  void
2626
  TraceDictionary(JSTracer* trc);
2627
2628
  inline void
2629
  TraverseForCC(nsCycleCollectionTraversalCallback& aCallback, uint32_t aFlags)
2630
0
  {
2631
0
    ImplCycleCollectionTraverse(aCallback, mBindings, "mBindings", aFlags);
2632
0
    ImplCycleCollectionTraverse(aCallback, mLayout, "mLayout", aFlags);
2633
0
  }
2634
2635
  inline void
2636
  UnlinkForCC()
2637
0
  {
2638
0
    ImplCycleCollectionUnlink(mBindings);
2639
0
    ImplCycleCollectionUnlink(mLayout);
2640
0
  }
2641
2642
  WebGPUBindGroupDescriptor&
2643
  operator=(const WebGPUBindGroupDescriptor& aOther);
2644
2645
private:
2646
  static bool
2647
  InitIds(JSContext* cx, WebGPUBindGroupDescriptorAtoms* atomsCache);
2648
};
2649
2650
namespace binding_detail {
2651
struct FastWebGPUBindGroupDescriptor : public WebGPUBindGroupDescriptor
2652
{
2653
  inline FastWebGPUBindGroupDescriptor()
2654
    : WebGPUBindGroupDescriptor(FastDictionaryInitializer())
2655
0
  {
2656
0
    // Doesn't matter what int we pass to the parent constructor
2657
0
  }
2658
};
2659
} // namespace binding_detail
2660
2661
2662
struct WebGPUComputePipelineDescriptor : public WebGPUPipelineDescriptorBase
2663
{
2664
  WebGPUComputePipelineDescriptor();
2665
2666
  explicit inline WebGPUComputePipelineDescriptor(const FastDictionaryInitializer& )
2667
    : WebGPUPipelineDescriptorBase(FastDictionaryInitializer())
2668
0
  {
2669
0
    // Do nothing here; this is used by our "Fast" subclass
2670
0
  }
2671
2672
  explicit inline WebGPUComputePipelineDescriptor(const WebGPUComputePipelineDescriptor& aOther)
2673
0
  {
2674
0
    *this = aOther;
2675
0
  }
2676
2677
  bool
2678
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
2679
2680
  bool
2681
  Init(const nsAString& aJSON);
2682
2683
  bool
2684
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
2685
2686
  bool
2687
  ToJSON(nsAString& aJSON) const;
2688
2689
  void
2690
  TraceDictionary(JSTracer* trc);
2691
2692
  inline void
2693
  TraverseForCC(nsCycleCollectionTraversalCallback& aCallback, uint32_t aFlags)
2694
0
  {
2695
0
    WebGPUPipelineDescriptorBase::TraverseForCC(aCallback, aFlags);
2696
0
  }
2697
2698
  inline void
2699
  UnlinkForCC()
2700
0
  {
2701
0
    WebGPUPipelineDescriptorBase::UnlinkForCC();
2702
0
  }
2703
2704
  WebGPUComputePipelineDescriptor&
2705
  operator=(const WebGPUComputePipelineDescriptor& aOther);
2706
};
2707
2708
namespace binding_detail {
2709
struct FastWebGPUComputePipelineDescriptor : public WebGPUComputePipelineDescriptor
2710
{
2711
  inline FastWebGPUComputePipelineDescriptor()
2712
    : WebGPUComputePipelineDescriptor(FastDictionaryInitializer())
2713
0
  {
2714
0
    // Doesn't matter what int we pass to the parent constructor
2715
0
  }
2716
};
2717
} // namespace binding_detail
2718
2719
2720
struct WebGPURenderPipelineDescriptor : public WebGPUPipelineDescriptorBase
2721
{
2722
  MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<mozilla::webgpu::AttachmentState>> mAttachmentState;
2723
  MOZ_INIT_OUTSIDE_CTOR Optional<Sequence<OwningNonNull<mozilla::webgpu::BlendState>>> mBlendState;
2724
  MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<mozilla::webgpu::DepthStencilState>> mDepthStencilState;
2725
  MOZ_INIT_OUTSIDE_CTOR Optional<OwningNonNull<mozilla::webgpu::InputState>> mInputState;
2726
  MOZ_INIT_OUTSIDE_CTOR Optional<uint32_t> mPrimitiveTopology;
2727
2728
  WebGPURenderPipelineDescriptor();
2729
2730
  explicit inline WebGPURenderPipelineDescriptor(const FastDictionaryInitializer& )
2731
    : WebGPUPipelineDescriptorBase(FastDictionaryInitializer())
2732
0
  {
2733
0
    // Do nothing here; this is used by our "Fast" subclass
2734
0
  }
2735
2736
  explicit inline WebGPURenderPipelineDescriptor(const WebGPURenderPipelineDescriptor& aOther)
2737
0
  {
2738
0
    *this = aOther;
2739
0
  }
2740
2741
  bool
2742
  Init(JSContext* cx, JS::Handle<JS::Value> val, const char* sourceDescription = "Value", bool passedToJSImpl = false);
2743
2744
  bool
2745
  ToObjectInternal(JSContext* cx, JS::MutableHandle<JS::Value> rval) const;
2746
2747
  void
2748
  TraceDictionary(JSTracer* trc);
2749
2750
  inline void
2751
  TraverseForCC(nsCycleCollectionTraversalCallback& aCallback, uint32_t aFlags)
2752
0
  {
2753
0
    WebGPUPipelineDescriptorBase::TraverseForCC(aCallback, aFlags);
2754
0
    ImplCycleCollectionTraverse(aCallback, mAttachmentState, "mAttachmentState", aFlags);
2755
0
    ImplCycleCollectionTraverse(aCallback, mBlendState, "mBlendState", aFlags);
2756
0
    ImplCycleCollectionTraverse(aCallback, mDepthStencilState, "mDepthStencilState", aFlags);
2757
0
    ImplCycleCollectionTraverse(aCallback, mInputState, "mInputState", aFlags);
2758
0
  }
2759
2760
  inline void
2761
  UnlinkForCC()
2762
0
  {
2763
0
    WebGPUPipelineDescriptorBase::UnlinkForCC();
2764
0
    ImplCycleCollectionUnlink(mAttachmentState);
2765
0
    ImplCycleCollectionUnlink(mBlendState);
2766
0
    ImplCycleCollectionUnlink(mDepthStencilState);
2767
0
    ImplCycleCollectionUnlink(mInputState);
2768
0
  }
2769
2770
  WebGPURenderPipelineDescriptor&
2771
  operator=(const WebGPURenderPipelineDescriptor& aOther);
2772
2773
private:
2774
  static bool
2775
  InitIds(JSContext* cx, WebGPURenderPipelineDescriptorAtoms* atomsCache);
2776
};
2777
2778
namespace binding_detail {
2779
struct FastWebGPURenderPipelineDescriptor : public WebGPURenderPipelineDescriptor
2780
{
2781
  inline FastWebGPURenderPipelineDescriptor()
2782
    : WebGPURenderPipelineDescriptor(FastDictionaryInitializer())
2783
0
  {
2784
0
    // Doesn't matter what int we pass to the parent constructor
2785
0
  }
2786
};
2787
} // namespace binding_detail
2788
2789
2790
class WebGPULogCallback : public CallbackFunction
2791
{
2792
public:
2793
  explicit inline WebGPULogCallback(JSContext* aCx, JS::Handle<JSObject*> aCallback, JS::Handle<JSObject*> aCallbackGlobal, nsIGlobalObject* aIncumbentGlobal)
2794
    : CallbackFunction(aCx, aCallback, aCallbackGlobal, aIncumbentGlobal)
2795
0
  {
2796
0
    MOZ_ASSERT(JS::IsCallable(mCallback));
2797
0
  }
2798
2799
  explicit inline WebGPULogCallback(JSObject* aCallback, JSObject* aCallbackGlobal, const FastCallbackConstructor& )
2800
    : CallbackFunction(aCallback, aCallbackGlobal, FastCallbackConstructor())
2801
0
  {
2802
0
    MOZ_ASSERT(JS::IsCallable(mCallback));
2803
0
  }
2804
2805
  explicit inline WebGPULogCallback(JSObject* aCallback, JSObject* aCallbackGlobal, JSObject* aAsyncStack, nsIGlobalObject* aIncumbentGlobal)
2806
    : CallbackFunction(aCallback, aCallbackGlobal, aAsyncStack, aIncumbentGlobal)
2807
0
  {
2808
0
    MOZ_ASSERT(JS::IsCallable(mCallback));
2809
0
  }
2810
2811
  explicit inline WebGPULogCallback(CallbackFunction* aOther)
2812
    : CallbackFunction(aOther)
2813
0
  {
2814
0
  }
2815
2816
  template <typename T>
2817
  inline void
2818
  Call(const T& thisVal, webgpu::LogEntry& error, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
2819
  {
2820
    MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
2821
    if (!aExecutionReason) {
2822
      aExecutionReason = "WebGPULogCallback";
2823
    }
2824
    CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
2825
    if (!s.GetContext()) {
2826
      MOZ_ASSERT(aRv.Failed());
2827
      return;
2828
    }
2829
    JS::Rooted<JS::Value> thisValJS(s.GetContext());
2830
    if (!ToJSValue(s.GetContext(), thisVal, &thisValJS)) {
2831
      aRv.Throw(NS_ERROR_FAILURE);
2832
      return;
2833
    }
2834
    return Call(s.GetContext(), thisValJS, error, aRv);
2835
  }
2836
2837
  inline void
2838
  Call(webgpu::LogEntry& error, ErrorResult& aRv, const char* aExecutionReason = nullptr, ExceptionHandling aExceptionHandling = eReportExceptions, JS::Realm* aRealm = nullptr)
2839
0
  {
2840
0
    MOZ_ASSERT(!aRv.Failed(), "Don't pass an already-failed ErrorResult to a callback!");
2841
0
    if (!aExecutionReason) {
2842
0
      aExecutionReason = "WebGPULogCallback";
2843
0
    }
2844
0
    CallSetup s(this, aRv, aExecutionReason, aExceptionHandling, aRealm);
2845
0
    if (!s.GetContext()) {
2846
0
      MOZ_ASSERT(aRv.Failed());
2847
0
      return;
2848
0
    }
2849
0
    return Call(s.GetContext(), JS::UndefinedHandleValue, error, aRv);
2850
0
  }
2851
2852
  template <typename T>
2853
  inline void
2854
  Call(const T& thisVal, webgpu::LogEntry& error, const char* aExecutionReason = nullptr)
2855
  {
2856
    return Call(thisVal, error, IgnoreErrors(), aExecutionReason);
2857
  }
2858
2859
  inline void
2860
  Call(webgpu::LogEntry& error, const char* aExecutionReason = nullptr)
2861
0
  {
2862
0
    return Call(error, IgnoreErrors(), aExecutionReason, eReportExceptions, nullptr);
2863
0
  }
2864
2865
  inline bool
2866
  operator==(const WebGPULogCallback& aOther) const
2867
0
  {
2868
0
    return CallbackFunction::operator==(aOther);
2869
0
  }
2870
2871
private:
2872
  void Call(JSContext* cx, JS::Handle<JS::Value> aThisVal, webgpu::LogEntry& error, ErrorResult& aRv);
2873
};
2874
2875
2876
namespace binding_detail {
2877
class FastWebGPULogCallback : public WebGPULogCallback
2878
{
2879
public:
2880
  explicit inline FastWebGPULogCallback(JSObject* aCallback, JSObject* aCallbackGlobal)
2881
    : WebGPULogCallback(aCallback, aCallbackGlobal, FastCallbackConstructor())
2882
0
  {
2883
0
  }
2884
2885
  inline void
2886
  Trace(JSTracer* aTracer)
2887
0
  {
2888
0
    WebGPULogCallback::Trace(aTracer);
2889
0
  }
2890
2891
  inline void
2892
  FinishSlowJSInitIfMoreThanOneOwner(JSContext* aCx)
2893
0
  {
2894
0
    WebGPULogCallback::FinishSlowJSInitIfMoreThanOneOwner(aCx);
2895
0
  }
2896
};
2897
} // namespace binding_detail
2898
2899
2900
namespace WebGPU_Binding {
2901
2902
  typedef mozilla::webgpu::Instance NativeType;
2903
2904
  bool
2905
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
2906
2907
  const JSClass*
2908
  GetJSClass();
2909
2910
  bool
2911
  Wrap(JSContext* aCx, mozilla::webgpu::Instance* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
2912
2913
  template <class T>
2914
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
2915
0
  {
2916
0
    JS::Rooted<JSObject*> reflector(aCx);
2917
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
2918
0
  }
2919
2920
  // We declare this as an array so that retrieving a pointer to this
2921
  // binding's property hooks only requires compile/link-time resolvable
2922
  // address arithmetic.  Declaring it as a pointer instead would require
2923
  // doing a run-time load to fetch a pointer to this binding's property
2924
  // hooks.  And then structures which embedded a pointer to this structure
2925
  // would require a run-time load for proper initialization, which would
2926
  // then induce static constructors.  Lots of static constructors.
2927
  extern const NativePropertyHooks sNativePropertyHooks[];
2928
2929
  void
2930
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
2931
2932
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
2933
0
  {
2934
0
    /* Get the interface prototype object for this class.  This will create the
2935
0
       object as needed. */
2936
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPU,
2937
0
                                       &CreateInterfaceObjects,
2938
0
                                       /* aDefineOnGlobal = */ true);
2939
0
2940
0
  }
2941
2942
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
2943
0
  {
2944
0
    /* Get the interface object for this class.  This will create the object as
2945
0
       needed. */
2946
0
2947
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPU,
2948
0
                                       &CreateInterfaceObjects,
2949
0
                                       aDefineOnGlobal);
2950
0
  }
2951
2952
  JSObject*
2953
  GetConstructorObject(JSContext* aCx);
2954
2955
} // namespace WebGPU_Binding
2956
2957
2958
2959
namespace WebGPUAdapter_Binding {
2960
2961
  typedef mozilla::webgpu::Adapter NativeType;
2962
2963
  bool
2964
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
2965
2966
  const JSClass*
2967
  GetJSClass();
2968
2969
  bool
2970
  Wrap(JSContext* aCx, mozilla::webgpu::Adapter* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
2971
2972
  template <class T>
2973
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
2974
0
  {
2975
0
    JS::Rooted<JSObject*> reflector(aCx);
2976
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
2977
0
  }
2978
2979
  // We declare this as an array so that retrieving a pointer to this
2980
  // binding's property hooks only requires compile/link-time resolvable
2981
  // address arithmetic.  Declaring it as a pointer instead would require
2982
  // doing a run-time load to fetch a pointer to this binding's property
2983
  // hooks.  And then structures which embedded a pointer to this structure
2984
  // would require a run-time load for proper initialization, which would
2985
  // then induce static constructors.  Lots of static constructors.
2986
  extern const NativePropertyHooks sNativePropertyHooks[];
2987
2988
  void
2989
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
2990
2991
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
2992
0
  {
2993
0
    /* Get the interface prototype object for this class.  This will create the
2994
0
       object as needed. */
2995
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPUAdapter,
2996
0
                                       &CreateInterfaceObjects,
2997
0
                                       /* aDefineOnGlobal = */ true);
2998
0
2999
0
  }
3000
3001
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
3002
0
  {
3003
0
    /* Get the interface object for this class.  This will create the object as
3004
0
       needed. */
3005
0
3006
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUAdapter,
3007
0
                                       &CreateInterfaceObjects,
3008
0
                                       aDefineOnGlobal);
3009
0
  }
3010
3011
  JSObject*
3012
  GetConstructorObject(JSContext* aCx);
3013
3014
} // namespace WebGPUAdapter_Binding
3015
3016
3017
3018
namespace WebGPUAttachmentState_Binding {
3019
3020
  typedef mozilla::webgpu::AttachmentState NativeType;
3021
3022
  bool
3023
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
3024
3025
  const JSClass*
3026
  GetJSClass();
3027
3028
  bool
3029
  Wrap(JSContext* aCx, mozilla::webgpu::AttachmentState* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
3030
3031
  template <class T>
3032
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
3033
0
  {
3034
0
    JS::Rooted<JSObject*> reflector(aCx);
3035
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
3036
0
  }
3037
3038
  // We declare this as an array so that retrieving a pointer to this
3039
  // binding's property hooks only requires compile/link-time resolvable
3040
  // address arithmetic.  Declaring it as a pointer instead would require
3041
  // doing a run-time load to fetch a pointer to this binding's property
3042
  // hooks.  And then structures which embedded a pointer to this structure
3043
  // would require a run-time load for proper initialization, which would
3044
  // then induce static constructors.  Lots of static constructors.
3045
  extern const NativePropertyHooks sNativePropertyHooks[];
3046
3047
  void
3048
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
3049
3050
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
3051
0
  {
3052
0
    /* Get the interface prototype object for this class.  This will create the
3053
0
       object as needed. */
3054
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPUAttachmentState,
3055
0
                                       &CreateInterfaceObjects,
3056
0
                                       /* aDefineOnGlobal = */ true);
3057
0
3058
0
  }
3059
3060
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
3061
0
  {
3062
0
    /* Get the interface object for this class.  This will create the object as
3063
0
       needed. */
3064
0
3065
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUAttachmentState,
3066
0
                                       &CreateInterfaceObjects,
3067
0
                                       aDefineOnGlobal);
3068
0
  }
3069
3070
  JSObject*
3071
  GetConstructorObject(JSContext* aCx);
3072
3073
} // namespace WebGPUAttachmentState_Binding
3074
3075
3076
3077
namespace WebGPUBindGroup_Binding {
3078
3079
  typedef mozilla::webgpu::BindGroup NativeType;
3080
3081
  bool
3082
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
3083
3084
  const JSClass*
3085
  GetJSClass();
3086
3087
  bool
3088
  Wrap(JSContext* aCx, mozilla::webgpu::BindGroup* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
3089
3090
  template <class T>
3091
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
3092
0
  {
3093
0
    JS::Rooted<JSObject*> reflector(aCx);
3094
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
3095
0
  }
3096
3097
  // We declare this as an array so that retrieving a pointer to this
3098
  // binding's property hooks only requires compile/link-time resolvable
3099
  // address arithmetic.  Declaring it as a pointer instead would require
3100
  // doing a run-time load to fetch a pointer to this binding's property
3101
  // hooks.  And then structures which embedded a pointer to this structure
3102
  // would require a run-time load for proper initialization, which would
3103
  // then induce static constructors.  Lots of static constructors.
3104
  extern const NativePropertyHooks sNativePropertyHooks[];
3105
3106
  void
3107
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
3108
3109
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
3110
0
  {
3111
0
    /* Get the interface prototype object for this class.  This will create the
3112
0
       object as needed. */
3113
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPUBindGroup,
3114
0
                                       &CreateInterfaceObjects,
3115
0
                                       /* aDefineOnGlobal = */ true);
3116
0
3117
0
  }
3118
3119
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
3120
0
  {
3121
0
    /* Get the interface object for this class.  This will create the object as
3122
0
       needed. */
3123
0
3124
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUBindGroup,
3125
0
                                       &CreateInterfaceObjects,
3126
0
                                       aDefineOnGlobal);
3127
0
  }
3128
3129
  JSObject*
3130
  GetConstructorObject(JSContext* aCx);
3131
3132
} // namespace WebGPUBindGroup_Binding
3133
3134
3135
3136
namespace WebGPUBindGroupLayout_Binding {
3137
3138
  typedef mozilla::webgpu::BindGroupLayout NativeType;
3139
3140
  bool
3141
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
3142
3143
  const JSClass*
3144
  GetJSClass();
3145
3146
  bool
3147
  Wrap(JSContext* aCx, mozilla::webgpu::BindGroupLayout* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
3148
3149
  template <class T>
3150
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
3151
0
  {
3152
0
    JS::Rooted<JSObject*> reflector(aCx);
3153
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
3154
0
  }
3155
3156
  // We declare this as an array so that retrieving a pointer to this
3157
  // binding's property hooks only requires compile/link-time resolvable
3158
  // address arithmetic.  Declaring it as a pointer instead would require
3159
  // doing a run-time load to fetch a pointer to this binding's property
3160
  // hooks.  And then structures which embedded a pointer to this structure
3161
  // would require a run-time load for proper initialization, which would
3162
  // then induce static constructors.  Lots of static constructors.
3163
  extern const NativePropertyHooks sNativePropertyHooks[];
3164
3165
  void
3166
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
3167
3168
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
3169
0
  {
3170
0
    /* Get the interface prototype object for this class.  This will create the
3171
0
       object as needed. */
3172
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPUBindGroupLayout,
3173
0
                                       &CreateInterfaceObjects,
3174
0
                                       /* aDefineOnGlobal = */ true);
3175
0
3176
0
  }
3177
3178
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
3179
0
  {
3180
0
    /* Get the interface object for this class.  This will create the object as
3181
0
       needed. */
3182
0
3183
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUBindGroupLayout,
3184
0
                                       &CreateInterfaceObjects,
3185
0
                                       aDefineOnGlobal);
3186
0
  }
3187
3188
  JSObject*
3189
  GetConstructorObject(JSContext* aCx);
3190
3191
} // namespace WebGPUBindGroupLayout_Binding
3192
3193
3194
3195
namespace WebGPUBindingType_Binding {
3196
3197
  typedef mozilla::dom::WebGPUBindingType NativeType;
3198
3199
  static const uint32_t UNIFORM_BUFFER = 0;
3200
  static const uint32_t SAMPLER = 1;
3201
  static const uint32_t SAMPLED_TEXTURE = 2;
3202
  static const uint32_t STORAGE_BUFFER = 3;
3203
  bool
3204
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
3205
3206
  // We declare this as an array so that retrieving a pointer to this
3207
  // binding's property hooks only requires compile/link-time resolvable
3208
  // address arithmetic.  Declaring it as a pointer instead would require
3209
  // doing a run-time load to fetch a pointer to this binding's property
3210
  // hooks.  And then structures which embedded a pointer to this structure
3211
  // would require a run-time load for proper initialization, which would
3212
  // then induce static constructors.  Lots of static constructors.
3213
  extern const NativePropertyHooks sNativePropertyHooks[];
3214
3215
  void
3216
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
3217
3218
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
3219
0
  {
3220
0
    /* Get the interface object for this class.  This will create the object as
3221
0
       needed. */
3222
0
3223
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUBindingType,
3224
0
                                       &CreateInterfaceObjects,
3225
0
                                       aDefineOnGlobal);
3226
0
  }
3227
3228
  JSObject*
3229
  GetConstructorObject(JSContext* aCx);
3230
3231
} // namespace WebGPUBindingType_Binding
3232
3233
3234
3235
namespace WebGPUBlendFactor_Binding {
3236
3237
  typedef mozilla::dom::WebGPUBlendFactor NativeType;
3238
3239
  static const uint32_t ZERO = 0;
3240
  static const uint32_t ONE = 1;
3241
  static const uint32_t SRC_COLOR = 2;
3242
  static const uint32_t ONE_MINUS_SRC_COLOR = 3;
3243
  static const uint32_t SRC_ALPHA = 4;
3244
  static const uint32_t ONE_MINUS_SRC_ALPHA = 5;
3245
  static const uint32_t DST_COLOR = 6;
3246
  static const uint32_t ONE_MINUS_DST_COLOR = 7;
3247
  static const uint32_t DST_ALPHA = 8;
3248
  static const uint32_t ONE_MINUS_DST_ALPHA = 9;
3249
  static const uint32_t SRC_ALPHA_SATURATED = 10;
3250
  static const uint32_t BLEND_COLOR = 11;
3251
  static const uint32_t ONE_MINUS_BLEND_COLOR = 12;
3252
  bool
3253
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
3254
3255
  // We declare this as an array so that retrieving a pointer to this
3256
  // binding's property hooks only requires compile/link-time resolvable
3257
  // address arithmetic.  Declaring it as a pointer instead would require
3258
  // doing a run-time load to fetch a pointer to this binding's property
3259
  // hooks.  And then structures which embedded a pointer to this structure
3260
  // would require a run-time load for proper initialization, which would
3261
  // then induce static constructors.  Lots of static constructors.
3262
  extern const NativePropertyHooks sNativePropertyHooks[];
3263
3264
  void
3265
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
3266
3267
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
3268
0
  {
3269
0
    /* Get the interface object for this class.  This will create the object as
3270
0
       needed. */
3271
0
3272
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUBlendFactor,
3273
0
                                       &CreateInterfaceObjects,
3274
0
                                       aDefineOnGlobal);
3275
0
  }
3276
3277
  JSObject*
3278
  GetConstructorObject(JSContext* aCx);
3279
3280
} // namespace WebGPUBlendFactor_Binding
3281
3282
3283
3284
namespace WebGPUBlendOperation_Binding {
3285
3286
  typedef mozilla::dom::WebGPUBlendOperation NativeType;
3287
3288
  static const uint32_t ADD = 0;
3289
  static const uint32_t SUBTRACT = 1;
3290
  static const uint32_t REVERSE_SUBTRACT = 2;
3291
  static const uint32_t MIN = 3;
3292
  static const uint32_t MAX = 4;
3293
  bool
3294
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
3295
3296
  // We declare this as an array so that retrieving a pointer to this
3297
  // binding's property hooks only requires compile/link-time resolvable
3298
  // address arithmetic.  Declaring it as a pointer instead would require
3299
  // doing a run-time load to fetch a pointer to this binding's property
3300
  // hooks.  And then structures which embedded a pointer to this structure
3301
  // would require a run-time load for proper initialization, which would
3302
  // then induce static constructors.  Lots of static constructors.
3303
  extern const NativePropertyHooks sNativePropertyHooks[];
3304
3305
  void
3306
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
3307
3308
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
3309
0
  {
3310
0
    /* Get the interface object for this class.  This will create the object as
3311
0
       needed. */
3312
0
3313
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUBlendOperation,
3314
0
                                       &CreateInterfaceObjects,
3315
0
                                       aDefineOnGlobal);
3316
0
  }
3317
3318
  JSObject*
3319
  GetConstructorObject(JSContext* aCx);
3320
3321
} // namespace WebGPUBlendOperation_Binding
3322
3323
3324
3325
namespace WebGPUBlendState_Binding {
3326
3327
  typedef mozilla::webgpu::BlendState NativeType;
3328
3329
  bool
3330
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
3331
3332
  const JSClass*
3333
  GetJSClass();
3334
3335
  bool
3336
  Wrap(JSContext* aCx, mozilla::webgpu::BlendState* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
3337
3338
  template <class T>
3339
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
3340
0
  {
3341
0
    JS::Rooted<JSObject*> reflector(aCx);
3342
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
3343
0
  }
3344
3345
  // We declare this as an array so that retrieving a pointer to this
3346
  // binding's property hooks only requires compile/link-time resolvable
3347
  // address arithmetic.  Declaring it as a pointer instead would require
3348
  // doing a run-time load to fetch a pointer to this binding's property
3349
  // hooks.  And then structures which embedded a pointer to this structure
3350
  // would require a run-time load for proper initialization, which would
3351
  // then induce static constructors.  Lots of static constructors.
3352
  extern const NativePropertyHooks sNativePropertyHooks[];
3353
3354
  void
3355
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
3356
3357
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
3358
0
  {
3359
0
    /* Get the interface prototype object for this class.  This will create the
3360
0
       object as needed. */
3361
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPUBlendState,
3362
0
                                       &CreateInterfaceObjects,
3363
0
                                       /* aDefineOnGlobal = */ true);
3364
0
3365
0
  }
3366
3367
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
3368
0
  {
3369
0
    /* Get the interface object for this class.  This will create the object as
3370
0
       needed. */
3371
0
3372
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUBlendState,
3373
0
                                       &CreateInterfaceObjects,
3374
0
                                       aDefineOnGlobal);
3375
0
  }
3376
3377
  JSObject*
3378
  GetConstructorObject(JSContext* aCx);
3379
3380
} // namespace WebGPUBlendState_Binding
3381
3382
3383
3384
namespace WebGPUBuffer_Binding {
3385
3386
  typedef mozilla::webgpu::Buffer NativeType;
3387
3388
  bool
3389
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
3390
3391
  const JSClass*
3392
  GetJSClass();
3393
3394
  bool
3395
  Wrap(JSContext* aCx, mozilla::webgpu::Buffer* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
3396
3397
  template <class T>
3398
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
3399
0
  {
3400
0
    JS::Rooted<JSObject*> reflector(aCx);
3401
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
3402
0
  }
3403
3404
  // We declare this as an array so that retrieving a pointer to this
3405
  // binding's property hooks only requires compile/link-time resolvable
3406
  // address arithmetic.  Declaring it as a pointer instead would require
3407
  // doing a run-time load to fetch a pointer to this binding's property
3408
  // hooks.  And then structures which embedded a pointer to this structure
3409
  // would require a run-time load for proper initialization, which would
3410
  // then induce static constructors.  Lots of static constructors.
3411
  extern const NativePropertyHooks sNativePropertyHooks[];
3412
3413
  void
3414
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
3415
3416
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
3417
0
  {
3418
0
    /* Get the interface prototype object for this class.  This will create the
3419
0
       object as needed. */
3420
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPUBuffer,
3421
0
                                       &CreateInterfaceObjects,
3422
0
                                       /* aDefineOnGlobal = */ true);
3423
0
3424
0
  }
3425
3426
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
3427
0
  {
3428
0
    /* Get the interface object for this class.  This will create the object as
3429
0
       needed. */
3430
0
3431
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUBuffer,
3432
0
                                       &CreateInterfaceObjects,
3433
0
                                       aDefineOnGlobal);
3434
0
  }
3435
3436
  JSObject*
3437
  GetConstructorObject(JSContext* aCx);
3438
3439
} // namespace WebGPUBuffer_Binding
3440
3441
3442
3443
namespace WebGPUBufferUsage_Binding {
3444
3445
  typedef mozilla::dom::WebGPUBufferUsage NativeType;
3446
3447
  static const uint32_t NONE = 0;
3448
  static const uint32_t MAP_READ = 1;
3449
  static const uint32_t MAP_WRITE = 2;
3450
  static const uint32_t TRANSFER_SRC = 4;
3451
  static const uint32_t TRANSFER_DST = 8;
3452
  static const uint32_t INDEX = 16;
3453
  static const uint32_t VERTEX = 32;
3454
  static const uint32_t UNIFORM = 64;
3455
  static const uint32_t STORAGE = 128;
3456
  bool
3457
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
3458
3459
  // We declare this as an array so that retrieving a pointer to this
3460
  // binding's property hooks only requires compile/link-time resolvable
3461
  // address arithmetic.  Declaring it as a pointer instead would require
3462
  // doing a run-time load to fetch a pointer to this binding's property
3463
  // hooks.  And then structures which embedded a pointer to this structure
3464
  // would require a run-time load for proper initialization, which would
3465
  // then induce static constructors.  Lots of static constructors.
3466
  extern const NativePropertyHooks sNativePropertyHooks[];
3467
3468
  void
3469
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
3470
3471
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
3472
0
  {
3473
0
    /* Get the interface object for this class.  This will create the object as
3474
0
       needed. */
3475
0
3476
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUBufferUsage,
3477
0
                                       &CreateInterfaceObjects,
3478
0
                                       aDefineOnGlobal);
3479
0
  }
3480
3481
  JSObject*
3482
  GetConstructorObject(JSContext* aCx);
3483
3484
} // namespace WebGPUBufferUsage_Binding
3485
3486
3487
3488
namespace WebGPUColorWriteBits_Binding {
3489
3490
  typedef mozilla::dom::WebGPUColorWriteBits NativeType;
3491
3492
  static const uint32_t NONE = 0;
3493
  static const uint32_t RED = 1;
3494
  static const uint32_t GREEN = 2;
3495
  static const uint32_t BLUE = 4;
3496
  static const uint32_t ALPHA = 8;
3497
  static const uint32_t ALL = 15;
3498
  bool
3499
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
3500
3501
  // We declare this as an array so that retrieving a pointer to this
3502
  // binding's property hooks only requires compile/link-time resolvable
3503
  // address arithmetic.  Declaring it as a pointer instead would require
3504
  // doing a run-time load to fetch a pointer to this binding's property
3505
  // hooks.  And then structures which embedded a pointer to this structure
3506
  // would require a run-time load for proper initialization, which would
3507
  // then induce static constructors.  Lots of static constructors.
3508
  extern const NativePropertyHooks sNativePropertyHooks[];
3509
3510
  void
3511
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
3512
3513
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
3514
0
  {
3515
0
    /* Get the interface object for this class.  This will create the object as
3516
0
       needed. */
3517
0
3518
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUColorWriteBits,
3519
0
                                       &CreateInterfaceObjects,
3520
0
                                       aDefineOnGlobal);
3521
0
  }
3522
3523
  JSObject*
3524
  GetConstructorObject(JSContext* aCx);
3525
3526
} // namespace WebGPUColorWriteBits_Binding
3527
3528
3529
3530
namespace WebGPUCommandBuffer_Binding {
3531
3532
  typedef mozilla::webgpu::CommandBuffer NativeType;
3533
3534
  bool
3535
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
3536
3537
  const JSClass*
3538
  GetJSClass();
3539
3540
  bool
3541
  Wrap(JSContext* aCx, mozilla::webgpu::CommandBuffer* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
3542
3543
  template <class T>
3544
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
3545
0
  {
3546
0
    JS::Rooted<JSObject*> reflector(aCx);
3547
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
3548
0
  }
3549
3550
  // We declare this as an array so that retrieving a pointer to this
3551
  // binding's property hooks only requires compile/link-time resolvable
3552
  // address arithmetic.  Declaring it as a pointer instead would require
3553
  // doing a run-time load to fetch a pointer to this binding's property
3554
  // hooks.  And then structures which embedded a pointer to this structure
3555
  // would require a run-time load for proper initialization, which would
3556
  // then induce static constructors.  Lots of static constructors.
3557
  extern const NativePropertyHooks sNativePropertyHooks[];
3558
3559
  void
3560
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
3561
3562
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
3563
0
  {
3564
0
    /* Get the interface prototype object for this class.  This will create the
3565
0
       object as needed. */
3566
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPUCommandBuffer,
3567
0
                                       &CreateInterfaceObjects,
3568
0
                                       /* aDefineOnGlobal = */ true);
3569
0
3570
0
  }
3571
3572
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
3573
0
  {
3574
0
    /* Get the interface object for this class.  This will create the object as
3575
0
       needed. */
3576
0
3577
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUCommandBuffer,
3578
0
                                       &CreateInterfaceObjects,
3579
0
                                       aDefineOnGlobal);
3580
0
  }
3581
3582
  JSObject*
3583
  GetConstructorObject(JSContext* aCx);
3584
3585
} // namespace WebGPUCommandBuffer_Binding
3586
3587
3588
3589
namespace WebGPUCommandEncoder_Binding {
3590
3591
  typedef mozilla::webgpu::CommandEncoder NativeType;
3592
3593
  bool
3594
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
3595
3596
  const JSClass*
3597
  GetJSClass();
3598
3599
  bool
3600
  Wrap(JSContext* aCx, mozilla::webgpu::CommandEncoder* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
3601
3602
  template <class T>
3603
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
3604
0
  {
3605
0
    JS::Rooted<JSObject*> reflector(aCx);
3606
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
3607
0
  }
3608
3609
  // We declare this as an array so that retrieving a pointer to this
3610
  // binding's property hooks only requires compile/link-time resolvable
3611
  // address arithmetic.  Declaring it as a pointer instead would require
3612
  // doing a run-time load to fetch a pointer to this binding's property
3613
  // hooks.  And then structures which embedded a pointer to this structure
3614
  // would require a run-time load for proper initialization, which would
3615
  // then induce static constructors.  Lots of static constructors.
3616
  extern const NativePropertyHooks sNativePropertyHooks[];
3617
3618
  void
3619
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
3620
3621
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
3622
0
  {
3623
0
    /* Get the interface prototype object for this class.  This will create the
3624
0
       object as needed. */
3625
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPUCommandEncoder,
3626
0
                                       &CreateInterfaceObjects,
3627
0
                                       /* aDefineOnGlobal = */ true);
3628
0
3629
0
  }
3630
3631
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
3632
0
  {
3633
0
    /* Get the interface object for this class.  This will create the object as
3634
0
       needed. */
3635
0
3636
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUCommandEncoder,
3637
0
                                       &CreateInterfaceObjects,
3638
0
                                       aDefineOnGlobal);
3639
0
  }
3640
3641
  JSObject*
3642
  GetConstructorObject(JSContext* aCx);
3643
3644
} // namespace WebGPUCommandEncoder_Binding
3645
3646
3647
3648
namespace WebGPUCompareFunction_Binding {
3649
3650
  typedef mozilla::dom::WebGPUCompareFunction NativeType;
3651
3652
  static const uint32_t NEVER = 0;
3653
  static const uint32_t LESS = 1;
3654
  static const uint32_t LESS_EQUAL = 2;
3655
  static const uint32_t GREATER = 3;
3656
  static const uint32_t GREATER_EQUAL = 4;
3657
  static const uint32_t EQUAL = 5;
3658
  static const uint32_t NOT_EQUAL = 6;
3659
  static const uint32_t ALWAYS = 7;
3660
  bool
3661
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
3662
3663
  // We declare this as an array so that retrieving a pointer to this
3664
  // binding's property hooks only requires compile/link-time resolvable
3665
  // address arithmetic.  Declaring it as a pointer instead would require
3666
  // doing a run-time load to fetch a pointer to this binding's property
3667
  // hooks.  And then structures which embedded a pointer to this structure
3668
  // would require a run-time load for proper initialization, which would
3669
  // then induce static constructors.  Lots of static constructors.
3670
  extern const NativePropertyHooks sNativePropertyHooks[];
3671
3672
  void
3673
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
3674
3675
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
3676
0
  {
3677
0
    /* Get the interface object for this class.  This will create the object as
3678
0
       needed. */
3679
0
3680
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUCompareFunction,
3681
0
                                       &CreateInterfaceObjects,
3682
0
                                       aDefineOnGlobal);
3683
0
  }
3684
3685
  JSObject*
3686
  GetConstructorObject(JSContext* aCx);
3687
3688
} // namespace WebGPUCompareFunction_Binding
3689
3690
3691
3692
namespace WebGPUComputePipeline_Binding {
3693
3694
  typedef mozilla::webgpu::ComputePipeline NativeType;
3695
3696
  bool
3697
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
3698
3699
  const JSClass*
3700
  GetJSClass();
3701
3702
  bool
3703
  Wrap(JSContext* aCx, mozilla::webgpu::ComputePipeline* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
3704
3705
  template <class T>
3706
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
3707
0
  {
3708
0
    JS::Rooted<JSObject*> reflector(aCx);
3709
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
3710
0
  }
3711
3712
  // We declare this as an array so that retrieving a pointer to this
3713
  // binding's property hooks only requires compile/link-time resolvable
3714
  // address arithmetic.  Declaring it as a pointer instead would require
3715
  // doing a run-time load to fetch a pointer to this binding's property
3716
  // hooks.  And then structures which embedded a pointer to this structure
3717
  // would require a run-time load for proper initialization, which would
3718
  // then induce static constructors.  Lots of static constructors.
3719
  extern const NativePropertyHooks sNativePropertyHooks[];
3720
3721
  void
3722
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
3723
3724
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
3725
0
  {
3726
0
    /* Get the interface prototype object for this class.  This will create the
3727
0
       object as needed. */
3728
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPUComputePipeline,
3729
0
                                       &CreateInterfaceObjects,
3730
0
                                       /* aDefineOnGlobal = */ true);
3731
0
3732
0
  }
3733
3734
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
3735
0
  {
3736
0
    /* Get the interface object for this class.  This will create the object as
3737
0
       needed. */
3738
0
3739
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUComputePipeline,
3740
0
                                       &CreateInterfaceObjects,
3741
0
                                       aDefineOnGlobal);
3742
0
  }
3743
3744
  JSObject*
3745
  GetConstructorObject(JSContext* aCx);
3746
3747
} // namespace WebGPUComputePipeline_Binding
3748
3749
3750
3751
namespace WebGPUDepthStencilState_Binding {
3752
3753
  typedef mozilla::webgpu::DepthStencilState NativeType;
3754
3755
  bool
3756
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
3757
3758
  const JSClass*
3759
  GetJSClass();
3760
3761
  bool
3762
  Wrap(JSContext* aCx, mozilla::webgpu::DepthStencilState* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
3763
3764
  template <class T>
3765
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
3766
0
  {
3767
0
    JS::Rooted<JSObject*> reflector(aCx);
3768
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
3769
0
  }
3770
3771
  // We declare this as an array so that retrieving a pointer to this
3772
  // binding's property hooks only requires compile/link-time resolvable
3773
  // address arithmetic.  Declaring it as a pointer instead would require
3774
  // doing a run-time load to fetch a pointer to this binding's property
3775
  // hooks.  And then structures which embedded a pointer to this structure
3776
  // would require a run-time load for proper initialization, which would
3777
  // then induce static constructors.  Lots of static constructors.
3778
  extern const NativePropertyHooks sNativePropertyHooks[];
3779
3780
  void
3781
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
3782
3783
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
3784
0
  {
3785
0
    /* Get the interface prototype object for this class.  This will create the
3786
0
       object as needed. */
3787
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPUDepthStencilState,
3788
0
                                       &CreateInterfaceObjects,
3789
0
                                       /* aDefineOnGlobal = */ true);
3790
0
3791
0
  }
3792
3793
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
3794
0
  {
3795
0
    /* Get the interface object for this class.  This will create the object as
3796
0
       needed. */
3797
0
3798
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUDepthStencilState,
3799
0
                                       &CreateInterfaceObjects,
3800
0
                                       aDefineOnGlobal);
3801
0
  }
3802
3803
  JSObject*
3804
  GetConstructorObject(JSContext* aCx);
3805
3806
} // namespace WebGPUDepthStencilState_Binding
3807
3808
3809
3810
namespace WebGPUDevice_Binding {
3811
3812
  typedef mozilla::webgpu::Device NativeType;
3813
3814
  bool
3815
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
3816
3817
  const JSClass*
3818
  GetJSClass();
3819
3820
  bool
3821
  Wrap(JSContext* aCx, mozilla::webgpu::Device* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
3822
3823
  template <class T>
3824
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
3825
0
  {
3826
0
    JS::Rooted<JSObject*> reflector(aCx);
3827
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
3828
0
  }
3829
3830
  // We declare this as an array so that retrieving a pointer to this
3831
  // binding's property hooks only requires compile/link-time resolvable
3832
  // address arithmetic.  Declaring it as a pointer instead would require
3833
  // doing a run-time load to fetch a pointer to this binding's property
3834
  // hooks.  And then structures which embedded a pointer to this structure
3835
  // would require a run-time load for proper initialization, which would
3836
  // then induce static constructors.  Lots of static constructors.
3837
  extern const NativePropertyHooks sNativePropertyHooks[];
3838
3839
  void
3840
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
3841
3842
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
3843
0
  {
3844
0
    /* Get the interface prototype object for this class.  This will create the
3845
0
       object as needed. */
3846
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPUDevice,
3847
0
                                       &CreateInterfaceObjects,
3848
0
                                       /* aDefineOnGlobal = */ true);
3849
0
3850
0
  }
3851
3852
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
3853
0
  {
3854
0
    /* Get the interface object for this class.  This will create the object as
3855
0
       needed. */
3856
0
3857
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUDevice,
3858
0
                                       &CreateInterfaceObjects,
3859
0
                                       aDefineOnGlobal);
3860
0
  }
3861
3862
  JSObject*
3863
  GetConstructorObject(JSContext* aCx);
3864
3865
} // namespace WebGPUDevice_Binding
3866
3867
3868
3869
namespace WebGPUFence_Binding {
3870
3871
  typedef mozilla::webgpu::Fence NativeType;
3872
3873
  bool
3874
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
3875
3876
  const JSClass*
3877
  GetJSClass();
3878
3879
  bool
3880
  Wrap(JSContext* aCx, mozilla::webgpu::Fence* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
3881
3882
  template <class T>
3883
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
3884
0
  {
3885
0
    JS::Rooted<JSObject*> reflector(aCx);
3886
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
3887
0
  }
3888
3889
  // We declare this as an array so that retrieving a pointer to this
3890
  // binding's property hooks only requires compile/link-time resolvable
3891
  // address arithmetic.  Declaring it as a pointer instead would require
3892
  // doing a run-time load to fetch a pointer to this binding's property
3893
  // hooks.  And then structures which embedded a pointer to this structure
3894
  // would require a run-time load for proper initialization, which would
3895
  // then induce static constructors.  Lots of static constructors.
3896
  extern const NativePropertyHooks sNativePropertyHooks[];
3897
3898
  void
3899
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
3900
3901
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
3902
0
  {
3903
0
    /* Get the interface prototype object for this class.  This will create the
3904
0
       object as needed. */
3905
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPUFence,
3906
0
                                       &CreateInterfaceObjects,
3907
0
                                       /* aDefineOnGlobal = */ true);
3908
0
3909
0
  }
3910
3911
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
3912
0
  {
3913
0
    /* Get the interface object for this class.  This will create the object as
3914
0
       needed. */
3915
0
3916
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUFence,
3917
0
                                       &CreateInterfaceObjects,
3918
0
                                       aDefineOnGlobal);
3919
0
  }
3920
3921
  JSObject*
3922
  GetConstructorObject(JSContext* aCx);
3923
3924
} // namespace WebGPUFence_Binding
3925
3926
3927
3928
namespace WebGPUFilterMode_Binding {
3929
3930
  typedef mozilla::dom::WebGPUFilterMode NativeType;
3931
3932
  static const uint32_t NEAREST = 0;
3933
  static const uint32_t LINEAR = 1;
3934
  bool
3935
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
3936
3937
  // We declare this as an array so that retrieving a pointer to this
3938
  // binding's property hooks only requires compile/link-time resolvable
3939
  // address arithmetic.  Declaring it as a pointer instead would require
3940
  // doing a run-time load to fetch a pointer to this binding's property
3941
  // hooks.  And then structures which embedded a pointer to this structure
3942
  // would require a run-time load for proper initialization, which would
3943
  // then induce static constructors.  Lots of static constructors.
3944
  extern const NativePropertyHooks sNativePropertyHooks[];
3945
3946
  void
3947
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
3948
3949
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
3950
0
  {
3951
0
    /* Get the interface object for this class.  This will create the object as
3952
0
       needed. */
3953
0
3954
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUFilterMode,
3955
0
                                       &CreateInterfaceObjects,
3956
0
                                       aDefineOnGlobal);
3957
0
  }
3958
3959
  JSObject*
3960
  GetConstructorObject(JSContext* aCx);
3961
3962
} // namespace WebGPUFilterMode_Binding
3963
3964
3965
3966
namespace WebGPUIndexFormat_Binding {
3967
3968
  typedef mozilla::dom::WebGPUIndexFormat NativeType;
3969
3970
  static const uint32_t UINT16 = 0;
3971
  static const uint32_t UINT32 = 1;
3972
  bool
3973
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
3974
3975
  // We declare this as an array so that retrieving a pointer to this
3976
  // binding's property hooks only requires compile/link-time resolvable
3977
  // address arithmetic.  Declaring it as a pointer instead would require
3978
  // doing a run-time load to fetch a pointer to this binding's property
3979
  // hooks.  And then structures which embedded a pointer to this structure
3980
  // would require a run-time load for proper initialization, which would
3981
  // then induce static constructors.  Lots of static constructors.
3982
  extern const NativePropertyHooks sNativePropertyHooks[];
3983
3984
  void
3985
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
3986
3987
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
3988
0
  {
3989
0
    /* Get the interface object for this class.  This will create the object as
3990
0
       needed. */
3991
0
3992
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUIndexFormat,
3993
0
                                       &CreateInterfaceObjects,
3994
0
                                       aDefineOnGlobal);
3995
0
  }
3996
3997
  JSObject*
3998
  GetConstructorObject(JSContext* aCx);
3999
4000
} // namespace WebGPUIndexFormat_Binding
4001
4002
4003
4004
namespace WebGPUInputState_Binding {
4005
4006
  typedef mozilla::webgpu::InputState NativeType;
4007
4008
  bool
4009
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
4010
4011
  const JSClass*
4012
  GetJSClass();
4013
4014
  bool
4015
  Wrap(JSContext* aCx, mozilla::webgpu::InputState* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
4016
4017
  template <class T>
4018
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
4019
0
  {
4020
0
    JS::Rooted<JSObject*> reflector(aCx);
4021
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
4022
0
  }
4023
4024
  // We declare this as an array so that retrieving a pointer to this
4025
  // binding's property hooks only requires compile/link-time resolvable
4026
  // address arithmetic.  Declaring it as a pointer instead would require
4027
  // doing a run-time load to fetch a pointer to this binding's property
4028
  // hooks.  And then structures which embedded a pointer to this structure
4029
  // would require a run-time load for proper initialization, which would
4030
  // then induce static constructors.  Lots of static constructors.
4031
  extern const NativePropertyHooks sNativePropertyHooks[];
4032
4033
  void
4034
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
4035
4036
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
4037
0
  {
4038
0
    /* Get the interface prototype object for this class.  This will create the
4039
0
       object as needed. */
4040
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPUInputState,
4041
0
                                       &CreateInterfaceObjects,
4042
0
                                       /* aDefineOnGlobal = */ true);
4043
0
4044
0
  }
4045
4046
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
4047
0
  {
4048
0
    /* Get the interface object for this class.  This will create the object as
4049
0
       needed. */
4050
0
4051
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUInputState,
4052
0
                                       &CreateInterfaceObjects,
4053
0
                                       aDefineOnGlobal);
4054
0
  }
4055
4056
  JSObject*
4057
  GetConstructorObject(JSContext* aCx);
4058
4059
} // namespace WebGPUInputState_Binding
4060
4061
4062
4063
namespace WebGPUInputStepMode_Binding {
4064
4065
  typedef mozilla::dom::WebGPUInputStepMode NativeType;
4066
4067
  static const uint32_t VERTEX = 0;
4068
  static const uint32_t INSTANCE = 1;
4069
  bool
4070
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
4071
4072
  // We declare this as an array so that retrieving a pointer to this
4073
  // binding's property hooks only requires compile/link-time resolvable
4074
  // address arithmetic.  Declaring it as a pointer instead would require
4075
  // doing a run-time load to fetch a pointer to this binding's property
4076
  // hooks.  And then structures which embedded a pointer to this structure
4077
  // would require a run-time load for proper initialization, which would
4078
  // then induce static constructors.  Lots of static constructors.
4079
  extern const NativePropertyHooks sNativePropertyHooks[];
4080
4081
  void
4082
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
4083
4084
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
4085
0
  {
4086
0
    /* Get the interface object for this class.  This will create the object as
4087
0
       needed. */
4088
0
4089
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUInputStepMode,
4090
0
                                       &CreateInterfaceObjects,
4091
0
                                       aDefineOnGlobal);
4092
0
  }
4093
4094
  JSObject*
4095
  GetConstructorObject(JSContext* aCx);
4096
4097
} // namespace WebGPUInputStepMode_Binding
4098
4099
4100
4101
namespace WebGPULoadOp_Binding {
4102
4103
  typedef mozilla::dom::WebGPULoadOp NativeType;
4104
4105
  static const uint32_t CLEAR = 0;
4106
  static const uint32_t LOAD = 1;
4107
  bool
4108
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
4109
4110
  // We declare this as an array so that retrieving a pointer to this
4111
  // binding's property hooks only requires compile/link-time resolvable
4112
  // address arithmetic.  Declaring it as a pointer instead would require
4113
  // doing a run-time load to fetch a pointer to this binding's property
4114
  // hooks.  And then structures which embedded a pointer to this structure
4115
  // would require a run-time load for proper initialization, which would
4116
  // then induce static constructors.  Lots of static constructors.
4117
  extern const NativePropertyHooks sNativePropertyHooks[];
4118
4119
  void
4120
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
4121
4122
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
4123
0
  {
4124
0
    /* Get the interface object for this class.  This will create the object as
4125
0
       needed. */
4126
0
4127
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPULoadOp,
4128
0
                                       &CreateInterfaceObjects,
4129
0
                                       aDefineOnGlobal);
4130
0
  }
4131
4132
  JSObject*
4133
  GetConstructorObject(JSContext* aCx);
4134
4135
} // namespace WebGPULoadOp_Binding
4136
4137
4138
4139
namespace WebGPULogEntry_Binding {
4140
4141
  typedef mozilla::webgpu::LogEntry NativeType;
4142
4143
  bool
4144
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
4145
4146
  const JSClass*
4147
  GetJSClass();
4148
4149
  bool
4150
  Wrap(JSContext* aCx, mozilla::webgpu::LogEntry* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
4151
4152
  template <class T>
4153
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
4154
0
  {
4155
0
    JS::Rooted<JSObject*> reflector(aCx);
4156
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
4157
0
  }
4158
4159
  // We declare this as an array so that retrieving a pointer to this
4160
  // binding's property hooks only requires compile/link-time resolvable
4161
  // address arithmetic.  Declaring it as a pointer instead would require
4162
  // doing a run-time load to fetch a pointer to this binding's property
4163
  // hooks.  And then structures which embedded a pointer to this structure
4164
  // would require a run-time load for proper initialization, which would
4165
  // then induce static constructors.  Lots of static constructors.
4166
  extern const NativePropertyHooks sNativePropertyHooks[];
4167
4168
  void
4169
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
4170
4171
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
4172
0
  {
4173
0
    /* Get the interface prototype object for this class.  This will create the
4174
0
       object as needed. */
4175
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPULogEntry,
4176
0
                                       &CreateInterfaceObjects,
4177
0
                                       /* aDefineOnGlobal = */ true);
4178
0
4179
0
  }
4180
4181
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
4182
0
  {
4183
0
    /* Get the interface object for this class.  This will create the object as
4184
0
       needed. */
4185
0
4186
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPULogEntry,
4187
0
                                       &CreateInterfaceObjects,
4188
0
                                       aDefineOnGlobal);
4189
0
  }
4190
4191
  JSObject*
4192
  GetConstructorObject(JSContext* aCx);
4193
4194
} // namespace WebGPULogEntry_Binding
4195
4196
4197
4198
namespace WebGPUPipelineLayout_Binding {
4199
4200
  typedef mozilla::webgpu::PipelineLayout NativeType;
4201
4202
  bool
4203
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
4204
4205
  const JSClass*
4206
  GetJSClass();
4207
4208
  bool
4209
  Wrap(JSContext* aCx, mozilla::webgpu::PipelineLayout* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
4210
4211
  template <class T>
4212
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
4213
0
  {
4214
0
    JS::Rooted<JSObject*> reflector(aCx);
4215
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
4216
0
  }
4217
4218
  // We declare this as an array so that retrieving a pointer to this
4219
  // binding's property hooks only requires compile/link-time resolvable
4220
  // address arithmetic.  Declaring it as a pointer instead would require
4221
  // doing a run-time load to fetch a pointer to this binding's property
4222
  // hooks.  And then structures which embedded a pointer to this structure
4223
  // would require a run-time load for proper initialization, which would
4224
  // then induce static constructors.  Lots of static constructors.
4225
  extern const NativePropertyHooks sNativePropertyHooks[];
4226
4227
  void
4228
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
4229
4230
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
4231
0
  {
4232
0
    /* Get the interface prototype object for this class.  This will create the
4233
0
       object as needed. */
4234
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPUPipelineLayout,
4235
0
                                       &CreateInterfaceObjects,
4236
0
                                       /* aDefineOnGlobal = */ true);
4237
0
4238
0
  }
4239
4240
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
4241
0
  {
4242
0
    /* Get the interface object for this class.  This will create the object as
4243
0
       needed. */
4244
0
4245
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUPipelineLayout,
4246
0
                                       &CreateInterfaceObjects,
4247
0
                                       aDefineOnGlobal);
4248
0
  }
4249
4250
  JSObject*
4251
  GetConstructorObject(JSContext* aCx);
4252
4253
} // namespace WebGPUPipelineLayout_Binding
4254
4255
4256
4257
namespace WebGPUPrimitiveTopology_Binding {
4258
4259
  typedef mozilla::dom::WebGPUPrimitiveTopology NativeType;
4260
4261
  static const uint32_t POINT_LIST = 0;
4262
  static const uint32_t LINE_LIST = 1;
4263
  static const uint32_t LINE_STRIP = 2;
4264
  static const uint32_t TRIANGLE_LIST = 3;
4265
  static const uint32_t TRIANGLE_STRIP = 4;
4266
  bool
4267
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
4268
4269
  // We declare this as an array so that retrieving a pointer to this
4270
  // binding's property hooks only requires compile/link-time resolvable
4271
  // address arithmetic.  Declaring it as a pointer instead would require
4272
  // doing a run-time load to fetch a pointer to this binding's property
4273
  // hooks.  And then structures which embedded a pointer to this structure
4274
  // would require a run-time load for proper initialization, which would
4275
  // then induce static constructors.  Lots of static constructors.
4276
  extern const NativePropertyHooks sNativePropertyHooks[];
4277
4278
  void
4279
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
4280
4281
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
4282
0
  {
4283
0
    /* Get the interface object for this class.  This will create the object as
4284
0
       needed. */
4285
0
4286
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUPrimitiveTopology,
4287
0
                                       &CreateInterfaceObjects,
4288
0
                                       aDefineOnGlobal);
4289
0
  }
4290
4291
  JSObject*
4292
  GetConstructorObject(JSContext* aCx);
4293
4294
} // namespace WebGPUPrimitiveTopology_Binding
4295
4296
4297
4298
namespace WebGPUQueue_Binding {
4299
4300
  typedef mozilla::webgpu::Queue NativeType;
4301
4302
  bool
4303
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
4304
4305
  const JSClass*
4306
  GetJSClass();
4307
4308
  bool
4309
  Wrap(JSContext* aCx, mozilla::webgpu::Queue* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
4310
4311
  template <class T>
4312
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
4313
0
  {
4314
0
    JS::Rooted<JSObject*> reflector(aCx);
4315
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
4316
0
  }
4317
4318
  // We declare this as an array so that retrieving a pointer to this
4319
  // binding's property hooks only requires compile/link-time resolvable
4320
  // address arithmetic.  Declaring it as a pointer instead would require
4321
  // doing a run-time load to fetch a pointer to this binding's property
4322
  // hooks.  And then structures which embedded a pointer to this structure
4323
  // would require a run-time load for proper initialization, which would
4324
  // then induce static constructors.  Lots of static constructors.
4325
  extern const NativePropertyHooks sNativePropertyHooks[];
4326
4327
  void
4328
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
4329
4330
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
4331
0
  {
4332
0
    /* Get the interface prototype object for this class.  This will create the
4333
0
       object as needed. */
4334
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPUQueue,
4335
0
                                       &CreateInterfaceObjects,
4336
0
                                       /* aDefineOnGlobal = */ true);
4337
0
4338
0
  }
4339
4340
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
4341
0
  {
4342
0
    /* Get the interface object for this class.  This will create the object as
4343
0
       needed. */
4344
0
4345
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUQueue,
4346
0
                                       &CreateInterfaceObjects,
4347
0
                                       aDefineOnGlobal);
4348
0
  }
4349
4350
  JSObject*
4351
  GetConstructorObject(JSContext* aCx);
4352
4353
} // namespace WebGPUQueue_Binding
4354
4355
4356
4357
namespace WebGPURenderPipeline_Binding {
4358
4359
  typedef mozilla::webgpu::RenderPipeline NativeType;
4360
4361
  bool
4362
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
4363
4364
  const JSClass*
4365
  GetJSClass();
4366
4367
  bool
4368
  Wrap(JSContext* aCx, mozilla::webgpu::RenderPipeline* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
4369
4370
  template <class T>
4371
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
4372
0
  {
4373
0
    JS::Rooted<JSObject*> reflector(aCx);
4374
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
4375
0
  }
4376
4377
  // We declare this as an array so that retrieving a pointer to this
4378
  // binding's property hooks only requires compile/link-time resolvable
4379
  // address arithmetic.  Declaring it as a pointer instead would require
4380
  // doing a run-time load to fetch a pointer to this binding's property
4381
  // hooks.  And then structures which embedded a pointer to this structure
4382
  // would require a run-time load for proper initialization, which would
4383
  // then induce static constructors.  Lots of static constructors.
4384
  extern const NativePropertyHooks sNativePropertyHooks[];
4385
4386
  void
4387
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
4388
4389
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
4390
0
  {
4391
0
    /* Get the interface prototype object for this class.  This will create the
4392
0
       object as needed. */
4393
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPURenderPipeline,
4394
0
                                       &CreateInterfaceObjects,
4395
0
                                       /* aDefineOnGlobal = */ true);
4396
0
4397
0
  }
4398
4399
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
4400
0
  {
4401
0
    /* Get the interface object for this class.  This will create the object as
4402
0
       needed. */
4403
0
4404
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPURenderPipeline,
4405
0
                                       &CreateInterfaceObjects,
4406
0
                                       aDefineOnGlobal);
4407
0
  }
4408
4409
  JSObject*
4410
  GetConstructorObject(JSContext* aCx);
4411
4412
} // namespace WebGPURenderPipeline_Binding
4413
4414
4415
4416
namespace WebGPUSampler_Binding {
4417
4418
  typedef mozilla::webgpu::Sampler NativeType;
4419
4420
  bool
4421
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
4422
4423
  const JSClass*
4424
  GetJSClass();
4425
4426
  bool
4427
  Wrap(JSContext* aCx, mozilla::webgpu::Sampler* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
4428
4429
  template <class T>
4430
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
4431
0
  {
4432
0
    JS::Rooted<JSObject*> reflector(aCx);
4433
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
4434
0
  }
4435
4436
  // We declare this as an array so that retrieving a pointer to this
4437
  // binding's property hooks only requires compile/link-time resolvable
4438
  // address arithmetic.  Declaring it as a pointer instead would require
4439
  // doing a run-time load to fetch a pointer to this binding's property
4440
  // hooks.  And then structures which embedded a pointer to this structure
4441
  // would require a run-time load for proper initialization, which would
4442
  // then induce static constructors.  Lots of static constructors.
4443
  extern const NativePropertyHooks sNativePropertyHooks[];
4444
4445
  void
4446
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
4447
4448
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
4449
0
  {
4450
0
    /* Get the interface prototype object for this class.  This will create the
4451
0
       object as needed. */
4452
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPUSampler,
4453
0
                                       &CreateInterfaceObjects,
4454
0
                                       /* aDefineOnGlobal = */ true);
4455
0
4456
0
  }
4457
4458
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
4459
0
  {
4460
0
    /* Get the interface object for this class.  This will create the object as
4461
0
       needed. */
4462
0
4463
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUSampler,
4464
0
                                       &CreateInterfaceObjects,
4465
0
                                       aDefineOnGlobal);
4466
0
  }
4467
4468
  JSObject*
4469
  GetConstructorObject(JSContext* aCx);
4470
4471
} // namespace WebGPUSampler_Binding
4472
4473
4474
4475
namespace WebGPUShaderModule_Binding {
4476
4477
  typedef mozilla::webgpu::ShaderModule NativeType;
4478
4479
  bool
4480
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
4481
4482
  const JSClass*
4483
  GetJSClass();
4484
4485
  bool
4486
  Wrap(JSContext* aCx, mozilla::webgpu::ShaderModule* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
4487
4488
  template <class T>
4489
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
4490
0
  {
4491
0
    JS::Rooted<JSObject*> reflector(aCx);
4492
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
4493
0
  }
4494
4495
  // We declare this as an array so that retrieving a pointer to this
4496
  // binding's property hooks only requires compile/link-time resolvable
4497
  // address arithmetic.  Declaring it as a pointer instead would require
4498
  // doing a run-time load to fetch a pointer to this binding's property
4499
  // hooks.  And then structures which embedded a pointer to this structure
4500
  // would require a run-time load for proper initialization, which would
4501
  // then induce static constructors.  Lots of static constructors.
4502
  extern const NativePropertyHooks sNativePropertyHooks[];
4503
4504
  void
4505
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
4506
4507
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
4508
0
  {
4509
0
    /* Get the interface prototype object for this class.  This will create the
4510
0
       object as needed. */
4511
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPUShaderModule,
4512
0
                                       &CreateInterfaceObjects,
4513
0
                                       /* aDefineOnGlobal = */ true);
4514
0
4515
0
  }
4516
4517
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
4518
0
  {
4519
0
    /* Get the interface object for this class.  This will create the object as
4520
0
       needed. */
4521
0
4522
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUShaderModule,
4523
0
                                       &CreateInterfaceObjects,
4524
0
                                       aDefineOnGlobal);
4525
0
  }
4526
4527
  JSObject*
4528
  GetConstructorObject(JSContext* aCx);
4529
4530
} // namespace WebGPUShaderModule_Binding
4531
4532
4533
4534
namespace WebGPUShaderStage_Binding {
4535
4536
  typedef mozilla::dom::WebGPUShaderStage NativeType;
4537
4538
  static const uint32_t VERTEX = 0;
4539
  static const uint32_t FRAGMENT = 1;
4540
  static const uint32_t COMPUTE = 2;
4541
  bool
4542
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
4543
4544
  // We declare this as an array so that retrieving a pointer to this
4545
  // binding's property hooks only requires compile/link-time resolvable
4546
  // address arithmetic.  Declaring it as a pointer instead would require
4547
  // doing a run-time load to fetch a pointer to this binding's property
4548
  // hooks.  And then structures which embedded a pointer to this structure
4549
  // would require a run-time load for proper initialization, which would
4550
  // then induce static constructors.  Lots of static constructors.
4551
  extern const NativePropertyHooks sNativePropertyHooks[];
4552
4553
  void
4554
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
4555
4556
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
4557
0
  {
4558
0
    /* Get the interface object for this class.  This will create the object as
4559
0
       needed. */
4560
0
4561
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUShaderStage,
4562
0
                                       &CreateInterfaceObjects,
4563
0
                                       aDefineOnGlobal);
4564
0
  }
4565
4566
  JSObject*
4567
  GetConstructorObject(JSContext* aCx);
4568
4569
} // namespace WebGPUShaderStage_Binding
4570
4571
4572
4573
namespace WebGPUShaderStageBit_Binding {
4574
4575
  typedef mozilla::dom::WebGPUShaderStageBit NativeType;
4576
4577
  static const uint32_t NONE = 0;
4578
  static const uint32_t VERTEX = 1;
4579
  static const uint32_t FRAGMENT = 2;
4580
  static const uint32_t COMPUTE = 4;
4581
  bool
4582
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
4583
4584
  // We declare this as an array so that retrieving a pointer to this
4585
  // binding's property hooks only requires compile/link-time resolvable
4586
  // address arithmetic.  Declaring it as a pointer instead would require
4587
  // doing a run-time load to fetch a pointer to this binding's property
4588
  // hooks.  And then structures which embedded a pointer to this structure
4589
  // would require a run-time load for proper initialization, which would
4590
  // then induce static constructors.  Lots of static constructors.
4591
  extern const NativePropertyHooks sNativePropertyHooks[];
4592
4593
  void
4594
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
4595
4596
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
4597
0
  {
4598
0
    /* Get the interface object for this class.  This will create the object as
4599
0
       needed. */
4600
0
4601
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUShaderStageBit,
4602
0
                                       &CreateInterfaceObjects,
4603
0
                                       aDefineOnGlobal);
4604
0
  }
4605
4606
  JSObject*
4607
  GetConstructorObject(JSContext* aCx);
4608
4609
} // namespace WebGPUShaderStageBit_Binding
4610
4611
4612
4613
namespace WebGPUStencilOperation_Binding {
4614
4615
  typedef mozilla::dom::WebGPUStencilOperation NativeType;
4616
4617
  static const uint32_t KEEP = 0;
4618
  static const uint32_t ZERO = 1;
4619
  static const uint32_t REPLACE = 2;
4620
  static const uint32_t INVERT = 3;
4621
  static const uint32_t INCREMENT_CLAMP = 4;
4622
  static const uint32_t DECREMENT_CLAMP = 5;
4623
  static const uint32_t INCREMENT_WRAP = 6;
4624
  static const uint32_t DECREMENT_WRAP = 7;
4625
  bool
4626
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
4627
4628
  // We declare this as an array so that retrieving a pointer to this
4629
  // binding's property hooks only requires compile/link-time resolvable
4630
  // address arithmetic.  Declaring it as a pointer instead would require
4631
  // doing a run-time load to fetch a pointer to this binding's property
4632
  // hooks.  And then structures which embedded a pointer to this structure
4633
  // would require a run-time load for proper initialization, which would
4634
  // then induce static constructors.  Lots of static constructors.
4635
  extern const NativePropertyHooks sNativePropertyHooks[];
4636
4637
  void
4638
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
4639
4640
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
4641
0
  {
4642
0
    /* Get the interface object for this class.  This will create the object as
4643
0
       needed. */
4644
0
4645
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUStencilOperation,
4646
0
                                       &CreateInterfaceObjects,
4647
0
                                       aDefineOnGlobal);
4648
0
  }
4649
4650
  JSObject*
4651
  GetConstructorObject(JSContext* aCx);
4652
4653
} // namespace WebGPUStencilOperation_Binding
4654
4655
4656
4657
namespace WebGPUStoreOp_Binding {
4658
4659
  typedef mozilla::dom::WebGPUStoreOp NativeType;
4660
4661
  static const uint32_t STORE = 0;
4662
  bool
4663
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
4664
4665
  // We declare this as an array so that retrieving a pointer to this
4666
  // binding's property hooks only requires compile/link-time resolvable
4667
  // address arithmetic.  Declaring it as a pointer instead would require
4668
  // doing a run-time load to fetch a pointer to this binding's property
4669
  // hooks.  And then structures which embedded a pointer to this structure
4670
  // would require a run-time load for proper initialization, which would
4671
  // then induce static constructors.  Lots of static constructors.
4672
  extern const NativePropertyHooks sNativePropertyHooks[];
4673
4674
  void
4675
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
4676
4677
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
4678
0
  {
4679
0
    /* Get the interface object for this class.  This will create the object as
4680
0
       needed. */
4681
0
4682
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUStoreOp,
4683
0
                                       &CreateInterfaceObjects,
4684
0
                                       aDefineOnGlobal);
4685
0
  }
4686
4687
  JSObject*
4688
  GetConstructorObject(JSContext* aCx);
4689
4690
} // namespace WebGPUStoreOp_Binding
4691
4692
4693
4694
namespace WebGPUSwapChain_Binding {
4695
4696
  typedef mozilla::webgpu::SwapChain NativeType;
4697
4698
  bool
4699
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
4700
4701
  const JSClass*
4702
  GetJSClass();
4703
4704
  bool
4705
  Wrap(JSContext* aCx, mozilla::webgpu::SwapChain* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
4706
4707
  template <class T>
4708
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
4709
0
  {
4710
0
    JS::Rooted<JSObject*> reflector(aCx);
4711
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
4712
0
  }
4713
4714
  // We declare this as an array so that retrieving a pointer to this
4715
  // binding's property hooks only requires compile/link-time resolvable
4716
  // address arithmetic.  Declaring it as a pointer instead would require
4717
  // doing a run-time load to fetch a pointer to this binding's property
4718
  // hooks.  And then structures which embedded a pointer to this structure
4719
  // would require a run-time load for proper initialization, which would
4720
  // then induce static constructors.  Lots of static constructors.
4721
  extern const NativePropertyHooks sNativePropertyHooks[];
4722
4723
  void
4724
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
4725
4726
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
4727
0
  {
4728
0
    /* Get the interface prototype object for this class.  This will create the
4729
0
       object as needed. */
4730
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPUSwapChain,
4731
0
                                       &CreateInterfaceObjects,
4732
0
                                       /* aDefineOnGlobal = */ true);
4733
0
4734
0
  }
4735
4736
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
4737
0
  {
4738
0
    /* Get the interface object for this class.  This will create the object as
4739
0
       needed. */
4740
0
4741
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUSwapChain,
4742
0
                                       &CreateInterfaceObjects,
4743
0
                                       aDefineOnGlobal);
4744
0
  }
4745
4746
  JSObject*
4747
  GetConstructorObject(JSContext* aCx);
4748
4749
} // namespace WebGPUSwapChain_Binding
4750
4751
4752
4753
namespace WebGPUTexture_Binding {
4754
4755
  typedef mozilla::webgpu::Texture NativeType;
4756
4757
  bool
4758
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
4759
4760
  const JSClass*
4761
  GetJSClass();
4762
4763
  bool
4764
  Wrap(JSContext* aCx, mozilla::webgpu::Texture* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
4765
4766
  template <class T>
4767
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
4768
0
  {
4769
0
    JS::Rooted<JSObject*> reflector(aCx);
4770
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
4771
0
  }
4772
4773
  // We declare this as an array so that retrieving a pointer to this
4774
  // binding's property hooks only requires compile/link-time resolvable
4775
  // address arithmetic.  Declaring it as a pointer instead would require
4776
  // doing a run-time load to fetch a pointer to this binding's property
4777
  // hooks.  And then structures which embedded a pointer to this structure
4778
  // would require a run-time load for proper initialization, which would
4779
  // then induce static constructors.  Lots of static constructors.
4780
  extern const NativePropertyHooks sNativePropertyHooks[];
4781
4782
  void
4783
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
4784
4785
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
4786
0
  {
4787
0
    /* Get the interface prototype object for this class.  This will create the
4788
0
       object as needed. */
4789
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPUTexture,
4790
0
                                       &CreateInterfaceObjects,
4791
0
                                       /* aDefineOnGlobal = */ true);
4792
0
4793
0
  }
4794
4795
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
4796
0
  {
4797
0
    /* Get the interface object for this class.  This will create the object as
4798
0
       needed. */
4799
0
4800
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUTexture,
4801
0
                                       &CreateInterfaceObjects,
4802
0
                                       aDefineOnGlobal);
4803
0
  }
4804
4805
  JSObject*
4806
  GetConstructorObject(JSContext* aCx);
4807
4808
} // namespace WebGPUTexture_Binding
4809
4810
4811
4812
namespace WebGPUTextureDimension_Binding {
4813
4814
  typedef mozilla::dom::WebGPUTextureDimension NativeType;
4815
4816
  static const uint32_t e1D = 0;
4817
  static const uint32_t e2D = 1;
4818
  static const uint32_t e3D = 2;
4819
  bool
4820
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
4821
4822
  // We declare this as an array so that retrieving a pointer to this
4823
  // binding's property hooks only requires compile/link-time resolvable
4824
  // address arithmetic.  Declaring it as a pointer instead would require
4825
  // doing a run-time load to fetch a pointer to this binding's property
4826
  // hooks.  And then structures which embedded a pointer to this structure
4827
  // would require a run-time load for proper initialization, which would
4828
  // then induce static constructors.  Lots of static constructors.
4829
  extern const NativePropertyHooks sNativePropertyHooks[];
4830
4831
  void
4832
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
4833
4834
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
4835
0
  {
4836
0
    /* Get the interface object for this class.  This will create the object as
4837
0
       needed. */
4838
0
4839
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUTextureDimension,
4840
0
                                       &CreateInterfaceObjects,
4841
0
                                       aDefineOnGlobal);
4842
0
  }
4843
4844
  JSObject*
4845
  GetConstructorObject(JSContext* aCx);
4846
4847
} // namespace WebGPUTextureDimension_Binding
4848
4849
4850
4851
namespace WebGPUTextureFormat_Binding {
4852
4853
  typedef mozilla::dom::WebGPUTextureFormat NativeType;
4854
4855
  static const uint32_t R8_G8_B8_A8_UNORM = 0;
4856
  static const uint32_t R8_G8_B8_A8_UINT = 1;
4857
  static const uint32_t B8_G8_R8_A8_UNORM = 2;
4858
  static const uint32_t D32_FLOAT_S8_UINT = 3;
4859
  bool
4860
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
4861
4862
  // We declare this as an array so that retrieving a pointer to this
4863
  // binding's property hooks only requires compile/link-time resolvable
4864
  // address arithmetic.  Declaring it as a pointer instead would require
4865
  // doing a run-time load to fetch a pointer to this binding's property
4866
  // hooks.  And then structures which embedded a pointer to this structure
4867
  // would require a run-time load for proper initialization, which would
4868
  // then induce static constructors.  Lots of static constructors.
4869
  extern const NativePropertyHooks sNativePropertyHooks[];
4870
4871
  void
4872
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
4873
4874
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
4875
0
  {
4876
0
    /* Get the interface object for this class.  This will create the object as
4877
0
       needed. */
4878
0
4879
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUTextureFormat,
4880
0
                                       &CreateInterfaceObjects,
4881
0
                                       aDefineOnGlobal);
4882
0
  }
4883
4884
  JSObject*
4885
  GetConstructorObject(JSContext* aCx);
4886
4887
} // namespace WebGPUTextureFormat_Binding
4888
4889
4890
4891
namespace WebGPUTextureUsage_Binding {
4892
4893
  typedef mozilla::dom::WebGPUTextureUsage NativeType;
4894
4895
  static const uint32_t NONE = 0;
4896
  static const uint32_t TRANSFER_SRC = 1;
4897
  static const uint32_t TRANSFER_DST = 2;
4898
  static const uint32_t SAMPLED = 4;
4899
  static const uint32_t STORAGE = 8;
4900
  static const uint32_t OUTPUT_ATTACHMENT = 16;
4901
  static const uint32_t PRESENT = 32;
4902
  bool
4903
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
4904
4905
  // We declare this as an array so that retrieving a pointer to this
4906
  // binding's property hooks only requires compile/link-time resolvable
4907
  // address arithmetic.  Declaring it as a pointer instead would require
4908
  // doing a run-time load to fetch a pointer to this binding's property
4909
  // hooks.  And then structures which embedded a pointer to this structure
4910
  // would require a run-time load for proper initialization, which would
4911
  // then induce static constructors.  Lots of static constructors.
4912
  extern const NativePropertyHooks sNativePropertyHooks[];
4913
4914
  void
4915
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
4916
4917
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
4918
0
  {
4919
0
    /* Get the interface object for this class.  This will create the object as
4920
0
       needed. */
4921
0
4922
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUTextureUsage,
4923
0
                                       &CreateInterfaceObjects,
4924
0
                                       aDefineOnGlobal);
4925
0
  }
4926
4927
  JSObject*
4928
  GetConstructorObject(JSContext* aCx);
4929
4930
} // namespace WebGPUTextureUsage_Binding
4931
4932
4933
4934
namespace WebGPUTextureView_Binding {
4935
4936
  typedef mozilla::webgpu::TextureView NativeType;
4937
4938
  bool
4939
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
4940
4941
  const JSClass*
4942
  GetJSClass();
4943
4944
  bool
4945
  Wrap(JSContext* aCx, mozilla::webgpu::TextureView* aObject, nsWrapperCache* aCache, JS::Handle<JSObject*> aGivenProto, JS::MutableHandle<JSObject*> aReflector);
4946
4947
  template <class T>
4948
  inline JSObject* Wrap(JSContext* aCx, T* aObject, JS::Handle<JSObject*> aGivenProto)
4949
0
  {
4950
0
    JS::Rooted<JSObject*> reflector(aCx);
4951
0
    return Wrap(aCx, aObject, aObject, aGivenProto, &reflector) ? reflector.get() : nullptr;
4952
0
  }
4953
4954
  // We declare this as an array so that retrieving a pointer to this
4955
  // binding's property hooks only requires compile/link-time resolvable
4956
  // address arithmetic.  Declaring it as a pointer instead would require
4957
  // doing a run-time load to fetch a pointer to this binding's property
4958
  // hooks.  And then structures which embedded a pointer to this structure
4959
  // would require a run-time load for proper initialization, which would
4960
  // then induce static constructors.  Lots of static constructors.
4961
  extern const NativePropertyHooks sNativePropertyHooks[];
4962
4963
  void
4964
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
4965
4966
  inline JS::Handle<JSObject*> GetProtoObjectHandle(JSContext* aCx)
4967
0
  {
4968
0
    /* Get the interface prototype object for this class.  This will create the
4969
0
       object as needed. */
4970
0
    return GetPerInterfaceObjectHandle(aCx, prototypes::id::WebGPUTextureView,
4971
0
                                       &CreateInterfaceObjects,
4972
0
                                       /* aDefineOnGlobal = */ true);
4973
0
4974
0
  }
4975
4976
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
4977
0
  {
4978
0
    /* Get the interface object for this class.  This will create the object as
4979
0
       needed. */
4980
0
4981
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUTextureView,
4982
0
                                       &CreateInterfaceObjects,
4983
0
                                       aDefineOnGlobal);
4984
0
  }
4985
4986
  JSObject*
4987
  GetConstructorObject(JSContext* aCx);
4988
4989
} // namespace WebGPUTextureView_Binding
4990
4991
4992
4993
namespace WebGPUVertexFormat_Binding {
4994
4995
  typedef mozilla::dom::WebGPUVertexFormat NativeType;
4996
4997
  static const uint32_t FLOAT_R32_G32_B32_A32 = 0;
4998
  static const uint32_t FLOAT_R32_G32_B32 = 1;
4999
  static const uint32_t FLOAT_R32_G32 = 2;
5000
  static const uint32_t FLOAT_R32 = 3;
5001
  bool
5002
  ConstructorEnabled(JSContext* aCx, JS::Handle<JSObject*> aObj);
5003
5004
  // We declare this as an array so that retrieving a pointer to this
5005
  // binding's property hooks only requires compile/link-time resolvable
5006
  // address arithmetic.  Declaring it as a pointer instead would require
5007
  // doing a run-time load to fetch a pointer to this binding's property
5008
  // hooks.  And then structures which embedded a pointer to this structure
5009
  // would require a run-time load for proper initialization, which would
5010
  // then induce static constructors.  Lots of static constructors.
5011
  extern const NativePropertyHooks sNativePropertyHooks[];
5012
5013
  void
5014
  CreateInterfaceObjects(JSContext* aCx, JS::Handle<JSObject*> aGlobal, ProtoAndIfaceCache& aProtoAndIfaceCache, bool aDefineOnGlobal);
5015
5016
  inline JS::Handle<JSObject*> GetConstructorObjectHandle(JSContext* aCx, bool aDefineOnGlobal = true)
5017
0
  {
5018
0
    /* Get the interface object for this class.  This will create the object as
5019
0
       needed. */
5020
0
5021
0
    return GetPerInterfaceObjectHandle(aCx, constructors::id::WebGPUVertexFormat,
5022
0
                                       &CreateInterfaceObjects,
5023
0
                                       aDefineOnGlobal);
5024
0
  }
5025
5026
  JSObject*
5027
  GetConstructorObject(JSContext* aCx);
5028
5029
} // namespace WebGPUVertexFormat_Binding
5030
5031
5032
5033
} // namespace dom
5034
} // namespace mozilla
5035
5036
#endif // mozilla_dom_WebGPUBinding_h