Skip to content

Commit 5d5051d

Browse files
committed
Use Resource trait for kind names
1 parent 22f843b commit 5d5051d

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

wgpu-core/src/hub.rs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -408,12 +408,12 @@ pub struct Registry<T: Resource, I: TypedId, F: IdentityHandlerFactory<I>> {
408408
}
409409

410410
impl<T: Resource, I: TypedId, F: IdentityHandlerFactory<I>> Registry<T, I, F> {
411-
fn new(backend: Backend, factory: &F, kind: &'static str) -> Self {
411+
fn new(backend: Backend, factory: &F) -> Self {
412412
Self {
413413
identity: factory.spawn(0),
414414
data: RwLock::new(Storage {
415415
map: Vec::new(),
416-
kind,
416+
kind: T::TYPE,
417417
_phantom: PhantomData,
418418
}),
419419
backend,
@@ -559,21 +559,21 @@ pub struct Hub<B: hal::Backend, F: GlobalIdentityHandlerFactory> {
559559
impl<B: GfxBackend, F: GlobalIdentityHandlerFactory> Hub<B, F> {
560560
fn new(factory: &F) -> Self {
561561
Self {
562-
adapters: Registry::new(B::VARIANT, factory, "Adapter"),
563-
devices: Registry::new(B::VARIANT, factory, "Device"),
564-
swap_chains: Registry::new(B::VARIANT, factory, "SwapChain"),
565-
pipeline_layouts: Registry::new(B::VARIANT, factory, "PipelineLayout"),
566-
shader_modules: Registry::new(B::VARIANT, factory, "ShaderModule"),
567-
bind_group_layouts: Registry::new(B::VARIANT, factory, "BindGroupLayout"),
568-
bind_groups: Registry::new(B::VARIANT, factory, "BindGroup"),
569-
command_buffers: Registry::new(B::VARIANT, factory, "CommandBuffer"),
570-
render_bundles: Registry::new(B::VARIANT, factory, "RenderBundle"),
571-
render_pipelines: Registry::new(B::VARIANT, factory, "RenderPipeline"),
572-
compute_pipelines: Registry::new(B::VARIANT, factory, "ComputePipeline"),
573-
buffers: Registry::new(B::VARIANT, factory, "Buffer"),
574-
textures: Registry::new(B::VARIANT, factory, "Texture"),
575-
texture_views: Registry::new(B::VARIANT, factory, "TextureView"),
576-
samplers: Registry::new(B::VARIANT, factory, "Sampler"),
562+
adapters: Registry::new(B::VARIANT, factory),
563+
devices: Registry::new(B::VARIANT, factory),
564+
swap_chains: Registry::new(B::VARIANT, factory),
565+
pipeline_layouts: Registry::new(B::VARIANT, factory),
566+
shader_modules: Registry::new(B::VARIANT, factory),
567+
bind_group_layouts: Registry::new(B::VARIANT, factory),
568+
bind_groups: Registry::new(B::VARIANT, factory),
569+
command_buffers: Registry::new(B::VARIANT, factory),
570+
render_bundles: Registry::new(B::VARIANT, factory),
571+
render_pipelines: Registry::new(B::VARIANT, factory),
572+
compute_pipelines: Registry::new(B::VARIANT, factory),
573+
buffers: Registry::new(B::VARIANT, factory),
574+
textures: Registry::new(B::VARIANT, factory),
575+
texture_views: Registry::new(B::VARIANT, factory),
576+
samplers: Registry::new(B::VARIANT, factory),
577577
}
578578
}
579579
}

0 commit comments

Comments
 (0)