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:
Erik 2026-07-18 21:35:16 +02:00
parent 3971997689
commit 749e8ceeb1
225 changed files with 29107 additions and 3914 deletions

View file

@ -197,6 +197,45 @@ public sealed class ProjectileControllerTests
Assert.True(entity.Position.X > pendingPosition.X);
}
[Fact]
public void LandblockUnload_SuspendsProjectileAtVisibilityEdgeWithoutFrameScan()
{
var fixture = new Fixture();
LiveEntityRecord record = fixture.Spawn(instance: 1);
WorldEntity entity = record.WorldEntity!;
fixture.Engine.ShadowObjects.Register(
entity.Id,
entity.SourceGfxObjOrSetupId,
entity.Position,
entity.Rotation,
radius: 0.5f,
worldOffsetX: 0f,
worldOffsetY: 0f,
landblockId: 0x01010000u,
state: (uint)MissileState,
seedCellId: CellA);
Assert.True(fixture.Controller.TryBind(record, ProjectileSetup(), 1.0, 1, 1));
Assert.True(record.PhysicsBody!.InWorld);
Assert.True(record.PhysicsBody.IsActive);
Assert.Single(fixture.Live.SpatialProjectileRuntimes);
fixture.Spatial.RemoveLandblock(0x0101FFFFu);
Assert.False(record.IsSpatiallyVisible);
Assert.Empty(fixture.Live.SpatialProjectileRuntimes);
Assert.False(record.PhysicsBody.InWorld);
Assert.False(record.PhysicsBody.IsActive);
Assert.Equal(0, fixture.Engine.ShadowObjects.TotalRegistered);
fixture.Spatial.AddLandblock(EmptyLandblock(0x0101FFFFu));
Assert.Single(fixture.Live.SpatialProjectileRuntimes);
fixture.Controller.Tick(1.1, 1, 1, playerWorldPosition: null);
Assert.True(record.PhysicsBody.InWorld);
Assert.True(record.PhysicsBody.IsActive);
Assert.Equal(1, fixture.Engine.ShadowObjects.TotalRegistered);
}
[Fact]
public void LoadedLandblockCrossing_RebucketsSameProjection()
{
@ -909,7 +948,7 @@ public sealed class ProjectileControllerTests
body.Position = new Vector3(191f, 10f, 50f);
entity.SetPosition(body.Position);
remote.CellId = startCell;
Assert.True(fixture.Controller.LeaveWorld(Guid));
Assert.True(fixture.Controller.LeaveWorld(record));
fixture.Controller.Tick(1.6, 0xA9, 0xB4, playerWorldPosition: null);
Assert.True(body.InWorld);
Assert.Contains(
@ -1033,7 +1072,7 @@ public sealed class ProjectileControllerTests
new PickupEvent.Parsed(Guid, InstanceSequence: 4, PositionSequence: 2),
out _));
Assert.True(fixture.Live.WithdrawLiveEntityProjection(Guid));
Assert.True(fixture.Controller.LeaveWorld(Guid));
Assert.True(fixture.Controller.LeaveWorld(record));
Assert.DoesNotContain(
fixture.Engine.ShadowObjects.GetObjectsInCell(CellA),
entry => entry.EntityId == entity.Id);