{"record":{"id":"4c1fa6b0497fc74b","repo":"gfx-rs/wgpu","slug":"timestamp-normalization-requires-the-wgsl-feature","errorCode":null,"errorMessage":"Timestamp normalization requires the wgsl feature flag to be enabled!","messagePattern":"Timestamp normalization requires the wgsl feature flag to be enabled!","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"wgpu-core/src/timestamp_normalization/mod.rs","lineNumber":151,"sourceCode":"                })?;\n\n            let common_src = include_str!(\"common.wgsl\");\n            let src = include_str!(\"timestamp_normalization.wgsl\");\n\n            let preprocessed_src = alloc::format!(\"{common_src}\\n{src}\");\n\n            #[cfg(feature = \"wgsl\")]\n            let module = naga::front::wgsl::parse_str(&preprocessed_src).map_err(|inner| {\n                TimestampNormalizerInitError::ParseWgsl(naga::error::ShaderError {\n                    source: preprocessed_src.clone(),\n                    label: None,\n                    inner: Box::new(inner),\n                })\n            })?;\n            #[cfg(not(feature = \"wgsl\"))]\n            #[allow(clippy::diverging_sub_expression)]\n            let module =\n                panic!(\"Timestamp normalization requires the wgsl feature flag to be enabled!\");\n\n            let info = crate::device::create_validator(\n                wgt::Features::IMMEDIATES,\n                wgt::DownlevelFlags::empty(),\n                naga::valid::ValidationFlags::all(),\n            )\n            .validate(&module)\n            .map_err(|inner| {\n                TimestampNormalizerInitError::ValidateWgsl(naga::error::ShaderError {\n                    source: preprocessed_src.clone(),\n                    label: None,\n                    inner,\n                })\n            })?;\n            let hal_shader = hal::ShaderInput::Naga(hal::NagaShader {\n                module: alloc::borrow::Cow::Owned(module),\n                info,\n                debug_source: None,","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/wgpu-core/src/timestamp_normalization/mod.rs#L133-L169","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (Cargo.toml)\nwgpu-core = { version = \"25\", default-features = false }\n// after\nwgpu-core = { version = \"25\", features = [\"wgsl\"] }","handlingStrategy":"validation","validationCode":"#[cfg(not(feature = \"wgsl\"))]\ncompile_error!(\"timestamp query usage requires the wgsl feature\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["wgpu","compile-time-feature","timestamp-query","naga"],"backgroundTag":"missing-cargo-feature","analyzedSha":"3e11ff59bf3f9795d285ecc045014089640d7248","analyzedAt":"2026-09-03T01:43:21.459Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}