Fix and re-enable player tests

This commit is contained in:
Dzmitry Malyshau 2021-12-03 10:58:53 -05:00
parent f03c45921e
commit cdf948b920
17 changed files with 74 additions and 122 deletions

View File

@ -156,7 +156,7 @@ jobs:
# check with all features
# explicitly don't mention wgpu-hal so that --all-features don't apply to it
cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu -p wgpu-core -p wgpu-info -p player --examples --tests --all-features
cargo ${{matrix.tool}} --target ${{ matrix.target }} -p wgpu -p wgpu-core -p wgpu-info -p player --examples --tests --all-features
# build docs
cargo doc --target ${{ matrix.target }} --no-deps
@ -167,7 +167,10 @@ jobs:
shell: bash
run: |
# run wgpu-info
cargo run --target ${{ matrix.target }} --bin wgpu-info
cargo run --bin wgpu-info
# run player tests
cargo test -p player
for backend in ${{ matrix.backends }}; do
echo "======= NATIVE TESTS $backend ======";
# run player tests

View File

@ -431,7 +431,7 @@ pub fn op_webgpu_command_encoder_copy_texture_to_texture(
#[derive(Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CommandEncoderFillBufferArgs {
pub struct CommandEncoderClearBufferArgs {
command_encoder_rid: u32,
destination_rid: u32,
destination_offset: u64,
@ -440,7 +440,7 @@ pub struct CommandEncoderFillBufferArgs {
pub fn op_webgpu_command_encoder_clear_buffer(
state: &mut OpState,
args: CommandEncoderFillBufferArgs,
args: CommandEncoderClearBufferArgs,
_: (),
) -> Result<WebGpuResult, AnyError> {
let instance = state.borrow::<super::Instance>();

View File

@ -1,5 +1,5 @@
(
backends: (bits: 0xF),
backends: 0x3E,
tests: [
"bind-group.ron",
"buffer-copy.ron",

View File

@ -1,5 +1,5 @@
(
features: (bits: 0x0),
features: 0x0,
expectations: [], //not crash!
actions: [
CreatePipelineLayout(Id(0, 1, Empty), (
@ -29,9 +29,7 @@
CreateBuffer(Id(0, 1, Empty), (
label: None,
size: 16,
usage: (
bits: 64,
),
usage: 64,
mapped_at_creation: false,
)),
CreateBindGroupLayout(Id(0, 1, Empty), (
@ -39,7 +37,7 @@
entries: [
(
binding: 0,
visibility: (bits: 0x3),
visibility: 0x3,
ty: Buffer(
ty: Uniform,
),

View File

@ -1,5 +1,5 @@
(
features: (bits: 0x0),
features: 0x0,
expectations: [
(
name: "basic",
@ -14,9 +14,7 @@
(
label: Some("dummy"),
size: 16,
usage: (
bits: 41,
),
usage: 41,
mapped_at_creation: false,
),
),

View File

@ -1,5 +1,5 @@
(
features: (bits: 0x0000_0008_0000_0000),
features: 0x0000_0020_0000_0000,
expectations: [
(
name: "Quad",
@ -25,15 +25,12 @@
size: (
width: 64,
height: 64,
depth_or_array_layers: 1,
),
mip_level_count: 1,
sample_count: 1,
dimension: D2,
format: Rgba8Unorm,
usage: (
bits: 27,
),
dimension: r#2d,
format: rgba8unorm,
usage: 27,
)),
// First fill the texture to ensure it wasn't just zero initialized or "happened" to be zero.
WriteTexture(
@ -51,7 +48,6 @@
size: (
width: 64,
height: 64,
depth_or_array_layers: 1,
),
),
CreateBuffer(
@ -59,9 +55,7 @@
(
label: Some("Output Buffer"),
size: 16384,
usage: (
bits: 9,
),
usage: 9,
mapped_at_creation: false,
),
),
@ -71,9 +65,7 @@
(
label: Some("Buffer to be cleared"),
size: 16,
usage: (
bits: 41,
),
usage: 41,
mapped_at_creation: false,
),
),
@ -91,7 +83,7 @@
ClearTexture(
dst: Id(0, 1, Empty),
subresource_range: ImageSubresourceRange(
aspect: All,
aspect: all,
base_mip_level: 0,
mip_level_count: None,
base_array_layer: 0,
@ -115,7 +107,6 @@
size: (
width: 64,
height: 64,
depth_or_array_layers: 1,
),
),
// Partial clear to prove

View File

@ -1,5 +1,5 @@
(
features: (bits: 0x0000_0000_0000_0008), // PIPELINE_STATISTICS_QUERY
features: 0x0000_0000_0000_0010, // PIPELINE_STATISTICS_QUERY
expectations: [
(
name: "Queried number of compute invocations is correct",
@ -38,7 +38,7 @@
desc: (
label: Some("Compute Invocation QuerySet"),
count: 2,
ty: PipelineStatistics((bits: 0x18)), // FRAGMENT_SHADER_INVOCATIONS | COMPUTE_SHADER_INVOCATIONS
ty: PipelineStatistics(0x18), // FRAGMENT_SHADER_INVOCATIONS | COMPUTE_SHADER_INVOCATIONS
),
),
CreateBuffer(
@ -46,9 +46,7 @@
(
label: Some("Compute Invocation Result Buffer"),
size: 16,
usage: (
bits: 9, // COPY_DST | MAP_READ
),
usage: 9, // COPY_DST | MAP_READ
mapped_at_creation: false,
),
),

View File

@ -1,5 +1,5 @@
(
features: (bits: 0x0),
features: 0x0,
expectations: [
(
name: "Quad",
@ -22,15 +22,12 @@
size: (
width: 64,
height: 64,
depth_or_array_layers: 1,
),
mip_level_count: 1,
sample_count: 1,
dimension: D2,
format: Rgba8Unorm,
usage: (
bits: 27,
),
dimension: r#2d,
format: rgba8unorm,
usage: 27,
)),
CreateTextureView(
id: Id(0, 1, Empty),
@ -42,9 +39,7 @@
(
label: Some("Output Buffer"),
size: 16384,
usage: (
bits: 9,
),
usage: 9,
mapped_at_creation: false,
),
),
@ -72,7 +67,7 @@
),
targets: [
(
format: Rgba8Unorm,
format: rgba8unorm,
),
],
)),
@ -99,8 +94,8 @@
view: Id(0, 1, Empty),
resolve_target: None,
channel: (
load_op: Clear,
store_op: Store,
load_op: clear,
store_op: store,
clear_value: (
r: 0,
g: 0,
@ -130,7 +125,6 @@
size: (
width: 64,
height: 64,
depth_or_array_layers: 1,
),
),
]),

View File

@ -1,5 +1,5 @@
(
features: (bits: 0x0),
features: 0x0,
expectations: [
// Ensuring that mapping zero-inits buffers.
(
@ -43,9 +43,7 @@
(
label: Some("mapped_at_creation: false, with MAP_WRITE"),
size: 16,
usage: (
bits: 131, // STORAGE + MAP_READ + MAP_WRITE
),
usage: 131, // STORAGE + MAP_READ + MAP_WRITE
mapped_at_creation: false,
),
),
@ -54,9 +52,7 @@
(
label: Some("mapped_at_creation: false, without MAP_WRITE"),
size: 16,
usage: (
bits: 129, // STORAGE + MAP_READ
),
usage: 129, // STORAGE + MAP_READ
mapped_at_creation: false,
),
),
@ -65,9 +61,7 @@
(
label: Some("partially written"),
size: 24,
usage: (
bits: 9, // MAP_READ + COPY_DST
),
usage: 9, // MAP_READ + COPY_DST
mapped_at_creation: false,
),
),
@ -91,9 +85,7 @@
CreateBuffer(Id(3, 1, Empty), (
label: Some("used in binding"),
size: 16,
usage: (
bits: 129, // STORAGE + MAP_READ
),
usage: 129, // STORAGE + MAP_READ
mapped_at_creation: false,
)),
CreateBindGroupLayout(Id(0, 1, Empty), (
@ -101,9 +93,7 @@
entries: [
(
binding: 0,
visibility: (
bits: 4,
),
visibility: 4,
ty: Buffer(
ty: Storage(
read_only: false,

View File

@ -1,5 +1,5 @@
(
features: (bits: 0x0),
features: 0x0,
expectations: [
(
name: "Sampled Texture",
@ -22,15 +22,12 @@
size: (
width: 64,
height: 64,
depth_or_array_layers: 1,
),
mip_level_count: 1,
sample_count: 1,
dimension: D2,
format: Rgba8Unorm,
usage: (
bits: 5, // SAMPLED + COPY_SRC
),
dimension: r#2d,
format: rgba8unorm,
usage: 5, // SAMPLED + COPY_SRC
)),
CreateTextureView(
id: Id(0, 1, Empty),
@ -42,9 +39,7 @@
(
label: Some("Sampled Texture Buffer"),
size: 16384,
usage: (
bits: 9,
),
usage: 9,
mapped_at_creation: false,
),
),
@ -53,15 +48,12 @@
size: (
width: 64,
height: 64,
depth_or_array_layers: 1,
),
mip_level_count: 1,
sample_count: 1,
dimension: D2,
format: Rgba8Unorm,
usage: (
bits: 9, // STORAGE + COPY_SRC
),
dimension: r#2d,
format: rgba8unorm,
usage: 9, // STORAGE + COPY_SRC
)),
CreateTextureView(
id: Id(1, 1, Empty),
@ -73,9 +65,7 @@
(
label: Some("Storage Texture Buffer"),
size: 16384,
usage: (
bits: 9,
),
usage: 9,
mapped_at_creation: false,
),
),
@ -86,25 +76,21 @@
entries: [
(
binding: 0,
visibility: (
bits: 4, // COMPUTE
),
visibility: 4, // COMPUTE
ty: Texture (
sample_type: Float(filterable: true),
view_dimension: D2,
view_dimension: r#2d,
multisampled: false,
),
count: None,
),
(
binding: 1,
visibility: (
bits: 4, // COMPUTE
),
visibility: 4, // COMPUTE
ty: StorageTexture (
access: WriteOnly,
format: Rgba8Unorm,
view_dimension: D2,
access: r#write-only,
format: rgba8unorm,
view_dimension: r#2d,
),
count: None,
),
@ -185,7 +171,6 @@
size: (
width: 64,
height: 64,
depth_or_array_layers: 1,
),
),
CopyTextureToBuffer(
@ -205,7 +190,6 @@
size: (
width: 64,
height: 64,
depth_or_array_layers: 1,
),
),
]),

View File

@ -1,5 +1,5 @@
[[group(0), binding(0)]] var tex: texture_2d<f32>;
[[group(0), binding(1)]] var tex_storage: texture_storage_2d<rgba8uint>;
[[group(0), binding(1)]] var tex_storage: texture_storage_2d<rgba8uint, write>;
[[stage(compute), workgroup_size(1)]]
fn main([[builtin(global_invocation_id)]] global_id: vec3<u32>) {

View File

@ -1,5 +1,5 @@
(
features: (bits: 0x0),
features: 0x0,
expectations: [
(
name: "Copy to Buffer",
@ -15,24 +15,19 @@
size: (
width: 64,
height: 64,
depth_or_array_layers: 1,
),
mip_level_count: 1,
sample_count: 1,
dimension: D2,
format: Rgba8Unorm,
usage: (
bits: 1, // COPY_SRC
),
dimension: r#2d,
format: rgba8unorm,
usage: 1, // COPY_SRC
)),
CreateBuffer(
Id(0, 1, Empty),
(
label: Some("Copy to Buffer Buffer"),
size: 16384,
usage: (
bits: 9,
),
usage: 9,
mapped_at_creation: false,
),
),
@ -54,7 +49,6 @@
size: (
width: 64,
height: 64,
depth_or_array_layers: 1,
),
),
]),

View File

@ -1,5 +1,5 @@
(
features: (bits: 0x0),
features: 0x0,
expectations: [
(
name: "Render Target",
@ -15,15 +15,12 @@
size: (
width: 64,
height: 64,
depth_or_array_layers: 1,
),
mip_level_count: 1,
sample_count: 1,
dimension: D2,
format: Rgba8Unorm,
usage: (
bits: 17, // RENDER_ATTACHMENT + COPY_SRC
),
dimension: r#2d,
format: rgba8unorm,
usage: 17, // RENDER_ATTACHMENT + COPY_SRC
)),
CreateTextureView(
id: Id(0, 1, Empty),
@ -35,9 +32,7 @@
(
label: Some("Render Target Buffer"),
size: 16384,
usage: (
bits: 9,
),
usage: 9,
mapped_at_creation: false,
),
),
@ -55,8 +50,8 @@
view: Id(0, 1, Empty),
resolve_target: None,
channel: (
load_op: Load,
store_op: Store,
load_op: load,
store_op: store,
clear_value: (
r: 1, g: 1, b: 1, a: 1,
),
@ -83,7 +78,6 @@
size: (
width: 64,
height: 64,
depth_or_array_layers: 1,
),
),
]),

View File

@ -89,7 +89,7 @@ impl Test<'_> {
adapter,
&wgt::DeviceDescriptor {
label: None,
features: self.features | wgt::Features::MAPPABLE_PRIMARY_BUFFERS,
features: self.features,
limits: wgt::Limits::default(),
},
None,

View File

@ -48,6 +48,7 @@ use super::{memory_init::TextureSurfaceDiscard, CommandBufferTextureMemoryAction
#[derive(Copy, Clone, Debug, Hash, Eq, PartialEq)]
#[cfg_attr(any(feature = "serial-pass", feature = "trace"), derive(Serialize))]
#[cfg_attr(any(feature = "serial-pass", feature = "replay"), derive(Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "kebab-case"))]
pub enum LoadOp {
/// Clear the output attachment with the clear color. Clearing is faster than loading.
Clear = 0,

View File

@ -29,6 +29,7 @@ pub enum ShaderModuleSource<'a> {
#[cfg_attr(feature = "replay", derive(serde::Deserialize))]
pub struct ShaderModuleDescriptor<'a> {
pub label: Label<'a>,
#[cfg_attr(feature = "serde", serde(default))]
pub shader_bound_checks: wgt::ShaderBoundChecks,
}

View File

@ -2755,9 +2755,15 @@ pub struct Extent3d {
///
pub height: u32,
///
#[cfg_attr(feature = "serde", serde(default = "default_depth"))]
pub depth_or_array_layers: u32,
}
#[cfg(feature = "serde")]
fn default_depth() -> u32 {
1
}
impl Default for Extent3d {
fn default() -> Self {
Self {