From 6c4128b4e7ba7696f014a04a87dfd1fd8ec31ddc Mon Sep 17 00:00:00 2001 From: Valaphee The Meerkat <32491319+valaphee@users.noreply.github.com> Date: Sat, 9 Dec 2023 23:56:09 +0100 Subject: [PATCH] [wgpu] correct doc for resolve query set (#4849) * Correct doc for resolve query set * Add note about wgpu::QUERY_SIZE --------- Co-authored-by: Andreas Reich --- wgpu/src/lib.rs | 50 ++++++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs index f5668881bb..48e7262bcc 100644 --- a/wgpu/src/lib.rs +++ b/wgpu/src/lib.rs @@ -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, @@ -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