Skip to content

Commit

Permalink
Log spring cleaning (#6065)
Browse files Browse the repository at this point in the history
Remove unused logs in wgpu-core and wgpu-hal
  • Loading branch information
nical authored Jul 31, 2024
1 parent 7ff80d6 commit 9c6ae1b
Show file tree
Hide file tree
Showing 15 changed files with 6 additions and 153 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ Bottom level categories:
- Fix crash when dropping the surface after the device. By @wumpf in [#6052](https://github.com/gfx-rs/wgpu/pull/6052)
- Fix error message that is thrown in create_render_pass to no longer say `compute_pass`. By @matthew-wong1 [#6041](https://github.com/gfx-rs/wgpu/pull/6041)

### Changes

- Reduce the amount of debug and trace logs emitted by wgpu-core and wgpu-hal. By @nical in [#6065](https://github.com/gfx-rs/wgpu/issues/6065)

### Dependency Updates

#### GLES
Expand Down
2 changes: 0 additions & 2 deletions wgpu-core/src/command/bind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,6 @@ impl<A: HalApi> Binder<A> {
bind_group: &Arc<BindGroup<A>>,
offsets: &[wgt::DynamicOffset],
) -> &'a [EntryPayload<A>] {
log::trace!("\tBinding [{}] = group {}", index, bind_group.error_ident());

let payload = &mut self.payloads[index];
payload.group = Some(bind_group.clone());
payload.dynamic_offsets.clear();
Expand Down
2 changes: 0 additions & 2 deletions wgpu-core/src/command/compute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,6 @@ impl<'scope, 'snatch_guard, 'cmd_buf, 'raw_encoder, A: HalApi>
.set_and_remove_from_usage_scope_sparse(&mut self.scope.buffers, indirect_buffer);
}

log::trace!("Encoding dispatch barriers");

CommandBuffer::drain_barriers(
self.raw_encoder,
&mut self.intermediate_trackers,
Expand Down
2 changes: 0 additions & 2 deletions wgpu-core/src/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,6 @@ impl<A: HalApi> CommandBuffer<A> {
}

pub(crate) fn extract_baked_commands(&mut self) -> BakedCommands<A> {
log::trace!("Extracting BakedCommands from {}", self.error_ident());
let data = self.data.lock().take().unwrap();
BakedCommands {
encoder: data.encoder.raw,
Expand Down Expand Up @@ -626,7 +625,6 @@ impl Global {
cmd_buf_data.status = CommandEncoderStatus::Finished;
//Note: if we want to stop tracking the swapchain texture view,
// this is the place to do it.
log::trace!("Command buffer {:?}", encoder_id);
None
}
}
Expand Down
3 changes: 0 additions & 3 deletions wgpu-core/src/command/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1600,8 +1600,6 @@ impl Global {
*status = CommandEncoderStatus::Error;
encoder.open_pass(hal_label).map_pass_err(pass_scope)?;

log::trace!("Encoding render pass begin in {}", cmd_buf.error_ident());

let info = RenderPassInfo::start(
device,
hal_label,
Expand Down Expand Up @@ -1907,7 +1905,6 @@ impl Global {
}
}

log::trace!("Merging renderpass into {}", cmd_buf.error_ident());
let (trackers, pending_discard_init_fixups) = state
.info
.finish(state.raw_encoder, state.snatch_guard)
Expand Down
12 changes: 1 addition & 11 deletions wgpu-core/src/device/life.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::{
},
hal_api::HalApi,
id,
resource::{self, Buffer, Labeled, Texture, Trackable},
resource::{self, Buffer, Texture, Trackable},
snatch::SnatchGuard,
SubmissionIndex,
};
Expand Down Expand Up @@ -283,7 +283,6 @@ impl<A: HalApi> LifetimeTracker<A> {

let mut work_done_closures: SmallVec<_> = self.work_done_closures.drain(..).collect();
for a in self.active.drain(..done_count) {
log::debug!("Active submission {} is done", a.index);
self.ready_to_map.extend(a.mapped);
for encoder in a.encoders {
let raw = unsafe { encoder.land() };
Expand Down Expand Up @@ -339,12 +338,6 @@ impl<A: HalApi> LifetimeTracker<A> {
.rev()
.find(|a| a.contains_buffer(&buffer));

log::trace!(
"Mapping of {} at submission {:?}",
buffer.error_ident(),
submission.as_deref().map(|s| s.index)
);

submission
.map_or(&mut self.ready_to_map, |a| &mut a.mapped)
.push(buffer);
Expand All @@ -369,8 +362,6 @@ impl<A: HalApi> LifetimeTracker<A> {
Vec::with_capacity(self.ready_to_map.len());

for buffer in self.ready_to_map.drain(..) {
let tracker_index = buffer.tracker_index();

// This _cannot_ be inlined into the match. If it is, the lock will be held
// open through the whole match, resulting in a deadlock when we try to re-lock
// the buffer back to active.
Expand All @@ -391,7 +382,6 @@ impl<A: HalApi> LifetimeTracker<A> {
_ => panic!("No pending mapping."),
};
let status = if pending_mapping.range.start != pending_mapping.range.end {
log::debug!("Buffer {tracker_index:?} map state -> Active");
let host = pending_mapping.op.host;
let size = pending_mapping.range.end - pending_mapping.range.start;
match super::map_buffer(
Expand Down
3 changes: 0 additions & 3 deletions wgpu-core/src/device/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1187,7 +1187,6 @@ impl Global {
))
.map_err(DeviceError::from)?
};
log::trace!("Stitching command buffer {:?} before submission", cmb_id);

//Note: locking the trackers has to be done after the storages
let mut trackers = device.trackers.lock();
Expand Down Expand Up @@ -1241,8 +1240,6 @@ impl Global {
pending_textures: FastHashMap::default(),
});
}

log::trace!("Device after submission {}", submit_index);
}
}

Expand Down
8 changes: 0 additions & 8 deletions wgpu-core/src/device/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1230,12 +1230,6 @@ impl<A: HalApi> Device<A> {
texture.hal_usage & mask_copy & mask_dimension & mask_mip_level
};

log::debug!(
"Create view for {} filters usages to {:?}",
texture.error_ident(),
usage
);

// use the combined depth-stencil format for the view
let format = if resolved_format.is_depth_stencil_component(texture.desc.format) {
texture.desc.format
Expand Down Expand Up @@ -2796,7 +2790,6 @@ impl<A: HalApi> Device<A> {
.iter()
.any(|ct| ct.write_mask != first.write_mask || ct.blend != first.blend)
} {
log::debug!("Color targets: {:?}", color_targets);
self.require_downlevel_flags(wgt::DownlevelFlags::INDEPENDENT_BLEND)?;
}
}
Expand Down Expand Up @@ -3483,7 +3476,6 @@ impl<A: HalApi> Device<A> {
let fence = guard.as_ref().unwrap();
let last_done_index = unsafe { self.raw.as_ref().unwrap().get_fence_value(fence)? };
if last_done_index < submission_index {
log::info!("Waiting for submission {:?}", submission_index);
unsafe {
self.raw
.as_ref()
Expand Down
12 changes: 0 additions & 12 deletions wgpu-core/src/present.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ impl Global {
.insert_single(&texture, hal::TextureUses::UNINITIALIZED);

let id = fid.assign(texture);
log::debug!("Created CURRENT Surface Texture {:?}", id);

if present.acquired_texture.is_some() {
return Err(SurfaceError::AlreadyAcquired);
Expand Down Expand Up @@ -301,10 +300,6 @@ impl Global {

// The texture ID got added to the device tracker by `submit()`,
// and now we are moving it away.
log::debug!(
"Removing swapchain texture {:?} from the device tracker",
texture_id
);
let texture = hub.textures.unregister(texture_id);
if let Some(texture) = texture {
device
Expand Down Expand Up @@ -336,8 +331,6 @@ impl Global {
}
};

log::debug!("Presented. End of Frame");

match result {
Ok(()) => Ok(Status::Good),
Err(err) => match err {
Expand Down Expand Up @@ -387,11 +380,6 @@ impl Global {

// The texture ID got added to the device tracker by `submit()`,
// and now we are moving it away.
log::debug!(
"Removing swapchain texture {:?} from the device tracker",
texture_id
);

let texture = hub.textures.unregister(texture_id);

if let Some(texture) = texture {
Expand Down
1 change: 0 additions & 1 deletion wgpu-core/src/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,6 @@ impl<A: HalApi> Buffer<A> {
let device = &self.device;
let snatch_guard = device.snatchable_lock.read();
let raw_buf = self.try_raw(&snatch_guard)?;
log::debug!("{} map state -> Idle", self.error_ident());
match mem::replace(&mut *self.map_state.lock(), BufferMapState::Idle) {
BufferMapState::Init { staging_buffer } => {
#[cfg(feature = "trace")]
Expand Down
3 changes: 0 additions & 3 deletions wgpu-core/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,11 @@ where
}

pub(crate) fn insert(&mut self, id: Id<T::Marker>, value: Arc<T>) {
log::trace!("User is inserting {}{:?}", T::TYPE, id);
let (index, epoch, _backend) = id.unzip();
self.insert_impl(index as usize, epoch, Element::Occupied(value, epoch))
}

pub(crate) fn insert_error(&mut self, id: Id<T::Marker>) {
log::trace!("User is inserting as error {}{:?}", T::TYPE, id);
let (index, epoch, _) = id.unzip();
self.insert_impl(index as usize, epoch, Element::Error(epoch))
}
Expand All @@ -143,7 +141,6 @@ where
}

pub(crate) fn remove(&mut self, id: Id<T::Marker>) -> Option<Arc<T>> {
log::trace!("User is removing {}{:?}", T::TYPE, id);
let (index, epoch, _) = id.unzip();
match std::mem::replace(&mut self.map[index as usize], Element::Vacant) {
Element::Occupied(value, storage_epoch) => {
Expand Down
8 changes: 1 addition & 7 deletions wgpu-core/src/track/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -735,8 +735,6 @@ unsafe fn insert<T: Clone>(
strict_assert_eq!(invalid_resource_state(new_start_state), false);
strict_assert_eq!(invalid_resource_state(new_end_state), false);

log::trace!("\tbuf {index}: insert {new_start_state:?}..{new_end_state:?}");

unsafe {
if let Some(&mut ref mut start_state) = start_states {
*start_state.get_unchecked_mut(index) = new_start_state;
Expand All @@ -751,7 +749,7 @@ unsafe fn insert<T: Clone>(
#[inline(always)]
unsafe fn merge<A: HalApi>(
current_states: &mut [BufferUses],
index32: u32,
_index32: u32,
index: usize,
state_provider: BufferStateProvider<'_>,
metadata_provider: ResourceMetadataProvider<'_, Arc<Buffer<A>>>,
Expand All @@ -769,8 +767,6 @@ unsafe fn merge<A: HalApi>(
));
}

log::trace!("\tbuf {index32}: merge {current_state:?} + {new_state:?}");

*current_state = merged_state;

Ok(())
Expand All @@ -795,8 +791,6 @@ unsafe fn barrier(
selector: (),
usage: current_state..new_state,
});

log::trace!("\tbuf {index}: transition {current_state:?} -> {new_state:?}");
}

#[inline(always)]
Expand Down
38 changes: 0 additions & 38 deletions wgpu-core/src/track/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1124,8 +1124,6 @@ unsafe fn insert<T: Clone>(
// check that resource states don't have any conflicts.
strict_assert_eq!(invalid_resource_state(state), false);

log::trace!("\ttex {index}: insert start {state:?}");

if let Some(start_state) = start_state {
unsafe { *start_state.simple.get_unchecked_mut(index) = state };
}
Expand All @@ -1141,8 +1139,6 @@ unsafe fn insert<T: Clone>(
let complex =
unsafe { ComplexTextureState::from_selector_state_iter(full_range, state_iter) };

log::trace!("\ttex {index}: insert start {complex:?}");

if let Some(start_state) = start_state {
unsafe { *start_state.simple.get_unchecked_mut(index) = TextureUses::COMPLEX };
start_state.complex.insert(index, complex.clone());
Expand All @@ -1163,8 +1159,6 @@ unsafe fn insert<T: Clone>(
// check that resource states don't have any conflicts.
strict_assert_eq!(invalid_resource_state(state), false);

log::trace!("\ttex {index}: insert end {state:?}");

// We only need to insert into the end, as there is guaranteed to be
// a start state provider.
unsafe { *end_state.simple.get_unchecked_mut(index) = state };
Expand All @@ -1176,8 +1170,6 @@ unsafe fn insert<T: Clone>(
ComplexTextureState::from_selector_state_iter(full_range, state_iter)
};

log::trace!("\ttex {index}: insert end {complex:?}");

// We only need to insert into the end, as there is guaranteed to be
// a start state provider.
unsafe { *end_state.simple.get_unchecked_mut(index) = TextureUses::COMPLEX };
Expand Down Expand Up @@ -1215,8 +1207,6 @@ unsafe fn merge<A: HalApi>(
(SingleOrManyStates::Single(current_simple), SingleOrManyStates::Single(new_simple)) => {
let merged_state = *current_simple | new_simple;

log::trace!("\ttex {index}: merge simple {current_simple:?} + {new_simple:?}");

if invalid_resource_state(merged_state) {
return Err(ResourceUsageCompatibilityError::from_texture(
unsafe { metadata_provider.get(index) },
Expand All @@ -1242,8 +1232,6 @@ unsafe fn merge<A: HalApi>(
for (selector, new_state) in new_many {
let merged_state = *current_simple | new_state;

log::trace!("\ttex {index}: merge {selector:?} {current_simple:?} + {new_state:?}");

if invalid_resource_state(merged_state) {
return Err(ResourceUsageCompatibilityError::from_texture(
unsafe { metadata_provider.get(index) },
Expand Down Expand Up @@ -1280,11 +1268,6 @@ unsafe fn merge<A: HalApi>(
// simple states are never unknown.
let merged_state = merged_state - TextureUses::UNKNOWN;

log::trace!(
"\ttex {index}: merge mip {mip_id} layers {layers:?} \
{current_layer_state:?} + {new_simple:?}"
);

if invalid_resource_state(merged_state) {
return Err(ResourceUsageCompatibilityError::from_texture(
unsafe { metadata_provider.get(index) },
Expand Down Expand Up @@ -1321,11 +1304,6 @@ unsafe fn merge<A: HalApi>(
continue;
}

log::trace!(
"\ttex {index}: merge mip {mip_id} layers {layers:?} \
{current_layer_state:?} + {new_state:?}"
);

if invalid_resource_state(merged_state) {
return Err(ResourceUsageCompatibilityError::from_texture(
unsafe { metadata_provider.get(index) },
Expand Down Expand Up @@ -1373,8 +1351,6 @@ unsafe fn barrier(
return;
}

log::trace!("\ttex {index}: transition simple {current_simple:?} -> {new_simple:?}");

barriers.push(PendingTransition {
id: index as _,
selector: texture_selector.clone(),
Expand All @@ -1391,10 +1367,6 @@ unsafe fn barrier(
continue;
}

log::trace!(
"\ttex {index}: transition {selector:?} {current_simple:?} -> {new_state:?}"
);

barriers.push(PendingTransition {
id: index as _,
selector,
Expand All @@ -1415,11 +1387,6 @@ unsafe fn barrier(
continue;
}

log::trace!(
"\ttex {index}: transition mip {mip_id} layers {layers:?} \
{current_layer_state:?} -> {new_simple:?}"
);

barriers.push(PendingTransition {
id: index as _,
selector: TextureSelector {
Expand Down Expand Up @@ -1449,11 +1416,6 @@ unsafe fn barrier(
continue;
}

log::trace!(
"\ttex {index}: transition mip {mip_id} layers {layers:?} \
{current_layer_state:?} -> {new_state:?}"
);

barriers.push(PendingTransition {
id: index as _,
selector: TextureSelector {
Expand Down
Loading

0 comments on commit 9c6ae1b

Please sign in to comment.