Files
metal2vulkan/docs
Anees Iqbal 37f0bf51f8 rt encoder arms: textures, sampler states and constexpr samplers by pushed index
ComputeCommandEncoder::set_texture (128 slots, Refusal::TextureArgumentIndex past them) and
set_sampler_state (16 slots, Refusal::SamplerArgumentIndex) bind as Metal's calls do, and
use_resource takes a texture as it takes a buffer. A dispatch pushes, for each texture and sampler
slot its kernel reads, the bound object's gpuResourceID (0 for none), whose index names its
elements of set 1; for a texture slot an integer write saturates through, the channel widths of
the bound texture's format (metal::format::integer_channels_word, now public); and for each
constexpr sampler, the index the consumer gave it. Nothing is written into set 1 at bind or
dispatch time, and every texture stays in its home layout. A texture's sample and read are reads
in the hazard sets, a texture one resource, with a hazard id from core's ids.

Each command buffer binds set 1 (vkCmdBindDescriptorSets, firstSet 1) once, before its first
pipeline; without it the lavapipe run reported VUID-vkCmdDispatch-None-08600. The command
buffer keeps each texture and sampler state an encoder binds or declares, in command.rs's Gpu
next to its blocks and pipelines, dropped with them at retire, so their elements stay theirs
while work may read them.

Device::new_compute_pipeline_state takes sampler_ids: the samplers the kernel numbers, in
Metal's order (NumberedSampler: each constexpr sampler, then one for a texture read and one for a
texture write), answered with an index each from the consumer's sampler grants
(Refusal::SamplerIds for another count). A constexpr sampler takes, before the call returns, the
device sampler of each use the kernel has (CombinedSampler::constexpr_sampler, canonical, shared
by create info with sampler states') at its index of the three sampler arrays; states that number
one constexpr sampler at one index share it, another sampler there is Refusal::IndexInUse, and
the last of them writes the defaults back and frees the index. Set 1's layout is checked against
the translator's (IdentityArray bindings). A kernel whose texture or sampler the translator would
take from the bound object rather than its resource ID stays Gap::KernelInput.

The harness grants its own texture and sampler indices on the new runtime and numbers constexpr
samplers by their words, so constexpr_sampling runs on it.

README: the encoder's texture and sampler arms, the numbering paragraph, the KernelInput gap.
REFUSALS.md regenerated; api_signatures and api_surface carry integer_channels_word and the new
refusals.

Verified:
- m3-max-42749 (msi), this tree: clippy of metal2vulkan-rt plain, --cfg m2v_gpu and --cfg
  m2v_cpu_icd green; rustdoc -D warnings green; nextest 37 of 37; the device tests on lavapipe
  under the validation layer 79 of 79, 0 validation errors (tests::sampling: sample_down through a
  runtime sampler, then sample_up through a constexpr sampler, against the linear filter's
  answers; the constexpr index shared, refused to a sampler state and freed with the last state).
- The same change on the sampler landing before development's region commits (tree
  ed71d2de2e): m3-max-42714 (780M, radv) and m3-max-42716 (3090), its archive under the
  validation layer, 76 of 76 each (the three source-reading tests skipped off the building
  machine), 0 validation errors, every gauge zero at drop; m3-max-42735 (UHD 630, Windows), its
  cross-built archive, 79 of 79, every gauge zero at drop.
- m3-max-42638 (msi), tree ed71d2de2e: clippy of metal2vulkan-harness plain and --cfg m2v_gpu green;
  the api_signatures and api_surface tests green.
2026-11-17 15:03:53 -08:00
..