A texture slot a function uses, bound to a texture whose usage lacks what the function's access
there asks, reaches no element of the texture's, and nothing refuses it: the slot reads element 0
of set 1 (nil's null descriptor) as zeros and its writes are dropped. A texture no shader reaches
(a Depth32Float target of RenderTarget usage alone, a texture of PixelFormatView usage alone) has
no index; a colour target of RenderTarget usage alone has an index whose elements are null; a
texture not made for shader writes has no storage element. This is the index-free direct bind of
the consumer's row 194 that is still open after f3bb94275b, which refuses the bind of a texture
reached through its views alone.
Metal binds such a texture and its validation stops the command that uses the slot, by the
argument's declared access; plain Metal reads and writes the texels. Measured on an Apple M3 Max,
macOS 27.0.1 (jobs m3-max-78392 and m3-max-78422, runtime-compiled MSL):
- setTexture:atIndex: binds every such texture, under the validation layer too;
- the validation layer asserts at the dispatch "Compute Function(k_read): reads texture (t[0])
whose usage (0x04) doesn't specify MTLTextureUsageShaderRead (0x01)" for a sample, a read or a
get_width alone of an access::read or access::sample argument; "writes texture (t[0]) whose
usage (0x01) doesn't specify MTLTextureUsageShaderWrite (0x02)" for an access::write argument,
its get_width alone included; both for access::read_write; and at the draw "Fragment
Function(f_first): Shader reads texture (t[0]) whose usage (0x04) doesn't specify
MTLTextureUsageShaderRead (0x01)", the pass's own attachment included;
- Metal's unknown usage answers 0x17 and passes every access; a view's usage is its texture's
(0x14, 0x11); a view made with a swizzle answers 0x11 (ShaderRead | PixelFormatView) of a
texture of 0x13 and of one of unknown usage, and a write of it asserts;
- with the layer off, plain Metal reads the depth (0.75), the texels (64, 128, 192, 255) and the
width (4) in every case, and writes a swizzled view through its swizzle.
This commit adds the refusal a dispatch or draw will return (stage, slot index, the texture's
usage as Metal answers it), its basis line, REFUSALS.md, basis.rs and the signature table, and the
device test slot_usage: sample_down (slot 0 sampled, slot 1 written and its size asked),
depth_fill_read and first_texel_fragment over textures of each usage. Its controls (read and
write usage, unknown usage, a view of a read texture, a read depth) run with their texels; a
render-target colour source, a read-only destination, a swizzled view's destination, a
render-target depth with no index and a PixelFormatView-only texture with no index expect the
refusal and their bytes kept. The commands do not refuse yet, so the test is red here: they run
and read zeros (or drop or unswizzle the write). The next commit makes them refuse.
Verified: cargo fmt; the red run is the next commit's job.