feat(render): Campaign V slice V6h — the Vulkan composition host
ACDREAM_RENDER_BACKEND=vulkan now runs the real GameWindow composition rather
than a second main(). All nine phases execute: DAT load, streaming, camera,
entity table, session, and the real retained UiHost drawing through the RHI.
No world renderers — they are raw GL until V4t and the world arm behind it.
The offline log is the client's own (acdream.pak opened, 6266 spells, Region
0x13000000, "loading world view centered on 0xA9B4FFFF", fourteen retail
LayoutDesc lines, streaming radii), and the captured frame is the retail
retained UI: vitals, combat/spell bar with DAT scarab icons, the nine-slot
toolbar, chat with tabs and Send, radar/compass with dat-font glyphs. Sampled
against the GL capture the widgets agree — chat interior RGBA (25,24,27,158)
vs (22,21,23,158), vitals bar (117,1,0) and toolbar slot (0,11,17) identical.
Three seams, as §5.5.9 specified:
1. Platform acquisition — already generic — publishes GameWindowGraphics
instead of a bare GL. Phases that still speak raw GL read Graphics.Gl and
take their Vulkan arm when it is null; each branch names the slice that
removes it.
2. VulkanHostInputCameraCompositionFactory is a new file and the whole of the
Phase-1 fork: four graphics members differ, input/camera/pointer delegate.
The default factory is chosen inside the phase from the platform result.
HostInputCameraResult gained backend-neutral Retirement and FrameSlots.
3. The frame root forks on one condition. The GL world-scene assembly is
unchanged, wrapped in `if (gl is not null)`; the Vulkan arm's graph is one
backbuffer clear pass computing the same RenderFrameFoundation from the same
clock and weather owners, then private presentation over it.
§5.5.9's three TextureCache couplings are unpicked: the constructor takes GL?
and rejects bindless without one, world entry points route through a Gl
property that throws naming V4t, and the (GlGpuTexture) VRAM-accounting cast
became a backend test. That cast's stated reason — DrawSprite's texture-unit
binding — was already stale, deleted at V6d.
VulkanBringUpHost is reduced to the capability-probe harness it is named for:
the instance/surface/device/swapchain sequence moved into VulkanGraphicsContext,
which the composition host and the harness now share. It is reached only with
ACDREAM_VULKAN_PROBE=1.
One latent Vulkan defect surfaced and is fixed here. The first composition-host
frame died with ErrorDeviceLost; validation named VUID-vkCmdDraw-None-08600 —
descriptor set 2 never bound. VulkanGpuPassEncoder bound sets 0/1/2 only as a
side effect of BindStorageBuffer/BindUniformBuffer, so a pass sampling the
texture table while binding no buffer — every retained-UI and debug-line pass —
drew with the table unbound. It survived V6c-V6g because the bring-up host
always drew VulkanRhiScene first and the UI pass inherited its binds; the
composition host has no 3-D scene. The fix is one line in the encoder's
constructor beside the viewport and scissor defaults, which exist for exactly
the same reason: a pass opens with complete binding state rather than depending
on what preceded it.
Gates: strict GL offline pixel gate against 46d893f7 measures 1.24e-05 (7 of
563,200 pixels), inside the documented 15-23 px / 4.1e-05 band, so GL behaviour
did not move. App tests 4,075/3 skips; complete Release suite 9,138/5 skips.
One full Vulkan run with VK_LAYER_KHRONOS_validation: zero errors, zero
warnings. Both Vulkan runs converged the ownership ledger — no [shutdown]
diagnostic on either stream. The reduced probe harness presented 34,811
validation-clean frames.
No divergence-register row: GL is the shipping backend and the pixel gate proves
it unmoved; the Vulkan arm is not a retail deviation but a backend under
construction.
Next is V4t, the texture stack, which the world arm cannot be written without.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
46d893f7c3
commit
b16f820643
29 changed files with 2292 additions and 997 deletions
|
|
@ -0,0 +1,146 @@
|
|||
using AcDream.App.Input;
|
||||
using AcDream.App.Rendering;
|
||||
using AcDream.App.Rendering.Gpu;
|
||||
using AcDream.App.Rendering.Gpu.Vk;
|
||||
using AcDream.UI.Abstractions.Input;
|
||||
using Silk.NET.Input;
|
||||
|
||||
namespace AcDream.App.Composition;
|
||||
|
||||
/// <summary>
|
||||
/// Campaign V slice V6h: the Vulkan arm of the host phase.
|
||||
///
|
||||
/// <para>This is the whole of the backend fork at composition Phase 1. Only the
|
||||
/// four graphics members differ from
|
||||
/// <see cref="RetailHostInputCameraCompositionFactory"/>; input, camera and
|
||||
/// pointer construction are platform concerns, not graphics ones, so they
|
||||
/// delegate rather than duplicate. Adding a fifth backend would add one more
|
||||
/// class of this shape and touch nothing else in the composition pipeline —
|
||||
/// which is the property §5.5.9 asked this slice to establish.</para>
|
||||
///
|
||||
/// <para><b>What is absent, and why.</b> There is no GL fence ring: the RHI
|
||||
/// device owns its own frames-in-flight through a timeline semaphore, so
|
||||
/// retirement and slot indexing come from the device instead. There is no
|
||||
/// <see cref="WorldRenderDiagnostics"/>: it is a raw-GL state tripwire, and
|
||||
/// Vulkan has no global state for it to watch. Both nulls are read by the
|
||||
/// phases that would otherwise consume them.</para>
|
||||
/// </summary>
|
||||
internal sealed class VulkanHostInputCameraCompositionFactory
|
||||
: IHostInputCameraCompositionFactory
|
||||
{
|
||||
private readonly RetailHostInputCameraCompositionFactory _platform = new();
|
||||
|
||||
public IFramebufferViewportTarget CreateViewportTarget(
|
||||
GameWindowGraphics graphics) =>
|
||||
// The viewport is a pipeline dynamic state on Vulkan, set per pass by
|
||||
// the encoder from the pass extent, so there is no persistent viewport
|
||||
// to bind here. The framebuffer-resize controller still drives the
|
||||
// camera aspect through its own target.
|
||||
NullFramebufferViewportTarget.Instance;
|
||||
|
||||
public GpuFrameFlightController? CreateGpuFrameFlights(
|
||||
GameWindowGraphics graphics) => null;
|
||||
|
||||
public IGpuDevice CreateGpuDevice(
|
||||
GameWindowGraphics graphics,
|
||||
GpuFrameFlightController? frameFlights) =>
|
||||
RequireContext(graphics).Device;
|
||||
|
||||
public IGpuResourceRetirementQueue CreateRetirement(
|
||||
GameWindowGraphics graphics,
|
||||
GpuFrameFlightController? frameFlights,
|
||||
IGpuDevice device) => device.Retirement;
|
||||
|
||||
public IRenderFrameSlotSource CreateFrameSlots(
|
||||
GameWindowGraphics graphics,
|
||||
GpuFrameFlightController? frameFlights,
|
||||
IGpuDevice device) =>
|
||||
new VulkanRenderFrameSlotSource(RequireContext(graphics).Device);
|
||||
|
||||
public WorldRenderDiagnostics? CreateWorldRenderDiagnostics(
|
||||
GameWindowGraphics graphics,
|
||||
IRenderFrameDiagnosticLog log) => null;
|
||||
|
||||
public SilkKeyboardSource CreateKeyboardSource(
|
||||
IKeyboard keyboard,
|
||||
HostQuiescenceGate quiescence) =>
|
||||
_platform.CreateKeyboardSource(keyboard, quiescence);
|
||||
|
||||
public SilkMouseSource CreateMouseSource(
|
||||
IMouse mouse,
|
||||
IInputCaptureSource capture,
|
||||
IKeyboardSource? keyboard,
|
||||
HostQuiescenceGate quiescence) =>
|
||||
_platform.CreateMouseSource(mouse, capture, keyboard, quiescence);
|
||||
|
||||
public IMouseLookCursor CreateMouseLookCursor(IMouse mouse) =>
|
||||
_platform.CreateMouseLookCursor(mouse);
|
||||
|
||||
public InputDispatcher CreateInputDispatcher(
|
||||
IKeyboardSource keyboard,
|
||||
IMouseSource mouse,
|
||||
KeyBindings bindings) =>
|
||||
_platform.CreateInputDispatcher(keyboard, mouse, bindings);
|
||||
|
||||
public CameraController CreateCameraController() =>
|
||||
_platform.CreateCameraController();
|
||||
|
||||
public IFramebufferCameraTarget CreateCameraTarget(CameraController camera) =>
|
||||
_platform.CreateCameraTarget(camera);
|
||||
|
||||
public CameraPointerInputController CreateCameraPointerInput(
|
||||
IReadOnlyList<IMouse> mice,
|
||||
HostQuiescenceGate quiescence,
|
||||
IInputCaptureSource capture,
|
||||
LocalPlayerModeState playerMode,
|
||||
CameraController camera,
|
||||
ChaseCameraInputState chase,
|
||||
IMouseSource mouse,
|
||||
PointerPositionState pointer) =>
|
||||
_platform.CreateCameraPointerInput(
|
||||
mice,
|
||||
quiescence,
|
||||
capture,
|
||||
playerMode,
|
||||
camera,
|
||||
chase,
|
||||
mouse,
|
||||
pointer);
|
||||
|
||||
private static VulkanGraphicsContext RequireContext(
|
||||
GameWindowGraphics graphics) =>
|
||||
graphics.Vulkan
|
||||
?? throw new InvalidOperationException(
|
||||
"The Vulkan host factory was composed against the " +
|
||||
$"{graphics.Backend} backend.");
|
||||
|
||||
/// <summary>
|
||||
/// Vulkan sets the viewport per pass from the pass extent, so there is no
|
||||
/// persistent viewport binding for the resize controller to update. Size is
|
||||
/// still recorded, because the swapchain recreation the host performs is
|
||||
/// what actually resizes the surface.
|
||||
/// </summary>
|
||||
private sealed class NullFramebufferViewportTarget : IFramebufferViewportTarget
|
||||
{
|
||||
public static NullFramebufferViewportTarget Instance { get; } = new();
|
||||
|
||||
private NullFramebufferViewportTarget()
|
||||
{
|
||||
}
|
||||
|
||||
public void ResizeViewport(int width, int height)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The flight slot per-frame buffers index by. Identical in role to the GL
|
||||
/// ring's <see cref="GpuFrameFlightController.CurrentSlot"/>; the count comes
|
||||
/// from the device's timeline flight controller rather than a fence array.
|
||||
/// </summary>
|
||||
private sealed class VulkanRenderFrameSlotSource(VulkanGpuDevice device)
|
||||
: IRenderFrameSlotSource
|
||||
{
|
||||
public int CurrentSlot => device.Flights.CurrentSlot;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue