From de0f845cb6bafdb8252cb840fa72b4701524b507 Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Wed, 5 Jul 2023 15:34:23 +0100 Subject: [PATCH] Added labels to all relevant WGPU constructs --- src/voxel/brickmap.rs | 16 ++++++++-------- src/voxel/voxel_renderer.rs | 14 +++++++++----- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/src/voxel/brickmap.rs b/src/voxel/brickmap.rs index c97e0a0..6f7b796 100644 --- a/src/voxel/brickmap.rs +++ b/src/voxel/brickmap.rs @@ -72,7 +72,7 @@ impl BrickmapManager { ..Default::default() }; let state_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { - label: None, + label: Some("Brick World State"), contents: bytemuck::cast_slice(&[state_uniform]), usage: wgpu::BufferUsages::UNIFORM, }); @@ -80,7 +80,7 @@ impl BrickmapManager { let brickgrid = vec![1u32; (brickgrid_dims.x * brickgrid_dims.y * brickgrid_dims.z) as usize]; let brickgrid_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { - label: None, + label: Some("Brickgrid"), contents: bytemuck::cast_slice(&brickgrid), usage: wgpu::BufferUsages::STORAGE | wgpu::BufferUsages::COPY_DST, }); @@ -88,7 +88,7 @@ impl BrickmapManager { let brickmap_cache = vec![Brickmap::default(); usize::pow(32, 3)]; let brickmap_cache_map = vec![None; brickmap_cache.capacity()]; let brickmap_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { - label: None, + label: Some("Brickmap Cache"), contents: bytemuck::cast_slice(&brickmap_cache), usage: wgpu::BufferUsages::STORAGE | wgpu::BufferUsages::COPY_DST, }); @@ -96,7 +96,7 @@ impl BrickmapManager { let shading_table_allocator = ShadingTableAllocator::new(4, u32::pow(2, 24)); let shading_table = vec![0u32; shading_table_allocator.total_elements as usize]; let shading_table_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { - label: None, + label: Some("Shading Table"), contents: bytemuck::cast_slice(&shading_table), usage: wgpu::BufferUsages::STORAGE | wgpu::BufferUsages::COPY_DST, }); @@ -104,14 +104,14 @@ impl BrickmapManager { let mut arr = [0u32; 1028]; arr[0] = 256; let feedback_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { - label: None, + label: Some("Feedback"), contents: bytemuck::cast_slice(&arr), usage: wgpu::BufferUsages::STORAGE | wgpu::BufferUsages::COPY_DST | wgpu::BufferUsages::COPY_SRC, }); let feedback_result_buffer = device.create_buffer(&wgpu::BufferDescriptor { - label: None, + label: Some("Feedback Read"), size: 1028 * 4, usage: wgpu::BufferUsages::COPY_DST | wgpu::BufferUsages::MAP_READ, mapped_at_creation: false, @@ -123,7 +123,7 @@ impl BrickmapManager { let brickgrid_staged = HashSet::new(); let brickgrid_unpack_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { - label: None, + label: Some("Brickgrid Unpack"), contents: bytemuck::cast_slice(&arr), usage: wgpu::BufferUsages::STORAGE | wgpu::BufferUsages::COPY_DST, }); @@ -132,7 +132,7 @@ impl BrickmapManager { arr[0] = unpack_max_count as u32; let brickmap_staged = Vec::new(); let brickmap_unpack_buffer = device.create_buffer_init(&wgpu::util::BufferInitDescriptor { - label: None, + label: Some("Brickmap Unpack"), contents: bytemuck::cast_slice(&arr), usage: wgpu::BufferUsages::STORAGE | wgpu::BufferUsages::COPY_DST, }); diff --git a/src/voxel/voxel_renderer.rs b/src/voxel/voxel_renderer.rs index 7782ffb..940ccb9 100644 --- a/src/voxel/voxel_renderer.rs +++ b/src/voxel/voxel_renderer.rs @@ -37,7 +37,7 @@ impl VoxelRenderer { context .device .create_render_pipeline(&wgpu::RenderPipelineDescriptor { - label: None, + label: Some("Raycast Quad"), layout: Some(&context.device.create_pipeline_layout( &wgpu::PipelineLayoutDescriptor { label: Some("draw"), @@ -69,6 +69,7 @@ impl VoxelRenderer { let cs_descriptor = wgpu::include_wgsl!("../../assets/shaders/brickmap_upload.wgsl"); let cs = context.device.create_shader_module(cs_descriptor); let unpack_layout = render::BindGroupLayoutBuilder::new() + .with_label("GPU Unpack BGL") .with_uniform_entry(wgpu::ShaderStages::COMPUTE) .with_rw_storage_entry(wgpu::ShaderStages::COMPUTE) .with_rw_storage_entry(wgpu::ShaderStages::COMPUTE) @@ -77,6 +78,7 @@ impl VoxelRenderer { .with_ro_storage_entry(wgpu::ShaderStages::COMPUTE) .build(context); let unpack_bind_group = render::BindGroupBuilder::new() + .with_label("GPU Unpack BG") .with_layout(&unpack_layout) .with_entry(brickmap_manager.get_worldstate_buffer().as_entire_binding()) .with_entry(brickmap_manager.get_brickgrid_buffer().as_entire_binding()) @@ -97,10 +99,10 @@ impl VoxelRenderer { context .device .create_compute_pipeline(&wgpu::ComputePipelineDescriptor { - label: None, + label: Some("GPU Unpack Pipeline"), layout: Some(&context.device.create_pipeline_layout( &wgpu::PipelineLayoutDescriptor { - label: Some("compute"), + label: Some("GPU Unpack PL"), bind_group_layouts: &[&unpack_layout], push_constant_ranges: &[], }, @@ -112,6 +114,7 @@ impl VoxelRenderer { let cs_descriptor = wgpu::include_wgsl!("../../assets/shaders/voxel_volume.wgsl"); let cs = context.device.create_shader_module(cs_descriptor); let raycast_layout = render::BindGroupLayoutBuilder::new() + .with_label("Voxel Raycast BGL") .with_entry( wgpu::ShaderStages::COMPUTE, wgpu::BindingType::StorageTexture { @@ -129,6 +132,7 @@ impl VoxelRenderer { .with_uniform_entry(wgpu::ShaderStages::COMPUTE) .build(context); let raycast_bind_group = render::BindGroupBuilder::new() + .with_label("Voxel Raycast BG") .with_layout(&raycast_layout) .with_entry(wgpu::BindingResource::TextureView(&render_texture.view)) .with_entry(brickmap_manager.get_worldstate_buffer().as_entire_binding()) @@ -142,10 +146,10 @@ impl VoxelRenderer { context .device .create_compute_pipeline(&wgpu::ComputePipelineDescriptor { - label: None, + label: Some("Voxel Raycast Pipeline"), layout: Some(&context.device.create_pipeline_layout( &wgpu::PipelineLayoutDescriptor { - label: Some("compute"), + label: Some("Voxel Raycast PL"), bind_group_layouts: &[&raycast_layout], push_constant_ranges: &[], },