Apply labels to wgpu resources for improved debugging/profiling (#2912)
# Objective $subj. All of these names show up in external tools when debugging/profiling frames, which is super useful.
This commit is contained in:
parent
44ed7e32d8
commit
0eb11df394
@ -235,7 +235,7 @@ pub fn prepare_core_views_system(
|
||||
let cached_texture = texture_cache.get(
|
||||
&render_device,
|
||||
TextureDescriptor {
|
||||
label: None,
|
||||
label: Some("view_depth_texture"),
|
||||
size: Extent3d {
|
||||
depth_or_array_layers: 1,
|
||||
width: view.width as u32,
|
||||
|
@ -221,7 +221,7 @@ impl RenderAsset for StandardMaterial {
|
||||
let value_std140 = value.as_std140();
|
||||
|
||||
let buffer = render_device.create_buffer_with_data(&BufferInitDescriptor {
|
||||
label: None,
|
||||
label: Some("pbr_standard_material_uniform_buffer"),
|
||||
usage: BufferUsage::UNIFORM | BufferUsage::COPY_DST,
|
||||
contents: value_std140.as_bytes(),
|
||||
});
|
||||
@ -264,7 +264,7 @@ impl RenderAsset for StandardMaterial {
|
||||
resource: BindingResource::Sampler(occlusion_sampler),
|
||||
},
|
||||
],
|
||||
label: None,
|
||||
label: Some("pbr_standard_material_bind_group"),
|
||||
layout: &pbr_shaders.material_layout,
|
||||
});
|
||||
|
||||
|
@ -133,17 +133,17 @@ impl FromWorld for ShadowShaders {
|
||||
count: None,
|
||||
},
|
||||
],
|
||||
label: None,
|
||||
label: Some("shadow_view_layout"),
|
||||
});
|
||||
|
||||
let pipeline_layout = render_device.create_pipeline_layout(&PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
label: Some("shadow_pipeline_layout"),
|
||||
push_constant_ranges: &[],
|
||||
bind_group_layouts: &[&view_layout, &pbr_shaders.mesh_layout],
|
||||
});
|
||||
|
||||
let pipeline = render_device.create_render_pipeline(&RenderPipelineDescriptor {
|
||||
label: None,
|
||||
label: Some("shadow_pipeline"),
|
||||
vertex: VertexState {
|
||||
buffers: &[VertexBufferLayout {
|
||||
array_stride: 32,
|
||||
@ -412,7 +412,7 @@ pub fn prepare_lights(
|
||||
dimension: TextureDimension::D2,
|
||||
format: SHADOW_FORMAT,
|
||||
usage: TextureUsage::RENDER_ATTACHMENT | TextureUsage::SAMPLED,
|
||||
label: None,
|
||||
label: Some("point_light_shadow_map_texture"),
|
||||
},
|
||||
);
|
||||
let directional_light_depth_texture = texture_cache.get(
|
||||
@ -428,7 +428,7 @@ pub fn prepare_lights(
|
||||
dimension: TextureDimension::D2,
|
||||
format: SHADOW_FORMAT,
|
||||
usage: TextureUsage::RENDER_ATTACHMENT | TextureUsage::SAMPLED,
|
||||
label: None,
|
||||
label: Some("directional_light_shadow_map_texture"),
|
||||
},
|
||||
);
|
||||
let mut view_lights = Vec::new();
|
||||
@ -459,7 +459,7 @@ pub fn prepare_lights(
|
||||
point_light_depth_texture
|
||||
.texture
|
||||
.create_view(&TextureViewDescriptor {
|
||||
label: None,
|
||||
label: Some("point_light_shadow_map_texture_view"),
|
||||
format: None,
|
||||
dimension: Some(TextureViewDimension::D2),
|
||||
aspect: TextureAspect::All,
|
||||
@ -549,7 +549,7 @@ pub fn prepare_lights(
|
||||
directional_light_depth_texture
|
||||
.texture
|
||||
.create_view(&TextureViewDescriptor {
|
||||
label: None,
|
||||
label: Some("directional_light_shadow_map_texture_view"),
|
||||
format: None,
|
||||
dimension: Some(TextureViewDimension::D2),
|
||||
aspect: TextureAspect::All,
|
||||
@ -581,7 +581,7 @@ pub fn prepare_lights(
|
||||
point_light_depth_texture
|
||||
.texture
|
||||
.create_view(&TextureViewDescriptor {
|
||||
label: None,
|
||||
label: Some("point_light_shadow_map_array_texture_view"),
|
||||
format: None,
|
||||
dimension: Some(TextureViewDimension::CubeArray),
|
||||
aspect: TextureAspect::All,
|
||||
@ -593,7 +593,7 @@ pub fn prepare_lights(
|
||||
let directional_light_depth_texture_view = directional_light_depth_texture
|
||||
.texture
|
||||
.create_view(&TextureViewDescriptor {
|
||||
label: None,
|
||||
label: Some("directional_light_shadow_map_array_texture_view"),
|
||||
format: None,
|
||||
dimension: Some(TextureViewDimension::D2Array),
|
||||
aspect: TextureAspect::All,
|
||||
@ -629,7 +629,7 @@ pub fn queue_shadow_view_bind_group(
|
||||
binding: 0,
|
||||
resource: view_binding,
|
||||
}],
|
||||
label: None,
|
||||
label: Some("shadow_view_bind_group"),
|
||||
layout: &shadow_shaders.view_layout,
|
||||
}));
|
||||
}
|
||||
|
@ -202,7 +202,7 @@ impl FromWorld for PbrShaders {
|
||||
count: None,
|
||||
},
|
||||
],
|
||||
label: None,
|
||||
label: Some("pbr_view_layout"),
|
||||
});
|
||||
|
||||
let material_layout = render_device.create_bind_group_layout(&BindGroupLayoutDescriptor {
|
||||
@ -304,7 +304,7 @@ impl FromWorld for PbrShaders {
|
||||
count: None,
|
||||
},
|
||||
],
|
||||
label: None,
|
||||
label: Some("pbr_material_layout"),
|
||||
});
|
||||
|
||||
let mesh_layout = render_device.create_bind_group_layout(&BindGroupLayoutDescriptor {
|
||||
@ -320,17 +320,17 @@ impl FromWorld for PbrShaders {
|
||||
},
|
||||
count: None,
|
||||
}],
|
||||
label: None,
|
||||
label: Some("pbr_mesh_layout"),
|
||||
});
|
||||
|
||||
let pipeline_layout = render_device.create_pipeline_layout(&PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
label: Some("pbr_pipeline_layout"),
|
||||
push_constant_ranges: &[],
|
||||
bind_group_layouts: &[&view_layout, &material_layout, &mesh_layout],
|
||||
});
|
||||
|
||||
let pipeline = render_device.create_render_pipeline(&RenderPipelineDescriptor {
|
||||
label: None,
|
||||
label: Some("pbr_pipeline"),
|
||||
vertex: VertexState {
|
||||
buffers: &[VertexBufferLayout {
|
||||
array_stride: 32,
|
||||
@ -476,7 +476,7 @@ pub fn queue_transform_bind_group(
|
||||
binding: 0,
|
||||
resource: binding,
|
||||
}],
|
||||
label: None,
|
||||
label: Some("transform_bind_group"),
|
||||
layout: &pbr_shaders.mesh_layout,
|
||||
}),
|
||||
});
|
||||
@ -546,7 +546,7 @@ pub fn queue_meshes(
|
||||
),
|
||||
},
|
||||
],
|
||||
label: None,
|
||||
label: Some("pbr_view_bind_group"),
|
||||
layout: &pbr_shaders.view_layout,
|
||||
});
|
||||
|
||||
|
@ -50,7 +50,7 @@ impl FromWorld for SpriteShaders {
|
||||
},
|
||||
count: None,
|
||||
}],
|
||||
label: None,
|
||||
label: Some("sprite_view_layout"),
|
||||
});
|
||||
|
||||
let material_layout = render_device.create_bind_group_layout(&BindGroupLayoutDescriptor {
|
||||
@ -75,17 +75,17 @@ impl FromWorld for SpriteShaders {
|
||||
count: None,
|
||||
},
|
||||
],
|
||||
label: None,
|
||||
label: Some("sprite_material_layout"),
|
||||
});
|
||||
|
||||
let pipeline_layout = render_device.create_pipeline_layout(&PipelineLayoutDescriptor {
|
||||
label: None,
|
||||
label: Some("sprite_pipeline_layout"),
|
||||
push_constant_ranges: &[],
|
||||
bind_group_layouts: &[&view_layout, &material_layout],
|
||||
});
|
||||
|
||||
let pipeline = render_device.create_render_pipeline(&RenderPipelineDescriptor {
|
||||
label: None,
|
||||
label: Some("sprite_pipeline"),
|
||||
depth_stencil: None,
|
||||
vertex: VertexState {
|
||||
buffers: &[VertexBufferLayout {
|
||||
@ -339,7 +339,7 @@ pub fn queue_sprites(
|
||||
binding: 0,
|
||||
resource: view_binding,
|
||||
}],
|
||||
label: None,
|
||||
label: Some("sprite_view_bind_group"),
|
||||
layout: &sprite_shaders.view_layout,
|
||||
}));
|
||||
let draw_sprite_function = draw_functions.read().get_id::<DrawSprite>().unwrap();
|
||||
@ -361,7 +361,7 @@ pub fn queue_sprites(
|
||||
resource: BindingResource::Sampler(&gpu_image.sampler),
|
||||
},
|
||||
],
|
||||
label: None,
|
||||
label: Some("sprite_material_bind_group"),
|
||||
layout: &sprite_shaders.material_layout,
|
||||
})
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user