feat(render): Campaign V slice V6l commit 3 - the offscreen viewports draw on Vulkan
Amendment 3 of three: the paperdoll and creature-appraisal views render on the
Vulkan arm. Plan section 5.5.16 defect 3 named two backend fixes as the
precondition; both are here, and running it found two more the note could not
have known about.
Fix 1: a layered sampled view per render target. An ATTACHMENT view must be
VK_IMAGE_VIEW_TYPE_2D and the global texture table's descriptor array is
sampler2DArray, so the attachment view cannot legally be registered into it -
section 5.5.7 recorded that as invalid usage rather than a mismatch that samples
oddly, and V6k made RegisterTexture refuse it loudly and name this fix.
VulkanGpuTexture now creates a SECOND, layered view over the same image for a
colour render target: one image, one allocation, two ways of looking at it,
legal without any creation flag. SampledView is what the table registers for
every texture, so the question disappears rather than being answered.
Fix 2: sample-count pipeline variants for WbDrawDispatcher. Vulkan requires a
pipeline's rasterizationSamples to equal the pass it draws in, and this
dispatcher draws in two passes with different counts - the multisampled
backbuffer world pass and the single-sampled offscreen target, which the
contract fixes at one sample. Its five pipelines became a MeshPipelineSet with
two instances, selected at bind time from the live pass rather than from the
scope, which is the same shape section 5.5.8 gave the depth-format problem. When
the backbuffer is single-sampled the two sets are one object, so nothing is
built twice and nothing is freed twice. The offscreen target's DEPTH attachment
also had to take the device's own combined depth/stencil format rather than the
contract enum's literal D24_UNORM_S8_UINT: a pipeline bakes one depth/stencil
format under dynamic rendering and the same pipelines draw in both passes, so a
second format would make one of the two undefined.
Fix 3, which running it found: entity APPEARANCE composites were still
bindless-only, so no entity with a palette override could be drawn on the Vulkan
arm at all - the doll being one, and every creature and player besides. The
backend that serves it has existed since V6i-2 and had no production consumer;
it has one now. TextureCache builds the composite cache on both arms, and
EnsureCompositeTexturesAvailable stops asking about bindless. Nothing about the
cache itself changed: the sharing, the bounded unowned LRU, the metered upload
budget and the retirement fence were already backend-neutral.
Fix 4, which the first successful capture found: the doll rendered upside down.
UiViewport has flipped V since V4a because a GL framebuffer's origin is
bottom-left, so its colour texture samples bottom-up. A Vulkan image's origin is
top-left and the backend's negative viewport height stores the rendered image
that way round, so the same flip stands the doll on its head. That is a property
of the backend that made the texture, not of the widget that draws it, so
IUiViewportRenderer answers TextureIsBottomUp and UiViewport asks. The line this
replaces had predicted exactly this failure since it was written.
The seam. WbDrawDispatcher's RHI arm borrows its pass from IWorldPassScope
rather than opening one, so a viewport that opens a pass of its own has to
publish it there for the span of the draw. Publish is on the interface now for
that. It does not nest: the world phase has closed its own pass by the time
private presentation runs, which is where these viewports have always drawn.
Gates. Release build green. App tests 4,129/3 skips; complete Release suite
9,192/5 (one solution-wide run reported a single App failure that did not
reproduce in the App suite alone or in a second solution-wide run - the
documented rerun-singly flake class; the failing test name was not surfaced by
the runner and is not carried forward as a claim). Strict GL offline pixel gate
against 08ffe141: 3.55e-05, 20 differing pixels of 563,200, inside the
documented 9-31 band. GL connected -Runs 3: 3/3 RENDERED on the desktop witness
and 3/3 on the client capture. One offline Vulkan run with
VK_LAYER_KHRONOS_validation proven inserted by the loader: zero validation
errors, zero warnings.
And the two captures the offline gate cannot reach, both connected and both
inspected. The Vulkan paperdoll (artifacts/v6l-vk-paperdoll3) renders the doll
upright, in armour, at the right scale, over a transparent background, and is
indistinguishable from the same capture on GL taken minutes later
(artifacts/v6l-gl-paperdoll) - which is also the no-regression check for the V
change. Particles (artifacts/v6l-vk-poi versus artifacts/v6l-gl-poi, cropped
4x at artifacts/crop-vk-glow.png and crop-gl-glow.png): Holtburg's forge plume
and its field of glint sprites draw in the same places with the same alpha
compositing on both backends, the puffs differing only in phase because two
launches cannot agree on an emitter's age.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
eced67d038
commit
2e8b8b91ad
13 changed files with 353 additions and 102 deletions
|
|
@ -189,19 +189,44 @@ public sealed unsafe class TextureCache
|
|||
}
|
||||
else
|
||||
{
|
||||
// Campaign V slice V6l: particles draw on both arms, so the standalone
|
||||
// particle cache exists on both. Everything about it that matters —
|
||||
// sharing equivalent surfaces between emitter owners, the bounded
|
||||
// unowned LRU, and retirement behind the frame-flight fence — is
|
||||
// Campaign V slice V6l: both owner-scoped caches exist on both arms.
|
||||
//
|
||||
// Everything about them that matters — sharing equivalent surfaces
|
||||
// between owners, the bounded unowned LRU, the metered upload budget,
|
||||
// and retirement behind the frame-flight fence — is already
|
||||
// backend-neutral; only how one entry is created and destroyed
|
||||
// differs, which is what the backend interface is for. The COMPOSITE
|
||||
// cache stays GL-only: it serves entity appearance, not particles,
|
||||
// and its port is not this slice's.
|
||||
_particleTextures = new StandaloneBindlessTextureCache(
|
||||
new ParticleRhiTextureBackend(this),
|
||||
retirementQueue,
|
||||
budgets.StandaloneUnownedBytes,
|
||||
budgets.StandaloneUnownedEntries);
|
||||
// differs, which is exactly what the two backend interfaces are for.
|
||||
// RhiCompositeTextureArrayBackend is V6i-2's, built and exercised at
|
||||
// startup since that slice but with no production consumer until now;
|
||||
// ParticleRhiTextureBackend is this slice's.
|
||||
var resources = new ResourceCleanupGroup();
|
||||
CompositeTextureArrayCache? composite = null;
|
||||
StandaloneBindlessTextureCache? particles = null;
|
||||
try
|
||||
{
|
||||
composite = new CompositeTextureArrayCache(
|
||||
new RhiCompositeTextureArrayBackend(device),
|
||||
retirementQueue,
|
||||
budgets.CompositeUnownedBytes,
|
||||
budgets.CompositePhysicalBytes);
|
||||
resources.Add("composite texture cache", composite.Dispose);
|
||||
particles = new StandaloneBindlessTextureCache(
|
||||
new ParticleRhiTextureBackend(this),
|
||||
retirementQueue,
|
||||
budgets.StandaloneUnownedBytes,
|
||||
budgets.StandaloneUnownedEntries);
|
||||
resources.Add("particle texture cache", particles.Dispose);
|
||||
resources.TransferAll();
|
||||
}
|
||||
catch (Exception constructionFailure)
|
||||
{
|
||||
resources.RollbackConstructionAndThrow(
|
||||
"TextureCache construction failed and its child-cache prefix did not cleanly roll back.",
|
||||
constructionFailure);
|
||||
}
|
||||
|
||||
_compositeTextures = composite;
|
||||
_particleTextures = particles;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -836,11 +861,15 @@ public sealed unsafe class TextureCache
|
|||
"WbDrawDispatcher requires the bindless-aware ctor overload (pass non-null BindlessSupport).");
|
||||
}
|
||||
|
||||
private CompositeTextureArrayCache EnsureCompositeTexturesAvailable()
|
||||
{
|
||||
EnsureBindlessAvailable();
|
||||
return _compositeTextures!;
|
||||
}
|
||||
/// <summary>
|
||||
/// Campaign V slice V6l: no longer gated on bindless. The composite cache is
|
||||
/// constructed on both arms — V6i-2's RHI backend is what serves the one
|
||||
/// without a GL context — so the only failure left is a cache that was never
|
||||
/// built at all.
|
||||
/// </summary>
|
||||
private CompositeTextureArrayCache EnsureCompositeTexturesAvailable() =>
|
||||
_compositeTextures ?? throw new InvalidOperationException(
|
||||
"This TextureCache owns no composite texture array cache.");
|
||||
|
||||
/// <summary>
|
||||
/// Campaign V slice V6l: no longer gated on bindless. The particle cache is
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue