gfx-rs/wgpu · critical
Timestamp normalization requires the wgsl feature flag to be
Error message
Timestamp normalization requires the wgsl feature flag to be enabled!
What it means
wgpu-core's timestamp normalization pass rewrites timestamp query results using a generated WGSL shader, so it needs the naga `wgsl` feature to build/validate that module. If the crate was compiled without the `wgsl` feature while TIMESTAMP_QUERY-inside-passes support is requested, this panic fires in the device/adapter initialization path.
Source
Thrown at wgpu-core/src/timestamp_normalization/mod.rs:151
})?;
let common_src = include_str!("common.wgsl");
let src = include_str!("timestamp_normalization.wgsl");
let preprocessed_src = alloc::format!("{common_src}\n{src}");
#[cfg(feature = "wgsl")]
let module = naga::front::wgsl::parse_str(&preprocessed_src).map_err(|inner| {
TimestampNormalizerInitError::ParseWgsl(naga::error::ShaderError {
source: preprocessed_src.clone(),
label: None,
inner: Box::new(inner),
})
})?;
#[cfg(not(feature = "wgsl"))]
#[allow(clippy::diverging_sub_expression)]
let module =
panic!("Timestamp normalization requires the wgsl feature flag to be enabled!");
let info = crate::device::create_validator(
wgt::Features::IMMEDIATES,
wgt::DownlevelFlags::empty(),
naga::valid::ValidationFlags::all(),
)
.validate(&module)
.map_err(|inner| {
TimestampNormalizerInitError::ValidateWgsl(naga::error::ShaderError {
source: preprocessed_src.clone(),
label: None,
inner,
})
})?;
let hal_shader = hal::ShaderInput::Naga(hal::NagaShader {
module: alloc::borrow::Cow::Owned(module),
info,
debug_source: None,View on GitHub (pinned to 3e11ff59bf)
Solutions
- Enable the `wgsl` feature on the wgpu/wgpu-core dependency in Cargo.toml: features = ["wgsl"].
- Alternatively disable timestamp query usage (remove Features::TIMESTAMP_QUERY) so normalization is not needed.
- Rebuild with `cargo build` after changing features and verify with `cargo tree -f` that naga is built with the wgsl backend.
Example fix
// before (Cargo.toml)
wgpu-core = { version = "25", default-features = false }
// after
wgpu-core = { version = "25", features = ["wgsl"] } Defensive patterns
Strategy: validation
Validate before calling
#[cfg(not(feature = "wgsl"))]
compile_error!("timestamp query usage requires the wgsl feature"); Prevention
- Keep a CI check that builds with the exact feature set used in production.
- Enable default features unless you deliberately maintain a minimal feature matrix.
- When adding Features::TIMESTAMP_QUERY, verify required wgpu/naga features are on.
When it happens
Trigger: Creating a device/queue with timestamp normalization enabled (e.g. features containing TIMESTAMP_QUERY with the internal normalization path) while the wgpu-core build lacks feature `wgsl`; enabling timestamp queries in a custom wgpu feature set that excludes wgsl.
Common situations: Custom builds of wgpu with minimal cargo features; vendored or forked builds trimming naga backends; upgrading wgpu and adding timestamp query usage without re-enabling the wgsl feature flag.
Related errors
- wgpu error: {err}
- Mismatched pop_error_scope call: no error scope for this thr
- Mismatched pop_error_scope call: error scopes must be popped
- Attempted to create a static DXC shader compiler, but the st
- ${name} is not webgpu
AI-assisted analysis of gfx-rs/wgpu@3e11ff59bf (2026-09-03).
Data as JSON: /api/errors/4c1fa6b0497fc74b.
Report an issue: GitHub.