Revert "Campaign V slice V4a" - it lost world multisampling
This reverts ceec3bc4. Two independent reasons, either sufficient.
The rendering regression. The slice deleted TextRenderGlStateScope, which
saved GL_MULTISAMPLE and GL_SAMPLE_ALPHA_TO_COVERAGE on entry, disabled them
for the text pass, and restored them on exit (TextRenderGlStateScope.cs:111-112
and 153-154 at the parent commit). Its replacement bakes that state into the
text pipeline but nothing restores it, and GlGpuPassEncoder.Dispose does not
either. Every world renderer is still raw GL at this point in the campaign, so
from the first UI frame onward the world drew with multisampling disabled.
The offline pixel gate caught it: 1,791 of 563,200 compared pixels differed,
0.318% against a 0.001 threshold. The commit message attributed this to
wall-clock-driven ambient animation shifting phase, and committed through the
failure. That explanation does not survive its own control: capturing twice at
the reverted-to commit differs by 19 pixels and twice at the slice's own commit
by 8, while base-versus-head differs by 1,791 - a 224x gap that no shared-noise
source explains. An amplified difference image settles it visually: the changed
pixels are the silhouette edges of every tree, building and rock, with terrain
interiors, water and the entire UI untouched. That is the signature of losing
edge antialiasing, not of animated sprites.
This is the exact failure mode two existing memory notes already warn about -
a mid-frame renderer must set every GL state it uses rather than inherit it,
and issue #52's lesson that a rendering migration must audit per-pass GL state
before declaring itself done.
The scope. The brief was three small leaf renderers plus additive frame-
lifecycle wiring, roughly ten files. The commit changed 334 files with 3,665
insertions and 3,845 deletions, including 323 public-to-internal visibility
conversions across the App assembly, 55 test files, two retired conformance
tests, and a self-described temporary escape hatch for bridging raw-GL viewport
textures. Even without the regression, that is not separable into the part
worth keeping and the part worth dropping.
Reverting rather than patching because the good work here - the RHI frame
lifecycle wiring and a genuine render-state-cache staleness fix - is small
enough to redo cleanly against a tightened spec, while untangling it from 300+
files of unrelated churn is not.
Post-revert: Release build clean, App suite back to 3,843 passed / 3 skipped,
offline pixel gate passing at 19 differing pixels.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
ceec3bc440
commit
9aaf97e785
334 changed files with 3841 additions and 3661 deletions
|
|
@ -1,4 +1,4 @@
|
|||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
|
|
@ -10,11 +10,11 @@ using Silk.NET.OpenGL;
|
|||
namespace AcDream.App.Diagnostics;
|
||||
|
||||
/// <summary>Stage indices for per-frame CPU attribution.</summary>
|
||||
internal enum FrameStage
|
||||
public enum FrameStage
|
||||
{
|
||||
/// <summary>Whole OnUpdate body (simulation + streaming apply).</summary>
|
||||
Update = 0,
|
||||
/// <summary>WbMeshAdapter.Tick — staged mesh/texture GPU upload drain.</summary>
|
||||
/// <summary>WbMeshAdapter.Tick — staged mesh/texture GPU upload drain.</summary>
|
||||
Upload = 1,
|
||||
/// <summary>ImGui Render (dev overlay).</summary>
|
||||
ImGui = 2,
|
||||
|
|
@ -23,11 +23,11 @@ internal enum FrameStage
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// One <c>ACDREAM_FRAME_HISTORY</c> CSV row — every field the aggregated
|
||||
/// One <c>ACDREAM_FRAME_HISTORY</c> CSV row — every field the aggregated
|
||||
/// <c>[frame-prof]</c> report discards when its 5-second window resets.
|
||||
/// Stage fields mirror <see cref="FrameStage"/> positionally (Update /
|
||||
/// Upload / ImGui / Pacing, matching <see cref="FrameProfiler.FormatReport"/>'s
|
||||
/// <c>names</c> array) — if <see cref="FrameStage"/> grows, extend this
|
||||
/// <c>names</c> array) — if <see cref="FrameStage"/> grows, extend this
|
||||
/// record, <see cref="FrameProfiler.WriteHistoryCsv"/>, and the CSV header
|
||||
/// together. <c>GpuUs</c> is <c>-1</c> for a frame with no available GPU
|
||||
/// sample (warm-up, or <c>ACDREAM_WB_DIAG=1</c> self-disable).
|
||||
|
|
@ -44,7 +44,7 @@ internal readonly record struct FrameHistoryRecord(
|
|||
long PacingUs);
|
||||
|
||||
/// <summary>
|
||||
/// MP0 (2026-07-05) — the permanent honest frame profiler. One
|
||||
/// MP0 (2026-07-05) — the permanent honest frame profiler. One
|
||||
/// <c>FrameBoundary</c> call at the top of the accepted render transaction
|
||||
/// measures CPU frame time as the delta between consecutive boundaries
|
||||
/// (captures the FULL frame including present) and samples per-frame allocated
|
||||
|
|
@ -56,29 +56,29 @@ internal readonly record struct FrameHistoryRecord(
|
|||
/// <see cref="RenderingDiagnostics.FrameProfEnabled"/> is true; costs one
|
||||
/// bool check per frame when off.
|
||||
///
|
||||
/// <para>Permanent apparatus — every MP-track gate reads it; do not strip.
|
||||
/// <para>Permanent apparatus — every MP-track gate reads it; do not strip.
|
||||
/// Whole-frame GPU timing self-disables under <c>ACDREAM_WB_DIAG=1</c>
|
||||
/// (nested TimeElapsed is illegal GL; see GpuFrameTimer).</para>
|
||||
///
|
||||
/// <para>2026-07-24 measurement-tooling review — the aggregated report
|
||||
/// <para>2026-07-24 measurement-tooling review — the aggregated report
|
||||
/// resets its ring buffers every ~5 s (<see cref="FrameStatsBuffer.Reset"/>),
|
||||
/// so route-wide p50/p95/p99 distributions across a whole soak cannot be
|
||||
/// reconstructed after the fact. <see cref="RenderingDiagnostics.FrameHistoryPath"/>
|
||||
/// (<c>ACDREAM_FRAME_HISTORY=<path></c>) opts into a SEPARATE
|
||||
/// per-frame history: one <see cref="FrameHistoryRecord"/> per frame in a
|
||||
/// preallocated, grow-as-needed <see cref="List{T}"/> (1 int + 1 double +
|
||||
/// 7 longs ≈ 72 bytes/record; a multi-hour capture at 165 fps is roughly
|
||||
/// 165 * 3600 * 72 bytes ≈ 43 MB/hour — fine for a bounded diagnostic run,
|
||||
/// 7 longs ≈ 72 bytes/record; a multi-hour capture at 165 fps is roughly
|
||||
/// 165 * 3600 * 72 bytes ≈ 43 MB/hour — fine for a bounded diagnostic run,
|
||||
/// not for unattended day-long capture). Its initial capacity is about 9 MiB
|
||||
/// and covers the canonical route above 300 FPS without a frame-thread resize.
|
||||
/// ZERO frame-thread I/O: the CSV is written once, from
|
||||
/// <see cref="Dispose"/>, at shutdown. Recording only takes effect while
|
||||
/// <see cref="RenderingDiagnostics.FrameProfEnabled"/> is ALSO true — it
|
||||
/// <see cref="RenderingDiagnostics.FrameProfEnabled"/> is ALSO true — it
|
||||
/// reuses that instrumentation rather than duplicating it. Does not
|
||||
/// change the <c>[frame-prof]</c> report format or any existing metric.</para>
|
||||
/// Spec: docs/superpowers/specs/2026-07-05-modern-pipeline-design.md §5.
|
||||
/// Spec: docs/superpowers/specs/2026-07-05-modern-pipeline-design.md §5.
|
||||
/// </summary>
|
||||
internal sealed class FrameProfiler : IDisposable
|
||||
public sealed class FrameProfiler : IDisposable
|
||||
{
|
||||
private const int WindowCapacity = 2048; // ~12 s at 165 fps
|
||||
private const int HistoryInitialCapacity = 131072;
|
||||
|
|
@ -136,7 +136,7 @@ internal sealed class FrameProfiler : IDisposable
|
|||
if (_wasEnabled)
|
||||
{
|
||||
// Dispose (not just Stop) so a later re-enable rebuilds the
|
||||
// query ring fresh — a kept instance would poll slots left
|
||||
// query ring fresh — a kept instance would poll slots left
|
||||
// pending from BEFORE the pause and report temporally stale
|
||||
// GPU samples. Safe here: this runs at the top of OnRender
|
||||
// with the GL context current.
|
||||
|
|
@ -163,7 +163,7 @@ internal sealed class FrameProfiler : IDisposable
|
|||
{
|
||||
// First enabled frame (startup or runtime toggle-on): establish
|
||||
// baselines, emit nothing. Clear any stage ticks a StageScope
|
||||
// disposed after toggle-off may have accumulated mid-pause —
|
||||
// disposed after toggle-off may have accumulated mid-pause —
|
||||
// EndStage still runs on scopes that were live when the flag
|
||||
// flipped, and that partial delta must not leak into the first
|
||||
// re-enabled frame.
|
||||
|
|
@ -274,7 +274,7 @@ internal sealed class FrameProfiler : IDisposable
|
|||
internal void EndStage(FrameStage stage, long startTimestamp)
|
||||
=> _stageAccumTicks[(int)stage] += Stopwatch.GetTimestamp() - startTimestamp;
|
||||
|
||||
/// <summary>Pure report formatter — unit-tested; invariant culture.</summary>
|
||||
/// <summary>Pure report formatter — unit-tested; invariant culture.</summary>
|
||||
public static string FormatReport(
|
||||
int frameCount,
|
||||
FrameStatsBuffer cpu, FrameStatsBuffer gpu, bool gpuActive,
|
||||
|
|
@ -301,7 +301,7 @@ internal sealed class FrameProfiler : IDisposable
|
|||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>Pure CSV formatter — unit-tested; invariant culture. One header row plus one row per record.</summary>
|
||||
/// <summary>Pure CSV formatter — unit-tested; invariant culture. One header row plus one row per record.</summary>
|
||||
internal static void WriteHistoryCsv(
|
||||
IEnumerable<FrameHistoryRecord> records,
|
||||
TextWriter writer,
|
||||
|
|
@ -330,7 +330,7 @@ internal sealed class FrameProfiler : IDisposable
|
|||
|
||||
/// <summary>
|
||||
/// Shutdown-only write of the accumulated <see cref="_history"/> as CSV
|
||||
/// (the ONLY I/O this feature performs — never from <see cref="FrameBoundary"/>).
|
||||
/// (the ONLY I/O this feature performs — never from <see cref="FrameBoundary"/>).
|
||||
/// Failures are logged, not thrown: a history-export problem must never
|
||||
/// block the rest of the render-owner shutdown chain
|
||||
/// (<c>GameWindowLifetime</c>'s <c>Hard("frame profiler", ...)</c> stage).
|
||||
|
|
@ -355,7 +355,7 @@ internal sealed class FrameProfiler : IDisposable
|
|||
}
|
||||
|
||||
/// <summary>Disposable stage scope; default instance is a no-op.</summary>
|
||||
internal readonly struct StageScope : IDisposable
|
||||
public readonly struct StageScope : IDisposable
|
||||
{
|
||||
private readonly FrameProfiler? _owner;
|
||||
private readonly FrameStage _stage;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue