fix(pipeline): MP1a - sink delegate restores immediate side-stage enqueue (exception-path faithfulness)
Coordinator-directed follow-up. The buffer-and-drain seam diverged from the original on the exception path: pre-MP1a, CollectEmittersFromScript enqueued particle-preload meshes DIRECTLY into _stagedMeshData mid-Prepare, so preloads staged before a later throw in the same Prepare* call (reachable via PrepareEnvCellMeshData side-staging during its StaticObjects loop, then PrepareCellStructMeshData throwing on a malformed-dat texture decode) were already safely enqueued. The drain version only flushed after a successful return — on throw, entries stranded on the shared extractor until an unrelated successful call flushed them, and were silently dropped on dispose. Fix: MeshExtractor takes an Action<ObjectMeshData>? sideStagedSink constructor parameter; the two CollectEmittersFromScript sites become _sideStagedSink?.Invoke(meshData) — the original code shape (immediate hand-off) at those exact lines. ObjectMeshManager wires the sink to _stagedMeshData.Enqueue, restoring the original immediate-enqueue semantics including on mid-Prepare throw. _sideStaged buffer, DrainSideStaged(), and the ProcessQueueAsync drain loop are deleted. The MP1b bake tool passes its own collector. Inventory doc updated: MP1a note now records the sink seam and the Content-owned upload enums, so its no-behavior-change claim is accurate. dotnet build green; full test suite 4059 passed / 0 failed / 4 skipped. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
5722681bf5
commit
932f904e00
3 changed files with 39 additions and 37 deletions
|
|
@ -167,7 +167,12 @@ namespace AcDream.App.Rendering.Wb {
|
|||
_graphicsDevice = graphicsDevice;
|
||||
_dats = dats;
|
||||
_logger = logger;
|
||||
_extractor = new MeshExtractor(_dats, _logger);
|
||||
// Side-stage sink: particle-preload meshes staged mid-extraction go
|
||||
// straight onto the staged-upload queue, exactly as the pre-MP1a code
|
||||
// did — immediate enqueue, surviving a later throw in the same
|
||||
// Prepare* call. ConcurrentQueue.Enqueue is thread-safe for the
|
||||
// extractor's up-to-4 concurrent decode workers.
|
||||
_extractor = new MeshExtractor(_dats, _logger, data => _stagedMeshData.Enqueue(data));
|
||||
_useModernRendering = _graphicsDevice.HasOpenGL43 && _graphicsDevice.HasBindless;
|
||||
if (_useModernRendering) {
|
||||
GlobalBuffer = new GlobalMeshBuffer(_graphicsDevice.GL);
|
||||
|
|
@ -475,12 +480,6 @@ namespace AcDream.App.Rendering.Wb {
|
|||
// If it's a direct setup or gfxobj, make sure background loads don't abort half-way
|
||||
data = _extractor.PrepareMeshData(id, isSetup, CancellationToken.None);
|
||||
}
|
||||
// MP1a: drain any mesh data the extractor staged as a side effect
|
||||
// (particle emitter GfxObj preloads inside CollectEmittersFromScript)
|
||||
// and enqueue it the same way the top-level result is enqueued below.
|
||||
foreach (var sideStaged in _extractor.DrainSideStaged()) {
|
||||
_stagedMeshData.Enqueue(sideStaged);
|
||||
}
|
||||
if (data != null) {
|
||||
lock (_cpuMeshCache) {
|
||||
if (_cpuMeshCache.Count >= _maxCpuCacheSize) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue