diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md index a8360a32b..1bbb44472 100644 --- a/crates/metal2vulkan-runtime/README.md +++ b/crates/metal2vulkan-runtime/README.md @@ -2855,9 +2855,11 @@ or does not check is rebuilt from the generations' names, with young counted ful 26 streams' libraries calls a SIMD-group, quad or SIMD-group matrix function (each library whose bytes name one disassembled with `llvm-dis`, jobs m3-max-52530, 52531, 52532, 52557 and 52604). Their libraries that call quad functions, 2 to 5 a stream, call them from no fragment function. -- A fragment function's raster order groups are refused at creation on every device, an - `Error::Translation` naming `RasterOrderGroups` and `fragmentShaderPixelInterlock`: device - creation does not enable `VK_EXT_fragment_shader_interlock`. +- On a device without `fragmentShaderPixelInterlock` (Pixel interlock, under Floor), a fragment + function's raster order group on memory it reads and writes is refused at creation, an + `Error::Translation` naming `RasterOrderGroups` and `fragmentShaderPixelInterlock`. Of the venues + run, KosmicKrisp on the M3 Max and RADV on the RX 550 list neither the extension nor the feature + (vulkaninfo, jobs m3-max-61291 and m3-max-61296). - Metal's triangle fill mode and depth clip mode, which Vulkan 1.3 bakes into a `VkPipeline`, are their defaults. - On a driver that keeps the topology class in a pipeline (dynamicPrimitiveTopologyUnrestricted @@ -3165,16 +3167,18 @@ or does not check is rebuilt from the generations' names, with young counted ful through the image's shadow, the counted copy a device without the feedback loop takes, first, and then, where the device has the feedback loop, unified image layouts and a `LINEAR` image with the feedback usage, the loop on the attachment in the general layout. -- A fetch (`[[color(n)]]`) orders the fragments of earlier draws before it, not the fragments of - its own draw that cover the same pixel, which Metal orders in primitive order: a fragment may - read the texel from before an earlier fragment of its draw wrote it - (`PrecisionNote::UnorderedFetchWithinDraw`). Exact for a draw whose primitives do not overlap - at a pixel. A fetch of an attachment the draw cannot read through is `Gap::Draw` of - `FetchedAttachment`: a drawable's texture (its image has no feedback usage and no second - element; no boot or replay stream fetched one), a texture made with no index, one that is no 2D - texture at its first level and slice, a texture of an image another attachment of the pass - shares (two planes of one surface), and every attachment on a device without the attachment - reads. +- A fetch (`[[color(n)]]`) orders the fragments of earlier draws before it, not the fragments of its + own draw that cover the same pixel, which Metal orders in primitive order: a fragment may read the + texel from before an earlier fragment of its draw wrote it + (`PrecisionNote::UnorderedFetchWithinDraw`). Exact for a draw whose primitives do not overlap at a + pixel. A raster order group on the colour it reads, or on a colour output of an attachment it + reads, takes the same form on every device, the pixel interlock's included: the interlock cannot + order the attachment's own write, which happens after the function. A fetch of an attachment the + draw cannot read through is `Gap::Draw` of `FetchedAttachment`: a drawable's texture (its image + has no feedback usage and no second element; no boot or replay stream fetched one), a texture made + with no index, one that is no 2D texture at its first level and slice, a texture of an image + another attachment of the pass shares (two planes of one surface), and every attachment on a + device without the attachment reads. - A pass over a surface plane that renders as a linear colour attachment alone (Exported surfaces: an opaque handle's plane in place through `VK_FORMAT_FEATURE_2_LINEAR_COLOR_ATTACHMENT_BIT_NV`, every plane format measured on the RTX 3090 @@ -3429,6 +3433,7 @@ Presenting runs on the runtime's own device; nothing is exported or imported. | `VK_KHR_shader_maximal_reconvergence` | device, where listed | SIMD groups that reconverge as Metal's do | | `VK_KHR_shader_subgroup_uniform_control_flow` | device, where listed | SIMD groups' reconvergence where maximal reconvergence is not offered | | `VK_KHR_shader_quad_control` | device, where listed | a fragment function's group operations over other lanes, through the quad-control feature below | +| `VK_EXT_fragment_shader_interlock` | device, where listed | a fragment function's raster order groups on memory it reads and writes, through the pixel-interlock feature below | | `VK_KHR_portability_enumeration` | instance, where offered | listing portability devices, each checked against the floor as any other | | `VK_KHR_portability_subset` | device, where listed | Vulkan requires it enabled where a device lists it; the device is asked for the portability features below | | `VK_EXT_attachment_feedback_loop_layout` | device, with the feedback loop | a draw's read of an attachment of its own pass through a texture, in the feedback layout (below) | @@ -3541,6 +3546,23 @@ both, and the translator builds the function; elsewhere it refuses the function |---|---|---| | `shaderQuadControl` | `VkPhysicalDeviceShaderQuadControlFeaturesKHR` | a fragment function's quads run whole for its group operations over other lanes | +### Pixel interlock + +A fragment function's raster order group on memory the function reads and writes (a buffer, a +texture or an argument buffer's member) has one form: its body runs inside the ordered pixel +interlock (`PixelInterlockOrderedEXT`), after every earlier fragment of its pixel, as Metal orders +the group. Where the device lists `VK_EXT_fragment_shader_interlock` and reports the feature below, +device creation enables both, and the translator builds the function; elsewhere it refuses the +function at creation, an `Error::Translation` naming `RasterOrderGroups` (Known gaps of render +pipeline states). The interlock chooses no other form: a framebuffer fetch, a stencil output, an +imageblock and a blend the function computes take the forms, or the refusals, they take on a device +without it, and a group on a colour attachment alone takes the fetch's own ordering (Known gaps of +render encoders). No other feature of the extension is enabled. + +| Pixel-interlock feature | Structure | Used for | +|---|---|---| +| `fragmentShaderPixelInterlock` | `VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT` | a fragment function's raster order groups on memory it reads and writes | + ### Limits The descriptor limits are what the runtime's fixed arrays need: 65,536 sampled textures, 65,536 diff --git a/crates/metal2vulkan-runtime/src/device.rs b/crates/metal2vulkan-runtime/src/device.rs index 307671eeb..13e9039e6 100644 --- a/crates/metal2vulkan-runtime/src/device.rs +++ b/crates/metal2vulkan-runtime/src/device.rs @@ -501,6 +501,7 @@ impl Device { mut maximal_reconvergence, mut subgroup_uniform_control_flow, mut quad_control, + mut interlock, mut robustness2, mut portability, mut feedback_loop, @@ -544,6 +545,9 @@ impl Device { if enabled(ash::khr::shader_quad_control::NAME) { features = features.push_next(&mut quad_control); } + if enabled(ash::ext::fragment_shader_interlock::NAME) { + features = features.push_next(&mut interlock); + } if enabled(ash::khr::portability_subset::NAME) { features = features.push_next(&mut portability); } diff --git a/crates/metal2vulkan-runtime/src/extension.rs b/crates/metal2vulkan-runtime/src/extension.rs index 70c3b2e5a..5bd3160af 100644 --- a/crates/metal2vulkan-runtime/src/extension.rs +++ b/crates/metal2vulkan-runtime/src/extension.rs @@ -36,6 +36,7 @@ impl DeviceExtension { /// `VkPhysicalDeviceShaderMaximalReconvergenceFeaturesKHR`, /// `VkPhysicalDeviceShaderSubgroupUniformControlFlowFeaturesKHR`, /// `VkPhysicalDeviceShaderQuadControlFeaturesKHR`, + /// `VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT`, /// `VkPhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT`, /// `VkPhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT` or /// `VkPhysicalDeviceVertexAttributeDivisorFeaturesKHR`. diff --git a/crates/metal2vulkan-runtime/src/floor.rs b/crates/metal2vulkan-runtime/src/floor.rs index bd673e406..3e84a4f64 100644 --- a/crates/metal2vulkan-runtime/src/floor.rs +++ b/crates/metal2vulkan-runtime/src/floor.rs @@ -40,8 +40,9 @@ pub const TIME_DOMAINS: [vk::TimeDomainKHR; 2] = [vk::TimeDomainKHR::DEVICE, crate::times::HOST_DOMAIN]; /// The device extensions device creation enables where the device lists them: the SIMD groups' -/// reconvergence modes, each for the optional features of its own, quad control, for -/// `shaderQuadControl` where the device reports it, the portability subset, which +/// reconvergence modes, each for the optional features of its own, quad control and the fragment +/// shader interlock, for `shaderQuadControl` and `fragmentShaderPixelInterlock` where the device +/// reports them, the portability subset, which /// Vulkan requires enabled where a device lists it, with the portability features the floor asks /// of such a device, the vertex attribute divisor's two extensions, for the step-rate feature /// of their own: the KHR, and the EXT it was promoted from, whose feature and pipeline structures @@ -59,6 +60,7 @@ pub const OPTIONAL_EXTENSIONS: &[&CStr] = &[ ash::khr::shader_maximal_reconvergence::NAME, ash::khr::shader_subgroup_uniform_control_flow::NAME, ash::khr::shader_quad_control::NAME, + ash::ext::fragment_shader_interlock::NAME, ash::khr::portability_subset::NAME, ash::khr::vertex_attribute_divisor::NAME, ash::ext::vertex_attribute_divisor::NAME, @@ -109,6 +111,8 @@ fn shader_extension(name: &CStr) -> Option { Some(VkExtension::KhrShaderSubgroupUniformControlFlow) } else if name == ash::khr::shader_quad_control::NAME { Some(VkExtension::KhrShaderQuadControl) + } else if name == ash::ext::fragment_shader_interlock::NAME { + Some(VkExtension::ExtFragmentShaderInterlock) } else if name == ash::ext::robustness2::NAME { Some(VkExtension::ExtRobustness2) } else if name == ash::khr::portability_subset::NAME { @@ -228,6 +232,10 @@ pub struct Features { /// `VkPhysicalDeviceShaderQuadControlFeaturesKHR`, of `VK_KHR_shader_quad_control`: read and /// enabled only where the device lists it. pub quad_control: vk::PhysicalDeviceShaderQuadControlFeaturesKHR<'static>, + /// `VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT`, of + /// `VK_EXT_fragment_shader_interlock`: read only where the device lists it, and then only + /// `fragmentShaderPixelInterlock` enabled. + pub interlock: vk::PhysicalDeviceFragmentShaderInterlockFeaturesEXT<'static>, /// `VkPhysicalDeviceRobustness2FeaturesEXT`, of `VK_EXT_robustness2`: `nullDescriptor` and /// `robustImageAccess2` are enabled, never the robust buffer access beside them. pub robustness2: vk::PhysicalDeviceRobustness2FeaturesEXT<'static>, @@ -290,6 +298,9 @@ macro_rules! feature { (@structure quad_control) => { "VkPhysicalDeviceShaderQuadControlFeaturesKHR" }; + (@structure interlock) => { + "VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT" + }; (@structure robustness2) => { "VkPhysicalDeviceRobustness2FeaturesEXT" }; @@ -502,6 +513,17 @@ pub(crate) const STEP_RATES: &[Feature] = &[feature!( pub(crate) const QUAD_CONTROL: &[Feature] = &[feature!(quad_control.shader_quad_control => ShaderQuadControl)]; +/// The feature of `VK_EXT_fragment_shader_interlock` (one of [`OPTIONAL_EXTENSIONS`]), which +/// device creation enables where the device lists the extension and reports it: a fragment +/// function's raster order group on memory the function reads and writes runs inside the ordered +/// pixel interlock, the one form the translator builds; on a device without it the translator +/// refuses the group (`RasterOrderGroups`). Under the identity domains the interlock chooses no +/// other form: a framebuffer fetch, a stencil output and a blend the function computes take the +/// forms they take without it. No answer chooses a second form, and no other feature of the +/// extension is enabled. +pub(crate) const PIXEL_INTERLOCK: &[Feature] = + &[feature!(interlock.fragment_shader_pixel_interlock => FragmentShaderPixelInterlock)]; + /// The features of `VK_EXT_border_color_swizzle` ([`BORDER_SWIZZLE_EXTENSIONS`]): enabled together /// where the device lists the extensions and reports `borderColorSwizzleFromImage` (Vulkan requires /// `borderColorSwizzle` of a device that lists it), and neither otherwise. No answer chooses a second form, and the @@ -530,6 +552,7 @@ pub(crate) fn shader_enables(capabilities: &Capabilities) -> EnableSet { .chain(PORTABILITY) .chain(STEP_RATES) .chain(QUAD_CONTROL) + .chain(PIXEL_INTERLOCK) { if let Some(name) = feature.translator { if *(feature.field)(&mut features) == vk::TRUE { @@ -706,9 +729,9 @@ pub struct Capabilities { /// loop. pub feedback_loop: bool, /// The features device creation enables: every one the floor requires, each of the optional, - /// step-rate, quad-control and linear-attachment ones the device reports, the attachment-read - /// ones where [`feedback_loop`](Self::feedback_loop) holds, and the border-swizzle ones where - /// the device reports both. + /// step-rate, quad-control, pixel-interlock and linear-attachment ones the device reports, the + /// attachment-read ones where [`feedback_loop`](Self::feedback_loop) holds, and the + /// border-swizzle ones where the device reports both. pub features: Features, /// The device extensions device creation enables: [`DEVICE_EXTENSIONS`], then each of /// [`OPTIONAL_EXTENSIONS`] the device lists, then [`ATTACHMENT_READ_EXTENSIONS`] where @@ -812,6 +835,7 @@ unsafe fn query( let uniform_control_flow_listed = listed(ash::khr::shader_subgroup_uniform_control_flow::NAME); let quad_control_listed = listed(ash::khr::shader_quad_control::NAME); + let interlock_listed = listed(ash::ext::fragment_shader_interlock::NAME); let robustness2_listed = listed(ash::ext::robustness2::NAME); let portability_listed = listed(ash::khr::portability_subset::NAME); let feedback_loop_listed = listed(ash::ext::attachment_feedback_loop_layout::NAME); @@ -831,6 +855,7 @@ unsafe fn query( maximal_reconvergence, subgroup_uniform_control_flow, quad_control, + interlock, robustness2, portability, feedback_loop, @@ -853,6 +878,9 @@ unsafe fn query( if quad_control_listed { features = features.push_next(&mut *quad_control); } + if interlock_listed { + features = features.push_next(&mut *interlock); + } if robustness2_listed { features = features.push_next(&mut *robustness2); } @@ -885,6 +913,7 @@ unsafe fn query( maximal_reconvergence.p_next = std::ptr::null_mut(); subgroup_uniform_control_flow.p_next = std::ptr::null_mut(); quad_control.p_next = std::ptr::null_mut(); + interlock.p_next = std::ptr::null_mut(); robustness2.p_next = std::ptr::null_mut(); portability.p_next = std::ptr::null_mut(); feedback_loop.p_next = std::ptr::null_mut(); @@ -977,7 +1006,10 @@ pub(crate) fn decide(device: &Queried) -> Result { let Some((queue_family, _)) = family.filter(|_| missing.is_empty()) else { return Err(BelowFloor { missing }); }; - for feature in (OPTIONAL.iter().chain(STEP_RATES)).chain(QUAD_CONTROL) { + for feature in (OPTIONAL.iter().chain(STEP_RATES)) + .chain(QUAD_CONTROL) + .chain(PIXEL_INTERLOCK) + { *(feature.field)(&mut features) = *(feature.field)(&mut reported); } let listed = diff --git a/crates/metal2vulkan-runtime/src/tests/floor.rs b/crates/metal2vulkan-runtime/src/tests/floor.rs index ad42b3751..1ccdd8d6c 100644 --- a/crates/metal2vulkan-runtime/src/tests/floor.rs +++ b/crates/metal2vulkan-runtime/src/tests/floor.rs @@ -6,9 +6,9 @@ use crate::floor::{ choose, decide, flag_names, limits, vulkan_name, BelowFloor, Features, MemoryTypes, Missing, Queried, ATTACHMENT_READS, ATTACHMENT_READ_EXTENSIONS, BORDER_SWIZZLE, BORDER_SWIZZLE_EXTENSIONS, DEVICE_EXTENSIONS, INSTANCE_EXTENSIONS, LINEAR_ATTACHMENTS, - MEMORY_FLAG_NAMES, OPTIONAL, OPTIONAL_EXTENSIONS, OPTIONAL_INSTANCE_EXTENSIONS, PORTABILITY, - PRIVATE_MEMORY, QUAD_CONTROL, REQUIRED, RING_MEMORY, SHARED_MEMORY, STEP_RATES, TIMESTAMP_BITS, - TIME_DOMAINS, VERSION, + MEMORY_FLAG_NAMES, OPTIONAL, OPTIONAL_EXTENSIONS, OPTIONAL_INSTANCE_EXTENSIONS, + PIXEL_INTERLOCK, PORTABILITY, PRIVATE_MEMORY, QUAD_CONTROL, REQUIRED, RING_MEMORY, + SHARED_MEMORY, STEP_RATES, TIMESTAMP_BITS, TIME_DOMAINS, VERSION, }; use ash::vk; use std::collections::BTreeSet; @@ -328,7 +328,10 @@ fn a_device_at_the_floor_is_above_it() { required.member ); } - for optional in (OPTIONAL.iter().chain(STEP_RATES)).chain(QUAD_CONTROL) { + for optional in (OPTIONAL.iter().chain(STEP_RATES)) + .chain(QUAD_CONTROL) + .chain(PIXEL_INTERLOCK) + { assert!(!holds(enabled, optional), "{} is enabled", optional.member); } assert_eq!(enabled.core.geometry_shader, vk::FALSE); @@ -1135,6 +1138,47 @@ fn the_step_rate_feature_is_enabled_where_reported() { .contains(&VkExtension::ExtVertexAttributeDivisor)); } +/// A device that lists `VK_EXT_fragment_shader_interlock` and reports `fragmentShaderPixelInterlock` +/// is given both, and the translator sees both; one that lists the extension without the feature +/// is given the extension alone. The extension's other features stay off. +#[test] +fn the_pixel_interlock_is_enabled_where_reported() { + use crate::floor::shader_enables; + use metal2vulkan::device::{VkExtension, VkFeature}; + let extension = ash::ext::fragment_shader_interlock::NAME; + let mut device = at_the_floor(); + device.extensions.push(extension.to_owned()); + let unreported = decide(&device).unwrap_or_else(|below| panic!("{below}")); + assert!(unreported.extensions.contains(&extension)); + assert!(PIXEL_INTERLOCK + .iter() + .all(|feature| !holds(&unreported.features, feature))); + let enables = shader_enables(&unreported); + assert!(enables + .extensions + .contains(&VkExtension::ExtFragmentShaderInterlock)); + assert!(!enables + .features + .contains(&VkFeature::FragmentShaderPixelInterlock)); + + device.features.interlock.fragment_shader_pixel_interlock = vk::TRUE; + device.features.interlock.fragment_shader_sample_interlock = vk::TRUE; + let capabilities = decide(&device).unwrap_or_else(|below| panic!("{below}")); + let interlock = &capabilities.features.interlock; + assert_eq!(interlock.fragment_shader_pixel_interlock, vk::TRUE); + assert_eq!(interlock.fragment_shader_sample_interlock, vk::FALSE); + let enables = shader_enables(&capabilities); + assert!(enables + .features + .contains(&VkFeature::FragmentShaderPixelInterlock)); + assert!(!enables + .features + .contains(&VkFeature::FragmentShaderSampleInterlock)); + assert!(enables + .extensions + .contains(&VkExtension::ExtFragmentShaderInterlock)); +} + /// A device that lists `VK_KHR_shader_quad_control` and reports `shaderQuadControl` is given both, /// and the translator sees both; one that lists the extension without the feature is given the /// extension alone. @@ -1489,6 +1533,10 @@ fn the_readme_states_the_floor() { ["Quad-control feature", "Structure", "Used for"], QUAD_CONTROL, ), + ( + ["Pixel-interlock feature", "Structure", "Used for"], + PIXEL_INTERLOCK, + ), ( ["Border-swizzle feature", "Structure", "Used for"], BORDER_SWIZZLE, @@ -1668,6 +1716,7 @@ fn every_device_the_loader_lists_is_above_the_floor() { mut maximal_reconvergence, mut subgroup_uniform_control_flow, mut quad_control, + mut interlock, mut robustness2, mut portability, mut feedback_loop, @@ -1694,6 +1743,9 @@ fn every_device_the_loader_lists_is_above_the_floor() { if enabled(ash::khr::shader_quad_control::NAME) { features = features.push_next(&mut quad_control); } + if enabled(ash::ext::fragment_shader_interlock::NAME) { + features = features.push_next(&mut interlock); + } if enabled(ash::khr::portability_subset::NAME) { features = features.push_next(&mut portability); } diff --git a/crates/metal2vulkan-runtime/src/tests/mod.rs b/crates/metal2vulkan-runtime/src/tests/mod.rs index f269f09fb..befbdaaf9 100644 --- a/crates/metal2vulkan-runtime/src/tests/mod.rs +++ b/crates/metal2vulkan-runtime/src/tests/mod.rs @@ -61,6 +61,7 @@ mod over_causes; mod pass; mod patch; mod pixel_format_info; +mod pixel_interlock; mod places; mod present; mod push_window; diff --git a/crates/metal2vulkan-runtime/src/tests/pixel_interlock.rs b/crates/metal2vulkan-runtime/src/tests/pixel_interlock.rs new file mode 100644 index 000000000..1833bee3a --- /dev/null +++ b/crates/metal2vulkan-runtime/src/tests/pixel_interlock.rs @@ -0,0 +1,112 @@ +//! A fragment function's raster order group on memory it reads and writes (`floor`'s +//! `PIXEL_INTERLOCK`), under a device cfg on every device of the cfg's kind: where device creation +//! enabled `VK_EXT_fragment_shader_interlock`, the translator's profile has +//! `fragmentShaderPixelInterlock`, the state is made and the draw answers Metal's values; elsewhere +//! creation refuses the state, naming `RasterOrderGroups`. +//! +//! `rog_buffer` (engine `fragment_rog`) adds 1 to its pixel's float in a buffer in raster order +//! group 0 and writes the sum, under four whole-target triangles in one draw, so each pixel's float +//! ends at 4 and its texel holds the fourth fragment's sum. +//! +//! `llvm-as` assembles the function; without it the test skips visibly. + +#[cfg(any(m2v_gpu, m2v_cpu_icd))] +mod on_device { + use crate::tests::command::on_device::each_device; + use crate::tests::draw::on_device::{ + descriptor, examples, floats, library, pass, read, run, target, Buffers, SIDE, + }; + use crate::{Error, FunctionDescriptor, PixelFormat, PrimitiveType, StageSource, TextureUsage}; + use metal2vulkan::device::VkFeature; + use metal2vulkan::error::Feature; + use metal2vulkan_devtools::engine_dir; + + /// Where Vulkan offers `fragmentShaderPixelInterlock`, a fragment function's raster order + /// group orders its read-modify-write of its pixel's float, as Metal's does; elsewhere the + /// state is refused naming raster order groups. + #[test] + fn every_device_orders_raster_order_groups_where_it_offers_the_pixel_interlock() { + let (Some(examples), Some(groups)) = + (examples(), library(&engine_dir().join("fragment_rog.ll"))) + else { + return; + }; + let mut d = descriptor(&examples, "colored_fragment", PixelFormat::RGBA32Float); + d.fragment = Some(StageSource::Function(FunctionDescriptor::new( + groups.function("rog_buffer").expect("the function"), + ))); + each_device("pixel_interlock", |name, _, device| { + // The translator's profile has the feature only where device creation enabled its + // extension. + let listed = (device.extensions().iter()) + .any(|enabled| enabled.as_c_str() == ash::ext::fragment_shader_interlock::NAME); + let core = device.core(); + let enabled = &core.translator.profile().enabled().features; + let on = enabled.contains(&VkFeature::FragmentShaderPixelInterlock); + assert!( + listed || !on, + "{name}: fragmentShaderPixelInterlock without its extension" + ); + let state = match device + .new_render_pipeline_state(&d, crate::tests::no_constexpr_samplers) + { + Ok(state) => state, + Err(Error::Translation(metal2vulkan::error::Error::Unsupported(u))) if !on => { + assert_eq!(u.feature, Feature::RasterOrderGroups, "{name}: {u:?}"); + println!("pixel_interlock: {name}: no pixel interlock; the state is refused"); + return; + } + Err(error) => panic!("{name}: {error}"), + }; + assert!(on, "{name}: a state made without the pixel interlock"); + const LAYERS: usize = 4; + let mut buffers = Buffers::new(&device); + let whole: [f32; 6] = [-1.0, -1.0, 3.0, -1.0, -1.0, 3.0]; + let positions = buffers.of(&device, &floats(&whole.repeat(LAYERS))); + let colors = buffers.of(&device, &floats(&[0.0; 12 * LAYERS])); + let pixels = (SIDE * SIDE) as usize; + let sums = buffers.of(&device, &floats(&vec![0.0_f32; pixels])); + let width = buffers.of(&device, &SIDE.to_le_bytes()); + let color = target( + &device, + PixelFormat::RGBA32Float, + TextureUsage::RENDER_TARGET, + ); + let queue = device.new_command_queue(4).expect("a queue"); + let command_buffer = queue.command_buffer().expect("a command buffer"); + let ok = |result: Result<(), Error>| { + result.unwrap_or_else(|error| panic!("{name}: {error}")) + }; + let mut encoder = (command_buffer.render_command_encoder(&pass(&color, None))) + .unwrap_or_else(|error| panic!("{name}: {error}")); + ok(encoder.set_render_pipeline_state(&state)); + ok(encoder.set_vertex_buffer(Some(&positions), 0, 0)); + ok(encoder.set_vertex_buffer(Some(&colors), 0, 1)); + ok(encoder.set_fragment_buffer(Some(&sums), 0, 0)); + ok(encoder.set_fragment_buffer(Some(&width), 0, 1)); + ok(encoder.draw_primitives(PrimitiveType::Triangle, 0, 3 * LAYERS as u32, 1, 0)); + encoder.end_encoding(); + run(name, &command_buffer); + let layers = LAYERS as f32; + let contents = sums.contents().expect("a Shared buffer"); + // SAFETY: the buffer holds `pixels` floats, is alive, and the GPU work is done. + let sums = unsafe { std::slice::from_raw_parts(contents.as_ptr(), pixels * 4) }; + let floats_of = |bytes: &[u8]| -> Vec { + (bytes.as_chunks::<4>().0.iter()) + .map(|w| f32::from_le_bytes(*w)) + .collect() + }; + assert_eq!(floats_of(sums), vec![layers; pixels], "{name}: the sums"); + let texels = floats_of(&read(&color, 16)); + assert_eq!( + texels, + [layers, 0.0, 0.0, 1.0].repeat(pixels), + "{name}: the texels" + ); + println!( + "pixel_interlock: {name}: fragmentShaderPixelInterlock enabled; {pixels} pixels \ + summed {LAYERS} fragments in order" + ); + }); + } +} diff --git a/crates/metal2vulkan/src/bind/graphics.rs b/crates/metal2vulkan/src/bind/graphics.rs index 0d28f0710..56677da84 100644 --- a/crates/metal2vulkan/src/bind/graphics.rs +++ b/crates/metal2vulkan/src/bind/graphics.rs @@ -993,7 +993,7 @@ fn plan(p: &RenderPipeline, device: &Device, shape: &BindShape) -> Result, color: u32) -> Error { ) }); let mut interlock = Vec::new(); - if !f.fragment.pixel_interlock { + if !super::fetch::interlock_forms(cx.profile) { interlock.push(Capability::Feature(VkFeature::FragmentShaderPixelInterlock)); } if writes && !f.leaf.fragment_stores_and_atomics { diff --git a/crates/metal2vulkan/src/lower/fragment/fetch.rs b/crates/metal2vulkan/src/lower/fragment/fetch.rs index b6b25bbe2..877ebba57 100644 --- a/crates/metal2vulkan/src/lower/fragment/fetch.rs +++ b/crates/metal2vulkan/src/lower/fragment/fetch.rs @@ -4,9 +4,10 @@ //! Vulkan orders an input-attachment read so only under rasterization-order attachment access //! (`color`; a device with neither form reads the input attachment ordered between draws alone, //! [`fetch_unordered`]). A device without that access but with `fragmentShaderPixelInterlock` -//! ([`interlock_orders`]: RADV, ANV, and MoltenVK where measured) orders a fetch instead through -//! the ordered pixel interlock, the mechanism of raster order groups and imageblocks: each color -//! attachment the function reads becomes a storage image of the attachment +//! outside the identity domains ([`interlock_orders`], [`interlock_forms`]: RADV, ANV, and +//! MoltenVK where measured) orders a fetch instead through the ordered pixel interlock, the +//! mechanism of raster order groups and imageblocks: each color attachment the function reads +//! becomes a storage image of the attachment //! (`ResourceKind::TileAttachment(n)`), read once at the fragment's pixel (the integer part of //! `FragCoord.xy`) before the body, the texel every use takes, and, when the function writes that //! attachment through its first @@ -333,11 +334,22 @@ use crate::vk; use super::{not_lowered, ColorInput}; +/// Whether the pixel interlock may choose a form on `p` beyond a raster order group's (`rog`): +/// the storage forms of a framebuffer fetch and of a blend, merge or logic operation the function +/// computes over it ([`interlock_orders`]), of a stencil output (`stencil`), of an imageblock +/// (`imageblock`) and of a snapshot read (`snapshot`). Each is a storage image bound through a +/// descriptor, which the identity domains hold none of, so under them the interlock chooses none +/// of these: each takes the form, or the refusal, it takes on a device without the interlock, and +/// the interlock orders a raster order group on the memory the function reads and writes alone. +pub(crate) fn interlock_forms(p: &DeviceProfile) -> bool { + p.fields().fragment.pixel_interlock && !crate::lower::access::identity(p) +} + /// Whether `p` orders framebuffer fetch only through the ordered pixel interlock: no -/// rasterization-order color attachment access, with `fragmentShaderPixelInterlock`. +/// rasterization-order color attachment access, with `fragmentShaderPixelInterlock` choosing the +/// storage form ([`interlock_forms`]). pub(crate) fn interlock_orders(p: &DeviceProfile) -> bool { - let f = p.fields().fragment; - !f.rasterization_order_color_access && f.pixel_interlock + !p.fields().fragment.rasterization_order_color_access && interlock_forms(p) } /// Whether `p` orders framebuffer fetch through rasterization-order input attachments (lavapipe): diff --git a/crates/metal2vulkan/src/lower/fragment/imageblock.rs b/crates/metal2vulkan/src/lower/fragment/imageblock.rs index c9b3e6009..a60f2f54b 100644 --- a/crates/metal2vulkan/src/lower/fragment/imageblock.rs +++ b/crates/metal2vulkan/src/lower/fragment/imageblock.rs @@ -91,7 +91,7 @@ fn not_implemented() -> Error { fn require(cx: &SelectCx<'_>, writes: bool) -> Result<(), Error> { let f = cx.profile.fields(); let mut missing = Vec::new(); - if !f.fragment.pixel_interlock { + if !super::fetch::interlock_forms(cx.profile) { missing.push(Capability::Feature(VkFeature::FragmentShaderPixelInterlock)); } if writes && !f.leaf.fragment_stores_and_atomics { diff --git a/crates/metal2vulkan/src/lower/fragment/mod.rs b/crates/metal2vulkan/src/lower/fragment/mod.rs index 372e0de94..332150c93 100644 --- a/crates/metal2vulkan/src/lower/fragment/mod.rs +++ b/crates/metal2vulkan/src/lower/fragment/mod.rs @@ -95,8 +95,8 @@ pub use color::ColorInput; pub use coverage::CoveragePlan; pub use discard::DiscardForm; pub(crate) use fetch::{ - compiled_write_mask, extended_range_blend, half_float_format, inputs_order, interlock_orders, - kept_channels, storage_form, ColorUse, StorageSamples, + compiled_write_mask, extended_range_blend, half_float_format, inputs_order, interlock_forms, + interlock_orders, kept_channels, storage_form, ColorUse, StorageSamples, }; pub use fetch::{ select_output as select_storage_output, select_second_output as select_storage_second_output, diff --git a/crates/metal2vulkan/src/lower/fragment/rog.rs b/crates/metal2vulkan/src/lower/fragment/rog.rs index dcb7e95c6..bd558c670 100644 --- a/crates/metal2vulkan/src/lower/fragment/rog.rs +++ b/crates/metal2vulkan/src/lower/fragment/rog.rs @@ -28,12 +28,16 @@ //! compiles on every device, the ones without an interlock included. //! //! **Color inputs without an ordered fetch form**. On a device with neither rasterization-order -//! color attachment access nor the pixel interlock (`fetch::fetch_unordered`), a color input reads -//! its input attachment ordered between draws alone, by the consumer's barriers. A group on such -//! an input, or on a color output of an attachment the function reads, asks for the order of that -//! read, which is the read's own there: it does not interlock the function, and the read's -//! fragments of one draw stay unordered (`PrecisionNote::UnorderedFetchWithinDraw`, which the read -//! records). A group on anything else still needs the interlock. +//! color attachment access nor the pixel interlock's storage form (`fetch::fetch_unordered`), a +//! color input reads its input attachment ordered between draws alone, by the consumer's barriers +//! (under the identity domains, the attachment's pushed texture, on every device without +//! rasterization-order access: there the interlock chooses no fetch form, +//! `fetch::interlock_forms`). A group on such an input, or on a color output of an attachment the +//! function reads, asks for the order of that read, which is the read's own there: it does not +//! interlock the function, since the interlock cannot order the attachment's own write, which +//! happens after the function, and the read's fragments of one draw stay unordered +//! (`PrecisionNote::UnorderedFetchWithinDraw`, which the read records). A group on anything else, +//! memory the function reads and writes, still needs the interlock. //! //! **Unused inputs**. A group on a parameter the body never uses, such as an input whose reads the //! function's constants fold away, orders no access, and neither does a member of a layout only diff --git a/crates/metal2vulkan/src/lower/fragment/snapshot.rs b/crates/metal2vulkan/src/lower/fragment/snapshot.rs index 403f802ff..4f3f00c54 100644 --- a/crates/metal2vulkan/src/lower/fragment/snapshot.rs +++ b/crates/metal2vulkan/src/lower/fragment/snapshot.rs @@ -160,7 +160,7 @@ pub(super) fn finish( "a snapshot read in a function with another critical section or a sample loop", )); } - if !cx.profile.fields().fragment.pixel_interlock { + if !super::fetch::interlock_forms(cx.profile) { return Err(Unsupported::needs( Feature::RasterOrderGroups, Capability::Feature(VkFeature::FragmentShaderPixelInterlock), diff --git a/crates/metal2vulkan/src/lower/fragment/stencil.rs b/crates/metal2vulkan/src/lower/fragment/stencil.rs index f8a209c8e..133d43b1d 100644 --- a/crates/metal2vulkan/src/lower/fragment/stencil.rs +++ b/crates/metal2vulkan/src/lower/fragment/stencil.rs @@ -123,7 +123,7 @@ pub(crate) fn device_form( ) -> Result { let f = p.fields(); let mut missing = Vec::new(); - if !f.fragment.pixel_interlock { + if !super::fetch::interlock_forms(p) { missing.push(Capability::Feature(VkFeature::FragmentShaderPixelInterlock)); } if !f.leaf.fragment_stores_and_atomics { diff --git a/crates/metal2vulkan/src/tests/engine_identity_interlock.rs b/crates/metal2vulkan/src/tests/engine_identity_interlock.rs new file mode 100644 index 000000000..d134ed3aa --- /dev/null +++ b/crates/metal2vulkan/src/tests/engine_identity_interlock.rs @@ -0,0 +1,188 @@ +//! The pixel interlock under the identity domains (`PointerDomain::Identity` with +//! `HandleDomain::Identity`): it orders a raster order group on memory the function reads and +//! writes, and chooses no other form (`lower::fragment::fetch::interlock_forms`). +//! +//! On lavapipe's profile under the identity domains without rasterization-order color attachment +//! access (which the runtime does not enable), with `fragmentShaderPixelInterlock` and without it, +//! each behind `colored_vertex` (`examples/runtime_examples`): +//! +//! - `rog_buffer` (engine `fragment_rog`), whose group holds a device buffer it reads and writes, +//! runs its body in the ordered pixel interlock where the profile has the feature, its modules +//! L3-valid, and is refused `Unsupported{RasterOrderGroups}` naming the feature where not. +//! - `fetch_ordered` (engine `fragment_fetch`), whose group holds only the color it reads, reads it +//! through the pushed texture (`PushField::FetchedColor`) on both: no storage attachment, no +//! interlock, and its fragment stage notes `UnorderedFetchWithinDraw`. Its modules are word for +//! word the same with and without the feature, so the interlock chose nothing of its form. +//! +//! `llvm-as` assembles the fixtures; a missing tool skips visibly. No GPU is used. + +use crate::budget::Budget; +use crate::device::requirements::VkFeature; +use crate::device::{Device, DevicePolicy, HandleDomain, PointerDomain}; +use crate::error::{Capability, Error, Feature, Needs}; +use crate::library::Library; +use crate::metal::PixelFormat; +use crate::pipeline::artifact::{PrecisionNote, RenderPipeline, StageModule}; +use crate::pipeline::descriptor::{ + ColorAttachmentDescriptor, FunctionDescriptor, RenderPipelineDescriptor, StageSource, +}; +use crate::pipeline::sym::PushField; +use crate::pipeline::testing::{description, engine_dir, llvm_assemble, AssembleError}; +use crate::spirv::testing::check_words_valid; +use crate::vk; + +fn identity() -> DevicePolicy { + DevicePolicy { + pointer_domain: PointerDomain::Identity, + handle_domain: HandleDomain::Identity, + ..DevicePolicy::default() + } +} + +/// The library of `ll`, under the engine fixtures' directory, or `None` (printed) where `llvm-as` +/// is missing. +fn library(ll: &str) -> Option { + let ll = engine_dir().join(ll); + match llvm_assemble(&ll) { + Ok(bitcode) => Some(Library::from_air(&bitcode).expect("the library")), + Err(AssembleError::Missing(why)) => { + eprintln!("SKIPPED: {why}"); + None + } + Err(e) => panic!("{}: {e:?}", ll.display()), + } +} + +/// Lavapipe's profile under the identity domains without rasterization-order color attachment +/// access, with `fragmentShaderPixelInterlock` where `interlock`. +fn device(interlock: bool) -> Device { + let mut desc = description("lavapipe").unwrap_or_else(|e| panic!("{e}")); + desc.features + .remove(&VkFeature::RasterizationOrderColorAttachmentAccess); + if !interlock { + desc.features + .remove(&VkFeature::FragmentShaderPixelInterlock); + } + let device = Device::from_queries(desc, identity()).unwrap_or_else(|e| panic!("{e}")); + assert_eq!( + device.profile().fragment().pixel_interlock, + interlock, + "lavapipe's profile and the interlock" + ); + device +} + +/// `colored_vertex` and `fragment` of `fragments`, into one `RGBA16Float` attachment. +fn pipeline( + device: &Device, + examples: &Library, + fragments: &Library, + fragment: &str, +) -> Result { + let function = |library: &Library, name| { + StageSource::Function(FunctionDescriptor::new( + library.function(name).expect("the function"), + )) + }; + let mut d = RenderPipelineDescriptor::new(function(examples, "colored_vertex")); + d.fragment = Some(function(fragments, fragment)); + d.color_attachments[0] = Some(ColorAttachmentDescriptor::new(PixelFormat::RGBA16Float)); + device.compile_render_pipeline(&d, &Budget::standard()) +} + +fn fragment(p: &RenderPipeline) -> &StageModule { + (p.stages.iter()) + .find(|m| m.stage == vk::ShaderStage::FRAGMENT) + .expect("a fragment stage") +} + +/// Whether `words` interlocks: an interlock execution mode (`PixelInterlockOrderedEXT` 5366 to +/// `ShadingRateInterlockUnorderedEXT` 5371) or an `OpBeginInvocationInterlockEXT` (5364). +fn interlocks(words: &[u32]) -> bool { + const OP_EXECUTION_MODE: u32 = 16; + const OP_BEGIN_INTERLOCK: u32 = 5364; + let mut at = 5; + while at < words.len() { + let len = (words[at] >> 16) as usize; + let op = words[at] & 0xffff; + let mode = words.get(at + 2).copied().unwrap_or(0); + if op == OP_BEGIN_INTERLOCK || (op == OP_EXECUTION_MODE && (5366..=5371).contains(&mode)) { + return true; + } + at += len.max(1); + } + false +} + +#[test] +fn the_pixel_interlock_orders_a_raster_order_group_on_memory_alone_under_the_identity_domains() { + let (Some(examples), Some(groups), Some(fetches)) = ( + library("../examples/runtime_examples.ll"), + library("fragment_rog.ll"), + library("fragment_fetch.ll"), + ) else { + return; + }; + let (with, without) = (device(true), device(false)); + + // A group on a buffer the function reads and writes: the interlock orders it. + let ordered = pipeline(&with, &examples, &groups, "rog_buffer") + .unwrap_or_else(|e| panic!("rog_buffer with the interlock: {e}")); + assert!( + interlocks(&fragment(&ordered).spirv), + "rog_buffer runs in the interlock" + ); + for m in &ordered.stages { + check_words_valid(&m.spirv, &ordered.requirements, with.profile()) + .unwrap_or_else(|e| panic!("rog_buffer: {:?}: {e}", m.stage)); + } + match pipeline(&without, &examples, &groups, "rog_buffer") { + Err(Error::Unsupported(u)) => assert_eq!( + (u.feature, u.needs), + ( + Feature::RasterOrderGroups, + Needs::AnyOf(vec![vec![Capability::Feature( + VkFeature::FragmentShaderPixelInterlock + )]]) + ), + "rog_buffer without the interlock" + ), + other => panic!( + "rog_buffer without the interlock: {:?}", + other.map(|_| "compiled") + ), + } + + // A group on the color the function reads alone: the fetch's own form, which the interlock + // does not choose. + let [read_with, read_without] = [&with, &without].map(|device| { + pipeline(device, &examples, &fetches, "fetch_ordered") + .unwrap_or_else(|e| panic!("fetch_ordered: {e}")) + }); + for (p, what) in [(&read_with, "with"), (&read_without, "without")] { + let m = fragment(p); + assert!(!interlocks(&m.spirv), "fetch_ordered {what}: no interlock"); + assert!( + p.graphics.storage_attachments.is_empty(), + "fetch_ordered {what}: no storage attachment" + ); + assert!( + (m.precision_notes).contains(&PrecisionNote::UnorderedFetchWithinDraw), + "fetch_ordered {what}: {:?}", + m.precision_notes + ); + let mut pushed = (p.interface.push.iter()).flat_map(|placement| &placement.fields); + assert!( + pushed.any(|f| matches!(f.field, PushField::FetchedColor { color: 0, .. })), + "fetch_ordered {what}: the pushed texture of color 0" + ); + } + let words = |p: &RenderPipeline| -> Vec> { + p.stages.iter().map(|m| m.spirv.to_vec()).collect() + }; + assert_eq!( + words(&read_with), + words(&read_without), + "fetch_ordered's modules with and without the interlock" + ); +} diff --git a/crates/metal2vulkan/src/tests/mod.rs b/crates/metal2vulkan/src/tests/mod.rs index 4949227e4..ba3a08589 100644 --- a/crates/metal2vulkan/src/tests/mod.rs +++ b/crates/metal2vulkan/src/tests/mod.rs @@ -82,6 +82,7 @@ mod engine_helper_threads; mod engine_identity; mod engine_identity_contain; mod engine_identity_domain; +mod engine_identity_interlock; mod engine_identity_pointers; mod engine_identity_render; mod engine_identity_spill; diff --git a/crates/metal2vulkan/tests/api_signatures.tsv b/crates/metal2vulkan/tests/api_signatures.tsv index ffd0e48b4..9737099ec 100644 --- a/crates/metal2vulkan/tests/api_signatures.tsv +++ b/crates/metal2vulkan/tests/api_signatures.tsv @@ -564,7 +564,7 @@ const-value metal2vulkan-runtime::floor::BORDER_SWIZZLE_EXTENSIONS &[ash::ext::c const-value metal2vulkan-runtime::floor::BUFFER_USAGE vk::BufferUsageFlags::from_raw(vk::BufferUsageFlags::TRANSFER_SRC.as_raw() | vk::BufferUsageFlags::TRANSFER_DST.as_raw() | vk::BufferUsageFlags::UNIFORM_TEXEL_BUFFER.as_raw() | vk::BufferUsageFlags::STORAGE_TEXEL_BUFFER.as_raw() | vk::BufferUsageFlags::UNIFORM_BUFFER.as_raw() | vk::BufferUsageFlags::STORAGE_BUFFER.as_raw() | vk::BufferUsageFlags::INDEX_BUFFER.as_raw() | vk::BufferUsageFlags::VERTEX_BUFFER.as_raw() | vk::BufferUsageFlags::INDIRECT_BUFFER.as_raw() | vk::BufferUsageFlags::SHADER_DEVICE_ADDRESS.as_raw()) const-value metal2vulkan-runtime::floor::DEVICE_EXTENSIONS &[ash::khr::swapchain::NAME, ash::ext::robustness2::NAME, ash::ext::calibrated_timestamps::NAME, ash::ext::line_rasterization::NAME] const-value metal2vulkan-runtime::floor::INSTANCE_EXTENSIONS &[ash::khr::surface::NAME] -const-value metal2vulkan-runtime::floor::OPTIONAL_EXTENSIONS &[ash::khr::shader_maximal_reconvergence::NAME, ash::khr::shader_subgroup_uniform_control_flow::NAME, ash::khr::shader_quad_control::NAME, ash::khr::portability_subset::NAME, ash::khr::vertex_attribute_divisor::NAME, ash::ext::vertex_attribute_divisor::NAME, ash::ext::external_memory_host::NAME, ash::khr::external_memory_fd::NAME, ash::ext::external_memory_dma_buf::NAME, ash::khr::external_memory_win32::NAME, ash::ext::queue_family_foreign::NAME, ash::ext::image_drm_format_modifier::NAME, ash::nv::linear_color_attachment::NAME] +const-value metal2vulkan-runtime::floor::OPTIONAL_EXTENSIONS &[ash::khr::shader_maximal_reconvergence::NAME, ash::khr::shader_subgroup_uniform_control_flow::NAME, ash::khr::shader_quad_control::NAME, ash::ext::fragment_shader_interlock::NAME, ash::khr::portability_subset::NAME, ash::khr::vertex_attribute_divisor::NAME, ash::ext::vertex_attribute_divisor::NAME, ash::ext::external_memory_host::NAME, ash::khr::external_memory_fd::NAME, ash::ext::external_memory_dma_buf::NAME, ash::khr::external_memory_win32::NAME, ash::ext::queue_family_foreign::NAME, ash::ext::image_drm_format_modifier::NAME, ash::nv::linear_color_attachment::NAME] const-value metal2vulkan-runtime::floor::OPTIONAL_INSTANCE_EXTENSIONS &[ash::khr::portability_enumeration::NAME] const-value metal2vulkan-runtime::floor::TIME_DOMAINS [vk::TimeDomainKHR::DEVICE, crate::times::HOST_DOMAIN] const-value metal2vulkan-runtime::floor::VERSION vk::API_VERSION_1_3 @@ -1920,6 +1920,7 @@ field metal2vulkan-runtime::floor::Features.core pub core: vk::PhysicalDeviceFea field metal2vulkan-runtime::floor::Features.divisor pub divisor: vk::PhysicalDeviceVertexAttributeDivisorFeaturesKHR<'static> field metal2vulkan-runtime::floor::Features.feedback_loop pub feedback_loop: vk::PhysicalDeviceAttachmentFeedbackLoopLayoutFeaturesEXT<'static> field metal2vulkan-runtime::floor::Features.feedback_loop_dynamic pub feedback_loop_dynamic: vk::PhysicalDeviceAttachmentFeedbackLoopDynamicStateFeaturesEXT<'static> +field metal2vulkan-runtime::floor::Features.interlock pub interlock: vk::PhysicalDeviceFragmentShaderInterlockFeaturesEXT<'static> field metal2vulkan-runtime::floor::Features.line_rasterization pub line_rasterization: vk::PhysicalDeviceLineRasterizationFeaturesEXT<'static> field metal2vulkan-runtime::floor::Features.linear_attachment pub linear_attachment: vk::PhysicalDeviceLinearColorAttachmentFeaturesNV<'static> field metal2vulkan-runtime::floor::Features.maximal_reconvergence pub maximal_reconvergence: vk::PhysicalDeviceShaderMaximalReconvergenceFeaturesKHR<'static> diff --git a/docs/API.md b/docs/API.md index 06c10bcff..3f4c4d6f6 100644 --- a/docs/API.md +++ b/docs/API.md @@ -2041,22 +2041,23 @@ bound. - `metal2vulkan-degrade-unordered-fetch-within-draw` (precision). `PrecisionNote::UnorderedFetchWithinDraw`: A fragment function reads a color attachment (framebuffer fetch) on a device with neither rasterization-order color attachment access nor - `fragmentShaderPixelInterlock` (Honeykrisp on Apple's M2 Pro; RADV on the RX 550). It reads the - attachment as an input attachment, and the runtime records a barrier of the draws' subpass's - dependency on itself, by region, before each draw that reads input attachments after an earlier - draw of its render pass instance, or its load operations, wrote a color, and before each draw - that writes a color after an earlier one read them: a fetch reads what every earlier - draw stored at its pixel, Metal's answer. Under the identity domains it reads the attachment's - texture at its own pixel instead (`PushField::FetchedColor`), and the consumer orders each - fetching draw after the earlier draws of its pass by a barrier between them (the runtime's - `Metrics::attachment_loop_reads`, or its copies into the attachment's shadow on a device - without the attachment feedback loop). Vulkan orders nothing between the overlapping - fragments of one draw there, where Metal orders them in primitive order: a fragment that covers - a pixel an earlier fragment of its own draw covered may read the texel from before that - fragment's write. Exact for a draw whose primitives do not overlap at a pixel; otherwise each - such pixel holds the result of some order of the draw's fragments there. A raster order group - on the color input, or on a color output of an attachment the function reads, takes the same - form. + `fragmentShaderPixelInterlock` (Honeykrisp on Apple's M2 Pro; RADV on the RX 550), or under the + identity domains on any device without rasterization-order access, the pixel interlock's included: + there the interlock chooses no fetch form, as its storage form is a descriptor the identity + domains do not hold. It reads the attachment as an input attachment, and the runtime records a + barrier of the draws' subpass's dependency on itself, by region, before each draw that reads input + attachments after an earlier draw of its render pass instance, or its load operations, wrote a + color, and before each draw that writes a color after an earlier one read them: a fetch reads what + every earlier draw stored at its pixel, Metal's answer. Under the identity domains it reads the + attachment's texture at its own pixel instead (`PushField::FetchedColor`), and the consumer orders + each fetching draw after the earlier draws of its pass by a barrier between them (the runtime's + `Metrics::attachment_loop_reads`, or its copies into the attachment's shadow on a device without + the attachment feedback loop). Vulkan orders nothing between the overlapping fragments of one draw + there, where Metal orders them in primitive order: a fragment that covers a pixel an earlier + fragment of its own draw covered may read the texel from before that fragment's write. Exact for a + draw whose primitives do not overlap at a pixel; otherwise each such pixel holds the result of + some order of the draw's fragments there. A raster order group on the color input, or on a color + output of an attachment the function reads, takes the same form. - `metal2vulkan-degrade-fp8-value` (precision). `PrecisionNote::Fp8Value`: An 8-bit float converts to an integer from the format's documented value with Metal's saturating float-to-integer rule, where Metal's device here answers otherwise: Metal on Apple M3 compiles these reads but extends