From 0e1d6be65a441c76bb186f2f72b279c1535e3ab4 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Tue, 3 Nov 2026 01:57:47 -0800 Subject: [PATCH] Expect a volume's compute filter in the filter test where the driver's blits do not filter it formats_the_blits_cannot_filter_take_the_compute_filter_level_by_level requires every format to take one route across its seven shapes. Since the VolumeBlitsUnfiltered defect (7e77515bee), a format whose blits filter takes its blit chain in every shape but the 3D one on MoltenVK, where `generate_mipmaps` takes the compute filter. Stack7's lane on the M3 failed there, for A8Unorm: [Blits(2), Blits(4), Blits(3), Blits(2), Blits(2), Blits(2), Filter]. What changed: - The test reads the device's driver defects. Where VolumeBlitsUnfiltered is listed, it expects the 3D shape to take the compute filter. - Everywhere else it still expects one route for every shape, and a blit-chain format's other shapes still take its chain. - A volume taking the filter is held to the filter's bound, level by level, as every filtered shape is. - The doc says so. Verified: the whole mipmap_chains file on the Apple M3 Max through MoltenVK 1.4.2 (--cfg m2v_gpu); see the message that carries this sha. (cherry picked from commit 200c18ea5c542235ea1340ed205e46b104442b19) (cherry picked from commit 26222950fb49e4190253bb4663802515bc22402b) --- .../src/runtime_lane/mipmap_chains.rs | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/crates/metal2vulkan-validation/src/runtime_lane/mipmap_chains.rs b/crates/metal2vulkan-validation/src/runtime_lane/mipmap_chains.rs index 4ec6eb899..059a8eb35 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/mipmap_chains.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/mipmap_chains.rs @@ -297,11 +297,12 @@ fn the_device_s_blit_chain_filters_each_level_and_is_announced() { /// Every format the compute filter computes, from random bytes (every bit pattern: NaNs, /// infinities, subnormals, out-of-range codes), in 2D textures (one texel high, a square of a /// power of two, one past 65 texels, halving and not), a 2D array, a cube and a 3D -/// texture: a format the device's blits filter takes its blit chain, and every other takes the -/// compute filter, each level the device wrote within `MipmapFilterChain::outside_bound` of the -/// filter on the CPU of the level above as the device read it back. The extended-range formats, -/// which no blit filters, take the filter on every device. `device-filtered-mipmaps` is -/// announced once. +/// texture: a format the device's blits filter takes its blit chain in every shape (but the 3D one +/// on a driver whose blits do not filter a volume, `RuntimeDriverDefect::VolumeBlitsUnfiltered`, +/// which takes the compute filter), and every other takes the compute filter in every shape, each +/// level the device wrote within `MipmapFilterChain::outside_bound` of the filter on the CPU of +/// the level above as the device read it back. The extended-range formats, which no blit filters, +/// take the filter on every device. `device-filtered-mipmaps` is announced once. #[test] fn formats_the_blits_cannot_filter_take_the_compute_filter_level_by_level() { let cache = ScratchCache::new().unwrap(); @@ -319,6 +320,9 @@ fn formats_the_blits_cannot_filter_take_the_compute_filter_level_by_level() { (TextureType::Cube, [4, 4, 1], 6, 3), (TextureType::Type3D, [5, 4, 3], 1, 3), ]; + // A driver whose blits do not filter a volume: its 3D textures take the compute filter. + let volume_blits = (device.properties().driver_defects) + .contains(&RuntimeDriverDefect::VolumeBlitsUnfiltered); let mut seed = 0x51f1_5eed_cafe_f00du64; let (mut checked, mut off_model) = (0usize, 0usize); let (mut by_filter, mut by_blits) = (Vec::new(), Vec::new()); @@ -369,9 +373,15 @@ fn formats_the_blits_cannot_filter_take_the_compute_filter_level_by_level() { } } let filter = made[0] == Made::Filter; + let filtered_shape = + |ty: TextureType| filter || (ty == TextureType::Type3D && volume_blits); assert!( - made.iter().all(|&m| (m == Made::Filter) == filter), - "{pf:?}: one way for every shape: {made:?}" + shapes + .iter() + .zip(&made) + .all(|(shape, &m)| (m == Made::Filter) == filtered_shape(shape.0)), + "{pf:?}: one way for every shape (the compute filter for a volume where the \ + driver's blits do not filter one, {volume_blits}): {made:?}" ); if filter { by_filter.push(pf);