A constexpr sampler's numbering is a placement like any other. Where a sampler state took the
index from it, a later pipeline state that numbers the constexpr sampler there took nothing back:
it sampled through the program's sampler. Now it places the constexpr sampler there again with
every element it holds (Arrays::hold_samplers: under the grants' lock, the owner's additions where
it still owns the index, else a placement), and the constexpr sampler keeps its elements' samplers
to write them. The consumer chooses constexpr indices and keeps them from the program's sampler
states while a state numbering one lives; rt does not check it (rt README, compute pipeline
docs).
An object the program released while a command buffer that used it is pending is displaced like
a live one: a placement at its index takes it at once, and its teardown once the command buffer
retires touches nothing it no longer owns (one owner compare for both). Nothing empties an
element at the program's release: a committed command buffer still reads the object through its
index, which Metal allows. The owner's teardown nulls it. RESOURCE-ID.md states the duty (no work
in flight reads a displaced or released object through its ID) and what an element no object owns
holds: every element is written at device creation, a null descriptor (nullDescriptor, on the
floor) or the array's default sampler, and written back to that when its owner goes.
The replay player gave constexpr samplers the lowest free sampler index, the range the stream's
named sampler IDs come from, so a program's sampler state could take a constexpr sampler's index.
It now gives them the highest free one, outside that sequence (Indices::highest; REPLAY-STREAM.md).
Tests:
- sampling::every_device_gives_a_constexpr_sampler_s_index_to_the_object_placed_there_last: a
nearest sampler state over sample_up's linear constexpr sampler reads nearest; a later state
numbering it takes the index back (linear, for both states); the sampler state's going touches
nothing; the slot gauge counts the index once.
- sampling::every_device_gives_a_released_object_s_index_to_the_next_at_once: a command buffer
samples A through SA, signals and waits on the host; A and SA are released and B and SB made at
their indices while it is pending (asserted); another queue reads B through SB; after the first
command buffer retires, and A and SA with it, the index still reads B through SB. The writes are
valid under UPDATE_UNUSED_WHILE_PENDING with PARTIALLY_BOUND (vkspec: "as long as they are not
dynamically used by any shader invocations"): A's dispatch completed before its signal.
- replay a_constexpr_sampler_takes_no_index_of_the_sequence.