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 | 52 ++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 27 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,6 +3671,31 @@ impl CommandEncoder { let id = self.id.as_ref().unwrap(); DynContext::command_encoder_pop_debug_group(&*self.context, id, self.data.as_ref()); } + + /// Resolves a query set, writing the results into the supplied destination buffer. + /// + /// 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, + query_range: Range, + destination: &Buffer, + destination_offset: BufferAddress, + ) { + DynContext::command_encoder_resolve_query_set( + &*self.context, + self.id.as_ref().unwrap(), + self.data.as_ref(), + &query_set.id, + query_set.data.as_ref(), + query_range.start, + query_range.end - query_range.start, + &destination.id, + destination.data.as_ref(), + destination_offset, + ) + } } /// [`Features::TIMESTAMP_QUERY`] must be enabled on the device in order to call these functions. @@ -3694,33 +3719,6 @@ impl CommandEncoder { } } -/// [`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. - /// - /// Queries may be between 8 and 40 bytes each. See [`PipelineStatisticsTypes`] for more information. - pub fn resolve_query_set( - &mut self, - query_set: &QuerySet, - query_range: Range, - destination: &Buffer, - destination_offset: BufferAddress, - ) { - DynContext::command_encoder_resolve_query_set( - &*self.context, - self.id.as_ref().unwrap(), - self.data.as_ref(), - &query_set.id, - query_set.data.as_ref(), - query_range.start, - query_range.end - query_range.start, - &destination.id, - destination.data.as_ref(), - destination_offset, - ) - } -} - 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