mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-12-08 21:26:17 +00:00
Refactor tests to be feature flag bit-width agnostic (#5155)
This commit is contained in:
parent
e2e9ef5547
commit
0003db18c4
@ -81,6 +81,7 @@ Bottom level categories:
|
|||||||
#### Tests
|
#### Tests
|
||||||
|
|
||||||
- Fix intermittent crashes on Linux in the `multithreaded_compute` test. By @jimblandy in [#5129](https://github.com/gfx-rs/wgpu/pull/5129).
|
- Fix intermittent crashes on Linux in the `multithreaded_compute` test. By @jimblandy in [#5129](https://github.com/gfx-rs/wgpu/pull/5129).
|
||||||
|
- Refactor tests to read feature flags by name instead of a hardcoded hexadecimal u64. By @rodolphito in [#5155](https://github.com/gfx-rs/wgpu/pull/5155).
|
||||||
|
|
||||||
## v0.19.0 (2024-01-17)
|
## v0.19.0 (2024-01-17)
|
||||||
|
|
||||||
@ -193,7 +194,7 @@ let surface = instance.create_surface(my_window.clone())?;
|
|||||||
```
|
```
|
||||||
|
|
||||||
All platform specific surface creation using points have moved into `SurfaceTargetUnsafe` as well.
|
All platform specific surface creation using points have moved into `SurfaceTargetUnsafe` as well.
|
||||||
For example:
|
For example:
|
||||||
|
|
||||||
Safety by @daxpedda in [#4597](https://github.com/gfx-rs/wgpu/pull/4597)
|
Safety by @daxpedda in [#4597](https://github.com/gfx-rs/wgpu/pull/4597)
|
||||||
Unification by @wumpf in [#4984](https://github.com/gfx-rs/wgpu/pull/4984)
|
Unification by @wumpf in [#4984](https://github.com/gfx-rs/wgpu/pull/4984)
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
(
|
(
|
||||||
features: 0x0,
|
features: [],
|
||||||
expectations: [], //not crash!
|
expectations: [], //not crash!
|
||||||
actions: [
|
actions: [
|
||||||
CreateBuffer(Id(0, 1, Empty), (
|
CreateBuffer(Id(0, 1, Empty), (
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
(
|
(
|
||||||
features: 0x0000_0004_0000_0000, // MAPPABLE_PRIMARY_BUFFERS
|
features: ["MAPPABLE_PRIMARY_BUFFERS"],
|
||||||
expectations: [
|
expectations: [
|
||||||
(
|
(
|
||||||
name: "basic",
|
name: "basic",
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
(
|
(
|
||||||
features: 0x0004_0004_0000_0000, // MAPPABLE_PRIMARY_BUFFERS | CLEAR_TEXTURE
|
features: ["MAPPABLE_PRIMARY_BUFFERS", "CLEAR_TEXTURE"],
|
||||||
expectations: [
|
expectations: [
|
||||||
(
|
(
|
||||||
name: "Quad",
|
name: "Quad",
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
(
|
(
|
||||||
features: 0x0000_0005_0000_0000, // MAPPABLE_PRIMARY_BUFFERS | PIPELINE_STATISTICS_QUERY
|
features: ["MAPPABLE_PRIMARY_BUFFERS", "PIPELINE_STATISTICS_QUERY"],
|
||||||
expectations: [
|
expectations: [
|
||||||
(
|
(
|
||||||
name: "Queried number of compute invocations is correct",
|
name: "Queried number of compute invocations is correct",
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
(
|
(
|
||||||
features: 0x0,
|
features: [],
|
||||||
expectations: [
|
expectations: [
|
||||||
(
|
(
|
||||||
name: "Quad",
|
name: "Quad",
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
(
|
(
|
||||||
features: 0x0000_0004_0000_0000, // MAPPABLE_PRIMARY_BUFFERS
|
features: ["MAPPABLE_PRIMARY_BUFFERS"],
|
||||||
expectations: [
|
expectations: [
|
||||||
// Ensuring that mapping zero-inits buffers.
|
// Ensuring that mapping zero-inits buffers.
|
||||||
(
|
(
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
(
|
(
|
||||||
features: 0x0,
|
features: [],
|
||||||
expectations: [
|
expectations: [
|
||||||
(
|
(
|
||||||
name: "Sampled Texture",
|
name: "Sampled Texture",
|
||||||
@ -56,7 +56,7 @@
|
|||||||
format: "rgba8unorm",
|
format: "rgba8unorm",
|
||||||
usage: 9, // STORAGE + COPY_SRC
|
usage: 9, // STORAGE + COPY_SRC
|
||||||
view_formats: [],
|
view_formats: [],
|
||||||
)),
|
)),
|
||||||
CreateTextureView(
|
CreateTextureView(
|
||||||
id: Id(1, 1, Empty),
|
id: Id(1, 1, Empty),
|
||||||
parent_id: Id(1, 1, Empty),
|
parent_id: Id(1, 1, Empty),
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
(
|
(
|
||||||
features: 0x0,
|
features: [],
|
||||||
expectations: [
|
expectations: [
|
||||||
(
|
(
|
||||||
name: "Copy to Buffer",
|
name: "Copy to Buffer",
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
(
|
(
|
||||||
features: 0x0,
|
features: [],
|
||||||
expectations: [
|
expectations: [
|
||||||
(
|
(
|
||||||
name: "Render Target",
|
name: "Render Target",
|
||||||
|
|||||||
@ -49,7 +49,6 @@ struct Expectation {
|
|||||||
data: ExpectedData,
|
data: ExpectedData,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(serde::Deserialize)]
|
|
||||||
struct Test<'a> {
|
struct Test<'a> {
|
||||||
features: wgt::Features,
|
features: wgt::Features,
|
||||||
expectations: Vec<Expectation>,
|
expectations: Vec<Expectation>,
|
||||||
@ -72,7 +71,30 @@ impl Test<'_> {
|
|||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
};
|
};
|
||||||
let string = read_to_string(path).unwrap().replace("Empty", backend_name);
|
let string = read_to_string(path).unwrap().replace("Empty", backend_name);
|
||||||
ron::de::from_str(&string).unwrap()
|
|
||||||
|
#[derive(serde::Deserialize)]
|
||||||
|
struct SerializedTest<'a> {
|
||||||
|
features: Vec<String>,
|
||||||
|
expectations: Vec<Expectation>,
|
||||||
|
actions: Vec<wgc::device::trace::Action<'a>>,
|
||||||
|
}
|
||||||
|
let SerializedTest {
|
||||||
|
features,
|
||||||
|
expectations,
|
||||||
|
actions,
|
||||||
|
} = ron::de::from_str(&string).unwrap();
|
||||||
|
let features = features
|
||||||
|
.iter()
|
||||||
|
.map(|feature| {
|
||||||
|
wgt::Features::from_name(feature)
|
||||||
|
.unwrap_or_else(|| panic!("Invalid feature flag {}", feature))
|
||||||
|
})
|
||||||
|
.fold(wgt::Features::empty(), |a, b| a | b);
|
||||||
|
Test {
|
||||||
|
features,
|
||||||
|
expectations,
|
||||||
|
actions,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn run(
|
fn run(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user