perf(diagnostics): expose prepared asset source counters

This commit is contained in:
Erik 2026-07-24 15:16:32 +02:00
parent 230a7df454
commit b1ad4b7c0a
5 changed files with 30 additions and 8 deletions

View file

@ -8,7 +8,7 @@
- C1 typed prepared-source boundary — `c42f93b3`
- C2 production renderer injection — `f05afc07`
- C3 activation probes and lookup precedence — implemented; automated gate
- C3 activation probes and lookup precedence — `230a7df4`; automated gate
green, connected exception-count gate remains in C4
- C4 connected equivalence and performance closeout — pending
@ -278,7 +278,8 @@ Commit as one semantic-cleanup unit.
Arwic with the same reference configuration.
5. Compare fixed-camera screenshots under the committed tolerance/mask rule.
6. Compare per-portal p99/allocation, process allocation/GC, exception count,
cache counters, and repeated-Caul ownership/memory to Slice A.
cache counters, prepared-source probes/reads/loaded/missing/corrupt totals,
and repeated-Caul ownership/memory to Slice A.
7. Run Release build and the complete Release suite.
8. Update the parent plan, roadmap, WorldBuilder inventory, divergence
register if and only if a real deviation changed, and durable memory.

View file

@ -901,7 +901,8 @@ internal sealed class LivePresentationCompositionPhase
foundation.Terrain,
foundation.SceneLighting,
foundation.MeshAdapter,
foundation.TextureCache)
foundation.TextureCache,
content.PreparedAssets)
: null;
var frameDiagnostics = new RenderFrameDiagnosticsController(
new RuntimeRenderFrameTitleFactsSource(

View file

@ -2,6 +2,7 @@ using AcDream.App.Rendering.Vfx;
using AcDream.App.Rendering.Wb;
using AcDream.App.Streaming;
using AcDream.App.World;
using AcDream.Content;
using AcDream.Core.Physics;
using AcDream.Core.Vfx;
using AcDream.Core.World;
@ -61,6 +62,7 @@ internal sealed class RuntimeRenderFrameResourceDiagnosticsSource :
private readonly SceneLightingUboBinding? _lighting;
private readonly WbMeshAdapter? _meshes;
private readonly TextureCache? _textures;
private readonly IPreparedAssetSource? _preparedAssets;
public RuntimeRenderFrameResourceDiagnosticsSource(
ParticleSystem? particles,
@ -74,7 +76,8 @@ internal sealed class RuntimeRenderFrameResourceDiagnosticsSource :
TerrainModernRenderer? terrain,
SceneLightingUboBinding? lighting,
WbMeshAdapter? meshes,
TextureCache? textures)
TextureCache? textures,
IPreparedAssetSource? preparedAssets)
{
_particles = particles;
_particleBindings = particleBindings;
@ -88,6 +91,7 @@ internal sealed class RuntimeRenderFrameResourceDiagnosticsSource :
_lighting = lighting;
_meshes = meshes;
_textures = textures;
_preparedAssets = preparedAssets;
}
public RenderFrameResourceDiagnosticsSnapshot Capture()
@ -98,6 +102,8 @@ internal sealed class RuntimeRenderFrameResourceDiagnosticsSource :
var mesh = meshManager?.Diagnostics ?? default;
var globalMesh = meshManager?.GlobalBuffer;
var cpuMesh = _meshes?.CpuMeshCacheDiagnostics ?? default;
PreparedAssetSourceStats prepared =
_preparedAssets?.Stats ?? default;
GCMemoryInfo gc = GC.GetGCMemoryInfo();
return new RenderFrameResourceDiagnosticsSnapshot(
@ -141,7 +147,12 @@ internal sealed class RuntimeRenderFrameResourceDiagnosticsSource :
_meshes?.LastMipmapBytes ?? 0,
globalMesh?.CapacityBytes ?? 0,
globalMesh?.PhysicalCapacityBytes ?? 0,
globalMesh?.IsMigrationInProgress ?? false),
globalMesh?.IsMigrationInProgress ?? false,
prepared.Probes,
prepared.Reads,
prepared.Loaded,
prepared.Missing,
prepared.Corrupt),
new TextureStreamResourceDiagnostics(
_textures?.OwnedBindlessTextureCount ?? 0,
_textures?.TextureOwnerCount ?? 0,

View file

@ -95,7 +95,12 @@ internal readonly record struct MeshStreamResourceDiagnostics(
long FrameMipmapBytes,
long GlobalCapacityBytes,
long GlobalPhysicalCapacityBytes,
bool GlobalMigrationInProgress);
bool GlobalMigrationInProgress,
long PreparedProbes,
long PreparedReads,
long PreparedLoaded,
long PreparedMissing,
long PreparedCorrupt);
internal readonly record struct TextureStreamResourceDiagnostics(
int OwnedBindlessTextures,
@ -254,6 +259,8 @@ internal sealed class RenderFrameDiagnosticsController :
+ $"mipmapFrame={mesh.FrameMipmapArrayCount}/{mesh.FrameMipmapBytes} "
+ $"meshCap={mesh.GlobalCapacityBytes} "
+ $"meshPhys={mesh.GlobalPhysicalCapacityBytes}/{mesh.GlobalMigrationInProgress} "
+ $"prepared={mesh.PreparedProbes}/{mesh.PreparedReads}/"
+ $"{mesh.PreparedLoaded}/{mesh.PreparedMissing}/{mesh.PreparedCorrupt} "
+ $"gpuTrack={process.TrackedGpuBytes}/{process.TrackedGpuBuffers}/"
+ $"{process.TrackedGpuTextures} "
+ $"managed={process.ManagedBytes}/{process.ManagedCommittedBytes} "

View file

@ -204,7 +204,8 @@ public sealed class RenderFrameDiagnosticsControllerTests
+ "lightBuffers=12 mesh=13/14/15 meshEst=16 meshUpload=17/18 "
+ "uploadFrame=19/20/21/22/23 bufferFrame=24/25/26/27 "
+ "staging=28/29/True/30 cpuMesh=31/32 mipmapFrame=33/34 meshCap=35 "
+ "meshPhys=36/True gpuTrack=57/58/59 managed=55/56 ownedTextures=37/38 "
+ "meshPhys=36/True prepared=60/61/62/63/64 "
+ "gpuTrack=57/58/59 managed=55/56 ownedTextures=37/38 "
+ "particleTextures=39/40/41/42/43 compositeCache=44/45/46 "
+ "compositeAtlas=47/48 compositeUpload=49/50/51",
actual);
@ -314,7 +315,8 @@ public sealed class RenderFrameDiagnosticsControllerTests
new DynamicBufferResourceDiagnostics(4, 5, 6, 7, 8, 9, 10, 11, 12),
new MeshStreamResourceDiagnostics(
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
24, 25, 26, 27, 28, 29, true, 30, 31, 32, 33, 34, 35, 36, true),
24, 25, 26, 27, 28, 29, true, 30, 31, 32, 33, 34, 35, 36, true,
60, 61, 62, 63, 64),
new TextureStreamResourceDiagnostics(
37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51),
new ProcessResourceDiagnostics(55, 56, 57, 58, 59));