fold ComputePassTimestampWrites & RenderPassTimestampWrites and make PassTimestampWrites usable with DynQuerySet

This commit is contained in:
Andreas Reich 2024-07-15 23:42:39 +02:00
parent fc764b4b17
commit bea9a10f90
3 changed files with 7 additions and 36 deletions

View File

@ -511,7 +511,7 @@ impl Global {
}
}
Some(hal::ComputePassTimestampWrites {
Some(hal::PassTimestampWrites {
query_set: query_set.raw(),
beginning_of_pass_write_index: tw.beginning_of_pass_write_index,
end_of_pass_write_index: tw.end_of_pass_write_index,

View File

@ -1192,7 +1192,7 @@ impl<'d, A: HalApi> RenderPassInfo<'d, A> {
pending_query_resets.use_query_set(query_set, index);
}
Some(hal::RenderPassTimestampWrites {
Some(hal::PassTimestampWrites {
query_set: query_set.raw(),
beginning_of_pass_write_index: tw.beginning_of_pass_write_index,
end_of_pass_write_index: tw.end_of_pass_write_index,

View File

@ -2074,24 +2074,13 @@ pub struct DepthStencilAttachment<'a, A: Api> {
pub clear_value: (f32, u32),
}
#[derive(Debug)]
pub struct RenderPassTimestampWrites<'a, A: Api> {
pub query_set: &'a A::QuerySet,
#[derive(Clone, Debug)]
pub struct PassTimestampWrites<'a, Q: DynQuerySet + ?Sized> {
pub query_set: &'a Q,
pub beginning_of_pass_write_index: Option<u32>,
pub end_of_pass_write_index: Option<u32>,
}
// Rust gets confused about the impl requirements for `A`
impl<A: Api> Clone for RenderPassTimestampWrites<'_, A> {
fn clone(&self) -> Self {
Self {
query_set: self.query_set,
beginning_of_pass_write_index: self.beginning_of_pass_write_index,
end_of_pass_write_index: self.end_of_pass_write_index,
}
}
}
#[derive(Clone, Debug)]
pub struct RenderPassDescriptor<'a, A: Api> {
pub label: Label<'a>,
@ -2100,32 +2089,14 @@ pub struct RenderPassDescriptor<'a, A: Api> {
pub color_attachments: &'a [Option<ColorAttachment<'a, A>>],
pub depth_stencil_attachment: Option<DepthStencilAttachment<'a, A>>,
pub multiview: Option<NonZeroU32>,
pub timestamp_writes: Option<RenderPassTimestampWrites<'a, A>>,
pub timestamp_writes: Option<PassTimestampWrites<'a, A::QuerySet>>,
pub occlusion_query_set: Option<&'a A::QuerySet>,
}
#[derive(Debug)]
pub struct ComputePassTimestampWrites<'a, A: Api> {
pub query_set: &'a A::QuerySet,
pub beginning_of_pass_write_index: Option<u32>,
pub end_of_pass_write_index: Option<u32>,
}
// Rust gets confused about the impl requirements for `A`
impl<A: Api> Clone for ComputePassTimestampWrites<'_, A> {
fn clone(&self) -> Self {
Self {
query_set: self.query_set,
beginning_of_pass_write_index: self.beginning_of_pass_write_index,
end_of_pass_write_index: self.end_of_pass_write_index,
}
}
}
#[derive(Clone, Debug)]
pub struct ComputePassDescriptor<'a, A: Api> {
pub label: Label<'a>,
pub timestamp_writes: Option<ComputePassTimestampWrites<'a, A>>,
pub timestamp_writes: Option<PassTimestampWrites<'a, A::QuerySet>>,
}
/// Stores the text of any validation errors that have occurred since