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

[wgpu-core] Remove tracking data from resources that are not tracked #6088

Merged
merged 2 commits into from
Aug 8, 2024
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
4 changes: 0 additions & 4 deletions wgpu-core/src/binding_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 513,6 @@ pub struct BindGroupLayout<A: HalApi> {
pub(crate) binding_count_validator: BindingTypeMaxCountValidator,
/// The `label` from the descriptor used to create the resource.
pub(crate) label: String,
pub(crate) tracking_data: TrackingData,
}

impl<A: HalApi> Drop for BindGroupLayout<A> {
Expand All @@ -535,7 534,6 @@ crate::impl_resource_type!(BindGroupLayout);
crate::impl_labeled!(BindGroupLayout);
crate::impl_parent_device!(BindGroupLayout);
crate::impl_storage_item!(BindGroupLayout);
crate::impl_trackable!(BindGroupLayout);

impl<A: HalApi> BindGroupLayout<A> {
pub(crate) fn raw(&self) -> &A::BindGroupLayout {
Expand Down Expand Up @@ -657,7 655,6 @@ pub struct PipelineLayout<A: HalApi> {
pub(crate) device: Arc<Device<A>>,
/// The `label` from the descriptor used to create the resource.
pub(crate) label: String,
pub(crate) tracking_data: TrackingData,
pub(crate) bind_group_layouts: ArrayVec<Arc<BindGroupLayout<A>>, { hal::MAX_BIND_GROUPS }>,
pub(crate) push_constant_ranges: ArrayVec<wgt::PushConstantRange, { SHADER_STAGE_COUNT }>,
}
Expand Down Expand Up @@ -769,7 766,6 @@ crate::impl_resource_type!(PipelineLayout);
crate::impl_labeled!(PipelineLayout);
crate::impl_parent_device!(PipelineLayout);
crate::impl_storage_item!(PipelineLayout);
crate::impl_trackable!(PipelineLayout);

#[repr(C)]
#[derive(Clone, Debug, Hash, Eq, PartialEq)]
Expand Down
3 changes: 0 additions & 3 deletions wgpu-core/src/device/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1866,7 1866,6 @@ impl<A: HalApi> Device<A> {
exclusive_pipeline: OnceCell::new(),
binding_count_validator: count_validator,
label: label.to_string(),
tracking_data: TrackingData::new(self.tracker_indices.bind_group_layouts.clone()),
})
}

Expand Down Expand Up @@ -2577,7 2576,6 @@ impl<A: HalApi> Device<A> {
raw: Some(raw),
device: self.clone(),
label: desc.label.to_string(),
tracking_data: TrackingData::new(self.tracker_indices.pipeline_layouts.clone()),
bind_group_layouts,
push_constant_ranges: desc.push_constant_ranges.iter().cloned().collect(),
})
Expand Down Expand Up @@ -3428,7 3426,6 @@ impl<A: HalApi> Device<A> {
let cache = pipeline::PipelineCache {
device: self.clone(),
label: desc.label.to_string(),
tracking_data: TrackingData::new(self.tracker_indices.pipeline_caches.clone()),
// This would be none in the error condition, which we don't implement yet
raw: Some(raw),
};
Expand Down
2 changes: 0 additions & 2 deletions wgpu-core/src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 303,6 @@ pub struct PipelineCache<A: HalApi> {
pub(crate) device: Arc<Device<A>>,
/// The `label` from the descriptor used to create the resource.
pub(crate) label: String,
pub(crate) tracking_data: TrackingData,
}

impl<A: HalApi> Drop for PipelineCache<A> {
Expand All @@ -322,7 321,6 @@ crate::impl_resource_type!(PipelineCache);
crate::impl_labeled!(PipelineCache);
crate::impl_parent_device!(PipelineCache);
crate::impl_storage_item!(PipelineCache);
crate::impl_trackable!(PipelineCache);

/// Describes how the vertex buffer is interpreted.
#[derive(Clone, Debug)]
Expand Down
2 changes: 1 addition & 1 deletion wgpu-core/src/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 173,7 @@ macro_rules! impl_labeled {
};
}

pub(crate) trait Trackable: Labeled {
pub(crate) trait Trackable {
fn tracker_index(&self) -> TrackerIndex;
}

Expand Down
6 changes: 0 additions & 6 deletions wgpu-core/src/track/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 221,10 @@ pub(crate) struct TrackerIndexAllocators {
pub texture_views: Arc<SharedTrackerIndexAllocator>,
pub samplers: Arc<SharedTrackerIndexAllocator>,
pub bind_groups: Arc<SharedTrackerIndexAllocator>,
pub bind_group_layouts: Arc<SharedTrackerIndexAllocator>,
pub compute_pipelines: Arc<SharedTrackerIndexAllocator>,
pub render_pipelines: Arc<SharedTrackerIndexAllocator>,
pub pipeline_layouts: Arc<SharedTrackerIndexAllocator>,
pub bundles: Arc<SharedTrackerIndexAllocator>,
pub query_sets: Arc<SharedTrackerIndexAllocator>,
pub pipeline_caches: Arc<SharedTrackerIndexAllocator>,
}

impl TrackerIndexAllocators {
Expand All @@ -238,13 235,10 @@ impl TrackerIndexAllocators {
texture_views: Arc::new(SharedTrackerIndexAllocator::new()),
samplers: Arc::new(SharedTrackerIndexAllocator::new()),
bind_groups: Arc::new(SharedTrackerIndexAllocator::new()),
bind_group_layouts: Arc::new(SharedTrackerIndexAllocator::new()),
compute_pipelines: Arc::new(SharedTrackerIndexAllocator::new()),
render_pipelines: Arc::new(SharedTrackerIndexAllocator::new()),
pipeline_layouts: Arc::new(SharedTrackerIndexAllocator::new()),
bundles: Arc::new(SharedTrackerIndexAllocator::new()),
query_sets: Arc::new(SharedTrackerIndexAllocator::new()),
pipeline_caches: Arc::new(SharedTrackerIndexAllocator::new()),
}
}
}
Expand Down
Loading