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>
80 lines
3.1 KiB
C#
80 lines
3.1 KiB
C#
using AcDream.App.Rendering.Gpu.Vk;
|
|
using Silk.NET.OpenGL;
|
|
|
|
namespace AcDream.App.Composition;
|
|
|
|
/// <summary>
|
|
/// Campaign V slice V6h: the graphics ownership that platform acquisition
|
|
/// publishes, once per backend.
|
|
///
|
|
/// <para><see cref="GameWindowPlatformAcquisition"/> was already generic over its
|
|
/// graphics type; only the call sites pinned <c>GL</c>. This class is what they
|
|
/// pin instead, so one composition pipeline drives both backends and the fork
|
|
/// lives at the handful of construction sites that genuinely differ rather than
|
|
/// in a second copy of the startup topology.</para>
|
|
///
|
|
/// <para>It is deliberately NOT a capability abstraction. Nothing dispatches on
|
|
/// it per frame; phases that still speak raw GL ask for the context by name and
|
|
/// take their Vulkan arm when it is absent. The GL arm is deleted at slice V11
|
|
/// and this class with it.</para>
|
|
/// </summary>
|
|
internal abstract class GameWindowGraphics : IDisposable
|
|
{
|
|
/// <summary>Which backend this handle owns.</summary>
|
|
public abstract RenderBackendKind Backend { get; }
|
|
|
|
/// <summary>
|
|
/// The live GL context, or null on any other backend. Phases whose owners
|
|
/// are still raw GL branch on this; each such branch is a slice of Campaign
|
|
/// V that has not landed yet, and the null arm names which one.
|
|
/// </summary>
|
|
public virtual GL? Gl => null;
|
|
|
|
/// <summary>The live Vulkan context, or null on any other backend.</summary>
|
|
public virtual VulkanGraphicsContext? Vulkan => null;
|
|
|
|
/// <summary>
|
|
/// The GL context, or a failure naming the caller. Used where the call site
|
|
/// has already established that the GL arm is running, so a null would be a
|
|
/// composition bug rather than a backend difference.
|
|
/// </summary>
|
|
public GL RequireGl(string owner) =>
|
|
Gl ?? throw new InvalidOperationException(
|
|
$"'{owner}' requires the OpenGL context, but the {Backend} backend is active.");
|
|
|
|
public abstract void Dispose();
|
|
}
|
|
|
|
/// <summary>OpenGL ownership: the Silk.NET <see cref="GL"/> context itself.</summary>
|
|
internal sealed class OpenGlGameWindowGraphics : GameWindowGraphics
|
|
{
|
|
public OpenGlGameWindowGraphics(GL gl) =>
|
|
Context = gl ?? throw new ArgumentNullException(nameof(gl));
|
|
|
|
/// <summary>The owned context. <see cref="GameWindowGraphics.Gl"/> is the borrowed view.</summary>
|
|
public GL Context { get; }
|
|
|
|
public override RenderBackendKind Backend => RenderBackendKind.Gl;
|
|
|
|
public override GL? Gl => Context;
|
|
|
|
public override void Dispose() => Context.Dispose();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Vulkan ownership: the instance, surface, device, swapchain and RHI device
|
|
/// that <see cref="VulkanGraphicsContext"/> acquired and gated.
|
|
/// </summary>
|
|
internal sealed class VulkanGameWindowGraphics : GameWindowGraphics
|
|
{
|
|
public VulkanGameWindowGraphics(VulkanGraphicsContext context) =>
|
|
Context = context ?? throw new ArgumentNullException(nameof(context));
|
|
|
|
public VulkanGraphicsContext Context { get; }
|
|
|
|
public override RenderBackendKind Backend => RenderBackendKind.Vulkan;
|
|
|
|
public override VulkanGraphicsContext? Vulkan => Context;
|
|
|
|
public override void Dispose() => Context.Dispose();
|
|
}
|