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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
( (
features: (bits: 0x0000_0008_0000_0000), features: 0x0000_0020_0000_0000,
expectations: [ expectations: [
( (
name: "Quad", name: "Quad",
@ -25,15 +25,12 @@
size: ( size: (
width: 64, width: 64,
height: 64, height: 64,
depth_or_array_layers: 1,
), ),
mip_level_count: 1, mip_level_count: 1,
sample_count: 1, sample_count: 1,
dimension: D2, dimension: r#2d,
format: Rgba8Unorm, format: rgba8unorm,
usage: ( usage: 27,
bits: 27,
),
)), )),
// First fill the texture to ensure it wasn't just zero initialized or "happened" to be zero. // First fill the texture to ensure it wasn't just zero initialized or "happened" to be zero.
WriteTexture( WriteTexture(
@ -51,7 +48,6 @@
size: ( size: (
width: 64, width: 64,
height: 64, height: 64,
depth_or_array_layers: 1,
), ),
), ),
CreateBuffer( CreateBuffer(
@ -59,9 +55,7 @@
( (
label: Some("Output Buffer"), label: Some("Output Buffer"),
size: 16384, size: 16384,
usage: ( usage: 9,
bits: 9,
),
mapped_at_creation: false, mapped_at_creation: false,
), ),
), ),
@ -71,9 +65,7 @@
( (
label: Some("Buffer to be cleared"), label: Some("Buffer to be cleared"),
size: 16, size: 16,
usage: ( usage: 41,
bits: 41,
),
mapped_at_creation: false, mapped_at_creation: false,
), ),
), ),
@ -91,7 +83,7 @@
ClearTexture( ClearTexture(
dst: Id(0, 1, Empty), dst: Id(0, 1, Empty),
subresource_range: ImageSubresourceRange( subresource_range: ImageSubresourceRange(
aspect: All, aspect: all,
base_mip_level: 0, base_mip_level: 0,
mip_level_count: None, mip_level_count: None,
base_array_layer: 0, base_array_layer: 0,
@ -115,7 +107,6 @@
size: ( size: (
width: 64, width: 64,
height: 64, height: 64,
depth_or_array_layers: 1,
), ),
), ),
// Partial clear to prove // 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: [ expectations: [
( (
name: "Queried number of compute invocations is correct", name: "Queried number of compute invocations is correct",
@ -38,7 +38,7 @@
desc: ( desc: (
label: Some("Compute Invocation QuerySet"), label: Some("Compute Invocation QuerySet"),
count: 2, count: 2,
ty: PipelineStatistics((bits: 0x18)), // FRAGMENT_SHADER_INVOCATIONS | COMPUTE_SHADER_INVOCATIONS ty: PipelineStatistics(0x18), // FRAGMENT_SHADER_INVOCATIONS | COMPUTE_SHADER_INVOCATIONS
), ),
), ),
CreateBuffer( CreateBuffer(
@ -46,9 +46,7 @@
( (
label: Some("Compute Invocation Result Buffer"), label: Some("Compute Invocation Result Buffer"),
size: 16, size: 16,
usage: ( usage: 9, // COPY_DST | MAP_READ
bits: 9, // COPY_DST | MAP_READ
),
mapped_at_creation: false, mapped_at_creation: false,
), ),
), ),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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