rt and translator: a sampler of Metal's undeclared filter 2 is made and filters as nearest

MTLSamplerMinMagFilter's raw value 2 (SamplerMinMagFilter::Cubic) is
declared by no SDK header, Apple page or Metal Shading Language text, and
nothing a program asks tells it about the value, so it is undocumented
Metal and is not emulated. Metal makes the state on every Mac measured. An
Apple M3 Max filters it over a footprint wider than one texel, and a Radeon
Pro 5300M and an Intel UHD Graphics 630 read the nearest texel (the
conformance case's own inputs: jobs m3-max-85003 and m3-max-85004). The
runtime now makes such a state and filters it as nearest on every device:
no shader arm, no second pipeline, no query, no note.

- rt Device::new_sampler_state no longer refuses a Cubic min or mag
  filter. Nothing raises Gap::CubicSampler now; the variant stays,
  documented so, because the consumer names it.
- translator: SamplerWord::of sets no bit for a Cubic filter, so its word
  is the nearest filter's. SamplerWord::CUBIC (bit 30) is deleted (its
  one reader, the anisotropic word path, is gone on development). SamplerWord::FIELDS is now (1 << 30) - 1.
  unnormalized_reads compares the two filters as the device's (a Cubic
  filter's is NEAREST) rather than refusing Cubic. vk_sampler already
  made NEAREST of Cubic.
- SamplerMinMagFilter::Cubic stays, because the consumer converts a
  guest's raw 2 to it. It is documented through regen_metal_enums.py's
  PRIVATE_DOCS as Metal's undeclared raw value 2, which the M3 Max filters
  and the x86 Macs read as nearest, and whose device sampler and word here
  are the nearest filter's. generated.rs is regenerated against the
  macOS 27.2 SDK.
- docs: the runtime README's sampler line, RESOURCE-ID.md (the word's bit
  30 is now 0, and the consumer makes a Cubic state as nearest),
  resource_words.tsv's three Cubic lines (bit 30 cleared:
  0x40000000 -> 0x00000000 twice, 0x58f6ab53 -> 0x18f6ab53), and the
  comments in select.rs and extended.rs that said the runtime makes no
  cubic sampler.
- reach.tsv's SamplerBicubicFilter row no longer names a runtime cubic
  sampler as its reach. REFUSALS.md and error/basis.rs regenerated
  (refusal_surface.py: Gap::CubicSampler has no raise site);
  api_signatures.tsv blessed (SamplerWord::CUBIC removed, FIELDS changed).
- RUNTIME_VERSION: a Cubic state is made where it was refused, so it
  takes a bump, set at staging (left at development's 2568 here).
  SEMANTICS_VERSION stays, since no module's words change.
  runtime-sources.sha256 re-pinned.

Consumer search (reims-vgpu development 1913fcbc15 and the steelbrain/*
refs from the last day): Gap::CubicSampler, 2 hits (development
crates/reims-vgpu-vulkan/src/rt_platform/diag.rs:3071 and :3109, a test
that counts the gap's name), kept. SamplerWord::CUBIC, SamplerWord::FIELDS
and SamplerMinMagFilter::Cubic by name: 0 hits. The consumer's
rt_platform::state::tests::states_on_vulkan, which expects None for
min_filter 2, now gets a sampler.
This commit is contained in:
Anees Iqbal committed 2026-12-03 13:06:04 -08:00
1 parent c43c130d1a
commit 6706d5b97f
14 files changed
+74 -71

No files matched your search

+5 -4
View File
@@ -2750,10 +2750,11 @@ made, with no lock, and never rewritten for layouts.
- A state's handle holds the device; what a command buffer keeps of it does not (Teardown).
Once its last handle and the last command buffer that used it are gone, its elements read the
defaults again and its index is free; a device sampler no other state holds goes to the reaper.
- Anisotropy is the device's own filter (`samplerAnisotropy` is in the floor). A cubic filter is
`Gap::CubicSampler`: the runtime makes no cubic sampler, so no live sampler's resource ID carries
the sampler word's cubic bit (30), and a shader does not test an argument buffer's sampler for
it. A descriptor the translator makes no device sampler of is `Error::Translation`.
- Anisotropy is the device's own filter (`samplerAnisotropy` is in the floor). A cubic filter
(`SamplerMinMagFilter::Cubic`, Metal's undeclared raw value 2) is made and filters as nearest, an
x86 Mac's answer, where an Apple-silicon Mac filters it over a wider footprint (`docs/API.md`,
accepted differences): its device samplers and its word are the nearest filter's. A descriptor
the translator makes no device sampler of is `Error::Translation`.
- A state bound with LOD clamps (`set_sampler_state_with_lod_clamps`, and the render encoder's
`set_vertex_sampler_state_with_lod_clamps` and `set_fragment_sampler_state_with_lod_clamps`:
Metal's `lodMinClamp:lodMaxClamp:` forms, whose range forms are loops of them) samples as Metal
+8 -5
View File
@@ -1431,11 +1431,12 @@ pub enum Gap {
/// The texture's pixel format.
pixel_format: PixelFormat,
},
/// A sampler state whose minification or magnification filter is cubic
/// ([`Device::new_sampler_state`](crate::Device::new_sampler_state)).
/// A sampler state whose minification or magnification filter is cubic. Not raised:
/// [`Device::new_sampler_state`](crate::Device::new_sampler_state) makes a `Cubic` filter
/// (`MTLSamplerMinMagFilterCubic`, Metal's undeclared raw value 2) and filters it as nearest.
/// The variant stays because a consumer names it.
///
/// Basis: ours (the translator's identity domains do not filter bicubically, and Vulkan's
/// cubic filter is not Metal's).
/// Basis: ours (the runtime's choice of nearest for a value Metal does not document).
CubicSampler,
/// [`Texture::replace_region`](crate::Texture::replace_region),
/// [`Texture::get_bytes`](crate::Texture::get_bytes), a Managed texture's places or a blit
@@ -3305,7 +3306,9 @@ impl fmt::Display for Gap {
"a grid of {threads_per_grid:?} threads in threadgroups of {threads_per_threadgroup:?} ends in partial threadgroups, which this kernel's variant does not run"
),
Gap::MemorylessTexture => f.write_str("Memoryless textures are not built"),
Gap::CubicSampler => f.write_str("cubic sampler filters are not built"),
Gap::CubicSampler => {
f.write_str("a cubic sampler filter, which the runtime makes as nearest")
}
Gap::TextureBufferSwizzle { pixel_format } => write!(
f,
"a swizzled texture buffer of {pixel_format:?} is not built"
+7 -6
View File
@@ -25,13 +25,13 @@
use crate::arrays::{Owner, ResourceId};
use crate::counters::Gauge;
use crate::device::{lock, Core, Device};
use crate::error::{Error, Gap, Limit};
use crate::error::{Error, Limit};
use crate::reaper::Free;
use ash::vk;
use metal2vulkan::bind::SamplerDescriptor;
use metal2vulkan::device::DeviceProfile;
use metal2vulkan::metal::sampler::{lod_clamps_read_alike, vk_sampler, SamplerUse, SamplerWord};
use metal2vulkan::metal::{CompareFunction, SamplerMinMagFilter};
use metal2vulkan::metal::CompareFunction;
use metal2vulkan::pipeline::{CombinedSampler, PrecisionNote};
use metal2vulkan::vk::{BorderColor, SamplerAddressMode, SamplerDesc};
use std::collections::HashMap;
@@ -457,8 +457,12 @@ impl Device {
/// buffer not yet retired, is taken at once, as a texture's is
/// ([`Device::new_texture`](crate::Device::new_texture)): the earlier one's going leaves it.
///
/// A minification or magnification filter of `Cubic` (`MTLSamplerMinMagFilterCubic`, a raw
/// value 2 the SDK headers do not declare) is made and filters as nearest, as an x86 Mac's
/// does, where an Apple-silicon Mac filters it over a wider footprint (`docs/API.md`, accepted
/// differences): its device samplers and its word are the nearest filter's.
///
/// Err: [`Refusal::IndicesNotGranted`](crate::Refusal::IndicesNotGranted);
/// [`Gap::CubicSampler`];
/// [`Error::Translation`] where the translator makes no device sampler of the descriptor;
/// [`Limit::DeviceSamplers`] past the device's `maxSamplerAllocationCount`; [`Error::Vulkan`]
/// where `vkCreateSampler` fails.
@@ -467,9 +471,6 @@ impl Device {
descriptor: &SamplerDescriptor,
index: u32,
) -> Result<SamplerState, Error> {
if [descriptor.min_filter, descriptor.mag_filter].contains(&SamplerMinMagFilter::Cubic) {
return Err(Error::Unsupported(Gap::CubicSampler));
}
let core = self.core();
let uses = uses_of(core, descriptor)?;
let samplers = take_samplers(core, &uses)?;
@@ -1 +1 @@
3ce6013c34fd0d2581049bab81912a9ef3e9fe72a5f0bd79d9af5e48ae183e31
093c7dc198ccd45d755368e098d7e97b73200b2810831c7f029c5562131d09e2
@@ -29,9 +29,10 @@
//! **A runtime sampler** reads its pushed resource ID's word (`PushField::SlotGuestBase`): the
//! sample is linear where the word states linear minification and magnification, else nearest; the
//! taps follow the word's address modes, border color, and coordinates, and its level the word's
//! mip filter (below). No check refuses a bound word that states anything else but a cubic filter
//! (below): mixed filters sample as nearest, where Metal's sample is not measured. That is an open
//! gap, which no consumer meets while the runtime makes no texture of these formats.
//! mip filter (below). No check refuses a bound word that states anything else: mixed filters
//! sample as nearest, where Metal's sample is not measured, and so does a `Cubic` filter, whose word
//! is the nearest filter's. That is an open gap, which no consumer meets while the runtime makes no
//! texture of these formats.
//!
//! **Levels and layers.** A sample reads the level Metal's rule reads (`level`, the rule measured
//! on the other formats: the level rounded to `half`, clamped into the sampler's clamp and the
@@ -96,12 +97,12 @@
//! 2 x 6 and 1 x 1, sampled at each texel's centre and at random coordinates up to 0.15 of the
//! texture past its edges, 2,304 per texture, through constexpr bicubic samplers under clamp to
//! edge, repeat, mirrored repeat, clamp to zero and the opaque-black and opaque-white borders, with
//! pixel coordinates, and with a constant offset under clamp to edge and repeat, and through a
//! runtime sampler whose filters are `Cubic` (a constexpr sampler of its state, as for the other
//! formats, `bicubic::cubic_state`), with `float` results and, under clamp to edge, `half` ones:
//! 3,317,760 lanes): the footprint, the weights, the addressing, a mirrored axis and a level below
//! four texels are the other formats' (`bicubic`), each tap the decoded texel or the border texel
//! through the format's channels. The sum is the device's arithmetic (`bicubic::routines::Plane`:
//! pixel coordinates, and with a constant offset under clamp to edge and repeat, and on Metal
//! through a runtime sampler whose filters are `Cubic`, with `float` results and, under clamp to
//! edge, `half` ones: 3,317,760 lanes): the footprint, the weights, the addressing, a mirrored axis
//! and a level below four texels are the other formats' (`bicubic`), each tap the decoded texel or
//! the border texel through the format's channels. The sum is the device's arithmetic
//! (`bicubic::routines::Plane`:
//! the Catmull-Rom weights computed from the fraction, the decoded taps summed by its multiply and
//! add, a level below four texels its `FMix` of the inner taps), clamped into the decoded values of
//! the format's codes 0 and 1023 (a color lane's `(0 - 384) / 510` and `(1023 - 384) / 510`, an
@@ -1177,8 +1177,8 @@ fn select_extended(
if volume && (shape.array || gather.is_some() || !measured) {
return Err(refused());
}
// Metal's bicubic filter: a constexpr bicubic sampler's. The consumer makes no device sampler
// of a cubic descriptor (`docs/RESOURCE-ID.md`), so a runtime sampler's is never one.
// Metal's bicubic filter: a constexpr bicubic sampler's. A runtime sampler's is never one: a
// `Cubic` descriptor filters as nearest (`docs/RESOURCE-ID.md`).
let cubic = match sampler {
SamplerArg::Static(SamplerRef::Slot(_), _) => None,
SamplerArg::Static(r, _) => super::bicubic::state(r)?,
@@ -1452,7 +1452,7 @@ fn select_one(
// fetches).
let integer = texel(t, 4).is_ok_and(|(_, class)| class != TexelClass::Float);
// Metal's bicubic filter: every operation through such a sampler passes its checks. A runtime
// sampler is never one (the consumer makes no device sampler of a cubic descriptor).
// sampler is never one (a `Cubic` descriptor filters as nearest).
let bicubic = match stat {
Some((SamplerRef::Slot(_), _)) => None,
Some((r, _)) => super::bicubic::state(r)?,
@@ -637,6 +637,11 @@ metal_enum! {
SamplerMinMagFilter = "MTLSamplerMinMagFilter" {
Nearest = 0, "MTLSamplerMinMagFilterNearest";
Linear = 1, "MTLSamplerMinMagFilterLinear";
///
/// Not declared by the SDK headers: the raw value 2 of `minFilter` and `magFilter`. Metal
/// makes a sampler state of it; an Apple M3 Max filters through it bicubically, and a Radeon
/// Pro 5300M and an Intel UHD Graphics 630 as nearest. Its device sampler and sampler word
/// here are the nearest filter's (`docs/API.md`, accepted differences).
Cubic = 2, "MTLSamplerMinMagFilterCubic";
}
aliases {
+8 -20
View File
@@ -160,8 +160,7 @@ pub(crate) fn unnormalized_reads(desc: &SamplerDescriptor) -> bool {
)
};
!desc.normalized_coordinates
&& desc.min_filter == desc.mag_filter
&& desc.min_filter != SamplerMinMagFilter::Cubic
&& filter(desc.min_filter) == filter(desc.mag_filter)
&& desc.mip_filter == SamplerMipFilter::NotMipmapped
&& desc.max_anisotropy <= 1
&& clamps(desc.s_address_mode)
@@ -802,8 +801,9 @@ fn filter(f: SamplerMinMagFilter) -> vk::Filter {
match f {
SamplerMinMagFilter::Nearest => vk::Filter::NEAREST,
SamplerMinMagFilter::Linear => vk::Filter::LINEAR,
// Vulkan's cubic filter is not Metal's bicubic one, so the sampler holds a nearest
// placeholder; a constexpr bicubic sampler's samples are fetches, which read no sampler.
// Metal's undeclared raw value 2 filters as nearest (`docs/API.md`, accepted
// differences). A constexpr bicubic sampler's state is nearest too: its samples are
// fetches, which read no sampler.
SamplerMinMagFilter::Cubic => vk::Filter::NEAREST,
}
}
@@ -853,9 +853,9 @@ pub fn compare_op(f: CompareFunction) -> vk::CompareOp {
/// | 21 | [`ANISOTROPIC`](Self::ANISOTROPIC): `maxAnisotropy` is above 1 |
/// | 22-25 | [`LEVEL_MIN`](Self::LEVEL_MIN): the level a nearest mip filter reads at `lodMinClamp` |
/// | 26-29 | [`LEVEL_MAX`](Self::LEVEL_MAX): 15 less the level a nearest mip filter reads at `lodMaxClamp` |
/// | 30 | [`CUBIC`](Self::CUBIC): `minFilter` or `magFilter` is `Cubic` |
///
/// An address mode is `MTLSamplerAddressMode`'s value. Every other bit is 0. The LOD clamps
/// An address mode is `MTLSamplerAddressMode`'s value. A `Cubic` filter (Metal's undeclared raw
/// value 2) sets no bit: it is the nearest filter's word. Every other bit is 0. The LOD clamps
/// themselves, `lodAverage`, and the anisotropy's degree are not in the word: the Vulkan sampler
/// applies them; the word holds the levels a nearest mip filter reads at the clamps, which a
/// nearest sample's snap needs to know the level it reads.
@@ -907,13 +907,8 @@ impl SamplerWord {
/// 15 less the level a nearest mip filter reads at `lodMaxClamp` (as at
/// [`LEVEL_MIN`](Self::LEVEL_MIN)), so that the default clamp, which clamps nothing, is 0.
pub const LEVEL_MAX: u32 = 0xf << Self::LEVEL_MAX_SHIFT;
/// The min or the mag filter is `Cubic` (`MTLSamplerMinMagFilterCubic`, raw value 2): a
/// function sampling through an argument buffer's sampler tests it where it reads the sampler's
/// table entry, and fails its command buffer where it reaches one. It is the word's highest
/// bit, so the test is `word >= CUBIC`.
pub const CUBIC: u32 = 1 << 30;
/// Every bit a word may set.
pub const FIELDS: u32 = (1 << 31) - 1;
pub const FIELDS: u32 = (1 << 30) - 1;
/// The bits of the filter Metal's linear rule answers: the word masked by them is
/// [`LINEAR`](Self::LINEAR) exactly for a sampler whose minification and magnification filters
/// are linear, without a mip filter, and isotropic. Its reduction does not decide it: a minimum
@@ -951,11 +946,6 @@ impl SamplerWord {
if desc.mag_filter == SamplerMinMagFilter::Linear {
w |= Self::MAG_LINEAR;
}
if desc.min_filter == SamplerMinMagFilter::Cubic
|| desc.mag_filter == SamplerMinMagFilter::Cubic
{
w |= Self::CUBIC;
}
w |= desc.mip_filter.as_raw() << Self::MIP_FILTER_SHIFT;
let modes = [
desc.s_address_mode,
@@ -2109,7 +2099,6 @@ mod tests {
W::ANISOTROPIC,
W::LEVEL_MIN,
W::LEVEL_MAX,
W::CUBIC,
];
let mut union = 0;
for f in fields {
@@ -2183,7 +2172,7 @@ mod tests {
/// holds for linear minification and magnification filters of one isotropic level, whatever
/// the coordinates, addressing, border, comparison and reduction; the state an emulated
/// sample reads (`SamplerWord::LINEAR_STATE`) is every field but the comparison, the
/// reduction, the level clamps and the cubic filter.
/// reduction and the level clamps.
#[test]
fn a_sampler_word_answers_the_linear_predicate() {
use SamplerMinMagFilter as F;
@@ -2226,7 +2215,6 @@ mod tests {
& !SamplerWord::REDUCTION
& !SamplerWord::LEVEL_MIN
& !SamplerWord::LEVEL_MAX
& !SamplerWord::CUBIC
);
}
+1 -3
View File
@@ -100,7 +100,6 @@ assoc-const metal2vulkan::metal::sampler::SamplerWord::BORDER pub const BORDER:
assoc-const metal2vulkan::metal::sampler::SamplerWord::BORDER_SHIFT pub const BORDER_SHIFT: u32
assoc-const metal2vulkan::metal::sampler::SamplerWord::COMPARE pub const COMPARE: u32
assoc-const metal2vulkan::metal::sampler::SamplerWord::COMPARE_SHIFT pub const COMPARE_SHIFT: u32
assoc-const metal2vulkan::metal::sampler::SamplerWord::CUBIC pub const CUBIC: u32
assoc-const metal2vulkan::metal::sampler::SamplerWord::FIELDS pub const FIELDS: u32
assoc-const metal2vulkan::metal::sampler::SamplerWord::LEVEL_MAX pub const LEVEL_MAX: u32
assoc-const metal2vulkan::metal::sampler::SamplerWord::LEVEL_MAX_SHIFT pub const LEVEL_MAX_SHIFT: u32
@@ -269,8 +268,7 @@ assoc-const-value metal2vulkan::metal::sampler::SamplerWord::BORDER 0b11 <<Self:
assoc-const-value metal2vulkan::metal::sampler::SamplerWord::BORDER_SHIFT 14
assoc-const-value metal2vulkan::metal::sampler::SamplerWord::COMPARE 0b111 <<Self::COMPARE_SHIFT
assoc-const-value metal2vulkan::metal::sampler::SamplerWord::COMPARE_SHIFT 16
assoc-const-value metal2vulkan::metal::sampler::SamplerWord::CUBIC 1 <<30
assoc-const-value metal2vulkan::metal::sampler::SamplerWord::FIELDS (1 <<31) - 1
assoc-const-value metal2vulkan::metal::sampler::SamplerWord::FIELDS (1 <<30) - 1
assoc-const-value metal2vulkan::metal::sampler::SamplerWord::LEVEL_MAX 0xf <<Self::LEVEL_MAX_SHIFT
assoc-const-value metal2vulkan::metal::sampler::SamplerWord::LEVEL_MAX_SHIFT 26
assoc-const-value metal2vulkan::metal::sampler::SamplerWord::LEVEL_MIN 0xf <<Self::LEVEL_MIN_SHIFT
Can't render this file because it is too large.
+3 -3
View File
@@ -1221,8 +1221,8 @@ texturebuffer 586 1 0 0x024a0d24
sampler 0 0 0 0 0 0 0 1 0x00000000 0x7f7fffff 0 1 0 0 0x00000000
sampler 1 0 0 0 0 0 0 1 0x00000000 0x7f7fffff 0 1 0 0 0x00000002
sampler 0 1 0 0 0 0 0 1 0x00000000 0x7f7fffff 0 1 0 0 0x00000004
sampler 2 0 0 0 0 0 0 1 0x00000000 0x7f7fffff 0 1 0 0 0x40000000
sampler 0 2 0 0 0 0 0 1 0x00000000 0x7f7fffff 0 1 0 0 0x40000000
sampler 2 0 0 0 0 0 0 1 0x00000000 0x7f7fffff 0 1 0 0 0x00000000
sampler 0 2 0 0 0 0 0 1 0x00000000 0x7f7fffff 0 1 0 0 0x00000000
sampler 0 0 1 0 0 0 0 1 0x00000000 0x7f7fffff 0 1 0 0 0x00000008
sampler 0 0 2 0 0 0 0 1 0x00000000 0x7f7fffff 0 1 0 0 0x00000010
sampler 0 0 0 1 0 0 0 1 0x00000000 0x7f7fffff 0 1 0 0 0x00000020
@@ -1278,4 +1278,4 @@ sampler 0 0 0 0 0 0 0 1 0x00000000 0x7f7fffff 0 1 6 0 0x00060000
sampler 0 0 0 0 0 0 0 1 0x00000000 0x7f7fffff 0 1 7 0 0x00070000
sampler 0 0 0 0 0 0 0 1 0x00000000 0x7f7fffff 0 1 0 1 0x00080000
sampler 0 0 0 0 0 0 0 1 0x00000000 0x7f7fffff 0 1 0 2 0x00100000
sampler 1 2 2 2 3 5 2 0 0x40300000 0x41140000 1 8 6 2 0x58f6ab53
sampler 1 2 2 2 3 5 2 0 0x40300000 0x41140000 1 8 6 2 0x18f6ab53
1 # gpuResourceID high words (docs/RESOURCE-ID.md): one Metal descriptor per line, raw Metal values.
1221 sampler
1222 sampler
1223 sampler
1224 sampler
1225 sampler
1226 sampler
1227 sampler
1228 sampler
1278 sampler
1279 sampler
1280 sampler
1281 sampler
+3 -4
View File
@@ -33,7 +33,7 @@ Columns:
| Devices below the runtime's floor | 8 | 8 | 0 | 0 | 0 | 0 | 0 |
| The runtime's `Refusal` | 96 | 96 | 0 | 0 | 0 | 0 | 0 |
| The runtime's `Limit` | 21 | 21 | 0 | 0 | 0 | 0 | 0 |
| The runtime's `Gap` | 31 | 31 | 0 | 0 | 0 | 0 | 0 |
| The runtime's `Gap` | 31 | 30 | 0 | 0 | 0 | 0 | 0 |
## Totals by basis
@@ -143,7 +143,7 @@ Columns:
| `AlphaToOne` | `alphaToOneEnabled` on a device without Vulkan's `alphaToOne` feature, the exact counterpart... | devices without VkFeature::AlphaToOne | `device` | 1: `crates/metal2vulkan/src/pipeline/link/graphics.rs (graphics_state)` | `rare`: alphaToOneEnabled on a device without alphaToOne |
| `StageStoresAndAtomics` | Buffer or image stores or atomics in a vertex or fragment function without the stage's store feature (`vertexPipelineStoresAndAtomics`,... | devices without VkFeature::FragmentStoresAndAtomics | `device` | 1: `crates/metal2vulkan/src/lower/access/tile_memory.rs (written)` | `app`: stores or atomics in vertex or fragment functions on a device without the feature |
| `FunctionConstantArgument` | An observed read of a pointer entry argument that a function-constant predicate removes, other than an absent buffer (which reads as null) or an... | every device (not implemented) | `ours` | 1: `crates/metal2vulkan-air/src/canon/interface.rs (absent_values)` | `rare`: a function-constant-removed argument read |
| `SamplerBicubicFilter` | A use of Metal's bicubic filter that no Metal reading establishes | every device (not implemented) | `ours` | 2: `crates/metal2vulkan/src/lower/sampler/bicubic.rs (refuse)`, `crates/metal2vulkan/src/lower/sampler/select.rs (bicubic_refused)` | `system`: bicubic filtering forms Metal does not establish; macOS 26.6.2 makes a runtime sampler with MTLSamplerMinMagFilterCubic (the consumer's boots), whose mip-filtered form is refused |
| `SamplerBicubicFilter` | A use of Metal's bicubic filter that no Metal reading establishes | every device (not implemented) | `ours` | 2: `crates/metal2vulkan/src/lower/sampler/bicubic.rs (refuse)`, `crates/metal2vulkan/src/lower/sampler/select.rs (bicubic_refused)` | `system`: bicubic filtering forms Metal does not establish, through a constexpr sampler of filter::bicubic (a runtime sampler of MTLSamplerMinMagFilterCubic filters as nearest) |
| `GroupCount` | A dispatch whose threadgroup count on `axis` exceeds `maxComputeWorkGroupCount` by more than the binder splits into regions (`None` | - | `-` | 0 | `rare`: more threadgroups than a device dispatches, past the binder's split |
| `IntersectionFunctionTable` | A ray intersection through intersection functions | every device (not implemented) | `ours` | 6: `crates/metal2vulkan/src/lower/raytracing/mod.rs (intersect, 2 sites)`, `crates/metal2vulkan/src/lower/raytracing/mod.rs (null_table)` (+3) | `rare`: ray tracing (out of scope by ruling) |
| `IndependentBlending` | Color attachments whose write masks or blend states differ, as Metal sets them per attachment, on a device without `independentBlend`, where no... | devices without VkFeature::IndependentBlend | `device` | 1: `crates/metal2vulkan/src/pipeline/link/graphics.rs (uniform_blend)` | `rare`: per-attachment blending on a device without independentBlend |
@@ -359,7 +359,7 @@ Columns:
| `TextureBufferSwizzle` | A texture buffer (`MTLTextureTypeTextureBuffer`) with a swizzle other than each channel's own (`Buffer::new_texture`), which Metal applies to its... | every device (a public call's own check of its arguments) | `ours`: a texel buffer view has no component mapping, and a texture's resource ID carries no swizzle to the shader; no recorded stream makes one | 1: `crates/metal2vulkan-runtime/src/texture.rs (texel_shape)` | `-` |
| `TextureFormat` | A texture of a pixel format the runtime makes no image of on this device for the descriptor's usage | every device (a public call's own check of its arguments) | `ours`: the device's format query, or the identity domains' shaders read every texture through its view alone | 5: `crates/metal2vulkan-runtime/src/texture.rs (attachment_view)`, `crates/metal2vulkan-runtime/src/texture.rs (form)` (+3) | `-` |
| `MipmapFilter` | `BlitCommandEncoder::generate_mipmaps` of a texture whose image the device's blits do not filter | every device (a public call's own check of its arguments) | `ours`: the device's format query; the levels are the device's blit chain alone | 1: `crates/metal2vulkan-runtime/src/blit.rs (generate_mipmaps)` | `-` |
| `CubicSampler` | A sampler state whose minification or magnification filter is cubic (`Device::new_sampler_state`) | every device (a public call's own check of its arguments) | `ours`: the translator's identity domains do not filter bicubically, and Vulkan's cubic filter is not Metal's | 1: `crates/metal2vulkan-runtime/src/sampler.rs (new_sampler_state)` | `-` |
| `CubicSampler` | A sampler state whose minification or magnification filter is cubic | every device (a public call's own check of its arguments) | `ours`: the runtime's choice of nearest for a value Metal does not document | 0 | `-` |
| `TextureBytes` | `Texture::replace_region`, `Texture::get_bytes`, a Managed texture's places or a blit copy between a buffer and a texture... | every device (a public call's own check of its arguments) | `ours`: no copy between such an image and bytes is built | 6: `crates/metal2vulkan-runtime/src/blit.rs (buffer_copy)`, `crates/metal2vulkan-runtime/src/blit.rs (with_option)` (+4) | `-` |
| `TextureCopy` | `BlitCommandEncoder::copy_from_texture` that the floor's `vkCmdCopyImage` does not make | every device (a public call's own check of its arguments) | `ours`: Vulkan 1.3 copies none of these with one command; each is built when a replay stream makes one | 1: `crates/metal2vulkan-runtime/src/blit.rs (texture_copy)` | `-` |
| `OverlappingCopy` | A blit copy whose source and destination share memory where no copy command orders it as from the source before the copy, which Metal leaves... | every device (a public call's own check of its arguments) | `ours`: no copy command reads bytes it writes, `VUID-vkCmdCopyImage-pRegions-00124` and its twins, and the device's layout of two heap textures leaves no cut; rows of two pitches that cross are built, in an order of rows from where they cross, when a replay stream or a walk counts one; the whole level between two heap textures is built through an image of the runtime's, counted, when a guest's run counts one | 2: `crates/metal2vulkan-runtime/src/blit.rs (buffer_copy)`, `crates/metal2vulkan-runtime/src/blit.rs (copy_from_texture)` | `-` |
@@ -651,7 +651,6 @@ Each refusal's sites, with the function that builds it.
- `rt:Gap::TextureBufferSwizzle`: `crates/metal2vulkan-runtime/src/texture.rs (texel_shape)`
- `rt:Gap::TextureFormat`: `crates/metal2vulkan-runtime/src/texture.rs (attachment_view)`; `crates/metal2vulkan-runtime/src/texture.rs (form)`; `crates/metal2vulkan-runtime/src/texture.rs (planned)`; `crates/metal2vulkan-runtime/src/texture.rs (texel_form)`; `crates/metal2vulkan-runtime/src/texture.rs (texel_texture)`
- `rt:Gap::MipmapFilter`: `crates/metal2vulkan-runtime/src/blit.rs (generate_mipmaps)`
- `rt:Gap::CubicSampler`: `crates/metal2vulkan-runtime/src/sampler.rs (new_sampler_state)`
- `rt:Gap::TextureBytes`: `crates/metal2vulkan-runtime/src/blit.rs (buffer_copy)`; `crates/metal2vulkan-runtime/src/blit.rs (with_option)`; `crates/metal2vulkan-runtime/src/blit/samples.rs (aspect)`; `crates/metal2vulkan-runtime/src/blit/samples.rs (check)`; `crates/metal2vulkan-runtime/src/texture.rs (check_places)`; `crates/metal2vulkan-runtime/src/texture.rs (copy)`
- `rt:Gap::TextureCopy`: `crates/metal2vulkan-runtime/src/blit.rs (texture_copy)`
- `rt:Gap::OverlappingCopy`: `crates/metal2vulkan-runtime/src/blit.rs (buffer_copy)`; `crates/metal2vulkan-runtime/src/blit.rs (copy_from_texture)`
+8 -9
View File
@@ -106,10 +106,10 @@ Element `i` of each sampler array is a device sampler made of the sampler whose
one per use, which the shader picks by the instruction and the texture's numeric type: binding 2
for a plain sample, 3 for a depth comparison, and 4 for a texture of an integer format, every
filter nearest. The consumer makes each from the descriptor (its reduction mode and anisotropy
included); it makes none of a descriptor whose min or mag filter is cubic. A shader takes a
runtime sampler slot's ID from the slot's push field, samples through the element its low word
indexes, and reads the word's fields where a sample depends on them (pixel coordinates, a nearest
pixel sampler).
included); a min or mag filter of `Cubic`, Metal's undeclared raw value 2, is made as nearest
(`docs/API.md`, accepted differences). A shader takes a runtime sampler slot's ID from the slot's
push field, samples through the element its low word indexes, and reads the word's fields where a
sample depends on them (pixel coordinates, a nearest pixel sampler).
A sampled cube's or cube array's element is its cube view, whose texels no fetch addresses, so a
`read` of it by face (`read(coord, face, lod)`, and with the cube index for a cube array) samples
@@ -129,8 +129,7 @@ address modes. A shader takes an argument buffer's sampler's ID from the member'
samples through the element of its use's array that its low word indexes, and reads the word's
fields as a runtime sampler slot's. The program writes the ID, so the shader compares its index
with the arrays' length: an index of 4,000 or more reads element 0, the default sampler, never one
outside the arrays. The runtime makes no sampler of a cubic filter, so no live ID's word carries
bit 30, and the shader does not test it.
outside the arrays.
## The texture word
@@ -197,7 +196,8 @@ format keeps its code. A texture buffer whose words overflow a `u32` has no word
## The sampler word
`metal2vulkan::metal::sampler::SamplerWord::of(descriptor)`. Each field holds its
`MTLSamplerDescriptor` value's raw Metal value, so the default descriptor's word is 0:
`MTLSamplerDescriptor` value's raw Metal value, so the default descriptor's word is 0. A `Cubic`
`minFilter` or `magFilter` (raw value 2) is the nearest filter's word:
| Bits | Field |
|---|---|
@@ -212,8 +212,7 @@ format keeps its code. A texture buffer whose words overflow a `u32` has no word
| 21 | `maxAnisotropy` is above 1 |
| 22-25 | the level a nearest mip filter reads at `lodMinClamp` |
| 26-29 | 15 less the level a nearest mip filter reads at `lodMaxClamp` |
| 30 | `minFilter` or `magFilter` is `Cubic` |
| 31 | 0 |
| 30-31 | 0 |
The level a nearest mip filter reads at a clamp `c`: take `c` below 0 as 0, and below 64 truncate
it onto sixty-fourths of a level; if the result is 15 or more the level is 15; otherwise, with `L`
+1 -1
View File
@@ -93,7 +93,7 @@ feature SamplerAddressMode app mirror-clamp-to-edge on a device without it
feature AlphaToOne rare alphaToOneEnabled on a device without alphaToOne
feature StageStoresAndAtomics app stores or atomics in vertex or fragment functions on a device without the feature
feature FunctionConstantArgument rare a function-constant-removed argument read
feature SamplerBicubicFilter system bicubic filtering forms Metal does not establish; macOS 26.6.2 makes a runtime sampler with MTLSamplerMinMagFilterCubic (the consumer's boots), whose mip-filtered form is refused
feature SamplerBicubicFilter system bicubic filtering forms Metal does not establish, through a constexpr sampler of filter::bicubic (a runtime sampler of MTLSamplerMinMagFilterCubic filters as nearest)
feature GroupCount rare more threadgroups than a device dispatches, past the binder's split
feature IntersectionFunctionTable rare ray tracing (out of scope by ruling)
feature IndependentBlending rare per-attachment blending on a device without independentBlend
Can't render this file because it contains an unexpected character in line 17 and column 65.
+11 -3
View File
@@ -242,9 +242,11 @@ PRIVATE = {
("MTLPixelFormatRGB10A8Uint_2P", 650),
],
# Metal's own name for the raw value 2 of `minFilter` and `magFilter`, which a sampler
# descriptor's description prints (an Apple M4 on macOS 27.0.1): Metal makes
# a sampler state of it, and samples through it with its bicubic filter. The
# descriptor keeps two bits; 3 stops the process in `newSamplerStateWithDescriptor:`.
# descriptor's description prints (an Apple M4 on macOS 27.0.1): Metal makes a sampler state
# of it on every Mac measured, and samples through it with a bicubic filter on an Apple M3 Max
# and an Apple M4 (macOS 27.0.1) and as nearest on a Radeon Pro 5300M and an Intel UHD Graphics
# 630 (macOS 26.7.1). The descriptor keeps two bits; 3 stops the process in
# `newSamplerStateWithDescriptor:`.
"MTLSamplerMinMagFilter": [("MTLSamplerMinMagFilterCubic", 2)],
# The `functionType` Metal answers for a Core Image kernel library's extern function (`TYPE` 5,
# from `newFunctionWithName:` or `newExternFunctionWithName:`), whose description prints
@@ -271,6 +273,12 @@ PRIVATE = {
# A doc comment for a `PRIVATE` enumerator, emitted on its variant after the enumerator's name, for
# a value whose meaning a consumer of the variant needs.
PRIVATE_DOCS = {
"MTLSamplerMinMagFilterCubic": [
"Not declared by the SDK headers: the raw value 2 of `minFilter` and `magFilter`. Metal",
"makes a sampler state of it; an Apple M3 Max filters through it bicubically, and a Radeon",
"Pro 5300M and an Intel UHD Graphics 630 as nearest. Its device sampler and sampler word",
"here are the nearest filter's (`docs/API.md`, accepted differences).",
],
"MTLTriangleFillModePoints": [
"Not declared by the SDK headers: the raw value 2, which Apple's GL renderer sends",
"for `glPolygonMode(GL_POINT)`. Metal draws each triangle's vertices as points of one",