gfx-rs/wgpu · error
TIMESTAMP_QUERY_INSIDE_ENCODERS feature must be enabled to c
Error message
TIMESTAMP_QUERY_INSIDE_ENCODERS feature must be enabled to call write_timestamp on a command encoder.
What it means
On the WebGPU backend, CommandEncoder::write_timestamp is unconditionally unsupported: the write-timestamp-on-encoder capability was removed from the WebGPU spec (gpuweb PR #4370). wgpu panics to signal that this backend can never service the call.
Source
Thrown at wgpu/src/backend/webgpu.rs:3552
}
}
fn insert_debug_marker(&self, label: &str) {
self.inner.insert_debug_marker(label)
}
fn push_debug_group(&self, group_label: &str) {
self.inner.push_debug_group(group_label)
}
fn pop_debug_group(&self) {
self.inner.pop_debug_group()
}
fn write_timestamp(&self, _query_set: &dispatch::DispatchQuerySet, _query_index: u32) {
// Not available on WebGPU.
// This was part of the spec originally but got removed, see https://github.com/gpuweb/gpuweb/pull/4370
panic!("TIMESTAMP_QUERY_INSIDE_ENCODERS feature must be enabled to call write_timestamp on a command encoder.")
}
fn resolve_query_set(
&self,
query_set: &dispatch::DispatchQuerySet,
first_query: u32,
query_count: u32,
destination: &dispatch::DispatchBuffer,
destination_offset: crate::BufferAddress,
) {
let query_set = &query_set.as_webgpu().inner;
let destination = &destination.as_webgpu().inner;
self.inner.resolve_query_set_with_u32(
query_set,
first_query,
query_count,
destination,View on GitHub (pinned to 3e11ff59bf)
Solutions
- Guard encoder-level write_timestamp calls behind a runtime backend check and skip them on WebGPU.
- Move timestamp writes into render/compute passes via pass-level write_timestamp where TIMESTAMP_QUERY_INSIDE_PASSES is supported.
- Fall back to CPU-side timing on web.
- Gate the profiling feature on adapter.features() at startup.
Example fix
// before
encoder.write_timestamp(&query_set, 0);
// after
if features.contains(Features::TIMESTAMP_QUERY_INSIDE_ENCODERS) && !is_webgpu {
encoder.write_timestamp(&query_set, 0);
} Defensive patterns
Strategy: validation
Validate before calling
let ok = device.features().contains(Features::TIMESTAMP_QUERY_INSIDE_ENCODERS)
&& adapter.get_info().backend != wgpu::Backend::Browser;
if ok { encoder.write_timestamp(&qs, 0); } Type guard
fn supports_encoder_timestamps(f: Features, b: Backend) -> bool {
f.contains(Features::TIMESTAMP_QUERY_INSIDE_ENCODERS) && b != Backend::Browser
} Prevention
- Check adapter.features() and backend before any timestamp API.
- Use pass-level timestamps only where the spec supports them.
- Centralize capability queries in one helper used by profiling code.
- Provide CPU timing fallbacks for web builds.
When it happens
Trigger: Calling command_encoder.write_timestamp(query_set, query_index) when running on the WebGPU (browser/wasm) backend, regardless of feature flags.
Common situations: wasm builds of an app using GPU timestamp profiling on native; shared profiling code paths that call write_timestamp on encoders without checking the backend; assuming TIMESTAMP_QUERY_INSIDE_ENCODERS makes the call valid on web.
Related errors
- TIMESTAMP_QUERY_INSIDE_PASSES feature must be enabled to cal
- {:?} is not enabled for this backend
- VERTEX_ATTRIBUTE_64BIT feature must be enabled to use Double
- IMMEDIATES feature must be enabled to call set_immediates
- 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/b3614777e708cdf0.
Report an issue: GitHub.