fix(rendering): bound portal resource lifetime
Separate logical ownership, render publication, and GPU retirement across live entities, landblocks, particles, textures, mesh arenas, portal/UI teardown, and per-frame scratch storage. Add bounded DAT/texture caches, upload budgets, three-frame fence retirement, exact-incarnation appearance reconciliation, frame pacing, and extensive lifetime conformance coverage.\n\nThe seven-destination connected route now cuts peak working/private memory roughly in half, returns Caul to 125-153 FPS locally, and produces no WER or AMD reset.\n\nCo-authored-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
parent
3971997689
commit
749e8ceeb1
225 changed files with 29107 additions and 3914 deletions
|
|
@ -1,4 +1,5 @@
|
|||
using AcDream.App.Rendering;
|
||||
using AcDream.App.Rendering.Wb;
|
||||
using AcDream.Content.Vfx;
|
||||
using AcDream.Core.Meshing;
|
||||
using AcDream.Core.Vfx;
|
||||
|
|
@ -78,6 +79,115 @@ public sealed class RetailParticleGeometryClassifierTests
|
|||
Assert.Equal(new[] { 0x01001666u, 0x01001667u }, decrements);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MeshReferenceTracker_retriesAcquireThatFailedBeforeCommit()
|
||||
{
|
||||
int attempts = 0;
|
||||
var increments = new List<uint>();
|
||||
using var tracker = new ParticleMeshReferenceTracker(
|
||||
id =>
|
||||
{
|
||||
attempts++;
|
||||
if (attempts == 1)
|
||||
throw new InvalidOperationException("before commit");
|
||||
increments.Add(id);
|
||||
},
|
||||
_ => { });
|
||||
|
||||
Assert.Throws<InvalidOperationException>(() => tracker.Register(7, 0x01001666u));
|
||||
tracker.Register(7, 0x01001666u);
|
||||
|
||||
Assert.Equal([0x01001666u], increments);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MeshReferenceTracker_doesNotRepeatAcquireThatCommittedBeforeThrowing()
|
||||
{
|
||||
int attempts = 0;
|
||||
using var tracker = new ParticleMeshReferenceTracker(
|
||||
_ =>
|
||||
{
|
||||
attempts++;
|
||||
throw new MeshReferenceMutationException(
|
||||
"after commit",
|
||||
mutationCommitted: true,
|
||||
new InvalidOperationException());
|
||||
},
|
||||
_ => { });
|
||||
|
||||
Assert.Throws<MeshReferenceMutationException>(() => tracker.Register(7, 0x01001666u));
|
||||
tracker.Register(7, 0x01001666u);
|
||||
|
||||
Assert.Equal(1, attempts);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MeshReferenceTracker_retriesReleaseWithoutRepeatingCommittedMutation()
|
||||
{
|
||||
int attempts = 0;
|
||||
var tracker = new ParticleMeshReferenceTracker(_ => { }, _ =>
|
||||
{
|
||||
attempts++;
|
||||
if (attempts == 1)
|
||||
throw new InvalidOperationException("before commit");
|
||||
});
|
||||
tracker.Register(7, 0x01001666u);
|
||||
|
||||
Assert.Throws<InvalidOperationException>(() => tracker.Release(7));
|
||||
tracker.Release(7);
|
||||
tracker.Release(7);
|
||||
|
||||
Assert.Equal(2, attempts);
|
||||
tracker.Dispose();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MeshReferenceTracker_disposeAttemptsEveryOwnerAndCanResume()
|
||||
{
|
||||
bool failFirst = true;
|
||||
var releases = new List<uint>();
|
||||
var tracker = new ParticleMeshReferenceTracker(_ => { }, id =>
|
||||
{
|
||||
if (id == 0x01001666u && failFirst)
|
||||
{
|
||||
failFirst = false;
|
||||
throw new InvalidOperationException("before commit");
|
||||
}
|
||||
releases.Add(id);
|
||||
});
|
||||
tracker.Register(7, 0x01001666u);
|
||||
tracker.Register(8, 0x01001667u);
|
||||
|
||||
Assert.Throws<AggregateException>(() => tracker.Dispose());
|
||||
Assert.Contains(0x01001667u, releases);
|
||||
tracker.Dispose();
|
||||
|
||||
Assert.Equal(1, releases.Count(id => id == 0x01001666u));
|
||||
Assert.Equal(1, releases.Count(id => id == 0x01001667u));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MeshReferenceTracker_releaseReentryDuringAcquireReconcilesWithoutLeak()
|
||||
{
|
||||
ParticleMeshReferenceTracker? tracker = null;
|
||||
int increments = 0;
|
||||
int decrements = 0;
|
||||
tracker = new ParticleMeshReferenceTracker(
|
||||
_ =>
|
||||
{
|
||||
increments++;
|
||||
tracker!.Release(7);
|
||||
},
|
||||
_ => decrements++);
|
||||
|
||||
tracker.Register(7, 0x01001666u);
|
||||
tracker.Release(7);
|
||||
tracker.Dispose();
|
||||
|
||||
Assert.Equal(1, increments);
|
||||
Assert.Equal(1, decrements);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BlendResolver_corruptSurfaceFallsBackAndReportsItsDid()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue