Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log static re_renderer resource generation #1464

Merged
merged 1 commit into from
Mar 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This slipped in here by accident - I need it on my current work-stream but it has nothing to do with the pr description

But now it's here, so I'm keeping it :)

let mut new = self.clone();
new.label = label;
new
}
}

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