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
|
|
@ -179,6 +179,36 @@ public class ChatWindowControllerTests
|
|||
Assert.Contains(ctrl!.Input, bar!.Children);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TranscriptLayout_IsReusedUntilContentOrWidthChanges()
|
||||
{
|
||||
var (rootInfo, layout, vm) = BuildTestTree();
|
||||
var bus = new CaptureBus();
|
||||
var ctrl = ChatWindowController.Bind(
|
||||
rootInfo, layout, vm, () => bus, null, null, NoTex)!;
|
||||
|
||||
vm.ShowSystemMessage("one wrapped transcript line");
|
||||
IReadOnlyList<UiText.Line> first = ctrl.Transcript.LinesProvider();
|
||||
IReadOnlyList<UiText.Line> unchanged = ctrl.Transcript.LinesProvider();
|
||||
|
||||
Assert.Same(first, unchanged);
|
||||
Assert.Equal(1, ctrl.TranscriptLayoutBuildCount);
|
||||
|
||||
vm.ShowSystemMessage("second line");
|
||||
IReadOnlyList<UiText.Line> appended = ctrl.Transcript.LinesProvider();
|
||||
Assert.NotSame(first, appended);
|
||||
Assert.Equal(2, ctrl.TranscriptLayoutBuildCount);
|
||||
|
||||
ctrl.Transcript.Width -= 40f;
|
||||
IReadOnlyList<UiText.Line> resized = ctrl.Transcript.LinesProvider();
|
||||
Assert.NotSame(appended, resized);
|
||||
Assert.Equal(3, ctrl.TranscriptLayoutBuildCount);
|
||||
|
||||
vm.Clear();
|
||||
Assert.Empty(ctrl.Transcript.LinesProvider());
|
||||
Assert.Equal(4, ctrl.TranscriptLayoutBuildCount);
|
||||
}
|
||||
|
||||
// ── Test 4: Input.OnSubmit publishes SendChatCmd via the capture bus ─────
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -187,6 +187,55 @@ public sealed class RadarSnapshotProviderTests
|
|||
Assert.Equal(monster, Assert.Single(snapshot.Blips).ObjectId);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void BuildSnapshot_UsesBoundedSpatialCandidatesBeforeRetailProjection()
|
||||
{
|
||||
const uint player = 40u;
|
||||
const uint nearby = 41u;
|
||||
const uint unrelated = 42u;
|
||||
var objects = new ClientObjectTable();
|
||||
objects.Ingest(Weenie(player, "Player", ItemType.Creature));
|
||||
objects.Ingest(Weenie(nearby, "Nearby", ItemType.Creature) with
|
||||
{
|
||||
RadarBehavior = (byte)RadarBehavior.ShowAlways,
|
||||
});
|
||||
objects.Ingest(Weenie(unrelated, "Unrelated", ItemType.Creature) with
|
||||
{
|
||||
RadarBehavior = (byte)RadarBehavior.ShowAlways,
|
||||
});
|
||||
var entities = new Dictionary<uint, WorldEntity>
|
||||
{
|
||||
[player] = Entity(player, Vector3.Zero, Quaternion.Identity),
|
||||
[nearby] = Entity(nearby, new Vector3(5f, 0f, 0f), Quaternion.Identity),
|
||||
[unrelated] = Entity(unrelated, new Vector3(6f, 0f, 0f), Quaternion.Identity),
|
||||
};
|
||||
var spawns = entities.Keys.ToDictionary(guid => guid, Spawn);
|
||||
uint copiedCell = 0;
|
||||
int copiedRadius = -1;
|
||||
var provider = new RadarSnapshotProvider(
|
||||
objects,
|
||||
() => entities,
|
||||
() => spawns,
|
||||
playerGuid: () => player,
|
||||
playerYawRadians: () => 0f,
|
||||
playerCellId: () => 0xA9B40001u,
|
||||
selectedGuid: () => null,
|
||||
coordinatesOnRadar: () => true,
|
||||
uiLocked: () => false,
|
||||
copySpatialCandidates: (cell, radius, destination) =>
|
||||
{
|
||||
copiedCell = cell;
|
||||
copiedRadius = radius;
|
||||
destination.Add(new KeyValuePair<uint, WorldEntity>(nearby, entities[nearby]));
|
||||
});
|
||||
|
||||
UiRadarSnapshot snapshot = provider.BuildSnapshot();
|
||||
|
||||
Assert.Equal(0xA9B40001u, copiedCell);
|
||||
Assert.Equal(1, copiedRadius);
|
||||
Assert.Equal(nearby, Assert.Single(snapshot.Blips).ObjectId);
|
||||
}
|
||||
|
||||
private static WorldEntity Entity(uint guid, Vector3 position, Quaternion rotation) => new()
|
||||
{
|
||||
Id = guid,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue