From 511cb197c8be1b5b2d418b4554c705a53ee3c601 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Wed, 29 Mar 2023 15:36:51 +0200 Subject: [PATCH 1/5] use format! instead of push_str on DebugLabel --- crates/re_renderer/src/debug_label.rs | 13 +++++----- .../re_renderer/src/draw_phases/outlines.rs | 24 +++++++------------ .../src/draw_phases/picking_layer.rs | 10 ++++---- crates/re_renderer/src/mesh.rs | 6 ++--- crates/re_renderer/src/renderer/lines.rs | 19 ++++++--------- crates/re_renderer/src/view_builder.rs | 6 ++--- .../src/wgpu_resources/texture_pool.rs | 2 +- 7 files changed, 33 insertions(+), 47 deletions(-) diff --git a/crates/re_renderer/src/debug_label.rs b/crates/re_renderer/src/debug_label.rs index a122ebc5afd1..a984b57e23ae 100644 --- a/crates/re_renderer/src/debug_label.rs +++ b/crates/re_renderer/src/debug_label.rs @@ -5,20 +5,19 @@ pub struct DebugLabel { label: String, } -impl DebugLabel { +impl std::fmt::Debug for DebugLabel { #[cfg(debug_assertions)] - pub fn push_str(mut self, append_this: &str) -> DebugLabel { - self.label.push_str(append_this); - self + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + self.label.fmt(f) } #[cfg(not(debug_assertions))] - pub fn push_str(&mut self, _append_this: &str) -> DebugLabel { - DebugLabel {} + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("DebugLabel").finish_non_exhaustive() } } -impl std::fmt::Debug for DebugLabel { +impl std::fmt::Display for DebugLabel { #[cfg(debug_assertions)] fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { self.label.fmt(f) diff --git a/crates/re_renderer/src/draw_phases/outlines.rs b/crates/re_renderer/src/draw_phases/outlines.rs index 72360aeb0df0..fd4ae7f8a3ae 100644 --- a/crates/re_renderer/src/draw_phases/outlines.rs +++ b/crates/re_renderer/src/draw_phases/outlines.rs @@ -203,7 +203,7 @@ impl OutlineMaskProcessor { resolution_in_pixel: [u32; 2], ) -> Self { crate::profile_function!(); - let instance_label = view_name.clone().push_str(" - OutlineMaskProcessor"); + let instance_label: DebugLabel = format!("{view_name} - OutlineMaskProcessor").into(); // ------------- Textures ------------- let texture_pool = &ctx.gpu_resources.textures; @@ -211,7 +211,7 @@ impl OutlineMaskProcessor { let mask_sample_count = Self::mask_sample_count(ctx.shared_renderer_data.config.hardware_tier); let mask_texture_desc = crate::wgpu_resources::TextureDesc { - label: instance_label.clone().push_str("::mask_texture"), + label: format!("{instance_label}::mask_texture").into(), size: wgpu::Extent3d { width: resolution_in_pixel[0], height: resolution_in_pixel[1], @@ -232,7 +232,7 @@ impl OutlineMaskProcessor { let mask_depth = texture_pool.alloc( &ctx.device, &crate::wgpu_resources::TextureDesc { - label: instance_label.clone().push_str("::mask_depth"), + label: format!("{instance_label}::mask_depth").into(), format: Self::MASK_DEPTH_FORMAT, usage: wgpu::TextureUsages::RENDER_ATTACHMENT, ..mask_texture_desc @@ -240,7 +240,7 @@ impl OutlineMaskProcessor { ); let voronoi_texture_desc = crate::wgpu_resources::TextureDesc { - label: instance_label.clone().push_str("::distance_texture"), + label: format!("{instance_label}::distance_texture").into(), sample_count: 1, format: Self::VORONOI_FORMAT, ..mask_texture_desc @@ -353,7 +353,7 @@ impl OutlineMaskProcessor { encoder: &'a mut wgpu::CommandEncoder, ) -> wgpu::RenderPass<'a> { encoder.begin_render_pass(&wgpu::RenderPassDescriptor { - label: self.label.clone().push_str(" - mask pass").get(), + label: DebugLabel::from(format!("{} - mask pass", self.label)).get(), color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &self.mask_texture.default_view, resolve_target: None, // We're going to do a manual resolve. @@ -388,7 +388,7 @@ impl OutlineMaskProcessor { // Initialize the jump flooding into voronoi texture 0 by looking at the mask texture. { let mut jumpflooding_init = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { - label: self.label.clone().push_str(" - jumpflooding_init").get(), + label: DebugLabel::from(format!("{} - jumpflooding_init", self.label)).get(), color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &self.voronoi_textures[0].default_view, resolve_target: None, @@ -409,11 +409,7 @@ impl OutlineMaskProcessor { pipelines.get_resource(self.render_pipeline_jumpflooding_step)?; for (i, bind_group) in self.bind_group_jumpflooding_steps.into_iter().enumerate() { let mut jumpflooding_step = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { - label: self - .label - .clone() - .push_str(&format!(" - jumpflooding_step {i}")) - .get(), + label: DebugLabel::from(format!("{} - jumpflooding_step {i}", self.label)).get(), color_attachments: &[Some(wgpu::RenderPassColorAttachment { // Start with texture 1 since the init step wrote to texture 0 view: &self.voronoi_textures[(i + 1) % 2].default_view, @@ -458,7 +454,7 @@ impl OutlineMaskProcessor { &ctx.device, &ctx.gpu_resources, &BindGroupDesc { - label: instance_label.clone().push_str("::jumpflooding_init"), + label: format!("{instance_label}::jumpflooding_init").into(), entries: smallvec![BindGroupEntry::DefaultTextureView(mask_texture.handle)], layout: bind_group_layout_jumpflooding_init, }, @@ -545,9 +541,7 @@ impl OutlineMaskProcessor { &ctx.device, &ctx.gpu_resources, &BindGroupDesc { - label: instance_label - .clone() - .push_str(&format!("::jumpflooding_steps[{i}]")), + label: format!("{instance_label}::jumpflooding_steps[{i}]").into(), entries: smallvec![ BindGroupEntry::DefaultTextureView(voronoi_textures[i % 2].handle), BindGroupEntry::Sampler(sampler), diff --git a/crates/re_renderer/src/draw_phases/picking_layer.rs b/crates/re_renderer/src/draw_phases/picking_layer.rs index 96740a762419..24645a69b089 100644 --- a/crates/re_renderer/src/draw_phases/picking_layer.rs +++ b/crates/re_renderer/src/draw_phases/picking_layer.rs @@ -114,7 +114,7 @@ impl PickingLayerProcessor { let picking_target = ctx.gpu_resources.textures.alloc( &ctx.device, &TextureDesc { - label: view_name.clone().push_str(" - PickingLayerProcessor"), + label: format!("{view_name} - PickingLayerProcessor").into(), size: picking_rect.wgpu_extent(), mip_level_count: 1, sample_count: 1, @@ -126,7 +126,7 @@ impl PickingLayerProcessor { let picking_depth = ctx.gpu_resources.textures.alloc( &ctx.device, &TextureDesc { - label: view_name.clone().push_str(" - picking_layer depth"), + label: format!("{view_name} - picking_layer depth").into(), format: Self::PICKING_LAYER_DEPTH_FORMAT, usage: wgpu::TextureUsages::RENDER_ATTACHMENT, ..picking_target.creation_desc @@ -166,9 +166,7 @@ impl PickingLayerProcessor { let frame_uniform_buffer = create_and_fill_uniform_buffer( ctx, - view_name - .clone() - .push_str(" - picking_layer frame uniform buffer"), + format!("{view_name} - picking_layer frame uniform buffer").into(), frame_uniform_buffer_content, ); @@ -203,7 +201,7 @@ impl PickingLayerProcessor { crate::profile_function!(); let mut pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { - label: view_name.clone().push_str(" - picking_layer pass").get(), + label: DebugLabel::from(format!("{view_name} - picking_layer pass")).get(), color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &self.picking_target.default_view, resolve_target: None, diff --git a/crates/re_renderer/src/mesh.rs b/crates/re_renderer/src/mesh.rs index 765f1d05c565..ad3f52ea0fab 100644 --- a/crates/re_renderer/src/mesh.rs +++ b/crates/re_renderer/src/mesh.rs @@ -218,7 +218,7 @@ impl GpuMesh { let vertex_buffer_combined = pools.buffers.alloc( device, &BufferDesc { - label: data.label.clone().push_str(" - vertices"), + label: format!("{} - vertices", data.label).into(), size: vb_combined_size, usage: wgpu::BufferUsages::VERTEX | wgpu::BufferUsages::COPY_DST, mapped_at_creation: false, @@ -247,7 +247,7 @@ impl GpuMesh { let index_buffer = pools.buffers.alloc( device, &BufferDesc { - label: data.label.clone().push_str(" - indices"), + label: format!("{} - indices", data.label).into(), size: index_buffer_size, usage: wgpu::BufferUsages::INDEX | wgpu::BufferUsages::COPY_DST, mapped_at_creation: false, @@ -271,7 +271,7 @@ impl GpuMesh { let materials = { let uniform_buffer_bindings = create_and_fill_uniform_buffer_batch( ctx, - data.label.clone().push_str(" - material uniforms"), + format!("{} - material uniforms", data.label).into(), data.materials .iter() .map(|material| gpu_data::MaterialUniformBuffer { diff --git a/crates/re_renderer/src/renderer/lines.rs b/crates/re_renderer/src/renderer/lines.rs index a3743fb8b83f..0f4674f2dc91 100644 --- a/crates/re_renderer/src/renderer/lines.rs +++ b/crates/re_renderer/src/renderer/lines.rs @@ -614,18 +614,13 @@ impl LineDrawData { )); for (range, _) in &batch_info.additional_outline_mask_ids_vertex_ranges { - batches_internal.push( - line_renderer.create_linestrip_batch( - ctx, - batch_info - .label - .clone() - .push_str(&format!("strip-only {range:?}")), - uniform_buffer_bindings_mask_only_batches.next().unwrap(), - range.clone(), - enum_set![DrawPhase::OutlineMask], - ), - ); + batches_internal.push(line_renderer.create_linestrip_batch( + ctx, + format!("{} strip-only {range:?}", batch_info.label).into(), + uniform_buffer_bindings_mask_only_batches.next().unwrap(), + range.clone(), + enum_set![DrawPhase::OutlineMask], + )); } start_vertex_for_next_batch = line_vertex_range_end; diff --git a/crates/re_renderer/src/view_builder.rs b/crates/re_renderer/src/view_builder.rs index 23edc60b3434..44935b09859e 100644 --- a/crates/re_renderer/src/view_builder.rs +++ b/crates/re_renderer/src/view_builder.rs @@ -546,7 +546,7 @@ impl ViewBuilder { crate::profile_scope!("main target pass"); let mut pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { - label: setup.name.clone().push_str(" - main pass").get(), + label: DebugLabel::from(format!("{} - main pass", setup.name)).get(), color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &setup.main_target_msaa.default_view, resolve_target: Some(&setup.main_target_resolved.default_view), @@ -617,7 +617,7 @@ impl ViewBuilder { let screenshot_texture = ctx.gpu_resources.textures.alloc( &ctx.device, &TextureDesc { - label: setup.name.clone().push_str(" - screenshot target"), + label: format!("{} - screenshot target", setup.name).into(), size: wgpu::Extent3d { width: setup.resolution_in_pixel[0], height: setup.resolution_in_pixel[1], @@ -633,7 +633,7 @@ impl ViewBuilder { { let mut pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { - label: setup.name.clone().push_str(" - screenshot").get(), + label: DebugLabel::from(format!("{} - screenshot", setup.name)).get(), color_attachments: &[Some(wgpu::RenderPassColorAttachment { view: &screenshot_texture.default_view, resolve_target: None, diff --git a/crates/re_renderer/src/wgpu_resources/texture_pool.rs b/crates/re_renderer/src/wgpu_resources/texture_pool.rs index fd547fda5af3..c113b4f603d8 100644 --- a/crates/re_renderer/src/wgpu_resources/texture_pool.rs +++ b/crates/re_renderer/src/wgpu_resources/texture_pool.rs @@ -58,7 +58,7 @@ impl TextureDesc { /// Copies the desc but adds a string to the label. pub fn with_label_push(&self, append_this: &str) -> Self { let mut copy = self.clone(); - copy.label = copy.label.push_str(append_this); + copy.label = format!("{}{append_this}", copy.label).into(); copy } } From ca9051d26253dd26033c6909c0a3c2931ee65416 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Wed, 29 Mar 2023 15:47:09 +0200 Subject: [PATCH 2/5] change most DebugLabels to more principled naming approach by mirrored rust field --- .../src/allocator/cpu_write_gpu_read_belt.rs | 2 +- .../re_renderer/src/allocator/gpu_readback_belt.rs | 2 +- crates/re_renderer/src/global_bindings.rs | 8 ++++---- crates/re_renderer/src/renderer/compositor.rs | 2 +- crates/re_renderer/src/renderer/generic_skybox.rs | 4 ++-- crates/re_renderer/src/renderer/lines.rs | 12 ++++++------ crates/re_renderer/src/renderer/mesh_renderer.rs | 12 ++++++------ crates/re_renderer/src/renderer/point_cloud.rs | 10 +++++----- crates/re_renderer/src/renderer/rectangles.rs | 6 +++--- crates/re_renderer/src/renderer/test_triangle.rs | 2 +- 10 files changed, 30 insertions(+), 30 deletions(-) diff --git a/crates/re_renderer/src/allocator/cpu_write_gpu_read_belt.rs b/crates/re_renderer/src/allocator/cpu_write_gpu_read_belt.rs index d4880e43d4d3..db9f14b0a8fa 100644 --- a/crates/re_renderer/src/allocator/cpu_write_gpu_read_belt.rs +++ b/crates/re_renderer/src/allocator/cpu_write_gpu_read_belt.rs @@ -346,7 +346,7 @@ impl CpuWriteGpuReadBelt { let buffer = buffer_pool.alloc( device, &BufferDesc { - label: "CpuWriteGpuReadBelt buffer".into(), + label: "CpuWriteGpuReadBelt chunk buffer".into(), size: buffer_size, usage: wgpu::BufferUsages::MAP_WRITE | wgpu::BufferUsages::COPY_SRC, mapped_at_creation: true, diff --git a/crates/re_renderer/src/allocator/gpu_readback_belt.rs b/crates/re_renderer/src/allocator/gpu_readback_belt.rs index 8d49923d8a46..2566bb9fbd42 100644 --- a/crates/re_renderer/src/allocator/gpu_readback_belt.rs +++ b/crates/re_renderer/src/allocator/gpu_readback_belt.rs @@ -205,7 +205,7 @@ impl GpuReadbackBelt { let buffer = buffer_pool.alloc( device, &BufferDesc { - label: "GpuReadbackBelt buffer".into(), + label: "GpuReadbackBelt chunk buffer".into(), size: buffer_size, usage: wgpu::BufferUsages::MAP_READ | wgpu::BufferUsages::COPY_DST, mapped_at_creation: false, diff --git a/crates/re_renderer/src/global_bindings.rs b/crates/re_renderer/src/global_bindings.rs index d6d4ebe43da5..c00ad0315c67 100644 --- a/crates/re_renderer/src/global_bindings.rs +++ b/crates/re_renderer/src/global_bindings.rs @@ -61,7 +61,7 @@ impl GlobalBindings { layout: pools.bind_group_layouts.get_or_create( device, &BindGroupLayoutDesc { - label: "global bind group layout".into(), + label: "GlobalBindings::layout".into(), // Needs to be kept in sync with `global_bindings.wgsl` / `create_bind_group` entries: vec![ @@ -99,7 +99,7 @@ impl GlobalBindings { nearest_neighbor_sampler: pools.samplers.get_or_create( device, &SamplerDesc { - label: "nearest".into(), + label: "GlobalBindings::nearest_neighbor_sampler".into(), address_mode_u: wgpu::AddressMode::Repeat, address_mode_v: wgpu::AddressMode::Repeat, address_mode_w: wgpu::AddressMode::Repeat, @@ -109,7 +109,7 @@ impl GlobalBindings { trilinear_sampler: pools.samplers.get_or_create( device, &SamplerDesc { - label: "linear".into(), + label: "GlobalBindings::trilinear_sampler".into(), mag_filter: wgpu::FilterMode::Linear, min_filter: wgpu::FilterMode::Linear, mipmap_filter: wgpu::FilterMode::Linear, @@ -134,7 +134,7 @@ impl GlobalBindings { pools, // Needs to be kept in sync with `global_bindings.wgsl` / `self.layout` &BindGroupDesc { - label: "global bind group".into(), + label: "GlobalBindings::create_bind_group".into(), entries: smallvec![ frame_uniform_buffer_binding, BindGroupEntry::Sampler(self.nearest_neighbor_sampler), diff --git a/crates/re_renderer/src/renderer/compositor.rs b/crates/re_renderer/src/renderer/compositor.rs index baf44525657a..a71e583e8bbd 100644 --- a/crates/re_renderer/src/renderer/compositor.rs +++ b/crates/re_renderer/src/renderer/compositor.rs @@ -89,7 +89,7 @@ impl CompositorDrawData { &ctx.device, &ctx.gpu_resources, &BindGroupDesc { - label: "compositor".into(), + label: "CompositorDrawData::bind_group".into(), entries: smallvec![ uniform_buffer_binding, BindGroupEntry::DefaultTextureView(color_texture.handle), diff --git a/crates/re_renderer/src/renderer/generic_skybox.rs b/crates/re_renderer/src/renderer/generic_skybox.rs index a83532256e34..96e5843efe49 100644 --- a/crates/re_renderer/src/renderer/generic_skybox.rs +++ b/crates/re_renderer/src/renderer/generic_skybox.rs @@ -57,11 +57,11 @@ impl Renderer for GenericSkybox { let render_pipeline = pools.render_pipelines.get_or_create( device, &RenderPipelineDesc { - label: "generic_skybox".into(), + label: "GenericSkybox::render_pipeline".into(), pipeline_layout: pools.pipeline_layouts.get_or_create( device, &PipelineLayoutDesc { - label: "global only".into(), + label: "GenericSkybox::render_pipeline".into(), entries: vec![shared_data.global_bindings.layout], }, &pools.bind_group_layouts, diff --git a/crates/re_renderer/src/renderer/lines.rs b/crates/re_renderer/src/renderer/lines.rs index 0f4674f2dc91..7a90f998ec8a 100644 --- a/crates/re_renderer/src/renderer/lines.rs +++ b/crates/re_renderer/src/renderer/lines.rs @@ -346,7 +346,7 @@ impl LineDrawData { let fallback_batches = [LineBatchInfo { world_from_obj: glam::Mat4::IDENTITY, - label: "all lines".into(), + label: "LineDrawData::fallback_batch".into(), line_vertex_count: vertices.len() as _, overall_outline_mask_ids: OutlineMaskPreference::NONE, additional_outline_mask_ids_vertex_ranges: Vec::new(), @@ -400,7 +400,7 @@ impl LineDrawData { let position_data_texture = ctx.gpu_resources.textures.alloc( &ctx.device, &TextureDesc { - label: "line position data".into(), + label: "LineDrawData::position_data_texture".into(), size: wgpu::Extent3d { width: POSITION_TEXTURE_SIZE, height: POSITION_TEXTURE_SIZE, @@ -416,7 +416,7 @@ impl LineDrawData { let line_strip_texture = ctx.gpu_resources.textures.alloc( &ctx.device, &TextureDesc { - label: "line strips".into(), + label: "LineDrawData::line_strip_texture".into(), size: wgpu::Extent3d { width: LINE_STRIP_TEXTURE_SIZE, height: LINE_STRIP_TEXTURE_SIZE, @@ -695,7 +695,7 @@ impl Renderer for LineRenderer { let bind_group_layout_all_lines = pools.bind_group_layouts.get_or_create( device, &BindGroupLayoutDesc { - label: "line renderer - all".into(), + label: "LineRenderer::bind_group_layout_all_lines".into(), entries: vec![ wgpu::BindGroupLayoutEntry { binding: 0, @@ -736,7 +736,7 @@ impl Renderer for LineRenderer { let bind_group_layout_batch = pools.bind_group_layouts.get_or_create( device, &BindGroupLayoutDesc { - label: "line renderer - batch".into(), + label: "LineRenderer::bind_group_layout_batch".into(), entries: vec![wgpu::BindGroupLayoutEntry { binding: 0, visibility: wgpu::ShaderStages::VERTEX | wgpu::ShaderStages::FRAGMENT, @@ -755,7 +755,7 @@ impl Renderer for LineRenderer { let pipeline_layout = pools.pipeline_layouts.get_or_create( device, &PipelineLayoutDesc { - label: "line renderer".into(), + label: "LineRenderer::pipeline_layout".into(), entries: vec![ shared_data.global_bindings.layout, bind_group_layout_all_lines, diff --git a/crates/re_renderer/src/renderer/mesh_renderer.rs b/crates/re_renderer/src/renderer/mesh_renderer.rs index 6790940549df..cdb0d3ef9f59 100644 --- a/crates/re_renderer/src/renderer/mesh_renderer.rs +++ b/crates/re_renderer/src/renderer/mesh_renderer.rs @@ -168,7 +168,7 @@ impl MeshDrawData { let instance_buffer = ctx.gpu_resources.buffers.alloc( &ctx.device, &BufferDesc { - label: "MeshDrawData instance buffer".into(), + label: "MeshDrawData::instance_buffer".into(), size: instance_buffer_size, usage: wgpu::BufferUsages::VERTEX | wgpu::BufferUsages::COPY_DST, mapped_at_creation: false, @@ -289,7 +289,7 @@ impl Renderer for MeshRenderer { let bind_group_layout = pools.bind_group_layouts.get_or_create( device, &BindGroupLayoutDesc { - label: "mesh renderer".into(), + label: "MeshRenderer::bind_group_layout".into(), entries: vec![ wgpu::BindGroupLayoutEntry { binding: 0, @@ -319,7 +319,7 @@ impl Renderer for MeshRenderer { let pipeline_layout = pools.pipeline_layouts.get_or_create( device, &PipelineLayoutDesc { - label: "mesh renderer".into(), + label: "MeshRenderer::pipeline_layout".into(), entries: vec![shared_data.global_bindings.layout, bind_group_layout], }, &pools.bind_group_layouts, @@ -329,7 +329,7 @@ impl Renderer for MeshRenderer { device, resolver, &ShaderModuleDesc { - label: "mesh renderer".into(), + label: "MeshRenderer".into(), source: include_file!("../../shader/instanced_mesh.wgsl"), }, ); @@ -348,7 +348,7 @@ impl Renderer for MeshRenderer { let render_pipeline_shaded = pools.render_pipelines.get_or_create( device, &RenderPipelineDesc { - label: "mesh renderer - shaded".into(), + label: "MeshRenderer::render_pipeline_shaded".into(), pipeline_layout, vertex_entrypoint: "vs_main".into(), vertex_handle: shader_module, @@ -367,7 +367,7 @@ impl Renderer for MeshRenderer { let render_pipeline_outline_mask = pools.render_pipelines.get_or_create( device, &RenderPipelineDesc { - label: "mesh renderer - outline mask".into(), + label: "MeshRenderer::render_pipeline_outline_mask".into(), pipeline_layout, vertex_entrypoint: "vs_main".into(), vertex_handle: shader_module, diff --git a/crates/re_renderer/src/renderer/point_cloud.rs b/crates/re_renderer/src/renderer/point_cloud.rs index 2f3e9e8fe50b..fd5eef376e93 100644 --- a/crates/re_renderer/src/renderer/point_cloud.rs +++ b/crates/re_renderer/src/renderer/point_cloud.rs @@ -201,7 +201,7 @@ impl PointCloudDrawData { } let fallback_batches = [PointCloudBatchInfo { - label: "all points".into(), + label: "fallback_batches".into(), world_from_obj: glam::Mat4::IDENTITY, flags: PointCloudBatchFlags::empty(), point_count: vertices.len() as _, @@ -242,7 +242,7 @@ impl PointCloudDrawData { // TODO(andreas): We want a "stack allocation" here that lives for one frame. // Note also that this doesn't protect against sharing the same texture with several PointDrawData! let position_data_texture_desc = TextureDesc { - label: "point cloud position data".into(), + label: "PointCloudDrawData::position_data_texture".into(), size: wgpu::Extent3d { width: DATA_TEXTURE_SIZE, height: DATA_TEXTURE_SIZE, @@ -541,7 +541,7 @@ impl Renderer for PointCloudRenderer { let bind_group_layout_all_points = pools.bind_group_layouts.get_or_create( device, &BindGroupLayoutDesc { - label: "point cloud - all".into(), + label: "PointCloudRenderer::bind_group_layout_all_points".into(), entries: vec![ wgpu::BindGroupLayoutEntry { binding: 0, @@ -592,7 +592,7 @@ impl Renderer for PointCloudRenderer { let bind_group_layout_batch = pools.bind_group_layouts.get_or_create( device, &BindGroupLayoutDesc { - label: "point cloud - batch".into(), + label: "PointCloudRenderer::bind_group_layout_batch".into(), entries: vec![wgpu::BindGroupLayoutEntry { binding: 0, visibility: wgpu::ShaderStages::VERTEX | wgpu::ShaderStages::FRAGMENT, @@ -611,7 +611,7 @@ impl Renderer for PointCloudRenderer { let pipeline_layout = pools.pipeline_layouts.get_or_create( device, &PipelineLayoutDesc { - label: "point cloud".into(), + label: "PointCloudRenderer::pipeline_layout".into(), entries: vec![ shared_data.global_bindings.layout, bind_group_layout_all_points, diff --git a/crates/re_renderer/src/renderer/rectangles.rs b/crates/re_renderer/src/renderer/rectangles.rs index 4563e48b4f77..aaac3ffd4899 100644 --- a/crates/re_renderer/src/renderer/rectangles.rs +++ b/crates/re_renderer/src/renderer/rectangles.rs @@ -190,7 +190,7 @@ impl RectangleDrawData { &ctx.device, &ctx.gpu_resources, &BindGroupDesc { - label: "rectangle".into(), + label: "RectangleInstance::bind_group".into(), entries: smallvec![ uniform_buffer, BindGroupEntry::DefaultTextureView(texture.handle), @@ -227,7 +227,7 @@ impl Renderer for RectangleRenderer { let bind_group_layout = pools.bind_group_layouts.get_or_create( device, &BindGroupLayoutDesc { - label: "rectangles".into(), + label: "RectangleRenderer::bind_group_layout".into(), entries: vec![ wgpu::BindGroupLayoutEntry { binding: 0, @@ -267,7 +267,7 @@ impl Renderer for RectangleRenderer { let pipeline_layout = pools.pipeline_layouts.get_or_create( device, &PipelineLayoutDesc { - label: "rectangle".into(), + label: "RectangleRenderer::pipeline_layout".into(), entries: vec![shared_data.global_bindings.layout, bind_group_layout], }, &pools.bind_group_layouts, diff --git a/crates/re_renderer/src/renderer/test_triangle.rs b/crates/re_renderer/src/renderer/test_triangle.rs index e752995110ef..21e810f40751 100644 --- a/crates/re_renderer/src/renderer/test_triangle.rs +++ b/crates/re_renderer/src/renderer/test_triangle.rs @@ -47,7 +47,7 @@ impl Renderer for TestTriangle { let render_pipeline = pools.render_pipelines.get_or_create( device, &RenderPipelineDesc { - label: "Test Triangle".into(), + label: "TestTriangle::render_pipeline".into(), pipeline_layout: pools.pipeline_layouts.get_or_create( device, &PipelineLayoutDesc { From 404b0cbdefd9a1e20881c156b99fb6e67719c800 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Wed, 29 Mar 2023 15:57:47 +0200 Subject: [PATCH 3/5] introduce include_shader_module for automatic debug labels on shader modules --- .../re_renderer/src/draw_phases/outlines.rs | 23 ++++++++----------- crates/re_renderer/src/renderer/compositor.rs | 9 +++----- .../re_renderer/src/renderer/debug_overlay.rs | 9 +++----- .../re_renderer/src/renderer/depth_cloud.rs | 11 ++++----- .../src/renderer/generic_skybox.rs | 10 +++----- crates/re_renderer/src/renderer/lines.rs | 10 +++----- .../re_renderer/src/renderer/mesh_renderer.rs | 9 +++----- crates/re_renderer/src/renderer/mod.rs | 6 ++--- .../re_renderer/src/renderer/point_cloud.rs | 11 +++------ crates/re_renderer/src/renderer/rectangles.rs | 8 ++----- .../re_renderer/src/renderer/test_triangle.rs | 16 ++++--------- .../src/wgpu_resources/shader_module_pool.rs | 11 +++++++++ 12 files changed, 50 insertions(+), 83 deletions(-) diff --git a/crates/re_renderer/src/draw_phases/outlines.rs b/crates/re_renderer/src/draw_phases/outlines.rs index fd4ae7f8a3ae..2b2c709d5225 100644 --- a/crates/re_renderer/src/draw_phases/outlines.rs +++ b/crates/re_renderer/src/draw_phases/outlines.rs @@ -46,13 +46,13 @@ use crate::{ allocator::create_and_fill_uniform_buffer_batch, config::HardwareTier, - include_file, + include_shader_module, renderer::screen_triangle_vertex_shader, view_builder::ViewBuilder, wgpu_resources::{ BindGroupDesc, BindGroupEntry, BindGroupLayoutDesc, GpuBindGroup, GpuBindGroupLayoutHandle, GpuRenderPipelineHandle, GpuTexture, PipelineLayoutDesc, PoolError, RenderPipelineDesc, - SamplerDesc, ShaderModuleDesc, WgpuResourcePools, + SamplerDesc, WgpuResourcePools, }, DebugLabel, RenderContext, }; @@ -266,6 +266,11 @@ impl OutlineMaskProcessor { let screen_triangle_vertex_shader = screen_triangle_vertex_shader(&mut ctx.gpu_resources, &ctx.device, &mut ctx.resolver); + let jumpflooding_init_shader_module = if mask_sample_count == 1 { + include_shader_module!("../../shader/outlines/jumpflooding_init.wgsl") + } else { + include_shader_module!("../../shader/outlines/jumpflooding_init_msaa.wgsl") + }; let jumpflooding_init_desc = RenderPipelineDesc { label: "OutlineMaskProcessor::jumpflooding_init".into(), pipeline_layout: ctx.gpu_resources.pipeline_layouts.get_or_create( @@ -282,14 +287,7 @@ impl OutlineMaskProcessor { fragment_handle: ctx.gpu_resources.shader_modules.get_or_create( &ctx.device, &mut ctx.resolver, - &ShaderModuleDesc { - label: "jumpflooding_init".into(), - source: if mask_sample_count == 1 { - include_file!("../../shader/outlines/jumpflooding_init.wgsl") - } else { - include_file!("../../shader/outlines/jumpflooding_init_msaa.wgsl") - }, - }, + &jumpflooding_init_shader_module, ), vertex_buffers: smallvec![], render_targets: smallvec![Some(Self::VORONOI_FORMAT.into())], @@ -318,10 +316,7 @@ impl OutlineMaskProcessor { fragment_handle: ctx.gpu_resources.shader_modules.get_or_create( &ctx.device, &mut ctx.resolver, - &ShaderModuleDesc { - label: "jumpflooding_step".into(), - source: include_file!("../../shader/outlines/jumpflooding_step.wgsl"), - }, + &include_shader_module!("../../shader/outlines/jumpflooding_step.wgsl"), ), ..jumpflooding_init_desc }, diff --git a/crates/re_renderer/src/renderer/compositor.rs b/crates/re_renderer/src/renderer/compositor.rs index a71e583e8bbd..5cba4b39e587 100644 --- a/crates/re_renderer/src/renderer/compositor.rs +++ b/crates/re_renderer/src/renderer/compositor.rs @@ -1,13 +1,13 @@ use crate::{ allocator::create_and_fill_uniform_buffer, context::SharedRendererData, - include_file, + include_shader_module, renderer::{screen_triangle_vertex_shader, DrawData, Renderer}, view_builder::ViewBuilder, wgpu_resources::{ BindGroupDesc, BindGroupEntry, BindGroupLayoutDesc, GpuBindGroup, GpuBindGroupLayoutHandle, GpuRenderPipelineHandle, GpuTexture, PipelineLayoutDesc, RenderPipelineDesc, - ShaderModuleDesc, WgpuResourcePools, + WgpuResourcePools, }, OutlineConfig, Rgba, }; @@ -172,10 +172,7 @@ impl Renderer for Compositor { fragment_handle: pools.shader_modules.get_or_create( device, resolver, - &ShaderModuleDesc { - label: "tonemap (fragment)".into(), - source: include_file!("../../shader/composite.wgsl"), - }, + &include_shader_module!("../../shader/composite.wgsl"), ), vertex_buffers: smallvec![], render_targets: smallvec![Some(shared_data.config.output_format_color.into())], diff --git a/crates/re_renderer/src/renderer/debug_overlay.rs b/crates/re_renderer/src/renderer/debug_overlay.rs index 63a668932577..f7dc4a4dbcec 100644 --- a/crates/re_renderer/src/renderer/debug_overlay.rs +++ b/crates/re_renderer/src/renderer/debug_overlay.rs @@ -2,11 +2,11 @@ use crate::{ allocator::create_and_fill_uniform_buffer, context::SharedRendererData, draw_phases::DrawPhase, - include_file, + include_shader_module, wgpu_resources::{ BindGroupDesc, BindGroupEntry, BindGroupLayoutDesc, GpuBindGroup, GpuBindGroupLayoutHandle, GpuRenderPipelineHandle, GpuTexture, PipelineLayoutDesc, RenderPipelineDesc, - ShaderModuleDesc, WgpuResourcePools, + WgpuResourcePools, }, IntRect, }; @@ -185,10 +185,7 @@ impl Renderer for DebugOverlayRenderer { let shader_module = pools.shader_modules.get_or_create( device, resolver, - &ShaderModuleDesc { - label: "DebugOverlay".into(), - source: include_file!("../../shader/debug_overlay.wgsl"), - }, + &include_shader_module!("../../shader/debug_overlay.wgsl"), ); let render_pipeline = pools.render_pipelines.get_or_create( device, diff --git a/crates/re_renderer/src/renderer/depth_cloud.rs b/crates/re_renderer/src/renderer/depth_cloud.rs index 762e5709f7a4..9d2b6898ae4e 100644 --- a/crates/re_renderer/src/renderer/depth_cloud.rs +++ b/crates/re_renderer/src/renderer/depth_cloud.rs @@ -16,13 +16,13 @@ use smallvec::smallvec; use crate::{ allocator::create_and_fill_uniform_buffer_batch, draw_phases::{DrawPhase, OutlineMaskProcessor}, - include_file, + include_shader_module, resource_managers::ResourceManagerError, view_builder::ViewBuilder, wgpu_resources::{ BindGroupDesc, BindGroupEntry, BindGroupLayoutDesc, GpuBindGroup, GpuBindGroupLayoutHandle, - GpuRenderPipelineHandle, GpuTexture, PipelineLayoutDesc, RenderPipelineDesc, - ShaderModuleDesc, TextureDesc, TextureRowDataInfo, + GpuRenderPipelineHandle, GpuTexture, PipelineLayoutDesc, RenderPipelineDesc, TextureDesc, + TextureRowDataInfo, }, ColorMap, OutlineMaskPreference, }; @@ -450,10 +450,7 @@ impl Renderer for DepthCloudRenderer { let shader_module = pools.shader_modules.get_or_create( device, resolver, - &ShaderModuleDesc { - label: "depth_cloud".into(), - source: include_file!("../../shader/depth_cloud.wgsl"), - }, + &include_shader_module!("../../shader/depth_cloud.wgsl"), ); let render_pipeline_desc_color = RenderPipelineDesc { diff --git a/crates/re_renderer/src/renderer/generic_skybox.rs b/crates/re_renderer/src/renderer/generic_skybox.rs index 96e5843efe49..e088c8b3a17d 100644 --- a/crates/re_renderer/src/renderer/generic_skybox.rs +++ b/crates/re_renderer/src/renderer/generic_skybox.rs @@ -3,12 +3,11 @@ use smallvec::smallvec; use crate::{ context::SharedRendererData, draw_phases::DrawPhase, - include_file, + include_shader_module, renderer::screen_triangle_vertex_shader, view_builder::ViewBuilder, wgpu_resources::{ - GpuRenderPipelineHandle, PipelineLayoutDesc, RenderPipelineDesc, ShaderModuleDesc, - WgpuResourcePools, + GpuRenderPipelineHandle, PipelineLayoutDesc, RenderPipelineDesc, WgpuResourcePools, }, }; @@ -73,10 +72,7 @@ impl Renderer for GenericSkybox { fragment_handle: pools.shader_modules.get_or_create( device, resolver, - &ShaderModuleDesc { - label: "generic_skybox (fragment)".into(), - source: include_file!("../../shader/generic_skybox.wgsl"), - }, + &include_shader_module!("../../shader/generic_skybox.wgsl"), ), vertex_buffers: smallvec![], render_targets: smallvec![Some(ViewBuilder::MAIN_TARGET_COLOR_FORMAT.into())], diff --git a/crates/re_renderer/src/renderer/lines.rs b/crates/re_renderer/src/renderer/lines.rs index 7a90f998ec8a..f44628dec59f 100644 --- a/crates/re_renderer/src/renderer/lines.rs +++ b/crates/re_renderer/src/renderer/lines.rs @@ -117,13 +117,12 @@ use smallvec::smallvec; use crate::{ allocator::create_and_fill_uniform_buffer_batch, draw_phases::{DrawPhase, OutlineMaskProcessor}, - include_file, + include_shader_module, size::Size, view_builder::ViewBuilder, wgpu_resources::{ BindGroupDesc, BindGroupEntry, BindGroupLayoutDesc, GpuBindGroup, GpuBindGroupLayoutHandle, - GpuRenderPipelineHandle, PipelineLayoutDesc, PoolError, RenderPipelineDesc, - ShaderModuleDesc, TextureDesc, + GpuRenderPipelineHandle, PipelineLayoutDesc, PoolError, RenderPipelineDesc, TextureDesc, }, Color32, DebugLabel, OutlineMaskPreference, }; @@ -768,10 +767,7 @@ impl Renderer for LineRenderer { let shader_module = pools.shader_modules.get_or_create( device, resolver, - &ShaderModuleDesc { - label: "LineRenderer".into(), - source: include_file!("../../shader/lines.wgsl"), - }, + &include_shader_module!("../../shader/lines.wgsl"), ); let render_pipeline_color = pools.render_pipelines.get_or_create( diff --git a/crates/re_renderer/src/renderer/mesh_renderer.rs b/crates/re_renderer/src/renderer/mesh_renderer.rs index cdb0d3ef9f59..ebaa12592956 100644 --- a/crates/re_renderer/src/renderer/mesh_renderer.rs +++ b/crates/re_renderer/src/renderer/mesh_renderer.rs @@ -10,13 +10,13 @@ use smallvec::smallvec; use crate::{ draw_phases::{DrawPhase, OutlineMaskProcessor}, - include_file, + include_shader_module, mesh::{gpu_data::MaterialUniformBuffer, mesh_vertices, GpuMesh, Mesh}, resource_managers::{GpuMeshHandle, ResourceHandle}, view_builder::ViewBuilder, wgpu_resources::{ BindGroupLayoutDesc, BufferDesc, GpuBindGroupLayoutHandle, GpuBuffer, - GpuRenderPipelineHandle, PipelineLayoutDesc, RenderPipelineDesc, ShaderModuleDesc, + GpuRenderPipelineHandle, PipelineLayoutDesc, RenderPipelineDesc, }, Color32, OutlineMaskPreference, }; @@ -328,10 +328,7 @@ impl Renderer for MeshRenderer { let shader_module = pools.shader_modules.get_or_create( device, resolver, - &ShaderModuleDesc { - label: "MeshRenderer".into(), - source: include_file!("../../shader/instanced_mesh.wgsl"), - }, + &include_shader_module!("../../shader/instanced_mesh.wgsl"), ); let primitive = wgpu::PrimitiveState { diff --git a/crates/re_renderer/src/renderer/mod.rs b/crates/re_renderer/src/renderer/mod.rs index 679620cc45bf..c3402add43d0 100644 --- a/crates/re_renderer/src/renderer/mod.rs +++ b/crates/re_renderer/src/renderer/mod.rs @@ -34,6 +34,7 @@ pub use debug_overlay::{DebugOverlayDrawData, DebugOverlayRenderer}; use crate::{ context::{RenderContext, SharedRendererData}, draw_phases::DrawPhase, + include_shader_module, wgpu_resources::WgpuResourcePools, FileResolver, FileSystem, }; @@ -87,9 +88,6 @@ pub fn screen_triangle_vertex_shader( pools.shader_modules.get_or_create( device, resolver, - &crate::wgpu_resources::ShaderModuleDesc { - label: "screen_triangle (vertex)".into(), - source: crate::include_file!("../../shader/screen_triangle.wgsl"), - }, + &include_shader_module!("../../shader/screen_triangle.wgsl"), ) } diff --git a/crates/re_renderer/src/renderer/point_cloud.rs b/crates/re_renderer/src/renderer/point_cloud.rs index fd5eef376e93..1e9bfb77a578 100644 --- a/crates/re_renderer/src/renderer/point_cloud.rs +++ b/crates/re_renderer/src/renderer/point_cloud.rs @@ -18,7 +18,7 @@ use std::{num::NonZeroU64, ops::Range}; use crate::{ allocator::create_and_fill_uniform_buffer_batch, draw_phases::{DrawPhase, OutlineMaskProcessor, PickingLayerObjectId, PickingLayerProcessor}, - DebugLabel, OutlineMaskPreference, PointCloudBuilder, + include_shader_module, DebugLabel, OutlineMaskPreference, PointCloudBuilder, }; use bitflags::bitflags; use bytemuck::Zeroable as _; @@ -27,12 +27,10 @@ use itertools::Itertools as _; use smallvec::smallvec; use crate::{ - include_file, view_builder::ViewBuilder, wgpu_resources::{ BindGroupDesc, BindGroupEntry, BindGroupLayoutDesc, GpuBindGroup, GpuBindGroupLayoutHandle, - GpuRenderPipelineHandle, PipelineLayoutDesc, RenderPipelineDesc, ShaderModuleDesc, - TextureDesc, + GpuRenderPipelineHandle, PipelineLayoutDesc, RenderPipelineDesc, TextureDesc, }, Size, }; @@ -624,10 +622,7 @@ impl Renderer for PointCloudRenderer { let shader_module = pools.shader_modules.get_or_create( device, resolver, - &ShaderModuleDesc { - label: "point cloud".into(), - source: include_file!("../../shader/point_cloud.wgsl"), - }, + &include_shader_module!("../../shader/point_cloud.wgsl"), ); let render_pipeline_desc_color = RenderPipelineDesc { diff --git a/crates/re_renderer/src/renderer/rectangles.rs b/crates/re_renderer/src/renderer/rectangles.rs index aaac3ffd4899..5238c3818886 100644 --- a/crates/re_renderer/src/renderer/rectangles.rs +++ b/crates/re_renderer/src/renderer/rectangles.rs @@ -16,13 +16,12 @@ use crate::{ allocator::create_and_fill_uniform_buffer_batch, depth_offset::DepthOffset, draw_phases::{DrawPhase, OutlineMaskProcessor}, - include_file, + include_shader_module, resource_managers::{GpuTexture2DHandle, ResourceManagerError}, view_builder::ViewBuilder, wgpu_resources::{ BindGroupDesc, BindGroupEntry, BindGroupLayoutDesc, GpuBindGroup, GpuBindGroupLayoutHandle, GpuRenderPipelineHandle, PipelineLayoutDesc, RenderPipelineDesc, SamplerDesc, - ShaderModuleDesc, }, OutlineMaskPreference, Rgba, }; @@ -276,10 +275,7 @@ impl Renderer for RectangleRenderer { let shader_module = pools.shader_modules.get_or_create( device, resolver, - &ShaderModuleDesc { - label: "rectangle".into(), - source: include_file!("../../shader/rectangle.wgsl"), - }, + &include_shader_module!("../../shader/rectangle.wgsl"), ); let render_pipeline_desc_color = RenderPipelineDesc { diff --git a/crates/re_renderer/src/renderer/test_triangle.rs b/crates/re_renderer/src/renderer/test_triangle.rs index 21e810f40751..c5f025f6f2a1 100644 --- a/crates/re_renderer/src/renderer/test_triangle.rs +++ b/crates/re_renderer/src/renderer/test_triangle.rs @@ -2,11 +2,9 @@ use smallvec::smallvec; use crate::{ context::SharedRendererData, - include_file, + include_shader_module, view_builder::ViewBuilder, - wgpu_resources::{ - GpuRenderPipelineHandle, PipelineLayoutDesc, RenderPipelineDesc, ShaderModuleDesc, - }, + wgpu_resources::{GpuRenderPipelineHandle, PipelineLayoutDesc, RenderPipelineDesc}, }; use super::*; @@ -60,19 +58,13 @@ impl Renderer for TestTriangle { vertex_handle: pools.shader_modules.get_or_create( device, resolver, - &ShaderModuleDesc { - label: "test_triangle (vertex)".into(), - source: include_file!("../../shader/test_triangle.wgsl"), - }, + &include_shader_module!("../../shader/test_triangle.wgsl"), ), fragment_entrypoint: "fs_main".into(), fragment_handle: pools.shader_modules.get_or_create( device, resolver, - &ShaderModuleDesc { - label: "test_triangle (fragment)".into(), - source: include_file!("../../shader/test_triangle.wgsl"), - }, + &include_shader_module!("../../shader/test_triangle.wgsl"), ), vertex_buffers: smallvec![], render_targets: smallvec![Some(ViewBuilder::MAIN_TARGET_COLOR_FORMAT.into())], diff --git a/crates/re_renderer/src/wgpu_resources/shader_module_pool.rs b/crates/re_renderer/src/wgpu_resources/shader_module_pool.rs index 0aabb606c6a3..8516b2604a8c 100644 --- a/crates/re_renderer/src/wgpu_resources/shader_module_pool.rs +++ b/crates/re_renderer/src/wgpu_resources/shader_module_pool.rs @@ -14,6 +14,17 @@ use super::{ slotmap::new_key_type! { pub struct GpuShaderModuleHandle; } +/// Create a shader module using the [`include_file!`] macro and set the path name as debug string. +#[macro_export] +macro_rules! include_shader_module { + ($path:expr $(,)?) => {{ + $crate::wgpu_resources::ShaderModuleDesc { + label: $crate::DebugLabel::from(stringify!($path)), + source: $crate::include_file!($path), + } + }}; +} + #[derive(Clone, Eq, Debug)] pub struct ShaderModuleDesc { /// Debug label of the shader. From 489b7cfa104f4d67de7093d486d61c46ad6e3b39 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Wed, 29 Mar 2023 16:17:48 +0200 Subject: [PATCH 4/5] doc warning fix --- crates/re_renderer/src/wgpu_resources/shader_module_pool.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/re_renderer/src/wgpu_resources/shader_module_pool.rs b/crates/re_renderer/src/wgpu_resources/shader_module_pool.rs index 8516b2604a8c..a6d23478b882 100644 --- a/crates/re_renderer/src/wgpu_resources/shader_module_pool.rs +++ b/crates/re_renderer/src/wgpu_resources/shader_module_pool.rs @@ -14,7 +14,7 @@ use super::{ slotmap::new_key_type! { pub struct GpuShaderModuleHandle; } -/// Create a shader module using the [`include_file!`] macro and set the path name as debug string. +/// Create a shader module using the `include_file!` macro and set the path name as debug string. #[macro_export] macro_rules! include_shader_module { ($path:expr $(,)?) => {{ From 047bb9c62fed216a9af25f07130d21c2e111be07 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Wed, 29 Mar 2023 16:50:45 +0200 Subject: [PATCH 5/5] strip path prefix from shader --- crates/re_renderer/src/wgpu_resources/shader_module_pool.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/re_renderer/src/wgpu_resources/shader_module_pool.rs b/crates/re_renderer/src/wgpu_resources/shader_module_pool.rs index a6d23478b882..1fb291f47f05 100644 --- a/crates/re_renderer/src/wgpu_resources/shader_module_pool.rs +++ b/crates/re_renderer/src/wgpu_resources/shader_module_pool.rs @@ -19,7 +19,7 @@ slotmap::new_key_type! { pub struct GpuShaderModuleHandle; } macro_rules! include_shader_module { ($path:expr $(,)?) => {{ $crate::wgpu_resources::ShaderModuleDesc { - label: $crate::DebugLabel::from(stringify!($path)), + label: $crate::DebugLabel::from(stringify!($path).strip_prefix("../../shader/")), source: $crate::include_file!($path), } }};