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
|
|
@ -0,0 +1,44 @@
|
|||
using AcDream.App.Rendering;
|
||||
|
||||
namespace AcDream.App.Tests.Rendering;
|
||||
|
||||
public sealed class OwnerScopedResourceRegistryTests
|
||||
{
|
||||
[Fact]
|
||||
public void RepeatedAcquireBySameOwnerIsIdempotent()
|
||||
{
|
||||
var registry = new OwnerScopedResourceRegistry<string>();
|
||||
|
||||
Assert.True(registry.Acquire(1, "shared"));
|
||||
Assert.False(registry.Acquire(1, "shared"));
|
||||
Assert.Equal(1, registry.OwnerCount);
|
||||
Assert.Equal(1, registry.ResourceCount);
|
||||
Assert.Equal(["shared"], registry.ReleaseOwner(1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SharedResourceRetiresOnlyAfterFinalOwner()
|
||||
{
|
||||
var registry = new OwnerScopedResourceRegistry<string>();
|
||||
registry.Acquire(1, "shared");
|
||||
registry.Acquire(2, "shared");
|
||||
|
||||
Assert.Empty(registry.ReleaseOwner(1));
|
||||
Assert.Equal(1, registry.ResourceCount);
|
||||
Assert.Equal(["shared"], registry.ReleaseOwner(2));
|
||||
Assert.Equal(0, registry.ResourceCount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ReleaseOwnerReturnsAllNewlyUnownedResourcesOnce()
|
||||
{
|
||||
var registry = new OwnerScopedResourceRegistry<int>();
|
||||
registry.Acquire(7, 10);
|
||||
registry.Acquire(7, 20);
|
||||
|
||||
Assert.Equal([10, 20], registry.ReleaseOwner(7).Order());
|
||||
Assert.Empty(registry.ReleaseOwner(7));
|
||||
Assert.Equal(0, registry.OwnerCount);
|
||||
Assert.Equal(0, registry.ResourceCount);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue