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
36
src/AcDream.App/Rendering/OrderedResourceTeardown.cs
Normal file
36
src/AcDream.App/Rendering/OrderedResourceTeardown.cs
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
namespace AcDream.App.Rendering;
|
||||
|
||||
/// <summary>
|
||||
/// Runs dependency-ordered resource teardown one stage at a time. A failed
|
||||
/// stage remains current, so a later <see cref="Advance"/> retries exactly
|
||||
/// that owner before any dependent resource can be destroyed.
|
||||
/// </summary>
|
||||
internal sealed class OrderedResourceTeardown(params Action[] stages)
|
||||
{
|
||||
private readonly Action[] _stages = stages ?? throw new ArgumentNullException(nameof(stages));
|
||||
private int _nextStage;
|
||||
private bool _advancing;
|
||||
|
||||
public bool IsComplete => _nextStage == _stages.Length;
|
||||
internal int NextStage => _nextStage;
|
||||
|
||||
public void Advance()
|
||||
{
|
||||
if (_advancing || IsComplete)
|
||||
return;
|
||||
|
||||
_advancing = true;
|
||||
try
|
||||
{
|
||||
while (_nextStage < _stages.Length)
|
||||
{
|
||||
_stages[_nextStage]();
|
||||
_nextStage++;
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_advancing = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue