Skip to content

Commit

Permalink
Merge branch 'trunk' into gl-timestamps
Browse files Browse the repository at this point in the history
  • Loading branch information
cwfitzgerald authored Oct 22, 2023
2 parents ef378ea + 3cc6a56 commit 30e755d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions examples/hello-synchronization/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ publish = false
[[bin]]
name = "hello-synchronization"
path = "src/main.rs"
harness = false

[dependencies]
bytemuck.workspace = true
Expand Down
6 changes: 6 additions & 0 deletions examples/hello-synchronization/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ const ARR_SIZE: usize = 128;

struct ExecuteResults {
patient_workgroup_results: Vec<u32>,
#[cfg_attr(test, allow(unused))]
hasty_workgroup_results: Vec<u32>,
}

#[cfg_attr(test, allow(unused))]
async fn run() {
let instance = wgpu::Instance::default();
let adapter = instance
Expand Down Expand Up @@ -187,6 +189,7 @@ async fn get_data<T: bytemuck::Pod>(
staging_buffer.unmap();
}

#[cfg(not(test))]
fn main() {
#[cfg(not(target_arch = "wasm32"))]
{
Expand All @@ -207,5 +210,8 @@ fn main() {
}
}

#[cfg(test)]
wgpu_test::gpu_test_main!();

#[cfg(test)]
mod tests;
1 change: 1 addition & 0 deletions examples/timestamp-queries/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ publish = false
[[bin]]
name = "timestamp-queries"
path = "src/main.rs"
harness = false

[dependencies]
bytemuck.workspace = true
Expand Down
6 changes: 6 additions & 0 deletions examples/timestamp-queries/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ impl QueryResults {
}
}

#[cfg_attr(test, allow(unused))]
fn print(&self, queue: &wgpu::Queue) {
let period = queue.get_timestamp_period();
let elapsed_us = |start, end: u64| end.wrapping_sub(start) as f64 * period as f64 / 1000.0;
Expand Down Expand Up @@ -174,6 +175,7 @@ impl Queries {
}
}

#[cfg_attr(test, allow(unused))]
async fn run() {
// Instantiates instance of wgpu
let backends = wgpu::util::backend_bits_from_env().unwrap_or_else(wgpu::Backends::all);
Expand Down Expand Up @@ -403,6 +405,7 @@ fn render_pass(
rpass.draw(0..3, 0..1);
}

#[cfg(not(test))]
fn main() {
#[cfg(not(target_arch = "wasm32"))]
{
Expand All @@ -417,6 +420,9 @@ fn main() {
}
}

#[cfg(test)]
wgpu_test::gpu_test_main!();

#[cfg(test)]
mod tests {
use wgpu_test::{gpu_test, GpuTestConfiguration};
Expand Down

0 comments on commit 30e755d

Please sign in to comment.