Files
metal2vulkan/docs
Anees Iqbal b7ef04ae97 rt: a sampler state binds with LOD clamps that read as its own; others are Gap::LodClamps
The replay streams bind sampler states with Metal's bind-time LOD clamps
(`setFragmentSamplerStates:lodMinClamps:lodMaxClamps:withRange:`): web3d on the 780M makes 2,635
such calls and on the 3090 2,627, every one over a state made with clamps (0, FLT_MAX), half of
them binding (0, FLT_MAX) and half (0, 1000); glbench makes none (replay's census). rt had no
such form, so the player skipped and counted the second kind.

A sample's level is clamped into the clamps and then to the texture's levels, at most 14 (Metal's
largest textures have 15 levels), and a level below 0 is level 0. So two clamps read alike where
each bound held to [0, 15] (the translator's LAST_WORD_LEVEL) is equal: in Metal's sampler, in
the device sampler `vk_sampler` makes (Vulkan clamps into [minLod, maxLod] and then to the view's
levels) and in the sampler word. The translator states the rule
(`metal::sampler::lod_clamps_read_alike`); rt's compute encoder (`set_sampler_state_with_lod_clamps`)
and render encoder (`set_vertex_sampler_state_with_lod_clamps`,
`set_fragment_sampler_state_with_lod_clamps`) bind the state as it is where the clamps read as
its own, which covers every call the streams make at no cost, and refuse others as the new
`Gap::LodClamps`, binding nothing (no stream makes one; a variant or a shader clamp is built when
one does). Each range form is a loop of its single form.

Tests: the translator's unit test pins the rule (1000 and infinity over FLT_MAX, -1 over 0 alike;
14, a raised lower bound and NaN not) and that every alike pair gives the descriptor's word, query
level and device lods; a device test binds on the three forms and gets the gap on each; the
sampling test binds its state with (0, 1000) and checks its samples as before. REFUSALS.md
regenerated; the signature and surface tables take the new items. Verified in the job named in the
landing message.
2026-11-18 18:05:44 -08:00
..