From dc01e6e21379b65dd438d15a51781fac4b6067d8 Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Thu, 27 Nov 2025 04:55:02 -0500 Subject: [PATCH] Normalize logging levels (#8579) --- CHANGELOG.md | 14 ++++++++++++++ examples/features/src/framework.rs | 9 --------- naga/src/back/hlsl/writer.rs | 6 +++--- naga/src/back/spv/writer.rs | 2 +- naga/src/front/glsl/builtins.rs | 4 ++-- naga/src/front/spv/mod.rs | 20 ++++++++++++++------ naga/src/valid/interface.rs | 7 +++---- naga/tests/naga/wgsl_errors.rs | 2 +- wgpu-core/src/command/ray_tracing.rs | 4 ++-- wgpu-core/src/device/resource.rs | 5 +---- wgpu-core/src/device/trace/record.rs | 2 +- wgpu-core/src/validation.rs | 5 +++-- wgpu-hal/src/auxil/dxgi/exception.rs | 6 ++++-- wgpu-hal/src/dx12/adapter.rs | 4 ++-- wgpu-hal/src/dx12/device.rs | 2 +- wgpu-hal/src/gles/adapter.rs | 12 ++++++------ wgpu-hal/src/gles/device.rs | 6 +++--- wgpu-hal/src/gles/egl.rs | 23 +++++++++++++---------- wgpu-hal/src/gles/mod.rs | 2 +- wgpu-hal/src/metal/device.rs | 2 +- wgpu-hal/src/vulkan/adapter.rs | 16 ++++++++-------- wgpu-hal/src/vulkan/instance.rs | 14 ++++++++------ wgpu-hal/src/vulkan/swapchain/native.rs | 2 +- wgpu-types/src/lib.rs | 3 +-- wgpu/src/api/buffer.rs | 6 ------ wgpu/src/api/queue.rs | 1 - wgpu/src/macros/mod.rs | 3 --- 27 files changed, 94 insertions(+), 88 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14568783a..032387adb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -106,6 +106,20 @@ One other breaking change worth noting is that in WGSL `@builtin(view_index)` no By @SupaMaggie70Incorporated in [#8206](https://github.com/gfx-rs/wgpu/pull/8206). +#### Log Levels + +We have received complaints about wgpu being way too log spammy at log levels `info`/`warn`/`error`. We have +adjusted our log policy and changed logging such that `info` and above should be silent unless some exceptional +event happens. Our new log policy is as follows: + +- Error: if we can’t (for some reason, usually a bug) communicate an error any other way. +- Warning: similar, but there may be one-shot warnings about almost certainly sub-optimal. +- Info: do not use +- Debug: Used for interesting events happening inside wgpu. +- Trace: Used for all events that might be useful to either `wgpu` or application developers. + +By @cwfitzgerald in [#8579](https://github.com/gfx-rs/wgpu/pull/8579). + ### New Features - Added support for transient textures on Vulkan and Metal. By @opstic in [#8247](https://github.com/gfx-rs/wgpu/pull/8247) diff --git a/examples/features/src/framework.rs b/examples/features/src/framework.rs index e383fcb03..aef3ca662 100644 --- a/examples/features/src/framework.rs +++ b/examples/features/src/framework.rs @@ -60,16 +60,11 @@ fn init_logger() { let query_level: Option = parse_url_query_string(&query_string, "RUST_LOG") .and_then(|x| x.parse().ok()); - // We keep wgpu at Error level, as it's very noisy. let base_level = query_level.unwrap_or(log::LevelFilter::Info); - let wgpu_level = query_level.unwrap_or(log::LevelFilter::Error); // On web, we use fern, as console_log doesn't have filtering on a per-module level. fern::Dispatch::new() .level(base_level) - .level_for("wgpu_core", wgpu_level) - .level_for("wgpu_hal", wgpu_level) - .level_for("naga", wgpu_level) .chain(fern::Output::call(console_log::log)) .apply() .unwrap(); @@ -79,10 +74,6 @@ fn init_logger() { // of these default filters. env_logger::builder() .filter_level(log::LevelFilter::Info) - // We keep wgpu at Error level, as it's very noisy. - .filter_module("wgpu_core", log::LevelFilter::Info) - .filter_module("wgpu_hal", log::LevelFilter::Error) - .filter_module("naga", log::LevelFilter::Error) .parse_default_env() .init(); } diff --git a/naga/src/back/hlsl/writer.rs b/naga/src/back/hlsl/writer.rs index e55472460..ca2c5d85a 100644 --- a/naga/src/back/hlsl/writer.rs +++ b/naga/src/back/hlsl/writer.rs @@ -441,7 +441,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> { _ => false, }) { - log::info!( + log::debug!( "Skipping function {:?} (name {:?}) because global {:?} is inaccessible", handle, function.name, @@ -945,7 +945,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> { if let Some(ref binding) = global.binding { if let Err(err) = self.options.resolve_resource_binding(binding) { - log::info!( + log::debug!( "Skipping global {:?} (name {:?}) for being inaccessible: {}", handle, global.name, @@ -1187,7 +1187,7 @@ impl<'a, W: fmt::Write> super::Writer<'a, W> { { Ok(bindings) => bindings, Err(err) => { - log::info!( + log::debug!( "Skipping global {:?} (name {:?}) for being inaccessible: {}", handle, global.name, diff --git a/naga/src/back/spv/writer.rs b/naga/src/back/spv/writer.rs index 6180f8a59..71b761c73 100644 --- a/naga/src/back/spv/writer.rs +++ b/naga/src/back/spv/writer.rs @@ -2666,7 +2666,7 @@ impl Writer { // because the entry point and its callees didn't use them, // then we must skip it. if !ep_info.dominates_global_use(info) { - log::info!("Skip function {:?}", ir_function.name); + log::debug!("Skip function {:?}", ir_function.name); continue; } diff --git a/naga/src/front/glsl/builtins.rs b/naga/src/front/glsl/builtins.rs index 3d7588d27..d07ba9c12 100644 --- a/naga/src/front/glsl/builtins.rs +++ b/naga/src/front/glsl/builtins.rs @@ -1669,7 +1669,7 @@ impl MacroCall { num_args += 1; if shadow { - log::warn!("Assuming LOD {:?} is zero", args[2],); + log::debug!("Assuming LOD {:?} is zero", args[2],); SampleLevel::Zero } else { @@ -1681,7 +1681,7 @@ impl MacroCall { num_args += 2; if shadow { - log::warn!( + log::debug!( "Assuming gradients {:?} and {:?} are not greater than 1", args[2], args[3], diff --git a/naga/src/front/spv/mod.rs b/naga/src/front/spv/mod.rs index ac9eaf830..d9a3b986e 100644 --- a/naga/src/front/spv/mod.rs +++ b/naga/src/front/spv/mod.rs @@ -799,7 +799,15 @@ impl> Frontend { dec.specialization_constant_id = Some(self.next()?); } other => { - log::warn!("Unknown decoration {other:?}"); + let level = match other { + // Block decorations show up everywhere and we don't + // really care about them, so to prevent log spam + // we demote them to debug level. + spirv::Decoration::Block => log::Level::Debug, + _ => log::Level::Warn, + }; + + log::log!(level, "Unknown decoration {other:?}"); for _ in base_words + 1..inst.wc { let _var = self.next()?; } @@ -4746,7 +4754,7 @@ impl> Frontend { let generator = self.next()?; let _bound = self.next()?; let _schema = self.next()?; - log::info!("Generated by {generator} version {version_raw:x}"); + log::debug!("Generated by {generator} version {version_raw:x}"); crate::Module::default() }; @@ -4816,7 +4824,7 @@ impl> Frontend { } if !self.upgrade_atomics.is_empty() { - log::info!("Upgrading atomic pointers..."); + log::debug!("Upgrading atomic pointers..."); module.upgrade_atomics(&self.upgrade_atomics)?; } @@ -4826,7 +4834,7 @@ impl> Frontend { self.process_entry_point(&mut module, ep, fun_id)?; } - log::info!("Patching..."); + log::debug!("Patching..."); { let mut nodes = petgraph::algo::toposort(&self.function_call_graph, None) .map_err(|cycle| Error::FunctionCallCycle(cycle.node_id()))?; @@ -4866,11 +4874,11 @@ impl> Frontend { } if !self.future_decor.is_empty() { - log::warn!("Unused item decorations: {:?}", self.future_decor); + log::debug!("Unused item decorations: {:?}", self.future_decor); self.future_decor.clear(); } if !self.future_member_decor.is_empty() { - log::warn!("Unused member decorations: {:?}", self.future_member_decor); + log::debug!("Unused member decorations: {:?}", self.future_member_decor); self.future_member_decor.clear(); } diff --git a/naga/src/valid/interface.rs b/naga/src/valid/interface.rs index a18b3738e..d0d6f125a 100644 --- a/naga/src/valid/interface.rs +++ b/naga/src/valid/interface.rs @@ -65,8 +65,8 @@ pub enum VaryingError { MissingInterpolation, #[error("Built-in {0:?} is not available at this stage")] InvalidBuiltInStage(crate::BuiltIn), - #[error("Built-in type for {0:?} is invalid")] - InvalidBuiltInType(crate::BuiltIn), + #[error("Built-in type for {0:?} is invalid. Found {1:?}")] + InvalidBuiltInType(crate::BuiltIn, crate::TypeInner), #[error("Entry point arguments and return values must all have bindings")] MissingBinding, #[error("Struct member {0} is missing a binding")] @@ -426,8 +426,7 @@ impl VaryingContext<'_> { return Err(VaryingError::InvalidBuiltInStage(built_in)); } if !type_good { - log::warn!("Wrong builtin type: {ty_inner:?}"); - return Err(VaryingError::InvalidBuiltInType(built_in)); + return Err(VaryingError::InvalidBuiltInType(built_in, ty_inner.clone())); } } crate::Binding::Location { diff --git a/naga/tests/naga/wgsl_errors.rs b/naga/tests/naga/wgsl_errors.rs index c9c413284..7b6711be3 100644 --- a/naga/tests/naga/wgsl_errors.rs +++ b/naga/tests/naga/wgsl_errors.rs @@ -4090,7 +4090,7 @@ fn invalid_clip_distances() { Err(naga::valid::ValidationError::EntryPoint { stage: naga::ShaderStage::Vertex, source: naga::valid::EntryPointError::Result( - naga::valid::VaryingError::InvalidBuiltInType(naga::ir::BuiltIn::ClipDistance) + naga::valid::VaryingError::InvalidBuiltInType(naga::ir::BuiltIn::ClipDistance, _) ), .. }), diff --git a/wgpu-core/src/command/ray_tracing.rs b/wgpu-core/src/command/ray_tracing.rs index e1daf7266..25d6d1e7f 100644 --- a/wgpu-core/src/command/ray_tracing.rs +++ b/wgpu-core/src/command/ray_tracing.rs @@ -340,7 +340,7 @@ pub(crate) fn build_acceleration_structures( } in &tlas_storage { if tlas.update_mode == wgt::AccelerationStructureUpdateMode::PreferUpdate { - log::info!("only rebuild implemented") + log::warn!("build_acceleration_structures called with PreferUpdate, but only rebuild is implemented"); } tlas_descriptors.push(hal::BuildAccelerationStructureDescriptor { entries, @@ -941,7 +941,7 @@ fn map_blas<'a>( scratch_buffer_offset, } = storage; if blas.update_mode == wgt::AccelerationStructureUpdateMode::PreferUpdate { - log::info!("only rebuild implemented") + log::debug!("only rebuild implemented") } let raw = blas.try_raw(snatch_guard)?; diff --git a/wgpu-core/src/device/resource.rs b/wgpu-core/src/device/resource.rs index 778f38411..5d037cd8a 100644 --- a/wgpu-core/src/device/resource.rs +++ b/wgpu-core/src/device/resource.rs @@ -2306,9 +2306,6 @@ impl Device { self.check_is_valid()?; self.require_features(wgt::Features::EXPERIMENTAL_PASSTHROUGH_SHADERS)?; - // TODO: when we get to use if-let chains, this will be a little nicer! - - log::info!("Backend: {}", self.backend()); let hal_shader = match self.backend() { wgt::Backend::Vulkan => hal::ShaderInput::SpirV( descriptor @@ -4433,7 +4430,7 @@ impl Device { )?; } _ => { - log::warn!( + log::debug!( "The fragment stage {:?} output @location({}) values are ignored", fragment_stage .as_ref() diff --git a/wgpu-core/src/device/trace/record.rs b/wgpu-core/src/device/trace/record.rs index faf66731f..b034f170c 100644 --- a/wgpu-core/src/device/trace/record.rs +++ b/wgpu-core/src/device/trace/record.rs @@ -53,7 +53,7 @@ pub struct Trace { impl Trace { pub fn new(path: std::path::PathBuf) -> Result { - log::info!("Tracing into '{path:?}'"); + log::debug!("Tracing into '{path:?}'"); let mut file = std::fs::File::create(path.join(FILE_NAME))?; file.write_all(b"[\n")?; Ok(Self { diff --git a/wgpu-core/src/validation.rs b/wgpu-core/src/validation.rs index ffe2c7e75..1a4ca444d 100644 --- a/wgpu-core/src/validation.rs +++ b/wgpu-core/src/validation.rs @@ -952,8 +952,9 @@ impl Interface { //Note: technically this should be at least `log::error`, but // the reality is - every shader coming from `glslc` outputs an array // of clip distances and hits this path :( - // So we lower it to `log::warn` to be less annoying. - log::warn!("Unexpected varying type: {other:?}"); + // So we lower it to `log::debug` to be less annoying as + // there's nothing the user can do about it. + log::debug!("Unexpected varying type: {other:?}"); return; } }; diff --git a/wgpu-hal/src/auxil/dxgi/exception.rs b/wgpu-hal/src/auxil/dxgi/exception.rs index e520ab185..ac7d55d8f 100644 --- a/wgpu-hal/src/auxil/dxgi/exception.rs +++ b/wgpu-hal/src/auxil/dxgi/exception.rs @@ -31,8 +31,10 @@ const MESSAGE_PREFIXES: &[(&str, log::Level)] = &[ ("CORRUPTION", log::Level::Error), ("ERROR", log::Level::Error), ("WARNING", log::Level::Warn), - ("INFO", log::Level::Info), - ("MESSAGE", log::Level::Debug), + // We intentionally suppress "INFO" messages down to debug + // so that users are not innundated with info messages from the runtime. + ("INFO", log::Level::Debug), + ("MESSAGE", log::Level::Trace), ]; unsafe extern "system" fn output_debug_string_handler( diff --git a/wgpu-hal/src/dx12/adapter.rs b/wgpu-hal/src/dx12/adapter.rs index d8dd82f19..38d25d69b 100644 --- a/wgpu-hal/src/dx12/adapter.rs +++ b/wgpu-hal/src/dx12/adapter.rs @@ -364,12 +364,12 @@ impl super::Adapter { Direct3D12::D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_2, 64, ), - Direct3D12::D3D12_RESOURCE_BINDING_TIER_3 => ( + tier if tier.0 >= Direct3D12::D3D12_RESOURCE_BINDING_TIER_3.0 => ( tier3_practical_descriptor_limit, tier3_practical_descriptor_limit, ), other => { - log::warn!("Unknown resource binding tier {other:?}"); + log::debug!("Got zero or negative value for resource binding tier {other:?}"); ( Direct3D12::D3D12_MAX_SHADER_VISIBLE_DESCRIPTOR_HEAP_SIZE_TIER_1, 8, diff --git a/wgpu-hal/src/dx12/device.rs b/wgpu-hal/src/dx12/device.rs index 7737d3845..c089aad8b 100644 --- a/wgpu-hal/src/dx12/device.rs +++ b/wgpu-hal/src/dx12/device.rs @@ -362,7 +362,7 @@ impl super::Device { (source, entry_point) }; - log::info!( + log::debug!( "Naga generated shader for {entry_point:?} at {naga_stage:?}:\n{source}" ); diff --git a/wgpu-hal/src/gles/adapter.rs b/wgpu-hal/src/gles/adapter.rs index 6ee5f7137..abf44a9c8 100644 --- a/wgpu-hal/src/gles/adapter.rs +++ b/wgpu-hal/src/gles/adapter.rs @@ -327,7 +327,7 @@ impl super::Adapter { // Windows doesn't recognize `GL_MAX_VERTEX_ATTRIB_STRIDE`. let new = (unsafe { gl.get_parameter_i32(glow::MAX_COMPUTE_SHADER_STORAGE_BLOCKS) } as u32); - log::warn!("Max vertex shader storage blocks is zero, but GL_ARB_shader_storage_buffer_object is specified. Assuming the compute value {new}"); + log::debug!("Max vertex shader storage blocks is zero, but GL_ARB_shader_storage_buffer_object is specified. Assuming the compute value {new}"); new } else { value @@ -366,7 +366,7 @@ impl super::Adapter { vertex_shader_storage_blocks == 0 && vertex_shader_storage_textures != 0; if vertex_ssbo_false_zero { // We only care about fragment here as the 0 is a lie. - log::warn!("Max vertex shader SSBO == 0 and SSTO != 0. Interpreting as false zero."); + log::debug!("Max vertex shader SSBO == 0 and SSTO != 0. Interpreting as false zero."); } let max_storage_buffers_per_shader_stage = if vertex_shader_storage_blocks == 0 { @@ -736,13 +736,13 @@ impl super::Adapter { // This should be at least 2048, but the driver for AMD Radeon HD 5870 on // Windows doesn't recognize `GL_MAX_VERTEX_ATTRIB_STRIDE`. - log::warn!("Max vertex attribute stride is 0. Assuming it is 2048"); + log::debug!("Max vertex attribute stride is 0. Assuming it is the OpenGL minimum spec 2048"); 2048 } else { value } } else { - log::warn!("Max vertex attribute stride unknown. Assuming it is 2048"); + log::debug!("Max vertex attribute stride unknown. Assuming it is the OpenGL minimum spec 2048"); 2048 } } else { @@ -832,7 +832,7 @@ impl super::Adapter { && r.split(&[' ', '(', ')'][..]) .any(|substr| substr.len() == 3 && substr.chars().nth(2) == Some('l')) { - log::warn!( + log::debug!( "Detected skylake derivative running on mesa i915. Clears to srgb textures will \ use manual shader clears." ); @@ -955,7 +955,7 @@ impl super::Adapter { let linked_ok = unsafe { gl.get_program_link_status(program) }; let msg = unsafe { gl.get_program_info_log(program) }; if !msg.is_empty() { - log::warn!("Shader link error: {msg}"); + log::error!("Shader link error: {msg}"); } if !linked_ok { return None; diff --git a/wgpu-hal/src/gles/device.rs b/wgpu-hal/src/gles/device.rs index 05741c18f..7d99f7488 100644 --- a/wgpu-hal/src/gles/device.rs +++ b/wgpu-hal/src/gles/device.rs @@ -194,7 +194,7 @@ impl super::Device { let msg = unsafe { gl.get_shader_info_log(raw) }; if compiled_ok { if !msg.is_empty() { - log::warn!("\tCompile: {msg}"); + log::debug!("\tCompile message: {msg}"); } Ok(raw) } else { @@ -403,7 +403,7 @@ impl super::Device { // Create empty fragment shader if only vertex shader is present if has_stages == wgt::ShaderStages::VERTEX { let shader_src = format!("#version {glsl_version}\n void main(void) {{}}",); - log::info!("Only vertex shader is present. Creating an empty fragment shader",); + log::debug!("Only vertex shader is present. Creating an empty fragment shader",); let shader = unsafe { Self::compile_shader( gl, @@ -432,7 +432,7 @@ impl super::Device { return Err(crate::PipelineError::Linkage(has_stages, msg)); } if !msg.is_empty() { - log::warn!("\tLink: {msg}"); + log::debug!("\tLink message: {msg}"); } if !private_caps.contains(PrivateCapabilities::SHADER_BINDING_LAYOUT) { diff --git a/wgpu-hal/src/gles/egl.rs b/wgpu-hal/src/gles/egl.rs index 824b07718..f2bd4f77c 100644 --- a/wgpu-hal/src/gles/egl.rs +++ b/wgpu-hal/src/gles/egl.rs @@ -88,8 +88,11 @@ unsafe extern "system" fn egl_debug_proc( let log_severity = match message_type { EGL_DEBUG_MSG_CRITICAL_KHR | EGL_DEBUG_MSG_ERROR_KHR => log::Level::Error, EGL_DEBUG_MSG_WARN_KHR => log::Level::Warn, - EGL_DEBUG_MSG_INFO_KHR => log::Level::Info, - _ => log::Level::Debug, + // We intentionally suppress info messages down to debug + // so that users are not innundated with info messages from + // the runtime. + EGL_DEBUG_MSG_INFO_KHR => log::Level::Debug, + _ => log::Level::Trace, }; let command = unsafe { ffi::CStr::from_ptr(command_raw) }.to_string_lossy(); let message = if message_raw.is_null() { @@ -263,7 +266,7 @@ fn choose_config( if tier_max == 1 { //Note: this has been confirmed to malfunction on Intel+NV laptops, // but also on Angle. - log::warn!("EGL says it can present to the window but not natively",); + log::info!("EGL says it can present to the window but not natively",); } // Android emulator can't natively present either. let tier_threshold = @@ -275,7 +278,7 @@ fn choose_config( return Ok((config, tier_max >= tier_threshold)); } Ok(None) => { - log::warn!("No config found!"); + log::debug!("No config found!"); } Err(e) => { log::error!("error in choose_first_config: {e:?}"); @@ -545,7 +548,7 @@ impl Inner { log::debug!("\tEGL surface: +srgb khr"); SrgbFrameBufferKind::Khr } else { - log::warn!("\tEGL surface: -srgb"); + log::debug!("\tEGL surface: -srgb"); SrgbFrameBufferKind::None }; @@ -902,7 +905,7 @@ impl crate::Instance for Instance { let (display, display_owner, wsi_kind) = if let (Some(library), Some(egl)) = (wayland_library, egl1_5) { - log::info!("Using Wayland platform"); + log::debug!("Using Wayland platform"); let display_attributes = [khronos_egl::ATTRIB_NONE]; let display = unsafe { egl.get_platform_display( @@ -914,7 +917,7 @@ impl crate::Instance for Instance { .map_err(instance_err("failed to get Wayland display"))?; (display, Some(Rc::new(library)), WindowKind::Wayland) } else if let (Some(display_owner), Some(egl)) = (x11_display_library, egl1_5) { - log::info!("Using X11 platform"); + log::debug!("Using X11 platform"); let display_attributes = [khronos_egl::ATTRIB_NONE]; let display = unsafe { egl.get_platform_display( @@ -926,7 +929,7 @@ impl crate::Instance for Instance { .map_err(instance_err("failed to get x11 display"))?; (display, Some(Rc::new(display_owner)), WindowKind::X11) } else if let (Some(display_owner), Some(egl)) = (angle_x11_display_library, egl1_5) { - log::info!("Using Angle platform with X11"); + log::debug!("Using Angle platform with X11"); let display_attributes = [ EGL_PLATFORM_ANGLE_NATIVE_PLATFORM_TYPE_ANGLE as khronos_egl::Attrib, EGL_PLATFORM_X11_KHR as khronos_egl::Attrib, @@ -944,7 +947,7 @@ impl crate::Instance for Instance { .map_err(instance_err("failed to get Angle display"))?; (display, Some(Rc::new(display_owner)), WindowKind::AngleX11) } else if client_ext_str.contains("EGL_MESA_platform_surfaceless") { - log::warn!("No windowing system present. Using surfaceless platform"); + log::debug!("No windowing system present. Using surfaceless platform"); #[allow(clippy::unnecessary_literal_unwrap)] // This is only a literal on Emscripten let egl = egl1_5.expect("Failed to get EGL 1.5 for surfaceless"); let display = unsafe { @@ -958,7 +961,7 @@ impl crate::Instance for Instance { (display, None, WindowKind::Unknown) } else { - log::warn!("EGL_MESA_platform_surfaceless not available. Using default platform"); + log::debug!("EGL_MESA_platform_surfaceless not available. Using default platform"); let display = unsafe { egl.get_display(khronos_egl::DEFAULT_DISPLAY) } .ok_or_else(|| crate::InstanceError::new("Failed to get default display".into()))?; (display, None, WindowKind::Unknown) diff --git a/wgpu-hal/src/gles/mod.rs b/wgpu-hal/src/gles/mod.rs index aad85106b..899fe382e 100644 --- a/wgpu-hal/src/gles/mod.rs +++ b/wgpu-hal/src/gles/mod.rs @@ -1083,7 +1083,7 @@ fn gl_debug_message_callback(source: u32, gltype: u32, id: u32, severity: u32, m let log_severity = match severity { glow::DEBUG_SEVERITY_HIGH => log::Level::Error, glow::DEBUG_SEVERITY_MEDIUM => log::Level::Warn, - glow::DEBUG_SEVERITY_LOW => log::Level::Info, + glow::DEBUG_SEVERITY_LOW => log::Level::Debug, glow::DEBUG_SEVERITY_NOTIFICATION => log::Level::Trace, _ => unreachable!(), }; diff --git a/wgpu-hal/src/metal/device.rs b/wgpu-hal/src/metal/device.rs index f7bcca725..4e8e3c347 100644 --- a/wgpu-hal/src/metal/device.rs +++ b/wgpu-hal/src/metal/device.rs @@ -218,7 +218,7 @@ impl super::Device { .lock() .new_library_with_source(source.as_ref(), &options) .map_err(|err| { - log::warn!("Naga generated shader:\n{source}"); + log::debug!("Naga generated shader:\n{source}"); crate::PipelineError::Linkage(stage_bit, format!("Metal: {err}")) })?; diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index dc3f6a78d..6d7d439d7 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -1153,7 +1153,7 @@ impl PhysicalDeviceProperties { if self.supports_extension(ext::memory_budget::NAME) { extensions.push(ext::memory_budget::NAME); } else { - log::warn!("VK_EXT_memory_budget is not available.") + log::debug!("VK_EXT_memory_budget is not available.") } // Require `VK_KHR_draw_indirect_count` if the associated feature was requested @@ -1812,9 +1812,9 @@ impl super::Instance { .flags .contains(wgt::InstanceFlags::ALLOW_UNDERLYING_NONCOMPLIANT_ADAPTER) { - log::warn!("Adapter is not Vulkan compliant: {}", info.name); + log::debug!("Adapter is not Vulkan compliant: {}", info.name); } else { - log::warn!( + log::debug!( "Adapter is not Vulkan compliant, hiding adapter: {}", info.name ); @@ -1825,7 +1825,7 @@ impl super::Instance { if phd_capabilities.device_api_version == vk::API_VERSION_1_0 && !phd_capabilities.supports_extension(khr::storage_buffer_storage_class::NAME) { - log::warn!( + log::debug!( "SPIR-V storage buffer class is not supported, hiding adapter: {}", info.name ); @@ -1834,7 +1834,7 @@ impl super::Instance { if !phd_capabilities.supports_extension(khr::maintenance1::NAME) && phd_capabilities.device_api_version < vk::API_VERSION_1_1 { - log::warn!( + log::debug!( "VK_KHR_maintenance1 is not supported, hiding adapter: {}", info.name ); @@ -1848,7 +1848,7 @@ impl super::Instance { }; let queue_flags = queue_families.first()?.queue_flags; if !queue_flags.contains(vk::QueueFlags::GRAPHICS) { - log::warn!("The first queue only exposes {queue_flags:?}"); + log::debug!("The first queue only exposes {queue_flags:?}"); return None; } @@ -1985,7 +1985,7 @@ impl super::Adapter { }); if !unsupported_extensions.is_empty() { - log::warn!("Missing extensions: {unsupported_extensions:?}"); + log::debug!("Missing extensions: {unsupported_extensions:?}"); } log::debug!("Supported extensions: {supported_extensions:?}"); @@ -2864,7 +2864,7 @@ fn is_intel_igpu_outdated_for_robustness2( .unwrap_or_default(); if is_outdated { - log::warn!( + log::debug!( "Disabling robustBufferAccess2 and robustImageAccess2: IntegratedGpu Intel Driver is outdated. Found with version 0x{:X}, less than the known good version 0x{:X} (31.0.101.2115)", props.driver_version, DRIVER_VERSION_WORKING diff --git a/wgpu-hal/src/vulkan/instance.rs b/wgpu-hal/src/vulkan/instance.rs index 72c4e2c8d..0699f8595 100644 --- a/wgpu-hal/src/vulkan/instance.rs +++ b/wgpu-hal/src/vulkan/instance.rs @@ -81,8 +81,10 @@ unsafe extern "system" fn debug_utils_messenger_callback( } let level = match message_severity { - vk::DebugUtilsMessageSeverityFlagsEXT::VERBOSE => log::Level::Debug, - vk::DebugUtilsMessageSeverityFlagsEXT::INFO => log::Level::Info, + // We intentionally suppress info messages down to debug + // so that users are not innundated with info messages from the runtime. + vk::DebugUtilsMessageSeverityFlagsEXT::VERBOSE => log::Level::Trace, + vk::DebugUtilsMessageSeverityFlagsEXT::INFO => log::Level::Debug, vk::DebugUtilsMessageSeverityFlagsEXT::WARNING => log::Level::Warn, vk::DebugUtilsMessageSeverityFlagsEXT::ERROR => log::Level::Error, _ => log::Level::Warn, @@ -297,7 +299,7 @@ impl super::Instance { { true } else { - log::warn!("Unable to find extension: {}", ext.to_string_lossy()); + log::debug!("Unable to find extension: {}", ext.to_string_lossy()); false } }); @@ -333,7 +335,7 @@ impl super::Instance { let debug_utils = if let Some(debug_utils_create_info) = debug_utils_create_info { if extensions.contains(&ext::debug_utils::NAME) { - log::info!("Enabling debug utils"); + log::debug!("Enabling debug utils"); let extension = ext::debug_utils::Instance::new(&entry, &raw_instance); let vk_info = debug_utils_create_info.to_vk_create_info(); @@ -707,7 +709,7 @@ impl super::Instance { }); } } else { - log::warn!( + log::debug!( "InstanceFlags::VALIDATION requested, but unable to find layer: {}", validation_layer_name.to_string_lossy() ); @@ -964,7 +966,7 @@ impl crate::Instance for super::Instance { }) { if version < (21, 2) { // See https://gitlab.freedesktop.org/mesa/mesa/-/issues/4688 - log::warn!( + log::debug!( concat!( "Disabling presentation on '{}' (id {:?}) ", "due to NV Optimus and Intel Mesa < v21.2" diff --git a/wgpu-hal/src/vulkan/swapchain/native.rs b/wgpu-hal/src/vulkan/swapchain/native.rs index ac8c07cd1..711a07004 100644 --- a/wgpu-hal/src/vulkan/swapchain/native.rs +++ b/wgpu-hal/src/vulkan/swapchain/native.rs @@ -595,7 +595,7 @@ impl Swapchain for NativeSwapchain { // (i.e `VkSwapchainCreateInfoKHR::preTransform` not being equal to the current device orientation). // This is always the case when the device orientation is anything other than the identity one, as we unconditionally use `VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR`. #[cfg(not(target_os = "android"))] - log::warn!("Suboptimal present of frame {}", texture.index); + log::debug!("Suboptimal present of frame {}", texture.index); } Ok(()) } diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index 8f8112610..29ef05640 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -3957,8 +3957,7 @@ impl TextureFormat { // Two chroma u16s and one luma u16 per block Self::P010 => 6, f => { - log::warn!("Memory footprint for format {f:?} is not implemented"); - 0 + unimplemented!("Memory footprint for format {f:?} is not implemented"); } }, }; diff --git a/wgpu/src/api/buffer.rs b/wgpu/src/api/buffer.rs index afab2cf1c..d039da367 100644 --- a/wgpu/src/api/buffer.rs +++ b/wgpu/src/api/buffer.rs @@ -643,7 +643,6 @@ impl<'a> BufferSlice<'a> { size: self.size, offset: self.offset, inner: range, - readable: self.buffer.usage.contains(BufferUsages::MAP_READ), } } @@ -945,7 +944,6 @@ pub struct BufferViewMut { offset: BufferAddress, size: BufferSize, inner: dispatch::DispatchBufferMappedRange, - readable: bool, } impl AsMut<[u8]> for BufferViewMut { @@ -959,10 +957,6 @@ impl Deref for BufferViewMut { type Target = [u8]; fn deref(&self) -> &Self::Target { - if !self.readable { - log::warn!("Reading from a BufferViewMut is slow and not recommended."); - } - self.inner.slice() } } diff --git a/wgpu/src/api/queue.rs b/wgpu/src/api/queue.rs index a61d0b023..0e52863eb 100644 --- a/wgpu/src/api/queue.rs +++ b/wgpu/src/api/queue.rs @@ -79,7 +79,6 @@ impl Deref for QueueWriteBufferView { type Target = [u8]; fn deref(&self) -> &Self::Target { - log::warn!("Reading from a QueueWriteBufferView won't yield the contents of the buffer and may be slow."); self.inner.slice() } } diff --git a/wgpu/src/macros/mod.rs b/wgpu/src/macros/mod.rs index b334ee003..a5ec345aa 100644 --- a/wgpu/src/macros/mod.rs +++ b/wgpu/src/macros/mod.rs @@ -116,7 +116,6 @@ fn make_spirv_be_pass() { macro_rules! include_spirv { ($($token:tt)*) => { { - //log::info!("including '{}'", $($token)*); $crate::ShaderModuleDescriptor { label: Some($($token)*), source: $crate::ShaderSource::SpirV( @@ -140,7 +139,6 @@ static SPIRV: crate::ShaderModuleDescriptor<'_> = include_spirv!("le-aligned.spv macro_rules! include_spirv_raw { ($($token:tt)*) => { { - //log::info!("including '{}'", $($token)*); $crate::ShaderModuleDescriptorPassthrough { label: $crate::__macro_helpers::Some($($token)*), spirv: Some($crate::__macro_helpers::Cow::Borrowed($crate::include_spirv_source!($($token)*))), @@ -177,7 +175,6 @@ static SPIRV_RAW: crate::ShaderModuleDescriptorPassthrough<'_> = macro_rules! include_wgsl { ($($token:tt)*) => { { - //log::info!("including '{}'", $($token)*); $crate::ShaderModuleDescriptor { label: $crate::__macro_helpers::Some($($token)*), source: $crate::ShaderSource::Wgsl($crate::__macro_helpers::Cow::Borrowed($crate::__macro_helpers::include_str!($($token)*))),