feat(render): Vulkan campaign V11 step 2 — delete the OpenGL backend

Vulkan is the sole, user-signed-off backend (V10 landed) and step 1
already removed ImGui/Studio/DevTools. This step deletes the GL
rendering backend itself: every Gpu/Gl/** implementation, the Wb
ManagedGL*/GLHelpers/GLSLShader/GLStateScope/RenderStateCache/
BindlessSupport family, Shader/ShaderProgramConstruction/SamplerCache,
RenderBootstrap, and RenderFrameGlStateController.

GameWindow.cs's Run()/CreateGraphics()/CreateBackbufferReader()/
OnLoad() collapse to their Vulkan-only arm; GameWindowGraphics loses
its OpenGlGameWindowGraphics subclass. RuntimeOptions.RenderBackend and
RenderBackendKind (incl. the Gl member of GpuBackendKind) are gone —
there is nothing left to select between. The five world-draw dual-arm
renderers (WbDrawDispatcher, EnvCellRenderer, TerrainModernRenderer,
ParticleRenderer, SkyRenderer) and the composition roots
(WorldRenderComposition, HostInputCameraComposition,
LivePresentationComposition, FrameRootComposition) collapse to their
RHI-only arm. GL-only diagnostic properties with a live external reader
(DynamicBufferCount and friends) simplify to a documented `=> 0`/no-op
rather than disappearing, since the reader is out of this commit's
scope.

A few GL-flavored mechanisms turned out to be backend-neutral once
isolated: GlConstructionCleanupLedger is renamed
ResourceConstructionCleanupLedger (exception-chain walking has nothing
to do with GL), and GlfwNativePlatformProbe moved out of the otherwise
GL-only GraphicalCapabilityRecord.cs into
GraphicalWindowBackendSelection.cs before the rest of that file was
deleted.

Test files with no surviving subject are deleted outright
(GraphicalCapabilityRequirementsTests, ShaderProgramConstructionTests,
PortalDepthShaderParityTests, TextureCacheBindlessTests,
TextRendererFailureSafetyTests, ClipFrameUploadTests, every
Gpu/Gl/*Tests, GlTextureOwnershipTests, RenderFrameGlStateControllerTests);
others get their dead GL-only members trimmed while their live
assertions stay (ClipFrameLayoutTests' MeshClipSsboBinding check now
reads GpuBindingModel.StorageClipRegions, the same binding index under
its new backend-neutral name; GpuResourceRetirementTransactionTests
drops its OpenGLGraphicsDevice-subclassing test double and the two GL
queue tests it existed for). EnvCellRendererTests' construction helper
now builds a real ObjectMeshManager via VulkanMeshPipelineDevice
instead of passing null through a null-forgiving operator, since the
RHI constructor never tolerated a null mesh manager and the old GL
constructor (which did) is gone.

Deferred to the next two steps, deliberately not touched here: the
Silk.NET.OpenGL/.Extensions.ARB package references, IMeshPipelineDevice.Gl
(WbMeshAdapter's GL? threading stays in place), Chorizite.Core's stale
csproj comment (the package itself is still load-bearing —
TextureFormat and friends are used well beyond the deleted
ManagedGLUniformBuffer), and the CI/gate scripts.

Build: `dotnet build AcDream.slnx -c Release` — 0 warnings, 0 errors.
Tests: full-solution `dotnet test` green across every project
(App.Tests 3937/3940 + 3 skips, Core.Tests 3296/3298 + 2 skips, all
others 100%); the 2 App.Tests names that flake under full-suite
parallel execution (#250-family, documented pre-existing) pass in
isolation.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-07-29 02:19:53 +02:00
parent b70b9832ff
commit 8a7a0837e1
121 changed files with 1243 additions and 19840 deletions

View file

@ -1,79 +1,32 @@
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.
/// The graphics ownership that platform acquisition publishes.
///
/// <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>
/// <para>Vulkan is the only backend as of Campaign V slice V11: the raw-GL
/// implementation (<c>OpenGlGameWindowGraphics</c>) and the members that only
/// existed to branch on it (<c>Backend</c>, <c>Gl</c>, <c>RequireGl</c>) were
/// deleted along with it. This class stays as the seam
/// <see cref="GameWindowPlatformAcquisition"/> and the composition phases are
/// already written against, so a future second backend would still add one
/// class of this shape rather than reopening every call site.</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>
/// <summary>The live Vulkan context.</summary>
public virtual VulkanGraphicsContext? Vulkan => null;
/// <summary>
/// Campaign V slice V6j: the backend's world-pass seam, or null where the
/// world renderers open their own passes.
///
/// <para>It lives here because the three composition phases that need it —
/// world render, live presentation and the frame root — already borrow this
/// handle, and because whether a backend HAS such a seam is exactly the kind
/// of thing this type exists to answer. GL returns null: its renderers
/// submit raw, and the frame spine still owns framebuffer management until
/// V4h.</para>
/// The backend's world-pass seam. Every remaining renderer records into the
/// pass this publishes rather than opening its own.
/// </summary>
public virtual AcDream.App.Rendering.IWorldPassScope? WorldPassScope => 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.
@ -91,8 +44,6 @@ internal sealed class VulkanGameWindowGraphics : GameWindowGraphics
public VulkanGraphicsContext Context { get; }
public override RenderBackendKind Backend => RenderBackendKind.Vulkan;
public override VulkanGraphicsContext? Vulkan => Context;
/// <summary>The concrete scope, for the phase that publishes the encoder on it.</summary>