Skip to content

Commit

Permalink
Log static re_renderer resource generation (#1464)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wumpf authored Mar 1, 2023
1 parent c31fae6 commit 564e343
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use super::{resource::PoolError, static_resource_pool::StaticResourcePool};

slotmap::new_key_type! { pub struct GpuBindGroupLayoutHandle; }

#[derive(Clone, Hash, PartialEq, Eq, Default)]
#[derive(Debug, Clone, Hash, PartialEq, Eq, Default)]
pub struct BindGroupLayoutDesc {
/// Debug label of the bind group layout. This will show up in graphics debuggers for easy identification.
pub label: DebugLabel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct GpuPipelineLayout {
pub layout: wgpu::PipelineLayout,
}

#[derive(Clone, Hash, PartialEq, Eq)]
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
pub struct PipelineLayoutDesc {
/// Debug label of the pipeline layout. This will show up in graphics debuggers for easy identification.
pub label: DebugLabel,
Expand Down
2 changes: 1 addition & 1 deletion crates/re_renderer/src/wgpu_resources/sampler_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::debug_label::DebugLabel;

slotmap::new_key_type! { pub struct GpuSamplerHandle; }

#[derive(Clone, Default, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, Default, PartialEq, Eq, Hash)]
pub struct SamplerDesc {
/// Debug label of the sampler. This will show up in graphics debuggers for easy identification.
pub label: DebugLabel,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl<Handle: Key, Desc, Res> Default for StaticResourcePool<Handle, Desc, Res> {
impl<Handle, Desc, Res> StaticResourcePool<Handle, Desc, Res>
where
Handle: Key,
Desc: Clone + Eq + Hash,
Desc: std::fmt::Debug + Clone + Eq + Hash,
{
fn to_pool_error<T>(get_result: Option<T>, handle: Handle) -> Result<T, PoolError> {
get_result.ok_or_else(|| {
Expand All @@ -51,6 +51,7 @@ where
creation_func: F,
) -> Handle {
*self.lookup.entry(desc.clone()).or_insert_with(|| {
re_log::debug!(?desc, "Created new resource");
let resource = creation_func(desc);
self.resources.insert(StoredResource {
resource,
Expand Down
9 changes: 9 additions & 0 deletions crates/re_renderer/src/wgpu_resources/texture_pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ pub struct TextureDesc {
pub usage: wgpu::TextureUsages,
}

impl TextureDesc {
/// Copies the desc but changes the label.
pub fn with_label(&self, label: DebugLabel) -> Self {
let mut new = self.clone();
new.label = label;
new
}
}

impl DynamicResourcesDesc for TextureDesc {
/// Number of bytes this texture is expected to take.
///
Expand Down

0 comments on commit 564e343

Please sign in to comment.