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>
44 lines
1.4 KiB
C#
44 lines
1.4 KiB
C#
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);
|
|
}
|
|
}
|