render target: a linear texture's sample count comes from its descriptor, not from a provisional
Component: crates/reims-vgpu, render-target resolution for type-2/3 linear textures.
Pathway: x86 macOS / Linux Vulkan. Rail: macos-15.
API contract. A type-2/3 linear texture descriptor declares its own sample count
(recovered in the parent commit: raw u16 at TEXTURE_DESC_PIXEL_FORMAT + 16).
Metal requires a render pipeline's raster sample count and its colour
attachment's texture to agree, so the texture's declaration is what the
attachment must be built to.
Owning invariant: `ResolvedRenderTarget::sample_count` states what the target
itself declares, and is not a stand-in for a field nobody read.
Behavior changed. The type-2/3 linear path takes `tex.sample_count` instead of a
hardcoded `1`. The two paths whose target is a *mapping* rather than a texture --
type-11 and type-4 surfaces -- keep `1`, because they carry no creation
descriptor: there `1` is the display contract's own default rather than a
provisional. A descriptor that established no sample count still yields `1`, so
a texture this decoder could not corroborate keeps exactly the behaviour it had.
Why, measured. Rail macos-15, arm `m`, two boots at the parent commit:
texture_desc_samples_1=3367 texture_desc_samples_4=4 trailer_corroborated=3371
texture_desc_samples_1=4705 texture_desc_samples_4=4 trailer_corroborated=4709
texture_desc_trailer_disagrees=0
OFF texture_desc_multisample samples=4 300x300 shift=0
Exactly four textures a boot declare four samples and every one is 300x300 --
the same geometry, to the pixel, that the promotion record names:
attachment_sample_count_override pipe=1014 tex_ref=1002 resolve_ref=0
pipeline_samples=4 target_samples=1 resolved_samples=4 300x300 mid=0
So the guest's texture really is four-sample, `pipeline_samples=4` was right, and
`target_samples=1` was the provisional. The device was not inventing a
multisample attachment; it was reporting a disagreement with its own placeholder.
Zero descriptors out of 3371 and 4709 failed the trailer's self-corroboration, so
the recovered layout holds on every descriptor these boots decoded, not only on
the ones that looked plausible.
The witness, control against candidate, three batteries each:
attach_samples_multisample_no_resolve 3 -> 0 (ctl-1/ctl-2 vs cnd-1/cnd-2)
texture_desc_samples_4 6 -> 6 unchanged
texture_desc_trailer_disagrees 0 -> 0
The disagreement is gone because there is no longer a disagreement: both sides
now read four. `note_attachment_sample_count_override` returns early when they
agree, so that counter going to zero is exactly the claim.
What this does NOT repair, deliberately. `chain_resident_land_fail` is 3 on both
arms, unchanged. The attachment is still multisampled -- correctly -- and
`resident_read_snapshot` still refuses to read a multisampled resident
(`TargetReadDecline::MultisampleImage`), so nothing is stored and
`runtime::exec::finish_stream` still applies the pass's clear, and the rendered
300x300 tile is still lost. That is the next commit's work, and it is now
unblocked: this one establishes that the multisample-ness is the guest's and not
this device's, which is the fact that decides whether to resolve or to stop
promoting.
Conformance gate: PASS. Rail macos-15, three control and three candidate
batteries interleaved against pinned binaries (control 221ba048 = parent,
candidate 01b1e949). 293 cases run and 292 scored on all six, no NOT-RUN, no
missing name, no duplicate, no panic. Case-level transitions:
cnd-1 preserved 262, unchanged debt 19, unchanged applicability 11,
changed detail 1, control-unstable 1, regressions 0
cnd-2 same, regressions 0
cnd-3 same, regressions 0
One reader decision, recorded rather than hidden: scoring with device logs also
flags `device_lock_busy -- control 0 candidate 1`, from a single line in cnd-1,
`reason=gfx_read_deferred offset=0x122c size=4`. That is an MMIO read arriving
while the host device lock is held -- host-side contention, no guest-visible
branch, and this session was running builds alongside the batteries. Its
companion `present_order_hold` moves the same way inside each arm (control
0/0/1, candidate 0/1/3), which is what a timing counter looks like. Not scored as
a regression. The control-unstable case is
`srt_blit_iosurface_source_1920x1080_x4`, failing in 1 of these 3 controls, known.
Verification actually run: cargo fmt --all and --check; clippy -D warnings on all
three main arms (aarch64-apple-darwin backend-metal, host
backend-vulkan,host-window, x86_64-unknown-linux-gnu backend-vulkan,host-window);
the full reims-vgpu suite serially, 2304 passed / 0 failed / 1 ignored.
Not verified:
- No live desktop boot ran this, and no visual interaction was re-photographed.
The defect it moves toward is a lost 300x300 tile inside Safari-class content;
symptom 2 still has no working end-to-end witness (`web-content-probe` exits 2
on its own setup gate).
- The guest's texture type was not read. `MTLTextureType` is a 4-bit field at
TEXTURE_DESC_PIXEL_FORMAT - 2 and would corroborate `2DMultisample`
independently of the sample count; it is not decoded here.
- Metal arm cross-compiles only; its tests did not run. No other pathway or rail.
This commit is contained in:
1 parent
eb406d87b5
commit
7540d6ecf9
1 file changed
+29
-5
@@ -348,10 +348,26 @@ pub(super) struct ResolvedRenderTarget {
|
||||
/// Bytes per row of the target (archive `bpr`).
|
||||
pub(super) row_stride: u32,
|
||||
pub(super) format: u16,
|
||||
/// Attachment samples requested for this encode. Linear texture resource
|
||||
/// dimensions do not retain the creation descriptor's sample count, so the
|
||||
/// Vulkan encode replaces this provisional single-sample value with the
|
||||
/// bound pipeline's raster sample count before constructing an image.
|
||||
/// Attachment samples this target's own declaration asks for.
|
||||
///
|
||||
/// For a type-2/3 linear texture this is the descriptor's decoded sample
|
||||
/// count — the texture says what it is, and on rail macos-15 four textures a
|
||||
/// boot say four. It was a hardcoded provisional `1` until that field was
|
||||
/// recovered, and the provisional was indistinguishable from a decoded one:
|
||||
/// `attachment_sample_count_override` reported `target_samples=1` against a
|
||||
/// pipeline's `4` on every boot and could not say which side was the
|
||||
/// invention.
|
||||
///
|
||||
/// It stays `1` on the two paths whose target is a *mapping* rather than a
|
||||
/// texture (type-11 and type-4 surfaces). Those carry no creation
|
||||
/// descriptor, so nothing there declares a sample count and `1` is the
|
||||
/// display contract's own default rather than a stand-in for an unread
|
||||
/// field.
|
||||
///
|
||||
/// The Vulkan encode still takes the bound pipeline's raster sample count
|
||||
/// when the pipeline declares one, because Metal requires the two to agree
|
||||
/// and the pipeline is the one that must; this is what that agreement is
|
||||
/// checked against.
|
||||
pub(super) sample_count: u32,
|
||||
}
|
||||
|
||||
@@ -1102,7 +1118,15 @@ fn resolve_render_target<M: HostMemory + HostOps>(
|
||||
height: h,
|
||||
row_stride: bpr,
|
||||
format: fmt,
|
||||
sample_count: 1,
|
||||
// The texture's own declaration when it made one. `None` means this
|
||||
// descriptor established no sample count -- not that the texture is
|
||||
// single-sample -- but an attachment has to be built with some number,
|
||||
// and one is the only one that is safe to build with: it is what every
|
||||
// path here did before the field was recovered, so a descriptor that
|
||||
// says nothing keeps exactly the behaviour it had. The distinction is
|
||||
// not lost, because `decode_trailer_sample_count` emits
|
||||
// `texture_desc_trailer_disagrees` on the way to `None`.
|
||||
sample_count: tex.sample_count.unwrap_or(1).max(1),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user