identity domains: a 2D bicubic sample reads its slot's format treatment from a pushed word

Under the identity domains (Device::from_queries, the new runtime's translator device) every
kernel that sampled a texture through a bicubic constexpr sampler was refused as
Unsupported{IdentityDomains} ("a bicubic filter"), because the filter's treatment of the bound
format (its inner taps, its clamp and its border texels) was a SpecKey::BicubicTexels
specialization the old binder sets from the bound texture. One compute pipeline of every macOS
guest boot met that refusal; the old runtime builds it.

The treatment is now one u32 field per bicubic slot, PushField::BicubicTexels(SlotRef), placed
and filled as TextureIntegerChannels is. The 2D routine already took the bits as a run-time value
(Bits::Value), so a sample reads the field instead of the constant; no per-format pipeline, no
new descriptor. metal::format::bicubic_texels_word(pf, swizzle) gives the word the binder
specializes the constant to (BICUBIC_TEXELS_UNBOUND for a slot bound to nothing), and None for a
format of no measured family or of 8-bit sRGB codes. rt fills the field from the bound texture
when the slot's texture changes, and refuses a dispatch whose bicubic slot holds a texture with no
word as Gap::BicubicTexels, naming the slot and the pixel format. The static precision note
BicubicFilterArithmetic stays.

Still refused under the identity domains, each the refusal it was: a bicubic sample of a 1D
texture or at pixel coordinates (and the in-place two-plane routine), an argument buffer's
texture, an array of samplers. The default domains (Device::new, the frozen old runtime's path)
are unchanged: they still specialize SpecKey::BicubicTexels and state RuntimeFact::BicubicTexels,
and the binders refuse the new field.

SEMANTICS_VERSION 2199 -> 2200, ARTIFACT_FORMAT_VERSION 554 -> 555 (a new push field tag).
docs/REFUSALS.md regenerated; api_signatures table blessed; docs/API.md and the rt README's known
gaps say what is lowered and what is refused.

Tests:
- engine_identity::a_bicubic_kernel_reads_each_slots_format_treatment_from_its_pushed_field
  (replaces the refusal test; fails without the change): bcu_formats on lavapipe and moltenvk-m3
  profiles under the default domains keeps its 10 facts and 10 spec keys and no push field; under
  the identity domains it compiles, passes L3, pushes the 10 slots' fields, declares no spec key
  and no fact, and keeps the precision note; bcu_forms (1D) and bcu_address (pixel) still compile
  on the default domains and are refused under the identity domains.
- rt tests::bicubic (device cfg): each format bound at every slot of bcu_formats pushes its word,
  its arm asserted per format (R32Float linear; RGBA8Unorm, RGBA16Unorm, R8Unorm the [0, 1] clamp;
  RGBA8Snorm the [-1, 1] clamp; RGBA16Float no clamp), an unbound slot the unbound word, and an
  RGBA8Unorm_sRGB texture at slot 3 is Gap::BicubicTexels naming slot 3 and the format.
This commit is contained in:
Anees Iqbal committed 2026-11-20 02:55:02 -08:00
1 parent b506518794
commit 6833eba8e2
23 files changed
+474 -58

No files matched your search

+15 -4
View File
@@ -178,8 +178,18 @@ compile does. `DevicePolicy::default()` is `DevicePolicy::UNTRUSTED`:
consumer pushes for it (`PushField::ConstexprSampler`), where the consumer places the device
sampler `CombinedSampler::constexpr_sampler` describes, normalized: the shader scales a pixel
sampler's coordinate. An integer write to a storage slot without a format saturates to the channel
widths the consumer pushes (`PushField::TextureIntegerChannels`). A fragment function under the
pipeline's private alpha test (`PrivateRenderState::alpha_test_enabled`, a compare function other
widths the consumer pushes (`PushField::TextureIntegerChannels`). A sample of a 2D texture
slot through a bicubic constexpr sampler at normalized coordinates reads how Metal's bicubic
filter treats the bound texture's texels (its inner taps, its clamp and its border texels) from
the word the consumer pushes for that slot (`PushField::BicubicTexels`:
`metal::format::bicubic_texels_word` of the bound texture's format and swizzle,
`metal::format::BICUBIC_TEXELS_UNBOUND` for a slot bound to nothing), the bits the default
domains specialize `SpecKey::BicubicTexels` to. `bicubic_texels_word` has no word for a
compressed, YUV, stencil, integer, extended-range or 8-bit sRGB format, so such a texture has
no bicubic sample there (the new runtime refuses the dispatch, `Gap::BicubicTexels`). Its
arithmetic is noted `PrecisionNote::BicubicFilterArithmetic`, as on the default domains. A
fragment function under the pipeline's private alpha test
(`PrivateRenderState::alpha_test_enabled`, a compare function other
than `Never` or `Always`) compares its color 0's alpha with the code the consumer pushes
(`PushField::AlphaTestReference`): `bind::alpha_test_code` of the encoder's
`setAlphaTestReferenceValue:`, 1 until the encoder sets it. It is Metal's 8-bit unorm code of the
@@ -197,8 +207,9 @@ compile does. `DevicePolicy::default()` is `DevicePolicy::UNTRUSTED`:
and its constexpr samplers. Any other function is refused as `Unsupported{IdentityDomains}`,
whose symbol names the first such form the function holds: one that samples through an
argument buffer's sampler or an array of samplers or samples an argument buffer's texture,
emulates a sampler's anisotropy or bicubic filter, uses a texture buffer, a slot's levels or
swizzle, a two-plane, extended-range or sRGB-twin form, reads an argument buffer's texture
emulates a sampler's anisotropy, samples a 1D texture or at pixel coordinates through a bicubic
filter, uses a texture buffer, a slot's levels or swizzle, a two-plane, extended-range or
sRGB-twin form, reads an argument buffer's texture
through another numeric type or as raw texels, reads the texture of an argument buffer that a
pointer another argument buffer holds reaches (it reads the root table, `RootTableAddress`), or
uses any other state of a texture or sampler beyond its ID.