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,46 @@
|
|||
using AcDream.App.Rendering;
|
||||
using AcDream.App.Rendering.Wb;
|
||||
|
||||
namespace AcDream.App.Tests.Rendering;
|
||||
|
||||
public sealed class FixedEntityTextureOwnerLeaseTests
|
||||
{
|
||||
[Fact]
|
||||
public void RepeatedReplacementReleasesHistoricalKeysForTheFixedOwner()
|
||||
{
|
||||
const uint owner = 42;
|
||||
var lifetime = new RegistryLifetime();
|
||||
using var lease = new FixedEntityTextureOwnerLease(lifetime, owner);
|
||||
|
||||
lease.Replace(hasReplacement: true);
|
||||
lifetime.Acquire(owner, "first");
|
||||
Assert.Equal(1, lifetime.ResourceCount);
|
||||
|
||||
lease.Replace(hasReplacement: true);
|
||||
lifetime.Acquire(owner, "second");
|
||||
Assert.Equal(1, lifetime.ResourceCount);
|
||||
|
||||
lease.Replace(hasReplacement: true);
|
||||
lifetime.Acquire(owner, "third");
|
||||
Assert.Equal(1, lifetime.ResourceCount);
|
||||
|
||||
lease.Replace(hasReplacement: false);
|
||||
Assert.Equal(0, lifetime.ResourceCount);
|
||||
Assert.Equal(3, lifetime.ReleaseCount);
|
||||
}
|
||||
|
||||
private sealed class RegistryLifetime : IEntityTextureLifetime
|
||||
{
|
||||
private readonly OwnerScopedResourceRegistry<string> _registry = new();
|
||||
public int ResourceCount => _registry.ResourceCount;
|
||||
public int ReleaseCount { get; private set; }
|
||||
|
||||
public void Acquire(uint owner, string key) => _registry.Acquire(owner, key);
|
||||
|
||||
public void ReleaseOwner(uint localEntityId)
|
||||
{
|
||||
ReleaseCount++;
|
||||
_registry.ReleaseOwner(localEntityId);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue