Review of this branch. Three defects lost guest work, and the first two share a
cause: a capability mask narrowed below the question its reader asks does not
decline, it answers wrongly.
Component: crates/reims-vgpu contract pixel tables, the Vulkan capability
snapshot and its device probe, the sampled upload rail, and runtime::objects
resolution. x86 macOS / Linux Vulkan pathway, except the object-list half, which
is transport-independent.
## An integer colour attachment had no capability bit, so it was never renderable
`91de82c8` split the two per-layout masks into their own vocabularies and sized
the render-target one by *blendable* layouts. Vulkan mandates no
`COLOR_ATTACHMENT_BLEND` for an integer format, so `Rg16Uint` was in neither
mask, `DeviceCapabilitySnapshot::render_target_layout_supported` had no bit to
read and returned `false`, and `gva_resident_format` built every `RG16Uint`
resident at `RESIDENT_RGBA_FORMAT`. Both Store arms then refused the frame: the
GPU-direct one on `ResidentFormatMismatch` (`held` eight-bit against `want`
`R16G16_UINT`), and the copying one inside `convert_rgba8_to_row`, which has no
integer arm by design and must not gain one.
So `33908f96` admitted the format at `render_target_bpp` and the loss moved one
rung later under a different name. Its boot evidence — `rt_linear_format`,
`clear_dropped` and `mrt_slot_unresolved` all 27/27/108 to zero — measured the
rung that stopped refusing, not the frame.
Three parts, and the probe is one of them because a bit nobody can set is not a
fix:
- the vocabulary is now `TexelLayout::is_render_target_layout` — exactly the set
the reader asks about. `is_blendable_attachment` is deleted rather than kept
beside it, so the two spellings that could drift are one function;
- `caps::device_features`'s per-layout probe (`color_attachment_blend` ->
`color_attachment`) demands `COLOR_ATTACHMENT_BLEND` only of layouts that can
blend. The old conjunction could only ever answer `false` for an integer one;
- `sampled_layout_linear_filter_if_published`'s "no bit" arm returned
`Some(true)`, written for the block-compressed layouts alone, so this device
claimed a `VK_FILTER_LINEAR` on an integer format that no driver advertises
and that the unpublished arm answers `false` for. The arm splits.
The `bool` that selected between the two masks is a `CapabilityMask` enum, so a
third mask fails the build in a `match` instead of silently widening one arm of
an `if`. Bit budget after: 32 + 8 render-target + 1 + 15 filter + 1 published
+ 1 BC = 57, six spare.
## A sampled integer texture fell into a converter with no arm for it
`linear_native_upload_format` gained an `Rgba32Float` arm and not an `Rg16Uint`
one, so a linear sampled `RG16Uint` returned `None`, took the CPU rung, and
refused as `linear_load_row_convert_unsupported`. The sampled half of that
commit's claim was unreachable; the tests exercised the translate tables and not
the production loader.
The arm is ungated, like `Rgba8Unorm` and unlike everything between them:
Vulkan mandates `SAMPLED_IMAGE` for `R16G16_UINT`, and the capability the other
native layouts are gated on is not this layout's question. Linear filtering of
an integer format is undefined in Vulkan and forbidden in Metal, so the guest's
own validation has already made the sampler nearest before the texture arrives —
the same relationship a draw's primitive type has with its pipeline's declared
topology class.
That whole rule lives in one engine door, `supports_sampled_layout_bind`. The
call site asked the filter query directly, which is why making that query
truthful would otherwise have made the layout unbindable.
## `CmdDeleteObject` retired object-list entries with a ref from another namespace
`47f610c6` wired `retired_entry::retire_ref` to `apply_delete_object`, whose own
`## Separate reference spaces stay separate` section — written directly above the
call — records that this ref is in the serializer's per-kind space, that the
object table is keyed by the kernel object-list ref, and that equal integers
across those spaces are unrelated. The measurement is in that doc: 1 988 deletes
in a 25 s driven boot, not one naming a live object-table ref, 22 colliding with
one under a different task.
So the call could only evict an entry that happened to share the integer, which
drops exactly the packets the store exists to keep — and object-list refs were
never retired on delete at all. It is gone; `retire_ref` with it. Retirement is
by namespace, which is the task's object list.
Three more on the same store:
- **Task teardown retires it.** `define_task` and `delete_task` retire every
other per-task ledger — objects, resources, sampler and pipeline states,
`map_audit`, `node_guard`, linear residents, GVA views — and did not retire
this one. A task deleted and never reused held its entries for the life of the
`DeviceState`, unbounded in a map whose whole design is "no capacity, no
eviction"; a redefined id could be answered from the previous generation
between the redefine and its first `CmdSetObjectList`.
- **The instruments run first.** `note_slot_empty_claimants` and
`slot_recheck::note_slot_empty` were skipped whenever the recall answered, so
the two instruments built to measure this miss class read zero exactly when
the population was largest. `slot_recheck` is the only thing that can still
contradict the freed reading the recall rests on, so it has to keep sampling
the slots the recall serves.
- **The census reads the device it is given.** `LIVE` was a process-wide
`AtomicU64` over a per-`DeviceState` map, so with two devices it reported
neither while `served`/`unknown` summed across both. `note_drain_tranche`
takes `&DeviceState`; the per-resolve `store(map.len())` is gone with it.
`ListMiss::SlotEmpty` and `retired_entry` asserted opposite readings of a zero
slot — "not written yet" against "freed". They now agree, on the measurement
that settled it (`slot_recheck` landed zero of 147 verdicts on a slot that later
filled; half the misses were on refs that had already resolved in the same
task), and both name the residual this does not fix: a slot freed, reallocated
and read before the guest's twelve-byte entry lands is zero for a ref that
already names something new. The fix for that is a generation captured at
submission time, which the wire does not carry.
## Docs that no longer described the code
- `render_target_bpp` carried a section headed "`RG16_UINT` is measured, wanted,
and still not here" arguing the format is refused and naming `rt_linear_format`
as the live refusal, while `is_render_target_format` immediately below listed
it. Rewritten as the record of why it is admitted and what the native rail
discharges.
- `draw::render_target`'s call site said `render_target_bpp` "refuses a format
with no known bytes-per-texel", which is the width/capability conflation that
function's own doc identifies as the bug.
- `note_load_action_dont_care` said "nothing is changed here, deliberately" about
plumbing the ordinal to the pass key — the change `8b50fac5` made — and still
claimed DontCare and Clear reach `caches.rs` as one key. It is also a latched
line, not a counter, so the new call sites' "counts the cases" comments were
wrong about their own instrument.
- Three items were spliced into a neighbour's doc block, leaving the neighbour
undocumented: `is_integer` into `is_block_compressed`'s, `readback_vk_format`
into `readback_bytes_per_texel`'s (so the readback-slot safety argument no
longer sat with the `unwrap_or` it warns about), and `retired_entry::census`
between `slot_recheck`'s comment and `slot_recheck`. `tight_row_bytes` lost its
doc outright, including the rule that it answers in blocks for a compressed
layout.
## Instruments and dead code
- `Phase::PrepSeed` had no `enter()` after `09e491a3` removed the CLEAR-seed
loop, so `prep_seed_us` was permanently zero — a bar that looks measured and
measures nothing. Retired with its rail; the span it held is charged to
`Prep`, and the following ordinals renumber.
- The widened DontCare seed path had no instrument at all: it now walks the LOAD
doors (a provenance seed clone, or `resolve_type11_load_seed` reading the
surface out of guest memory) on every pass, and `note_load_seed_outcome` stays
LOAD-only. `dontcare_seed_served`/`dontcare_seed_empty` are the counters, so a
boot can say how often the widening pays.
- `EVERY_GATE_OPEN` was a field-for-field copy of `NativeUploads::ALL` with
nothing comparing them; a fifth gate set in one and missed in the other makes
`native_bind_is_host_gated` compare two equal answers and skip asking the host,
reproducing the `RGBA32Float` defect it exists to have fixed. `ALL` widens to
`any(test, backend-vulkan)` and is used. Its doc also corrects "every gate
shut": the shut arm is `BGRA8`, because `bgra8` is not a host gate.
- `solid_bgra8` lost its only non-test caller with the seed loop and is `pub` in
`contract`, so nothing warned. Deleted with its test.
- `write_gva_frame_within` allocated the tight scratch row on the
`FrameRows::Native` arm, which never reads it.
## Behaviour narrowed without a test
`clear_publish_target` stopped retargeting a clear when the store action is
`STORE` and `resolve_texture_ref` is non-zero — the old code keyed the retarget
on the resolve texture's presence alone. That is the more correct reading and it
stays, but it was uncovered; the case is asserted now.
## The screenshot helper's fallback restored the defect it fixed
`55de1305` narrowed the default selector to an exact caption and then fell back
to the substring match, warning on stderr. The case that reaches the fallback is
the guest window being *absent* — a VM that died, or a boot that lost the
hostfwd race — which is exactly when a larger unrelated window mentioning this
device wins the area ranking, and the capture reports FOUND and exits 0. Failing
is the safe default: a missing guest display is a real result and a picture of
something else is not. The fallback is `--inexact` now.
## Verification
`cargo test -p reims-vgpu --no-default-features --features
backend-vulkan,host-window -- --test-threads=1`: 2225 lib green plus 8
integration binaries, 0 failed, 4 ignored (the gitignored wire fixtures and
three doc tests). Net +1 test: -1 for the deleted `solid_bgra8` case, +2 new.
clippy `-D warnings` exit 0 on all three arms — native vulkan,host-window,
`--target aarch64-apple-darwin` backend-metal, `--target
x86_64-unknown-linux-gnu`. `scripts/feature-matrix`: all arms PASS, warnings=0,
lib=2225 all_targets=2322, no dropped count. `cargo doc` intra-doc link pass:
178 warnings, every one in the pre-existing cosmetic classes, none naming a
symbol this touches.
Two new tests gate the halves that fail silently.
`an_integer_colour_attachment_is_renderable_and_never_filterable` sets the
sampled-filter array for the integer layout deliberately and requires the
snapshot not to read it, so it pins both directions.
`a_deleted_or_redefined_task_keeps_no_remembered_entries` asserts through the
map rather than through a resolve, because a torn-down task misses with
`TaskInactive` long before the recall runs — the leak is invisible to
`lookup_list_entry` by construction, which is why it survived. Verified by
ablation: stubbing the retirement fails it on "the object list these refs index
went away with the task".
## Not verified
No live boot. Every defect above is a rung no counter in this tree reports
today: the RG16Uint Store loss reads as `ResidentFormatMismatch` and a
row-converter refusal rather than `rt_linear_format`, and the sampled one as
`linear_load_row_convert_unsupported`. Confirming any of it needs a driven
macos-15 x86/Vulkan boot read at those slugs, plus the
`REIMS_VGPU_GUEST_IMPORT=off` pair compared on pixels — the copying Store arm is
where two of these fixes land and a host with the import never takes it.
The reused-slot window is designed around, not closed; `slot_recheck` is left
sampling as the instrument that would report it firing, and a non-zero fill rate
there is the signal to retire the recall.
`--inexact` passes `bash -n`; the KWin fallback path itself is untested live, as
it was before.
The `backend-metal` test functions do not run on a Linux host, so the Metal arm
is compile-only for all of this — which covers the `CapabilityMask` const
assertions, since rustc evaluates them on the cross-compiled arm.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015FVCj11zRrQQgLSws6k6zu