Log spring cleaning (#6065)

Remove unused logs in wgpu-core and wgpu-hal
This commit is contained in:
Nicolas Silva 2024-07-31 18:24:23 +02:00 committed by GitHub
parent 7ff80d65fc
commit 9c6ae1beae
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 6 additions and 153 deletions

View File

@ -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

View File

@ -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();

View File

@ -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,

View File

@ -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,
@ -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
}
}

View File

@ -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,
@ -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)

View File

@ -5,7 +5,7 @@ use crate::{
},
hal_api::HalApi,
id,
resource::{self, Buffer, Labeled, Texture, Trackable},
resource::{self, Buffer, Texture, Trackable},
snatch::SnatchGuard,
SubmissionIndex,
};
@ -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() };
@ -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);
@ -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.
@ -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(

View File

@ -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();
@ -1241,8 +1240,6 @@ impl Global {
pending_textures: FastHashMap::default(),
});
}
log::trace!("Device after submission {}", submit_index);
}
}

View File

@ -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
@ -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)?;
}
}
@ -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()

View File

@ -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);
@ -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
@ -336,8 +331,6 @@ impl Global {
}
};
log::debug!("Presented. End of Frame");
match result {
Ok(()) => Ok(Status::Good),
Err(err) => match err {
@ -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 {

View File

@ -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")]

View File

@ -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))
}
@ -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) => {

View File

@ -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;
@ -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>>>,
@ -769,8 +767,6 @@ unsafe fn merge<A: HalApi>(
));
}
log::trace!("\tbuf {index32}: merge {current_state:?} + {new_state:?}");
*current_state = merged_state;
Ok(())
@ -795,8 +791,6 @@ unsafe fn barrier(
selector: (),
usage: current_state..new_state,
});
log::trace!("\tbuf {index}: transition {current_state:?} -> {new_state:?}");
}
#[inline(always)]

View File

