Files
metal2vulkan/docs
Anees Iqbal 5806b10c13 Translator: a sampled cube read by face samples its cube element under the identity domains
L215 (a). A texturecube or texturecube_array read by face was declared as the binder's 2D-array
view of its faces (RuntimeFact::ImageViewShape), since SPIR-V's OpImageFetch takes no cube. The
identity domains hold a sampled cube's element as its cube view and source no such fact, so
every such read was Unsupported{IdentityDomains}.

Under the identity domains a sampled cube (not a depth cube) that is read is now declared as its
cube element, and the read samples it. It goes through element 0 of its numeric type's sampler
array (binding 2, or 4 for an integer texture), which no ID reaches: the default sampler. It
samples at the direction of the read texel's centre on its face, with the read's level as the
explicit Lod.
- On face f the centre is (sc, tc) = ((2x + 1 - w) / w, (2y + 1 - h) / h), whose numerator is an
  exact integer.
- The direction is Vulkan's cube map face selection read backwards, the table Metal's faces share.
  With m the face's sign, it is (m, -tc, -m*sc), (sc, m, m*tc) or (m*sc, -tc, m).
- Its major axis is the face's, at magnitude 1, so (s, t) on that face is the texel's centre, half
  a texel inside its cell, and nearest reads that texel. Integer Lod l under nearest mip selects
  level l.
- A sample clamps every operand, so the read is checked in the shader on every device
  (ReadCheck::Shader). x and y are tested against the extent at the level, the face against 6, the
  cube index against the cube count, and the level against the level count, with Metal's
  out-of-bounds texel outside (its alpha from the ID's word).
- slot::samples_cube_element is the one rule the declaration and the read's check share.
  SlotPlan::face_sampler gives the sampler use the sampler family declares.
- A depth cube read by face, and a cube whose faces an emulated filter fetches, keep the 2D-array
  view and stay refused under the identity domains. The table domains are unchanged.

The runtime's default samplers now reach every level (maxLod VK_LOD_CLAMP_NONE, was 0), so an
explicit level past 0 reads that level. A sampler element nobody owns holds the default, as do
nil, freed and out-of-range sampler IDs. Their samples could reach only level 0 before; they now
reach the level they ask for.
Existing tests that cover the default samplers:
- tests::arrays' set_1_is_filled_at_creation (both live with set 1);
- tests::device's gauge check (set 1's two default samplers and nothing else);
- tests::argument_sampling's argument_sampler_edges (an argument buffer's sampler against the
  default's answer).
RESOURCE-ID.md states the default sampler and the cube read's contract for a consumer that lays
the arrays out itself. API.md and the runtime README say so too; the README's known gap now names
only the depth cube read.

A refusal becomes a module, so SEMANTICS_VERSION 2315. The golden table's cube_faces cells
change from the refusal, a bless at the next pin. No refusal site was added or removed:
docs/REFUSALS.md regenerates unchanged.
2026-12-02 07:25:18 -08:00
..