Skip to content

Commit

Permalink
[wgpu] correct doc for resolve query set (#4849)
Browse files Browse the repository at this point in the history
* Correct doc for resolve query set

* Add note about wgpu::QUERY_SIZE

---------

Co-authored-by: Andreas Reich <[email protected]>
  • Loading branch information
valaphee and Wumpf authored Dec 9, 2023
1 parent af701fb commit 6c4128b
Showing 1 changed file with 24 additions and 26 deletions.
50 changes: 24 additions & 26 deletions wgpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3671,34 +3671,11 @@ impl CommandEncoder {
let id = self.id.as_ref().unwrap();
DynContext::command_encoder_pop_debug_group(&*self.context, id, self.data.as_ref());
}
}

/// [`Features::TIMESTAMP_QUERY`] must be enabled on the device in order to call these functions.
impl CommandEncoder {
/// Issue a timestamp command at this point in the queue.
/// The timestamp will be written to the specified query set, at the specified index.
///
/// Must be multiplied by [`Queue::get_timestamp_period`] to get
/// the value in nanoseconds. Absolute values have no meaning,
/// but timestamps can be subtracted to get the time it takes
/// for a string of operations to complete.
pub fn write_timestamp(&mut self, query_set: &QuerySet, query_index: u32) {
DynContext::command_encoder_write_timestamp(
&*self.context,
self.id.as_ref().unwrap(),
self.data.as_mut(),
&query_set.id,
query_set.data.as_ref(),
query_index,
)
}
}

/// [`Features::TIMESTAMP_QUERY`] or [`Features::PIPELINE_STATISTICS_QUERY`] must be enabled on the device in order to call these functions.
impl CommandEncoder {
/// Resolve a query set, writing the results into the supplied destination buffer.
/// Resolves a query set, writing the results into the supplied destination buffer.
///
/// Queries may be between 8 and 40 bytes each. See [`PipelineStatisticsTypes`] for more information.
/// Occlusion and timestamp queries are 8 bytes each (see [`crate::QUERY_SIZE`]). For pipeline statistics queries,
/// see [`PipelineStatisticsTypes`] for more information.
pub fn resolve_query_set(
&mut self,
query_set: &QuerySet,
Expand All @@ -3721,6 +3698,27 @@ impl CommandEncoder {
}
}

/// [`Features::TIMESTAMP_QUERY`] must be enabled on the device in order to call these functions.
impl CommandEncoder {
/// Issue a timestamp command at this point in the queue.
/// The timestamp will be written to the specified query set, at the specified index.
///
/// Must be multiplied by [`Queue::get_timestamp_period`] to get
/// the value in nanoseconds. Absolute values have no meaning,
/// but timestamps can be subtracted to get the time it takes
/// for a string of operations to complete.
pub fn write_timestamp(&mut self, query_set: &QuerySet, query_index: u32) {
DynContext::command_encoder_write_timestamp(
&*self.context,
self.id.as_ref().unwrap(),
self.data.as_mut(),
&query_set.id,
query_set.data.as_ref(),
query_index,
)
}
}

impl<'a> RenderPass<'a> {
/// Sets the active bind group for a given bind group index. The bind group layout
/// in the active pipeline when any `draw_*()` method is called must match the layout of
Expand Down

0 comments on commit 6c4128b

Please sign in to comment.