{"record":{"id":"67c69f9a4d5576f0","repo":"gfx-rs/wgpu","slug":"timestamp-query-inside-passes-feature-must-be-enab","errorCode":null,"errorMessage":"TIMESTAMP_QUERY_INSIDE_PASSES feature must be enabled to call write_timestamp in a compute pass.","messagePattern":"TIMESTAMP_QUERY_INSIDE_PASSES feature must be enabled to call write_timestamp in a compute pass\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"wgpu/src/backend/webgpu.rs","lineNumber":3666,"sourceCode":"\n    fn set_immediates(&mut self, _offset: u32, _data: &[u8]) {\n        panic!(\"IMMEDIATES feature must be enabled to call set_immediates\")\n    }\n\n    fn insert_debug_marker(&mut self, label: &str) {\n        self.inner.insert_debug_marker(label);\n    }\n\n    fn push_debug_group(&mut self, group_label: &str) {\n        self.inner.push_debug_group(group_label);\n    }\n\n    fn pop_debug_group(&mut self) {\n        self.inner.pop_debug_group();\n    }\n\n    fn write_timestamp(&mut self, _query_set: &dispatch::DispatchQuerySet, _query_index: u32) {\n        panic!(\"TIMESTAMP_QUERY_INSIDE_PASSES feature must be enabled to call write_timestamp in a compute pass.\")\n    }\n\n    fn begin_pipeline_statistics_query(\n        &mut self,\n        _query_set: &dispatch::DispatchQuerySet,\n        _query_index: u32,\n    ) {\n        // Not available in gecko yet\n    }\n\n    fn end_pipeline_statistics_query(&mut self) {\n        // Not available in gecko yet\n    }\n\n    fn dispatch_workgroups(&mut self, x: u32, y: u32, z: u32) {\n        self.inner\n            .dispatch_workgroups_with_workgroup_count_y_and_workgroup_count_z(x, y, z);\n    }","sourceCodeStart":3648,"sourceCodeEnd":3684,"githubUrl":"https://github.com/gfx-rs/wgpu/blob/3e11ff59bf3f9795d285ecc045014089640d7248/wgpu/src/backend/webgpu.rs#L3648-L3684","documentation":"On the WebGPU backend, ComputePassEncoder::write_timestamp is not supported, so wgpu panics. The message indicates the TIMESTAMP_QUERY_INSIDE_PASSES feature would be required, and that capability cannot be satisfied via the WebGPU backend path.","triggerScenarios":"Calling compute_pass.write_timestamp(query_set, query_index) on a compute pass running via the webgpu backend.","commonSituations":"GPU profiling code instrumenting compute passes, compiled to wasm; backend-agnostic profiler traits calling write_timestamp unconditionally; assuming native support carries over to the browser.","solutions":["Gate pass-level write_timestamp on Features::TIMESTAMP_QUERY_INSIDE_PASSES (from adapter.features()) AND a non-WebGPU backend.","Skip timestamp instrumentation on web and use CPU timers.","Configure profiling instrumentation once at device creation via a capability flag.","Read/resolve timestamps only on backends where they were recorded."],"exampleFix":"// before\ncompute_pass.write_timestamp(&timestamps, 0);\n// after\nif timestamps_enabled && !is_webgpu {\n    compute_pass.write_timestamp(&timestamps, 0);\n}","handlingStrategy":"validation","validationCode":"if device.features().contains(Features::TIMESTAMP_QUERY_INSIDE_PASSES) && !is_webgpu_backend {\n    compute_pass.write_timestamp(&qs, 0);\n}","typeGuard":"fn supports_pass_timestamps(f: Features, b: Backend) -> bool {\n    f.contains(Features::TIMESTAMP_QUERY_INSIDE_PASSES) && b != Backend::Browser\n}","tryCatchPattern":null,"preventionTips":["Feature-gate pass timestamp instrumentation at profiler construction time.","Keep the profiling abstraction configurable per backend.","Skip GPU timestamps on browser targets and use performance.now().","Audit all write_timestamp call sites after backend changes."],"tags":["panic","webgpu","timestamps","compute-pass","unsupported-feature"],"backgroundTag":"unsupported-feature-panic","analyzedSha":"3e11ff59bf3f9795d285ecc045014089640d7248","analyzedAt":"2026-09-03T01:43:21.459Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}