Commit Graph
477 Commits
Author SHA1 Message Date
Anees Iqbal 44a1c864c8 rt: no copy command whose source and destination share memory: buffer copies over a texture in place cut in slabs, heap aliases refused
A copy between a buffer and a texture in place over its bytes (copy_from_buffer into it,
copy_from_texture_to_buffer out of it, and their options forms) recorded one
vkCmdCopyBufferToImage or vkCmdCopyImageToBuffer whose region's bytes could be the texture's own,
which Vulkan forbids (VUID-vkCmdCopyBufferToImage-pRegions-00173,
VUID-vkCmdCopyImageToBuffer-pRegions-00184). And a copy between two textures placed in one heap
whose ranges meet, or between a heap buffer and a heap texture whose ranges meet, recorded one
command over memory one image lays out as the device chooses (VUID-vkCmdCopyImage-pRegions-00124
and the same two). Metal leaves both undefined.

Buffer and texture over it: buffer_copy now compares the region's rows (its offset and
bytes_per_row in the VkBuffer shaders reach) with the texture's rows (Side::rows, from bufcopy)
where both lie in one VkBuffer, and feeds every meeting pair of rows to bufcopy's meeting/cut:
one slab form for every copy whose bytes meet. A BufferCopy carries its slabs; each slab is its
own vkCmdCopyBufferToImage / vkCmdCopyImageToBuffer, with the COPY->COPY execution barrier between
two slabs that copy_from_texture's slabs take (now one fn, between()). The region on the
texture's own texels copies nothing; regions whose bytes do not meet stay one command. The answer
is the source's bytes from before the copy, as an Apple M3 Max gives between two textures over one
buffer (conformance buffer_texture_blits); between a buffer and its texture it was not recorded on
a Mac.

Heap aliases: a texture names where its image's memory lies that other resources may share
(TextureObject::bound: a heap texture's range, from Under::Heap's block and offset; a texture in
place, from its rows). copy_from_texture between two textures (not one image) whose memory meets
where either has no rows, and a buffer copy whose region's bytes meet a heap texture's memory, are
refused: nothing records, and nothing is emulated.

Both refusals have their own kind, Gap::OverlappingCopy { pixel_format }, which also takes over
bufcopy's two shapes no one-axis cut orders (a destination row across the end of its own source
row and the start of the next; rows of two pitches meeting at their starts), until now under
Gap::TextureCopy. Every one counts in the new Metrics::overlapping_copies_refused.

Docs: the rt README's blit section describes the buffer slabs and the heap refusal, and a new
"Known gaps of blit encoders" names the two shapes (built, cut on two levels, when a replay stream
or a walk counts one) and the heap refusal. docs/REFUSALS.md regenerated; api_signatures.tsv
blessed (the variant and the Metrics field).

