diff --git a/crates/metal2vulkan-conformance/known-gaps-rt.tsv b/crates/metal2vulkan-conformance/known-gaps-rt.tsv index f10e065ae..d61b76db4 100644 --- a/crates/metal2vulkan-conformance/known-gaps-rt.tsv +++ b/crates/metal2vulkan-conformance/known-gaps-rt.tsv @@ -3224,18 +3224,6 @@ half-output-blends-rgba32f RX 550 divergent case/blended/sas-1msa 20 elements di # bind Metal's own validation refuses, and a getter of the consumer's. buffer-bind-off-alignment * refused case/outcome/dispatch_type Err(TheConsumers("an encoder's dispatchType is the argument it was made with: metal2vulkan-runtime keeps no getter and leaves it to its consumer")) refused: the consumer's own (dispatchType) buffer-bind-off-alignment * refused case/outcome/step/3/dispatchThreadgroups Err(Error::Refused("the buffer at index 0, bound at offset 2, is not at a multiple of its argument's 4-byte alignment")) Metal itself refuses the bind: its API validation stops the pass ("Compute Function(vwp_words): the offset into the buffer src that is bound at Buffer index 0 must be a multiple of 4 but was set to 2", the recording's validated fact), where plain Metal ran it (Ok). rt refuses the dispatch as Metal's validation does (docs/API.md section 10, "A dispatch that reaches a buffer bound off its argument's alignment is refused"). -layered-attachment-places * refused case/pieces/pass:volume-plane-0 Err(Error::Unsupported("a render pass with TextureType is not built")) refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no render pass over a plane of a 3D texture: its render pass refuses the texture type, and its RenderPassDescriptor has no depthPlane. No device query is asked. -layered-attachment-places * refused case/pieces/pass:volume-plane-1 Err(Unavailable({call: "depthPlane"})) refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no render pass over a plane of a 3D texture: its render pass refuses the texture type, and its RenderPassDescriptor has no depthPlane. No device query is asked. -layered-attachment-places * refused case/pieces/pass:volume-plane-2 Err(Unavailable({call: "depthPlane"})) refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no render pass over a plane of a 3D texture: its render pass refuses the texture type, and its RenderPassDescriptor has no depthPlane. No device query is asked. -layered-attachment-places * refused case/pieces/prime:volume-plane-0:color/level-0/slice-0/plane-0 Err(Error::Unsupported("a render pass with TextureType is not built")) refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no render pass over a plane of a 3D texture: its render pass refuses the texture type, and its RenderPassDescriptor has no depthPlane. No device query is asked. -layered-attachment-places * refused case/pieces/prime:volume-plane-0:color/level-0/slice-0/plane-1 Err(Unavailable({call: "depthPlane"})) refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no render pass over a plane of a 3D texture: its render pass refuses the texture type, and its RenderPassDescriptor has no depthPlane. No device query is asked. -layered-attachment-places * refused case/pieces/prime:volume-plane-0:color/level-0/slice-0/plane-2 Err(Unavailable({call: "depthPlane"})) refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no render pass over a plane of a 3D texture: its render pass refuses the texture type, and its RenderPassDescriptor has no depthPlane. No device query is asked. -layered-attachment-places * refused case/pieces/prime:volume-plane-1:color/level-0/slice-0/plane-0 Err(Error::Unsupported("a render pass with TextureType is not built")) refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no render pass over a plane of a 3D texture: its render pass refuses the texture type, and its RenderPassDescriptor has no depthPlane. No device query is asked. -layered-attachment-places * refused case/pieces/prime:volume-plane-1:color/level-0/slice-0/plane-1 Err(Unavailable({call: "depthPlane"})) refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no render pass over a plane of a 3D texture: its render pass refuses the texture type, and its RenderPassDescriptor has no depthPlane. No device query is asked. -layered-attachment-places * refused case/pieces/prime:volume-plane-1:color/level-0/slice-0/plane-2 Err(Unavailable({call: "depthPlane"})) refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no render pass over a plane of a 3D texture: its render pass refuses the texture type, and its RenderPassDescriptor has no depthPlane. No device query is asked. -layered-attachment-places * refused case/pieces/prime:volume-plane-2:color/level-0/slice-0/plane-0 Err(Error::Unsupported("a render pass with TextureType is not built")) refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no render pass over a plane of a 3D texture: its render pass refuses the texture type, and its RenderPassDescriptor has no depthPlane. No device query is asked. -layered-attachment-places * refused case/pieces/prime:volume-plane-2:color/level-0/slice-0/plane-1 Err(Unavailable({call: "depthPlane"})) refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no render pass over a plane of a 3D texture: its render pass refuses the texture type, and its RenderPassDescriptor has no depthPlane. No device query is asked. -layered-attachment-places * refused case/pieces/prime:volume-plane-2:color/level-0/slice-0/plane-2 Err(Unavailable({call: "depthPlane"})) refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no render pass over a plane of a 3D texture: its render pass refuses the texture type, and its RenderPassDescriptor has no depthPlane. No device query is asked. xr-clear-routes-bgr10xr * refused case/plain-16/target/0 Err(Error::Unsupported("no texture of BGR10XR is made on this device for the usage")) refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no extended-range texture, drawable or layer). The translator holds `BGR10XR` raw in R32_UINT, its texels decoded and encoded in the shader (FormatEmulation::ExtendedRange), and rt's texture refuses that emulation (its identity domains make no extended-range conversion) before the device's format query is asked: the device is not asked about the integer format. xr-clear-routes-bgr10xr-srgb * refused case/plain-16/target/0 Err(Error::Unsupported("no texture of BGR10XRSRGB is made on this device for the usage")) refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no extended-range texture, drawable or layer). The translator holds `BGR10XRSRGB` raw in R32_UINT, its texels decoded and encoded in the shader (FormatEmulation::ExtendedRange), and rt's texture refuses that emulation (its identity domains make no extended-range conversion) before the device's format query is asked: the device is not asked about the integer format. xr-clear-routes-bgra10xr * refused case/plain-16/target/0 Err(Error::Unsupported("no texture of BGRA10XR is made on this device for the usage")) refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no extended-range texture, drawable or layer). The translator holds `BGRA10XR` raw in R16G16B16A16_UINT, its texels decoded and encoded in the shader (FormatEmulation::ExtendedRange), and rt's texture refuses that emulation (its identity domains make no extended-range conversion) before the device's format query is asked: the device is not asked about the integer format. diff --git a/crates/metal2vulkan-conformance/src/rt_side/render.rs b/crates/metal2vulkan-conformance/src/rt_side/render.rs index 836e08094..15ad3c7f9 100644 --- a/crates/metal2vulkan-conformance/src/rt_side/render.rs +++ b/crates/metal2vulkan-conformance/src/rt_side/render.rs @@ -47,18 +47,24 @@ fn store(action: StoreAction) -> Answer { }) } -/// An attachment's place, refused where it names what the runtime's attachment has no field -/// for: a depth plane or store action options. -fn plain(place: &AttachmentPlace, options: StoreActionOptions) -> Answer<()> { - if place.depth_plane != 0 { - return Err(Failure::unavailable("depthPlane")); - } +/// An attachment's store action options, refused where set: the runtime's attachments have no +/// field for them. +fn optionless(options: StoreActionOptions) -> Answer<()> { if options != StoreActionOptions::default() { return Err(Failure::unavailable("storeActionOptions")); } Ok(()) } +/// A depth or stencil attachment's place, refused where it names a depth plane, which the +/// runtime's depth and stencil attachments have no field for, and its options as [`optionless`]. +fn plain(place: &AttachmentPlace, options: StoreActionOptions) -> Answer<()> { + if place.depth_plane != 0 { + return Err(Failure::unavailable("depthPlane")); + } + optionless(options) +} + /// The runtime's depth resolve filter for a case's. fn depth_filter( filter: MultisampleDepthResolveFilter, @@ -391,12 +397,13 @@ impl RtSide<'_> { descriptor.render_target_array_length = pass.array_length; for (at, color) in pass.colors.iter().enumerate() { let Some(held) = color.texture else { continue }; - plain(&color.place, color.options)?; + optionless(color.options)?; let attachment = (descriptor.color_attachments.get_mut(at)) .ok_or_else(|| Failure::named("NoSuchAttachment", format!("color {at}")))?; attachment.texture = Some(self.held_texture(held)?.clone()); attachment.level = color.place.level; attachment.slice = color.place.slice; + attachment.depth_plane = color.place.depth_plane; attachment.resolve_texture = (color.resolve) .map(|resolve| self.held_texture(resolve).cloned()) .transpose()?; diff --git a/crates/metal2vulkan-runtime/README.md b/crates/metal2vulkan-runtime/README.md index 1f7afe5b1..eccc5a568 100644 --- a/crates/metal2vulkan-runtime/README.md +++ b/crates/metal2vulkan-runtime/README.md @@ -1497,7 +1497,10 @@ made, with no lock, and never rewritten for layouts. `Refusal::TextureBufferNotOverBuffer` at every make but `Buffer::new_texture`, which makes texture buffers (below). A cube array texture's image is cube-compatible with six layers a cube, and its view is a cube array view (`imageCubeArray`, - in the floor). + in the floor). A 3D texture of `RenderTarget` usage and a colour format is made + 2D-array-compatible (`VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT`, in its image format query too), + so that a pass renders into one depth plane of a level through a 2D view of it (Render + encoders). - `Texture::gpu_resource_id` is its index (0 without one) and the translator's `TextureWord` of its format and swizzle (`docs/RESOURCE-ID.md`), so the guest computes the ID itself. An ID of index 0 that a shader reads from bytes (an argument buffer's texture) reads the null descriptor, @@ -4099,6 +4102,11 @@ cache is answered compile-required on both. `renderTargetHeight`, `defaultRasterSampleCount` and `renderTargetArrayLength`. Each attachment is one level of its texture and, from its `slice`, the pass's layers (below): a 2D texture, a 2D array, a cube or a cube array, or a 2D multisample texture or array, of `RenderTarget` usage; + or a colour attachment's `depthPlane` of a level of a 3D texture of that usage, in a pass of one + layer, through a 2D view of that plane of its image (Vulkan's + `VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT`, whose barriers name the image's layers as + `VK_REMAINING_ARRAY_LAYERS` from 0 and move every plane of the level, and whose load, store and + clear act on the plane alone: the level's other planes keep their texels); every attachment of a pass has one sample count, and a draw's pipeline state that count as its `rasterSampleCount` (`DrawKind::AttachmentFormats` otherwise). The device's counts are `Device::supports_texture_sample_count`'s. A multisample attachment is stored as its samples: @@ -4623,8 +4631,9 @@ cache is answered compile-required on both. which no Vulkan resolve mode is, and two aspects paired where `independentResolve` or `independentResolveNone` does not allow it), a store action an encoder sets that does not resolve an attachment whose pass left it `Unknown` with a resolve texture (`LateStore`: the - rendering began resolving, as Vulkan fixes the resolve as it begins), a 1D or 3D texture's - attachment, a 3D resolve texture's plane (`TextureType`), the + rendering began resolving, as Vulkan fixes the resolve as it begins), a 1D texture's + attachment, a 3D texture's depth or stencil attachment, a 3D resolve texture, a resolve's depth + plane but 0 (`TextureType`), the `CustomSampleDepthStore` store action, a clear of a format only a shader clears (extended range, bfloat, YCbCr), a `renderTargetArrayLength` past the device's `maxFramebufferLayers` (`ArrayLength`: Vulkan renders at most that many layers, @@ -4647,10 +4656,10 @@ cache is answered compile-required on both. - Layered rendering refuses: in a pass of `renderTargetArrayLength` 2 or more, an attachment or a resolve texture with fewer slices from its own `slice` than the pass's length (`Refusal::AttachmentPlace`, naming the last slice the pass would render), a 3D texture's - depth planes, which are no attachment's layers (`Gap::RenderPass`, `TextureType`, as for any 3D - attachment), and a draw that reads one of its pass's attachments through a texture on a device - without the attachment feedback loop (`Gap::Draw`, `AttachmentRead`: an attachment's shadow - holds one layer). A vertex function's `[[render_target_array_index]]` and + depth planes, which are no attachment's layers (`Gap::RenderPass`, `TextureType`), and a draw + that reads one of its pass's attachments through a texture on a device without the attachment + feedback loop (`Gap::Draw`, `AttachmentRead`: an attachment's shadow holds one layer, and no 3D + texture's depth plane, which a pass of one layer refuses the same way). A vertex function's `[[render_target_array_index]]` and `[[viewport_array_index]]` are stored as the function writes them. Metal requires the same value at every vertex of a primitive; where a program breaks that, the layer or viewport is the device's choice. An index the function declares and never writes, which Metal gives no value, @@ -5207,6 +5216,7 @@ extension offers each of them by Vulkan's definition and is not asked. | `imageViewFormatSwizzle` | `VkPhysicalDevicePortabilitySubsetFeaturesKHR` | a texture view's component mapping: its format's and Metal's swizzle | | `mutableComparisonSamplers` | `VkPhysicalDevicePortabilitySubsetFeaturesKHR` | the comparison sampler array, which takes each sampler state's sampler as it is made | | `multisampleArrayImage` | `VkPhysicalDevicePortabilitySubsetFeaturesKHR` | `MTLTextureType2DMultisampleArray` | +| `imageView2DOn3DImage` | `VkPhysicalDevicePortabilitySubsetFeaturesKHR` | a 3D texture's depth plane as a colour attachment: a 2D view of a 2D-array-compatible 3D image | ### Step rates diff --git a/crates/metal2vulkan-runtime/src/error.rs b/crates/metal2vulkan-runtime/src/error.rs index 2cd293790..b13b021e5 100644 --- a/crates/metal2vulkan-runtime/src/error.rs +++ b/crates/metal2vulkan-runtime/src/error.rs @@ -951,13 +951,14 @@ pub enum Refusal { }, /// A render pass attachment or resolve texture of a level or slice past its texture's: its own /// slice, or the last of the slices a layered pass renders from it - /// (`renderTargetArrayLength`). + /// (`renderTargetArrayLength`); or a 3D texture's depth plane past its level's depth. /// /// Basis: ours (no texel of the texture is there to render into). AttachmentPlace { /// The level asked for. level: u32, - /// The slice asked for: the attachment's own, or the last its pass renders. + /// The slice asked for: the attachment's own, or the last its pass renders; a 3D texture's + /// depth plane. slice: u32, }, /// A render pass color attachment of a depth or stencil pixel format, a depth attachment of a @@ -1788,7 +1789,8 @@ pub enum DrawKind { /// attachment reads (`floor::Capabilities::attachment_reads`), from the vertex function at the /// rendered level and layer, written, of a depth or stencil attachment, of an image over a /// buffer in place or whose format the device takes neither the feedback usage nor a shadow - /// for, or of an image two attachments of the pass render. + /// for, or of an image two attachments of the pass render; and through a shadow, which holds + /// one layer, an attachment of a layered pass or a 3D texture's depth plane. /// Metal reads a render target through a texture. AttachmentRead, /// A draw through a pipeline state whose fragment function reads a colour attachment @@ -1913,8 +1915,11 @@ pub enum RenderPassKind { /// `Unknown` with a resolve texture: the rendering began resolving into the texture, as Vulkan /// fixes the resolve as the rendering begins. LateStore, - /// An attachment of a texture type but a 2D texture, a 2D array, a cube or a cube array: a 1D - /// texture's, or a 3D texture's depth plane. + /// An attachment that is neither a level of a 2D texture, a 2D array, a cube, a cube array or a + /// 2D multisample texture or array, nor a depth plane of a 3D texture's level that a color + /// attachment renders in a pass of one layer: a 1D texture's; a 3D texture's in a layered pass + /// (`renderTargetArrayLength` 2 or more), as a depth or stencil attachment, or as a resolve + /// texture; and a resolve's depth plane but 0. TextureType, /// `MTLStoreActionCustomSampleDepthStore`, set on the pass or by the encoder's /// `setColorStoreAction:atIndex:` family. diff --git a/crates/metal2vulkan-runtime/src/floor.rs b/crates/metal2vulkan-runtime/src/floor.rs index 2e5de6e77..a8e040a42 100644 --- a/crates/metal2vulkan-runtime/src/floor.rs +++ b/crates/metal2vulkan-runtime/src/floor.rs @@ -659,6 +659,9 @@ pub(crate) const PORTABILITY: &[Feature] = &[ feature!(portability.mutable_comparison_samplers => MutableComparisonSamplers), // `MTLTextureType2DMultisampleArray`. feature!(portability.multisample_array_image => MultisampleArrayImage), + // A 3D texture's depth plane as a render pass attachment: a 2D view of a 3D image, made + // 2D-array-compatible (`VUID-VkImageCreateInfo-imageView2DOn3DImage-04459`). + feature!(portability.image_view2_d_on3_d_image => ImageView2DOn3DImage), ]; /// The features the runtime uses only where the device reports them. Each answer chooses one of diff --git a/crates/metal2vulkan-runtime/src/pass.rs b/crates/metal2vulkan-runtime/src/pass.rs index 831839a5a..427248a2e 100644 --- a/crates/metal2vulkan-runtime/src/pass.rs +++ b/crates/metal2vulkan-runtime/src/pass.rs @@ -48,7 +48,7 @@ use crate::buffer::{Buffer, BufferObject}; use crate::device::Core; use crate::error::{Error, Gap, LinearPlanePassKind, Refusal, RenderPassKind}; -use crate::texture::{Attachment, ResolveCopy, Texture, TextureObject}; +use crate::texture::{barrier_layers, Attachment, ResolveCopy, Texture, TextureObject}; use ash::vk; use metal2vulkan::metal::format::{self as formats, FormatEmulation}; use metal2vulkan::metal::PixelFormat; @@ -199,22 +199,28 @@ impl ClearColor { /// resolve of an extended-range, bfloat or YCbCr format, which Vulkan's average would take in the /// image's own encoding. An integer format has no resolve, [`Refusal::ResolveFormat`]. /// -/// Not built: a 3D texture's `depthPlane` (refused by the texture's type) and -/// `storeActionOptions`, whose one option needs more than one sample. +/// Not built: `storeActionOptions`, whose one option needs more than one sample. /// /// Its default is Metal's: no texture or resolve texture, levels, slices and planes 0, `DontCare` /// load, `Store` store, opaque black clear. #[derive(Clone, Default)] pub struct RenderPassColorAttachmentDescriptor { /// `texture`: the texture rendered into; `None` for no attachment at this index. It needs - /// `RenderTarget` usage and a color format; a 2D texture, a 2D array, a cube, a cube array, or - /// a 2D multisample texture or array. + /// `RenderTarget` usage and a color format; a 2D texture, a 2D array, a cube, a cube array, a + /// 2D multisample texture or array, or a 3D texture in a pass of one layer (`depth_plane`). pub texture: Option, /// `level`: the mipmap level rendered into. pub level: u32, /// `slice`: the array slice or cube face rendered into, the first of a layered pass's /// ([`RenderPassDescriptor::render_target_array_length`]). pub slice: u32, + /// `depthPlane`: a 3D texture's depth plane rendered into, inside the level's depth + /// ([`Refusal::AttachmentPlace`] past it), through a 2D view of that plane of its image, which + /// a 3D texture of `RenderTarget` usage is made to take; the level's other planes keep their + /// texels. Read of no other type, as Metal ignores it. A 3D texture in a layered pass + /// ([`RenderPassDescriptor::render_target_array_length`] 2 or more) is [`Gap::RenderPass`] of + /// [`RenderPassKind::TextureType`]. + pub depth_plane: u32, /// `loadAction`: `DontCare` by default. pub load_action: LoadAction, /// `storeAction`: `Store` by default. @@ -241,8 +247,8 @@ pub struct RenderPassColorAttachmentDescriptor { /// `resolveSlice`: the resolve texture's array slice or cube face resolved into, the first of a /// layered pass's. pub resolve_slice: u32, - /// `resolveDepthPlane`: a 3D resolve texture's depth plane. A plane but 0 is - /// [`Gap::RenderPass`] of [`RenderPassKind::TextureType`], as a 3D attachment is. + /// `resolveDepthPlane`: a 3D resolve texture's depth plane. A 3D resolve texture, and a plane + /// but 0, are [`Gap::RenderPass`] of [`RenderPassKind::TextureType`]. pub resolve_depth_plane: u32, } @@ -259,7 +265,8 @@ pub struct RenderPassColorAttachmentDescriptor { /// A store action that resolves resolves into `resolve_texture` by `depth_resolve_filter`, as a /// color attachment's resolves (the module's documentation). /// -/// Not built: a 3D texture's `depthPlane`, as a color attachment's. +/// Not built: a 3D texture's `depthPlane`; a depth attachment of a 3D texture is +/// [`Gap::RenderPass`] of [`RenderPassKind::TextureType`]. #[derive(Clone)] pub struct RenderPassDepthAttachmentDescriptor { /// `texture`: the texture whose depth is rendered into; `None` for no depth attachment. It @@ -315,7 +322,7 @@ impl Default for RenderPassDepthAttachmentDescriptor { /// resolves too, both resolve into one view (`VUID-VkRenderingInfo-pDepthAttachment-06086`), else /// [`Gap::RenderPass`] of [`RenderPassKind::Resolve`]. /// -/// Not built: a 3D texture's `depthPlane`, as a color attachment's. +/// Not built: a 3D texture's `depthPlane`, as a depth attachment's. #[derive(Clone)] pub struct RenderPassStencilAttachmentDescriptor { /// `texture`: the texture whose stencil is rendered into; `None` for no stencil attachment. It @@ -492,14 +499,16 @@ impl Resolve { } } -/// The level and layers of `a`, every aspect. +/// The level and layers of `a`, every aspect, as a barrier names them (a 3D image's as +/// [`barrier_layers`] does). fn range(a: &Attachment) -> vk::ImageSubresourceRange { + let [base_array_layer, layer_count] = barrier_layers(a.volume, a.layer, a.layers); vk::ImageSubresourceRange { aspect_mask: a.aspects, base_mip_level: a.level, level_count: 1, - base_array_layer: a.layer, - layer_count: a.layers, + base_array_layer, + layer_count, } } @@ -754,7 +763,7 @@ impl Pass { pixel_format: pf, })); } - let attachment = texture.attachment(c.level, c.slice, layers)?; + let attachment = texture.attachment(c.level, c.slice, Some(c.depth_plane), layers)?; let resolve = match ( resolving(c.store_action, c.resolve_texture.is_some())?, &c.resolve_texture, @@ -818,7 +827,7 @@ impl Pass { pixel_format: pf, })); } - let attachment = texture.attachment(z.level, z.slice, layers)?; + let attachment = texture.attachment(z.level, z.slice, None, layers)?; let resolve = match ( resolving(z.store_action, z.resolve_texture.is_some())?, &z.resolve_texture, @@ -880,7 +889,7 @@ impl Pass { pixel_format: pf, })); } - let attachment = texture.attachment(s.level, s.slice, layers)?; + let attachment = texture.attachment(s.level, s.slice, None, layers)?; let resolve = match ( resolving(s.store_action, s.resolve_texture.is_some())?, &s.resolve_texture, diff --git a/crates/metal2vulkan-runtime/src/render_encoder.rs b/crates/metal2vulkan-runtime/src/render_encoder.rs index 6a892cabd..450cdda5a 100644 --- a/crates/metal2vulkan-runtime/src/render_encoder.rs +++ b/crates/metal2vulkan-runtime/src/render_encoder.rs @@ -55,7 +55,9 @@ //! level and layer the pass cleared, inside Metal's render area, is a clear of the shadow's to the //! pass's clear colour instead, between the same barriers. A memory barrier after draws leaves //! every shadow holding nothing, so the next draw that reads an attachment copies what it reads -//! again, after what the earlier draws rendered; it records nothing itself. +//! again, after what the earlier draws rendered; it records nothing itself. A shadow's copies are +//! of layers, so a draw that reads this way a 3D texture whose depth plane its pass renders is +//! refused ([`DrawKind::AttachmentRead`]). //! //! A `Boolean` or `Counting` visibility result mode counts the draws after it in one precise //! occlusion query, begun before its first draw and ended in the rendering as the next mode set @@ -3027,8 +3029,11 @@ impl RenderCommandEncoder { })); } if !texture.looped() { - // A shadow holds what one layer of its attachment rendered. - if a.layers > 1 { + // A shadow holds what one layer of its attachment rendered, and no depth plane of + // a 3D texture's: its copies are of layers at the plane 0 (`region`). + if a.layers > 1 + || target.texture.descriptor().texture_type == crate::TextureType::Type3D + { return Err(Error::Unsupported(Gap::Draw { kind: DrawKind::AttachmentRead, })); diff --git a/crates/metal2vulkan-runtime/src/tests/depth_planes.rs b/crates/metal2vulkan-runtime/src/tests/depth_planes.rs new file mode 100644 index 000000000..c94f35da9 --- /dev/null +++ b/crates/metal2vulkan-runtime/src/tests/depth_planes.rs @@ -0,0 +1,581 @@ +//! A 3D texture's depth planes as colour attachments, under a device cfg, on every device of the +//! cfg's kind: the passes a browser's GL layer makes on a 3D texture (`texImage3D` of an RGB +//! format, whose alpha it clears through a pass on each plane; `framebufferTextureLayer` of a 3D +//! texture, then a clear or a draw), on the texture its guest makes: `ShaderRead | ShaderWrite | +//! RenderTarget`, Managed. +//! +//! For `RGBA8Unorm` and `RGBA16Float` (the layer's `RGB16F`): an 8 x 8 x 4 texture of two levels +//! (the second 4 x 4 x 2, a level shallower than the first) and an 8 x 8 x 1 one of one level, every +//! plane of every level written first through `replace_region`, each texel naming its level, `x`, +//! `y` and plane. One command buffer then encodes: +//! +//! - level 0's plane 2: `Clear`, and one draw of the top half (the owned `colored_vertex` pair); +//! - level 1's plane 1: the same, on the shallower level; +//! - level 0's plane 0: `Load`, and the same draw; +//! - level 0's plane 1: `Clear` alone, with no draw; +//! - the one-deep texture's plane 0: `Clear` and the draw; +//! +//! then copies every plane of both levels and the one-deep texture into a Shared buffer, and samples +//! each texel's centre through a nearest sampler state (the owned `msf_slot3d_linear_zero`): level +//! 0 through the texture, level 1 through a 3D view of it. Every texel is the texture's own answer, +//! the planes no pass named included. Two passes are refused as they begin: a plane past level 1's +//! depth ([`Refusal::AttachmentPlace`]) and a pass of two layers on a 3D texture +//! ([`RenderPassKind::TextureType`]). +//! +//! Recorded (`tests::layouts`): each rendering's colour attachment on a 3D image is a 2D view of one +//! layer, the plane, at its level, of an image made `VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT`; the +//! run prints them. +//! +//! `llvm-as` assembles the fixtures; without it the test skips visibly. + +use crate::tests::command::on_device::{each_device, finished}; +use crate::tests::draw::on_device::{ + descriptor, examples, floats, library, state, vertices, Buffers, GREEN, +}; +use crate::tests::layouts::{rendered, Recording}; +use crate::texture::TextureObject; +use crate::{ + Buffer, BufferLayout, ComputePipelineDescriptor, ComputePipelineState, Device, DispatchType, + Error, FunctionDescriptor, HostBytes, IndexClass, LoadAction, NumberedSampler, PixelFormat, + PrimitiveType, Region, RenderPassDescriptor, RenderPassKind, RenderPipelineState, + SamplerDescriptor, SamplerState, StageSource, StorageMode, StoreAction, Texture, + TextureDescriptor, TexturePlace, TextureType, TextureUsage, +}; +use crate::{Gap, Refusal}; +use ash::vk::{self, Handle}; +use metal2vulkan_devtools::engine_dir; + +/// The deep texture's extent and levels. +const SIDE: u32 = 8; +const DEPTH: u32 = 4; +const LEVELS: u32 = 2; +/// The guest's usage: `ShaderRead | ShaderWrite | RenderTarget`. +const USAGE: TextureUsage = TextureUsage::SHADER_READ + .union(TextureUsage::SHADER_WRITE) + .union(TextureUsage::RENDER_TARGET); +/// The two clear colours, as numerators of the format's scale. +const CLEAR_A: [u32; 4] = [30, 180, 60, 255]; +const CLEAR_B: [u32; 4] = [200, 20, 120, 255]; +/// The textures each format's cell makes an index for. +const TEXTURES: u32 = 3; + +/// How a format holds a channel. +#[derive(Clone, Copy)] +enum Kind { + Unorm8, + Half, +} + +impl Kind { + /// A texel's bytes. + fn unit(self) -> usize { + match self { + Kind::Unorm8 => 4, + Kind::Half => 8, + } + } + + /// The denominator of the values the test writes: each is a numerator below it over it, which + /// the format holds exactly. + fn scale(self) -> f32 { + match self { + Kind::Unorm8 => 255.0, + Kind::Half => 256.0, + } + } + + /// The bytes of a texel of `color`, a value the format holds exactly. + fn bytes(self, color: [f32; 4]) -> Vec { + match self { + Kind::Unorm8 => color + .iter() + .map(|&c| { + let byte = (c * 255.0).round(); + assert!((c * 255.0 - byte).abs() < 1e-3, "{c} is no unorm8"); + byte as u8 + }) + .collect(), + Kind::Half => color.iter().flat_map(|&c| half(c).to_le_bytes()).collect(), + } + } +} + +/// `x`'s `half` bits, for a value a `half` holds exactly: zero, or a normal one. +fn half(x: f32) -> u16 { + if x == 0.0 { + return 0; + } + let bits = x.to_bits(); + let exponent = ((bits >> 23) & 0xff) as i32 - 127 + 15; + assert!((1..31).contains(&exponent) && bits & 0x1fff == 0, "{x}"); + ((bits >> 16) & 0x8000) as u16 | ((exponent as u16) << 10) | ((bits >> 13) & 0x3ff) as u16 +} + +/// The colour of numerators `n` over `kind`'s scale. +fn color(kind: Kind, n: [u32; 4]) -> [f32; 4] { + n.map(|n| n as f32 / kind.scale()) +} + +/// The texel written first at `(x, y)` of plane `z` of level `level`: each channel names one of +/// them. +fn written(kind: Kind, level: u32, [x, y, z]: [u32; 3]) -> [f32; 4] { + color(kind, [10 * x + level, 10 * y + 3, 40 * z + 5, 200 + level]) +} + +/// What a pass leaves at row `y` of the plane it renders, of a level `side` texels high: the draw's +/// green over the top half where it draws, else its clear colour, or what was there for a `Load`. +fn passed(drawn: bool, clear: Option<[f32; 4]>, side: u32, y: u32, before: [f32; 4]) -> [f32; 4] { + match (drawn && y < side / 2, clear) { + (true, _) => GREEN, + (false, Some(clear)) => clear, + (false, None) => before, + } +} + +/// One pass on a texture: its level and plane, its load action's clear colour (`None` for `Load`) +/// and whether it draws. +struct Planed<'a> { + texture: &'a Texture, + level: u32, + plane: u32, + clear: Option<[f32; 4]>, + drawn: bool, +} + +/// The extent of level `level` of `texture`. +fn extent(texture: &Texture, level: u32) -> [u32; 3] { + let d = texture.descriptor(); + [d.width, d.height, d.depth].map(|e| (e >> level).max(1)) +} + +/// Every texel of level `level` of `texture` once `passes` ran, plane by plane, row by row. +fn want(kind: Kind, texture: &Texture, level: u32, passes: &[Planed<'_>]) -> Vec<[f32; 4]> { + let [w, h, d] = extent(texture, level); + let mut texels = Vec::new(); + for z in 0..d { + for y in 0..h { + for x in 0..w { + let mut texel = written(kind, level, [x, y, z]); + let named = (passes.iter()).filter(|p| { + p.texture.image() == texture.image() && p.level == level && p.plane == z + }); + for p in named { + texel = passed(p.drawn, p.clear, h, y, texel); + } + texels.push(texel); + } + } + } + texels +} + +/// A Shared buffer's bytes, as the host reads them. +fn read(buffer: &Buffer) -> Vec { + let contents = buffer.contents().expect("a Shared buffer"); + // SAFETY: the buffer is alive, `length` bytes long, and no GPU work uses it. + unsafe { std::slice::from_raw_parts(contents.as_ptr(), buffer.length() as usize) }.to_vec() +} + +/// The 32-bit floats of `bytes`. +fn floats_of(bytes: &[u8]) -> Vec { + let (words, _) = bytes.as_chunks::<4>(); + words.iter().map(|word| f32::from_le_bytes(*word)).collect() +} + +/// Panics, naming the first texel and how many differ, where `got` is not `want`. +fn exact(name: &str, what: &str, got: &[T], want: &[T]) { + assert_eq!(got.len(), want.len(), "{name}: {what}: the texels read"); + let differ: Vec = (0..got.len()).filter(|&i| got[i] != want[i]).collect(); + if let Some(&first) = differ.first() { + panic!( + "{name}: {what}: {} of {} texels differ, the first (texel {first}): {:?}, not {:?}", + differ.len(), + got.len(), + got[first], + want[first] + ); + } +} + +/// `msf_slot3d_linear_zero`'s state, its constexpr sampler numbered `constexpr`. +fn sampling(name: &str, device: &Device, constexpr: u32) -> Option { + let library = library(&engine_dir().join("msf_runtime_samplers.ll"))?; + let function = (library.function("msf_slot3d_linear_zero")).expect("the kernel"); + let descriptor = + ComputePipelineDescriptor::new(StageSource::Function(FunctionDescriptor::new(function))); + let state = device.new_compute_pipeline_state(&descriptor, |samplers| { + assert!( + matches!(samplers, [NumberedSampler::Constexpr(_)]), + "{name}: {samplers:?}" + ); + Ok(vec![constexpr]) + }); + Some(state.unwrap_or_else(|error| panic!("{name}: msf_slot3d_linear_zero: {error}"))) +} + +/// What one device needs for every format: the draw's vertices, the sampling kernel and its +/// sampler state. +struct Shared<'a> { + device: &'a Device, + sampler: &'a SamplerState, + kernel: &'a ComputePipelineState, + vertices: &'a (Buffer, Buffer), +} + +/// The cell for `pf` held as `kind` with the draw `drawn`, its textures at indices from `first`. +fn cell( + name: &str, + shared: &Shared<'_>, + (drawn, first): (&RenderPipelineState, u32), + pf: PixelFormat, + kind: Kind, +) { + let Shared { + device, + sampler, + kernel, + vertices: (positions, colors), + } = shared; + let name = &format!("{name}: {pf:?}"); + let texture = |depth: u32, levels: u32, index: u32| { + let mut d = TextureDescriptor::new(TextureType::Type3D, pf, SIDE, SIDE); + d.depth = depth; + d.mipmap_level_count = levels; + d.usage = USAGE; + d.storage_mode = StorageMode::Managed; + let texture = + (device.new_texture(&d, Some(index))).unwrap_or_else(|error| panic!("{name}: {error}")); + for level in 0..levels { + let size = extent(&texture, level); + let [w, h, d] = size; + let bytes: Vec = (0..d) + .flat_map(|z| (0..h).flat_map(move |y| (0..w).map(move |x| [x, y, z]))) + .flat_map(|at| kind.bytes(written(kind, level, at))) + .collect(); + let row = u64::from(w) * kind.unit() as u64; + let region = Region { + origin: [0; 3], + size, + }; + let image = row * u64::from(h); + let bytes = HostBytes::from(&bytes[..]); + (texture.replace_region(region, level, 0, bytes, row, image)) + .unwrap_or_else(|error| panic!("{name}: level {level}: {error}")); + } + texture + }; + let deep = texture(DEPTH, LEVELS, first); + let flat = texture(1, 1, first + 1); + let second = (deep.new_texture_view(pf, TextureType::Type3D, 1..2, 0..1, Some(first + 2))) + .unwrap_or_else(|error| panic!("{name}: the view of level 1: {error}")); + + let [a, b] = [CLEAR_A, CLEAR_B].map(|n| color(kind, n)); + let passes = [ + Planed { + texture: &deep, + level: 0, + plane: 2, + clear: Some(a), + drawn: true, + }, + Planed { + texture: &deep, + level: 1, + plane: 1, + clear: Some(a), + drawn: true, + }, + Planed { + texture: &deep, + level: 0, + plane: 0, + clear: None, + drawn: true, + }, + Planed { + texture: &deep, + level: 0, + plane: 1, + clear: Some(b), + drawn: false, + }, + Planed { + texture: &flat, + level: 0, + plane: 0, + clear: Some(a), + drawn: true, + }, + ]; + let attachment = |p: &Planed<'_>| { + let mut d = RenderPassDescriptor::default(); + let c = &mut d.color_attachments[0]; + c.texture = Some(p.texture.clone()); + c.level = p.level; + c.depth_plane = p.plane; + c.store_action = StoreAction::Store; + match p.clear { + Some([red, green, blue, alpha]) => { + c.load_action = LoadAction::Clear; + c.clear_color = crate::ClearColor::new( + f64::from(red), + f64::from(green), + f64::from(blue), + f64::from(alpha), + ); + } + None => c.load_action = LoadAction::Load, + } + d + }; + + let queue = device.new_command_queue(4).expect("a queue"); + // Refused as they begin: a plane past level 1's two, and a pass of two layers. + let refused = queue.command_buffer().expect("a command buffer"); + let mut past = attachment(&passes[1]); + past.color_attachments[0].depth_plane = 2; + match refused.render_command_encoder(&past) { + Err(Error::Refused(Refusal::AttachmentPlace { level: 1, slice: 2 })) => {} + Err(error) => panic!("{name}: a plane past the level's depth: {error}"), + Ok(_) => panic!("{name}: a plane past the level's depth began"), + } + let mut layered = attachment(&passes[0]); + layered.render_target_array_length = 2; + match refused.render_command_encoder(&layered) { + Err(Error::Unsupported(Gap::RenderPass { + kind: RenderPassKind::TextureType, + })) => {} + Err(error) => panic!("{name}: a layered pass on a 3D texture: {error}"), + Ok(_) => panic!("{name}: a layered pass on a 3D texture began"), + } + drop(refused); + + let handle = device.core().device.handle(); + let before = rendered(handle).len(); + let command_buffer = queue.command_buffer().expect("a command buffer"); + let ok = |result: Result<(), Error>, what: &str| { + result.unwrap_or_else(|error| panic!("{name}: {what}: {error}")) + }; + for p in &passes { + let what = format!("level {}'s plane {}", p.level, p.plane); + let mut encoder = (command_buffer.render_command_encoder(&attachment(p))) + .unwrap_or_else(|error| panic!("{name}: {what}: {error}")); + if p.drawn { + ok(encoder.set_render_pipeline_state(drawn), "the state"); + ok( + encoder.set_vertex_buffer(Some(positions), 0, 0), + "positions", + ); + ok(encoder.set_vertex_buffer(Some(colors), 0, 1), "colours"); + ok( + encoder.draw_primitives(PrimitiveType::Triangle, 0, 3, 1, 0), + &what, + ); + } + encoder.end_encoding(); + } + + // Every plane of both levels and of the one-deep texture, out; then each texel sampled. + let levels = [(&deep, 0, &deep), (&deep, 1, &second), (&flat, 0, &flat)]; + let mut buffers = Buffers::sized(device, 1 << 20); + let unit = kind.unit() as u64; + let outs: Vec = (levels.iter()) + .map(|&(texture, level, _)| { + let [w, h, d] = extent(texture, level); + buffers.of(device, &vec![0xee; (unit * u64::from(w * h * d)) as usize]) + }) + .collect(); + let mut blit = + (command_buffer.blit_command_encoder()).unwrap_or_else(|error| panic!("{name}: {error}")); + for (&(texture, level, _), out) in levels.iter().zip(&outs) { + let size = extent(texture, level); + let layout = BufferLayout { + offset: 0, + bytes_per_row: unit * u64::from(size[0]), + bytes_per_image: unit * u64::from(size[0] * size[1]), + }; + let from = TexturePlace { + slice: 0, + level, + origin: [0; 3], + }; + ok( + blit.copy_from_texture_to_buffer(texture, from, size, out, layout), + "a level out", + ); + } + blit.end_encoding(); + let lanes_of = |&(texture, level, _): &(&Texture, u32, &Texture)| { + let [w, h, d] = extent(texture, level); + w * h * d + }; + let samples: Vec<(Buffer, Buffer)> = (levels.iter()) + .map(|level| { + let [w, h, d] = extent(level.0, level.1); + let centre = |c: u32, n: u32| (c as f32 + 0.5) / n as f32; + let coords: Vec = (0..d) + .flat_map(|z| (0..h).flat_map(move |y| (0..w).map(move |x| [x, y, z]))) + .flat_map(|[x, y, z]| [centre(x, w), centre(y, h), centre(z, d), 0.0]) + .collect(); + let lanes = lanes_of(level) as usize; + ( + buffers.of(device, &floats(&coords)), + buffers.of(device, &vec![0xee; 32 * lanes]), + ) + }) + .collect(); + let mut encoder = (command_buffer.compute_command_encoder(DispatchType::Serial)) + .unwrap_or_else(|error| panic!("{name}: {error}")); + ok(encoder.set_compute_pipeline_state(kernel), "the kernel"); + ok(encoder.set_sampler_state(Some(*sampler), 0), "the sampler"); + for (level, (coords, out)) in levels.iter().zip(&samples) { + ok(encoder.set_texture(Some(level.2), 0), "the sampled texture"); + ok(encoder.set_buffer(Some(coords), 0, 0), "the lanes"); + ok(encoder.set_buffer(Some(out), 0, 1), "the answers"); + ok( + encoder.dispatch_threads([lanes_of(level), 1, 1], [32, 1, 1]), + "the dispatch", + ); + } + encoder.end_encoding(); + command_buffer.commit().expect("a commit"); + finished(name, &command_buffer); + assert_eq!(command_buffer.error(), None, "{name}"); + + for (((&(texture, level, _), out), (_, sampled)), what) in levels + .iter() + .zip(&outs) + .zip(&samples) + .zip(["level 0", "level 1", "the one-deep texture"]) + { + let want = want(kind, texture, level, &passes); + let bytes: Vec = want.iter().flat_map(|&t| kind.bytes(t)).collect(); + exact(name, &format!("{what}, copied out"), &read(out), &bytes); + // Each lane's answer through the nearest sampler state, the second of its two, as the + // format's bytes. + let answers = floats_of(&read(sampled)); + let got: Vec> = (0..want.len()) + .map(|lane| { + let at = 8 * lane + 4; + let texel = [0, 1, 2, 3].map(|c| answers[at + c]); + kind.bytes(texel.map(|c| (c * kind.scale()).round() / kind.scale())) + }) + .collect(); + let samples_want: Vec> = want.iter().map(|&t| kind.bytes(t)).collect(); + exact(name, &format!("{what}, sampled"), &got, &samples_want); + // The raw answers, bit for bit, where the format's values are a half's. + if let Kind::Half = kind { + let raw: Vec<[u32; 4]> = (0..want.len()) + .map(|lane| [0, 1, 2, 3].map(|c| answers[8 * lane + 4 + c].to_bits())) + .collect(); + let raw_want: Vec<[u32; 4]> = want.iter().map(|t| t.map(f32::to_bits)).collect(); + exact(name, &format!("{what}, sampled raw"), &raw, &raw_want); + } + } + + // What ran: each pass's colour attachment, as recorded. + let attachments: Vec<_> = rendered(handle).into_iter().skip(before).collect(); + assert_eq!( + attachments.len(), + passes.len(), + "{name}: one rendering a pass" + ); + let mut shown = Vec::new(); + for (p, a) in passes.iter().zip(&attachments) { + assert_eq!( + a.image.as_raw(), + p.texture.image().as_raw(), + "{name}: the attachment's image" + ); + assert_eq!( + a.image_type.as_raw(), + vk::ImageType::TYPE_3D.as_raw(), + "{name}: the image type" + ); + assert!( + a.flags + .contains(vk::ImageCreateFlags::TYPE_2D_ARRAY_COMPATIBLE), + "{name}: the image's flags {:#x}", + a.flags.as_raw() + ); + let r = a.range; + assert_eq!( + ( + a.view_type.as_raw(), + r.base_mip_level, + r.level_count, + r.base_array_layer, + r.layer_count + ), + (vk::ImageViewType::TYPE_2D.as_raw(), p.level, 1, p.plane, 1), + "{name}: level {}'s plane {}: the view", + p.level, + p.plane + ); + shown.push(format!( + "level {} plane {} ({}): a 2D view (VkImageViewType {}), base level {}, base layer \ + {}, {} layer, of a 3D image (VkImageType {}) made with flags {:#x} \ + (2D_ARRAY_COMPATIBLE among them)", + p.level, + p.plane, + match (p.clear, p.drawn) { + (Some(_), true) => "clear and draw", + (Some(_), false) => "clear", + (None, _) => "load and draw", + }, + a.view_type.as_raw(), + r.base_mip_level, + r.base_array_layer, + r.layer_count, + a.image_type.as_raw(), + a.flags.as_raw() + )); + } + println!( + "{name}: {SIDE} x {SIDE} x {DEPTH} of {LEVELS} levels and {SIDE} x {SIDE} x 1, {USAGE:?}, \ + Managed: {}; every plane of both levels and of the one-deep texture exact, copied out \ + and sampled at each texel's centre through a nearest sampler state", + shown.join("; ") + ); +} + +#[test] +fn every_device_renders_into_one_depth_plane_of_a_3d_texture_and_keeps_the_others() { + let Some(examples) = examples() else { + return; + }; + let _recording = Recording::start(); + each_device("depth_planes", |name, _, device| { + let at = IndexClass::Sampler.range().start; + let _samplers = (device.grant_indices(IndexClass::Sampler, at, 2)) + .unwrap_or_else(|error| panic!("{name}: {error}")); + let Some(kernel) = sampling(name, &device, at) else { + return; + }; + let first = IndexClass::Texture.range().start; + let _textures = (device.grant_indices(IndexClass::Texture, first, 2 * TEXTURES)) + .unwrap_or_else(|error| panic!("{name}: {error}")); + let sampler = (device.new_sampler_state(&SamplerDescriptor::new(), at + 1)) + .unwrap_or_else(|error| panic!("{name}: {error}")); + let mut buffers = Buffers::new(&device); + let vertices = vertices(&device, &mut buffers); + let shared = Shared { + device: &device, + sampler: &sampler, + kernel: &kernel, + vertices: &vertices, + }; + let formats = [ + (PixelFormat::RGBA8Unorm, Kind::Unorm8), + (PixelFormat::RGBA16Float, Kind::Half), + ]; + for (n, (pf, kind)) in (0..).zip(formats) { + let drawn = state( + name, + &device, + &descriptor(&examples, "colored_fragment", pf), + ); + cell(name, &shared, (&drawn, first + n * TEXTURES), pf, kind); + } + }); +} diff --git a/crates/metal2vulkan-runtime/src/tests/floor.rs b/crates/metal2vulkan-runtime/src/tests/floor.rs index 251aa179c..4e2c4a688 100644 --- a/crates/metal2vulkan-runtime/src/tests/floor.rs +++ b/crates/metal2vulkan-runtime/src/tests/floor.rs @@ -1185,6 +1185,7 @@ fn a_device_that_lists_the_portability_subset_is_asked_for_its_features() { feature(PORTABILITY_FEATURES, "imageViewFormatSwizzle"), feature(PORTABILITY_FEATURES, "mutableComparisonSamplers"), feature(PORTABILITY_FEATURES, "multisampleArrayImage"), + feature(PORTABILITY_FEATURES, "imageView2DOn3DImage"), ] ); @@ -1197,6 +1198,7 @@ fn a_device_that_lists_the_portability_subset_is_asked_for_its_features() { reported.image_view_format_swizzle = vk::TRUE; reported.mutable_comparison_samplers = vk::TRUE; reported.multisample_array_image = vk::TRUE; + reported.image_view2_d_on3_d_image = vk::TRUE; let capabilities = decide(&device).unwrap_or_else(|below| panic!("{below}")); assert!(capabilities.extensions.contains(&subset)); let enabled = capabilities.features.portability; @@ -1205,10 +1207,11 @@ fn a_device_that_lists_the_portability_subset_is_asked_for_its_features() { enabled.image_view_format_swizzle, enabled.mutable_comparison_samplers, enabled.multisample_array_image, + enabled.image_view2_d_on3_d_image, enabled.constant_alpha_color_blend_factors, enabled.events, ), - (vk::TRUE, vk::TRUE, vk::TRUE, vk::FALSE, vk::FALSE) + (vk::TRUE, vk::TRUE, vk::TRUE, vk::TRUE, vk::FALSE, vk::FALSE) ); } @@ -1238,6 +1241,7 @@ fn the_translator_sees_the_portability_subset_device_creation_enables() { VkFeature::ImageViewFormatSwizzle, VkFeature::MutableComparisonSamplers, VkFeature::MultisampleArrayImage, + VkFeature::ImageView2DOn3DImage, ] { assert!(enables.features.contains(&feature), "{feature:?}"); } @@ -2246,7 +2250,7 @@ fn every_device_the_loader_lists_is_above_the_floor() { {}; queue family {}; Private memory type {} (flags {:#x}), Shared memory type {} \ (flags {:#x}), ring memory type {} (flags {:#x}); extensions enabled {:?}; \ portability features enabled: imageViewFormatSwizzle {}, \ - mutableComparisonSamplers {}, multisampleArrayImage {}", + mutableComparisonSamplers {}, multisampleArrayImage {}, imageView2DOn3DImage {}", capabilities.float16, capabilities.storage_read_without_format, capabilities.buffer_int64_atomics, @@ -2265,7 +2269,8 @@ fn every_device_the_loader_lists_is_above_the_floor() { .features .portability .mutable_comparison_samplers, - capabilities.features.portability.multisample_array_image + capabilities.features.portability.multisample_array_image, + capabilities.features.portability.image_view2_d_on3_d_image ); println!( "floor: {name}: attachment reads {}, through the feedback loop {}", diff --git a/crates/metal2vulkan-runtime/src/tests/layouts.rs b/crates/metal2vulkan-runtime/src/tests/layouts.rs index 6e134b11f..363f4df12 100644 --- a/crates/metal2vulkan-runtime/src/tests/layouts.rs +++ b/crates/metal2vulkan-runtime/src/tests/layouts.rs @@ -3,7 +3,8 @@ //! module's own for each core command rt records that names an image layout (its barriers, its //! copies between images and buffers, its blits, its colour clears, dynamic rendering's //! attachments and its descriptor writes), each noting the layouts it names, then calling the -//! driver's. Its copies between images keep each region's aspects too ([`image_copies`]). Its barrier commands are counted too. The core commands that name a layout and that rt does not record get no entry, so +//! driver's. Its copies between images keep each region's aspects too ([`image_copies`]), and its +//! renderings each colour attachment's view and image as made ([`rendered`]). Its barrier commands are counted too. The core commands that name a layout and that rt does not record get no entry, so //! that a call of one panics (ash's stub for a command it did not load) and the test learns of it. //! //! Each command buffer's barriers, copies to a buffer and timestamp writes are kept in the order @@ -134,8 +135,13 @@ struct Record { drivers: HashMap, /// Each command buffer's device. devices: HashMap, - /// Each image view's image. - views: HashMap<(vk::Device, vk::ImageView), vk::Image>, + /// Each image view's image, type and range. + views: HashMap< + (vk::Device, vk::ImageView), + (vk::Image, vk::ImageViewType, vk::ImageSubresourceRange), + >, + /// Each image's type and create flags, as made while recording. + made: HashMap<(vk::Device, vk::Image), (vk::ImageType, vk::ImageCreateFlags)>, /// Each queue's device. queues: HashMap, /// Each command buffer's steps since its begin, in the order recorded. @@ -151,6 +157,21 @@ struct Record { submitted: HashMap>>, /// Every copy between images recorded, in the order recorded. copies: Vec, + /// Every colour attachment of a rendering recorded whose view and image were made while + /// recording, in the order recorded. + rendered: Vec, +} + +/// A colour attachment a `vkCmdBeginRendering` of `device` named: its view's type and range, and +/// its image's type and create flags. +#[derive(Clone, Copy)] +pub(crate) struct Rendered { + pub(crate) device: vk::Device, + pub(crate) image: vk::Image, + pub(crate) image_type: vk::ImageType, + pub(crate) flags: vk::ImageCreateFlags, + pub(crate) view_type: vk::ImageViewType, + pub(crate) range: vk::ImageSubresourceRange, } /// A `vkCmdCopyImage` of `device`: its images, the layouts it names them in and each region's @@ -196,6 +217,14 @@ pub(crate) fn image_copies(device: vk::Device) -> Vec { .collect() } +/// Every colour attachment `device`'s renderings named so far, in the order recorded. +pub(crate) fn rendered(device: vk::Device) -> Vec { + (record().rendered.iter()) + .filter(|rendered| rendered.device == device) + .copied() + .collect() +} + /// `device`'s images' moves so far, in the order its queue ran its command buffers. pub(crate) fn moves(device: vk::Device) -> Moves { record().moves.get(&device).cloned().unwrap_or_default() @@ -403,7 +432,10 @@ fn note( /// The image of `view` of `device`, where the record knows it. fn image_of(device: vk::Device, view: vk::ImageView) -> Option { - record().views.get(&(device, view)).copied() + record() + .views + .get(&(device, view)) + .map(|&(image, _, _)| image) } /// A slice of `count` elements at `pointer`, empty where it is null. @@ -462,9 +494,11 @@ unsafe extern "system" fn create_image( // SAFETY: the caller's arguments, passed on. let result = unsafe { (driver.create_image)(device, info, allocator, image) }; if result == vk::Result::SUCCESS { - // SAFETY: the call wrote the image. - let image = unsafe { *image }; - record().homed.insert((device, image), false); + // SAFETY: the call wrote the image, of the caller's info. + let (image, info) = unsafe { (*image, &*info) }; + let mut record = record(); + record.homed.insert((device, image), false); + (record.made).insert((device, image), (info.image_type, info.flags)); } result } @@ -523,9 +557,10 @@ unsafe extern "system" fn create_image_view( // SAFETY: the caller's arguments, passed on. let result = unsafe { (driver.create_image_view)(device, info, allocator, view) }; if result == vk::Result::SUCCESS { - // SAFETY: the call wrote the view, of the info's image. - let (view, image) = unsafe { (*view, (*info).image) }; - record().views.insert((device, view), image); + // SAFETY: the call wrote the view, of the caller's info. + let (view, info) = unsafe { (*view, &*info) }; + let viewed = (info.image, info.view_type, info.subresource_range); + record().views.insert((device, view), viewed); } result } @@ -813,6 +848,26 @@ unsafe extern "system" fn cmd_begin_rendering( .map(|&(what, image, _)| (image, Step::Use(what))); step(command_buffer, used.collect::>()); note(device, named); + { + let mut record = record(); + for attachment in colors { + let Some(&(image, view_type, range)) = + record.views.get(&(device, attachment.image_view)) + else { + continue; + }; + if let Some(&(image_type, flags)) = record.made.get(&(device, image)) { + record.rendered.push(Rendered { + device, + image, + image_type, + flags, + view_type, + range, + }); + } + } + } // SAFETY: the caller's arguments, passed on. unsafe { (driver.cmd_begin_rendering)(command_buffer, info) } } diff --git a/crates/metal2vulkan-runtime/src/tests/mod.rs b/crates/metal2vulkan-runtime/src/tests/mod.rs index bb5c4d5c0..8e34b8b4d 100644 --- a/crates/metal2vulkan-runtime/src/tests/mod.rs +++ b/crates/metal2vulkan-runtime/src/tests/mod.rs @@ -23,6 +23,8 @@ mod cube_views; mod d3d11; mod deep_threadgroups; #[cfg(any(m2v_gpu, m2v_cpu_icd))] +mod depth_planes; +#[cfg(any(m2v_gpu, m2v_cpu_icd))] mod depth_stencil_copy; #[cfg(any(m2v_gpu, m2v_cpu_icd))] mod depth_stencil_route; diff --git a/crates/metal2vulkan-runtime/src/texture.rs b/crates/metal2vulkan-runtime/src/texture.rs index 322619876..a616696fc 100644 --- a/crates/metal2vulkan-runtime/src/texture.rs +++ b/crates/metal2vulkan-runtime/src/texture.rs @@ -322,6 +322,7 @@ impl ShadowView { /// An image view of one level and layer of a texture's image, for render passes. struct AttachmentView { level: u32, + /// Its first layer: a slice, or a 3D image's depth plane. layer: u32, layers: u32, view: vk::ImageView, @@ -351,6 +352,8 @@ pub(crate) struct Attachment { /// The image renders as a linear colour attachment alone (`Image::linear_attachment`), so a /// pass renders it only beside other such images ([`Gap::LinearPlanePass`]). pub(crate) linear: bool, + /// The image is 3D: a barrier names its one layer ([`barrier_layers`]). + pub(crate) volume: bool, } /// A texture's bytes in a buffer, which [`Texture::replace_region`] and [`Texture::get_bytes`] @@ -2044,7 +2047,10 @@ impl Plan { } /// The image's create flags over `shape`'s: mutable where it lists formats for its views, - /// cube-compatible where the plan makes it so, and of extended usage where it is extended. + /// cube-compatible where the plan makes it so, of extended usage where it is extended, and + /// 2D-array-compatible where it is a 3D image of the colour attachment usage, so that a pass + /// renders into one depth plane of a level through a 2D view of it + /// ([`TextureObject::attachment`]): `VUID-VkImageViewCreateInfo-image-06728`. fn flags(&self, shape: &Shape) -> vk::ImageCreateFlags { let mut flags = shape.flags; if !self.view_formats.is_empty() { @@ -2056,6 +2062,11 @@ impl Plan { if self.extended { flags |= vk::ImageCreateFlags::EXTENDED_USAGE; } + if shape.image_type == vk::ImageType::TYPE_3D + && self.usage.contains(vk::ImageUsageFlags::COLOR_ATTACHMENT) + { + flags |= vk::ImageCreateFlags::TYPE_2D_ARRAY_COMPATIBLE; + } flags } @@ -2066,6 +2077,20 @@ impl Plan { } } +/// The first layer and the layer count a barrier names on a texture's image from `layer`, `count` +/// of them, where `volume` says the image is 3D: a 3D image's one layer as 0 and +/// `VK_REMAINING_ARRAY_LAYERS`. A 3D render target's image is 2D-array-compatible ([`Plan`]'s +/// flags), and a barrier's layers on such an image name every depth slice of its levels while the +/// maintenance9 feature is off, as the runtime leaves it, but one slice each once it is on +/// (`VUID-VkImageMemoryBarrier2-subresourceRange-01488`, `-maintenance9-10798`); the remaining +/// count names the whole level either way. +pub(crate) fn barrier_layers(volume: bool, layer: u32, count: u32) -> [u32; 2] { + match volume { + true => [0, vk::REMAINING_ARRAY_LAYERS], + false => [layer, count], + } +} + /// The slices of each level of a texture of descriptor `d`: a cube's six faces each a slice, and /// one for a 3D texture. fn slices(d: &TextureDescriptor) -> u32 { @@ -3779,6 +3804,8 @@ impl TextureInner { new: vk::ImageLayout, ) -> vk::ImageMemoryBarrier2<'static> { let image = self.imaged(); + let volume = self.descriptor.texture_type == TextureType::Type3D; + let [base_array_layer, layer_count] = barrier_layers(volume, placed.layer, 1); vk::ImageMemoryBarrier2::default() .old_layout(old) .new_layout(new) @@ -3789,8 +3816,8 @@ impl TextureInner { aspect_mask: image.aspects, base_mip_level: placed.level, level_count: 1, - base_array_layer: placed.layer, - layer_count: 1, + base_array_layer, + layer_count, }) } @@ -4050,6 +4077,9 @@ impl TextureInner { let [level, layer] = self.base(); let image = self.imaged(); let home = image.home; + let d = &self.descriptor; + let [base_array_layer, layer_count] = + barrier_layers(d.texture_type == TextureType::Type3D, layer, slices(d)); vk::ImageMemoryBarrier2::default() .old_layout(old.unwrap_or(home)) .new_layout(new.unwrap_or(home)) @@ -4060,8 +4090,8 @@ impl TextureInner { aspect_mask: image.aspects, base_mip_level: level + levels.start, level_count: levels.end - levels.start, - base_array_layer: layer, - layer_count: slices(&self.descriptor), + base_array_layer, + layer_count, }) } } @@ -4947,12 +4977,14 @@ pub(crate) trait TextureObject { Some(view) => &view.parent.descriptor, None => &self.object().descriptor, }; + let volume = root.texture_type == TextureType::Type3D; + let [base_array_layer, layer_count] = barrier_layers(volume, 0, slices(root)); vk::ImageSubresourceRange { aspect_mask: self.object().imaged().aspects, base_mip_level: 0, level_count: root.mipmap_level_count, - base_array_layer: 0, - layer_count: slices(root), + base_array_layer, + layer_count, } } @@ -4987,21 +5019,33 @@ pub(crate) trait TextureObject { /// `level` and the `layers` slices from `slice` of the texture as a render pass attachment: /// the image view of that one level and those layers of its image (a 2D view of one layer, a /// 2D array view of more), every aspect, with the identity swizzle, made at the first pass - /// that renders into it and kept with the texture. + /// that renders into it and kept with the texture. A 3D texture's attachment, where the + /// attachment takes a depth plane (`plane`, a color attachment's `depthPlane`) and the pass + /// renders one layer, is that plane of the level: a 2D view of the plane, which its image's + /// 2D-array compatibility gives (`Plan::flags`); `plane` is read of no other type, as Metal + /// ignores it. /// /// Err: [`Refusal::AttachmentUsage`] for a texture made without `RenderTarget` usage; /// [`Gap::RenderPass`] of [`RenderPassKind::TextureType`] for one but a 2D texture, a 2D - /// array, a cube, a cube array or a 2D multisample texture or array; + /// array, a cube, a cube array, a 2D multisample texture or array, or a 3D texture where the + /// attachment takes a depth plane and the pass renders one layer; /// [`Refusal::AttachmentPlace`] for a level or slice past the texture's, the last of the - /// `layers` slices included; [`Error::Vulkan`] where the view cannot be made. - fn attachment(&self, level: u32, slice: u32, layers: u32) -> Result { + /// `layers` slices included, or a depth plane past its level's depth; [`Error::Vulkan`] where + /// the view cannot be made. + fn attachment( + &self, + level: u32, + slice: u32, + plane: Option, + layers: u32, + ) -> Result { let d = &self.object().descriptor; if !d.usage.is_empty() && !d.usage.contains(TextureUsage::RENDER_TARGET) { return Err(Error::Refused(Refusal::AttachmentUsage { pixel_format: d.pixel_format, })); } - self.attachment_view(level, slice, layers) + self.attachment_view(level, slice, plane, layers) } /// `level` and the `layers` slices from `slice` of the texture as a pass's resolve @@ -5022,7 +5066,9 @@ pub(crate) trait TextureObject { /// the device's optimal image does not render, a texture in place over a dma-buf's import, and /// a view of another format of a texture in place whose linear image takes none; /// [`Refusal::AttachmentPlace`] past a texture over a buffer's one level and slice; - /// [`Error::Vulkan`] where its resolve image cannot be made; as [`attachment`] for the rest. + /// [`Error::Vulkan`] where its resolve image cannot be made; as [`attachment`] of no depth + /// plane for the rest, so a 3D texture is [`Gap::RenderPass`] of + /// [`RenderPassKind::TextureType`]. /// /// [`attachment`]: TextureObject::attachment fn resolve_attachment( @@ -5036,7 +5082,7 @@ pub(crate) trait TextureObject { let object = self.object(); let image = object.image_of(); if image.is_some_and(|image| image.usage.intersects(renders)) { - return Ok((self.attachment_view(level, slice, layers)?, None)); + return Ok((self.attachment_view(level, slice, None, layers)?, None)); } let gap = || { Error::Unsupported(Gap::RenderPass { @@ -5106,6 +5152,7 @@ pub(crate) trait TextureObject { level: 0, layer: 0, layers: 1, + volume: false, aspects: vk::ImageAspectFlags::COLOR, // Where each pass leaves it, for its copy (`pass::Resolve::from`). home: vk::ImageLayout::TRANSFER_SRC_OPTIMAL, @@ -5123,25 +5170,35 @@ pub(crate) trait TextureObject { Ok((attachment, Some(copy))) } - /// `level` and the `layers` slices from `slice` of the texture as a render pass attachment, - /// as [`attachment`] views them, whatever its usage: the caller checked that its image has - /// the attachment usage. + /// `level` and the `layers` slices from `slice` of the texture, or a 3D texture's depth plane + /// `plane`, as a render pass attachment, as [`attachment`] views them, whatever its usage: the + /// caller checked that its image has the attachment usage. /// /// Err: as [`attachment`] but [`Refusal::AttachmentUsage`]. /// /// [`attachment`]: TextureObject::attachment - fn attachment_view(&self, level: u32, slice: u32, layers: u32) -> Result { + fn attachment_view( + &self, + level: u32, + slice: u32, + plane: Option, + layers: u32, + ) -> Result { let d = &self.object().descriptor; let gap = |kind| Err(Error::Unsupported(Gap::RenderPass { kind })); - match d.texture_type { - TextureType::Type2D - | TextureType::Type2DArray - | TextureType::Cube - | TextureType::CubeArray - | TextureType::Type2DMultisample - | TextureType::Type2DMultisampleArray => {} + let plane = match (d.texture_type, plane) { + ( + TextureType::Type2D + | TextureType::Type2DArray + | TextureType::Cube + | TextureType::CubeArray + | TextureType::Type2DMultisample + | TextureType::Type2DMultisampleArray, + _, + ) => None, + (TextureType::Type3D, Some(plane)) if layers == 1 => Some(plane), _ => return gap(RenderPassKind::TextureType), - } + }; if level >= d.mipmap_level_count || slice >= slices(d) { return Err(Error::Refused(Refusal::AttachmentPlace { level, slice })); } @@ -5151,8 +5208,20 @@ pub(crate) trait TextureObject { slice: slice + layers - 1, })); } + // A 3D texture's depth plane lies in its level's depth (Vulkan's image mip level sizing: + // `VUID-VkImageViewCreateInfo-image-02724`). + if let Some(plane) = plane.filter(|&plane| plane >= (d.depth >> level).max(1)) { + return Err(Error::Refused(Refusal::AttachmentPlace { + level, + slice: plane, + })); + } let [first_level, first_layer] = TextureInner::base(self.object()); let (level_in_image, layer) = (first_level + level, first_layer + slice); + // The view's first layer: the slice's, or a 3D image's depth plane. The attachment's + // layer stays the slice's, the image's one layer of a 3D level, and its barriers name + // that layer as `barrier_layers` does: each moves every plane of the level. + let first = plane.unwrap_or(layer); // The type's check above refused a texture buffer. let image = self.object().imaged(); // A view of another format than the image's renders where the format's features hold an @@ -5171,7 +5240,7 @@ pub(crate) trait TextureObject { }; let mut views = lock(&self.object().attachments); let kept = (views.iter()) - .find(|a| a.level == level_in_image && a.layer == layer && a.layers == layers) + .find(|a| a.level == level_in_image && a.layer == first && a.layers == layers) .map(|a| a.view); let view = match kept { Some(view) => view, @@ -5181,7 +5250,7 @@ pub(crate) trait TextureObject { aspect_mask: image.aspects, base_mip_level: level_in_image, level_count: 1, - base_array_layer: layer, + base_array_layer: first, layer_count: layers, }; let kind = match layers { @@ -5189,8 +5258,10 @@ pub(crate) trait TextureObject { _ => vk::ImageViewType::TYPE_2D_ARRAY, }; // SAFETY: the image is bound, of the texture's format, holds the level and layers - // (the texture's own, which lie in its image), and has the attachment usage its - // render target usage or its resolves gave it (the caller's check). + // (the texture's own, which lie in its image), or the level's depth plane, of a 3D + // image of the attachment usage, which its plan made 2D-array-compatible + // (`Plan::flags`), and has the attachment usage its render target usage or its + // resolves gave it (the caller's check). let view = unsafe { image_view( core, @@ -5205,7 +5276,7 @@ pub(crate) trait TextureObject { core.counters.rise(Gauge::AttachmentViews); views.push(AttachmentView { level: level_in_image, - layer, + layer: first, layers, view, }); @@ -5218,6 +5289,7 @@ pub(crate) trait TextureObject { level: level_in_image, layer, layers, + volume: plane.is_some(), aspects: image.aspects, home: image.home, extent: [(d.width >> level).max(1), (d.height >> level).max(1)], diff --git a/crates/metal2vulkan/tests/api_signatures.tsv b/crates/metal2vulkan/tests/api_signatures.tsv index f7546af21..39d866106 100644 --- a/crates/metal2vulkan/tests/api_signatures.tsv +++ b/crates/metal2vulkan/tests/api_signatures.tsv @@ -1628,6 +1628,7 @@ field metal2vulkan-runtime::RawDevice.queue_family_index pub queue_family_index: field metal2vulkan-runtime::Region.origin pub origin: [u32; 3] field metal2vulkan-runtime::Region.size pub size: [u32; 3] field metal2vulkan-runtime::RenderPassColorAttachmentDescriptor.clear_color pub clear_color: ClearColor +field metal2vulkan-runtime::RenderPassColorAttachmentDescriptor.depth_plane pub depth_plane: u32 field metal2vulkan-runtime::RenderPassColorAttachmentDescriptor.level pub level: u32 field metal2vulkan-runtime::RenderPassColorAttachmentDescriptor.load_action pub load_action: LoadAction field metal2vulkan-runtime::RenderPassColorAttachmentDescriptor.resolve_depth_plane pub resolve_depth_plane: u32 diff --git a/docs/CONFORMANCE-COVERAGE.md b/docs/CONFORMANCE-COVERAGE.md index cd817b71e..e32063650 100644 --- a/docs/CONFORMANCE-COVERAGE.md +++ b/docs/CONFORMANCE-COVERAGE.md @@ -30,19 +30,19 @@ Its limits, measured rather than asserted: | | | |---|---| -| implemented Metal items | 637 | +| implemented Metal items | 638 | | of those, unreachable: `objc2-metal` binds no name for them | 1 | -| so reachable by some case | 636 | -| of the reachable, exercised by the suite's Metal leg | 558 | +| so reachable by some case | 637 | +| of the reachable, exercised by the suite's Metal leg | 559 | | of the reachable, not exercised | 78 | | share of the reachable exercised | 88% | | of those exercised, no case reaching it loosens anything | 339 | -| of those exercised, a case reaching it loosens some site | 219 | +| of those exercised, a case reaching it loosens some site | 220 | | case modules | 187 | | committed recordings | 1333 | | distinct SDK items the Metal leg reaches, of any status | 812 | | of those, reached only where this cannot name the family | 5 | -| ledger rows (a case whose gap is recorded) | 7991 | +| ledger rows (a case whose gap is recorded) | 7979 | | declared crossings of the option space (pairs put to Metal at once) | 26 | | declared crossings that are no pair of it (a boolean or numeric field, or one type in two slots) | 30 | @@ -417,7 +417,7 @@ Every container with an implemented item, by how much of it the suite reaches. * | `MTLObjectPayloadBinding` | 3 | 0 | 3 | 0 | `fragment_imageblock_reflection`, `function_bindings`, `mesh_pipeline_reflection`, `pipeline_option_reflection`… | | `MTLPipelineBufferDescriptor` | 2 | 0 | 2 | 0 | `compute_pipeline_descriptors`, `pipeline_descriptors`, `tile_pipeline_descriptors` | | `MTLPointerType` | 8 | 0 | 8 | 0 | `fragment_imageblock_reflection`, `function_bindings`, `mesh_pipeline_reflection`, `pipeline_option_reflection`… | -| `MTLRenderPassAttachmentDescriptor` | 10 | 0 | 10 | 0 | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`… | +| `MTLRenderPassAttachmentDescriptor` | 11 | 0 | 11 | 0 | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`… | | `MTLRenderPassColorAttachmentDescriptor` | 2 | 0 | 2 | 0 | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`… | | `MTLRenderPassColorAttachmentDescriptorArray` | 3 | 0 | 3 | 0 | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`… | | `MTLRenderPassDepthAttachmentDescriptor` | 3 | 0 | 3 | 0 | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`… | @@ -470,7 +470,7 @@ A container is one Objective-C type; the SDK header it sits in is the family of | `MTLEvent.h` | 6 | 5 | 1 | | `MTLFence.h` | 1 | 0 | 1 | | `MTLPipeline.h` | 5 | 4 | 1 | -| `MTLRenderPass.h` | 32 | 31 | 1 | +| `MTLRenderPass.h` | 33 | 32 | 1 | | `MTLTexture.h` | 39 | 38 | 1 | | `MTLAllocation.h` | 1 | 1 | 0 | | `MTLBlitCommandEncoder.h` | 14 | 14 | 0 | @@ -535,7 +535,7 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many | family | cases | Metal ran | compared | items reached | |---|---|---|---|---| -| `alpha_coverage_pairs` | 17 | 17 | 1 tolerance(s): `Degradation` | 115 | +| `alpha_coverage_pairs` | 17 | 17 | 1 tolerance(s): `Degradation` | 116 | | `argument_encoder_crossings` | 4 | 4 | every field | 41 | | `argument_encoders` | 5 | 5 | every field | 57 | | `astc_textures` | 42 | 42 | 1 tolerance(s): `Degradation` | 39 | @@ -543,20 +543,20 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many | `attribute_strides` | 4 | 4 | every field | 46 | | `bicubic_texel_classes` | 1 | 1 | every field | 31 | | `binary_archives` | 6 | 6 | every field | 27 | -| `blend_interactions` | 4 | 4 | every field | 119 | -| `blend_sweeps` | 12 | 12 | every field | 119 | +| `blend_interactions` | 4 | 4 | every field | 120 | +| `blend_sweeps` | 12 | 12 | every field | 120 | | `blit_encoder_commands` | 11 | 11 | every field | 46 | -| `blit_indirect_commands` | 3 | 3 | every field | 97 | +| `blit_indirect_commands` | 3 | 3 | every field | 98 | | `border_swizzles` | 8 | 8 | every field | 56 | | `buffer_bind_off_alignment` | 1 | 1 | every field | 22 | | `buffer_blits` | 4 | 4 | every field | 21 | | `buffer_depth_samples` | 5 | 5 | every field | 57 | | `buffer_tails` | 2 | 2 | every field | 49 | -| `buffer_target_clears` | 6 | 6 | 1 tolerance(s): `AcceptedDifference` | 60 | +| `buffer_target_clears` | 6 | 6 | 1 tolerance(s): `AcceptedDifference` | 61 | | `buffer_texture_blits` | 2 | 2 | every field | 37 | | `buffer_textures` | 3 | 2 | every field | 43 | | `chroma_pairs` | 6 | 6 | every field | 64 | -| `color_write_masks` | 5 | 5 | every field | 116 | +| `color_write_masks` | 5 | 5 | every field | 117 | | `command_buffer_facts` | 1 | 1 | every field | 23 | | `command_queues` | 1 | 1 | every field | 5 | | `compressed_blits` | 4 | 4 | every field | 39 | @@ -566,39 +566,39 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many | `compute_encoder_commands` | 8 | 8 | every field | 62 | | `compute_heap_residency` | 1 | 1 | every field | 43 | | `compute_pipeline_descriptors` | 3 | 3 | 1 tolerance(s): `AcceptedDifference` | 22 | -| `compute_render_chains` | 3 | 3 | every field | 143 | +| `compute_render_chains` | 3 | 3 | every field | 144 | | `compute_threadgroups` | 2 | 1 | every field | 27 | | `copy_out_strides` | 1 | 1 | every field | 36 | | `denormal_word_fetches` | 1 | 1 | every field | 39 | -| `depth_resolve_pairs` | 2 | 2 | every field | 133 | +| `depth_resolve_pairs` | 2 | 2 | every field | 134 | | `depth_stencil_copies` | 1 | 1 | every field | 37 | -| `depth_stencil_space` | 8 | 8 | every field | 136 | +| `depth_stencil_space` | 8 | 8 | every field | 137 | | `depth_texel_reads` | 1 | 1 | every field | 48 | | `device_queries` | 5 | 5 | every field | 3 | -| `discard_hoist` | 1 | 1 | 1 tolerance(s): `Degradation` | 137 | -| `draw_state_changes` | 1 | 1 | every field | 139 | +| `discard_hoist` | 1 | 1 | 1 tolerance(s): `Degradation` | 138 | +| `draw_state_changes` | 1 | 1 | every field | 140 | | `dynamic_libraries` | 3 | 3 | every field | 6 | | `empty_command_buffers` | 1 | 1 | every field | 20 | | `etc_textures` | 10 | 10 | every field | 39 | | `event_orders` | 5 | 5 | 4 tolerance(s): `AcceptedDifference` | 27 | -| `extended_range_blends` | 18 | 18 | every field | 126 | -| `extended_range_gamut` | 39 | 39 | every field | 117 | -| `extended_range_gradients` | 8 | 8 | every field | 118 | +| `extended_range_blends` | 18 | 18 | every field | 127 | +| `extended_range_gamut` | 39 | 39 | every field | 118 | +| `extended_range_gradients` | 8 | 8 | every field | 119 | | `extended_range_planes` | 4 | 4 | every field | 28 | -| `extended_range_targets` | 22 | 22 | every field | 123 | +| `extended_range_targets` | 22 | 22 | every field | 124 | | `extended_range_two_planes` | 2 | 2 | every field | 32 | | `extended_swizzles` | 15 | 15 | every field | 56 | | `fence_orders` | 6 | 6 | 1 tolerance(s): `AcceptedDifference` | 27 | -| `fetch_ordered` | 6 | 6 | every field | 118 | +| `fetch_ordered` | 6 | 6 | every field | 119 | | `format_copies` | 16 | 16 | every field | 37 | | `format_footprints` | 6 | 6 | 1 tolerance(s): `AcceptedDifference` | 19 | | `fragment_imageblock_reflection` | 1 | 1 | every field | 74 | -| `frame_chains` | 1 | 1 | every field | 140 | +| `frame_chains` | 1 | 1 | every field | 141 | | `fresh_contents` | 87 | 87 | every field | 40 | | `function_bindings` | 15 | 15 | every field | 64 | | `function_constants_half3` | 1 | 1 | every field | 27 | | `function_facts` | 15 | 15 | every field | 32 | -| `half_output_blends` | 6 | 6 | every field | 119 | +| `half_output_blends` | 6 | 6 | every field | 120 | | `half_read_nans` | 6 | 6 | every field | 48 | | `half_storage_writes` | 9 | 9 | every field | 32 | | `half_texel_nans` | 8 | 8 | every field | 31 | @@ -607,14 +607,14 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many | `heap_facts` | 5 | 5 | every field | 5 | | `heap_metal_sizes` | 7 | 7 | 1 tolerance(s): `AcceptedDifference` | 14 | | `host_detach` | 1 | 1 | every field | 18 | -| `host_page_writes` | 4 | 4 | every field | 125 | +| `host_page_writes` | 4 | 4 | every field | 126 | | `imageblock_sizes` | 1 | 1 | every field | 24 | -| `indirect_command_depth` | 6 | 6 | every field | 163 | -| `indirect_commands` | 9 | 9 | every field | 165 | +| `indirect_command_depth` | 6 | 6 | every field | 164 | +| `indirect_commands` | 9 | 9 | every field | 166 | | `indirect_private_types` | 1 | 0 | every field | 0 | | `indirect_ranges` | 3 | 3 | every field | 69 | -| `int_attributes` | 1 | 1 | every field | 104 | -| `layered_targets` | 5 | 5 | every field | 133 | +| `int_attributes` | 1 | 1 | every field | 105 | +| `layered_targets` | 5 | 5 | every field | 134 | | `level_sizes` | 2 | 2 | every field | 39 | | `library_facts` | 9 | 9 | every field | 38 | | `math_routines` | 2 | 2 | every field | 25 | @@ -627,13 +627,13 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many | `nan_integer_conversions` | 1 | 1 | 1 tolerance(s): `AcceptedDifference` | 56 | | `nearest_positions` | 1 | 1 | every field | 48 | | `norm_storage_writes` | 7 | 7 | every field | 41 | -| `padded_blends` | 17 | 17 | every field | 118 | -| `padded_fetch` | 11 | 11 | every field | 118 | -| `pass_attachment_pairs` | 2 | 2 | every field | 118 | -| `pass_bound_pairs` | 1 | 1 | every field | 119 | +| `padded_blends` | 17 | 17 | every field | 119 | +| `padded_fetch` | 11 | 11 | every field | 119 | +| `pass_attachment_pairs` | 2 | 2 | every field | 119 | +| `pass_bound_pairs` | 1 | 1 | every field | 120 | | `pass_bytes` | 4 | 4 | every field | 25 | -| `pass_sequence_actions` | 2 | 2 | 1 tolerance(s): `AcceptedDifference` | 134 | -| `pass_start_reads` | 14 | 14 | 2 tolerance(s): `AcceptedDifference` | 124 | +| `pass_sequence_actions` | 2 | 2 | 1 tolerance(s): `AcceptedDifference` | 135 | +| `pass_start_reads` | 14 | 14 | 2 tolerance(s): `AcceptedDifference` | 125 | | `pipeline_descriptors` | 3 | 3 | every field | 75 | | `pipeline_facts` | 9 | 9 | every field | 67 | | `pipeline_functions` | 8 | 8 | every field | 5 | @@ -643,82 +643,82 @@ Each case module: the cases it holds, the `Side` methods it calls, and how many | `pipeline_options` | 21 | 21 | every field | 76 | | `pixel_downscales` | 7 | 7 | every field | 51 | | `pixel_samplers` | 20 | 20 | every field | 51 | -| `primitive_type_crossings` | 1 | 1 | every field | 117 | +| `primitive_type_crossings` | 1 | 1 | every field | 118 | | `pvrtc_cpu_order` | 6 | 6 | every field | 37 | | `pvrtc_rows` | 8 | 8 | every field | 37 | -| `quad_helpers` | 1 | 1 | 1 tolerance(s): `Degradation` | 117 | +| `quad_helpers` | 1 | 1 | 1 tolerance(s): `Degradation` | 118 | | `rate_map_degenerate_forms` | 3 | 3 | every field | 19 | | `rate_map_sweeps` | 9 | 9 | every field | 19 | | `rate_maps` | 2 | 2 | every field | 14 | | `read_through` | 13 | 13 | every field | 59 | | `read_write_tiers` | 7 | 7 | every field | 45 | -| `reconvergence` | 2 | 2 | every field | 123 | -| `render_chains` | 3 | 3 | every field | 137 | -| `render_depth_stencil_state` | 3 | 3 | every field | 137 | -| `render_draw_forms` | 4 | 4 | every field | 124 | -| `render_pass_descriptors` | 12 | 12 | every field | 30 | -| `render_residency` | 2 | 2 | every field | 131 | -| `render_state` | 3 | 3 | every field | 157 | -| `resolve_then_load` | 1 | 1 | every field | 125 | +| `reconvergence` | 2 | 2 | every field | 124 | +| `render_chains` | 3 | 3 | every field | 138 | +| `render_depth_stencil_state` | 3 | 3 | every field | 138 | +| `render_draw_forms` | 4 | 4 | every field | 125 | +| `render_pass_descriptors` | 12 | 12 | every field | 31 | +| `render_residency` | 2 | 2 | every field | 132 | +| `render_state` | 3 | 3 | every field | 158 | +| `resolve_then_load` | 1 | 1 | every field | 126 | | `resource_facts` | 4 | 4 | every field | 21 | | `rgb10a2_srgb` | 8 | 8 | every field | 76 | -| `rotated_planes` | 20 | 20 | every field | 116 | -| `rotated_targets` | 14 | 14 | every field | 119 | +| `rotated_planes` | 20 | 20 | every field | 117 | +| `rotated_targets` | 14 | 14 | every field | 120 | | `sample_fills` | 17 | 0 | every field | 0 | -| `sample_positions` | 19 | 16 | every field | 117 | -| `sampler_bind_clamps` | 2 | 2 | every field | 151 | +| `sample_positions` | 19 | 16 | every field | 118 | +| `sampler_bind_clamps` | 2 | 2 | every field | 152 | | `sampler_crossings` | 8 | 8 | every field | 57 | | `sampler_filtering` | 15 | 15 | every field | 57 | | `scheduled_handlers` | 1 | 1 | every field | 16 | -| `shader_stencil` | 2 | 2 | every field | 133 | +| `shader_stencil` | 2 | 2 | every field | 134 | | `shared_creator_formats` | 2 | 2 | every field | 23 | | `shared_events` | 2 | 2 | every field | 13 | | `shared_exponent_storage` | 5 | 5 | every field | 40 | | `signed_remainders` | 1 | 1 | every field | 25 | | `simdgroup_lockstep` | 2 | 2 | every field | 25 | -| `snorm_tile_store` | 7 | 7 | 1 tolerance(s): `Degradation` | 116 | +| `snorm_tile_store` | 7 | 7 | 1 tolerance(s): `Degradation` | 117 | | `sparse_heaps` | 6 | 6 | every field | 15 | | `sparse_mappings` | 14 | 14 | every field | 32 | | `sparse_tiles` | 4 | 4 | every field | 1 | -| `srgb_fetch` | 2 | 2 | every field | 132 | +| `srgb_fetch` | 2 | 2 | every field | 133 | | `stage_in_regions` | 1 | 1 | every field | 49 | | `stage_in_unread` | 1 | 1 | every field | 48 | -| `stencil_resolve_pairs` | 2 | 2 | every field | 134 | -| `stencil_resolved_sample` | 1 | 1 | every field | 134 | +| `stencil_resolve_pairs` | 2 | 2 | every field | 135 | +| `stencil_resolved_sample` | 1 | 1 | every field | 135 | | `surface_fills` | 1 | 0 | every field | 0 | | `surface_textures` | 10 | 10 | every field | 29 | | `swizzled_storage` | 6 | 6 | every field | 41 | -| `tessellation_crossings` | 6 | 6 | every field | 104 | -| `tessellation_rendered` | 1 | 1 | every field | 120 | -| `tessellation_sweeps` | 7 | 7 | every field | 105 | +| `tessellation_crossings` | 6 | 6 | every field | 105 | +| `tessellation_rendered` | 1 | 1 | every field | 121 | +| `tessellation_sweeps` | 7 | 7 | every field | 106 | | `texel_swizzles` | 6 | 6 | every field | 39 | | `texture_accesses` | 1 | 1 | every field | 20 | | `texture_buffer_fills` | 3 | 0 | every field | 0 | | `texture_buffer_tails` | 1 | 1 | every field | 48 | | `texture_descriptor_pairs` | 5 | 5 | 1 tolerance(s): `AcceptedDifference` | 27 | | `texture_fills` | 54 | 2 | every field | 40 | -| `texture_view_casts` | 5 | 5 | every field | 77 | +| `texture_view_casts` | 5 | 5 | every field | 78 | | `texture_views` | 4 | 4 | every field | 35 | | `textures` | 76 | 76 | every field | 10 | | `threadgroup_start` | 1 | 1 | every field | 24 | | `tile_pipeline_descriptors` | 3 | 3 | every field | 31 | | `tile_pipeline_reflection` | 1 | 1 | every field | 77 | | `tile_threadgroups` | 8 | 8 | every field | 49 | -| `topology_classes` | 2 | 2 | every field | 115 | +| `topology_classes` | 2 | 2 | every field | 116 | | `two_plane_copies` | 3 | 1 | every field | 40 | | `two_plane_heap_blits` | 1 | 1 | every field | 38 | | `two_plane_samples` | 16 | 16 | every field | 48 | | `vector_word_phases` | 4 | 4 | every field | 23 | -| `vertex_attribute_strides` | 2 | 2 | every field | 104 | -| `vertex_constant_step` | 1 | 1 | every field | 105 | -| `vertex_fetch_reach` | 1 | 1 | every field | 105 | -| `vertex_formats` | 4 | 4 | every field | 104 | -| `vertex_step_rate` | 1 | 1 | every field | 104 | -| `viewport_cuts` | 2 | 2 | every field | 120 | -| `visibility` | 16 | 16 | 1 tolerance(s): `AcceptedDifference` | 130 | +| `vertex_attribute_strides` | 2 | 2 | every field | 105 | +| `vertex_constant_step` | 1 | 1 | every field | 106 | +| `vertex_fetch_reach` | 1 | 1 | every field | 106 | +| `vertex_formats` | 4 | 4 | every field | 105 | +| `vertex_step_rate` | 1 | 1 | every field | 105 | +| `viewport_cuts` | 2 | 2 | every field | 121 | +| `visibility` | 16 | 16 | 1 tolerance(s): `AcceptedDifference` | 131 | | `visible_tables` | 18 | 18 | every field | 49 | -| `wide_int_attributes` | 2 | 2 | every field | 104 | -| `wide_points` | 1 | 1 | every field | 118 | +| `wide_int_attributes` | 2 | 2 | every field | 105 | +| `wide_points` | 1 | 1 | every field | 119 | | `ycbcr_gathers` | 4 | 4 | every field | 50 | | `ycbcr_minify` | 2 | 2 | every field | 50 | | `ycbcr_textures` | 2 | 2 | 1 tolerance(s): `AcceptedDifference` | 39 | @@ -1363,6 +1363,7 @@ One row per implemented item of the SDK, in the coverage map's order. *exercised | `texture` | yes | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`, `buffer_depth_samples`, `buffer_target_clears`, `color_write_masks`, `compute_render_chains`, `depth_resolve_pairs`, `depth_stencil_space`, `discard_hoist`, `draw_state_changes`, `extended_range_blends`, `extended_range_gamut`, `extended_range_gradients`, `extended_range_targets`, `fetch_ordered`, `frame_chains`, `half_output_blends`, `host_page_writes`, `indirect_command_depth`, `indirect_commands`, `indirect_ranges`, `int_attributes`, `layered_targets`, `mesh_barriers`, `mesh_commands`, `mesh_draws`, `mesh_partial_barriers`, `nan_integer_conversions`, `padded_blends`, `padded_fetch`, `pass_attachment_pairs`, `pass_bound_pairs`, `pass_sequence_actions`, `pass_start_reads`, `primitive_type_crossings`, `quad_helpers`, `reconvergence`, `render_chains`, `render_depth_stencil_state`, `render_draw_forms`, `render_pass_descriptors`, `render_residency`, `render_state`, `resolve_then_load`, `rgb10a2_srgb`, `rotated_planes`, `rotated_targets`, `sample_positions`, `sampler_bind_clamps`, `shader_stencil`, `snorm_tile_store`, `srgb_fetch`, `stencil_resolve_pairs`, `stencil_resolved_sample`, `tessellation_crossings`, `tessellation_rendered`, `tessellation_sweeps`, `texture_view_casts`, `tile_threadgroups`, `topology_classes`, `vertex_attribute_strides`, `vertex_constant_step`, `vertex_fetch_reach`, `vertex_formats`, `vertex_step_rate`, `viewport_cuts`, `visibility`, `wide_int_attributes`, `wide_points` | 422 | | `level` | yes | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`, `buffer_target_clears`, `color_write_masks`, `compute_render_chains`, `depth_resolve_pairs`, `depth_stencil_space`, `discard_hoist`, `draw_state_changes`, `extended_range_blends`, `extended_range_gamut`, `extended_range_gradients`, `extended_range_targets`, `fetch_ordered`, `frame_chains`, `half_output_blends`, `host_page_writes`, `indirect_command_depth`, `indirect_commands`, `int_attributes`, `layered_targets`, `padded_blends`, `padded_fetch`, `pass_attachment_pairs`, `pass_bound_pairs`, `pass_sequence_actions`, `pass_start_reads`, `primitive_type_crossings`, `quad_helpers`, `reconvergence`, `render_chains`, `render_depth_stencil_state`, `render_draw_forms`, `render_pass_descriptors`, `render_residency`, `render_state`, `resolve_then_load`, `rotated_planes`, `rotated_targets`, `sample_positions`, `sampler_bind_clamps`, `shader_stencil`, `snorm_tile_store`, `srgb_fetch`, `stencil_resolve_pairs`, `stencil_resolved_sample`, `tessellation_crossings`, `tessellation_rendered`, `tessellation_sweeps`, `texture_view_casts`, `topology_classes`, `vertex_attribute_strides`, `vertex_constant_step`, `vertex_fetch_reach`, `vertex_formats`, `vertex_step_rate`, `viewport_cuts`, `visibility`, `wide_int_attributes`, `wide_points` | 383 | | `slice` | yes | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`, `buffer_depth_samples`, `buffer_target_clears`, `color_write_masks`, `compute_render_chains`, `depth_resolve_pairs`, `depth_stencil_space`, `discard_hoist`, `draw_state_changes`, `extended_range_blends`, `extended_range_gamut`, `extended_range_gradients`, `extended_range_targets`, `fetch_ordered`, `frame_chains`, `half_output_blends`, `host_page_writes`, `indirect_command_depth`, `indirect_commands`, `int_attributes`, `layered_targets`, `padded_blends`, `padded_fetch`, `pass_attachment_pairs`, `pass_bound_pairs`, `pass_sequence_actions`, `pass_start_reads`, `primitive_type_crossings`, `quad_helpers`, `reconvergence`, `render_chains`, `render_depth_stencil_state`, `render_draw_forms`, `render_pass_descriptors`, `render_residency`, `render_state`, `resolve_then_load`, `rotated_planes`, `rotated_targets`, `sample_positions`, `sampler_bind_clamps`, `shader_stencil`, `snorm_tile_store`, `srgb_fetch`, `stencil_resolve_pairs`, `stencil_resolved_sample`, `tessellation_crossings`, `tessellation_rendered`, `tessellation_sweeps`, `texture_view_casts`, `topology_classes`, `vertex_attribute_strides`, `vertex_constant_step`, `vertex_fetch_reach`, `vertex_formats`, `vertex_step_rate`, `viewport_cuts`, `visibility`, `wide_int_attributes`, `wide_points` | 388 | +| `depthPlane` | yes | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`, `buffer_target_clears`, `color_write_masks`, `compute_render_chains`, `depth_resolve_pairs`, `depth_stencil_space`, `discard_hoist`, `draw_state_changes`, `extended_range_blends`, `extended_range_gamut`, `extended_range_gradients`, `extended_range_targets`, `fetch_ordered`, `frame_chains`, `half_output_blends`, `host_page_writes`, `indirect_command_depth`, `indirect_commands`, `int_attributes`, `layered_targets`, `padded_blends`, `padded_fetch`, `pass_attachment_pairs`, `pass_bound_pairs`, `pass_sequence_actions`, `pass_start_reads`, `primitive_type_crossings`, `quad_helpers`, `reconvergence`, `render_chains`, `render_depth_stencil_state`, `render_draw_forms`, `render_pass_descriptors`, `render_residency`, `render_state`, `resolve_then_load`, `rotated_planes`, `rotated_targets`, `sample_positions`, `sampler_bind_clamps`, `shader_stencil`, `snorm_tile_store`, `srgb_fetch`, `stencil_resolve_pairs`, `stencil_resolved_sample`, `tessellation_crossings`, `tessellation_rendered`, `tessellation_sweeps`, `texture_view_casts`, `topology_classes`, `vertex_attribute_strides`, `vertex_constant_step`, `vertex_fetch_reach`, `vertex_formats`, `vertex_step_rate`, `viewport_cuts`, `visibility`, `wide_int_attributes`, `wide_points` | 383 | | `resolveTexture` | yes | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`, `buffer_target_clears`, `color_write_masks`, `compute_render_chains`, `depth_resolve_pairs`, `depth_stencil_space`, `discard_hoist`, `draw_state_changes`, `extended_range_blends`, `extended_range_gamut`, `extended_range_gradients`, `extended_range_targets`, `fetch_ordered`, `frame_chains`, `half_output_blends`, `host_page_writes`, `indirect_command_depth`, `indirect_commands`, `int_attributes`, `layered_targets`, `padded_blends`, `padded_fetch`, `pass_attachment_pairs`, `pass_bound_pairs`, `pass_sequence_actions`, `pass_start_reads`, `primitive_type_crossings`, `quad_helpers`, `reconvergence`, `render_chains`, `render_depth_stencil_state`, `render_draw_forms`, `render_pass_descriptors`, `render_residency`, `render_state`, `resolve_then_load`, `rotated_planes`, `rotated_targets`, `sample_positions`, `sampler_bind_clamps`, `shader_stencil`, `snorm_tile_store`, `srgb_fetch`, `stencil_resolve_pairs`, `stencil_resolved_sample`, `tessellation_crossings`, `tessellation_rendered`, `tessellation_sweeps`, `texture_view_casts`, `topology_classes`, `vertex_attribute_strides`, `vertex_constant_step`, `vertex_fetch_reach`, `vertex_formats`, `vertex_step_rate`, `viewport_cuts`, `visibility`, `wide_int_attributes`, `wide_points` | 383 | | `resolveLevel` | yes | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`, `buffer_target_clears`, `color_write_masks`, `compute_render_chains`, `depth_resolve_pairs`, `depth_stencil_space`, `discard_hoist`, `draw_state_changes`, `extended_range_blends`, `extended_range_gamut`, `extended_range_gradients`, `extended_range_targets`, `fetch_ordered`, `frame_chains`, `half_output_blends`, `host_page_writes`, `indirect_command_depth`, `indirect_commands`, `int_attributes`, `layered_targets`, `padded_blends`, `padded_fetch`, `pass_attachment_pairs`, `pass_bound_pairs`, `pass_sequence_actions`, `pass_start_reads`, `primitive_type_crossings`, `quad_helpers`, `reconvergence`, `render_chains`, `render_depth_stencil_state`, `render_draw_forms`, `render_pass_descriptors`, `render_residency`, `render_state`, `resolve_then_load`, `rotated_planes`, `rotated_targets`, `sample_positions`, `sampler_bind_clamps`, `shader_stencil`, `snorm_tile_store`, `srgb_fetch`, `stencil_resolve_pairs`, `stencil_resolved_sample`, `tessellation_crossings`, `tessellation_rendered`, `tessellation_sweeps`, `texture_view_casts`, `topology_classes`, `vertex_attribute_strides`, `vertex_constant_step`, `vertex_fetch_reach`, `vertex_formats`, `vertex_step_rate`, `viewport_cuts`, `visibility`, `wide_int_attributes`, `wide_points` | 383 | | `resolveSlice` | yes | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`, `buffer_target_clears`, `color_write_masks`, `compute_render_chains`, `depth_resolve_pairs`, `depth_stencil_space`, `discard_hoist`, `draw_state_changes`, `extended_range_blends`, `extended_range_gamut`, `extended_range_gradients`, `extended_range_targets`, `fetch_ordered`, `frame_chains`, `half_output_blends`, `host_page_writes`, `indirect_command_depth`, `indirect_commands`, `int_attributes`, `layered_targets`, `padded_blends`, `padded_fetch`, `pass_attachment_pairs`, `pass_bound_pairs`, `pass_sequence_actions`, `pass_start_reads`, `primitive_type_crossings`, `quad_helpers`, `reconvergence`, `render_chains`, `render_depth_stencil_state`, `render_draw_forms`, `render_pass_descriptors`, `render_residency`, `render_state`, `resolve_then_load`, `rotated_planes`, `rotated_targets`, `sample_positions`, `sampler_bind_clamps`, `shader_stencil`, `snorm_tile_store`, `srgb_fetch`, `stencil_resolve_pairs`, `stencil_resolved_sample`, `tessellation_crossings`, `tessellation_rendered`, `tessellation_sweeps`, `texture_view_casts`, `topology_classes`, `vertex_attribute_strides`, `vertex_constant_step`, `vertex_fetch_reach`, `vertex_formats`, `vertex_step_rate`, `viewport_cuts`, `visibility`, `wide_int_attributes`, `wide_points` | 383 | @@ -1976,7 +1977,6 @@ An item the suite's Metal leg calls whose coverage-map status is not implemented | `MTLRenderCommandEncoder` `setTileTexture:atIndex:` | missing | tile render pipelines; metal2vulkan-runtime makes none | `tile_threadgroups` | | `MTLRenderCommandEncoder` `setVertexBuffer:offset:attributeStride:atIndex:` | missing | a bind with a per-bind stride, which stage-in and vertex fetch read | `vertex_attribute_strides` | | `MTLRenderCommandEncoder` `setVertexBytes:length:attributeStride:atIndex:` | missing | a bind with a per-bind stride, which stage-in and vertex fetch read | `vertex_attribute_strides` | -| `MTLRenderPassAttachmentDescriptor` `depthPlane` | missing | a 3D texture's depth plane as an attachment; such an attachment is refused (`RenderPassKind::TextureType`) | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`, `buffer_target_clears`, `color_write_masks`, `compute_render_chains`, `depth_resolve_pairs`, `depth_stencil_space`, `discard_hoist`, `draw_state_changes`, `extended_range_blends`, `extended_range_gamut`, `extended_range_gradients`, `extended_range_targets`, `fetch_ordered`, `frame_chains`, `half_output_blends`, `host_page_writes`, `indirect_command_depth`, `indirect_commands`, `int_attributes`, `layered_targets`, `padded_blends`, `padded_fetch`, `pass_attachment_pairs`, `pass_bound_pairs`, `pass_sequence_actions`, `pass_start_reads`, `primitive_type_crossings`, `quad_helpers`, `reconvergence`, `render_chains`, `render_depth_stencil_state`, `render_draw_forms`, `render_pass_descriptors`, `render_residency`, `render_state`, `resolve_then_load`, `rotated_planes`, `rotated_targets`, `sample_positions`, `sampler_bind_clamps`, `shader_stencil`, `snorm_tile_store`, `srgb_fetch`, `stencil_resolve_pairs`, `stencil_resolved_sample`, `tessellation_crossings`, `tessellation_rendered`, `tessellation_sweeps`, `texture_view_casts`, `topology_classes`, `vertex_attribute_strides`, `vertex_constant_step`, `vertex_fetch_reach`, `vertex_formats`, `vertex_step_rate`, `viewport_cuts`, `visibility`, `wide_int_attributes`, `wide_points` | | `MTLRenderPassAttachmentDescriptor` `storeActionOptions` | missing | store action options, whose one option needs more than one sample | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`, `buffer_target_clears`, `color_write_masks`, `compute_render_chains`, `depth_resolve_pairs`, `depth_stencil_space`, `discard_hoist`, `draw_state_changes`, `extended_range_blends`, `extended_range_gamut`, `extended_range_gradients`, `extended_range_targets`, `fetch_ordered`, `frame_chains`, `half_output_blends`, `host_page_writes`, `indirect_command_depth`, `indirect_commands`, `int_attributes`, `layered_targets`, `padded_blends`, `padded_fetch`, `pass_attachment_pairs`, `pass_bound_pairs`, `pass_sequence_actions`, `pass_start_reads`, `primitive_type_crossings`, `quad_helpers`, `reconvergence`, `render_chains`, `render_depth_stencil_state`, `render_draw_forms`, `render_pass_descriptors`, `render_residency`, `render_state`, `resolve_then_load`, `rotated_planes`, `rotated_targets`, `sample_positions`, `sampler_bind_clamps`, `shader_stencil`, `snorm_tile_store`, `srgb_fetch`, `stencil_resolve_pairs`, `stencil_resolved_sample`, `tessellation_crossings`, `tessellation_rendered`, `tessellation_sweeps`, `texture_view_casts`, `topology_classes`, `vertex_attribute_strides`, `vertex_constant_step`, `vertex_fetch_reach`, `vertex_formats`, `vertex_step_rate`, `viewport_cuts`, `visibility`, `wide_int_attributes`, `wide_points` | | `MTLRenderPassDescriptor` `defaultRasterSampleCount` | missing | a pass with no attachment, which is refused (`RenderPassKind::NoAttachment`) | `alpha_coverage_pairs`, `blend_interactions`, `blend_sweeps`, `blit_indirect_commands`, `buffer_target_clears`, `color_write_masks`, `compute_render_chains`, `depth_resolve_pairs`, `depth_stencil_space`, `discard_hoist`, `draw_state_changes`, `extended_range_blends`, `extended_range_gamut`, `extended_range_gradients`, `extended_range_targets`, `fetch_ordered`, `frame_chains`, `half_output_blends`, `host_page_writes`, `indirect_command_depth`, `indirect_commands`, `int_attributes`, `layered_targets`, `padded_blends`, `padded_fetch`, `pass_attachment_pairs`, `pass_bound_pairs`, `pass_sequence_actions`, `pass_start_reads`, `primitive_type_crossings`, `quad_helpers`, `reconvergence`, `render_chains`, `render_depth_stencil_state`, `render_draw_forms`, `render_pass_descriptors`, `render_residency`, `render_state`, `resolve_then_load`, `rotated_planes`, `rotated_targets`, `sample_positions`, `sampler_bind_clamps`, `shader_stencil`, `snorm_tile_store`, `srgb_fetch`, `stencil_resolve_pairs`, `stencil_resolved_sample`, `tessellation_crossings`, `tessellation_rendered`, `tessellation_sweeps`, `texture_view_casts`, `topology_classes`, `vertex_attribute_strides`, `vertex_constant_step`, `vertex_fetch_reach`, `vertex_formats`, `vertex_step_rate`, `viewport_cuts`, `visibility`, `wide_int_attributes`, `wide_points` | | `MTLRenderPassDescriptor` `getSamplePositions:count:` | missing | programmable sample positions | `render_pass_descriptors` | @@ -5300,18 +5300,6 @@ A case whose difference from Metal is recorded rather than compared away. The le | `half-output-blends-rgba32f` | Metal's stored blend result and ours differ at this site, and the row's count and bound are this venue's. Metal's compiler folds the attachment's blend and its … | | `buffer-bind-off-alignment` | refused: the consumer's own (dispatchType) | | `buffer-bind-off-alignment` | Metal itself refuses the bind: its API validation stops the pass ("Compute Function(vwp_words): the offset into the buffer src that is bound at Buffer index 0 m… | -| `layered-attachment-places` | refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no rend… | -| `layered-attachment-places` | refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no rend… | -| `layered-attachment-places` | refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no rend… | -| `layered-attachment-places` | refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no rend… | -| `layered-attachment-places` | refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no rend… | -| `layered-attachment-places` | refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no rend… | -| `layered-attachment-places` | refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no rend… | -| `layered-attachment-places` | refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no rend… | -| `layered-attachment-places` | refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no rend… | -| `layered-attachment-places` | refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no rend… | -| `layered-attachment-places` | refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no rend… | -| `layered-attachment-places` | refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no 3D texture as an attachment and no depthPlane). rt builds no rend… | | `xr-clear-routes-bgr10xr` | refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no extended-range texture, drawable or layer). The translator holds … | | `xr-clear-routes-bgr10xr-srgb` | refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no extended-range texture, drawable or layer). The translator holds … | | `xr-clear-routes-bgra10xr` | refused: no stream uses it yet (every-stream census 11-19, m3-max-51200..51246: 17 streams, no extended-range texture, drawable or layer). The translator holds … | diff --git a/docs/METAL-COVERAGE.md b/docs/METAL-COVERAGE.md index 5b66bb82c..930de230f 100644 --- a/docs/METAL-COVERAGE.md +++ b/docs/METAL-COVERAGE.md @@ -10,12 +10,12 @@ Every public item of the macOS 27.2 SDK (Xcode 27.2, 27B52)'s Metal headers, by | Status | Items | Of which deprecated | |---|---|---| -| implemented | 638 | 29 | -| missing | 1073 | 34 | +| implemented | 639 | 29 | +| missing | 1072 | 34 | | out of scope | 424 | 5 | | all | 2135 | 68 | -Implemented by the runtime: 281; by the translator's values: 357. Missing by size: S 181, M 203, L 313, XL 376. +Implemented by the runtime: 282; by the translator's values: 357. Missing by size: S 181, M 202, L 313, XL 376. ## Missing, in build order @@ -32,7 +32,7 @@ Cheap items a plain app calls first, then medium pieces by how often a plain app | plain-value constructors (`MTLOriginMake` and the rest) | S | 7 | `MTLOriginMake`, `MTLSizeMake`, `MTLRegionMake1D`, ... | | a buffer made with bytes | S | 1 | `MTLDevice.newBufferWithBytes:length:options:` | | pipeline creation forms (from a function, with a completion handler) | S | 6 | `MTLDevice.newRenderPipelineStateWithDescriptor:options:completionHandler:`, `MTLDevice.newComputePipelineStateWithFunction:error:`, `MTLDevice.newComputePipelineStateWithFunction:options:reflection:error:`, ... | -| render pass descriptor fields | S/M/L | 8 | `MTLRenderPassAttachmentDescriptor.depthPlane`, `MTLRenderPassAttachmentDescriptor.storeActionOptions`, `MTLRenderPassDescriptor.imageblockSampleLength`, ... | +| render pass descriptor fields | S/M/L | 7 | `MTLRenderPassAttachmentDescriptor.storeActionOptions`, `MTLRenderPassDescriptor.imageblockSampleLength`, `MTLRenderPassDescriptor.threadgroupMemoryLength`, ... | | encoder calls (stride setters, indirect draws, store action options, a render encoder's heap uses) | S/M/L | 23 | `MTLBlitCommandEncoder.synchronizeTexture:slice:level:`, `MTLBlitCommandEncoder.copyFromTexture:sourceSlice:sourceLevel:toTexture:destinationSlice:destinationLevel:sliceCount:levelCount:`, `MTLBlitCommandEncoder.copyFromTexture:toTexture:`, ... | | `textureBarrier` and queue-stage barriers | S/M | 2 | `MTLCommandEncoder.barrierAfterQueueStages:beforeStages:`, `MTLRenderCommandEncoder.textureBarrier` | | a pipeline state's reflection after creation | S | 2 | `MTLComputePipelineState.reflection`, `MTLRenderPipelineState.reflection` | @@ -2145,7 +2145,7 @@ Cheap items a plain app calls first, then medium pieces by how often a plain app | `MTLRenderPassAttachmentDescriptor.texture` | property | implemented | `RenderPassColorAttachmentDescriptor.texture` (runtime) | | `MTLRenderPassAttachmentDescriptor.level` | property | implemented | `RenderPassColorAttachmentDescriptor.level` (runtime) | | `MTLRenderPassAttachmentDescriptor.slice` | property | implemented | `RenderPassColorAttachmentDescriptor.slice` (runtime) | -| `MTLRenderPassAttachmentDescriptor.depthPlane` | property | missing | M: a 3D texture's depth plane as an attachment; such an attachment is refused (`RenderPassKind::TextureType`) | +| `MTLRenderPassAttachmentDescriptor.depthPlane` | property | implemented | `RenderPassColorAttachmentDescriptor.depth_plane` (runtime) | | `MTLRenderPassAttachmentDescriptor.resolveTexture` | property | implemented | `RenderPassColorAttachmentDescriptor.resolve_texture` (runtime) | | `MTLRenderPassAttachmentDescriptor.resolveLevel` | property | implemented | `RenderPassColorAttachmentDescriptor.resolve_level` (runtime) | | `MTLRenderPassAttachmentDescriptor.resolveSlice` | property | implemented | `RenderPassColorAttachmentDescriptor.resolve_slice` (runtime) | diff --git a/docs/REFUSALS.md b/docs/REFUSALS.md index 17bc3e069..d7ed8e7e8 100644 --- a/docs/REFUSALS.md +++ b/docs/REFUSALS.md @@ -301,7 +301,7 @@ Columns: | `AttachmentUsage` | A render pass attachment (`CommandBuffer::render_command_encoder`) whose texture was made without `RenderTarget` usage | every device (a public call's own check of its arguments) | `metal-documented`: a texture a render pass renders into needs `MTLTextureUsageRenderTarget`; Metal's validation stops the descriptor | 1: `crates/metal2vulkan-runtime/src/texture.rs (attachment)` | `-` | | `ResolveTexture` | A store action that resolves (`MultisampleResolve` or `StoreAndMultisampleResolve`), on a render pass attachment or set by its encoder, for an... | every device (a public call's own check of its arguments) | `metal-documented`: `MTLRenderPass.h`: `resolveTexture` is "Only used (and required) if the store action is set to MTLStoreActionMultisampleResolve" | 2: `crates/metal2vulkan-runtime/src/pass.rs (resolving)`, `crates/metal2vulkan-runtime/src/render_encoder.rs (later_store)` | `-` | | `ResolveFormat` | A resolve of a render pass color attachment of an integer pixel format | every device (a public call's own check of its arguments) | `metal-documented`: Metal's validation asserts that an integer color format "cannot be a MSAA resolve target", and plain Metal writes values no sample holds | 1: `crates/metal2vulkan-runtime/src/pass.rs (check)` | `-` | -| `AttachmentPlace` | A render pass attachment or resolve texture of a level or slice past its texture's | every device (a public call's own check of its arguments) | `ours`: no texel of the texture is there to render into | 3: `crates/metal2vulkan-runtime/src/texture.rs (attachment_view, 2 sites)`, `crates/metal2vulkan-runtime/src/texture.rs (resolve_attachment)` | `-` | +| `AttachmentPlace` | A render pass attachment or resolve texture of a level or slice past its texture's | every device (a public call's own check of its arguments) | `ours`: no texel of the texture is there to render into | 4: `crates/metal2vulkan-runtime/src/texture.rs (attachment_view, 3 sites)`, `crates/metal2vulkan-runtime/src/texture.rs (resolve_attachment)` | `-` | | `AttachmentFormat` | A render pass color attachment of a depth or stencil pixel format, a depth attachment of a format without depth, or a stencil attachment of a... | every device (a public call's own check of its arguments) | `metal-documented`: a color attachment takes a color-renderable format, a depth attachment a format with depth and a stencil attachment a format with stencil; Metal's validation stops the descriptor | 3: `crates/metal2vulkan-runtime/src/pass.rs (check, 3 sites)` | `-` | | `NoAttachmentPass` | A render pass with no attachment whose `renderTargetWidth` or `renderTargetHeight` is 0, or whose `defaultRasterSampleCount` is 0, Metal's default | every device (a public call's own check of its arguments) | `metal-measured`: an Apple M3 Max, macOS 27.0.1, the API validation layer off, m3-max-62174, `probes/no_attachment_passes.m`: a side of 0 makes no encoder, nil, and a count of 0 ends the process at the encoder, SIGABRT, where 64 by 64 pixels at 1 sample makes one | 1: `crates/metal2vulkan-runtime/src/pass.rs (check)` | `-` | | `VertexBufferOffset` | A draw whose vertex descriptor reads a vertex buffer at an offset at or past the buffer's length | every device (a public call's own check of its arguments) | `metal-documented`: a buffer's offset lies inside it; Metal's validation stops the bind | 1: `crates/metal2vulkan-runtime/src/render_encoder.rs (find)` | `-` | @@ -597,7 +597,7 @@ Each refusal's sites, with the function that builds it. - `rt:Refusal::AttachmentUsage`: `crates/metal2vulkan-runtime/src/texture.rs (attachment)` - `rt:Refusal::ResolveTexture`: `crates/metal2vulkan-runtime/src/pass.rs (resolving)`; `crates/metal2vulkan-runtime/src/render_encoder.rs (later_store)` - `rt:Refusal::ResolveFormat`: `crates/metal2vulkan-runtime/src/pass.rs (check)` -- `rt:Refusal::AttachmentPlace`: `crates/metal2vulkan-runtime/src/texture.rs (attachment_view, 2 sites)`; `crates/metal2vulkan-runtime/src/texture.rs (resolve_attachment)` +- `rt:Refusal::AttachmentPlace`: `crates/metal2vulkan-runtime/src/texture.rs (attachment_view, 3 sites)`; `crates/metal2vulkan-runtime/src/texture.rs (resolve_attachment)` - `rt:Refusal::AttachmentFormat`: `crates/metal2vulkan-runtime/src/pass.rs (check, 3 sites)` - `rt:Refusal::NoAttachmentPass`: `crates/metal2vulkan-runtime/src/pass.rs (check)` - `rt:Refusal::VertexBufferOffset`: `crates/metal2vulkan-runtime/src/render_encoder.rs (find)` diff --git a/scripts/metal-coverage/coverage.tsv b/scripts/metal-coverage/coverage.tsv index 09a43a2de..cde6a26e5 100644 --- a/scripts/metal-coverage/coverage.tsv +++ b/scripts/metal-coverage/coverage.tsv @@ -1684,7 +1684,7 @@ MTLRenderPass.h MTLRenderPassAttachmentDescriptor class MTLRenderPassAttachmentD MTLRenderPass.h MTLRenderPassAttachmentDescriptor property texture I runtime RenderPassColorAttachmentDescriptor.texture MTLRenderPass.h MTLRenderPassAttachmentDescriptor property level I runtime RenderPassColorAttachmentDescriptor.level MTLRenderPass.h MTLRenderPassAttachmentDescriptor property slice I runtime RenderPassColorAttachmentDescriptor.slice -MTLRenderPass.h MTLRenderPassAttachmentDescriptor property depthPlane M a 3D texture's depth plane as an attachment; such an attachment is refused (`RenderPassKind::TextureType`) M render-pass +MTLRenderPass.h MTLRenderPassAttachmentDescriptor property depthPlane I runtime RenderPassColorAttachmentDescriptor.depth_plane MTLRenderPass.h MTLRenderPassAttachmentDescriptor property resolveTexture I runtime RenderPassColorAttachmentDescriptor.resolve_texture MTLRenderPass.h MTLRenderPassAttachmentDescriptor property resolveLevel I runtime RenderPassColorAttachmentDescriptor.resolve_level MTLRenderPass.h MTLRenderPassAttachmentDescriptor property resolveSlice I runtime RenderPassColorAttachmentDescriptor.resolve_slice