|
1 | 1 | use wgpu_test::{fail, gpu_test, valid, GpuTestConfiguration, GpuTestInitializer, TestParameters}; |
2 | 2 |
|
3 | 3 | pub fn all_tests(vec: &mut Vec<GpuTestInitializer>) { |
4 | | - vec.extend([BAD_BUFFER, BAD_TEXTURE]); |
| 4 | + vec.extend([BAD_BUFFER_MAP, BAD_TEXTURE_CREATE_VIEW, BAD_TEXTURE_WRITE]); |
5 | 5 | } |
6 | 6 |
|
7 | 7 | #[gpu_test] |
8 | | -static BAD_BUFFER: GpuTestConfiguration = GpuTestConfiguration::new() |
| 8 | +static BAD_BUFFER_MAP: GpuTestConfiguration = GpuTestConfiguration::new() |
9 | 9 | .parameters(TestParameters::default().enable_noop()) |
10 | 10 | .run_sync(|ctx| { |
11 | 11 | // Create a buffer with bad parameters and call a few methods. |
@@ -38,7 +38,7 @@ static BAD_BUFFER: GpuTestConfiguration = GpuTestConfiguration::new() |
38 | 38 | }); |
39 | 39 |
|
40 | 40 | #[gpu_test] |
41 | | -static BAD_TEXTURE: GpuTestConfiguration = GpuTestConfiguration::new() |
| 41 | +static BAD_TEXTURE_CREATE_VIEW: GpuTestConfiguration = GpuTestConfiguration::new() |
42 | 42 | .parameters(TestParameters::default().enable_noop()) |
43 | 43 | .run_sync(|ctx| { |
44 | 44 | let texture = fail( |
@@ -72,3 +72,51 @@ static BAD_TEXTURE: GpuTestConfiguration = GpuTestConfiguration::new() |
72 | 72 | valid(&ctx.device, || texture.destroy()); |
73 | 73 | valid(&ctx.device, || texture.destroy()); |
74 | 74 | }); |
| 75 | + |
| 76 | +#[gpu_test] |
| 77 | +static BAD_TEXTURE_WRITE: GpuTestConfiguration = GpuTestConfiguration::new() |
| 78 | + .parameters(TestParameters::default().enable_noop()) |
| 79 | + .run_sync(|ctx| { |
| 80 | + let texture = fail( |
| 81 | + &ctx.device, |
| 82 | + || { |
| 83 | + ctx.device.create_texture(&wgpu::TextureDescriptor { |
| 84 | + label: None, |
| 85 | + size: wgpu::Extent3d { |
| 86 | + width: 256, |
| 87 | + height: 256, |
| 88 | + depth_or_array_layers: 1, |
| 89 | + }, |
| 90 | + mip_level_count: 5888, |
| 91 | + sample_count: 1, |
| 92 | + dimension: wgpu::TextureDimension::D2, |
| 93 | + format: wgpu::TextureFormat::Rgba8Unorm, |
| 94 | + usage: wgpu::TextureUsages::COPY_DST, |
| 95 | + view_formats: &[], |
| 96 | + }) |
| 97 | + }, |
| 98 | + Some("mip level count"), |
| 99 | + ); |
| 100 | + |
| 101 | + fail( |
| 102 | + &ctx.device, |
| 103 | + || { |
| 104 | + ctx.queue.write_texture( |
| 105 | + wgpu::TexelCopyTextureInfo { |
| 106 | + texture: &texture, |
| 107 | + mip_level: 255, |
| 108 | + origin: wgpu::Origin3d::ZERO, |
| 109 | + aspect: wgpu::TextureAspect::All, |
| 110 | + }, |
| 111 | + &[0u8; 4], |
| 112 | + wgpu::TexelCopyBufferLayout::default(), |
| 113 | + wgpu::Extent3d { |
| 114 | + width: 1, |
| 115 | + height: 1, |
| 116 | + depth_or_array_layers: 1, |
| 117 | + }, |
| 118 | + ); |
| 119 | + }, |
| 120 | + Some("Texture with '' label is invalid"), |
| 121 | + ); |
| 122 | + }); |
0 commit comments