Another project
1mod common;
2
3use common::{extent_square, make_context};
4
5const RENDER_COLOR_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Rgba8Unorm;
6const RENDER_DEPTH_FORMAT: wgpu::TextureFormat = wgpu::TextureFormat::Depth32Float;
7
8#[test]
9fn msaa_x4_probe_matches_independent_color_and_depth_query() {
10 let ctx = make_context(extent_square(16));
11 let probed = ctx.gpu().capabilities().supports_msaa_x4();
12
13 let instance =
14 wgpu::Instance::new(wgpu::InstanceDescriptor::new_without_display_handle_from_env());
15 let Ok(adapter) = pollster::block_on(instance.request_adapter(&wgpu::RequestAdapterOptions {
16 power_preference: wgpu::PowerPreference::LowPower,
17 force_fallback_adapter: false,
18 compatible_surface: None,
19 })) else {
20 panic!("cross-check adapter request must match the offscreen adapter");
21 };
22 let color = adapter
23 .get_texture_format_features(RENDER_COLOR_FORMAT)
24 .flags;
25 let depth = adapter
26 .get_texture_format_features(RENDER_DEPTH_FORMAT)
27 .flags;
28 let expected = color.supported_sample_counts().contains(&4)
29 && depth.supported_sample_counts().contains(&4);
30
31 assert_eq!(
32 probed, expected,
33 "supports_msaa_x4 must AND msaa x4 across the color and depth render formats",
34 );
35}