Skip to content

Commit

Permalink
refactor: destructure timestamp writes in `command_encoder_create_{co…
Browse files Browse the repository at this point in the history
…mpute,render}_pass`
  • Loading branch information
ErichDonGubler committed Nov 21, 2024
1 parent 64114b4 commit d0b9929
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
12 changes: 10 additions & 2 deletions wgpu-core/src/command/compute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ use crate::{
use thiserror::Error;
use wgt::{BufferAddress, DynamicOffset};

use super::{bind::BinderError, memory_init::CommandBufferTextureMemoryActions};
use super::{
bind::BinderError, memory_init::CommandBufferTextureMemoryActions, SimplifiedQueryType,
};
use crate::ray_tracing::TlasAction;
use std::sync::Arc;
use std::{fmt, mem::size_of, str};
Expand Down Expand Up @@ -309,6 +311,12 @@ impl Global {
};

arc_desc.timestamp_writes = if let Some(tw) = desc.timestamp_writes {
let &PassTimestampWrites {
query_set,
beginning_of_pass_write_index: _,
end_of_pass_write_index: _,
} = tw;

match cmd_buf
.device
.require_features(wgt::Features::TIMESTAMP_QUERY)
Expand All @@ -317,7 +325,7 @@ impl Global {
Err(e) => return make_err(e.into(), arc_desc),
}

let query_set = match hub.query_sets.get(tw.query_set).get() {
let query_set = match hub.query_sets.get(query_set).get() {
Ok(query_set) => query_set,
Err(e) => return make_err(e.into(), arc_desc),
};
Expand Down
8 changes: 7 additions & 1 deletion wgpu-core/src/command/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,13 @@ impl Global {
};

arc_desc.timestamp_writes = if let Some(tw) = desc.timestamp_writes {
let query_set = query_sets.get(tw.query_set).get()?;
let &PassTimestampWrites {
query_set,
beginning_of_pass_write_index: _,
end_of_pass_write_index: _,
} = tw;

let query_set = query_sets.get(query_set).get()?;

device.require_features(wgt::Features::TIMESTAMP_QUERY)?;

Expand Down

0 comments on commit d0b9929

Please sign in to comment.