fix #225: stabilize render pacing and frame CPU
Replace scheduler-quantized software sleeps with a reusable Windows high-resolution deadline timer, expose pacing in the frame profiler, and make shutdown wake every persistent mesh worker without losing the shared signal. Preserve retail alpha order while using a stable radix, skip duplicate deferred-alpha SSBO packing, pack light sets, cache static selection descriptors, and retire historical material groups at the whole-frame boundary. The fixed dense-Caul sample improved from roughly 9-12 ms CPU to 5.3-6.2 ms without reducing visual quality. Release build succeeds with zero warnings and all 6,300 tests pass with five intentional skips. Three independent retail, architecture, and adversarial reviews are clean; the post-review connected route remains pending because local ACE is offline. Co-authored-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
parent
47d7086a74
commit
3718e341be
17 changed files with 1103 additions and 225 deletions
|
|
@ -354,6 +354,29 @@ namespace AcDream.App.Rendering.Wb
|
|||
private readonly ManualResetEventSlim _preparationWorkAvailable = new(false);
|
||||
private const int MaxParallelLoads = 4;
|
||||
|
||||
internal enum PreparationWorkerWakeAction
|
||||
{
|
||||
Process,
|
||||
ResetAndWait,
|
||||
Exit,
|
||||
}
|
||||
|
||||
internal static PreparationWorkerWakeAction DecidePreparationWorkerWake(
|
||||
bool isDisposed,
|
||||
bool hasPendingRequests,
|
||||
bool stagingAtHighWater,
|
||||
bool arenaBackpressured)
|
||||
{
|
||||
// Shutdown has priority over every ordinary idle/backpressure state.
|
||||
// Dispose sets one shared manual-reset signal for all persistent
|
||||
// workers; no worker may reset that signal before its peers wake.
|
||||
if (isDisposed)
|
||||
return PreparationWorkerWakeAction.Exit;
|
||||
if (!hasPendingRequests || stagingAtHighWater || arenaBackpressured)
|
||||
return PreparationWorkerWakeAction.ResetAndWait;
|
||||
return PreparationWorkerWakeAction.Process;
|
||||
}
|
||||
|
||||
private sealed class ObjectReleaseTicket(
|
||||
ulong id,
|
||||
ObjectRenderData data,
|
||||
|
|
@ -911,14 +934,20 @@ namespace AcDream.App.Rendering.Wb
|
|||
{
|
||||
// IsDisposed re-check lets Dispose cancel and join every
|
||||
// tracked worker before the DAT mappings are released.
|
||||
if (IsDisposed
|
||||
|| _pendingRequests.Count == 0
|
||||
|| _stagedMeshData.IsAtHighWater
|
||||
|| _arenaBackpressured)
|
||||
// Exit WITHOUT resetting the shared manual-reset event:
|
||||
// Dispose sets it once to wake all four persistent workers.
|
||||
// If the first worker reset it, the remaining three slept
|
||||
// forever and graceful client shutdown deadlocked.
|
||||
PreparationWorkerWakeAction wakeAction = DecidePreparationWorkerWake(
|
||||
IsDisposed,
|
||||
_pendingRequests.Count != 0,
|
||||
_stagedMeshData.IsAtHighWater,
|
||||
_arenaBackpressured);
|
||||
if (wakeAction == PreparationWorkerWakeAction.Exit)
|
||||
return;
|
||||
if (wakeAction == PreparationWorkerWakeAction.ResetAndWait)
|
||||
{
|
||||
_preparationWorkAvailable.Reset();
|
||||
if (IsDisposed)
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue