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,5 +1,6 @@
using System;
using System.Collections.Generic;
using AcDream.Content;
using DatReaderWriter;
using DatReaderWriter.DBObjs;
using DatReaderWriter.Enums;
@ -179,7 +180,7 @@ public static class LayoutImporter
/// </summary>
/// <param name="dats">The dat collection to read the LayoutDesc from.</param>
/// <param name="layoutId">The LayoutDesc dat id to read.</param>
public static ElementInfo? ImportInfos(DatCollection dats, uint layoutId)
public static ElementInfo? ImportInfos(IDatReaderWriter dats, uint layoutId)
{
var ld = dats.Get<LayoutDesc>(layoutId);
if (ld is null) return null;
@ -234,7 +235,7 @@ public static class LayoutImporter
/// top-level template. DialogFactory uses this path for the shared dialog catalog.
/// </summary>
public static ElementInfo? ImportInfos(
DatCollection dats,
IDatReaderWriter dats,
uint layoutId,
uint rootElementId)
{
@ -273,7 +274,7 @@ public static class LayoutImporter
/// <param name="fontResolve">Optional per-element font resolver (see
/// <see cref="Build"/> for details). Null = original single-font behavior.</param>
public static ImportedLayout? Import(
DatCollection dats,
IDatReaderWriter dats,
uint layoutId,
Func<uint, (uint, int, int)> resolve,
UiDatFont? datFont,
@ -287,7 +288,7 @@ public static class LayoutImporter
/// <summary>Import one selected root from a catalog-style LayoutDesc.</summary>
public static ImportedLayout? Import(
DatCollection dats,
IDatReaderWriter dats,
uint layoutId,
uint rootElementId,
Func<uint, (uint, int, int)> resolve,
@ -314,7 +315,7 @@ public static class LayoutImporter
/// (cycle-guarded by <paramref name="baseChain"/>), then resolves + attaches children.
/// </summary>
private static ElementInfo Resolve(
DatCollection dats,
IDatReaderWriter dats,
ElementDesc d,
HashSet<(uint layoutId, uint elementId)> baseChain)
{
@ -369,7 +370,7 @@ public static class LayoutImporter
}
private static void IncorporateChildren(
DatCollection dats,
IDatReaderWriter dats,
ElementInfo result,
IReadOnlyList<ElementInfo>? baseChildren,
ElementDesc derived)
@ -406,7 +407,7 @@ public static class LayoutImporter
}
private static ElementInfo IncorporateResolvedChild(
DatCollection dats,
IDatReaderWriter dats,
ElementInfo baseChild,
ElementDesc derivedChild)
{