Files
metal2vulkan/docs
Anees Iqbal d3d40dd31e Identity domains: an argument buffer's texture sampled through the argument buffer's own sampler
Under the identity domains, an argument buffer's sampler was refused. Its cubic test pushed the
execution status address ("an encoder value the function reads as ExecutionStatusAddress"), and
behind that was the form's own refusal ("an argument buffer's sampler"). The sampler's resource ID
is now its handle, read from the member's 8 bytes with no sampler table (access::handle,
emit_identity_sampler):
- Its index selects the element of the set-1 sampler array of its use. That is the array an
  argument buffer's sampler already declares, at the same binding the slot samplers' identity
  arrays use.
- The word's fields (pixel coordinates, the nearest-pixel test) come from the ID's high word
  (sampler::emit::heap_sampler_field).
- The handle is a uvec2 wherever it is held (lowered_pointer, and word_repr for a member word).
  A select's null operand is the nil ID.

Bad-ID guard: compare-and-select, index < 4,000 ? index : 0, so an index past the arrays samples
through element 0, the default sampler. I chose it over 4,096-element arrays with a 12-bit mask
because it is two instructions with no layout or floor change. The mask would need every array at
4,096 elements and every unowned element holding the default sampler, which the floor does not
state. pipeline::link::IDENTITY_SAMPLERS becomes pub(crate) for it.

No cubic test under the identity domains (sampler::select::cubic_reach returns early). The runtime
makes no sampler state of a cubic filter (Gap::CubicSampler), so no live ID's word carries bit 30.
The runtime README says so beside the gap, and docs/RESOURCE-ID.md says how the shader reads the
ID.

The conformance ledger's 32 rows refused only by the cubic mark now run through the runtime. On
lavapipe:
- 3 match: pixel-samplers-rgba16f-nearest-{border,edge,zero}.
- 5 are refused at case/encoder, Unavailable argument_encoder or argument_encoder_with_arguments:
  the rt side has no argument encoder.
- 24 differ. In each, every source our side runs answers alike wherever Metal's do.
Their 32 rows become 192 rows scoped to llvmpipe, each naming its note and bound:
- pixel-downscales: pixel-sampler-scaling, 2/255.
- pixel-samplers linear: device-sampling.
- rgba8 nearest and subnormal: device-texel-conversion.
- the two nearest mirror norm sites: device-sampling, the device's mirror clamp to edge at
  normalized coordinates, which a device test shows a slot's sampler and an argument buffer's
  read alike.
docs/CONFORMANCE-COVERAGE.md is regenerated for the ledger (7,490 rows to 7,650).

pixel-samplers now declares the slot form's pixel-sampler-scaling on nearest states as well
(replay::pixel_sampler_scaling_notice): under the identity domains the slot's word is read at
dispatch, so the note is the operation's on any state.

SEMANTICS_VERSION 2231 (a placeholder for the landing to renumber).

Tests:
- engine_identity's
  an_argument_buffers_sampler_samples_through_the_identity_arrays_by_its_resource_id covers
  tail_argument_samplers' four kernels and tail_argument_cube_gradient on every profile: L3, set
  0 empty, set 1 the identity layout, the bindings used, no sampler slot ID, constexpr index or
  status address pushed, and no RuntimeFact::CubicArgumentSampler.
- metal2vulkan-runtime tests::argument_sampling (lavapipe, m2v_cpu_icd):
  - argument_sampler_edges through a linear state reads the edge averages; through an ID of that
    word with index 4,000 it reads element 0's nearest texels (the guard).
  - every_device_samples_alike_through_an_argument_buffers_sampler_and_a_slots: one texture at
    the pixel-samplers case's 800 normalized coordinates through one nearest state under clamp to
    edge, to zero, to an opaque white border and mirror clamp to edge, bound at a slot and held in
    an argument buffer; bit-equal.
- validation's an_argument_buffer_sampler_samples_its_member_texture compares the runtime's run
  with Metal's texels, where it held the refusal.

Verified (potluck jobs; this commit's tree equals WIP 16c70bf88a on acc706ca47):
- Gate m3-max-61241 (um870, at WIP 7df837b74d, the same tree but for the coverage document):
  focused tests (the (ii) translator, runtime device and validation tests, golden, argument
  sampler and cubic) pass on lavapipe; fmt, clippy (plain, --cfg m2v_gpu, --cfg m2v_cpu_icd) and
  Rustdoc clean; the suites of metal2vulkan, metal2vulkan-runtime and metal2vulkan-conformance on
  lavapipe: 4,866 of 4,868 pass. The two red: the_old_render_descriptor_key_keeps_its_value (red
  between pins) and the coverage document test, for this ledger's rows; the document is
  regenerated here (python3 -I scripts/conformance-coverage/coverage.py) and its test passes
  at 16c70bf88a (m3-max-61285, um870).
- Mirror control, lavapipe (m3-max-61184, at WIP 01ba67160c on dc21cd66c7): both
  argument_sampling device tests pass; slot and argument-buffer samplers bit-equal under all four
  address modes.
- Conformance replay --cpu on lavapipe with the new ledger: m3-max-61194 (um790, WIP 8793aab9ce
  on dc21cd66c7) and m3-max-61223 (gem10, at 7df837b74d) rc=0: announced 3, divergent 24 (each
  held by its llvmpipe row), refused 5.
- Family C proofs at WIP 5277d7228 on dc21cd66c7 (translator source equal to this commit's but for
  SEMANTICS): SCOPE=public m3-max-61166, 14 cases, match 10 -> 14 (06b41c83, 0e720f8b, 2648a020,
  34f89406 flip from not_supported to match), slowest after 06b41c83 1.05 s, 207 MiB; SCOPE=private
  m3-max-61180, 6/6 match before and after, slowest after 1.92 s, 220 MiB.
- States-only play on lavapipe, 36 streams, player built at WIP 0ff352d28b on dc21cd66c7
  (translator source equal): render made 291,334, refused 0; compute made 51,029, refused 0;
  0 newly refused states (m3-max-61181 ms01, 61188 um870, 61196 um790, 61206 gem10, 61210 msi).
2026-11-20 19:31:25 -08:00
..