gfx-rs/wgpu · error
TIMESTAMP_QUERY_INSIDE_PASSES feature must be enabled to cal
Error message
TIMESTAMP_QUERY_INSIDE_PASSES feature must be enabled to call write_timestamp in a compute pass.
What it means
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.
Source
Thrown at wgpu/src/backend/webgpu.rs:3666
fn set_immediates(&mut self, _offset: u32, _data: &[u8]) {
panic!("IMMEDIATES feature must be enabled to call set_immediates")
}
fn insert_debug_marker(&mut self, label: &str) {
self.inner.insert_debug_marker(label);
}
fn push_debug_group(&mut self, group_label: &str) {
self.inner.push_debug_group(group_label);
}
fn pop_debug_group(&mut self) {
self.inner.pop_debug_group();
}
fn write_timestamp(&mut self, _query_set: &dispatch::DispatchQuerySet, _query_index: u32) {
panic!("TIMESTAMP_QUERY_INSIDE_PASSES feature must be enabled to call write_timestamp in a compute pass.")
}
fn begin_pipeline_statistics_query(
&mut self,
_query_set: &dispatch::DispatchQuerySet,
_query_index: u32,
) {
// Not available in gecko yet
}
fn end_pipeline_statistics_query(&mut self) {
// Not available in gecko yet
}
fn dispatch_workgroups(&mut self, x: u32, y: u32, z: u32) {
self.inner
.dispatch_workgroups_with_workgroup_count_y_and_workgroup_count_z(x, y, z);
}View on GitHub (pinned to 3e11ff59bf)
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.
Example fix
// before
compute_pass.write_timestamp(×tamps, 0);
// after
if timestamps_enabled && !is_webgpu {
compute_pass.write_timestamp(×tamps, 0);
} Defensive patterns
Strategy: validation
Validate before calling
if device.features().contains(Features::TIMESTAMP_QUERY_INSIDE_PASSES) && !is_webgpu_backend {
compute_pass.write_timestamp(&qs, 0);
} Type guard
fn supports_pass_timestamps(f: Features, b: Backend) -> bool {
f.contains(Features::TIMESTAMP_QUERY_INSIDE_PASSES) && b != Backend::Browser
} Prevention
- 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.
When it happens
Trigger: Calling compute_pass.write_timestamp(query_set, query_index) on a compute pass running via the webgpu backend.
Common situations: 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.
Related errors
- TIMESTAMP_QUERY_INSIDE_ENCODERS feature must be enabled to c
- IMMEDIATES feature must be enabled to call set_immediates
- {:?} is not enabled for this backend
- VERTEX_ATTRIBUTE_64BIT feature must be enabled to use Double
- MESH_SHADER feature must be enabled to call draw_mesh_tasks
AI-assisted analysis of gfx-rs/wgpu@3e11ff59bf (2026-09-03).
Data as JSON: /api/errors/67c69f9a4d5576f0.
Report an issue: GitHub.