mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-10-30 05:51:42 +00:00
Re-add missing example tests (#4277)
This commit is contained in:
parent
04ac5f2851
commit
3cc6a563ca
@ -9,6 +9,7 @@ publish = false
|
||||
[[bin]]
|
||||
name = "hello-synchronization"
|
||||
path = "src/main.rs"
|
||||
harness = false
|
||||
|
||||
[dependencies]
|
||||
bytemuck.workspace = true
|
||||
|
@ -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
|
||||
@ -187,6 +189,7 @@ async fn get_data<T: bytemuck::Pod>(
|
||||
staging_buffer.unmap();
|
||||
}
|
||||
|
||||
#[cfg(not(test))]
|
||||
fn main() {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
@ -207,5 +210,8 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
wgpu_test::gpu_test_main!();
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
@ -9,6 +9,7 @@ publish = false
|
||||
[[bin]]
|
||||
name = "timestamp-queries"
|
||||
path = "src/main.rs"
|
||||
harness = false
|
||||
|
||||
[dependencies]
|
||||
bytemuck.workspace = true
|
||||
|
@ -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;
|
||||
@ -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);
|
||||
@ -403,6 +405,7 @@ fn render_pass(
|
||||
rpass.draw(0..3, 0..1);
|
||||
}
|
||||
|
||||
#[cfg(not(test))]
|
||||
fn main() {
|
||||
#[cfg(not(target_arch = "wasm32"))]
|
||||
{
|
||||
@ -417,6 +420,9 @@ fn main() {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
wgpu_test::gpu_test_main!();
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use wgpu_test::{gpu_test, GpuTestConfiguration};
|
||||
|
Loading…
Reference in New Issue
Block a user