@ -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 };
}
@ -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());
@ -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 };
@ -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 };
@ -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) },
@ -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) },
@ -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) },
@ -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) },
@ -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(),
@ -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,
@ -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 {
@ -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 {

View File

@ -220,7 +220,6 @@ impl super::CommandEncoder {
}
fn reset_signature(&mut self, layout: &super::PipelineLayoutShared) {
log::trace!("Reset signature {:?}", layout.signature);
if let Some(root_index) = layout.special_constants_root_index {
self.pass.root_elements[root_index as usize] =
super::RootElement::SpecialConstantBuffer {
@ -315,17 +314,7 @@ impl crate::CommandEncoder for super::CommandEncoder {
{
self.temp.barriers.clear();
log::trace!(
"List {:p} buffer transitions",
self.list.as_ref().unwrap().as_ptr()
);
for barrier in barriers {
log::trace!(
"\t{:p}: usage {:?}..{:?}",
barrier.buffer.resource.as_ptr(),
barrier.usage.start,
barrier.usage.end
);
let s0 = conv::map_buffer_usage_to_state(barrier.usage.start);
let s1 = conv::map_buffer_usage_to_state(barrier.usage.end);
if s0 != s1 {
@ -374,18 +363,7 @@ impl crate::CommandEncoder for super::CommandEncoder {
{
self.temp.barriers.clear();
log::trace!(
"List {:p} texture transitions",
self.list.as_ref().unwrap().as_ptr()
);
for barrier in barriers {
log::trace!(
"\t{:p}: usage {:?}..{:?}, range {:?}",
barrier.texture.resource.as_ptr(),
barrier.usage.start,
barrier.usage.end,
barrier.range
);
let s0 = conv::map_texture_usage_to_state(barrier.usage.start);
let s1 = conv::map_texture_usage_to_state(barrier.usage.end);
if s0 != s1 {
@ -879,13 +857,11 @@ impl crate::CommandEncoder for super::CommandEncoder {
group: &super::BindGroup,
dynamic_offsets: &[wgt::DynamicOffset],
) {
log::trace!("Set group[{}]", index);
let info = &layout.bind_group_infos[index as usize];
let mut root_index = info.base_root_index as usize;
// Bind CBV/SRC/UAV descriptor tables
if info.tables.contains(super::TableTypes::SRV_CBV_UAV) {
log::trace!("\tBind element[{}] = view", root_index);
self.pass.root_elements[root_index] =
super::RootElement::Table(group.handle_views.unwrap().gpu);
root_index += 1;
@ -893,7 +869,6 @@ impl crate::CommandEncoder for super::CommandEncoder {
// Bind Sampler descriptor tables.
if info.tables.contains(super::TableTypes::SAMPLERS) {
log::trace!("\tBind element[{}] = sampler", root_index);
self.pass.root_elements[root_index] =
super::RootElement::Table(group.handle_samplers.unwrap().gpu);
root_index += 1;
@ -906,7 +881,6 @@ impl crate::CommandEncoder for super::CommandEncoder {
.zip(group.dynamic_buffers.iter())
.zip(dynamic_offsets)
{
log::trace!("\tBind element[{}] = dynamic", root_index);
self.pass.root_elements[root_index] = super::RootElement::DynamicOffsetBuffer {
kind,
address: gpu_base + offset as d3d12::GpuAddress,

View File

@ -196,7 +196,6 @@ impl super::Device {
}
let value = cur_value + 1;
log::debug!("Waiting for idle with value {}", value);
self.present_queue.signal(&self.idler.fence, value);
let hr = self
.idler
@ -817,11 +816,6 @@ impl crate::Device for super::Device {
}
}
log::debug!(
"Creating Root Signature '{}'",
desc.label.unwrap_or_default()
);
let mut binding_map = hlsl::BindingMap::default();
let (mut bind_cbv, mut bind_srv, mut bind_uav, mut bind_sampler) = (
hlsl::BindTarget::default(),
@ -844,11 +838,6 @@ impl crate::Device for super::Device {
if pc_start != u32::MAX && pc_end != u32::MIN {
let parameter_index = parameters.len();
let size = (pc_end - pc_start) / 4;
log::debug!(
"\tParam[{}] = push constant (count = {})",
parameter_index,
size,
);
parameters.push(d3d12::RootParameter::constants(
d3d12::ShaderVisibility::All,
native_binding(&bind_cbv),
@ -942,12 +931,6 @@ impl crate::Device for super::Device {
bt.register += entry.count.map(NonZeroU32::get).unwrap_or(1);
}
if ranges.len() > range_base {
log::debug!(
"\tParam[{}] = views (vis = {:?}, count = {})",
parameters.len(),
visibility_view_static,
ranges.len() - range_base,
);
parameters.push(d3d12::RootParameter::descriptor_table(
conv::map_visibility(visibility_view_static),
&ranges[range_base..],
@ -981,12 +964,6 @@ impl crate::Device for super::Device {
bind_sampler.register += entry.count.map(NonZeroU32::get).unwrap_or(1);
}
if ranges.len() > range_base {
log::debug!(
"\tParam[{}] = samplers (vis = {:?}, count = {})",
parameters.len(),
visibility_sampler,
ranges.len() - range_base,
);
parameters.push(d3d12::RootParameter::descriptor_table(
conv::map_visibility(visibility_sampler),
&ranges[range_base..],
@ -1036,12 +1013,6 @@ impl crate::Device for super::Device {
);
info.dynamic_buffers.push(kind);
log::debug!(
"\tParam[{}] = dynamic {:?} (vis = {:?})",
parameters.len(),
buffer_ty,
dynamic_buffers_visibility,
);
parameters.push(d3d12::RootParameter::descriptor(
parameter_ty,
dynamic_buffers_visibility,
@ -1062,7 +1033,6 @@ impl crate::Device for super::Device {
| crate::PipelineLayoutFlags::NUM_WORK_GROUPS,
) {
let parameter_index = parameters.len();
log::debug!("\tParam[{}] = special", parameter_index);
parameters.push(d3d12::RootParameter::constants(
d3d12::ShaderVisibility::All, // really needed for VS and CS only
native_binding(&bind_cbv),
@ -1075,9 +1045,6 @@ impl crate::Device for super::Device {
(None, None)
};
log::trace!("{:#?}", parameters);
log::trace!("Bindings {:#?}", binding_map);
let (blob, error) = self
.library
.serialize_root_signature(
@ -1105,8 +1072,6 @@ impl crate::Device for super::Device {
.create_root_signature(blob, 0)
.into_device_result("Root signature creation")?;
log::debug!("\traw = {:?}", raw);
if let Some(label) = desc.label {
let cwstr = conv::map_label(label);
unsafe { raw.SetName(cwstr.as_ptr()) };