Tests: a_buffer_copy_over_its_texture_s_own_bytes_copies_in_slabs_or_in_no_order (slabs a row on
into and out of the texture with their order, two texels on both ways, a one-row region, whole rows
two texels on unordered, a region after the texture and one in another buffer one slab, the
texture's own bytes nothing, a heap texture's memory met or not);
textures_whose_memory_meets_where_one_is_laid_out_by_the_device_copy_in_no_order (heap/heap both
ways, in place/heap, touching ranges, another buffer, a texture of its own, two slices of one heap
texture). On a device: every_device_copies_between_a_buffer_and_a_texture_over_it_from_the_source_before_the_copy
(a row on and back into and out of the texture, within the rows both ways, apart; whole buffer
bytes as from the source before the copy, one submission, 2 + slabs barriers, no byte copied; whole
rows a memory alignment on refused, counted, nothing recorded) and
every_device_refuses_a_copy_between_heap_resources_whose_memory_meets (texture onto its alias, into
and out of a heap buffer over its bytes: refused, counted 3, nothing recorded; copies between heap
resources apart run, the bytes back as they went in, one submission). bufcopy's device test now
expects Gap::OverlappingCopy and its count.
2026-11-21 07:59:23 -08:00
Anees Iqbal 817463704e rt: texture buffers are buffer views of their buffer's bytes in set 1's two texel-buffer arrays
What: Buffer::new_texture of a texture buffer's descriptor makes one VkBufferView of the bytes
shaders reach (a Managed buffer's device copy where it has one), from the offset, its width's
texels long: no image, no copy, no new push field. Set 1 gains two arrays of 65,536 elements,
binding 5 (uniform texel buffers, the read ones) and binding 6 (storage texel buffers, the written
ones), at the same index class as textures; a texture buffer's index is the same element of both,
and placing a texture or a texture buffer over the other's index nulls the other's elements. The
translator's identity domains classify a texture_buffer slot or argument-buffer member as a texel
buffer of that array (no TexelBufferRange fact, no swizzle under identity), so a pipeline that
declares one is no longer Unsupported{IdentityDomains}. SEMANTICS_VERSION 2258.

Metal's own refusals are typed: an offset off Device::minimum_texture_buffer_alignment
(minimumTextureBufferAlignmentForPixelFormat:, the device's texel-buffer offset alignment, the
larger of the uniform and storage ones, a single texel's size where the device says it suffices)
is Refusal::TextureBufferAlignment; a bytesPerRow below the row or texels past the buffer is
Refusal::BufferTextureLayout; a descriptor of more than one row, level, slice or sample, and a
swizzle with writes, as Metal refuses them. Device::new_texture (and every other make) of a texture
buffer's descriptor is Refusal::TextureBufferNotOverBuffer: the consumer places the bytes as it
places every buffer. Gap::TextureBuffer goes; a swizzled texture buffer (Gap::TextureBufferSwizzle),
a view of one, and a blit copy of one are recorded gaps. A format needs both texel-buffer usages in
its buffer features (Gap::TextureFormat otherwise): the view's buffer has both usages, and without
maintenance5 its usage is the buffer's.

The floor requires the six texel-buffer descriptor-indexing features (update-after-bind, dynamic
and non-uniform indexing, uniform and storage) and raises the limits the two arrays count against:
uniform texel buffers against the sampled-image limits, storage texel buffers against the
storage-image limits, both against maxPerStageUpdateAfterBindResources and the pools: sampled and
storage per stage and per set 131,072 (196,608 sampled with attachment reads' second elements),
resources 262,152 (327,688), pools 274,144 (339,680). Every recorded device fits: the 8 device dumps'
least are llvmpipe's 1,015,808 sampled/storage/resources and the UHD 630's 1,048,576 pools; all 12
devices there report the six features.

Why: six harvested guest functions declare a texture buffer, and a pipeline that declared one was
refused at creation.

Checked by: tests::texture_buffers (lavapipe: R32Uint read at a buffer offset and written, out of
bounds read zero and dropped, atomics through read_write, every refusal), engine_identity's
a_texture_buffer_is_the_texel_buffer_element_its_resource_id_names (L3 on lavapipe and moltenvk-m3),
the floor tests, the signatures table and REFUSALS.md regenerated; the lane's compile job reports
the runs.
2026-11-21 07:27:27 -08:00
Anees Iqbal abb3c82247 rt: a copy between two textures over one buffer whose bytes meet copies in slabs
copy_from_texture recorded one vkCmdCopyImage when its source and destination were two
different textures in place over one buffer (each a linear image on the buffer's bytes) whose
regions' bytes meet, which Vulkan forbids (VUID-vkCmdCopyImage-pRegions-00124: no memory both a
source and a destination of one command). Only regions of one subresource of one image were
cut into slabs. Metal leaves such a copy undefined; an Apple M3 Max gives each destination texel
what the source held before the copy (the conformance crate's buffer_texture_blits rows
within-buffer-a-row-on and -reversed).

A texture in place now names where its texels lie: the VkBuffer commands reach the buffer's bytes
through (one per allocation, spanning it), the first texel's offset there and the row pitch the
device reports for the linear image (Rows, Side::rows). Where both textures of a copy lie in one
VkBuffer, texture_copy finds every pair of a destination row and a source row whose bytes meet
(meeting: a source row meets at most the two destination rows whose starts lie nearest it, as a
pitch is at least a row; nothing to look at where the two regions' spans of bytes do not meet)
and feeds their shifts to the slab chooser of 7c1baad228, generalized to take several shifts
(cut): an axis every shift moves along, all one way, is cut no thicker than the least shift in
whole texels (bytes along x, rows along y), the end the shifts point to first, so no slab's
source and destination share a byte and no slab reads a byte an earlier one wrote; the axis of
fewest slabs wins, as before. One subresource of one image is the one-shift case and cuts as
before. Regions on the same bytes copy nothing. Regions whose bytes do not meet, interleaved rows
included, stay one command.

Where along each axis the rows meet shifted both ways, or not shifted (a destination row across
the end of its own source row and the start of the next, or rows of two pitches meeting at their
starts), no cut along one axis keeps the order: Gap::TextureCopy names that arm now, its doc,
docs/REFUSALS.md (regenerated) and the rt README's blit section with it, instead of an invalid
command. No scratch image, no cap, no copy of the runtime's own.

Tests: regions_of_two_textures_over_one_buffer_copy_in_slabs_where_their_bytes_meet checks the
slabs (a row on both ways with the regions' order, two rows on, two texels on within the rows
both ways, a row and two texels on), the gap (whole rows two texels on; two pitches meeting),
one slab for interleaved rows of one pitch and of two and for another buffer, and nothing for
the same bytes. On a device, every_device_copies_between_textures_over_one_buffer_from_the_source_before_the_copy
makes four RGBA8 textures in place over one Shared buffer at the device's own pitch (asserted in
place) and copies a row on and a row back, a memory alignment on within the rows on and back,
and apart, each expecting the whole buffer to hold the source's bytes from before the copy and
everything else kept, one submission, 2 + slabs barriers, no byte copied; the gap case is refused
and records nothing.
2026-11-21 07:08:04 -08:00
Anees Iqbal d245bab9d1 rt: an execution over a range the GPU writes counts its parts with a kernel; parts bounded at 2 MiB of preprocess bytes
What: an execution of an indirect command buffer runs in parts of the most commands whose
preprocess bytes, as vkGetGeneratedCommandsMemoryRequirementsEXT answers with the inherited
pipeline, stay at or under 2 MiB (indirect::PART_BYTES), one rule on every device, in place of
parts of 64 commands. The device is asked from one command up, doubling while the answer stays at
or under the bound, then again at fewer in proportion to the last answer until it is, so no answer
at far more commands than a part takes is trusted (lavapipe's grows with the square of the count
and wraps at 32 bits). An execution over a range a buffer holds (executeCommandsInBuffer:
indirectBuffer:indirectBufferOffset:), location 0 included, ends the rendering, runs the
translator's new count kernel (pipeline::own_kernel(OwnKernel::ExecutionCounts), one workgroup a
part, its parameter block pipeline::ExecutionCounts in the ring), one global barrier, and begins
the rendering again; each part's vkCmdExecuteGeneratedCommandsEXT reads its count at
sequenceCountAddress: its commands through the range's last, none past it or wholly before its
location. A CPU-given range runs no kernel. While a visibility result's query counts the draws,
the execution is refused (Gap::Draw VisibilityResultInterrupt, counted), as the rendering cannot
end inside the query. The runtime makes its own kernels once a device, at first use, through the
pipeline cache and layout (runtime src/own.rs), and destroys them with the device. The idle
preprocess pool's bound goes from 128 to 64 MiB: one frame of the sample now takes about 27 MB of
commands' bytes plus at most one part an execution.

Why: an execution over a GPU range ran the buffer's whole capacity, every command past the range
costing its vertex work. Parts of 64 commands cost 61 times one execution's GPU time on the 2080.
RADV fails past about 4 MiB of generated commands in one execution (draws nothing on a 7900 XTX,
loses the device on a 780M): it chains by sequence count, not bytes. The 2 MiB bound is half that.

Verified: on the probe branch (d59701c670), jobs 63460 and 63481 measured the frame of Apple's
rendering sample: at the 2 MiB bound 931.8 us of GPU time on the 2080 (920.0 at whole capacity)
and 588.5 on the XTX. This commit: compile job and the lavapipe rt suite, reported with the sha.
Tests: the count kernel against a brute-force count on the interpreter and valid on every
committed profile; held ranges at 0, past a part, past the commands, and a CPU range across
parts; a held range in a Boolean visibility mode before and after its first draw; the widest
layout's part at or under the bound on every device.
2026-11-21 06:47:06 -08:00
Anees Iqbal b5ac9fd07b rt: visibility results, one precise occlusion query per mode, copied into the buffer at the pass's end
What: `setVisibilityResultMode:offset:` builds `Boolean` and `Counting`. Each such mode set is one
segment counted by one precise occlusion query (`VK_QUERY_CONTROL_PRECISE_BIT`), begun in the
pass's rendering before the segment's first draw and ended there at the next mode set or the
encoder's end; a segment with no draw begins and ends its query as it ends, so its word is 0.
After `vkCmdEndRendering` the pass copies the counts (`vkCmdCopyQueryPoolResults`, 64-bit, WAIT)
straight into the visibility result buffer's `VkBuffer` at place+offset, one copy for each run of
consecutive offsets in one pool, before the pass's second barrier (recorded or owed), which orders
them before every later command; a Shared buffer's segment end barrier reaches the host, and a
Managed buffer's write and a texture over the buffer in an image of its own are kept as a blit's
write is. `Boolean` writes the count too, nonzero exactly where a sample passed (Metal documents a
nonzero word; the M3 Max writes 1): an accepted difference in docs/API.md section 10, and the
conformance cases compare a `Boolean` word as nonzero alone.

A command buffer takes its queries from occlusion pools of 256 the device lends it
(`crate::visibility`), each query reset on the host (`hostQueryReset`) as the command buffer
retires or drops uncommitted; the device keeps at most 16 pools free and destroys the rest
(`Gauges::occlusion_pools`). `occlusionQueryPrecise` joins the floor's required features (every
venue's profile reports it; Roadmap 2022 requires it), with the README floor table, the
runtime-floor profile's `m2v_runtime_floor` block and the regeneration script's list.

Refusals: Metal's own, each where the mode is set, the encoder's mode unchanged:
`Refusal::NoVisibilityResultBuffer`, `Refusal::VisibilityResultOffset` (not a multiple of 8, or
past the buffer), `Refusal::VisibilityResultOffsetTaken` (Apple documents each offset as set once
per pass; Metal's validation stops it), and `Refusal::ArgumentPlace` at alignment 8 for an offset
at an allocation byte off a multiple of 8 (VUID-vkCmdCopyQueryPoolResults-flags-00823). Gaps, each
counted and a README known gap: `DrawKind::AccumulatedVisibilityResults` (a mode in an
`Accumulate` pass; `Metrics::accumulated_visibility_refused`) and
`DrawKind::VisibilityResultInterrupt` (a command that would end the rendering while a query counts:
a memory barrier after a writing draw, a draw that moves an attachment to the feedback layout, pays
an owed barrier before an attachment read or copies into a shadow, and, bounded, a draw that looks
at textures over a buffer in an image of their own or reaches a Managed buffer with textures over
its device copy; `Metrics::visibility_interrupts_refused`). Every refusal is checked before the
encoder changes state; a segment's first draw may still end the rendering, before its query
begins. `DrawKind::VisibilityResults` is gone. `RenderPassDescriptor::visibility_result_type`
(`VisibilityResultType`, Metal's `visibilityResultType`) is a field now.

Translator: `PrecisionNote::DeviceOcclusionCount`, the static note of a `Boolean` or `Counting`
result (`RenderCommandEncoder::VISIBILITY_NOTE`), quoting Vulkan's "Occlusion Queries" (precise
counts differ between implementations: fragments killed before rasterization, counts multiplied
per colour output) and "Fragment Operations" (`earlyFragmentMultisampleCoverageAfterSampleCounting`);
its codec tag, ARTIFACT_FORMAT_VERSION 588, validation's allowance (unbounded, no tolerance), the
conformance degradation `device-occlusion-count` among the native notes, and docs/API.md's
catalogue. The dead `Feature::CountingVisibility` (no construction site) is removed with its reach
row. The old runtime's `Device::new` is untouched; the runtime-floor test profile now states
`occlusionQueryPrecise`, which re-keys that profile's fingerprint.

Why: the visibility-cut ruling. A guest that sets a mode got a refusal; it now gets its results,
or a typed, counted refusal where the cut does not build the shape (continuations and a combine
are not built).

Verified: cargo fmt; scripts/api-signatures --bless/--check, refusal_surface (0 without reach or
basis), metal-coverage and conformance-coverage regenerated, check_device_profiles (0 findings).
The compile job (fmt, signatures, clippy plain / --cfg m2v_gpu / --cfg m2v_cpu_icd, workspace
Rustdoc -D warnings) and the lavapipe rt suite, with tests/visibility.rs (Boolean and Counting
against the CPU's counts, pool reuse and the 16-pool bound past 17, Metal's refusals, Accumulate,
the barrier and attachment-read interrupts), are named in the lane's report.
2026-11-21 06:16:57 -08:00
Anees Iqbal 7c1baad228 rt: overlapping regions of one texture copy in slabs, as from the source before the copy
copy_from_texture refused a copy whose regions overlap in one level and slice of one image (a
texture into itself, or a texture and its view) as Gap::TextureCopy, and the program's copy was
skipped. Metal does not refuse the call; it leaves the result undefined, and an Apple M3 Max gives
each destination texel what the source held before the copy (the conformance crate's
buffer_texture_blits case, which recorded it).

No vkCmdCopyImage may read a texel it writes (VUID-vkCmdCopyImage-pRegions-00124), so
texture_copy now cuts such a copy into slabs along one shifted axis, the one of fewest slabs. Each
slab is no thicker than the shift there, so its two regions lie apart, and the slab at the end the
shift points to goes first, so no slab reads a texel an earlier one wrote: the result is memmove's.
Each slab is one vkCmdCopyImage in the general layout, with an execution barrier (COPY to COPY)
between two slabs, every hazard between slabs being a write after a read. Each extra barrier is
counted. Regions apart remain one slab and one command, and the same region still records nothing.
A shift of 20 texels over a 21-texel row is 2 commands; the worst case, a shift of one texel, is one
command per texel of the region's extent on that axis. No scratch image, no cap.

Gap::TextureCopy keeps its other arms (a multisample texture, depth and stencil both, one pixel
format in two Vulkan formats, 1D with another type); its doc, the rt README's blit section and
docs/REFUSALS.md (regenerated) drop the overlapping arm. The conformance ledger's row for
buffer-texture-blits-overlapping goes, since the rt side now answers that case, and
docs/CONFORMANCE-COVERAGE.md is regenerated.

Tests: overlapping_regions_copy_in_slabs_the_far_end_of_the_shift_first checks the slabs' regions
and order (a 21x1 row shifted by 20, a shift toward lower y, a diagonal shift on the axis of fewer
slabs, regions apart as one slab); the 3D/array host test now expects slabs where it expected the
gap. On a device, every_device_copies_overlapping_regions_from_the_source_before_the_copy copies
toward higher and toward lower x and y, from a view into its texture, along a 3D texture's depth,
and by whole BC1 blocks where the device makes them. Each case expects the source's bytes from
before the copy, one submission, 2 + slabs barriers and no byte copied of the runtime's own.
2026-11-21 06:24:22 -08:00
Anees Iqbal c3f9f55e63 rt: a kernel past the stage bound is made from its helper's compile alone, never compiled in the process
A driver's compiler takes memory that grows faster than the stage, in the process that creates the
pipeline. The translator refused every stage past COMPILED_STAGE_WEIGHT (99,109, the heaviest
measured to compile within host-sized memory, ANV on the Iris Xe of RPL-P), where Metal makes it.
Now the translator states the weight and the runtime compiles such a kernel only in a helper
process the consumer starts, caps and times.

Translator: the stage bound refuses nothing. stage_bound::emit still plans a kernel again keeping
its widest-mode pin where only that emulation passed the bound, and returns the module with its
entry weight, now ModuleStats::entry_weight (codec and serde carry it). COMPILED_STAGE_WEIGHT is
public in pipeline. Feature::StageSize and Needs::StageBound are gone. SEMANTICS_VERSION 2257,
ARTIFACT_FORMAT_VERSION 588.

Runtime (new stage.rs):
- Floor: pipelineCreationCacheControl, required and enabled (Vulkan 1.3 requires it), for
  VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT.
- A kernel's VkPipeline of a module past the bound is made from a VkPipelineCache of its own entry
  in the cache directory's stages/ alone, with the fail-on-compile-required flag, the cache
  destroyed when the create returns; the device's shared cache and blob never hold it
  (Metrics::pipelines_from_stage_fills).
- With no entry the make is refused with Error::StageUnfilled(StageRequest), at the state's
  creation, at prepare_dispatch (which now returns Result and reports only this refusal) and at
  the dispatch. A StageRequest is Clone, Send, Sync, Eq and Hash by its stage key, the entry's
  name, so a consumer joins the makes and dispatches of one pipeline into one fill.
- Device::fill_stage writes the request to the helper's pipe, reads its reply and keeps the
  cache data as the entry (Metrics::stage_fills); serve_stage is the helper's main: it opens the
  device of the request's deviceUUID and driverUUID with the parent's options, checks the
  enables, compiles through an empty cache and writes its data. A wire frame is the magic
  m2vstage, the wire version, the length and a checksum.
- Device::record_stage_breach keeps what the consumer ended its helper for (memory, time) as the
  entry; fill_stage keeps a failed compile; a create answered compile-required keeps that. Each
  refuses the pipeline (Gap::StageSize, StageGap::Breach) with no helper asked again, until the
  driver's header changes the key.
- stages/ holds at most 256 MiB and 32 entries, breaches among them, least recently used out
  first (a hit touches the file). An entry that does not check, of another key or another
  driver's header is a miss and is removed. Nothing of an entry stays in memory past the call
  that reads or writes it.
- A device with no cache directory, or whose driver writes no pipeline cache header (lavapipe),
  and a render stage past the bound are refused typed (Gap::StageSize with its StageGap).

The validation runtime executor reports a refused prepare_dispatch; the replay prepass ignores it
as the dispatch reports it again.

Docs: the runtime README's "Kernels past the stage bound" and its known gaps, the stages/
directory, prepare_dispatch's one error, the floor row; docs/API.md's entry_weight;
docs/REFUSALS.md regenerated; the api signature and surface tables.

Tests: tests/stage.rs: the directory past capacity on both bounds, oldest use out first, a hit
outliving older entries, a breach under the same bounds; cut, foreign-key, other-header and
unknown-breach entries a miss and removed; the wire's version and cut frames; the request's
joinable bounds; and on a device (m2v_gpu, m2v_cpu_icd), with the bound lowered for the test, the
refusal with no directory, lavapipe's NoPipelineCache, and elsewhere refused unfilled, filled by
serve_stage over two pipes, made from the entry alone with the shared cache's data unchanged,
then refused by a recorded breach.
2026-11-21 05:55:29 -08:00
Anees Iqbal 20ae73f152 Translator: the resident-table domains' encoder-operation lowering goes; object words stay
What: lower/access/encode.rs goes. It lowered a function's indirect-command encoder operations
under the resident-table domains, writing the binder's records and their written flags. What it
held that is still used moves to lower/access/object.rs:
- an argument buffer's command-buffer or pipeline-state member read as its word (ObjectWord);
- the plan that admits such a load only as an encoder operand.

Every encoder operation is now refused, `Unsupported{GpuEncodedIndirectCommands,
NotImplemented}`, except those the identity domains' icb.rs lowers: a render command's buffer
setters, its indexed triangle draw and a reset. icb.rs is selected first, as before. The other
deletions follow from that:
- indirect_commands.rs drops CommandEncoderOperation's per-operation policy table;
- lower/access/dynamic.rs drops the resident-set search and address helpers only encode.rs
  called (plan_search, plan_address, search_start, plain_base);
- the error doc of the depth-stencil argument names the setters' refusal;
- engine_indirect_commands.rs keeps two tests: every encoder operation refused under the
  resident-table domains on every committed profile and Profile F, and a depth-stencil member
  compiled unread and refused read. engine_handles.rs expects the refusal where a pipeline-state
  member is a command's operand;
- the command-writes interface test now takes icbcut's indexed kernel (icb_indexed_16) under the
  identity domains, plus the template that takes no command buffer;
- the authored census integration test expects the encoding case's refusal on both forms;
- docs/API.md's indirect-command section says which domain refuses what;
- docs/REFUSALS.md is regenerated.

Why: rule 4 (small) and rule 2 (one form). The runtime compiles under the identity domains, where
this lowering never ran. Under the resident-table domains, the validation executor's alone, it was
a second form of GPU-encoded commands that no consumer path takes.

No public item changes (indirect_commands is pub(crate); api_signatures.tsv is unchanged).
Versions: SEMANTICS_VERSION 2255 -> 2256 (a placeholder; the landing sets the number), because the
resident-table domains refuse what they lowered. Under the identity domains no output changes.

Verified (jobs at this commit's tree less the runtime README edit below it, 4606692494, or at the
next commit's, the runtime-sources pin, 4e9e857f8c):
- m3-max-63058 at the pin: fmt, clippy, clippy --cfg m2v_gpu, clippy --cfg m2v_cpu_icd, Rustdoc
  -D warnings and scripts/api-docs, all rc 0 (peak 7.5 GiB);
- m3-max-63040, the validation suite at this commit: 1359 of 1360 passed, the one failure the
  runtime guard, which the next commit pins;
- m3-max-63057, the metal2vulkan and metal2vulkan-runtime suites and doctests at the pin: 3349 of
  3360 passed. The failures are the render key, the AIR printout and the golden table (bless due
  at development's next pin) and the engine inventory's 8 parts: 2,142 cells moved, 0 rows new or
  gone, of which 1,342 are the storage forms' removal below this commit (ilock, m3-max-63032) and
  800 are this commit's, the resident-table encoder operations now refused: m3-max-63151, the
  parts with every difference printed, names them as 50 entries on all 16 profiles, each
  ok -> Unsupported{GpuEncodedIndirectCommands; NotImplemented}, in 31 fixtures, every entry a
  kernel that encodes indirect commands (26 engine/icb_* and 3 kernel_icb_* fixtures,
  resident_draws.ll's rd_encode and mesh_commands.ll's six enc_* kernels); the other 1,342 are
  ilock's, class for class. The inventory compiles under RESIDENT_TABLES
  (spirv::testing::committed_profiles), and its bless runs on macOS only (bless_engine_inventory
  refuses without every assembler, m3-max-63084);
- docs/REFUSALS.md regenerated by scripts/refusal-surface/refusal_surface.py;
- no states-only play: the runtime compiles under the identity domains, whose output this commit is
  expected not to change. That is read from the code: icb.rs, the identity lowering, is untouched
  and still selected first. It is not measured, because the golden table's every cell is re-keyed
  until development's bless. ilock and this commit report the same staleness: 29,792 cells,
  m3-max-63032 and 63057.
2026-11-21 04:39:28 -08:00
Anees Iqbal 7e8b93d953 Fetch: the interlocked storage forms go; one input-attachment form, ordered by ROA where the device has it
What. The pixel interlock's storage forms of framebuffer fetch, of the fragment imageblock and of
the shadow stencil are deleted, with their snapshot reads, the sample planes' split and merge
modules, the stencil shadow's copies and the binder, pipeline and runtime items that served them.
A color input now has one form on every device: its input attachment, ordered by
rasterization-order attachment access where the device has it, and elsewhere ordered between
draws alone, noted `PrecisionNote::UnorderedFetchWithinDraw`. The pixel interlock serves raster
order groups only; on a device without rasterization-order access a group on a color input or a
read output does not interlock. What had no other form is refused, typed:
- a fragment function's imageblock use, `Unsupported{Imageblocks, NotImplemented}`;
- a `[[stencil]]` output on a device without `VK_EXT_shader_stencil_export`, naming
  `StencilExport`;
- a merge, a rotated blend or a logic operation that reads the attachment, on a device without
  rasterization-order access, naming `FramebufferFetch` and
  `RasterizationOrderColorAttachmentAccess`.

Why. Rule 2 (one form per Vulkan capability) and rule 4 (small): the storage forms were a second
form of fetch, imageblocks and stencil output chosen by the interlock feature, outside the eight
allowed second forms. The runtime never took them under the identity domains.

Versions: ARTIFACT_FORMAT_VERSION 586 -> 587 (a placeholder; the landing sets the number).
SEMANTICS_VERSION moves in this stack's fourth commit and the runtime-sources pin in its fifth.
RUNTIME_VERSION is not bumped.

Removed public items (crates/metal2vulkan/tests/api_signatures.tsv): pipeline::StorageAttachmentUse,
ShadowStencilUse, FragmentImageblock, ImageblockMechanism, SnapshotForm, SnapshotRefusal,
StorageAttachmentView; bind::PlanesSplitModule, PlanesMergeModules, StencilSplitModule,
planes_split_module, planes_merge_modules, stencil_split_module, CopySource, FragmentTests;
RuntimeFact::{FragmentImageblock, InterlockedFramebufferFetch, MovableStorageWrites,
ShadowStencil, TestedStorageWrites}; PushField::{ShadowStencilState, SnapshotPhase,
StorageKeptChannels}; ResourceKind::SnapshotTexels, BindingSource::SnapshotTexels,
WriteSource::{ShadowStencil, SnapshotTexels}, PushHole::SnapshotPhase,
DrawReplayRule::{FragmentImageblock, ShaderStencil}, PlanesCopy::Alpha8,
ExtendedRangeBlend::OneColorChannel, PrivateRenderField::SampleMask,
PrecisionNote::UnmeasuredFetchBlend (translator and runtime), runtime
RenderPipelineKind::{Imageblock, ShaderStencil}. Changed: FramebufferFetchInputs::of(read, colors),
DepthStencilCopy::{StencilExport, StencilPlane}, WriteSource::TileAttachment.

Runtime README, known gaps: a new bullet names a fragment function with imageblock data (an input
or output declared [[imageblock_data]]) as refused on every device, and the stencil output bullet
says the runtime has refused it on a device without the extension all along. Both say why: the
forms deleted here bound a storage image through a descriptor, which the identity domains the
runtime compiles under hold none of. The raster order group bullet already names its refusal.
docs/REFUSALS.md is unchanged (scripts/refusal-surface/refusal_surface.py leaves it as it is).

Consumer check (~/.cache/m2v-orch/consumer-uses.sh, consumer development e76e2ffeb4 plus its 49
steelbrain/* tips younger than a day): 0 code hits on development for every removed name above
(Imageblock appears there only in rt_platform/diag.rs comments); UnmeasuredFetchBlend and
OneColorChannel hit only crates/reims-vgpu-vulkan on unlanded lane branches, none on development.

This commit does not build crates/metal2vulkan-validation alone: its executor still names the
removed pipeline items until the next commit, which removes its storage-form arms.

Verified: in the stack's second commit, which states every job; this commit alone does not
build the validation crate.
2026-11-21 04:39:18 -08:00
Anees Iqbal f61383d22b rt: delete Device::release_indices, Grants::release and Refusal::IndicesInUse
A grant now lasts as long as the device. The consumer never returns one:
its code, read at its tree on the 8a36a49453 pin, has zero calls of
release_indices and no IndicesInUse (it calls grant_indices in four
files). Only the runtime's own tests called it.

Product: Grants::release, Device::release_indices with its doc, the
IndicesInUse variant and its Display arm go; Bits::put and Grants::set
lose the clearing arm only release used. 40 code lines and 19 comment
lines fewer. IndexGrant::indices stays (grant uses it). Grants are
dropped with the device.

Docs: the README's index section, Device::grant_indices, new_texture,
IndicesNotGranted, Gauges::releases_waiting and the pool's release
comments no longer name the call; they say a grant lasts as long as the
device and point at Gauges::descriptor_slots where a vacate shows.
api_signatures.tsv re-blessed (two records out) and docs/REFUSALS.md
regenerated (77 runtime refusals). The api_surface table pins only the
translator's names and does not change.

Tests: 36 tests called release_indices only as cleanup; those calls go
and their grant bindings take a leading underscore. The two Grants unit
tests in tests/arrays.rs drop their release cases. The four that read IndicesInUse read instead:
- an_index_has_one_owner_the_object_placed_there_last: the owners map
  (owns goes false after the owner's vacate);
- every_device_round_trips_texture_bytes and
  every_device_shares_sampler_states_device_samplers:
  Gauges::descriptor_slots, counted while the objects live and back to
  its count before the placements once they are gone;
- every_device_holds_a_release_until_the_work_committed_before_it_retires:
  releases_waiting nonzero and descriptor_slots 1 under the work, then
  descriptor_slots 0 once releases_waiting reads 0 (the block-maker
  thread vacates the index before that gauge falls).

Checked before the commit: signatures.py --check and
refusal_surface.py --check pass. The compile gate (fmt check; clippy
plain, --cfg m2v_gpu and --cfg m2v_cpu_icd; workspace Rustdoc, all with
-D warnings) and the runtime's tests on lavapipe run on this commit.
2026-11-21 03:03:59 -08:00
Anees Iqbal 2a054f7785 Translator: the emitted words are the only words check; the size estimate goes
Selection summed a word cost per strategy and per interface part into a `SizeEstimate` and refused
the function `LimitExceeded(SpirvWords)` before emission when the sum passed the cap. The sum was a
forecast, not a bound, and it overshot: a guest kernel (function hash 4cc9c0bb, Iris profile, on
the command-line path) estimated 30,197,397 words against the 16,777,216 cap and emits 8,589,684
(job 62553), so it was
refused for a size it does not have. The cap already held exactly on the serialized module; that
check is now the only one (`pipeline::compile::lower_bounded`). That kernel is now refused by what
it holds, `LedgerBytes` at 450 MiB; a function the estimate overshot that fits the ledger can now
translate (none in this library does).

Removed with the estimate, as nothing else read them:
- `lower::estimate` (`SizeEstimate` and its frame costs), `Plan::estimate`, the check in
  `stage_bound::emit` (which no longer takes the cap) and the selection's block count;
- the word sums that fed only the estimate: the stage interface's (`StageIoPlan::words`, its
  parameter, object, store and rounding costs, and the fragment family's input attachments,
  discards, interlock, sample loop, snapshots, imageblock, storage form, shader stencil, logic
  operation, blends and word merges), the tessellation and mesh interfaces', the dispatch forms',
  a module blob's, the tile staging's, and the emulated tier's and the predicated walk's extra
  words, with `Predication::reloads`;
- the predicated walk's second structurization before emission, which only measured its
  constructs for the estimate (`structurize::emit::construct_words`).
The per-strategy costs and shared-routine costs the `StrategyCensus` reports stay.

Public: `EntryPlan::estimated_words` goes. The consumer's checkout (reims-vgpu at 44d738908a) has 0
hits for `estimated_words` and for `EntryPlan`. `tests/api_signatures.tsv` loses that one row;
`tests/api_surface.rs`'s pinned names do not move (`EntryPlan` stays).

Tests: the checks that the estimate bounds the emitted words go from the tests that also check
something else; the tests that checked only that go (every stage, simd, leaf, tail, coordinate,
bicubic, snapshot, pulled-fetch and shared-switch entry's estimate, the large predicated body under
a multiple of its words, and the skeleton's estimate bound). The word cap's test keeps both sides
on the emitted words: a module compiles at a cap of its own words and is refused one word below.

SEMANTICS 2253: a function the estimate refused can now translate, and the refusal of one that
does not fit names the ledger. docs/REFUSALS.md regenerated: `SpirvWords` has the one site.

Verified:
- The gate on this change over f3f661dd14 (job 62796): fmt, the API signatures, clippy plain,
  --cfg m2v_gpu and --cfg m2v_cpu_icd, workspace Rustdoc and doctests green; nextest of
  metal2vulkan and metal2vulkan-runtime 3464 of 3468, the four reds development's own suites show
  at f3f661dd14 (m3-max-62774): the old render descriptor key, which hashes SEMANTICS_VERSION,
  and the new icb_indexed_extras fixture's golden cells, AIR printout and inventory part, all
  blessed on development.
- Every kernel of the guest library (63, by hash), on the command-line path: intel-irisxe-anv's
  runtime-policy device file, the release command line before (fe1e8780a2) and with this change
  over it, alternately per kernel on one node (job 62742). 62 keep their outcome and their
  output's hash; the one difference is 4cc9c0bb, refused SpirvWords before and LedgerBytes after.
  It is the slowest row and the largest peak on both sides: 2.55 s and 309 MiB before, 2.86 s and
  470 MiB after (it now runs into emission before the ledger refuses it). Total wall 12.0 s
  before, 12.3 s after.
2026-11-21 02:53:10 -08:00
Anees Iqbal 22ae7df766 rt: indirect command buffers of indexed draws on VK_EXT_device_generated_commands
What: the first cut of Metal indirect command buffers, the runtime's half, in one commit: the
device's extension, the buffer object, the executions, the reset and the pool depend on each
other, and any part alone would be dead code.

- The device enables VK_EXT_device_generated_commands with VK_KHR_maintenance5 together where
  both are reported (floor::INDIRECT_COMMANDS), and nothing else chooses a form. maintenance5 has
  one form here: rt takes nothing of it but the BufferUsageFlags2 a preprocess buffer needs, and
  its A8 format stays untaken. dgc.rs declares the extension's structures by hand, each size and
  offset checked at compile time against the spec's layout; it goes once ash binds the extension.
- IndirectCommandBuffer, IndirectCommandBufferDescriptor and IndirectCommandType
  (Device::new_indirect_command_buffer): indexed draws that inherit the pipeline state and bind
  their own buffers, at most 31 a stage; records in a Private block, reset from the device's
  template at the next commit. gpuResourceID is the records' device address.
- RenderCommandEncoder::execute_commands_in_buffer (a CPU range) and
  execute_commands_in_buffer_with_range (a range read from a buffer, executed at full capacity
  with the SEQUENCE_INDEX token): one PUSH_CONSTANT token a run of slot words, the index buffer
  token and the indexed draw, through the inherited pipeline; the push constants and the index
  buffer are pushed again after an execution. Every execution runs as one
  vkCmdExecuteGeneratedCommandsEXT a part of CHUNK = 64 commands, in order, on every device (the
  planner's ruling: one execution of more drew wrong on the XTX past ~4 MiB of generated commands
  and out of order on the 2080 past 64 sequences); each later part pushes its first command
  (PushField::IndirectBase) and takes its own preprocess offset in the execution's one region. A slot a command binds is pushed the widest bounds,
  unchecked, as a loaded pointer's access is (README, SlotBounds).
- BlitCommandEncoder::reset_commands_in_buffer (copies from the template in regions) and
  optimize_indirect_command_buffer (no work); useResource of an indirect command buffer in the
  compute and render encoders, and RenderCommandEncoder::use_heap.
- Preprocess memory: sized from vkGetGeneratedCommandsMemoryRequirementsEXT with the inherited
  pipeline per (content, raster state, record layout) at a part's 64 commands in a cache of
  SHAPES = 256; layouts LAYOUTS = 64;
  templates TEMPLATES = 16, each at most 64 KiB. Each a fill-past-capacity test. A new pool of
  regions (its own VkBuffer and VkDeviceMemory each, usage2 PREPROCESS | SHADER_DEVICE_ADDRESS, a
  memory type from the requirements' bits, device-local first, rounded to 64 KiB): one taken at
  record time per execution (an idle one at most twice its need, else one made), given back when
  its command buffer retires, the oldest idle ones freed past IDLE_BYTES = 128 MiB. At rest it
  holds idle regions up to 128 MiB, freed at device drop. No execution waits or is refused for
  the pool's sake. Not the block mechanism: blocks are made with the floor's one usage on every
  device, and adding the preprocess bit on DGC devices alone would be a second form; the memory
  types come from the driver's per-layout requirements. Gauges of the used and idle bytes: flat
  between iterations 100 and 200, zero at device drop (tested).
- Typed refusals by name (Gap::IndirectCommandBuffers with IndirectCommandsKind): no extension,
  other command types, per-command pipelines (everywhere), inherited buffers, bind counts past
  31, capacity, an unflagged state, a draw input the commands cannot carry, more tokens than the
  device takes; Refusal::CommandRange for ranges past the commands.
- README: indirect command buffers and their known gaps (b1's two costs, the preprocess cost,
  lavapipe's preprocess size defect verbatim, the Iris, UHD 630 and Mac host lines, the parts
  and their measured cost), the
  extension rows; METAL-COVERAGE and REFUSALS regenerated; api_signatures blessed.

GetDeviceProcAddr audit (verified by grep of the runtime's loads): every device function rt
loads belongs to an extension enabled at the load. calibrated_timestamps is a floor extension;
feedback_loop_dynamic_state loads only under the feedback loop; device_fault loads only where
device creation enabled it; external_memory_fd,
external_memory_win32 and external_memory_host load only where enabled(); Dgc::load runs only
where INDIRECT_COMMANDS is enabled.

Verified: see the lane's report (compile gate, lavapipe and GPU device tests).
2026-11-21 01:53:50 -08:00
Anees Iqbal d9ba8d0e72 Translator: GPU-encoded indexed triangle draws into indirect command buffers under the identity domains
What: the first cut of Metal indirect command buffers, the translator's half.

- pipeline::IndirectDrawLayout (public): the record contract the runtime and the lowering share.
  A 24-byte header (capacity, vertex and fragment slot counts and stride as u32, then the reset
  index address as u64 at 16), then command i at 24 + i * stride, stride = 8 (Nv + Nf) + 40:
  the slot words (the buffer's address less 2^31, the word an execution pushes as the slot's
  SlotGuestBase), the index token's data, the sequence index and VkDrawIndexedIndirectCommand.
- lower/access/icb.rs: under the identity domains, a function's render_command
  set_vertex_buffer, set_fragment_buffer, draw_indexed_primitives of triangles and reset write
  the records through the gpuResourceID an argument buffer's command_buffer member holds, each
  only where the command's index is below the capacity (and a slot below its stage's count).
  Every other indirect-command operation stays Unsupported{GpuEncodedIndirectCommands,
  NotImplemented}; a vertex or fragment function without its stage's store feature and a device
  without device addresses refuse by name.
- LoweringInputs::indirect_range with PushField::IndirectRange, PushField::IndirectSequence and
  PushField::IndirectBase: a vertex function of a state made with supportIndirectCommandBuffers
  reads the execution's range and its command (the sequence index plus its part's first command)
  in its first block and draws nothing for a command outside the range, so an execution over a
  range a buffer holds runs at full capacity (one SEQUENCE_INDEX token), in parts. Such a state's
  vertex function pulls every attribute it reads.
- Fixture engine/icb_indexed_extras (MSL we wrote, regenerated by scripts/regen-air-fixtures):
  a reset kernel, a vertex function that reads before its buffer's address, and one of fourteen
  vertex buffers (a state of more tokens than lavapipe's 16). Inventory rows added by hand (the
  fourteen-buffer vertex function's thirteen constant buffers pass the runtime floor's twelve);
  the golden hash rows, the air_input printout and the old render descriptor key come with
  development's bless.
- SEMANTICS_VERSION 2252 and ARTIFACT_FORMAT_VERSION 586 are placeholders one above
  development's (2251 and 585); the lowering's emission and the encoded lowering inputs change.
- docs/API.md states the forms; docs/REFUSALS.md regenerated; api_surface and api_signatures
  carry IndirectDrawLayout.

Why: the cutover's guests encode indexed draws into indirect command buffers from kernels, which
the identity domains refused.

Verified: see the lane's report (compile gate and test jobs, the states-only play).
2026-11-21 01:50:00 -08:00
Anees Iqbal 39b0efc6e7 rt: a release waits for the command buffers committed before it, one commit-order mark for textures, samplers, idle allocations and imports
What: one mark (memory::Wait) for everything a command buffer may reach with no handle of it.
A release notes the last commit's place in the commit order. It goes once every command buffer
committed up to there is submitted (Work::settled) and that submission completed. With none in
flight (a count kept from commit to retire) it goes at once, as before.
- What waits:
  - a texture's index (its set-1 elements), views and image, and its shadow view;
  - a texture view's views;
  - a sampler state's index and its device samplers;
  - an idle allocation's free;
  - an imported or exported block's free, and with it the import's release.
- How the objects and indices go: the block-maker thread holds them in one FIFO (Pool::release)
  and hands each to the reaper once its wait is over; teardown frees what is left. With nothing
  in flight, an index is vacated on the releasing thread, so its grant may be returned at once.
- What is unchanged: a displaced index; attachment views, pipelines and modules, which their
  command buffers keep. The loose memory (texture allocations, surface plane imports, copies'
  staging) takes no second wait: it comes from the reaper's frees, or from copies.
- New: Gauges::releases_waiting counts what waits. Every device test's teardown reads it zero, and
  the harness compares it at runs 100 and 200.
- Consumer-visible: Gauges gains a field (non_exhaustive, so nothing breaks). release_indices
  refuses IndicesInUse for an index whose texture or sampler state was released under work in
  flight, until that work retires (docs/REFUSALS.md regenerated). A command buffer parked at an
  event wait holds every such release after its commit until it retires (README, in the memory
  and the set-1 paragraphs).
- Docs: new_texture's doc and the README take the new contract and Metal's own answers (the
  consumer's game tool on two Macs, from main), and api_signatures.tsv is blessed for the field.
- Test: one ordinary test, argument_tier's held release. A command buffer at an event wait holds
  a 17 MiB allocation's free and a released texture's index past twice the idle age; once it
  retires, both go. The two hazard tests of the commit before run on a CPU device always, and
  pass only with this.

Why: the consumer's game step loses the device on RTX 3090s (Xid 13, MMU faults). The game tool
remakes heap textures every frame and drops the old ones at once, while the frame in flight still
samples them through set 1 by resource ID, naming only the heap. Before this, rt nulled the
elements and destroyed the views and image at once, under that pass.

Product lines (comments left out): +171 -23 in crates/metal2vulkan-runtime/src.

Verified at this commit: cargo fmt; scripts/api-signatures --check after its bless (the one new
line is Gauges.releases_waiting); docs/REFUSALS.md regenerated (IndicesInUse's row). Before-run on
ms01's RTX 3090 at 2d0c57661d (job m3-max-62569): the address test (argument_tier) hung the GPU
(Xid 109 CTX SWITCH TIMEOUT, no loss rt saw, Xid 31 at teardown). The texture test showed no Xid,
and its lines were lost (the leg's buffered pipe). Its gate and its after-fix hazard run follow
this commit; main's landing names them.
2026-11-21 01:59:43 -08:00
Anees Iqbal 99e5d42deb rt: several viewports and scissor rectangles, and the viewport index, through the with-count dynamic states
setViewports:count: and setScissorRects:count: refused any count but 1 (DrawKind::Viewports). They
now take 1 to 16 each, and every draw records them with their count (vkCmdSetViewportWithCount,
vkCmdSetScissorWithCount, core in Vulkan 1.3). VIEWPORT_WITH_COUNT and SCISSOR_WITH_COUNT replace
VIEWPORT and SCISSOR in every pipeline's dynamic states, whose viewport state counts become 0, so
no pipeline is made for a count. Vulkan takes as many scissors as viewports. Each viewport's
scissor follows the deleted runtime's rule (render_state.rs's vk_scissors at 5d725aeec7^): the
rectangle of its index, the one rectangle where one is set, and none past the rectangles set where
several are, each cut to the pixels its viewport covers. A draw's attachment-read area is the
union of what it covers through the viewports it reaches: every viewport set for a vertex function
that writes [[viewport_array_index]] (GraphicsState::writes_viewport_index, now Draws::
selects_viewport), and viewport 0 for any other.

A vertex function's [[viewport_array_index]] is the translator's one form at the floor: its
ViewportIndex output, written 0 at or past the encoder's count (RuntimeFact::ViewportCount), which
the draw now pushes (PushField::ViewportCount -> FieldValue::ViewportCount, refilled when the count
changes). Its fragment function reads the index as written. An index that is not one value across
a primitive stays the translator's refusal at creation, needing geometryShader, which device
creation does not enable. Out of range: none or more than 16 is DrawKind::Viewports.

Floor: multiViewport and shaderOutputViewportIndex join REQUIRED, and the translator is told.
The venue dumps report both true on every venue: m3-max-48727, 48728, 48729, 48730, 48731, 48736,
48737 and 61508. shaderOutputViewportIndex is also true in the probes 61359 to 61362 and 61366.
tests/floor.rs, the README floor table, RUNTIME_FLOOR and profiles/runtime-floor.json add them.

The translator's tests that read runtime-floor as a device without the viewport index now take it
below the floor: engine_selected_indices (the raw index alone without multiViewport; the zero
indices without shaderOutputLayer and shaderOutputViewportIndex) and engine_stage_io_tail (the
floor declares Layer and ViewportIndex; the zero index below it). runtime-floor joins the stems
whose fragment ViewportIndex needs MultiViewport.

Also, missed in a5fac6fa9b: the README's pipeline bullet names the depth clip and triangle fill
modes among what a VkPipeline bakes.

Conformance: render-state-boxes leaves known-gaps-rt.tsv; CONFORMANCE-COVERAGE.md regenerated.
Docs: README (encoder bullets, floor table, refusal list), REFUSALS.md (Viewports' doc), the
encoder's built list.

Tests: tests/viewports.rs. rt6_select draws through the viewport of its instance, two viewports
(the halves) and two scissors (the whole target and its top half). Instance 0 fills the left half,
instance 1 the right half's top, and instance 2, past the count, draws through viewport 0, its
fragment reading 2. No pipeline is made, and none or 17 viewports or rectangles are Viewports.
draw.rs drops its two-viewport refusal. floor.rs adds the two missing cases, and the translator
sees shaderOutputViewportIndex.
2026-11-21 00:34:20 -08:00
Anees Iqbal 0906aad6e5 rt: a pass with no attachment is refused at 0 samples alone, as plain Metal refuses it, measured
What: Refusal::NoAttachmentPass refused a side of 0, and any defaultRasterSampleCount that is not
a power of two up to 64. The first form's basis was ours, and that is not enough: only what Metal
refuses may fail. A new probe, crates/metal2vulkan-conformance/probes/no_attachment_passes.m,
measured plain Metal (the API validation layer off) on an Apple M3 Max, macOS 27.0.1, in job
m3-max-62174:
- a new descriptor's defaultRasterSampleCount is 0;
- a side of 0 makes no encoder (nil), and 64 by 64 at 1 sample makes one;
- a count of 0 ends the process at the encoder (SIGABRT), with or without a draw;
- 4 by 4 at 1 sample runs the counting fragment 16 times, and at 4 samples 64 times.
So the refusal keeps a side of 0 and a count of 0, now with the basis metal-measured. A count
that is no Vulkan sample count now makes the encoder, as Metal makes one at 260 (the low 8 bits,
4; ead49055ec's probe). No pipeline state has such a count, so every draw in it is
DrawKind::AttachmentFormats.

Docs: the variant's doc and basis, the descriptor field's doc, the README bullet, REFUSALS.md. The
probe's header carries what it measured. Test: no_attachment.rs drops the 3-sample refusal case.
2026-11-21 00:22:08 -08:00
Anees Iqbal de58250086 rt: a render pass with no attachment, renderTargetWidth by renderTargetHeight at defaultRasterSampleCount
Until now a pass with no attachment was refused as Gap::RenderPass of RenderPassKind::NoAttachment.
Pass::check now builds it. Its area is renderTargetWidth by renderTargetHeight, and its samples
are the new RenderPassDescriptor::default_raster_sample_count (Metal's defaultRasterSampleCount,
0 by default as in Metal), which a draw's pipeline state must match through the existing
renders_into check (DrawKind::AttachmentFormats otherwise). Vulkan's dynamic rendering of no
attachment takes the bound pipeline's rasterizationSamples alone. The translator already asks
framebufferNoAttachmentsSampleCounts for such a state. Its area is the Vulkan render area
unrounded: there is no load, store or resolve to reach the 32-pixel band.

Refusals:
- Refusal::NoAttachmentPass { width, height, samples } (new) covers a side of 0, or a count
  that is no sample count (a power of two up to 64), Metal's default 0 included. Basis: ours
  (VUID-VkRenderingInfo-None-08994 and -08995).
- RenderPassKind::NoAttachment stays, now for a side past the device's maxFramebufferWidth or
  maxFramebufferHeight (VUID-VkRenderingInfo-pNext-07815 and -07816; EncoderLimits::max_framebuffer).
  Every venue dumped reports 16384 or 32768, so 16384 (Metal's largest side) or more: jobs
  m3-max-48727 to 48731, 48736, 48737 and 61508.

Consumer: reims-vgpu builds rt::RenderPassDescriptor from Default and its fields
(crates/reims-vgpu-vulkan/src/rt_platform/descriptor.rs:412), so it still compiles. Its ops
already keep default_raster_sample_count (reims-vgpu-graphics ops.rs:480), but rt_pass does not
yet pass it on. Until it does, its passes with no attachment are NoAttachmentPass at 0 samples.

Conformance: the rt side sets default_raster_sample_count to 1 wherever its pass has a size, as
the Metal side sets it (metal_side.rs:8940). All 377 ledger rows refused with "a render pass with
NoAttachment is not built" leave known-gaps-rt.tsv: integer-vertex-attributes, the tessellation-*
cases, vertex-format-*, vertex-constant-step-instances, vertex-step-rate-instances.
CONFORMANCE-COVERAGE.md is regenerated. Docs: README (the descriptor, the new pass bullet, the
render pass gaps), REFUSALS.md, and api_signatures (1 field, 1 variant).

Tests:
- tests/no_attachment.rs: engine rt6_attachmentless (the functions a Metal probe drew in such a
  pass) in a 2 by 2 pass at 1, 2 and 4 samples. rt6_mark_sample, which reads [[sample_id]], marks
  every sample of every pixel and runs 4 times the samples. rt6_mark_coverage marks every sample
  and runs at least once a pixel. Also checked: a 4-sample state in a 1-sample pass is
  AttachmentFormats; no width, no height, 0 and 3 samples are NoAttachmentPass; a width past
  the device's is NoAttachment.
- tests/pass.rs: the default descriptor is now NoAttachmentPass at 0 by 0 and 0 samples.
2026-11-21 00:22:07 -08:00
Anees Iqbal 7cd1103a44 rt: cube array textures and views, with imageCubeArray in the floor
A cube array texture (`MTLTextureTypeCubeArray`) is built: an image cube-compatible with six of
its layers a cube (`arrayLength` times six layers), whose shader view is
`VK_IMAGE_VIEW_TYPE_CUBE_ARRAY`. Metal's casts with a cube array
(`makeTextureView(pixelFormat:textureType:levels:slices:)`) are built in the same form: a cube
array's subrange of whole cubes, its faces as a 2D texture (one face) or a 2D array (any faces),
six of its faces as a cube, a cube as a cube array of one cube, and a multiple of six slices of a
square 2D array as a cube array where its image is cube-compatible. A pass resolves into a
one-sample colour cube array as into a cube (`Plan::resolves`), and a layered pass renders a cube
array's faces across its cubes (the attachment view of its layers, as for a cube).

`imageCubeArray` joins the floor's required features. Every probed device reports it (vulkaninfo
dumps m3-max-48727 to 48731, 48736, 48737 and 61508: the RX 7900 XTX, every 780M, the RTX 2080,
the RTX 3090, the RTX 5080 Laptop, the Iris Xe, lavapipe, the UHD 630's Windows driver,
KosmicKrisp and the RX 550), and Vulkan 1.4 and Roadmap 2022 require it of every device. A device
without it gets the floor's refusal. The runtime-floor profile and its generator state it
(check_device_profiles: 0 findings), and the floor's missing-feature test has its case.

`Gap::CubeArrayTexture` is deleted (the consumer's checkout at 9bb622a2c2: 0 hits); REFUSALS is
regenerated and the API table loses the variant. The runtime README's texture and view lines,
its resolve line and its floor table say what is built.

Tests, each on every device of the cfg's kind: `tests::texture` round-trips a cube array's last
face (its second cube's); `tests::view` casts a cube as a cube array of one cube, reporting
Metal's array length 1; `tests::cube_views` samples a two-cube `RGBA32Float` cube array at its
second cube and a cube view of its first six faces through the owned fixture
`unk_cube_grad_lod`, every lane reading its face's slice, with `imageCubeArray` enabled; and
`tests::layered` renders a cube array's slices 4 to 9, across both its cubes (the cube-array
layered case, as the layered change landed first).

The conformance ledger's cube array rows and the runtime-floor contexts' opened chains follow in
the next commits.
2026-11-21 00:19:34 -08:00
Anees Iqbal a5fac6fa9b rt: the depth clip mode Clamp and the triangle fill mode Lines, as pipelines of the draw's class made at first use
setDepthClipMode: and setTriangleFillMode: refused every value but Metal's defaults
(DrawKind::DepthClamp, DrawKind::FillMode). Vulkan 1.3 bakes both in
VkPipelineRasterizationStateCreateInfo, and only VK_EXT_extended_dynamic_state3 makes them
dynamic. The floor cannot require that extension: the UHD 630's Windows driver lists no EDS3, and
KosmicKrisp reports extendedDynamicState3PolygonMode false. So both are now first-use pipeline
variants, the accepted form. The encoder keeps a Raster (clamp, lines) and each draw takes
RenderCompiled::pipeline(topology, raster). The content keeps its primary VkPipeline (the triangle
or patch class at the default state) and a bounded list of the others, by class list topology and
raster state: at most 7 (three more states of the triangle or patch class, two of each other
class). The line and point classes take the clip mode alone, since Metal and Vulkan apply the fill
mode to triangles only. A triangle's edges under Lines chain Bresenham's rule, as the line class
does ("the effective rasterization input topology is in the line topology class"). The first draw
under a state makes its pipeline and waits for it: a first-use wait of a new site,
FirstUse::Raster (Metrics::first_use_raster_waits, _nanos, _max_nanos). The line and point
classes' first draws at the default state count where they did.

Floor:
- depthClamp joins REQUIRED, and the translator is told (=> DepthClamp), so the encoder maps the
  mode through metal::state::depth_clamp_enable. Vulkan 1.4 and Roadmap 2022 require it. The venue
  dumps report it true on every venue: m3-max-48727, 48728, 48729, 48730, 48731, 48736, 48737 and
  61508. tests/floor.rs, the README floor table, RUNTIME_FLOOR and profiles/runtime-floor.json
  add it.
- fillModeNonSolid is enabled where reported (FILL_MODES, told to the translator), and the setter
  maps Lines through metal::state::polygon_mode. KosmicKrisp on the M3 Max reports it false
  (m3-max-48737); every other dumped venue reports it true. There Lines stays DrawKind::FillMode,
  and so does the raw value 2, which no SDK header declares.

DrawKind::DepthClamp is deleted. The consumer's checkout names it nowhere (git grep in
reims-vgpu: 0 hits). Its only call sites are set_triangle_fill_mode and set_depth_clip_mode at
crates/reims-vgpu-vulkan/src/rt_platform/render.rs:371 and :374, whose signatures are unchanged.

The translator's raster-state test reads runtime-floor, which now states depthClamp. Clamp maps
there, and the refusal is asserted on runtime-floor without it, as ab8277a560 did for
depthBiasClamp. Other translator tests that read runtime-floor were grepped for DepthClamp and
FillModeNonSolid, and none reads the floor as lacking them.

Known gaps (README): a content's first draw under Clamp or Lines makes a VkPipeline, which Metal
does not. Under Clamp the depth a fragment function writes is the device's clamp's: Metal stores a
negative NaN as 0 below a range above 0, and the translator's depth_clamp_range variant is not
drawn.

Conformance: render-state-depth-clip and render-state-facing leave known-gaps-rt.tsv;
CONFORMANCE-COVERAGE.md regenerated. Docs: README (encoder, first-use waits, floor and fill-mode
tables, known gaps), REFUSALS.md, the api_signatures table (3 Metrics fields, 1 variant gone).

Tests:
- tests/raster.rs: a triangle in front of the near plane draws nothing under Clip and every
  texel under Clamp (twice: one pipeline made). Under Lines, through a viewport half a pixel
  right of and above the corner, the triangle draws its two edges inside the target, column 0
  and row 7, and nothing inside. Without fillModeNonSolid it is FillMode and fills. Pipelines
  made, raster first-use waits and first-use waits are each 1 + fillModeNonSolid.
- draw.rs: setting both modes makes no pipeline when no draw follows.
- floor.rs: depthClamp's missing case, and the fill-mode feature enabled where reported.
- first_use_sites.rs: the raster site.
2026-11-21 00:14:34 -08:00
Anees Iqbal 57855c6097 Link: the synthesized geometry stage goes, both forms (the barycentric weights and the rate map's fan-out)
The translator built geometry stages in two forms that no Metal function asks for:
- the barycentric weights: a fragment function's [[barycentric_coord]] read as varyings, which a
  generated geometry stage of each topology class wrote, on a device without
  fragmentShaderBarycentric;
- the rate map's fan-out: a draw of a rasterization-rate-mapped pass's triangles once, a geometry
  stage emitting a copy of each per region, with its probe and its region-copy vertex variant.

Neither form reached a guest. The runtime enables no geometryShader, so it refused the weights
form already. It never sets BindShape::region_fan_out, and draws a rate-mapped pass region by
region (the regions route, RateMapRegions, and region_viewports, which stay). Validation never set
region_fan_out either.

After this change, one form is left for each:
- A fragment function that reads [[barycentric_coord]] reads the device's own
  BaryCoordKHR/BaryCoordNoPerspKHR. Without fragmentShaderBarycentric it is refused as
  Unsupported(Barycentrics) needing that feature alone; geometryShader is no longer offered.
- A rate-mapped pass draws through the regions route.

Rule 1: no precision note stops being raised. The fan-out's copies were a near-equivalent of the
regions route, which carries its own note (RateMapRegions::precision), and the weights form
raised none. The catalogue is unchanged.

Removed:
- pipeline::link::geometry (GeometryStages, the three classes' stages) and pipeline::link::fan_out,
  with their tests (link/tests/geometry.rs, link/tests/fan_out.rs) and tests/engine_region_fan_out;
- bind::fan_out (the region table, the probe's word layout and its constants);
- RegionFanOut and FanOutState;
- the region_fan_out fields of GraphicsState, BindState, BindShape, VariantKey and
  RenderLinkInputs, and LoweringInputs::region_copies;
- the region copy's lowering: StageIoPlan::region_copy, RegionCopy and the region table's
  declaration;
- PushField::RegionBox and RegionProbe;
- SyntheticBinding::RateMapRegions and RateMapFlags, and WriteSource::RateMapRegions and
  RateMapFlags;
- RuntimeFact::SynthesizedGeometry, RenderPipeline::runs_stage and Linked::geometry;
- IoRole::Barycentric with VaryingKey::barycentric and its key tag;
- VkProperty::SubgroupGeometryStage;
- the SPIR-V IR's geometry execution model, which only these stages produced: ExecModel::Geometry,
  OpEmitVertex and OpEndPrimitive, the InputPoints, InputLines, OutputLineStrip,
  OutputTriangleStrip and Invocations modes, ModelNeed::Geometry, EntryRule::GeometryModes and the
  builder's geometry ops;
- from scripts/regen-spirv-grammar/items.txt, the opcodes EmitVertex and EndPrimitive, the
  execution model Geometry and those five execution modes. spv.rs is regenerated: the opcodes and
  the model stay as test-only values, which the test parser reads, and the modes go;
- in validation, the census's geometry stage filter, the draw's runs_stage filter and the
  candidate's GEOMETRY stage arm. The census test that read three geometry stages from
  engine/bary_weights goes with them.

The SPIR-V builder now marks only Position Invariant; ClipDistance was the fan-out's.
band::plan loses its geometry flag, and takes the four SPIR-V helpers it shared with the
geometry module. The binder's stage map takes a geometry stage as no render stage.

Validation cases that executed either form: none.
- Fan-out: no validation code sets region_fan_out.
- Weights: two authored cases read [[barycentric_coord]], fa8b920d3cf3 and ae0a7e39b12f. Neither
  has a stored Vulkan observation on a profile without fragmentShaderBarycentric. fa8b920d3cf3 is
  observed on Metal and MoltenVK, and moltenvk-m3 has the feature. ae0a7e39b12f is observed on
  Metal only.

Fourth user of GeometryStages: none. It was used by link, the compile API's splice, the binder's
selection (through RuntimeFact::SynthesizedGeometry and GraphicsState::region_fan_out) and its
own tests.

Tests:
- engine_stage_io_tail's weights test is now without_the_feature_the_weights_are_refused: on
  lavapipe, ANV's Iris Xe, NVIDIA's Pascal (each with geometryShader) and runtime-floor (without
  it), both barycentric entries are refused needing fragmentShaderBarycentric.
- engine_target_indices checks each pipeline's stages valid where it counted geometry stages, and
  loses the_weights_stage_beside_a_vertex_layer_is_not_implemented: that combination is now the
  plain refusal above.
- engine_amplification no longer counts geometry stages.
- The binder's render stage test refuses a geometry stage.
- The builder's invariant test refuses ClipDistance.
- engine_rotated_weights' rotated draw runs on moltenvk-m3 and RDNA3's RADV, each with
  fragmentShaderBarycentric, where it ran on lavapipe through the weights form.
- The fact mechanism test numbers its 100 RuntimeFact variants densely again (PrivateArena,
  which development added, takes 99).

Bless due until the next named pin, where the M3 bless job takes them; nothing is blessed here:
- tests::public_fixtures_engine (the inventory): every [[barycentric_coord]] cell on a profile
  without fragmentShaderBarycentric becomes Unsupported(Barycentrics) needing it alone, where it
  compiled through the geometry stages (with geometryShader) or offered GeometryShader as the
  alternative;
- tests::golden_hashes, and pipeline::compile::tests::the_old_render_descriptor_key_keeps_its_value
  (the render key), as under the commit below: the profiles' fingerprints change;
- the authored compile census.

SEMANTICS_VERSION 2247 -> 2248 and ARTIFACT_FORMAT_VERSION 583 -> 584 are placeholders that main
renumbers.
SEMANTICS: a fragment function's weights and every rate-mapped variant change form. ARTIFACT: the
codec loses the RegionFanOut, FanOutState, GraphicsState::region_fan_out, IoRole::Barycentric,
RuntimeFact::SynthesizedGeometry, PushField, SyntheticBinding and VkProperty tags. RUNTIME_VERSION
stays: the runtime's render-pipeline kind no longer reads region_fan_out, which it never set, and
its SynthesizedStages doc names the bands alone. runtime-sources.sha256 keeps development's (land-pkt
re-pins it), api_signatures and api_surface drop the removed items, and docs/REFUSALS.md is regenerated.
API.md drops the geometry stages from RenderPipeline's stages, its barycentric bullet and its band
bullet. ARCHITECTURE.md's link line drops pipeline::link::geometry, and the runtime README's
Barycentrics gap names the feature alone.

Consumer check (consumer_check.sh, consumer development b76d6ac4a9): region_fan_out,
RegionFanOut, FanOutState, region_copies, region_copy, RateMapFlags, RegionBox, RegionProbe,
SynthesizedGeometry, FEW_COPIES, PROBE_DRAW_WORDS, RegionCopies and runs_stage have 0 hits.
GeometryStages appears in crates/reims-vgpu-c/link-order.txt only. fan_out's hits are the
consumer's own event fan-out in crates/reims-vgpu/src/graphics/decode/cmdbuf.rs, not this
module.

Verified (jobs read):
- m3-max-61801: the suites at this change's work in progress (4f1f934423); its real reds were the
  mechanism numbering and the rotated weights on amd-rdna3-radv, both fixed here; the render key
  reads bless-due.
- At the stack's tip over this change (dvl-5 1fa4aed963 and dvl-6 92fe40c38f): 61978 and 61987,
  fmt, clippy in every configuration, Rustdoc, each feature alone, the API docs and the Windows
  clippy, green; 61891, the suites at dvl-4: 13 failures, each a bless-due golden above or
  development's own (the raster state test, the inventory's sample_fill rows); 61968, the lavapipe
  device suite of metal2vulkan-validation, 1483 of 1483, and public case qualification Match;
  62042, the metal2vulkan-validation suite at dvl-5, 1378 of 1378 passed.
- States-only play of this change's player (p-gd.zst) over 35 distinct streams on gem10 (61919),
  um870 (61924), ms01 (61967) and um790 (62004): 456,384 render and 91,972 compute states made,
  0 refused, every stream exit 0. The msi stream (windrag-780m-b2) is not played: msi had no
  memory free.

Rebased onto development 4cf936ed4d (selidx landed as 3ecf606aa8). The conflicts: the version
lines; the mechanism test, where development added RuntimeFact::PrivateArena; runtime-sources.sha256,
where development's is kept; and api_signatures.tsv and docs/REFUSALS.md, both regenerated
(signatures.py --bless, refusal_surface.py) and differing from development by this change's items
alone. The jobs above ran at the old base; the rebased tip's are in the report to main.
2026-11-21 00:03:34 -08:00
Anees Iqbal aed460e0da rt: indirect draws, of primitives, indexed primitives and patches
The render encoder builds Metal's three indirect draws:
`drawPrimitives:indirectBuffer:indirectBufferOffset:` (`draw_primitives_indirect`),
`drawIndexedPrimitives:indexType:indexBuffer:indexBufferOffset:indirectBuffer:indirectBufferOffset:`
(`draw_indexed_primitives_indirect`) and
`drawPatches:patchIndexBuffer:patchIndexBufferOffset:indirectBuffer:indirectBufferOffset:`
(`draw_patches_indirect`). Each is one `vkCmdDrawIndirect` or `vkCmdDrawIndexedIndirect` on the
buffer at its offset: Metal's argument structs lie as Vulkan's commands do, so the GPU reads
them as they are and nothing is copied. Before, the encoder had no such methods and the README
listed indirect draws as not built.

drawPatches indirect is built: rt's patch draw is vkCmdDraw(patch_count, instances, patch_start,
base), each patch one vertex of the state's patch list, so Metal's patch count is the indirect
command's vertex count unchanged. A patch index buffer stays `DrawKind::PatchIndexBuffer`, as
the direct draw's.

The arguments' buffer counts among the draw's reads as an index buffer does (draw_reaches,
Managed copies), and the command buffer keeps it until it retires. The pass's first barrier
(Reach::Commands, which has INDIRECT_COMMAND_READ) and the encoder's memory barrier make earlier
writes visible to the read. An offset not a multiple of 4 or without the arguments' 16 bytes (20
indexed) is Refusal::IndirectOffset; arguments at a block byte not a multiple of 4 are
Refusal::ArgumentPlace; an indexed draw's index offset must be a multiple of the index size and
inside the buffer. A device that takes firstInstance 0 alone under a divided step rate refuses
an indirect draw through such a state (DividedBaseInstance), since the GPU reads the base
instance.

Floor: drawIndirectFirstInstance joins REQUIRED (Vulkan 1.4 requires it), so Metal's base
instance is the device's own. The translator is not told. The venue dumps report it true on
every venue: m3-max-48727, 48728, 48729, 48730, 48731, 48736, 48737 and 61508. tests/floor.rs,
the README floor table, regen_device_profiles.py's RUNTIME_FLOOR and profiles/runtime-floor.json
add it. The translator's tests that read runtime-floor only see indirect_needs_arguments become
false more often, which none asserts the other way.

Known gap (README): an indexed indirect draw's index count is the GPU's, so a count past the
index buffer is not refused as a direct one is. Without robustBufferAccess2, which the floor does
not require, a count past the block's VkBuffer is outside valid usage
(VUID-vkCmdDrawIndexedIndirect-robustBufferAccess2-08798).

The encoder's doc no longer lists `useResource:` as not built (it is, since 62b3e5a250).

Docs: README, REFUSALS.md and METAL-COVERAGE.md (the three selectors now implemented), the
api_signatures table (three methods).

Tests: draw.rs's every_device_draws_from_indirect_arguments_a_blit_wrote: arguments written by a
blit earlier in the command buffer, at offset 16, draw the constant-step triangle as the direct
draw does (vertex 1, instances 1 and 2 at base instance 1), indexed through [7, 0, 1, 2] from
index 1 at base vertex 1 too; arguments of no instances draw nothing. patch.rs's
every_device_draws_patches_from_indirect_arguments: two patches from arguments 4 bytes in draw
as the direct patch test's, and a patch index buffer is PatchIndexBuffer.
2026-11-21 00:02:34 -08:00
Anees Iqbal 3ecf606aa8 Stage io: an index not shown the same across a primitive is refused; the selected index store goes
Metal's shading language leaves a primitive whose vertices write different indices undefined:
"You must return the same value of [[render_target_array_index]] for every vertex in a primitive.
If values differ, the behavior and value passed to the fragment function are undefined." The same
sentence covers [[viewport_array_index]]. The selected index store answered that case with the
first vertex's index, through the synthesized geometry stages, and MoltenVK's profile could take
DriverDeviation::MetalFirstVertexIndices to store it as written. Both reproduced undefined Metal.
The runtime never reached either: it enables no geometryShader, and no profile takes the
deviation.

After this change every profile has one form. An index that the function's structure shows to be
the same at every vertex of a primitive is stored to Layer or ViewportIndex where
shaderOutputLayer or shaderOutputViewportIndex is enabled. Without that feature it is refused as
Unsupported(LayeredRendering), or as Unsupported(VertexAmplification) for an index the
amplification's offset alone sets. The refusal needs the output feature only; geometryShader is
no longer offered. An index not shown the same is refused as NotImplemented(LayeredRendering) on
every device. index_store's comment cites the two spec sentences as the reason for that refusal.
It cites Vulkan's same-value rule (VUID-VkPipelineShaderStageCreateInfo-stage-02596 for Layer,
-02597 for ViewportIndex) as the reason the index is not stored as written. A device without
multiViewport still stores no viewport index.

Removed:
- IndexStore::Selected, indices_selected, selected_index;
- StageIoPlan::indices_selected and first_vertex_indices_by_device, and the compile layer's
  requirement;
- IoRole::SelectedLayer and SelectedViewport, with their codec tags;
- VaryingKey::selected_layer and selected_viewport, with their key tags;
- GeometryStages::layer and viewport, the stages' Layer and ViewportIndex stores, and the
  Reason's index half;
- RuntimeFact::SynthesizedGeometry's layer and viewport fields;
- DriverDeviation::MetalFirstVertexIndices, its last variant, and with it the DriverDeviation type
  and DeviceProfile::takes_driver_deviation;
- VkProperty::MetalFirstVertexIndices and its codec tag.

The geometry stages keep the barycentric weights and the fan-out. A fan-out stage past the
geometry limits is now refused as RasterizationRateMap needing the limit. Before, it was refused
as LayeredRendering with an empty alternative, because the stage's reason held neither weights
nor an index.

Rule 1: no note stops being raised. The first-vertex form raised none. The input it served is now
a typed refusal, so no difference goes silent. The catalogue is unchanged.

The command line: no code there names a removed item. Translating a vertex function whose index
is not shown the same now prints FALLBACK (NotImplemented LayeredRendering) on a geometryShader
profile, where before it compiled with the stages. Validation: four authored cases compiled on
every profile-leg but moltenvk-m3 through the stages: 07f125464dac, 434e73e03189, 7ce6dea0475e
and a013a2bcbe56. On moltenvk-m3 they were refused needing geometryShader. They are now refused
on every leg; the authored compile census takes them at the next named pin, not in this change.
The coverage census test that read three geometry stages from engine/rt6_first_vertex now reads
them from engine/bary_weights on the 780M profile without fragmentShaderBarycentric.

Fixture: engine/vertex_amplification's amp_vertex and amp_vertex_layer now take their viewport
and slice from the instance (iid & 1) instead of the vertex (vid & 1). The amplification and
render-target-slice tests then still compile them, and engine/rt6_first_vertex carries the
per-vertex case. The fixture was regenerated by scripts/regen-air-fixtures (Apple metal
32023.922, llvm-dis 21.1.8).

Tests:
- engine_selected_indices becomes engine_target_indices, covering:
  - a uniform slice or viewport takes the output or nothing else;
  - no multiViewport stores nothing;
  - per-vertex indices are refused on every device;
  - the floor's zero reads;
  - the weights' stage beside a vertex Layer is not implemented.
- link/tests/geometry.rs loses its two selected-index tests.
- engine_amplification, engine_render_target_slice and engine_stage_io now expect the builtin and
  the output-only refusal.
- runtime-floor now requires shaderOutputLayer, so the tests that need a device without it
  withhold the feature from the floor's description (engine_target_indices, engine_amplification,
  engine_stage_io).

Bless due until the next named pin, where the M3 bless job takes them; nothing is blessed here:
- tests::air_input::engine_fixtures_match_their_golden_printout: vertex_amplification's printout;
- tests::public_fixtures_engine (the inventory):
  - rt6_first_vertex and rt6_first_vertex_point become NotImplemented(LayeredRendering) on every
    profile;
  - amp_vertex and amp_vertex_layer become ok on moltenvk-m3;
  - each LayeredRendering cell that offered GeometryShader loses that alternative;
- tests::golden_hashes, and pipeline::compile::tests::the_old_render_descriptor_key_keeps_its_value
  (the render key): the profiles' fingerprints change with VkProperty's codec;
- the authored compile census.

SEMANTICS_VERSION 2245 -> 2246 and ARTIFACT_FORMAT_VERSION 582 -> 583.
SEMANTICS: an index store changes form. ARTIFACT: the codec loses two IoRole tags, a VkProperty tag
and two RuntimeFact fields. RUNTIME_VERSION stays; runtime-sources.sha256 takes the new hash, and
api_signatures is blessed. docs/REFUSALS.md is regenerated. The runtime README's known gap for a
differing index names the refusal as not implemented and drops the geometry stage form. API.md's
layered-rendering bullet, its RenderPipeline stage list and its profile accessors, and
ARCHITECTURE.md's link line drop the selected index.

Consumer check (consumer_check.sh, consumer development b76d6ac4a9):
- MetalFirstVertexIndices, SelectedLayer, SelectedViewport, selected_layer, selected_viewport,
  SynthesizedGeometry, driver_deviations and DriverDeviation: 0 hits.
- GeometryStages and takes_driver_deviation: in crates/reims-vgpu-c/link-order.txt only.
- DriverDeviation and takes_driver_deviation are named in crates/reims-vgpu-vulkan/src/gpu/rgbx.rs
  and encode_render/tests/metal_tests.rs on some of the consumer's steelbrain/* branches, for
  MetalSampler, MetalHalfConversion and MetalVertexSimdgroups, which the stack below already
  removed. development has neither file.

Verified (jobs read):
- m3-max-61766: lint in every configuration and the suites at this change on the earlier stack
  (eeef281428); its reds were the bless-due goldens above.
- At the stack's tip over this change (dvl-5 1fa4aed963 and dvl-6 92fe40c38f): 61978 and 61987,
  fmt, clippy in every configuration, Rustdoc, each feature alone, the API docs and the Windows
  clippy, green; 61891, the suites at dvl-4: 13 failures, each a bless-due golden above or
  development's own (the raster state test, the inventory's sample_fill rows); 61968, the lavapipe
  device suite of metal2vulkan-validation, 1483 of 1483.
- m3-max-62042: the metal2vulkan-validation suite at dvl-5, 1378 of 1378 passed.
- States-only play of this change's player (p-si.zst) over the 36 streams on um870 (61909),
  gem10 (61912), ms01 (61958), um790 (61990) and msi (62045): 502,920 render and 108,189 compute
  states made, 0 refused, every stream exit 0.
2026-11-20 23:23:51 -08:00
Anees Iqbal c034220175 Private memory past the 16 KiB floor lives in the runtime's arena, one slot an invocation; a dispatch past its budget splits
A kernel whose private arrays (indexed at run time) passed the translator's 16 KiB floor was
refused as Unsupported{PrivateMemory}. The app's 780M library holds 7 such kernels (19,792 to
34,736 bytes a thread), and the Iris walk refused one at 28,704. Metal holds that memory itself.
The runtime now holds it in device memory it owns.

Translator, under the identity domains only (the default domains' binder supplies no such
memory, so they refuse as before):
- memory::plan::private_memory: a kernel with no call stack whose private bytes pass the floor
  places every alloca it indexes at run time in its private arena, and marks the arena
  ArenaLayout::device. The arena then leaves the private bytes. The kernel's own bytes decide;
  no device fact does.
- Such an arena has no Private variable. Its words are PhysicalStorageBuffer words (Aligned 4)
  at the invocation's slot. The slot is PushField::PrivateArenaAddress (a u64) plus
  i * slot_bytes, with i = ((wz*ny + wy)*nx + wx)*n + LocalInvocationIndex in 32 bits. It is
  computed once in the entry block (dispatch::KernelDecl::arena_slot, Invariant::ArenaSlot).
  RuntimeFact::PrivateArena { slot_bytes } states the slot: the arena's bytes rounded up to 16.
- A tile kernel's arena past the floor stays refused (PrivateMemory). A slot past u32 is
  LimitExceeded(PrivateArenaBytes).

Runtime (crate::arena):
- The arena is one Private pool block, never zeroed: Metal's private memory is undefined until
  the thread writes it. The device keeps a Weak to the last block. Each command buffer that
  dispatches into a block keeps it (keep_block), and a dispatch that needs no more than a block
  still kept takes it again.
- A dispatch's slots take at most 1/16 of the largest DEVICE_LOCAL heap, capped at the longest
  block, or one threadgroup's slots where those are more. A dispatch past that budget runs in
  pieces of whole threadgroups through the existing split loop, each piece's DispatchRegion
  carrying its first threadgroup. There is one split form; vkCmdDispatchBase is not used.
- A barrier (the encoder's owed barrier, so it merges with a hazard barrier) comes before each
  arena piece, except the first piece in a block the dispatch took new. Dispatches of kernels
  without an arena take no new barrier.
- An indirect dispatch of an arena kernel is Gap::IndirectPrivateArena: its counts are the
  GPU's, so the runtime can neither size the arena nor split it.
- Metrics::private_arena_dispatches, private_arena_pieces and private_arena_blocks count the
  path, and private_arena_allocations counts the block takes.
- The budget a device test splits with is Core::arena_budget's test override (cfg(test) with
  m2v_gpu or m2v_cpu_icd), never a DeviceOptions field.

Docs: docs/API.md (the field, the fact, the slot formula), the runtime README (Compute
encoders: the arena, its budget, its order, the indirect gap), docs/REFUSALS.md (regenerated),
api_signatures.tsv (blessed).
SEMANTICS_VERSION 2244 -> 2245, ARTIFACT_FORMAT_VERSION 581 -> 582, RUNTIME_VERSION 2549 -> 2550.

Tests:
- engine_private_memory's
  a_kernel_past_the_floor_keeps_its_private_memory_in_the_runtimes_memory_under_identity:
  7176, 9216 and 51,200 words on the 780M's, the Iris Xe's and an RTX 50's profiles. Each compiles,
  passes L3, pushes the address, states the fact, holds 0 private bytes and records no note.
  The default domains refuse as before.
- rt private_arena's
  every_device_holds_private_memory_past_the_floor_in_its_arena_split_or_whole: 28,704, 36,864
  and 204,800 bytes a thread, 8 groups of 64, under the device's budget (1 piece) and a test
  budget (4 and 8 pieces). Every answer matches a CPU reference. It counts 2 arena dispatches,
  their pieces, and exactly 2*pieces - (blocks taken) barriers beyond a plain command buffer's.
  Four plain dispatches take the barriers one does.

The kernel interface declares the arena's slot (Interface::private_arena, the slot bytes of
RuntimeFact::PrivateArena); the compute test's interface sets it to None.
2026-11-20 22:37:06 -08:00
Anees Iqbal 7ba1cdbf30 rt: a blit copy between a buffer and a texture takes MTLBlitOption's plane options
copyFromBuffer:...:options: and copyFromTexture:...:toBuffer:...:options: are
BlitCommandEncoder::copy_from_buffer_with_options and
copy_from_texture_to_buffer_with_options, with a public BlitOption (None,
DepthFromDepthStencil, StencilFromDepthStencil). A plane option copies the aspect it
names, one vkCmdCopyBufferToImage or vkCmdCopyImageToBuffer region of that aspect, where
the pixel format has it: the depth or the stencil of a combined format, and the depth of
Depth16Unorm or the stencil of Stencil8 too, which Metal takes (the conformance crate's
buffer-depth-samples rows put the option to Metal on those formats). The forms without
an option are those of None. The unit is texture.rs's copy_unit of the named aspect, so a
copy into a 32-bit float depth is Gap::FloatDepthUpload as Depth32Float's is, and a
multisample texture stays Gap::TextureBytes; a plane option of a format without its
aspect is Gap::TextureBytes. MTLBlitOptionRowLinearPVRTC is not offered: the runtime
makes no PVRTC texture, and the conformance side keeps it unavailable.

The private buffer_copy takes the direction and the option as one Way, which keeps it
under clippy's argument count without an expect.

Docs: the rt README's blit lines, Gap::TextureBytes's doc, REFUSALS.md (regenerated),
the metal-coverage map (the two options selectors now name the options methods) and
METAL-COVERAGE.md, the public signature table (6 records added, none moved).

Tests: tests/blit_options.rs. On the host, each option's aspect and unit bytes in both
directions, and each refusal. Under a device cfg, a pass clears a Depth32Float_Stencil8
texture to depth 0.25 and stencil 0x5a, a stencil region goes in from a buffer, and both
planes come back out (the region with 0x5a around it, 0.25 at every texel);
Depth16Unorm's depth and Stencil8's stencil go in and come back out bit for bit.
2026-11-20 22:11:29 -08:00
Anees Iqbal 2c5573d598 rt: a refused pipeline state's Error::Translation names its functions
What: Error::Translation is now Error::Translation { error, functions }. new_compute_pipeline_state
and new_render_pipeline_state fill `functions` at their public entry with each Function stage's own
name in its library (FunctionInfo::name), in stage order (the vertex function before the fragment
function), and the Display prints them: "the translator made no pipeline of a, b: ...". A compiled
stage has no name; a sampler state, a device and a dispatch's late kernel variant name none, and
then the text is as before. It is a diagnostic for the program's log, documented as the text of
the NSError Metal's failed creation gives; no lowering or decision reads it.

Why: the consumer logged only the first refusal of each kind, which hid 6 of one 3D modelling
app's 8 refused kernels; with the names it logs every refused create.

How: the existing creation bodies moved to private compute_pipeline_state and
render_pipeline_state, whose translator errors name no function (Error::translation, for map_err),
and the public entries map them through Error::of_stages. The one-token map_err edits are in
pipeline.rs, render.rs, sampler.rs:371 and device.rs:1290 and 1294.

Same commit: 10 rt test patterns; validation's candidate/platform/runtime.rs (2),
candidate/tests/engine_compute.rs, replay/new_runtime/mod.rs and replay/new_runtime/tests.rs (3);
conformance's rt_side.rs, rt_side/states.rs and case.rs. Conformance's Failure::of_rt records the
error's text without the names (they are the case's own functions), so the 484 answers in
known-gaps-rt.tsv stay as they are. The rt README's compute and render state entries say what
`functions` holds; REFUSALS.md and api_signatures.tsv are regenerated (one changed signature).

Consumer break to follow: reims-vgpu builds or matches rt::Error::Translation(..) at 17 sites,
all in crates/reims-vgpu-vulkan/src/rt_platform/: unbuilt.rs (7), diag.rs (5), library.rs (3),
pipeline.rs (1), argument.rs (1). Each becomes Translation { error, .. } in a match, or
Translation { error, functions: Vec::new() } where it builds one.

Tests (device cfgs): every_device_names_the_function_of_a_refused_compute_state (translate.rs):
a compute state of the vertex function colored_vertex is Error::Translation with functions
["colored_vertex"], and its text starts "the translator made no pipeline of colored_vertex: ".
every_device_refuses_the_patch_draws_it_does_not_build (patch.rs) now also holds the
control-point index type's Tessellation refusal to functions ["tess_triangle_points",
"tess_fragment"] and to the text that names them in that order. Without the entry mapping both
fail on an empty `functions`.
2026-11-20 22:25:11 -08:00
Anees Iqbal 62b3e5a250 rt: the render encoder's use_resource, and a draw after a declared write of a texture with no storage element is Gap::StorageElement
What: RenderCommandEncoder::use_resource is useResource:usage:stages:, its plural and their
deprecated forms without stages. The command buffer keeps the buffer or the texture until it
retires and nothing is recorded: every resource is resident to every function, and the pass's
barriers already order its draws. A usage that writes a texture (or a view of one) made for
shader writes with no storage element marks the encoder, and every later draw whose vertex or
fragment function may reach a texture through its storage image beyond its slots
(PipelineInterface::unbound_storage_textures: an argument buffer's write or read_write texture, a
resource ID) is Gap::StorageElement with no slot, as the compute encoder's dispatch already is.
Before this, such a draw ran and Vulkan dropped the writes Metal makes. The declaration
invalidates the encoder's held draw facts, so a draw of an unchanged state and bindings after it
is checked again.

Also: the three redundant explicit links in new_render_pipeline_state's docs (private rustdoc
-D warnings, from 3653240b57) are plain intra-doc links; Refusal::OtherDevice's doc names the
render encoder's calls; the README's storage-element known gap no longer waits for the render
encoder's useResource:, and the render encoder's section describes use_resource; coverage.tsv
marks the four MTLRenderCommandEncoder useResource rows implemented; REFUSALS.md,
METAL-COVERAGE.md, CONFORMANCE-COVERAGE.md and api_signatures.tsv regenerated.

Test: every_device_refuses_a_draw_after_a_declared_write_of_a_texture_with_no_storage_element
(storage_element.rs, device cfgs): an owned fragment function writes an argument buffer's
texture2d<float, write>; for RGBA8Unorm, RGBA8Unorm_sRGB, BGRA8Unorm_sRGB, A8Unorm and an sRGB
view of an RGBA8Unorm texture, a draw before the declaration draws, the same draw after
use_resource(WRITE) is Gap::StorageElement { slot: None, pixel_format } exactly where the texture
has no storage element, and a colored_fragment draw after the declaration draws; the fragment
function's write through its resource ID lands (1, 0, 1, 1). Without the Facts::find check the
refused cases draw and the test panics.
2026-11-20 22:08:11 -08:00
Anees Iqbal a134775713 Simd: Metal's own lockstep, fragment and vertex simdgroups, and full quads go
DriverDeviation::SimdgroupLockstep, MetalFragmentSimdgroups, MetalVertexSimdgroups and
MetalFullQuads were never taken, and neither were their VkProperty twins and codec tags.
Device::from_queries enables no Metal* property, and no committed profile carries one. The forms
that only they reached go with them:
- Lockstep. Kernel ordering no longer leaves out a barrier that only emulated simdgroups make
  exact on a device that runs a simdgroup in lockstep. This removes OrderKey's device bit and the
  Decision's count, air::Lockstep::device in metal2vulkan-air, SimdPlan::device_lockstep, the
  census name barrier.lockstep.device (simd::DEVICE_LOCKSTEP) and the module's
  VkProperty::SimdgroupLockstep requirement. Every such place takes its barrier and tier as on
  every real device.
- Fragment simdgroups. SimdPlan::metal_lane and its requirement go. A fragment's
  [[thread_index_in_simdgroup]] is the device's grouping's lane on every profile, and the SimdWidth
  refusal no longer offers VkProperty::MetalFragmentSimdgroups as an alternative: it needs the
  32-lane width alone, as subgroup::tier's own width refusal does. docs/REFUSALS.md's row and the
  fixture inventory's 24 refusal cells on the eight gsm2_fragment_lanes rows change with it.
- Vertex simdgroups. The prefix lane goes: SimdPlan::prefix_lane, its Private word and entry hook
  (simd::emit_entry), and SubgroupRequirement::metal_vertex_simdgroups with its swap of
  SubgroupStage(Vertex). A vertex function's simdgroup operations need the stage listed, as on
  every real device.
- Full quads. SimdPlan::metal_full_quads and its requirement go. A fragment whose group operations
  count the helpers needs shaderQuadControl, as on every real device.

Rule 1: no note stops being raised. FragmentSimdgroupGrouping was withheld only on a
MetalFragmentSimdgroups profile, so on no real device, and it is now raised wherever the
function's answer reads the simdgroup's members, on every profile. Its catalogue entry already
said "on every device", and its doc in artifact.rs now says so too. The other three forms carried
no note. Their inputs now take a barrier, a refusal or the device's grouping, as on every real
device. The catalogue loses no entry.

Validation: c3.rs's FragmentSubgroupUnderTwoQuads doc clause becomes "every device takes that
note, so the gap's answer is always announced". That is the one validation file that named one of
these deviations. It used the deviation only to explain why the gap's answer is always announced,
because the allowance code never reads the deviation. Nothing else in c3.rs changes. The fixture
README's gsm2_fragment_lanes row drops the Metal lane and the gone driver_deviations lane, and its
gsm2_simd_products and gsm2_vertex_votes_shifts rows drop MoltenVK's measured vertex classes.

Tests: the asserts that no module requires one of these properties, or counts
barrier.lockstep.device, go with them. This covers engine_simd_lockstep's two emulated-tier
tests, its no-barrier lists and LOCKSTEP_NAMES, engine_simd's fragment-lane test (whose narrow
refusal now needs the width alone), and engine_matmul2d's tier assert, which held on every profile
once no profile had the property. Also going: device/tests/subgroup.rs'
a_measured_vertex_stage_states_its_fact_in_place_of_the_stage and the requirement literals' field.
engine_fragment's simd_after_discard takes quad control alone.

SEMANTICS_VERSION 2241 and ARTIFACT_FORMAT_VERSION 579 are placeholders that main renumbers.
SEMANTICS: the profile's fingerprint, the SimdWidth refusal's needs and the census of the same
input change form. ARTIFACT: the codec loses four VkProperty tags and the requirement's field.
RUNTIME_VERSION stays, because the pinned sources' edits remove forms and fields no profile
reached. runtime-sources.sha256 takes the new hash, and api_signatures is blessed.

Consumer check (consumer-uses.sh, consumer development a414607f95, 62 refs): SimdgroupLockstep,
MetalFragmentSimdgroups, MetalFullQuads, metal_vertex_simdgroups and DEVICE_LOCKSTEP have 0 hits
in code. MetalVertexSimdgroups has 0 hits on development. It is used in
crates/reims-vgpu-vulkan/src/gpu/encode_render/tests/metal_tests.rs on 36 of the consumer's
steelbrain/* branches younger than a day, a file its development does not have.
air::Lockstep::device: the consumer's development names no `lockstep` at all.

Verified: m3-max-61467 (homelab-gem10-1): fmt, clippy (all features, --cfg m2v_gpu, --cfg
m2v_cpu_icd) and Rustdoc green at the old base (m3-max-61463 before it failed on four unused test
imports, removed).

Rebased onto development d10a14d5af: the SEMANTICS placeholder is one above its 2235 in stack order
(ARTIFACT_FORMAT_VERSION is already above its 574). The checks above ran at the old base acc706ca47;
the rebased stack's tip is checked by m3-max-61756 (msi-laptop), at the stack rebased on d6d56b8a7c
(tip 5c74fad38d, whose diff from its base is this stack's diff from d10a14d5af): fmt, clippy (all
features, --cfg m2v_gpu, --cfg m2v_cpu_icd) and Rustdoc green; nextest of metal2vulkan,
metal2vulkan-validation, metal2vulkan-conformance and metal2vulkan-runtime ran 5877 tests, 5870
passed. Of the 7 failures, the old render descriptor key's test is unpinned; golden_hashes and
engine inventory parts 4, 5, 7 and 8 are bless due (the profiles' fingerprints changed); and
metal::state's encoder_raster_state_needs_its_features fails the same way at development d10a14d5af
itself (m3-max-61802, where runtime-floor gained depthBiasClamp in a529fb658e), as inventory parts
3, 4, 5 and 8 do there. The stack as rebased on 72e1754218 (tip 090d544208: the same product
changes, without the test-only push sweep fix) played 36 distinct streams over 61 runs on five nodes
with 0 refused (player m3-max-61537; plays m3-max-61548, 61549, 61550, 61559 and 61569).
2026-11-20 22:07:19 -08:00
Anees Iqbal 4d17e4593b Colour writes: the Metal colour-write deviations and the premultiplied rotated blend go
DriverDeviation::MetalColorWrites, MetalFloatColorNans, MetalSmallFloatColorWrites and
MetalNorm16ColorWrites, with their VkProperty values, were never taken. Device::from_queries
enables no Metal* property, and no committed profile carries one. Their forms go:
- lower/stage_io/color_write.rs: the Metal conversion (Conversion, conversion()), the skip of a
  half-float channel on a Metal device, and nan_kept's profile read;
- pipeline/color_writes.rs: lowered()'s small-float and 16-bit norm arms, metal_color_writes and
  metal_stored;
- the rotated blend's premultiplied form, which only MetalColorWrites reached:
  rotated_blend::premultiplied, the measured table's premultiplied factors,
  RotatedBlendForm::Premultiplied, PlannedOutput::premultiplied and stage_io's
  premultiplied_blue.
RotatedBlendForm kept one variant, Unmeasured, so it goes too. LoweringInputs::rotated_blends and
StageIo::rotated_blends become a BTreeSet<u32>: the rotated attachments blended in none of the
measured forms. rotated_blend::rotated_form becomes unmeasured().

Notes: RotatedBlendRounding stays, since the unmeasured form raises it; its doc and its docs/API.md
catalogue entry lose the premultiplied clause. DeviceColorConversion and DeviceNanEncoding stay,
since the device's forms raise them. On Apple's own blend the two straight-alpha pairs may round one
code apart in the search's form, unannounced; rotated_blend's module doc says so.

Tests: color_writes' tests lose their Metal branches; api_surface's with_color_writes loses its
device argument; engine_rotated_colors loses the Apple-blend expectations and premultiplies();
rotated_blend's tests read unmeasured(); engine_fragment's profile filter and api_tests follow.

SEMANTICS_VERSION 2236, ARTIFACT_FORMAT_VERSION 575 (placeholders; main renumbers). SEMANTICS: the
rotated blends' key bytes change form. ARTIFACT: the codec loses RotatedBlendForm and four
VkProperty values, and StageIo's field changes type. RUNTIME_VERSION stays; no binder source
changes. api_signatures is blessed; docs/REFUSALS.md is regenerated (DualSourceBlending loses
rotated_blend's premultiplied site).

Consumer check (consumer-uses.sh, consumer development 415d453172, 58 refs):
MetalFloatColorNans, MetalSmallFloatColorWrites, MetalNorm16ColorWrites, RotatedBlendForm and
rotated_blends 0 hits (code). MetalColorWrites: 0 on development; used in
crates/reims-vgpu-vulkan/src/gpu/encode_render.rs (ties_as_metals) on 36 of the consumer's
steelbrain/* branches, a crate its development no longer has. Premultiplied and Unmeasured: the
consumer's hits are its own (a comment in display.rs, its RefusedWait::Unmeasured), not these
items.

Verified: m3-max-61229 at this commit (homelab-um790-xtx-1): fmt, clippy (all features, --cfg
m2v_gpu and --cfg m2v_cpu_icd) and Rustdoc rc 0. m3-max-61208 on the same change before its rebase
onto acc706ca47 (f4ecfa8c4, msi-laptop): nextest over metal2vulkan, -conformance, -validation and
-runtime, 5881 run, 5880 passed, 25 skipped, 1 failed: the render key test
(the_old_render_descriptor_key_keeps_its_value), left unpinned until the next named pin.

Rebased onto development d10a14d5af: the SEMANTICS placeholder is one above its 2235 in stack order
(ARTIFACT_FORMAT_VERSION is already above its 574). The checks above ran at the old base acc706ca47;
the rebased stack's tip is checked by m3-max-61756 (msi-laptop), at the stack rebased on d6d56b8a7c
(tip 5c74fad38d, whose diff from its base is this stack's diff from d10a14d5af): fmt, clippy (all
features, --cfg m2v_gpu, --cfg m2v_cpu_icd) and Rustdoc green; nextest of metal2vulkan,
metal2vulkan-validation, metal2vulkan-conformance and metal2vulkan-runtime ran 5877 tests, 5870
passed. Of the 7 failures, the old render descriptor key's test is unpinned; golden_hashes and
engine inventory parts 4, 5, 7 and 8 are bless due (the profiles' fingerprints changed); and
metal::state's encoder_raster_state_needs_its_features fails the same way at development d10a14d5af
itself (m3-max-61802, where runtime-floor gained depthBiasClamp in a529fb658e), as inventory parts
3, 4, 5 and 8 do there. The stack as rebased on 72e1754218 (tip 090d544208: the same product
changes, without the test-only push sweep fix) played 36 distinct streams over 61 runs on five nodes
with 0 refused (player m3-max-61537; plays m3-max-61548, 61549, 61550, 61559 and 61569).
2026-11-20 22:07:18 -08:00
Anees Iqbal 6ef64ae3ee rt: a depth bias's clamp is the device's own
setDepthBias:slopeScale:clamp: bounds the bias by its clamp: "Pass a positive or negative value to
limit the largest magnitude of a positive or negative bias, respectively. You can disable the bias
clamping functionality by passing 0.0" (Apple's page for the method, as fetched). Vulkan's
depthBiasClamp is the same bound (dbclamp: x for 0, min(x, clamp) above 0, max(x, clamp) below).
rt refused every clamp but 0 (DrawKind::DepthBiasClamp), where the deleted runtime passed it.

floor: depthBiasClamp joins REQUIRED. Every dumped venue reports it (vulkaninfo m3-max-48727 to
48731, 48736, 48737 and 61508 for the RX 550: RX 7900 XTX, the three 780Ms, RTX 2080, RTX 3090,
Iris Xe, RTX 5080 Laptop, llvmpipe, the UHD 630's Windows driver, KosmicKrisp on the M3 Max, RX
550), and Vulkan 1.4 and Roadmap 2022 require it.

render encoder: set_depth_bias keeps the clamp beside the bias and slope scale and records it in
vkCmdSetDepthBias, as dynamic state (no pipeline). It returns nothing now, as Metal's call does:
its only error was the clamp. DrawKind::DepthBiasClamp is deleted. The consumer's checkout names
both: rt_platform/render.rs:380 (`e.set_depth_bias(...)?`) and rt_platform/unbuilt.rs:873 (a test's
sample refusal of DepthBiasClamp); each needs a one-line change at its next pin.

AGENTS.md: the Scope sentence on features no guest has used is replaced with the planner's
wording: a feature a program can ask about is answered from the Vulkan query; one Metal gives every
Mac device with no way to ask is built, a typed refusal in the known gaps until it is.

Docs: the README's floor table, its depth bias paragraph and its render encoder known gaps;
docs/REFUSALS.md regenerated (Draw's basis and sites); api_signatures.tsv blessed (the setter's
signature, the variant gone). The conformance ledger drops render-state-depth-bias's refusal row.

Tests: every_device_tests_writes_and_biases_a_depth_attachment's first draw is biased by 2^23
(0.25 or 0.125 in the device's unit at depth 0.25) clamped to 0.0625, and the depth read back is
0.3125 on every device; the later draws' answers are unchanged in kind. The conformance case
render-state-depth-bias (a slope-scaled bias under the clamp -0.0125) now compares against Metal's
recording.
2026-11-20 21:33:03 -08:00
Anees Iqbal 4e3a6a3555 rt: layered rendering in one form, the vertex function storing Layer in every pass
`RenderPassDescriptor::render_target_array_length` is Metal's `renderTargetArrayLength`. A pass
of length N of 2 or more is one rendering of `layerCount` N: every attachment and resolve texture
is a view of its level and N slices from its own `slice` (a 2D array view; a cube's faces are its
slices), and the rendering's load, store and resolve cover every layer, with no per-layer loop.
At 0 and 1 the pass renders the attachment's slice alone, as Metal's does.

A vertex function's `[[render_target_array_index]]` has one form: the variant that writes
`Layer`, in every pass. Each draw pushes the pass's length, max(len, 1)
(`FieldValue::RenderTargetArrayLength` for the translator's `PushField::RenderTargetArrayLength`),
and the function stores 0 for an index at or past it, so at 0 and 1 every index renders the
attachment's slice. The fragment function reads the raw index through the flat varying the
translator carries. The runtime never asks for `VariantKey::dropped_vertex_layer`; a state whose
fact is `RenderTargetArrayLength { layer_dropped: true }` is refused as a draw input. What still
uses `dropped_vertex_layer`: the old binder (`bind/graphics.rs:905`, the variant it asks for at a
shape's length), stage_io's plan (`lower/stage_io/plan.rs:1600` and `:2305`, also the
non-layered amplification), and the validation crate's engine tests
(`candidate/engine/graphics/tests.rs:907`); it stays for cutxlate to delete.

`shaderOutputLayer` joins the floor's required features: every probed device reports it
(vulkaninfo, jobs m3-max-61359 on gem10: the 780M, the RX 550 and lavapipe; 61360 on um790: the
RX 7900 XTX, the RTX 2080, the 780M and lavapipe; 61361 on um870: the 780M, the RTX 3090 and
lavapipe; 61362: KosmicKrisp, Mesa 26.3.1; 61366: the UHD 630's Windows driver, Vulkan
1.3.215). A device without it gets the floor's refusal. The runtime-floor profile and its
generator gain it.

Refused, in the README's layered-rendering gap line: an attachment or resolve texture with fewer
slices from its own than the pass's length (`Refusal::AttachmentPlace`, naming the last slice); a
3D texture's depth planes (`TextureType`, as for every 3D attachment); a length past
`maxFramebufferLayers` (`RenderPassKind::ArrayLength`, new:
VUID-VkRenderingInfo-layerCount-07817); a draw that reads one of a layered pass's attachments
through a texture on a device without the feedback loop (`AttachmentRead`: a shadow holds one
layer); and a vertex function whose index the translator cannot show the same at every vertex of
a primitive, at creation, naming `LayeredRendering` and `geometryShader`: Vulkan requires one
`Layer` per primitive (VUID-VkPipelineShaderStageCreateInfo-stage-02596), the translator's other
form is a geometry stage device creation does not enable, and Metal calls a differing index
undefined. The feedback-loop move's ranges around the rendered layers (`around`) take the
attachment's layer count.

The conformance runtime side passes the length; the case `layered-render-target-array-length`
loses its ledger row. REFUSALS, METAL-COVERAGE and CONFORMANCE-COVERAGE regenerated; the API
table gains the field and the kind.

Test: `tests::layered`, on every device of the cfg's kind: a 2D array's slices 1 to 3 with an
index past the length, a cube's six faces, a pass of length 0 and one of length 1 whose vertex
function writes index 3 (rendering the attachment's slice, the fragment reading 3), every slice
read back; and `rt6_first_vertex`'s per-vertex index refused naming `LayeredRendering`.
2026-11-20 21:11:36 -08:00
Anees Iqbal bb9a63810b rt: a draw fills its functions' bicubic word, as a dispatch does
A render state whose vertex or fragment function samples a 2D texture slot
through a bicubic constexpr sampler was refused at creation
(Gap::RenderPipeline, DrawInput): render::draws had no arm for the
translator's PushField::BicubicTexels, and fill_push wrote nothing for it.
A dispatch fills the same field for a kernel's slot.

Now a draw means by the field what a dispatch does. render::draws places the
field (FieldValue::BicubicTexels of the slot, in the stage's table) and lists
the slot in the content's own Draws::bicubic. The draw's checks
(Facts::find), which run only when the pipeline state or a binding changes,
refuse a bound texture with no bicubic word with the dispatch's typed gap,
Gap::BicubicTexels naming the slot and the format (an 8-bit sRGB format,
whose taps Metal filters decoded, a compressed, YUV, stencil, integer or
extended-range one). fill_push writes the word from the bound texture's format
and swizzle (bicubic_texels_word), or BICUBIC_TEXELS_UNBOUND for a slot that
holds no texture. A bicubic sample at pixel coordinates or of a 1D texture
stays the translator's refusal under the identity domains, as for a kernel.

Nothing new runs on the draw path of any other pipeline. The check loops over
the content's own list, Draws::bicubic, which render::draws fills only from a
BicubicTexels push field: empty for every other content, so its check is a
loop over nothing, once per change, never a per-draw scan. The fill is the
match arm of that field, which no other content has. The device test asserts
the list is empty for a state without a bicubic sampler (colored_fragment).

Both stages are covered. The fragment half uses the fixture bcu_fragment. The
vertex half uses a new owned fixture, bcu_vertex: a vertex function samples at
p[vid] through a clamp-to-edge bicubic sampler at normalized coordinates in
the implicit form, and bcu_vertex_color writes the sample. Its companions come
from scripts/regen-air-fixtures on the M3 (m3-max-61235, Metal 32023.922, SDK
27.2), with its TOOLCHAIN line. It has no corpus case.

Gap::BicubicTexels's docs and text now name a dispatch or a draw and "a
function" in place of "a kernel". docs/REFUSALS.md is regenerated, and the
ledger row of bicubic-texel-classes' sRGB dispatch carries the new text.

RUNTIME_VERSION 2547 -> 2548 (placeholder): a run of an unchanged render
artifact with a bicubic slot now draws where it was refused.

Basis: this is NOT documented Metal. The MSL spec lists only nearest and
linear filters, and 'bicubic' appears nowhere in the spec or the feature-set
tables. It is built because a guest already uses the bicubic constexpr
sampler in kernels, which is why the kernel half exists. Filling the field for
a draw completes that one form and adds none.

Test: tests::bicubic_draw's every_device_draws_a_bicubic_sample_in_each_stage,
for each stage:
- the content lists its one slot, and the field is in the push range;
- each of six formats pushes its bicubic_texels_word, and an empty slot pushes
  the unbound word;
- an RGBA8Unorm_sRGB texture is refused with Gap::BicubicTexels naming slot 0
  and the format;
- an RGBA8Unorm texture whose texels are all one value renders that value at
  every pixel.
2026-11-20 19:33:15 -08:00
Anees Iqbal acc706ca47 Identity domains: a sequentially consistent fence is refused naming the fence
The translator orders a seq_cst fence (atomic_thread_fence of memory_order_seq_cst beyond the
thread, or a seq_cst barrier whose memory scope is the device) through an increment of the
command buffer's ExecutionStatus word. The identity domains reach no such word. Their refusal was
the generic one at the plan's end, which named the push field the fence asked for: "an encoder
value the function reads as ExecutionStatusAddress". require_seq_cst now refuses the fence itself
under the identity domains, as Unsupported{IdentityDomains}, not implemented, naming its Metal
form, "a sequentially consistent fence" (barrier::SEQ_CST_FORM). It stays refused; the default
domains compile it as before.

Docs: the runtime README's known gap of the forms the identity domains do not lower gains the
fence and its test. Validation's executor_contract::seq_cst_fence and
ToolingRequirement::SeqCstFence docs name the new text. docs/REFUSALS.md is regenerated (the
IdentityDomains row gains the barrier.rs site).

Tests: engine_identity's new
a_seq_cst_fence_is_refused_naming_its_form_under_the_identity_domains (a4_device_fence on
lavapipe and moltenvk-m3: under the default domains it compiles and states ExecutionStatus; under
the identity domains it is refused IdentityDomains, NotImplemented, symbol "a sequentially
consistent fence"). Validation's
a_seq_cst_fence_is_refused_through_the_runtime_as_its_requirement_says now looks for the fence's
name in the runtime's error.

SEMANTICS_VERSION 2230 (placeholder; main renumbers): a refusal's text changes.

Consumer check: no public item is added or removed.

Verified: m3-max-61154 (msi) at this commit's tree: fmt, clippy (plain, --cfg m2v_gpu and
--cfg m2v_cpu_icd) and Rustdoc green; nextest of metal2vulkan, -conformance, -validation and
-runtime, 5880 of 5881 passed, the new identity test among them; the one failure is
the_old_render_descriptor_key_keeps_its_value, which moves with SEMANTICS_VERSION and waits for the
next named pin. Only the refusal's text changes, so no play.
2026-11-20 18:57:42 -08:00
Anees Iqbal dc21cd66c7 Colour groups go: no render variant draws a group of a pipeline's color attachments
A device draws to at most the lesser of its maxColorAttachments and maxFragmentOutputAttachments
color attachments at once. A pipeline with more (or one at an index at or past that count) was
compiled as color groups: a variant per group (VariantKey::color_group) whose fragment function
wrote the group's colors at locations 0.., with the group's attachments alone in its graphics
state, and the runtime drew each group in a pass of its own. The runtime's floor requires 8 of both
limits (floor.rs), Metal's count, so no device it runs on takes a group, and it asks for every
render variant with VariantKey::new(); nothing in it reads GraphicsState::color_group. The groups,
their inputs and their note are deleted. Such a pipeline is now refused where it was already
refused without a group: InterfaceComponents at MaxColorAttachments (link) or at
MaxFragmentOutputAttachments (the fragment's outputs).

Removed:
- pipeline/compile/color_group.rs (group, descriptor, entry, refusal) and the compile layer's use
  of it: FragmentPass::color_group, InputsFrom::color_group, grouped_entry, and the grouped
  descriptor in compile_render_pipeline_keys and render_pipeline;
- the inputs and keys: ColorGroup (with of, width_on, colors, groups, location),
  VariantKey::color_group, LoweringInputs::color_group and its key bytes, the pipeline key's
  " color_group N" field (variant_fields);
- link: RenderLinkInputs::color_group, LinkInputs::render_variant's group parameter, and link's
  group check (a fragment stage of another group, and the per-group refusals);
- the state: GraphicsState::color_group and StageIo::color_group;
- the invariance: the stage plan's invariant_fragment_outputs and its Invariant decorations of
  FragDepth, SampleMask and FragStencilRefEXT; the module builder now decorates Position and
  ClipDistance alone, the outputs nothing else made invariant;
- PrecisionNote::ColorAttachmentGroups, its conformance Degradation, its comparison allowance and
  its catalogue entry in docs/API.md;
- validation: the census's color_groups and color_limit, which translated a fragment function of
  more colors than the profile draws as one module a group, and with them PendingL3::groups,
  PendingModule and the L3 stage's later modules: an attempt is one module again.
  ENGINE_CENSUS_VERSION 8;
- the runtime's translator_fields row for color_group.

Tests:
- engine_color_groups goes, and engine_primitive_ids' color_groups_share_the_vertex_function_s_id.
- validation's a_fragment_function_of_more_colors_than_the_floor_translates_in_color_groups becomes
  a_fragment_function_of_more_colors_than_the_device_draws_is_refused: on a four-color profile
  cg_five, cg_seven, cg_sparse and cg_counts keep their limit refusal; on lavapipe each translates.
- the builder's invariance test: FragDepth is refused like PointSize.
- api_tests, api_surface and the variant key's debug text lose their rows.
The color_groups and color_groups_fetch fixtures stay (engine_dead_reads, pass_attachment_pairs
and the fixture tables read them).

docs/API.md's paragraph on groups now states the two limit refusals; docs/VALIDATION.md's census
row loses its sentence. api_signatures is blessed; docs/REFUSALS.md is regenerated.

SEMANTICS_VERSION 2228, ARTIFACT_FORMAT_VERSION 573 (placeholders; main renumbers). SEMANTICS: a
pipeline that took groups is refused, and the note goes. ARTIFACT: the codec loses ColorGroup,
StageIo's and GraphicsState's fields and a PrecisionNote variant. RUNTIME_VERSION stays: the
binder never read a group, and the runtime pin does not move.

Consumer check (consumer-uses.sh, consumer development 0140a12682, 60 refs): 0 hits (code) for
ColorGroup, color_group, width_on, render_variant and color_groups. ColorAttachmentGroups: 0 on
development; used in crates/reims-vgpu-vulkan/src/answer.rs on 37 of the consumer's steelbrain/*
branches, a crate its development no longer has.

Verified: m3-max-61080 (msi) at the tree before the import fix: nextest of metal2vulkan,
-conformance, -validation and -runtime, 5878 of 5879 passed; the one failure is
the_old_render_descriptor_key_keeps_its_value, which moves with SEMANTICS_VERSION (main pins it at
a named pin). Its clippy step found validation's InternalError import unused; m3-max-61112 (um790)
at this commit's tree: fmt, clippy and Rustdoc green. States-only plays on lavapipe of the probe
player built at the change (steelbrain/cutxlate-cgplay, m3-max-61082): m3-max-61087 to 61091, 61
runs over the 36 streams, render 502920 states made and 0 refused, compute 108189 made and 0
refused, the counts of the plays before the change.
2026-11-20 18:21:24 -08:00
Anees Iqbal a8d448f4ce Depth stand-ins go: no variant runs its draw's depth or stencil test in the shader
The runtime asks for every render variant with VariantKey::new() (render.rs) and never states
FragmentTests, so VariantKey::shader_tests, shader_stencil and window_depth_varying are false on
its path. No variant it makes tests a fragment's depth or stencil against a stand-in of the pass's
attachment. That variant, its stand-ins and their consumer contract are deleted. The consumer
names none of them on its development branch (consumer check below).

The binder: for a fragment function that stores before Vulkan's tests (TestedStorageWrites), a
draw whose depth test writes (FragmentTests::Depth { writes: true }) or whose stencil test acts
(Stencil, or Drop for a function without the early-tests variant) ran the in-shader variant. It is
now refused NotImplemented at the tested attachment, of the feature that stores first
(FramebufferFetch, or Imageblocks for an imageblock alone):
- a function with the early-tests variant: at the depth attachment for Depth, at the stencil
  attachment for Stencil;
- a function without it: at the depth attachment, or the stencil one where the pass has no depth,
  as Any already was.
A draw whose tests drop but write and count nothing keeps the early-tests variant, and one whose
tests drop nothing runs the pipeline as compiled, as before.

Removed:
- the inputs and keys: VariantKey and LoweringInputs::{shader_tests, shader_stencil,
  window_depth_varying}, and their key bytes;
- the lowering: lower/fragment/depth_test.rs (DepthTest, StencilTest, depth_test_form,
  stencil_test_form, depth_test_word, stencil_test_word, STAND_IN_FORMAT) and its calls from
  fetch's and the imageblock's tests, and the stencil output stage_io stored nowhere under it;
- the window depth varying: IoRole::WindowDepth, VaryingKey::window_depth, the vertex function's
  store (stage_io's WindowDepth) and the fragment's input, and its link checks;
- the facts and state: RuntimeFact::ShaderTests and ShaderStencilTest, GraphicsState::shader_tests,
  ShaderTestsUse, StandInUse, StandInView, link/shader_tests.rs, and compile::api's stand-in
  requirements;
- the bindings: SyntheticBinding::DepthStandIn and StencilStandIn, WriteSource::DepthStandIn and
  StencilStandIn, PushField::ShaderTestsState and ShaderStencilState, the binder's push words and
  ShaderTestsTemplate, and BindState::{depth_range, depth_clip_mode_clamp, stencil_references},
  which only those words read;
- the copies: DepthStencilCopy::DepthFromStandIn, DepthStandInForm, DepthSplitModule and
  depth_split_module;
- the notes and kinds: PrecisionNote::ComputedSampleDepth (and its conformance Degradation, C3
  deferral and comparison rows, and its catalogue entry in docs/API.md),
  Feature::MultisampledShaderDepthTest (and its reach row), DriverDeviation and VkProperty
  CenterFragCoordDepth and SampleFragCoordDepth, which nothing else reads;
- DrawReplayRule::ShaderTests, and the mechanism rows of the two facts;
- the runtime's translator_fields row for shader_tests.

Tests:
- engine_fragment: the discarding fetch beside depth expects a depth test that writes refused at
  the depth attachment and a stencil test that acts at the stencil attachment. The per-sample
  depth test, the memory-writing fetch's Drop draw, a returned depth
  (a_fetch_that_returns_its_depth_refuses_a_draw_whose_depth_test_writes, which keeps the compiled
  pipeline's checks) and a returned stencil or mask
  (a_returned_stencil_or_sample_mask_refuses_a_draw_whose_tests_act) expect the refusal. The
  stencil test in the shader goes.
- engine_fragment_imageblock: a tested imageblock writer's depth draw is refused
  NotImplemented(Imageblocks) at the depth attachment.
- engine_moved_writers: the writers' wanted tests are the early-tests variant alone; a draw that
  ran the function's own tests is refused.
- depth_stencil_copy, owned_divisions, the mechanism table, api_tests, the binder's templates, the
  variant key's debug text: their stand-in rows go. The binder's stencil words test goes.

api_surface loses its rows; api_signatures is blessed; docs/REFUSALS.md is regenerated.

SEMANTICS_VERSION 2227, ARTIFACT_FORMAT_VERSION 572, RUNTIME_VERSION 2547 (placeholders; main
renumbers). SEMANTICS: the binder's plans of such draws change, and the key bytes go. ARTIFACT: the
codec loses SyntheticBinding, PushField, RuntimeFact, IoRole, VkProperty and PrecisionNote variants,
GraphicsState's field and three structs. RUNTIME: plans and BindState change. The runtime pin
moves.

Consumer check (consumer-uses.sh, consumer development 0140a12682, 61 refs): 0 hits (code) for
ShaderTestsUse, StandInUse, StandInView, shader_tests, shader_stencil, window_depth_varying,
DepthStandInForm, DepthSplitModule, depth_split_module, DepthFromStandIn,
MultisampledShaderDepthTest, CenterFragCoordDepth, SampleFragCoordDepth, ShaderTestsState,
ShaderStencilState, DepthStandIn, StencilStandIn, WindowDepth, window_depth, stencil_references,
depth_clip_mode_clamp, ShaderStencilTest, DepthTest and ShaderTests; depth_range in link-order
lists only. ComputedSampleDepth: 0 on development; used in crates/reims-vgpu-vulkan/src/answer.rs
on 38 of the consumer's steelbrain/* branches, a crate its development no longer has.

Verified: m3-max-61056 (msi) at this commit's tree: fmt, clippy, Rustdoc, and nextest of
metal2vulkan, -conformance, -validation and -runtime, 5885 of 5886 passed; the one failure is
the_old_render_descriptor_key_keeps_its_value, which moves with SEMANTICS_VERSION (main pins it).
States-only plays on lavapipe of the probe player built at the change on 999b82bfe2
(steelbrain/cutxlate-siplay, m3-max-61016): m3-max-61022 to 61026, 61 runs over the 36 streams,
render 502920 states made and 0 refused, compute 108189 made and 0 refused, the counts of the play
before the change: no state a stream makes meets the new refusal.
2026-11-20 18:07:17 -08:00
Anees Iqbal 81ced9a1cb Extended-range fetch and blend refused: what needs Metal's tile half is NotImplemented(Format)
Metal's tile memory holds an attachment of Apple's extended-range formats (BGR10_XR, BGRA10_XR,
RGB10A8_2P_XR10 and their _sRGB twins) as half through a render pass and rounds it to the codes
only at the store. A fetch of such an attachment, or a blend onto it after an earlier draw of the
pass wrote it, sees that draw's half. The attachment holds the codes. With the half shadow gone
(the commit before), such a read or blend would take the stored codes, which is wrong but valid
output. Both are now a typed refusal, NotImplemented(Format) at Attachment::Color(n), on every
device and in either fetch form. This is the same boundary as the runtime's own refusal of every
extended-range texture: Gap::TextureFormat (crates/metal2vulkan-runtime/src/error.rs:1011),
raised in texture.rs's form() (texture.rs:2416, `if !viewed(mapping.emulation)`), so rt never
makes such an attachment.

Where (lower::fragment::fetch::codes_round_the_tile names the forms: an extended-range form that
is neither padded nor bfloat):
- A fetch: color::select_param, beside the bfloat fetch's refusal. It runs for the storage form
  and the input attachment alike. An integer read stays Metal's pipeline error
  (InvalidDescriptor(ColorAttachment)).
- A blend into one the function writes, under any write mask:
  - fetch::blended_extended_range, which both ordered devices' plans call (the interlocked storage
    form, and input_blend over rasterization-order input attachments);
  - stage_io::extended_color::plan, on a device that orders fetch in neither form. It is checked
    before the orderings' refusal, since no device would make the blend.
- The public door metal::format::extended_range_blend answers NotImplemented(Format) for those
  forms on every device.

Unchanged: an unblended write and a masked merge (a kept code is the encode of the half the tile
keeps there). Padded forms (R10Unorm_X6, RG10Unorm_X12, their _sRGB twins, RGB10A2Unorm_sRGB):
their fetches and blends are built as before. Bfloat: its fetch is refused as before, and its
blend is Metal's error.

Dead with it: the source-range clamp only those blends took. Every caller of
extended_range::blend::native now passes a padded form's None. Removed: blend::extended_ranges,
clamped_lanes and native's ranges parameter, extended_range::source_range, and blend_color.rs
(SOURCE_RANGE, SRGB_SOURCE_RANGE). The validation build script's runtime inputs list
blend_color.rs no more, and the runtime pin moves. In the CPU-model tests: the XR forms' blend
cases and EVERY_FORM; the padded blends keep their model.

Docs: fetch's module docs (the extended-range paragraph, plus one on Apple's forms in place of the
"across draws" one), color's and stage_io::extended_color's, input_blend's, ExtendedRangeColor's,
PrecisionNote::ExtendedRangeBlendSource and ExtendedRangeFloatBlendSource (now padded only), the
door's, and docs/API.md (section 4's framebuffer fetch, and the two notes' catalogue entries).
docs/REFUSALS.md regenerated, api_signatures blessed.

Conformance (crates/metal2vulkan-conformance/known-gaps-rt.tsv), by expectation: the next round's
conformance replay on every card confirms them. 260 rows change their answer from "unsupported:
FramebufferFetch; needs AnyOf([[Feature(FragmentShaderPixelInterlock)],
[Feature(RasterizationOrderColorAttachmentAccess)]])" to "unsupported: Format; needs
NotImplemented", at the same metadata and color attachment. Their explanation now names the
refusal:
- xr-blend-* (108);
- xr-gamut-* (108);
- xr-gradient-*-blended (24);
- xr-masked-*-over (20).
The unblended masked rows (xr-masked-bgr10xr-red, -blue-green and their sRGB twins) keep the
orderings' refusal. The runtime's floor orders fetch in neither form, so its stage_io refusal is
what these rows record. docs/CONFORMANCE-COVERAGE.md is regenerated.

Tests:
- fetch::tests: the door's case splits Apple's forms (NotImplemented) from the padded blended
  ones; on runtime-floor, R10Unorm_X6 keeps the orderings' refusal and BGRA10_XR is
  NotImplemented; the moltenvk-m3 FragmentStoresAndAtomics case takes R10Unorm_X6.
- engine_extended_range::blended_pipelines: a `refused` helper (Format, NotImplemented,
  Color(0)); the wide-gamut client pipelines are refused on every venue and runtime-floor; the
  unwritten and masked test expects the refusal for every written blended shape.
- engine_extended_range::targets: a blended attachment, and lavapipe's fetch, expect the refusal.
- engine_fragment: a_fetched_extended_range_attachment_is_refused (every Apple form on every
  committed profile, exf_fetch_three, and the whole pipeline on moltenvk-m3) replaces the made
  fetch; the fast source-alpha-over sRGB XR blend and the input-attachment XR blend go, as they
  covered refused forms only; the premultiplied blend test and the blend note's test move to
  padded forms (RG10Unorm_X12 and its sRGB twin). con_fetch_coverage, the second-source blend and
  tsw_fetch_discard keep their storage-form and coverage mechanics on RGB10A2Unorm_sRGB, the
  four-channel padded form, where the guests' pipelines had RGB10A8_2P_XR10; their docs say so.
- lower::arith::extended_range::tests: the padded forms' blend model alone.

SEMANTICS_VERSION 2225 (after guestgaps' 2224, on development 81bd82fdaa): the refused inputs'
cached artifacts must not be served. Every made pipeline lowers to the same words: native's clamp
ran for XR forms alone. The old render key test is re-pinned by the commit after this one, from
the check job's printed key. ARTIFACT (569, the shadows' deletion) and RUNTIME stay; the runtime
pin moves with the sources.

Consumer check (consumer-uses.sh, consumer development b955213d27, 64 refs): extended_ranges,
SOURCE_RANGE, SRGB_SOURCE_RANGE, blend_color, clamped_lanes and codes_round_the_tile have 0 hits.
source_range's hits are the consumer's own field (CopyIndirectCommandBuffer::source_range,
unrelated); ours was a private fn.

Verified, at the earlier base 453eec0373 with this change: check 60853 (4406 tests, 10 failed:
the render key, the tests above and the coverage doc, all changed here since; 60899 then showed a
closure type in the new engine_fragment test, fixed here). A states-only play of that tree over
the recordings (60871, 60872, 60873, 60893, 60900) refused 0 render and 0 compute states. The
check and the play at this tree are named in the next commit and the report.
2026-11-20 17:26:22 -08:00
Anees Iqbal a950689934 Extended shadows go: no variant reads and writes an extended-range attachment's half shadow
Metal's tile memory holds an extended-range color attachment (BGR10_XR, BGRA10_XR,
RGB10A8_2P_XR10 and their sRGB twins) as half through a render pass and rounds it to the codes
only at the store. The binder offered a variant for a draw whose render pass instance held a
half shadow of such an attachment (BindState/BindShape::extended_shadows,
VariantKey::extended_shadows, LoweringInputs::extended_shadows). Its fragment function read and
wrote an Rgba16f storage image beside the codes (ResourceKind::ExtendedShadow), either in the
interlocked storage form or, on a device that fetches through rasterization-order input
attachments, beside the input attachment (lower::fragment's input_shadow). metal2vulkan-runtime
never asks for the variant and makes no extended-range texture (Gap::TextureFormat), so nothing
reached it.

Now no such variant exists. A function compiled with no shadow (every function, as before for
every rt draw) is unchanged: a blend or fetch onto an earlier draw's write reads the codes that
draw stored (extended_range::tile_value). Those differ from Metal's half where it is not a code's
value, and fetch's module docs say so.

Removed:
- lowering: lower/fragment/input_shadow.rs (InputShadow and its plan, read, store and words),
  FragmentPlan::input_shadows, Declared::extended_shadows, the storage form's shadow
  (StorageColor::shadowed, declare_shadow, shadow_and_texel, shadow_read, the shadowed branches of
  texel, value, the write and its blended and merged forms, and their word estimates), and the
  input-attachment blend's, color read's and stage_io write's shadow branches. The loop over
  covered samples no longer has a shadow refusal. The blend's doc, which sat above
  merged_extended, now sits on blended.
- pipeline: LoweringInputs::extended_shadows and its key bytes, VariantKey::extended_shadows,
  ResourceKind::ExtendedShadow, BindingSource::ExtendedShadow and its link arm, the fetch inputs'
  shadowed reads and writes and their tests and coverage (the input-attachment form passes no
  depth, stencil or coverage state, as before for an unshadowed draw), and the requirements
  trace's ExtendedShadow arm. MovableStorageWrites' doc loses the shadow.
- binder: BindState::extended_shadows, BindShape::extended_shadows, WriteSource::ExtendedShadow,
  and the graphics binder's choice of the shadowed variant (its refusals of a mesh, layered,
  amplified or multisampled plain writer's shadow included).
- tests: engine_fragment's four shadow tests and their helpers (image_accesses,
  shadow_image_types, execution_modes, interlocked); engine_moved_writers' shadow move (its Move
  enum goes, and the writers are checked with the interlocked move alone); the shape round-trip,
  the variant round-trip fixtures, the compile-key test's shadow arm, and the requirements test's
  ExtendedShadow kind.

No SEMANTICS_VERSION bump: an input without shadows (every input a consumer can now state)
lowers to the same words. Removing the shadowed branches leaves the instruction order of the
unshadowed paths as it was, and the key appended shadow bytes only when the set was non-empty.
ARTIFACT_FORMAT_VERSION 569 (after guestgaps' 568 on 81bd82fdaa): the codec loses
ResourceKind::ExtendedShadow and BindingSource::ExtendedShadow. RUNTIME_VERSION stays: no run of
an unchanged artifact and plan does anything else, since no consumer set the field, so this
commit updates the runtime pin alone. api_signatures is regenerated, and so is docs/REFUSALS.md
(FramebufferFetch: 18 sites to 15).

Consumer check (consumer-uses.sh, consumer development b955213d27, 64 refs; on development 81bd82fdaa): extended_shadows,
ExtendedShadow, InputShadow, input_shadow: 0 hits (code).

Verified: nothing yet; the two fix-forward commits after this one make it build (60740, 60749),
and the check job of the series is named with the refusal commit.
2026-11-20 17:26:22 -08:00
Anees Iqbal b90e0565da The floor: from_queries refuses a push window below 256 bytes, the runtime's floor requires 8 fragment outputs, and runtime-floor replaces the profiles below it
What: Device::from_queries refuses a description whose maxPushConstantsSize is below the 256
bytes every stage's push window is lowered for, with a typed Unsupported{PushWindow} naming the
MaxPushConstantsSize limit (crates/metal2vulkan/src/device/derive.rs, the floor checks of
from_queries). The runtime's floor (metal2vulkan-runtime's floor list) requires
maxFragmentOutputAttachments >= 8. All 15 committed device profiles report 8, and so does every
matrix card.

The committed profile set keeps only devices at or above the floor:
- roadmap-2022 and lunarg-desktop-baseline-2023 are deleted;
- vk12-floor and swiftshader move to profiles/below-floor/, inputs of the from_queries refusal
  test only;
- runtime-floor, derived from the runtime's floor by scripts/regen-device-profiles and held
  equal to it by a test, is the floor every test compiles on.

A test of a below-floor form now runs on runtime-floor without the feature that form stands in
for, labelled "below the runtime's floor" (pipeline::testing::profile_without, PROFILE_F,
device_f, FORMATLESS_FLOOR). The validation tests name runtime-floor, or derive the device they
need from it (no tessellation, no formatless writes, robustImageAccess alone, no device
addresses).

Why: the runtime refuses every device below its floor, so translating for those profiles tested
forms no device the runtime opens can ask for. A push window below 256 bytes cannot hold what
the lowering puts there.

Consumer check: no public item of a published crate is deleted. The one removed constant,
FORMATLESS_FLOOR's old value, is in the crate-private pipeline::testing.

Not in this change, re-blessed on development: the golden hashes table
(tests::golden_hashes) and the public fixture expectations (tests::public_fixtures_engine). The
runtime-sources pin (candidate::engine::artifact) follows from the test run at this tree.

Verified: cargo fmt. The suites, clippy and the CPU-ICD run are potluck jobs on this tree, named
when the branch is handed over.
2026-11-20 16:35:52 -08:00
Anees Iqbal 75c9d080a3 YCbCr writes go: a function's writes to a 4:4:4 two-plane YCbCr texture are refused
Metal stores a function's writes to an unpacked 4:4:4 two-plane YCbCr texture into both its
planes. The translator held such a slot through an R32G32B32A32_UINT write shadow
(StorageImageClass::YCbCrWrite), and a heap's float storage class held such a member through an
R32G32B32A32_SFLOAT view of its shadow, flagged in its handle-table entry (FLAG_YCBCR_WRITES).
The consumer then encoded the shadow into the planes with bind::ycbcr_write_module. The same
module's second mode stored a render pass's YCbCr attachment (FormatEmulation::YCbCrRendered) into
the planes. metal2vulkan-runtime refuses every YCbCr texture (Gap::TextureFormat), so neither mode
ever ran, but every heap write of a float or half texel through a 2D handle carried the flag's
test and select under its own specialization constant.

Now a slot that writes such a texture keeps the format's refusal (storage_choice,
NotImplemented(Format)), as the other 4:4:4 formats' writes did, and a heap member of one has no
storage choice, so the heap refuses it (ArgumentBufferTextures, NotImplemented). A heap write no
longer tests the flag, and its handle-table search no longer carries it. FormatEmulation::
YCbCrRendered stays as the pipeline's form: a pipeline into such an attachment is made as before,
so no new pipeline-state refusal appears. Its doc now says the pass's store into the planes is not
implemented and that the runtime refuses such textures.

Removed:
- lowering: StorageImageClass::YCbCrWrite (slot.rs's write-only check, emit's ycbcr_write_texel
  and YCBCR_WRITE_WORDS), the heap mark (heap_ycbcr_mark, HEAP_YCBCR_WRITE_WORDS,
  Write::heap_ycbcr, lower::texture::heap_ycbcr_writes), AccessPlan::heap_ycbcr_writes, and the
  YCbCr element mask in heap_element_index.
- memory::handles: FLAG_YCBCR_WRITES, HANDLE_YCBCR_WRITES, Lookup's ycbcr field in Flagged and
  Indexed, carries_ycbcr, ycbcr_writes_spec, ycbcr_flag_mask, ycbcr_element_mask,
  ycbcr_writes_set, k32_const, and Table's stage (only the YCbCr carry read it). carry takes the
  form alone. The search tests lose the YCbCr forms and
  a_search_carries_the_ycbcr_flag_only_under_its_constant. The test tables keep an unused bit 15.
- pipeline: SpecKey::HeapYCbCrWrites; HeapStorageReads' doc loses the write shadow.
- binder: plan/resources' write-shadow choice, bind::heap's shadow view, its entry flag and the
  reads_unmeasured case, plan::slots::heap_ycbcr_writes and its two specialization arms (compute
  and graphics). bind::ycbcr_write goes whole: ycbcr_write_module, YCbCrWriteModule, and the CPU
  models ycbcr_write and ycbcr_store, along with their tests. bind::ycbcr_convert loses
  words_buffer and scalar, which only the write module used.
- metal::format: ycbcr_writes_stored. The YCbCr, YCbCrRendered, writes_dropped, ycbcr_renders
  and held_storage_choice docs say what holds now.
- tests: engine_heap_ycbcr_writes, engine_extended_range's
  ycbcr_write_slots_store_each_texel_s_bits_and_mark, and engine_handles' word allowance for the
  mark (100 words). owned_divisions loses the write module; api_surface loses five rows.

SEMANTICS_VERSION 2223 is in this commit (placeholder; main renumbers): every heap write of a
float or half texel through a 2D handle loses the mark's code, and the plans of such slots
change (a refusal). ARTIFACT_FORMAT_VERSION 566: SpecKey loses HeapYCbCrWrites in the codec.
RUNTIME_VERSION 2545: bind::heap's handle-table entry flags lose bit 15. The runtime pin is
updated. api_signatures is regenerated, and so is docs/REFUSALS.md (one site fewer for
ArgumentBufferTextures and one for Format).

Consumer check (consumer-uses.sh, consumer development 12b87d3d6b, 64 refs): YCbCrWriteModule,
ycbcr_store, ycbcr_write, ycbcr_write_module, HeapYCbCrWrites, YCbCrWrite, FLAG_YCBCR_WRITES,
WRITTEN_BINDING: 0 hits (code). ycbcr_writes_stored: 0 hits on development. It is used on 39
consumer lane branches (steelbrain/quiesce and others, the newest 17 hours old), in
crates/reims-vgpu-vulkan/src/gpu/ycbcr/sampling.rs:2527, a test of the old runtime's YCbCr write
path. That directory is not on the consumer's development.

Verified: nothing yet (a check job is owed).
2026-11-20 16:11:26 -08:00
Anees Iqbal f7279104ae Emulated meshes go: a device without VK_EXT_mesh_shader refuses mesh and object functions
The planner's ruling: a mesh render pipeline is native or refused. With VK_EXT_mesh_shader and
meshShader (taskShader for an object function), the stages are task and mesh shaders, as before.
The emulation was a second form for devices without them: the object and mesh functions ran as
compute entries, which wrote each threadgroup's vertices and primitives as records into a
per-draw buffer or the command buffer's records pool, and a synthesized vertex stage drew those
records. The runtime never takes that path. Now a mesh or object function on such a device is
refused at lowering (Unsupported{MeshShading}, needing VK_EXT_mesh_shader and the stage's feature
where the profile lacks them), and so is its pipeline. The command line compiles no mesh pipeline
and answers FALLBACK for a mesh or object function on every device, as before.

Removed:
- lowering: lower/mesh/work.rs (the work buffer layout), lower::mesh::emulates, the emulated
  compute entries and their wrappers, the record stores, Layout/layout/records/emulated_payload,
  the RECORDS/WORK/OBJECT_* slots; MeshPlan's emulated and payload_words. Also dispatch.rs's
  WrapperGroups and the wrapper_groups field, emit's GLCompute arm for meshes,
  stage_io::flat_primitive_inputs, and the requirement trace's record writes. The payload is
  always TaskPayloadWorkgroupEXT (memory::arena::declare_payload). lower::mesh::mesh_stages states
  the native test that folds_object_grids reads. The mesh builtins are a const.
- pipeline: MeshRecords, RecordField, RecordValue; GraphicsState::mesh_records and mesh_corners;
  StageInterface's mesh_records, mesh_corners and emulated_payload (vk_stage loses its COMPUTE
  arm); the synthesized vertex stage (link::mesh keeps the payload check) and link's record
  slots and push-range hull; SyntheticBinding::MeshRecords and MeshWork;
  RuntimeFact::MeshLastFirst; VariantKey::mesh_last_first. Varyings hold mesh outputs to
  maxMeshOutputComponents only. The link contract's compute-entry records check goes, and
  compile/api's mesh_info reads the task and mesh limits only.
- binder: bind/mesh_scan (mesh_scan_module, mesh_object_arguments_module, MeshScanModule; its
  div_ceil and for_range move to mesh_arguments, their one other reader), MeshDispatch,
  MeshGroups, MeshRecordsRegion, DrawCommands::mesh_dispatch, MeshTemplate::records and
  RecordsTemplate, GroupStage::Compute (GroupLimits.total is a plain u32), the emulated mesh
  stage flags, BindState and BindShape's mesh_last_first, WriteSource::MeshRecords and MeshWork,
  and DrawReplayRule::DispatchesFirst. Status: StatusBits::MESH_RECORDS_OVERFLOW,
  StatusReport::mesh_records_overflow, MeshRecordsFault, and the words MeshRecordsCursor and
  MeshFault{Draw,Objects,Groups}. The buffer keeps its 32 bytes, with SeqCstFences at word 7:
  words 3 to 6 are not written, and bit 5 is unreported.
- runtime: the synthesized-stage test no longer reads mesh_records; the SynthesizedStages doc
  loses "mesh records".
- tests: engine_mesh's emulated tests (the compute entries, the records pipeline and its object
  draws, the last-first variant) are replaced by two refusal tests, one per function and one per
  pipeline. The tests that also ran the emulating profiles run the profiles with the extension.
  engine_mesh_barriers loses its interpreter run of the emulated object entries; the
  round-trip, link and module-sweep fixtures and api_surface lose the rows.
- validation: build.rs's runtime inputs lose lower/mesh/work.rs; a companion test's comment.
  The 15 authored mesh and object cases stay untouched. The authored compile census is
  re-blessed on development.

Docs: API.md's mesh section states the refusal and loses the emulation's paragraphs, and two
lists lose "an emulated object or mesh function". Varyings docs lose a stale emulated
post-tessellation mention. docs/REFUSALS.md and api_signatures are regenerated. README and the
command's help name no mesh pipeline and need no change.

SEMANTICS_VERSION 2221 is in this commit (placeholder; main renumbers): what the translator emits
for a mesh or object function on a device without the extension changes (a refusal), and the
mesh draws' plans change. ARTIFACT_FORMAT_VERSION 565: the codec loses MeshRecords,
RecordField, RecordValue, StageInterface's three fields, GraphicsState's two, two
SyntheticBinding variants and RuntimeFact::MeshLastFirst. RUNTIME_VERSION stays at this series'
2543. The runtime pin is updated.

Consumer check (consumer-uses.sh, consumer development 12b87d3d6b, 70 refs):
MeshDispatch: 0 hits (code); link-order lists only.
MeshGroups, MeshRecordsRegion, mesh_scan_module, mesh_object_arguments_module, MeshScanModule,
MeshRecordsFault, mesh_dispatch, MESH_RECORDS_OVERFLOW, MeshRecordsCursor, MeshFaultDraw,
MeshFaultObjects, MeshFaultGroups, DispatchesFirst, mesh_last_first, MeshRecords, RecordValue,
mesh_records, mesh_corners, emulated_payload, MeshWork, MeshLastFirst, POOL_WORDS, DRAW_OFFSET,
DISPATCH_OFFSET: 0 hits (code).
mesh_records_overflow: 0 hits on development. It is used on consumer lane branches
(steelbrain/quiesce and others), but only as the name of a local function in
reims-vgpu-vulkan/src/gpu/command.rs, which answers the old runtime's
CommandBufferError::MeshRecordsOverflow. It does not read this field.

Verified: nothing yet (a check job is owed).
2026-11-20 15:28:31 -08:00
Anees Iqbal b14c6a7101 Emulated tessellation goes: a device without tessellationShader refuses the function
The runtime's floor requires tessellationShader, so on every device the runtime opens a
post-tessellation vertex function runs through the device's tessellation stages. The emulation
was a second form: it ran the function as a plain vertex stage that drew Metal's tessellator's
triangles itself, from the draw's records, which a compute scan wrote before each patch draw. Now a
device without tessellationShader refuses the function (Unsupported{Tessellation}, needing
VkFeature::TessellationShader), and the command line answers FALLBACK there.

Removed:
- lowering: lower/tessellation/{emulated,tessellator,work}.rs, wrap_entry, Emulation, emulates;
  EvalPlan's base_instance and emulated; Declared's emulated globals; the emulated
  [[base_instance]] source; PushField::TessellationChunk; stage_io::primitive_id_varying.
- pipeline: EmulatedTessellation, GraphicsState::emulated_tessellation, TessellationStage::emulated,
  LoweringInputs::tessellation (and InputsFrom::Vertex's tessellation field and its key bytes),
  link's emulated_state, RuntimeInput::TessellationDescriptor, SyntheticBinding::TessellationWork
  and TessellationRecords; primitive_id_carried_on is primitive_id_varying_on again.
- binder: bind/tessellation_scan (tessellation_scan_module, TessellationScanKernel,
  TessellationScanModule), TessellationDispatch, TessellationRecords,
  DrawCommands::tessellation_dispatch, WriteSource::TessellationWork and TessellationRecords,
  StatusBits::TESSELLATION_RECORDS_OVERFLOW and RECORDS_FAULTS, StatusReport's
  tessellation_records_overflow and TessellationRecordsFault. FactorTemplate keeps only the
  control stage: FactorSite goes, and its fields are push_offset and factor_binding, with the
  patch index binding always present. The mesh scan's first-fault test reads its own bit. Bit 8
  of the status word is unreported.
- tests: tests/tessellator (the emulated tessellator against its model), the emulated tests in
  engine_tessellation (now asserting the refusal on profiles without the feature), the emulated
  fixtures in api_tests and graphics tests, owned_divisions' scan sweep, and api_surface rows.
  The key test keeps its native half: a vertex function's key is the same for every
  tessellation state.
- validation: build.rs's runtime inputs lose tessellator.rs and work.rs (factors.rs stays: the
  binder sizes factor ranges by factor_bytes). The acceptance and coverage tests expect the typed
  refusal on roadmap-2022, vk12-floor and swiftshader.

Docs: README and the command's help say a post-tessellation function needs tessellationShader;
API.md's tessellation section states the refusal; the two tessellation precision notes no longer
mention the emulation; docs/REFUSALS.md and api_signatures regenerated (Tessellation now names
VkFeature::TessellationShader instead of MaxStorageBufferRange).

SEMANTICS_VERSION 2220 is in this commit (placeholder; main renumbers): what the translator emits
for a post-tessellation function on a device without tessellationShader changes (a refusal), and
the vertex key loses the tessellation state. ARTIFACT_FORMAT_VERSION 564: the codec loses
EmulatedTessellation, TessellationStage::emulated and three enum variants. RUNTIME_VERSION stays
at this series' 2543. The runtime pin is updated.

Consumer check (consumer-uses.sh):
consumer: development 7ea4edc2fb; 72 refs (development + steelbrain/* younger than a day)
TessellationDispatch: 0 hits (code); link-order lists only
TessellationRecords, TessellationRecordsFault, tessellation_scan_module, TessellationScanKernel,
TessellationScanModule, TESSELLATION_RECORDS_OVERFLOW, RECORDS_FAULTS, tessellation_dispatch,
TessellationWork, EmulatedTessellation, emulated_tessellation, TessellationChunk,
RuntimeInput::TessellationDescriptor, scan_kernel, max_patch_triangles, wrap_entry, FactorSite:
0 hits (code)
tessellation_records_overflow: 0 hits on development. It is USED on consumer lane branches
(steelbrain/quiesce and others), but only as the name of a local function in
reims-vgpu-vulkan/src/gpu/command.rs, which answers the old runtime's
CommandBufferError::TessellationRecordsOverflow. It does not read this field, and this tree's
runtime has no such error.

Verified: nothing yet (a compile job is owed).
2026-11-20 15:26:56 -08:00
Anees Iqbal 158d918e91 Flat dispatch goes: a flat or folded variant's indirect dispatch outside a device replay
flat_dispatch_module read an indirect Metal dispatch's arguments on the device and wrote the
record and VkDispatchIndirectCommand a flat (or folded) variant then ran at, for a dispatch
outside the device replay. The runtime never takes a binding plan, and no consumer records the
module. The plan now builds a flat variant's direct Threads dispatch alone (its record is
DispatchCommands::region_record, as before); its indirect dispatch, and any dispatch of a folded
variant, whose records only the device replay's preprocess writes, is
Unsupported{GpuEncodedIndirectCommands, NotImplemented}, already the answer for the variant's
other forms. The device replay keeps its flat and folded variants and flat_dispatch, the
derivation its preprocess shares.

Removed: bind/replay/flat.rs (flat_dispatch_module, FlatDispatchModule, FlatIndirect,
FlatArguments), its tests, and the folded variant's read_records in instantiate_dispatch_into;
the dispatch test now asserts the flat variant's indirect dispatch is refused; the replay
modules' overflow test reads the preprocess alone (its want of 26 already counted the shared
derivation's 23). Records' docs say what they hold now (the Binder doc lost its clamp too).

RUNTIME_VERSION stays at this series' 2543 (the plan's answers change); runtime-sources
re-pinned, api_signatures and REFUSALS.md regenerated.

Consumer check (consumer-uses.sh):
consumer: development 7ea4edc2fb; 68 refs (development + steelbrain/* younger than a day)
flat_dispatch_module: 0 hits (code)
FlatIndirect: 0 hits (code)
FlatArguments: 0 hits (code)
FlatDispatchModule: 0 hits (code)

Verified: nothing yet (compile check owed).
2026-11-20 15:15:26 -08:00
Anees Iqbal 53e1535ee3 Indirect clamp goes: an indirect dispatch reads Metal's group counts from its buffer
The runtime reads an indirect dispatch's group counts where Metal wrote them (its README:
a count above maxComputeWorkGroupCount is the GPU's to read, which Vulkan leaves undefined),
and its path never takes a binding plan's clamp prepass. The plan now does the same: an
indirect region reads IndirectArgs::Buffer on every device, its use is the 12 argument bytes
vkCmdDispatchIndirect reads in DRAW_INDIRECT, and IndirectGroupCount's mechanism is None.

Removed: bind/indirect_clamp.rs and its tests (IndirectClamp, IndirectClampModule,
indirect_clamp_module), DispatchCommands::indirect_clamp, IndirectArgs::ClampScratch, the
template's storage_alignment, Mechanism::IndirectClamp, StatusBits::OVERFLOW (bit 0 stays
unused) and StatusReport::overflow. The validation executors lose their clamp checks
(compute.rs, replay.rs, device_replay.rs), which valexec confirmed only refused the clamp, and
the engine's overflow verdict. The engine_binder harness runs an indirect dispatch from its
buffer at counts within the test device's limit.

ARTIFACT_FORMAT_VERSION 563 (Mechanism's codec list loses a variant), RUNTIME_VERSION 2543
(the dispatch plan's indirect region and uses change), runtime-sources re-pinned,
api_signatures and REFUSALS.md regenerated.

Consumer check (consumer-uses.sh):
consumer: development e6414dd601; 70 refs (development + steelbrain/* younger than a day)
IndirectClamp: 0 hits (code)
IndirectClampModule: 0 hits (code)
indirect_clamp_module: 0 hits (code)
ClampScratch: 0 hits (code)
indirect_clamp: 0 hits (code)
OVERFLOW: 0 hits (code)
StatusReport: 0 hits (code)
StatusBits: 0 hits (code)

SEMANTICS_VERSION 2219 is in this commit too: the artifact records IndirectGroupCount's mechanism,
which moves from IndirectClamp to None (the planner's rule: an emitting commit carries its own
bump); main renumbers it at the landing.

Verified: nothing yet (compile check owed).
2026-11-20 15:15:25 -08:00
Anees Iqbal 193a9a6e95 Builders, batch 3: the resolve draws, the visibility combine and the texture shadow's modules go
color_resolve.rs (color_resolve_modules and its format, channel, rule and source types),
depth_stencil_resolve.rs (depth_stencil_resolve_modules, DepthPick, ResolveWrite and the draw
types), visibility_combine.rs (visibility_combine_module, VisibilityCombine, ContinuedResult) and
the texture shadow's four files (shadow_merge_module, shadow_merge_image_module,
shadow_merge_kept_image_module, shadow_copy_back_module, shadow_copy_in_module and their
types): no non-test code outside them names any of their items (the runtime, the harness,
validation and conformance included; test items stripped one by one, wherever they lie), and no
plan, variant key or lowering input asks a consumer to run them. They go with their tests,
re-exports, api_surface rows and owned_divisions builds.

Metal's sRGB resolve tables (SRGB_RESOLVE_LINEAR, SRGB_RESOLVE_THRESHOLDS) move into the tile
test, their one reader, as private constants with their measured docs. depth_stencil_copy's
binding map loses the resolve draws' arm. bind's module map, metal/format/word.rs and the
msaa_word_formats probe's note no longer name the resolve. The runtime-sources table drops
lower/arith/extended_range.rs, which only the color resolve reached, and its SPIR-V builder row no
longer names the visibility resolve.

No run or translation changes (nothing called them): the versions stay; api_signatures,
REFUSALS.md and the runtime pin are regenerated.

Consumer check: ~/.cache/m2v-orch/consumer-uses.sh, consumer: development b7929d6936; 73 refs
(development + steelbrain/* younger than a day), 0 hits for color_resolve_modules
ColorResolveFormat ColorResolveModules ResolveChannel ResolveRule ResolveSource
SRGB_RESOLVE_LINEAR SRGB_RESOLVE_THRESHOLDS depth_stencil_resolve_modules DepthPick
DepthStencilResolveDraw DepthStencilResolveModules ResolveWrite visibility_combine_module
ContinuedResult VisibilityCombine VisibilityCombineModule shadow_copy_back_module
ShadowCopyBackModule ShadowTexelView shadow_copy_in_module ShadowCopyInModule
shadow_merge_module ShadowMergeModule ShadowMergeStores shadow_merge_image_module
shadow_merge_kept_image_module ShadowMergeImageModule ShadowMergeRead (ColorResolveFormat,
ResolveSource and DepthPick appear in link-order lists only).
2026-11-20 15:15:25 -08:00
Anees Iqbal 46cd581525 Builders, batch 1: thirteen bind files no code names go with their tests
dynamic_views, extended_canonical, extended_shadow, icb_reset, pages_copy, plane_bytes_copy,
plane_copy, plane_words, rotate_texels, rows_copy, tiled_texels, ycbcr_refresh and ycbcr_sample:
no non-test code outside each file names any of its public items (the runtime, the harness,
validation and conformance included), so each file goes whole, with its tests, its re-exports,
its api_surface rows and its owned_divisions builds. The docs that named them say what is true
now: bind's module map, the depth clamp's tiled-texel note, the written-flag docs (a consumer may
reset only the flagged records), the input shadow's runtime file, conformance's two-plane note.
The runtime-sources row of lower/arith/extended_range.rs names the color resolve, which still
reaches it, in place of the deleted half-shadow load.

No behaviour of a run or a translation changes (nothing called them), so neither
RUNTIME_VERSION nor SEMANTICS_VERSION moves; api_signatures, REFUSALS.md and the runtime pin are
regenerated.

Consumer check: ~/.cache/m2v-orch/consumer-uses.sh, consumer: development 62b3227c74; 67 refs
(development + steelbrain/* younger than a day), 0 hits for DynamicViewsModule
dynamic_views_module ExtendedShadowModule extended_shadow_module IcbResetModule icb_reset_module
PagesCopyModule PagesCopy pages_copy_module PlaneWordsModule plane_words_module
RotateTexelsModule rotate_texels_module RowsCopyModule rows_copy_module TiledTexelsModule
TiledLevelMove tiled_texels_module YCbCrRefreshModule ycbcr_refresh_module YCbCrSampleModule
ycbcr_sample_module; consumer: development 62b3227c74; 68 refs, 0 hits for
ExtendedCanonicalModule extended_canonical_module extended_range_canonical PlaneBytesCopyModule
plane_bytes_copy_module PlaneBytes PlaneSource PlaneCopyModule plane_copy_module. PlaneRows:
its hits are the consumer's own `struct PlaneRows` (reims-vgpu-video's vaapi/va/frame.rs:333,
re-exported from vaapi.rs), none of them ours.
2026-11-20 15:15:25 -08:00
Anees Iqbal 3653240b57 runtime: a point-size function's state is refused under the line and triangle class
Metal's pipeline creation fails for a vertex function that writes `[[point_size]]` under the line
or the triangle input primitive topology class ("Vertex shader writes point size but
inputPrimitiveTopology is MTLPrimitiveTopologyClassLine", measured on an M3 Max, macOS 27.0.1,
the conformance crate's topology_classes probe), and makes it under the point and the
unspecified class. The runtime made all four, so the round's
topology-class-point-size-function on the RX 7900 XTX recorded render-pipeline:line and
:triangle true where Metal recorded false, and drew lines and triangles Metal never drew
(drawn:, target:line and :triangle).

RenderCompiled::of now refuses such a state with the new
Refusal::PointSizeTopology { class }, read from the translator's graphics.writes_point_size and
the descriptor's class, before any Vulkan object is made. The descriptor key already covers the
class, so a cached content of another class never answers for it.

The ledger's row for the case's drawn:unspecified refusal ("a draw with Points is not built") is
stale: points are drawn now, and the round reports it no longer refuses. Dropped.

The runtime README's point bullet states the refusal and the 1.0 stored for a size not greater
than 0 (the previous point-size commit); docs/REFUSALS.md regenerated and the api_signatures
table blessed (one variant row).

Test: draw's every_device_refuses_a_point_size_function_under_the_line_and_triangle_class
(`draw_point_size_class`): rt6_point's state is refused with the class under Line and Triangle and
made under Unspecified and Point.
2026-11-20 14:38:09 -08:00
Anees Iqbal f473ccdb72 runtime: a pass resolves into a colour texture of any usage, as Metal does
Metal resolves into a texture of any usage. Probe resolve_texture_usage.m (M3 Max, macOS 27.0.1,
job m3-max-59768) showed this, and a guest's walk met it twice: a map view's 900x900 pass
resolves a 4-sample BGRA8Unorm_sRGB colour, beside a 4-sample Depth32Float_Stencil8 and with
every load Load, into a 1-sample BGRA8Unorm_sRGB Shared texture of ShaderRead usage. The runtime
refused that as RenderPassKind::ResolveUsage and skipped the pass, so the view missed its drawing.

Form A, as ruled: every one-sample colour texture (2D, 2D array or cube) whose image is optimal
now takes the colour attachment usage on every device where its format renders, whatever
Metal's usage. A pass resolves into it by Vulkan's own resolve, as into a render target.
- texture.rs plan() sets Plan::resolves for a one-sample colour texture of those types made
  without the attachment usage, where the format's features hold the attachment
  (plan.supported). The optimal image's format query runs with the usage. Where it refuses the
  image or the image does not fit the texture's samples, extent and layers, the image is made
  without the usage. Plan::image_usage gives image_info and the texture's Image the usage. Such
  a texture is no render target: it takes no feedback usage or shadow for attachment reads,
  and a pass that renders into it is still Refusal::AttachmentUsage.
- A linear image in place over a buffer (linear_usage, check_over, linear_layout, the plane
  checks) is unchanged. It takes no attachment usage for a resolve alone, so it stays in place
  and is never copied to gain one, and a resolve into it stays ResolveUsage. A texture over a
  buffer in its own optimal image (the counted copy) takes the usage like any optimal image, and
  the pass's write of it is copied back as a render target's is.
- pass.rs resolve() reads the image's own usage (TextureObject::resolve_attachment) in place of
  Metal's. ResolveUsage remains for an image with no attachment usage: a depth or stencil
  texture (macgaps measured no depth format), a colour texture of another type or of a format
  the device's optimal image does not render, and a linear image in place.

Memory: macgaps' table (jobs m3-max-59774, m3-max-59775, m3-max-59776) shows the worst pair on
the Radeon 780M (RADV): a 1920x1080 one-level RGBA8Unorm image grows from 8,847,360 to 8,896,512
bytes (1.0056). On the RX 550 the same image reaches 8,882,200. The Iris Xe, RTX 3090, llvmpipe
and KosmicKrisp show no growth.

Docs: RenderPassKind::ResolveUsage, resolve_texture's doc and the runtime README's resolve
paragraph and known gap say what is true now. docs/REFUSALS.md regenerated (the attachment
view's function is now attachment_view). No public signature moved.

Tests (lavapipe): every_device_resolves_into_a_texture_of_shader_read_usage is the probe's case.
A 4-sample BGRA8Unorm_sRGB attachment cleared to (0.25, 0.5, 0.75, 1) is resolved into a
1-sample Shared texture of ShaderRead usage, and of ShaderRead | ShaderWrite. The image has the
attachment usage, Metrics::resolves rises by one, and every texel reads the clear colour within
one code. A depth resolve into a ShaderRead Depth32Float texture is ResolveUsage. A ShaderRead
texture over a Shared buffer in place has no attachment usage, and a resolve into it is
ResolveUsage. every_device_resolves_a_loaded_pass_beside_depth_and_stencil_into_a_shader_read_texture
is the walk's shape: 900x900, colour beside a 4-sample Depth32Float_Stencil8, every load Load,
resolving what an earlier pass cleared. The old check that ShaderRead and ShaderRead |
ShaderWrite resolves are ResolveUsage is gone, since both now resolve.
2026-11-20 13:42:24 -08:00
Anees Iqbal 569b32b49a RuntimeDriverDefect goes: an identity-keyed table no runtime code reads
The enum listed 33 defects of named drivers in commands a runtime records, keyed on the driver's
identity and release (rule 2). The runtime constructs none and reads none: no crate of ours, and
none of reims's, names a variant. With it go Needs::RuntimeDriverDefect,
Unsupported::runtime_driver_defect, validation's UnsupportedReason::DriverDefect ("driver_defect"
keys; the stale census rows that carry one go at the next re-bless), the conformance verdict's
device-gap arm, the error and engine key tests' entries, the API guide's Needs entry and the
refusal surface script's constructor.

Since nothing reads a variant, no ladder rung follows from one: no site becomes a precision note or
a typed gap. The four docs that cited a variant now state what Vulkan or the module does without
it: the depth/stencil copy modules (maintenance8's copies), the generated-commands replay (the
explicit preprocess form, which the runtime does not take), the validation executor's set-layout
query note (MoltenVK's understated answer), the pipeline-cache probe's comments (MoltenVK compiles
a seeded cache's shaders at load), and SeparateMultisampledDepthStencil's refusal (maintenance8
alone).

NativeHalfConversion's bound adds NVIDIA 620.70.06's measurement on the RTX 3090: the pair is
dropped under the 16-bit RTE, DenormPreserve and SignedZeroInfNanPreserve too, every float that is
no half coming back unchanged over all 2^32 inputs. The bound already covered no rounding at all.

REFUSALS.md and api_signatures.tsv regenerated.

Verified: nothing yet; the gate follows.
2026-11-20 13:39:49 -08:00
Anees Iqbal 82abe62334 Fix forward: the API signature table and REFUSALS.md at the dead-variant batch's landing over the orphans
The dead-variant batch (cutxlate-dw) and the translator orphans (cutcheck) deleted items on both
sides: the orphans removed CompensatedViewport, is_permanent_for and the ViewportCompensation
path; the batch removed the offset-0 class (ZERO_OFFSET_CLASS, ZERO_OFFSET_TOLD,
storage_view_buffers), Needs::DriverDefect and the dead DriverWorkaround variants. The landing's
rebase kept both deletions, so the generated tables are regenerated from the merged sources:
scripts/api-signatures/signatures.py --bless and scripts/refusal-surface/refusal_surface.py.

Verified: both scripts ran on the merged tree; the table holds no ZERO_OFFSET row.
2026-11-20 11:59:14 -08:00
Anees Iqbal 8252854871 SEMANTICS 2208 for the dead driver variants; the runtime pin, REFUSALS.md and api_signatures follow
SEMANTICS_VERSION 2208: the batch changes what a module holds on devices that took the deleted
variants (the clipping notes and the denormals note on every device, one serializer form, a
constant slot's storage view, the half rounding bound) and no longer defers discards or guards
helper branches anywhere.

runtime-sources.sha256 moves without a RUNTIME_VERSION bump: the binder's edits in the batch drop
forms no plan reaches (the uniform texel view's class, the offset-0 class no consumer set, the
mesh limit's always-zero staged bytes), so it binds every plan it can be handed as before.

REFUSALS.md and api_signatures.tsv are regenerated (signatures.py --bless, refusal_surface.py).

Verified: nothing yet; the gate follows.
2026-11-20 11:58:40 -08:00
Anees Iqbal 912bf785ce Simdgroups: the vertex grouping note goes, with its fact's reader
The planner's ruling: no VertexSimdgroupGrouping. lower/simd recorded it for a vertex function's
simdgroup or quad operation where the stage takes no required subgroup size and the profile
carried DriverWorkaround::VertexGroupingNotApples (ANV's 8-vertex interleaved subgroups); no
profile carries that variant since the fact tables went, so it was recorded nowhere. The note,
its reader (regroups_vertices), its codec tag, its conformance degradation and code, its
validation allowance, deferral and bound text, API.md's catalogue entry and the engine_simd and
c3 tests that named it go.

The public surface moves with this commit and the batch's earlier ones: the api_signatures table
(regenerated by signatures.py) drops PrecisionNote::VertexSimdgroupGrouping (the translator's
and the runtime's re-export), Feature::PixelCoverage and Feature::CentroidVarying (link's split
refusal), and DescriptorView::UniformTexel (the views' rung 1); REFUSALS.md (regenerated) drops
the two features, and the reach table their rows.
2026-11-20 11:56:55 -08:00