|
| 1 | +use wgpu::*; |
| 2 | +use wgpu_test::{gpu_test, FailureCase, GpuTestConfiguration, TestParameters}; |
| 3 | + |
| 4 | +#[gpu_test] |
| 5 | +static STENCIL_ONLY_VIEW_CREATION: GpuTestConfiguration = GpuTestConfiguration::new() |
| 6 | + .parameters( |
| 7 | + TestParameters::default() |
| 8 | + .skip(FailureCase::webgl2()) // WebGL doesn't have stencil only views |
| 9 | + .limits(wgpu::Limits::downlevel_defaults()), |
| 10 | + ) |
| 11 | + .run_async(|ctx| async move { |
| 12 | + for format in [TextureFormat::Stencil8, TextureFormat::Depth24PlusStencil8] { |
| 13 | + let texture = ctx.device.create_texture(&TextureDescriptor { |
| 14 | + label: None, |
| 15 | + size: Extent3d { |
| 16 | + width: 256, |
| 17 | + height: 256, |
| 18 | + depth_or_array_layers: 1, |
| 19 | + }, |
| 20 | + mip_level_count: 1, |
| 21 | + sample_count: 1, |
| 22 | + dimension: TextureDimension::D2, |
| 23 | + format, |
| 24 | + usage: TextureUsages::COPY_DST |
| 25 | + | TextureUsages::COPY_SRC |
| 26 | + | TextureUsages::TEXTURE_BINDING, |
| 27 | + view_formats: &[], |
| 28 | + }); |
| 29 | + let _view = texture.create_view(&TextureViewDescriptor { |
| 30 | + aspect: TextureAspect::StencilOnly, |
| 31 | + ..Default::default() |
| 32 | + }); |
| 33 | + } |
| 34 | + }); |
| 35 | + |
| 36 | +#[gpu_test] |
| 37 | +static DEPTH_ONLY_VIEW_CREATION: GpuTestConfiguration = |
| 38 | + GpuTestConfiguration::new().run_async(|ctx| async move { |
| 39 | + for format in [ |
| 40 | + TextureFormat::Depth16Unorm, |
| 41 | + TextureFormat::Depth24Plus, |
| 42 | + TextureFormat::Depth24PlusStencil8, |
| 43 | + ] { |
| 44 | + let texture = ctx.device.create_texture(&TextureDescriptor { |
| 45 | + label: None, |
| 46 | + size: Extent3d { |
| 47 | + width: 256, |
| 48 | + height: 256, |
| 49 | + depth_or_array_layers: 1, |
| 50 | + }, |
| 51 | + mip_level_count: 1, |
| 52 | + sample_count: 1, |
| 53 | + dimension: TextureDimension::D2, |
| 54 | + format, |
| 55 | + usage: TextureUsages::COPY_DST |
| 56 | + | TextureUsages::COPY_SRC |
| 57 | + | TextureUsages::TEXTURE_BINDING, |
| 58 | + view_formats: &[], |
| 59 | + }); |
| 60 | + let _view = texture.create_view(&TextureViewDescriptor { |
| 61 | + aspect: TextureAspect::DepthOnly, |
| 62 | + ..Default::default() |
| 63 | + }); |
| 64 | + } |
| 65 | + }); |
0 commit comments