Skip to content

Commit

Permalink
Lift API logging from trace to info level
Browse files Browse the repository at this point in the history
Most of this logging used to be info level until I demoted it to trace. Unfortunately this gets in my way because:
 - Most of the logging I currently need is these API entry points, there is is a fair amount of more verbose logging in wgpu at higher levels than trace
 - Firefox disable all trace and debug logging for optimized builds, which means I miss the this API logging where I need most.

This patch lifts the api logging back to info level.
  • Loading branch information
nical committed Nov 24, 2023
1 parent 86562e6 commit d4801c9
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 77 deletions.
4 changes: 2 additions & 2 deletions wgpu-core/src/command/clear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
size: Option<BufferAddress>,
) -> Result<(), ClearError> {
profiling::scope!("CommandEncoder::clear_buffer");
log::trace!("CommandEncoder::clear_buffer {dst:?}");
log::info!("CommandEncoder::clear_buffer {dst:?}");

let hub = A::hub(self);

Expand Down Expand Up @@ -161,7 +161,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
subresource_range: &ImageSubresourceRange,
) -> Result<(), ClearError> {
profiling::scope!("CommandEncoder::clear_texture");
log::trace!("CommandEncoder::clear_texture {dst:?}");
log::info!("CommandEncoder::clear_texture {dst:?}");

let hub = A::hub(self);

Expand Down
6 changes: 3 additions & 3 deletions wgpu-core/src/command/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
label: &str,
) -> Result<(), CommandEncoderError> {
profiling::scope!("CommandEncoder::push_debug_group");
log::trace!("CommandEncoder::push_debug_group {label}");
log::info!("CommandEncoder::push_debug_group {label}");

let hub = A::hub(self);

Expand Down Expand Up @@ -466,7 +466,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
label: &str,
) -> Result<(), CommandEncoderError> {
profiling::scope!("CommandEncoder::insert_debug_marker");
log::trace!("CommandEncoder::insert_debug_marker {label}");
log::info!("CommandEncoder::insert_debug_marker {label}");

let hub = A::hub(self);

Expand Down Expand Up @@ -497,7 +497,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
encoder_id: id::CommandEncoderId,
) -> Result<(), CommandEncoderError> {
profiling::scope!("CommandEncoder::pop_debug_marker");
log::trace!("CommandEncoder::pop_debug_group");
log::info!("CommandEncoder::pop_debug_group");

let hub = A::hub(self);

Expand Down
44 changes: 22 additions & 22 deletions wgpu-core/src/command/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1410,7 +1410,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
num_dynamic_offsets,
bind_group_id,
} => {
log::trace!("RenderPass::set_bind_group {index} {bind_group_id:?}");
log::info!("RenderPass::set_bind_group {index} {bind_group_id:?}");

let scope = PassErrorScope::SetBindGroup(bind_group_id);
let max_bind_groups = device.limits.max_bind_groups;
Expand Down Expand Up @@ -1493,7 +1493,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
}
}
RenderCommand::SetPipeline(pipeline_id) => {
log::trace!("RenderPass::set_pipeline {pipeline_id:?}");
log::info!("RenderPass::set_pipeline {pipeline_id:?}");

let scope = PassErrorScope::SetPipelineRender(pipeline_id);
state.pipeline = Some(pipeline_id);
Expand Down Expand Up @@ -1621,7 +1621,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
offset,
size,
} => {
log::trace!("RenderPass::set_index_buffer {buffer_id:?}");
log::info!("RenderPass::set_index_buffer {buffer_id:?}");

let scope = PassErrorScope::SetIndexBuffer(buffer_id);
let buffer = info
Expand Down Expand Up @@ -1674,7 +1674,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
offset,
size,
} => {
log::trace!("RenderPass::set_vertex_buffer {slot} {buffer_id:?}");
log::info!("RenderPass::set_vertex_buffer {slot} {buffer_id:?}");

let scope = PassErrorScope::SetVertexBuffer(buffer_id);
let buffer = info
Expand Down Expand Up @@ -1737,7 +1737,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
state.vertex.update_limits();
}
RenderCommand::SetBlendConstant(ref color) => {
log::trace!("RenderPass::set_blend_constant");
log::info!("RenderPass::set_blend_constant");

state.blend_constant = OptionalState::Set;
let array = [
Expand All @@ -1751,7 +1751,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
}
}
RenderCommand::SetStencilReference(value) => {
log::trace!("RenderPass::set_stencil_reference {value}");
log::info!("RenderPass::set_stencil_reference {value}");

state.stencil_reference = value;
if state
Expand All @@ -1768,7 +1768,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
depth_min,
depth_max,
} => {
log::trace!("RenderPass::set_viewport {rect:?}");
log::info!("RenderPass::set_viewport {rect:?}");

let scope = PassErrorScope::SetViewport;
if rect.x < 0.0
Expand Down Expand Up @@ -1806,7 +1806,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
size_bytes,
values_offset,
} => {
log::trace!("RenderPass::set_push_constants");
log::info!("RenderPass::set_push_constants");

let scope = PassErrorScope::SetPushConstant;
let values_offset = values_offset
Expand Down Expand Up @@ -1841,7 +1841,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
}
}
RenderCommand::SetScissor(ref rect) => {
log::trace!("RenderPass::set_scissor_rect {rect:?}");
log::info!("RenderPass::set_scissor_rect {rect:?}");

let scope = PassErrorScope::SetScissorRect;
if rect.x + rect.w > info.extent.width
Expand All @@ -1866,7 +1866,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
first_vertex,
first_instance,
} => {
log::trace!(
log::info!(
"RenderPass::draw {vertex_count} {instance_count} {first_vertex} {first_instance}"
);

Expand Down Expand Up @@ -1910,7 +1910,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
base_vertex,
first_instance,
} => {
log::trace!("RenderPass::draw_indexed {index_count} {instance_count} {first_index} {base_vertex} {first_instance}");
log::info!("RenderPass::draw_indexed {index_count} {instance_count} {first_index} {base_vertex} {first_instance}");

let indexed = true;
let scope = PassErrorScope::Draw {
Expand Down Expand Up @@ -1958,7 +1958,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
count,
indexed,
} => {
log::trace!("RenderPass::draw_indirect (indexed:{indexed}) {buffer_id:?} {offset} {count:?}");
log::info!("RenderPass::draw_indirect (indexed:{indexed}) {buffer_id:?} {offset} {count:?}");

let scope = PassErrorScope::Draw {
indexed,
Expand Down Expand Up @@ -2032,7 +2032,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
max_count,
indexed,
} => {
log::trace!("RenderPass::multi_draw_indirect_count (indexed:{indexed}) {buffer_id:?} {offset} {count_buffer_id:?} {count_buffer_offset:?} {max_count:?}");
log::info!("RenderPass::multi_draw_indirect_count (indexed:{indexed}) {buffer_id:?} {offset} {count_buffer_id:?} {count_buffer_offset:?} {max_count:?}");

let scope = PassErrorScope::Draw {
indexed,
Expand Down Expand Up @@ -2148,15 +2148,15 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
)
.unwrap();

log::trace!("RenderPass::push_debug_group {label:?}");
log::info!("RenderPass::push_debug_group {label:?}");
unsafe {
raw.begin_debug_marker(label);
}
}
string_offset += len;
}
RenderCommand::PopDebugGroup => {
log::trace!("RenderPass::pop_debug_group");
log::info!("RenderPass::pop_debug_group");

let scope = PassErrorScope::PopDebugGroup;
if state.debug_scope_depth == 0 {
Expand All @@ -2176,7 +2176,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
&base.string_data[string_offset..string_offset + len],
)
.unwrap();
log::trace!("RenderPass::insert_debug_marker {label:?}");
log::info!("RenderPass::insert_debug_marker {label:?}");
unsafe {
raw.insert_debug_marker(label);
}
Expand All @@ -2187,7 +2187,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
query_set_id,
query_index,
} => {
log::trace!("RenderPass::write_timestamps {query_set_id:?} {query_index}");
log::info!("RenderPass::write_timestamps {query_set_id:?} {query_index}");
let scope = PassErrorScope::WriteTimestamp;

device
Expand All @@ -2210,7 +2210,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
.map_pass_err(scope)?;
}
RenderCommand::BeginOcclusionQuery { query_index } => {
log::trace!("RenderPass::begin_occlusion_query {query_index}");
log::info!("RenderPass::begin_occlusion_query {query_index}");
let scope = PassErrorScope::BeginOcclusionQuery;

let query_set_id = occlusion_query_set_id
Expand All @@ -2234,7 +2234,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
.map_pass_err(scope)?;
}
RenderCommand::EndOcclusionQuery => {
log::trace!("RenderPass::end_occlusion_query");
log::info!("RenderPass::end_occlusion_query");
let scope = PassErrorScope::EndOcclusionQuery;

end_occlusion_query(raw, &*query_set_guard, &mut active_query)
Expand All @@ -2244,7 +2244,7 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
query_set_id,
query_index,
} => {
log::trace!("RenderPass::begin_pipeline_statistics_query {query_set_id:?} {query_index}");
log::info!("RenderPass::begin_pipeline_statistics_query {query_set_id:?} {query_index}");
let scope = PassErrorScope::BeginPipelineStatisticsQuery;

let query_set = tracker
Expand All @@ -2264,14 +2264,14 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
.map_pass_err(scope)?;
}
RenderCommand::EndPipelineStatisticsQuery => {
log::trace!("RenderPass::end_pipeline_statistics_query");
log::info!("RenderPass::end_pipeline_statistics_query");
let scope = PassErrorScope::EndPipelineStatisticsQuery;

end_pipeline_statistics_query(raw, &*query_set_guard, &mut active_query)
.map_pass_err(scope)?;
}
RenderCommand::ExecuteBundle(bundle_id) => {
log::trace!("RenderPass::execute_bundle {bundle_id:?}");
log::info!("RenderPass::execute_bundle {bundle_id:?}");
let scope = PassErrorScope::ExecuteBundle;
let bundle: &command::RenderBundle<A> = tracker
.bundles
Expand Down
18 changes: 18 additions & 0 deletions wgpu-core/src/command/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,9 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
size: BufferAddress,
) -> Result<(), CopyError> {
profiling::scope!("CommandEncoder::copy_buffer_to_buffer");
log::info!(
"CommandEncoder::copy_buffer_to_buffer {source:?} -> {destination:?} {size:?}bytes"
);

if source == destination {
return Err(TransferError::SameSourceDestinationBuffer.into());
Expand Down Expand Up @@ -727,6 +730,11 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
copy_size: &Extent3d,
) -> Result<(), CopyError> {
profiling::scope!("CommandEncoder::copy_buffer_to_texture");
log::info!(
"CommandEncoder::copy_buffer_to_texture {:?} -> {:?} {copy_size:?}",
source.buffer,
destination.texture
);

let hub = A::hub(self);

Expand Down Expand Up @@ -885,6 +893,11 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
copy_size: &Extent3d,
) -> Result<(), CopyError> {
profiling::scope!("CommandEncoder::copy_texture_to_buffer");
log::info!(
"CommandEncoder::copy_texture_to_buffer {:?} -> {:?} {copy_size:?}",
source.texture,
destination.buffer
);

let hub = A::hub(self);

Expand Down Expand Up @@ -1055,6 +1068,11 @@ impl<G: GlobalIdentityHandlerFactory> Global<G> {
copy_size: &Extent3d,
) -> Result<(), CopyError> {
profiling::scope!("CommandEncoder::copy_texture_to_texture");
log::info!(
"CommandEncoder::copy_texture_to_texture {:?} -> {:?} {copy_size:?}",
source.texture,
destination.texture
);

let hub = A::hub(self);

Expand Down
Loading

0 comments on commit d4801c9

Please sign in to comment.