fix(streaming): retire stale portal-region entities
Port retail's 25-second leave-visibility lifetime over canonical live records, retaining spatially resident and owned entities while using the conservative ACE visibility envelope for nonresident records. Route expiry through the normal generation-safe F747 teardown so animations, effects, physics, and render owners unwind symmetrically. Replace the append-only modern mesh buffer with coalescing vertex/index ranges and upload each mesh's vertices once instead of once per material. Released zero-reference meshes can now reuse GPU ranges after portal and cache churn. A connected five-region round trip returned animation ownership to baseline, recreated the starting region on revisit, and held normal FPS. Release build succeeds and all 5,927 tests pass with five intentional skips. Co-authored-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
parent
2cbf34a668
commit
3971997689
13 changed files with 918 additions and 117 deletions
|
|
@ -29,6 +29,7 @@ namespace AcDream.App.Rendering.Wb {
|
|||
public uint VBO { get; set; }
|
||||
public int VertexCount { get; set; }
|
||||
public List<ObjectRenderBatch> Batches { get; set; } = new();
|
||||
internal GlobalMeshAllocation? GlobalAllocation { get; set; }
|
||||
public bool IsSetup { get; set; }
|
||||
public List<(ulong GfxObjId, Matrix4x4 Transform)> SetupParts { get; set; } = new();
|
||||
|
||||
|
|
@ -712,9 +713,17 @@ namespace AcDream.App.Rendering.Wb {
|
|||
|
||||
var gl = _graphicsDevice.GL;
|
||||
uint vao = 0, vbo = 0;
|
||||
var modernIndexBatches = meshData.TextureBatches.Values
|
||||
.SelectMany(batches => batches)
|
||||
.Where(batch => batch.Indices.Count != 0)
|
||||
.Select(batch => batch.Indices.ToArray())
|
||||
.ToArray();
|
||||
GlobalMeshAllocation? globalAllocation = null;
|
||||
|
||||
if (_useModernRendering) {
|
||||
// Everything goes into the global VBO/IBO
|
||||
// One mesh owns one vertex range and one contiguous index
|
||||
// range. The former append path duplicated the full vertex
|
||||
// array per material and never reclaimed evicted ranges.
|
||||
vao = GlobalBuffer!.VAO;
|
||||
vbo = GlobalBuffer!.VBO;
|
||||
}
|
||||
|
|
@ -787,9 +796,6 @@ namespace AcDream.App.Rendering.Wb {
|
|||
|
||||
if (_useModernRendering) {
|
||||
ibo = GlobalBuffer!.IBO;
|
||||
var appended = GlobalBuffer.Append(meshData.Vertices, batch.Indices.ToArray());
|
||||
batchBaseVertex = appended.baseVertex;
|
||||
firstIndex = (uint)appended.firstIndex;
|
||||
}
|
||||
else {
|
||||
gl.GenBuffers(1, out ibo);
|
||||
|
|
@ -824,11 +830,25 @@ namespace AcDream.App.Rendering.Wb {
|
|||
}
|
||||
}
|
||||
|
||||
if (_useModernRendering && modernIndexBatches.Length != 0) {
|
||||
globalAllocation = GlobalBuffer!.UploadMesh(meshData.Vertices, modernIndexBatches);
|
||||
if (renderBatches.Count != globalAllocation.BatchFirstIndices.Count) {
|
||||
GlobalBuffer.Release(globalAllocation);
|
||||
throw new InvalidOperationException("Global mesh batch allocation count mismatch.");
|
||||
}
|
||||
|
||||
for (int i = 0; i < renderBatches.Count; i++) {
|
||||
renderBatches[i].BaseVertex = (uint)globalAllocation.Vertices.Offset;
|
||||
renderBatches[i].FirstIndex = (uint)globalAllocation.BatchFirstIndices[i];
|
||||
}
|
||||
}
|
||||
|
||||
var renderData = new ObjectRenderData {
|
||||
VAO = vao,
|
||||
VBO = vbo,
|
||||
VertexCount = meshData.Vertices.Length,
|
||||
Batches = renderBatches,
|
||||
GlobalAllocation = globalAllocation,
|
||||
ParticleEmitters = meshData.ParticleEmitters,
|
||||
DIDDegrade = meshData.DIDDegrade,
|
||||
CPUPositions = meshData.Vertices.Select(v => v.Position).ToArray(),
|
||||
|
|
@ -958,6 +978,10 @@ namespace AcDream.App.Rendering.Wb {
|
|||
}
|
||||
}
|
||||
else {
|
||||
if (data.GlobalAllocation is { } allocation) {
|
||||
GlobalBuffer!.Release(allocation);
|
||||
data.GlobalAllocation = null;
|
||||
}
|
||||
foreach (var batch in data.Batches) {
|
||||
if (batch.Atlas != null) {
|
||||
batch.Atlas.ReleaseTexture(batch.Key);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue