diff --git a/crates/metal2vulkan-conformance/src/cases/extended_range_targets.rs b/crates/metal2vulkan-conformance/src/cases/extended_range_targets.rs index 772b9f738..23beffff6 100644 --- a/crates/metal2vulkan-conformance/src/cases/extended_range_targets.rs +++ b/crates/metal2vulkan-conformance/src/cases/extended_range_targets.rs @@ -1069,6 +1069,13 @@ impl Case for ClearRoutes { named.extend(super::compressed_blits::kept_encoding_notice( self.format.format.as_raw(), )); + // On a venue that presents no texture compression the blit that reads `plain-16` back, + // through the texture the recording's Mac compressed, keeps the device's encoding where + // the recording holds the compressor's canonical one, and the runtime rewrites none + // under the suite's exact policy (`compressed_blits`'s declaration says why). Measured on + // the RTX 5080 Laptop: `case/plain-16/texels/*` alone differ against the recording with + // the key and matched before it. + named.push(crate::replay::without_compression("plain-16")); named } diff --git a/crates/metal2vulkan-runtime/src/nan_clear.rs b/crates/metal2vulkan-runtime/src/nan_clear.rs index 05ab9c30d..97eb9513e 100644 --- a/crates/metal2vulkan-runtime/src/nan_clear.rs +++ b/crates/metal2vulkan-runtime/src/nan_clear.rs @@ -110,9 +110,10 @@ pub(super) fn degrade_nan_clears(device: &Device, layout: &PassLayout, drew: boo } /// Whether Metal's NaN clear of `target`, in a pass with a draw call where `called`, keeps a -/// `half` NaN's sign (the module docs): on a device that presents an Apple silicon Mac's -/// compression (`Device::metal_compresses_textures`; on one that presents a Mac keeping none, as -/// a Mac with an Intel or AMD GPU does, never: expected rather than measured), its texture (a view's first +/// `half` NaN's sign (the module docs), which is also whether its clear takes the straight route +/// (`render.rs`): on a device that presents an Apple silicon Mac's compression +/// (`Device::metal_compresses_textures`; on one that presents a Mac keeping none, as a Mac with +/// an Intel or AMD GPU does, never: expected rather than measured), its texture (a view's first /// texture) is one Metal keeps losslessly compressed (`heap_tiled::metal_compresses`: not over a /// buffer, of no usage Metal keeps uncompressed, optimized contents allowed), the attachment's /// level is 16 texels or more a side, counted in pixels at any sample count, and the pass has no diff --git a/crates/metal2vulkan-validation/src/runtime_lane/bfloat_targets.rs b/crates/metal2vulkan-validation/src/runtime_lane/bfloat_targets.rs index 3de7d0d31..78dbf4a12 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/bfloat_targets.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/bfloat_targets.rs @@ -359,11 +359,19 @@ const M3_CODES: [[u16; 4]; 2] = [ /// (`ClearRoute::Straight`) for a 16 x 16 private target of plain usage in a pass with no draw /// call, and through `half` (`ClearRoute::ThroughHalf`) for an 8 x 8 one, one of `ShaderWrite` or /// `PixelFormatView` usage, and one whose pass draws into another attachment. Every texel of the -/// target is checked. +/// target is checked. On a device that presents a Mac keeping no texture compressed +/// (`DeviceProperties::lossless_compression` false) the 16 x 16 one is not compressed either, so +/// it takes the route of the uncompressed ones, through `half` (`nan_clear::keeps_nan_sign`; +/// expected, not measured on such a Mac). #[test] fn bfloat_clears_take_metal_s_route() { let (messages, _cache, lane) = lane_with(|_| {}); let plain = TextureUsage::RENDER_TARGET | TextureUsage::SHADER_READ; + // The route of the shape Metal keeps compressed, where the device presents the compression. + let compressed = match lane.device.properties().lossless_compression { + true => ClearRoute::Straight, + false => ClearRoute::ThroughHalf, + }; let library = library(&lane.device).unwrap(); let function = |name: &str| { StageSource::Function( @@ -385,7 +393,7 @@ fn bfloat_clears_take_metal_s_route() { .new_render_pipeline_state(&state, &PipelineOptions::default()) .unwrap_or_else(|e| panic!("{pf:?}: the pipeline: {e}")); for (side, usage, draws, route) in [ - (16, plain, false, ClearRoute::Straight), + (16, plain, false, compressed), (8, plain, false, ClearRoute::ThroughHalf), ( 16, diff --git a/crates/metal2vulkan-validation/src/runtime_lane/extended_range_targets.rs b/crates/metal2vulkan-validation/src/runtime_lane/extended_range_targets.rs index a4bc3e488..a7bba9aff 100644 --- a/crates/metal2vulkan-validation/src/runtime_lane/extended_range_targets.rs +++ b/crates/metal2vulkan-validation/src/runtime_lane/extended_range_targets.rs @@ -852,11 +852,19 @@ const ROUTE_COLORS: [[f64; 4]; 4] = [ ]; /// A `Clear` of each single-plane extended-range format stores Metal's route's texel in every -/// texel of the target (the module docs). +/// texel of the target (the module docs). On a device that presents a Mac keeping no texture +/// compressed (`DeviceProperties::lossless_compression` false) the 16 x 16 plain target is not +/// compressed either, so it takes the route of the uncompressed ones, through `half` +/// (`nan_clear::keeps_nan_sign`; expected, not measured on such a Mac). #[test] fn clears_take_metal_s_route() { let (messages, _cache, lane) = lane(); let plain = TextureUsage::RENDER_TARGET | TextureUsage::SHADER_READ; + // The route of the shape Metal keeps compressed, where the device presents the compression. + let compressed = match lane.device.properties().lossless_compression { + true => ClearRoute::Straight, + false => ClearRoute::ThroughHalf, + }; let library = library(&lane.device).unwrap(); let function = |name: &str| { StageSource::Function( @@ -878,7 +886,7 @@ fn clears_take_metal_s_route() { .unwrap_or_else(|e| panic!("{:?}: the pipeline: {e}", f.pf)); let size = texel_size(f.form); for (side, usage, draws, route) in [ - (16, plain, false, ClearRoute::Straight), + (16, plain, false, compressed), (8, plain, false, ClearRoute::ThroughHalf), ( 16, diff --git a/docs/API.md b/docs/API.md index 81921d72d..d1a90966f 100644 --- a/docs/API.md +++ b/docs/API.md @@ -4056,8 +4056,9 @@ each item named states the rule in full. both; a `Depth32Float` one never read the released clear. - a GPU blit or fill through any texture keeps its bytes, with no `extended-range-bits-kept`, `device-nan-encoding` or `shared-exponent-kept` note for it and no rewrite under - `ExtendedRangeBlitPolicy::Canonical`, and a `half` NaN clear keeps no sign. Expected, not - measured on such a Mac. + `ExtendedRangeBlitPolicy::Canonical`, and a clear of any texture takes the route of Metal's + uncompressed one, through `half`, so a `half` NaN clear keeps no sign and an extended-range + or bfloat clear rounds as through `half`. Expected, not measured on such a Mac. Metal leaves a new texture's contents undefined, and zero and a released texture's texels are both what such a Mac reads, so this trades no accuracy and no `DevicePolicy` switch fills the