aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webgpu
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/webgpu')
-rw-r--r--components/script/dom/webgpu/gpu.rs2
-rw-r--r--components/script/dom/webgpu/gpuadapter.rs4
-rw-r--r--components/script/dom/webgpu/gpubindgroup.rs4
-rw-r--r--components/script/dom/webgpu/gpubindgrouplayout.rs4
-rw-r--r--components/script/dom/webgpu/gpubuffer.rs2
-rw-r--r--components/script/dom/webgpu/gpucanvascontext.rs7
-rw-r--r--components/script/dom/webgpu/gpucommandencoder.rs12
-rw-r--r--components/script/dom/webgpu/gpucomputepassencoder.rs8
-rw-r--r--components/script/dom/webgpu/gpucomputepipeline.rs4
-rw-r--r--components/script/dom/webgpu/gpudevice.rs30
-rw-r--r--components/script/dom/webgpu/gpupipelinelayout.rs2
-rw-r--r--components/script/dom/webgpu/gpuqueue.rs6
-rw-r--r--components/script/dom/webgpu/gpurenderbundleencoder.rs10
-rw-r--r--components/script/dom/webgpu/gpurenderpassencoder.rs10
-rw-r--r--components/script/dom/webgpu/gpurenderpipeline.rs4
-rw-r--r--components/script/dom/webgpu/gpusampler.rs2
-rw-r--r--components/script/dom/webgpu/gputexture.rs4
-rw-r--r--components/script/dom/webgpu/gputextureview.rs2
-rw-r--r--components/script/dom/webgpu/gpuuncapturederrorevent.rs2
-rw-r--r--components/script/dom/webgpu/identityhub.rs199
-rw-r--r--components/script/dom/webgpu/mod.rs1
21 files changed, 260 insertions, 59 deletions
diff --git a/components/script/dom/webgpu/gpu.rs b/components/script/dom/webgpu/gpu.rs
index f955db7c350..6cdd83878b5 100644
--- a/components/script/dom/webgpu/gpu.rs
+++ b/components/script/dom/webgpu/gpu.rs
@@ -21,8 +21,8 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
-use crate::dom::gpuadapter::GPUAdapter;
use crate::dom::promise::Promise;
+use crate::dom::webgpu::gpuadapter::GPUAdapter;
use crate::realms::InRealm;
use crate::script_runtime::CanGc;
use crate::task_source::{TaskSource, TaskSourceName};
diff --git a/components/script/dom/webgpu/gpuadapter.rs b/components/script/dom/webgpu/gpuadapter.rs
index da81c8d7d4c..1b6552e031b 100644
--- a/components/script/dom/webgpu/gpuadapter.rs
+++ b/components/script/dom/webgpu/gpuadapter.rs
@@ -20,11 +20,11 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::DOMString;
use crate::dom::globalscope::GlobalScope;
-use crate::dom::gpudevice::GPUDevice;
-use crate::dom::gpusupportedfeatures::gpu_to_wgt_feature;
use crate::dom::promise::Promise;
use crate::dom::types::{GPUAdapterInfo, GPUSupportedLimits};
use crate::dom::webgpu::gpu::{response_async, AsyncWGPUListener};
+use crate::dom::webgpu::gpudevice::GPUDevice;
+use crate::dom::webgpu::gpusupportedfeatures::gpu_to_wgt_feature;
use crate::realms::InRealm;
use crate::script_runtime::CanGc;
diff --git a/components/script/dom/webgpu/gpubindgroup.rs b/components/script/dom/webgpu/gpubindgroup.rs
index 7992e3825d0..b734684b92d 100644
--- a/components/script/dom/webgpu/gpubindgroup.rs
+++ b/components/script/dom/webgpu/gpubindgroup.rs
@@ -16,8 +16,8 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
-use crate::dom::gpubindgrouplayout::GPUBindGroupLayout;
-use crate::dom::gpudevice::GPUDevice;
+use crate::dom::webgpu::gpubindgrouplayout::GPUBindGroupLayout;
+use crate::dom::webgpu::gpudevice::GPUDevice;
#[dom_struct]
pub struct GPUBindGroup {
diff --git a/components/script/dom/webgpu/gpubindgrouplayout.rs b/components/script/dom/webgpu/gpubindgrouplayout.rs
index c09c36ade58..bdfdcab1e9e 100644
--- a/components/script/dom/webgpu/gpubindgrouplayout.rs
+++ b/components/script/dom/webgpu/gpubindgrouplayout.rs
@@ -17,8 +17,8 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
-use crate::dom::gpuconvert::convert_bind_group_layout_entry;
-use crate::dom::gpudevice::GPUDevice;
+use crate::dom::webgpu::gpuconvert::convert_bind_group_layout_entry;
+use crate::dom::webgpu::gpudevice::GPUDevice;
#[dom_struct]
pub struct GPUBindGroupLayout {
diff --git a/components/script/dom/webgpu/gpubuffer.rs b/components/script/dom/webgpu/gpubuffer.rs
index cab38d067c2..6a47b14331f 100644
--- a/components/script/dom/webgpu/gpubuffer.rs
+++ b/components/script/dom/webgpu/gpubuffer.rs
@@ -23,9 +23,9 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
-use crate::dom::gpudevice::GPUDevice;
use crate::dom::promise::Promise;
use crate::dom::webgpu::gpu::{response_async, AsyncWGPUListener};
+use crate::dom::webgpu::gpudevice::GPUDevice;
use crate::realms::InRealm;
use crate::script_runtime::{CanGc, JSContext};
diff --git a/components/script/dom/webgpu/gpucanvascontext.rs b/components/script/dom/webgpu/gpucanvascontext.rs
index 2766f318c8a..06c69190a09 100644
--- a/components/script/dom/webgpu/gpucanvascontext.rs
+++ b/components/script/dom/webgpu/gpucanvascontext.rs
@@ -20,11 +20,12 @@ use webrender_api::ImageKey;
use super::gpuconvert::convert_texture_descriptor;
use super::gputexture::GPUTexture;
+use crate::dom::bindings::codegen::Bindings::GPUCanvasContextBinding::GPUCanvasContextMethods;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::GPUTexture_Binding::GPUTextureMethods;
use crate::dom::bindings::codegen::Bindings::WebGPUBinding::{
- GPUCanvasAlphaMode, GPUCanvasConfiguration, GPUCanvasContextMethods, GPUDeviceMethods,
- GPUExtent3D, GPUExtent3DDict, GPUObjectDescriptorBase, GPUTextureDescriptor,
- GPUTextureDimension, GPUTextureFormat, GPUTextureUsageConstants,
+ GPUCanvasAlphaMode, GPUCanvasConfiguration, GPUDeviceMethods, GPUExtent3D, GPUExtent3DDict,
+ GPUObjectDescriptorBase, GPUTextureDescriptor, GPUTextureDimension, GPUTextureFormat,
+ GPUTextureUsageConstants,
};
use crate::dom::bindings::codegen::UnionTypes::HTMLCanvasElementOrOffscreenCanvas;
use crate::dom::bindings::error::{Error, Fallible};
diff --git a/components/script/dom/webgpu/gpucommandencoder.rs b/components/script/dom/webgpu/gpucommandencoder.rs
index 67d78c0fcc9..8c72b12f6b7 100644
--- a/components/script/dom/webgpu/gpucommandencoder.rs
+++ b/components/script/dom/webgpu/gpucommandencoder.rs
@@ -20,12 +20,12 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
-use crate::dom::gpubuffer::GPUBuffer;
-use crate::dom::gpucommandbuffer::GPUCommandBuffer;
-use crate::dom::gpucomputepassencoder::GPUComputePassEncoder;
-use crate::dom::gpuconvert::{convert_load_op, convert_store_op};
-use crate::dom::gpudevice::GPUDevice;
-use crate::dom::gpurenderpassencoder::GPURenderPassEncoder;
+use crate::dom::webgpu::gpubuffer::GPUBuffer;
+use crate::dom::webgpu::gpucommandbuffer::GPUCommandBuffer;
+use crate::dom::webgpu::gpucomputepassencoder::GPUComputePassEncoder;
+use crate::dom::webgpu::gpuconvert::{convert_load_op, convert_store_op};
+use crate::dom::webgpu::gpudevice::GPUDevice;
+use crate::dom::webgpu::gpurenderpassencoder::GPURenderPassEncoder;
#[dom_struct]
pub struct GPUCommandEncoder {
diff --git a/components/script/dom/webgpu/gpucomputepassencoder.rs b/components/script/dom/webgpu/gpucomputepassencoder.rs
index e75157b32fc..0f8937fec8b 100644
--- a/components/script/dom/webgpu/gpucomputepassencoder.rs
+++ b/components/script/dom/webgpu/gpucomputepassencoder.rs
@@ -11,10 +11,10 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
-use crate::dom::gpubindgroup::GPUBindGroup;
-use crate::dom::gpubuffer::GPUBuffer;
-use crate::dom::gpucommandencoder::GPUCommandEncoder;
-use crate::dom::gpucomputepipeline::GPUComputePipeline;
+use crate::dom::webgpu::gpubindgroup::GPUBindGroup;
+use crate::dom::webgpu::gpubuffer::GPUBuffer;
+use crate::dom::webgpu::gpucommandencoder::GPUCommandEncoder;
+use crate::dom::webgpu::gpucomputepipeline::GPUComputePipeline;
#[dom_struct]
pub struct GPUComputePassEncoder {
diff --git a/components/script/dom/webgpu/gpucomputepipeline.rs b/components/script/dom/webgpu/gpucomputepipeline.rs
index 4d905126c71..ace43db11b4 100644
--- a/components/script/dom/webgpu/gpucomputepipeline.rs
+++ b/components/script/dom/webgpu/gpucomputepipeline.rs
@@ -16,8 +16,8 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
-use crate::dom::gpubindgrouplayout::GPUBindGroupLayout;
-use crate::dom::gpudevice::GPUDevice;
+use crate::dom::webgpu::gpubindgrouplayout::GPUBindGroupLayout;
+use crate::dom::webgpu::gpudevice::GPUDevice;
#[dom_struct]
pub struct GPUComputePipeline {
diff --git a/components/script/dom/webgpu/gpudevice.rs b/components/script/dom/webgpu/gpudevice.rs
index 945c7491874..62b47bc7661 100644
--- a/components/script/dom/webgpu/gpudevice.rs
+++ b/components/script/dom/webgpu/gpudevice.rs
@@ -42,24 +42,24 @@ use crate::dom::bindings::str::{DOMString, USVString};
use crate::dom::bindings::trace::RootedTraceableBox;
use crate::dom::eventtarget::EventTarget;
use crate::dom::globalscope::GlobalScope;
-use crate::dom::gpuadapter::GPUAdapter;
-use crate::dom::gpubindgroup::GPUBindGroup;
-use crate::dom::gpubindgrouplayout::GPUBindGroupLayout;
-use crate::dom::gpubuffer::GPUBuffer;
-use crate::dom::gpucommandencoder::GPUCommandEncoder;
-use crate::dom::gpucomputepipeline::GPUComputePipeline;
-use crate::dom::gpupipelinelayout::GPUPipelineLayout;
-use crate::dom::gpuqueue::GPUQueue;
-use crate::dom::gpurenderbundleencoder::GPURenderBundleEncoder;
-use crate::dom::gpurenderpipeline::GPURenderPipeline;
-use crate::dom::gpusampler::GPUSampler;
-use crate::dom::gpushadermodule::GPUShaderModule;
-use crate::dom::gpusupportedfeatures::GPUSupportedFeatures;
-use crate::dom::gputexture::GPUTexture;
-use crate::dom::gpuuncapturederrorevent::GPUUncapturedErrorEvent;
use crate::dom::promise::Promise;
use crate::dom::types::GPUError;
use crate::dom::webgpu::gpu::response_async;
+use crate::dom::webgpu::gpuadapter::GPUAdapter;
+use crate::dom::webgpu::gpubindgroup::GPUBindGroup;
+use crate::dom::webgpu::gpubindgrouplayout::GPUBindGroupLayout;
+use crate::dom::webgpu::gpubuffer::GPUBuffer;
+use crate::dom::webgpu::gpucommandencoder::GPUCommandEncoder;
+use crate::dom::webgpu::gpucomputepipeline::GPUComputePipeline;
+use crate::dom::webgpu::gpupipelinelayout::GPUPipelineLayout;
+use crate::dom::webgpu::gpuqueue::GPUQueue;
+use crate::dom::webgpu::gpurenderbundleencoder::GPURenderBundleEncoder;
+use crate::dom::webgpu::gpurenderpipeline::GPURenderPipeline;
+use crate::dom::webgpu::gpusampler::GPUSampler;
+use crate::dom::webgpu::gpushadermodule::GPUShaderModule;
+use crate::dom::webgpu::gpusupportedfeatures::GPUSupportedFeatures;
+use crate::dom::webgpu::gputexture::GPUTexture;
+use crate::dom::webgpu::gpuuncapturederrorevent::GPUUncapturedErrorEvent;
use crate::realms::InRealm;
use crate::script_runtime::CanGc;
diff --git a/components/script/dom/webgpu/gpupipelinelayout.rs b/components/script/dom/webgpu/gpupipelinelayout.rs
index c1cbbdb72ab..5a5768388c4 100644
--- a/components/script/dom/webgpu/gpupipelinelayout.rs
+++ b/components/script/dom/webgpu/gpupipelinelayout.rs
@@ -16,7 +16,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
-use crate::dom::gpudevice::GPUDevice;
+use crate::dom::webgpu::gpudevice::GPUDevice;
#[dom_struct]
pub struct GPUPipelineLayout {
diff --git a/components/script/dom/webgpu/gpuqueue.rs b/components/script/dom/webgpu/gpuqueue.rs
index 403628737d3..9eea0bffa69 100644
--- a/components/script/dom/webgpu/gpuqueue.rs
+++ b/components/script/dom/webgpu/gpuqueue.rs
@@ -19,10 +19,10 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
-use crate::dom::gpubuffer::GPUBuffer;
-use crate::dom::gpucommandbuffer::GPUCommandBuffer;
-use crate::dom::gpudevice::GPUDevice;
use crate::dom::promise::Promise;
+use crate::dom::webgpu::gpubuffer::GPUBuffer;
+use crate::dom::webgpu::gpucommandbuffer::GPUCommandBuffer;
+use crate::dom::webgpu::gpudevice::GPUDevice;
use crate::script_runtime::CanGc;
#[dom_struct]
diff --git a/components/script/dom/webgpu/gpurenderbundleencoder.rs b/components/script/dom/webgpu/gpurenderbundleencoder.rs
index 3f23db60706..2a76bfe0336 100644
--- a/components/script/dom/webgpu/gpurenderbundleencoder.rs
+++ b/components/script/dom/webgpu/gpurenderbundleencoder.rs
@@ -20,11 +20,11 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
-use crate::dom::gpubindgroup::GPUBindGroup;
-use crate::dom::gpubuffer::GPUBuffer;
-use crate::dom::gpudevice::GPUDevice;
-use crate::dom::gpurenderbundle::GPURenderBundle;
-use crate::dom::gpurenderpipeline::GPURenderPipeline;
+use crate::dom::webgpu::gpubindgroup::GPUBindGroup;
+use crate::dom::webgpu::gpubuffer::GPUBuffer;
+use crate::dom::webgpu::gpudevice::GPUDevice;
+use crate::dom::webgpu::gpurenderbundle::GPURenderBundle;
+use crate::dom::webgpu::gpurenderpipeline::GPURenderPipeline;
#[dom_struct]
pub struct GPURenderBundleEncoder {
diff --git a/components/script/dom/webgpu/gpurenderpassencoder.rs b/components/script/dom/webgpu/gpurenderpassencoder.rs
index ea77df69d02..765e220f32e 100644
--- a/components/script/dom/webgpu/gpurenderpassencoder.rs
+++ b/components/script/dom/webgpu/gpurenderpassencoder.rs
@@ -15,11 +15,11 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
-use crate::dom::gpubindgroup::GPUBindGroup;
-use crate::dom::gpubuffer::GPUBuffer;
-use crate::dom::gpucommandencoder::GPUCommandEncoder;
-use crate::dom::gpurenderbundle::GPURenderBundle;
-use crate::dom::gpurenderpipeline::GPURenderPipeline;
+use crate::dom::webgpu::gpubindgroup::GPUBindGroup;
+use crate::dom::webgpu::gpubuffer::GPUBuffer;
+use crate::dom::webgpu::gpucommandencoder::GPUCommandEncoder;
+use crate::dom::webgpu::gpurenderbundle::GPURenderBundle;
+use crate::dom::webgpu::gpurenderpipeline::GPURenderPipeline;
#[dom_struct]
pub struct GPURenderPassEncoder {
diff --git a/components/script/dom/webgpu/gpurenderpipeline.rs b/components/script/dom/webgpu/gpurenderpipeline.rs
index 0cf8754ecbf..48f6d93bc01 100644
--- a/components/script/dom/webgpu/gpurenderpipeline.rs
+++ b/components/script/dom/webgpu/gpurenderpipeline.rs
@@ -14,8 +14,8 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
-use crate::dom::gpubindgrouplayout::GPUBindGroupLayout;
-use crate::dom::gpudevice::{GPUDevice, PipelineLayout};
+use crate::dom::webgpu::gpubindgrouplayout::GPUBindGroupLayout;
+use crate::dom::webgpu::gpudevice::{GPUDevice, PipelineLayout};
#[dom_struct]
pub struct GPURenderPipeline {
diff --git a/components/script/dom/webgpu/gpusampler.rs b/components/script/dom/webgpu/gpusampler.rs
index ad7aa3e8b89..25fa90a2410 100644
--- a/components/script/dom/webgpu/gpusampler.rs
+++ b/components/script/dom/webgpu/gpusampler.rs
@@ -14,7 +14,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::DomRoot;
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
-use crate::dom::gpudevice::GPUDevice;
+use crate::dom::webgpu::gpudevice::GPUDevice;
#[dom_struct]
pub struct GPUSampler {
diff --git a/components/script/dom/webgpu/gputexture.rs b/components/script/dom/webgpu/gputexture.rs
index b37197f4a90..02cb4c94f74 100644
--- a/components/script/dom/webgpu/gputexture.rs
+++ b/components/script/dom/webgpu/gputexture.rs
@@ -19,8 +19,8 @@ use crate::dom::bindings::reflector::{reflect_dom_object, DomObject, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
-use crate::dom::gpudevice::GPUDevice;
-use crate::dom::gputextureview::GPUTextureView;
+use crate::dom::webgpu::gpudevice::GPUDevice;
+use crate::dom::webgpu::gputextureview::GPUTextureView;
#[dom_struct]
pub struct GPUTexture {
diff --git a/components/script/dom/webgpu/gputextureview.rs b/components/script/dom/webgpu/gputextureview.rs
index 3c8d484fca3..e563af68d84 100644
--- a/components/script/dom/webgpu/gputextureview.rs
+++ b/components/script/dom/webgpu/gputextureview.rs
@@ -11,7 +11,7 @@ use crate::dom::bindings::reflector::{reflect_dom_object, Reflector};
use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::USVString;
use crate::dom::globalscope::GlobalScope;
-use crate::dom::gputexture::GPUTexture;
+use crate::dom::webgpu::gputexture::GPUTexture;
#[dom_struct]
pub struct GPUTextureView {
diff --git a/components/script/dom/webgpu/gpuuncapturederrorevent.rs b/components/script/dom/webgpu/gpuuncapturederrorevent.rs
index 0ee3871d98d..2e53e62bbd4 100644
--- a/components/script/dom/webgpu/gpuuncapturederrorevent.rs
+++ b/components/script/dom/webgpu/gpuuncapturederrorevent.rs
@@ -15,7 +15,7 @@ use crate::dom::bindings::root::{Dom, DomRoot};
use crate::dom::bindings::str::DOMString;
use crate::dom::event::Event;
use crate::dom::globalscope::GlobalScope;
-use crate::dom::gpuerror::GPUError;
+use crate::dom::webgpu::gpuerror::GPUError;
use crate::script_runtime::CanGc;
#[dom_struct]
diff --git a/components/script/dom/webgpu/identityhub.rs b/components/script/dom/webgpu/identityhub.rs
new file mode 100644
index 00000000000..c98618e97f0
--- /dev/null
+++ b/components/script/dom/webgpu/identityhub.rs
@@ -0,0 +1,199 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
+
+use webgpu::identity::{ComputePass, ComputePassId, RenderPass, RenderPassId};
+use webgpu::wgc::id::markers::{
+ Adapter, BindGroup, BindGroupLayout, Buffer, CommandEncoder, ComputePipeline, Device,
+ PipelineLayout, Queue, RenderBundle, RenderPipeline, Sampler, ShaderModule, Texture,
+ TextureView,
+};
+use webgpu::wgc::id::{
+ AdapterId, BindGroupId, BindGroupLayoutId, BufferId, CommandEncoderId, ComputePipelineId,
+ DeviceId, PipelineLayoutId, QueueId, RenderBundleId, RenderPipelineId, SamplerId,
+ ShaderModuleId, TextureId, TextureViewId,
+};
+use webgpu::wgc::identity::IdentityManager;
+
+#[derive(Debug)]
+pub struct IdentityHub {
+ adapters: IdentityManager<Adapter>,
+ devices: IdentityManager<Device>,
+ queues: IdentityManager<Queue>,
+ buffers: IdentityManager<Buffer>,
+ bind_groups: IdentityManager<BindGroup>,
+ bind_group_layouts: IdentityManager<BindGroupLayout>,
+ compute_pipelines: IdentityManager<ComputePipeline>,
+ pipeline_layouts: IdentityManager<PipelineLayout>,
+ shader_modules: IdentityManager<ShaderModule>,
+ command_encoders: IdentityManager<CommandEncoder>,
+ textures: IdentityManager<Texture>,
+ texture_views: IdentityManager<TextureView>,
+ samplers: IdentityManager<Sampler>,
+ render_pipelines: IdentityManager<RenderPipeline>,
+ render_bundles: IdentityManager<RenderBundle>,
+ compute_passes: IdentityManager<ComputePass>,
+ render_passes: IdentityManager<RenderPass>,
+}
+
+impl Default for IdentityHub {
+ fn default() -> Self {
+ IdentityHub {
+ adapters: IdentityManager::new(),
+ devices: IdentityManager::new(),
+ queues: IdentityManager::new(),
+ buffers: IdentityManager::new(),
+ bind_groups: IdentityManager::new(),
+ bind_group_layouts: IdentityManager::new(),
+ compute_pipelines: IdentityManager::new(),
+ pipeline_layouts: IdentityManager::new(),
+ shader_modules: IdentityManager::new(),
+ command_encoders: IdentityManager::new(),
+ textures: IdentityManager::new(),
+ texture_views: IdentityManager::new(),
+ samplers: IdentityManager::new(),
+ render_pipelines: IdentityManager::new(),
+ render_bundles: IdentityManager::new(),
+ compute_passes: IdentityManager::new(),
+ render_passes: IdentityManager::new(),
+ }
+ }
+}
+
+impl IdentityHub {
+ pub fn create_device_id(&self) -> DeviceId {
+ self.devices.process()
+ }
+
+ pub fn free_device_id(&self, id: DeviceId) {
+ self.devices.free(id);
+ }
+
+ pub fn create_queue_id(&self) -> QueueId {
+ self.queues.process()
+ }
+
+ pub fn free_queue_id(&self, id: QueueId) {
+ self.queues.free(id);
+ }
+
+ pub fn create_adapter_id(&self) -> AdapterId {
+ self.adapters.process()
+ }
+
+ pub fn free_adapter_id(&self, id: AdapterId) {
+ self.adapters.free(id);
+ }
+
+ pub fn create_buffer_id(&self) -> BufferId {
+ self.buffers.process()
+ }
+
+ pub fn free_buffer_id(&self, id: BufferId) {
+ self.buffers.free(id);
+ }
+
+ pub fn create_bind_group_id(&self) -> BindGroupId {
+ self.bind_groups.process()
+ }
+
+ pub fn free_bind_group_id(&self, id: BindGroupId) {
+ self.bind_groups.free(id);
+ }
+
+ pub fn create_bind_group_layout_id(&self) -> BindGroupLayoutId {
+ self.bind_group_layouts.process()
+ }
+
+ pub fn free_bind_group_layout_id(&self, id: BindGroupLayoutId) {
+ self.bind_group_layouts.free(id);
+ }
+
+ pub fn create_compute_pipeline_id(&self) -> ComputePipelineId {
+ self.compute_pipelines.process()
+ }
+
+ pub fn free_compute_pipeline_id(&self, id: ComputePipelineId) {
+ self.compute_pipelines.free(id);
+ }
+
+ pub fn create_pipeline_layout_id(&self) -> PipelineLayoutId {
+ self.pipeline_layouts.process()
+ }
+
+ pub fn free_pipeline_layout_id(&self, id: PipelineLayoutId) {
+ self.pipeline_layouts.free(id);
+ }
+
+ pub fn create_shader_module_id(&self) -> ShaderModuleId {
+ self.shader_modules.process()
+ }
+
+ pub fn free_shader_module_id(&self, id: ShaderModuleId) {
+ self.shader_modules.free(id);
+ }
+
+ pub fn create_command_encoder_id(&self) -> CommandEncoderId {
+ self.command_encoders.process()
+ }
+
+ pub fn free_command_buffer_id(&self, id: CommandEncoderId) {
+ self.command_encoders.free(id);
+ }
+
+ pub fn create_sampler_id(&self) -> SamplerId {
+ self.samplers.process()
+ }
+
+ pub fn free_sampler_id(&self, id: SamplerId) {
+ self.samplers.free(id);
+ }
+
+ pub fn create_render_pipeline_id(&self) -> RenderPipelineId {
+ self.render_pipelines.process()
+ }
+
+ pub fn free_render_pipeline_id(&self, id: RenderPipelineId) {
+ self.render_pipelines.free(id);
+ }
+
+ pub fn create_texture_id(&self) -> TextureId {
+ self.textures.process()
+ }
+
+ pub fn free_texture_id(&self, id: TextureId) {
+ self.textures.free(id);
+ }
+
+ pub fn create_texture_view_id(&self) -> TextureViewId {
+ self.texture_views.process()
+ }
+
+ pub fn free_texture_view_id(&self, id: TextureViewId) {
+ self.texture_views.free(id);
+ }
+
+ pub fn create_render_bundle_id(&self) -> RenderBundleId {
+ self.render_bundles.process()
+ }
+
+ pub fn free_render_bundle_id(&self, id: RenderBundleId) {
+ self.render_bundles.free(id);
+ }
+
+ pub fn create_compute_pass_id(&self) -> ComputePassId {
+ self.compute_passes.process()
+ }
+
+ pub fn free_compute_pass_id(&self, id: ComputePassId) {
+ self.compute_passes.free(id);
+ }
+
+ pub fn create_render_pass_id(&self) -> RenderPassId {
+ self.render_passes.process()
+ }
+
+ pub fn free_render_pass_id(&self, id: RenderPassId) {
+ self.render_passes.free(id);
+ }
+}
diff --git a/components/script/dom/webgpu/mod.rs b/components/script/dom/webgpu/mod.rs
index 22994a942bc..2b06224c6fb 100644
--- a/components/script/dom/webgpu/mod.rs
+++ b/components/script/dom/webgpu/mod.rs
@@ -42,3 +42,4 @@ pub mod gputextureusage;
pub mod gputextureview;
pub mod gpuuncapturederrorevent;
pub mod gpuvalidationerror;
+pub mod identityhub;