fix(rendering): reconcile shadow roots from live runtime
Recover ordinary live roots from LiveEntityRuntime's canonical active spatial workset instead of relying on already-retained derived records. Keep attached children callback-authoritative, cache immutable selection geometry fingerprints, and pin zero-allocation retained update paths with regression tests. Release gate: 3,733 App tests / 3 skips; 8,217 complete-solution tests / 5 skips. Co-Authored-By: OpenAI Codex <codex@openai.com>
This commit is contained in:
parent
056bbd4efd
commit
91463db551
7 changed files with 272 additions and 15 deletions
|
|
@ -2,6 +2,7 @@ using System.Numerics;
|
|||
using AcDream.App.Rendering;
|
||||
using AcDream.App.Rendering.Scene;
|
||||
using AcDream.App.Rendering.Wb;
|
||||
using AcDream.Core.Selection;
|
||||
using AcDream.Core.World;
|
||||
|
||||
namespace AcDream.App.Tests.Rendering;
|
||||
|
|
@ -363,6 +364,48 @@ public sealed class CurrentRenderSceneOracleTests
|
|||
Assert.Empty(oracle.DispatcherCandidates);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SelectionGeometryFingerprint_IsCachedAndFrameStorageIsReused()
|
||||
{
|
||||
const int partCount = 1_000;
|
||||
var oracle = new CurrentRenderSceneOracle();
|
||||
var mesh = new RetailSelectionMesh(
|
||||
Vector3.Zero,
|
||||
2f,
|
||||
[new RetailSelectionPolygon(
|
||||
[
|
||||
new(-1f, -1f, 0f),
|
||||
new(1f, -1f, 0f),
|
||||
new(1f, 1f, 0f),
|
||||
new(-1f, 1f, 0f),
|
||||
],
|
||||
SingleSided: false)]);
|
||||
PublishSelectionFrame();
|
||||
long before = GC.GetAllocatedBytesForCurrentThread();
|
||||
|
||||
PublishSelectionFrame();
|
||||
|
||||
long allocated = GC.GetAllocatedBytesForCurrentThread() - before;
|
||||
Assert.Equal(partCount, oracle.Snapshot.SelectionPartCount);
|
||||
Assert.True(allocated == 0, $"Allocated {allocated:N0} bytes.");
|
||||
|
||||
void PublishSelectionFrame()
|
||||
{
|
||||
oracle.BeginSelectionFrame();
|
||||
for (int index = 0; index < partCount; index++)
|
||||
{
|
||||
oracle.ObserveSelectionPart(
|
||||
serverGuid: (uint)index + 1,
|
||||
localEntityId: (uint)index + 1,
|
||||
partIndex: index,
|
||||
gfxObjId: 0x0100_0001u,
|
||||
Matrix4x4.CreateTranslation(index, 0, 0),
|
||||
mesh);
|
||||
}
|
||||
oracle.CompleteSelectionFrame();
|
||||
}
|
||||
}
|
||||
|
||||
private static CurrentRenderProjectionFingerprint CaptureSingle(
|
||||
WorldEntity entity,
|
||||
uint landblockId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue