Skip to content

Commit 78d821c

Browse files
refactor: destructure timestamp writes in command_encoder_create_{compute,render}_pass
1 parent 2a4644b commit 78d821c

File tree

2 files changed

+17
-3
lines changed

2 files changed

+17
-3
lines changed

wgpu-core/src/command/compute.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ use crate::{
2828
use thiserror::Error;
2929
use wgt::{BufferAddress, DynamicOffset};
3030

31-
use super::{bind::BinderError, memory_init::CommandBufferTextureMemoryActions};
31+
use super::{
32+
bind::BinderError, memory_init::CommandBufferTextureMemoryActions, SimplifiedQueryType,
33+
};
3234
use crate::ray_tracing::TlasAction;
3335
use std::sync::Arc;
3436
use std::{fmt, mem::size_of, str};
@@ -309,6 +311,12 @@ impl Global {
309311
};
310312

311313
arc_desc.timestamp_writes = if let Some(tw) = desc.timestamp_writes {
314+
let &PassTimestampWrites {
315+
query_set,
316+
beginning_of_pass_write_index: _,
317+
end_of_pass_write_index: _,
318+
} = tw;
319+
312320
match cmd_buf
313321
.device
314322
.require_features(wgt::Features::TIMESTAMP_QUERY)
@@ -317,7 +325,7 @@ impl Global {
317325
Err(e) => return make_err(e.into(), arc_desc),
318326
}
319327

320-
let query_set = match hub.query_sets.get(tw.query_set).get() {
328+
let query_set = match hub.query_sets.get(query_set).get() {
321329
Ok(query_set) => query_set,
322330
Err(e) => return make_err(e.into(), arc_desc),
323331
};

wgpu-core/src/command/render.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1392,7 +1392,13 @@ impl Global {
13921392
};
13931393

13941394
arc_desc.timestamp_writes = if let Some(tw) = desc.timestamp_writes {
1395-
let query_set = query_sets.get(tw.query_set).get()?;
1395+
let &PassTimestampWrites {
1396+
query_set,
1397+
beginning_of_pass_write_index: _,
1398+
end_of_pass_write_index: _,
1399+
} = tw;
1400+
1401+
let query_set = query_sets.get(query_set).get()?;
13961402

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

0 commit comments

Comments
 (0)