A function made with values that lack a constant an argument's binding index
reads (`[[buffer(kIdx)]]`, kIdx given no value) was made, the bundle taking the
missing required constant as 0: the argument sat at index 0, beside the
kernel's buffer 0 or alone, where Metal refuses the function.
What Metal answers, measured by an oracle probe of our own on macbook-pro-2019,
macOS 26.7.1 (25G241), the AMD Radeon Pro 5300M (m3-max-84515/84516), and on
the M3 Max, macOS 27.0.1 (m3-max-84627), the same 110 answers: nil and
MTLLibraryErrorDomain code 3, its description alone, a line for each such
argument in argument order, "error: texture argument ts has invalid location
(<_ZL32__metal_implicit_attr_int_expr_2,2>) in k_texarr\n", the global the
module stores the index in by name and the count. Buffers, threadgroup memory,
textures, arrays of textures and samplers alike, kernels, vertex and fragment
functions alike, used or not. Such an argument takes no location, so a later
one at the same index is no overlap; overlap lines keep their form, in the
same order. An argument whose predicate the values leave undecided is left out,
and an index of a default (`is_function_constant_defined(k) ? k : 3`) is made.
What the guest sees now: newFunctionWithName:constantValues:error:, and every
way that reaches it (descriptors, completion handlers), answers nil with
Metal's error and words for such values, and never takes 0 for the missing
index. The refusal of overlapping locations, RgfxOverlappingArgumentError, is
now RgfxInvalidLocationError: it runs the module's initialisers with the values
given, and, where a global they do not decide is read, again with a 0 for each
declared constant the values lack; a global only that run decides is one the
values leave undecided. The AIR reader keeps the names of an argument's index
and count globals. Functions given every constant answer as before.
test_undecided_locations_refused_as_metal holds the oracle's words for
tests/undecided_locations.metal (the probe's source), first two arguments at
one undecided index, and compares every function under each of the probe's
takings, by values set by name, by index and in a descriptor, with this Mac's
own Metal.
(cherry picked from commit cbae8ac8df3ba63894826c2ef1d631f00881acf9)