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

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.Threading;
namespace AcDream.Core.Chat;
@ -25,6 +26,7 @@ public sealed class ChatLog
private readonly ConcurrentQueue<ChatEntry> _buffer = new();
private readonly int _maxEntries;
private uint _localPlayerGuid;
private long _revision;
// Phase J follow-up: ACE often sends the same system text via two
// wire paths (GameMessageSystemChat 0xF7E0 + GameEventCommunication-
@ -51,6 +53,13 @@ public sealed class ChatLog
public int Count => _buffer.Count;
/// <summary>
/// Monotonic content revision. It advances after every successful append and
/// every explicit clear, allowing retained UI consumers to cache formatted
/// transcript layout without snapshotting the concurrent queue every frame.
/// </summary>
public long Revision => Interlocked.Read(ref _revision);
/// <summary>
/// Push the authoritative local-player GUID from <c>WorldSession</c>.
/// One-way setter — only <c>GameWindow</c> should call it, exactly
@ -301,12 +310,14 @@ public sealed class ChatLog
_buffer.Enqueue(entry);
while (_buffer.Count > _maxEntries)
_buffer.TryDequeue(out _);
Interlocked.Increment(ref _revision);
EntryAppended?.Invoke(entry);
}
public void Clear()
{
while (_buffer.TryDequeue(out _)) { /* drain */ }
Interlocked.Increment(ref _revision);
}
}