Skip to content

Commit

Permalink
WIP: chore!: remove GPUCommandEncoder.writeTimestamp API
Browse files Browse the repository at this point in the history
See [`gpuweb/gpuweb`gfx-rs#4370](gpuweb/gpuweb#4370).
  • Loading branch information
ErichDonGubler committed Apr 2, 2024
1 parent 1144b06 commit 3408603
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 198 deletions.
43 changes: 0 additions & 43 deletions wgpu/src/backend/wgpu_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1998,27 +1998,6 @@ impl crate::Context for ContextWgpuCore {
}
}

fn command_encoder_write_timestamp(
&self,
encoder: &Self::CommandEncoderId,
encoder_data: &Self::CommandEncoderData,
query_set: &Self::QuerySetId,
_query_set_data: &Self::QuerySetData,
query_index: u32,
) {
if let Err(cause) = wgc::gfx_select!(encoder => self.0.command_encoder_write_timestamp(
*encoder,
*query_set,
query_index
)) {
self.handle_error_nolabel(
&encoder_data.error_sink,
cause,
"CommandEncoder::write_timestamp",
);
}
}

fn command_encoder_resolve_query_set(
&self,
encoder: &Self::CommandEncoderId,
Expand Down Expand Up @@ -2332,17 +2311,6 @@ impl crate::Context for ContextWgpuCore {
wgpu_compute_pass_pop_debug_group(pass_data);
}

fn compute_pass_write_timestamp(
&self,
_pass: &mut Self::ComputePassId,
pass_data: &mut Self::ComputePassData,
query_set: &Self::QuerySetId,
_query_set_data: &Self::QuerySetData,
query_index: u32,
) {
wgpu_compute_pass_write_timestamp(pass_data, *query_set, query_index)
}

fn compute_pass_begin_pipeline_statistics_query(
&self,
_pass: &mut Self::ComputePassId,
Expand Down Expand Up @@ -2849,17 +2817,6 @@ impl crate::Context for ContextWgpuCore {
wgpu_render_pass_pop_debug_group(pass_data);
}

fn render_pass_write_timestamp(
&self,
_pass: &mut Self::RenderPassId,
pass_data: &mut Self::RenderPassData,
query_set: &Self::QuerySetId,
_query_set_data: &Self::QuerySetData,
query_index: u32,
) {
wgpu_render_pass_write_timestamp(pass_data, *query_set, query_index)
}

fn render_pass_begin_occlusion_query(
&self,
_pass: &mut Self::RenderPassId,
Expand Down
114 changes: 0 additions & 114 deletions wgpu/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,14 +506,6 @@ pub trait Context: Debug + WasmNotSendSync + Sized {
encoder_data: &Self::CommandEncoderData,
);

fn command_encoder_write_timestamp(
&self,
encoder: &Self::CommandEncoderId,
encoder_data: &Self::CommandEncoderData,
query_set: &Self::QuerySetId,
query_set_data: &Self::QuerySetData,
query_index: u32,
);
#[allow(clippy::too_many_arguments)]
fn command_encoder_resolve_query_set(
&self,
Expand Down Expand Up @@ -646,14 +638,6 @@ pub trait Context: Debug + WasmNotSendSync + Sized {
pass: &mut Self::ComputePassId,
pass_data: &mut Self::ComputePassData,
);
fn compute_pass_write_timestamp(
&self,
pass: &mut Self::ComputePassId,
pass_data: &mut Self::ComputePassData,
query_set: &Self::QuerySetId,
query_set_data: &Self::QuerySetData,
query_index: u32,
);
fn compute_pass_begin_pipeline_statistics_query(
&self,
pass: &mut Self::ComputePassId,
Expand Down Expand Up @@ -977,14 +961,6 @@ pub trait Context: Debug + WasmNotSendSync + Sized {
pass: &mut Self::RenderPassId,
pass_data: &mut Self::RenderPassData,
);
fn render_pass_write_timestamp(
&self,
pass: &mut Self::RenderPassId,
pass_data: &mut Self::RenderPassData,
query_set: &Self::QuerySetId,
query_set_data: &Self::QuerySetData,
query_index: u32,
);
fn render_pass_begin_occlusion_query(
&self,
pass: &mut Self::RenderPassId,
Expand Down Expand Up @@ -1488,14 +1464,6 @@ pub(crate) trait DynContext: Debug + WasmNotSendSync {
);
fn command_encoder_pop_debug_group(&self, encoder: &ObjectId, encoder_data: &crate::Data);

fn command_encoder_write_timestamp(
&self,
encoder: &ObjectId,
encoder_data: &crate::Data,
query_set: &ObjectId,
query_set_data: &crate::Data,
query_index: u32,
);
#[allow(clippy::too_many_arguments)]
fn command_encoder_resolve_query_set(
&self,
Expand Down Expand Up @@ -1620,14 +1588,6 @@ pub(crate) trait DynContext: Debug + WasmNotSendSync {
group_label: &str,
);
fn compute_pass_pop_debug_group(&self, pass: &mut ObjectId, pass_data: &mut crate::Data);
fn compute_pass_write_timestamp(
&self,
pass: &mut ObjectId,
pass_data: &mut crate::Data,
query_set: &ObjectId,
query_set_data: &crate::Data,
query_index: u32,
);
fn compute_pass_begin_pipeline_statistics_query(
&self,
pass: &mut ObjectId,
Expand Down Expand Up @@ -1947,14 +1907,6 @@ pub(crate) trait DynContext: Debug + WasmNotSendSync {
group_label: &str,
);
fn render_pass_pop_debug_group(&self, pass: &mut ObjectId, pass_data: &mut crate::Data);
fn render_pass_write_timestamp(
&self,
pass: &mut ObjectId,
pass_data: &mut crate::Data,
query_set: &ObjectId,
query_set_data: &crate::Data,
query_index: u32,
);
fn render_pass_begin_occlusion_query(
&self,
pass: &mut ObjectId,
Expand Down Expand Up @@ -2840,28 +2792,6 @@ where
Context::command_encoder_pop_debug_group(self, &encoder, encoder_data)
}

fn command_encoder_write_timestamp(
&self,
encoder: &ObjectId,
encoder_data: &crate::Data,
query_set: &ObjectId,
query_set_data: &crate::Data,
query_index: u32,
) {
let encoder = <T::CommandEncoderId>::from(*encoder);
let encoder_data = downcast_ref(encoder_data);
let query_set = <T::QuerySetId>::from(*query_set);
let query_set_data = downcast_ref(query_set_data);
Context::command_encoder_write_timestamp(
self,
&encoder,
encoder_data,
&query_set,
query_set_data,
query_index,
)
}

fn command_encoder_resolve_query_set(
&self,
encoder: &ObjectId,
Expand Down Expand Up @@ -3133,28 +3063,6 @@ where
Context::compute_pass_pop_debug_group(self, &mut pass, pass_data)
}

fn compute_pass_write_timestamp(
&self,
pass: &mut ObjectId,
pass_data: &mut crate::Data,
query_set: &ObjectId,
query_set_data: &crate::Data,
query_index: u32,
) {
let mut pass = <T::ComputePassId>::from(*pass);
let pass_data = downcast_mut::<T::ComputePassData>(pass_data);
let query_set = <T::QuerySetId>::from(*query_set);
let query_set_data = downcast_ref(query_set_data);
Context::compute_pass_write_timestamp(
self,
&mut pass,
pass_data,
&query_set,
query_set_data,
query_index,
)
}

fn compute_pass_begin_pipeline_statistics_query(
&self,
pass: &mut ObjectId,
Expand Down Expand Up @@ -3899,28 +3807,6 @@ where
Context::render_pass_pop_debug_group(self, &mut pass, pass_data)
}

fn render_pass_write_timestamp(
&self,
pass: &mut ObjectId,
pass_data: &mut crate::Data,
query_set: &ObjectId,
query_set_data: &crate::Data,
query_index: u32,
) {
let mut pass = <T::RenderPassId>::from(*pass);
let pass_data = downcast_mut::<T::RenderPassData>(pass_data);
let query_set = <T::QuerySetId>::from(*query_set);
let query_set_data = downcast_ref(query_set_data);
Context::render_pass_write_timestamp(
self,
&mut pass,
pass_data,
&query_set,
query_set_data,
query_index,
)
}

fn render_pass_begin_occlusion_query(
&self,
pass: &mut ObjectId,
Expand Down
41 changes: 0 additions & 41 deletions wgpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4019,27 +4019,6 @@ impl<'a> RenderPass<'a> {
}
}

/// [`Features::TIMESTAMP_QUERY_INSIDE_PASSES`] must be enabled on the device in order to call these functions.
impl<'a> RenderPass<'a> {
/// 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::render_pass_write_timestamp(
&*self.parent.context,
&mut self.id,
self.data.as_mut(),
&query_set.id,
query_set.data.as_ref(),
query_index,
)
}
}

impl<'a> RenderPass<'a> {
/// Start a occlusion query on this render pass. It can be ended with
/// `end_occlusion_query`. Occlusion queries may not be nested.
Expand Down Expand Up @@ -4221,26 +4200,6 @@ impl<'a> ComputePass<'a> {
}
}

/// [`Features::TIMESTAMP_QUERY_INSIDE_PASSES`] must be enabled on the device in order to call these functions.
impl<'a> ComputePass<'a> {
/// 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::compute_pass_write_timestamp(
&*self.parent.context,
&mut self.id,
self.data.as_mut(),
&query_set.id,
query_set.data.as_ref(),
query_index,
)
}
}

/// [`Features::PIPELINE_STATISTICS_QUERY`] must be enabled on the device in order to call these functions.
impl<'a> ComputePass<'a> {
/// Start a pipeline statistics query on this compute pass. It can be ended with
Expand Down

0 comments on commit 3408603

Please sign in to comment.