mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Add logging to LifetimeTracker::triage_suspected.
This adds `log::debug` lines reporting the decision to actually free something, for all resource types.
This commit is contained in:
committed by
Dzmitry Malyshau
parent
1e42208657
commit
d6f3472467
@@ -445,6 +445,7 @@ impl<A: HalApi> LifetimeTracker<A> {
|
||||
|
||||
while let Some(id) = self.suspected_resources.render_bundles.pop() {
|
||||
if trackers.bundles.remove_abandoned(id) {
|
||||
log::debug!("Bundle {:?} will be destroyed", id);
|
||||
#[cfg(feature = "trace")]
|
||||
if let Some(t) = trace {
|
||||
t.lock().add(trace::Action::DestroyRenderBundle(id.0));
|
||||
@@ -463,6 +464,7 @@ impl<A: HalApi> LifetimeTracker<A> {
|
||||
|
||||
while let Some(id) = self.suspected_resources.bind_groups.pop() {
|
||||
if trackers.bind_groups.remove_abandoned(id) {
|
||||
log::debug!("Bind group {:?} will be destroyed", id);
|
||||
#[cfg(feature = "trace")]
|
||||
if let Some(t) = trace {
|
||||
t.lock().add(trace::Action::DestroyBindGroup(id.0));
|
||||
@@ -494,6 +496,7 @@ impl<A: HalApi> LifetimeTracker<A> {
|
||||
let mut list = mem::take(&mut self.suspected_resources.texture_views);
|
||||
for id in list.drain(..) {
|
||||
if trackers.views.remove_abandoned(id) {
|
||||
log::debug!("Texture view {:?} will be destroyed", id);
|
||||
#[cfg(feature = "trace")]
|
||||
if let Some(t) = trace {
|
||||
t.lock().add(trace::Action::DestroyTextureView(id.0));
|
||||
@@ -520,6 +523,7 @@ impl<A: HalApi> LifetimeTracker<A> {
|
||||
|
||||
for id in self.suspected_resources.textures.drain(..) {
|
||||
if trackers.textures.remove_abandoned(id) {
|
||||
log::debug!("Texture {:?} will be destroyed", id);
|
||||
#[cfg(feature = "trace")]
|
||||
if let Some(t) = trace {
|
||||
t.lock().add(trace::Action::DestroyTexture(id.0));
|
||||
@@ -556,6 +560,7 @@ impl<A: HalApi> LifetimeTracker<A> {
|
||||
|
||||
for id in self.suspected_resources.samplers.drain(..) {
|
||||
if trackers.samplers.remove_abandoned(id) {
|
||||
log::debug!("Sampler {:?} will be destroyed", id);
|
||||
#[cfg(feature = "trace")]
|
||||
if let Some(t) = trace {
|
||||
t.lock().add(trace::Action::DestroySampler(id.0));
|
||||
@@ -580,11 +585,11 @@ impl<A: HalApi> LifetimeTracker<A> {
|
||||
|
||||
for id in self.suspected_resources.buffers.drain(..) {
|
||||
if trackers.buffers.remove_abandoned(id) {
|
||||
log::debug!("Buffer {:?} will be destroyed", id);
|
||||
#[cfg(feature = "trace")]
|
||||
if let Some(t) = trace {
|
||||
t.lock().add(trace::Action::DestroyBuffer(id.0));
|
||||
}
|
||||
log::debug!("Buffer {:?} is detached", id);
|
||||
|
||||
if let Some(res) = hub.buffers.unregister_locked(id.0, &mut *guard) {
|
||||
let submit_index = res.life_guard.life_count();
|
||||
@@ -608,6 +613,7 @@ impl<A: HalApi> LifetimeTracker<A> {
|
||||
|
||||
for id in self.suspected_resources.compute_pipelines.drain(..) {
|
||||
if trackers.compute_pipes.remove_abandoned(id) {
|
||||
log::debug!("Compute pipeline {:?} will be destroyed", id);
|
||||
#[cfg(feature = "trace")]
|
||||
if let Some(t) = trace {
|
||||
t.lock().add(trace::Action::DestroyComputePipeline(id.0));
|
||||
@@ -632,6 +638,7 @@ impl<A: HalApi> LifetimeTracker<A> {
|
||||
|
||||
for id in self.suspected_resources.render_pipelines.drain(..) {
|
||||
if trackers.render_pipes.remove_abandoned(id) {
|
||||
log::debug!("Render pipeline {:?} will be destroyed", id);
|
||||
#[cfg(feature = "trace")]
|
||||
if let Some(t) = trace {
|
||||
t.lock().add(trace::Action::DestroyRenderPipeline(id.0));
|
||||
@@ -660,6 +667,7 @@ impl<A: HalApi> LifetimeTracker<A> {
|
||||
{
|
||||
//Note: this has to happen after all the suspected pipelines are destroyed
|
||||
if ref_count.load() == 1 {
|
||||
log::debug!("Pipeline layout {:?} will be destroyed", id);
|
||||
#[cfg(feature = "trace")]
|
||||
if let Some(t) = trace {
|
||||
t.lock().add(trace::Action::DestroyPipelineLayout(id.0));
|
||||
@@ -684,6 +692,7 @@ impl<A: HalApi> LifetimeTracker<A> {
|
||||
//Note: same BGL can appear multiple times in the list, but only the last
|
||||
// encounter could drop the refcount to 0.
|
||||
if guard[id].multi_ref_count.dec_and_check_empty() {
|
||||
log::debug!("Bind group layout {:?} will be destroyed", id);
|
||||
#[cfg(feature = "trace")]
|
||||
if let Some(t) = trace {
|
||||
t.lock().add(trace::Action::DestroyBindGroupLayout(id.0));
|
||||
@@ -701,6 +710,7 @@ impl<A: HalApi> LifetimeTracker<A> {
|
||||
|
||||
for id in self.suspected_resources.query_sets.drain(..) {
|
||||
if trackers.query_sets.remove_abandoned(id) {
|
||||
log::debug!("Query set {:?} will be destroyed", id);
|
||||
// #[cfg(feature = "trace")]
|
||||
// trace.map(|t| t.lock().add(trace::Action::DestroyComputePipeline(id.0)));
|
||||
if let Some(res) = hub.query_sets.unregister_locked(id.0, &mut *guard) {
|
||||
|
||||
Reference in New Issue
Block a user