Gate TubeField expansion by planned packets

This commit is contained in:
Meta Vens 2026-05-26 22:55:38 +01:00
commit 0707d84ab1
3 changed files with 36 additions and 1 deletions

View file

@ -255,6 +255,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
private int activeTubeFieldTruncatedSegments;
private int activeTubeFieldIndirectDrawCount;
private int activeTubeFieldSkippedDrawBatches;
private int activeTubeFieldUnplannedLowerings;
private Viewport viewport;
private RawRect scissorRect;
private int width;
@ -2337,15 +2338,29 @@ public sealed class D3D12Renderer : IAquariumRenderer
activeTubeFieldTruncatedSegments = 0;
activeTubeFieldIndirectDrawCount = 0;
activeTubeFieldSkippedDrawBatches = 0;
activeTubeFieldUnplannedLowerings = 0;
tubeFieldDrawBatches.Clear();
if (tubeFieldComputePipelineState is null || activeFieldEvidenceFrame.TubeSplineLowerings.Count == 0)
{
return;
}
var plannedTubeFieldClaims = PlannedTubeFieldClaimKeys();
if (plannedTubeFieldClaims.Count == 0)
{
activeTubeFieldUnplannedLowerings = activeFieldEvidenceFrame.TubeSplineLowerings.Count;
return;
}
var segmentBase = 0;
foreach (var lowering in activeFieldEvidenceFrame.TubeSplineLowerings)
{
if (!plannedTubeFieldClaims.Contains(lowering.ClaimKey))
{
activeTubeFieldUnplannedLowerings++;
continue;
}
if (!lowering.IsValid ||
!fieldResourceRegistry.TryGetStructuredBuffer(lowering.ResourceKey, out var sourceBuffer))
{
@ -2423,6 +2438,21 @@ public sealed class D3D12Renderer : IAquariumRenderer
activeTubeFieldDrawIndexCount = activeTubeFieldDispatchedSegments * 6;
}
private HashSet<string> PlannedTubeFieldClaimKeys()
{
var planned = new HashSet<string>(StringComparer.Ordinal);
foreach (var packet in activeFieldLoweringPlan.Packets)
{
if (packet.Backend == AquariumFieldBackendKind.TubeField &&
packet.Encoding == AquariumFieldEncoding.Tube)
{
planned.Add(packet.ClaimKey);
}
}
return planned;
}
private void BindFractalReservoirConstants(ID3D12GraphicsCommandList activeCommandList, int splatDispatchCount)
{
activeCommandList.SetComputeRoot32BitConstant(RootFractalConstants, (uint)activeFractalReservoirField.SplatCount, 0);
@ -3071,6 +3101,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
$"truncated {activeTubeFieldTruncatedSegments:N0}; " +
$"indirect draws {activeTubeFieldIndirectDrawCount:N0}; " +
$"skipped draw batches {activeTubeFieldSkippedDrawBatches:N0}; " +
$"unplanned lowerings {activeTubeFieldUnplannedLowerings:N0}; " +
$"index draw count {activeTubeFieldDrawIndexCount:N0}; " +
$"budget {MaxTubeFieldSegments:N0}");
}

View file

@ -246,3 +246,4 @@
{"lesson":"Mesh layout authority is now split by source. Imported/user-facing mesh packages default to the engine standard `PositionNormalUvColor` vertex layout (48-byte position, normal, uv, color contract), which is the lane for FBX/OBJ-style assets. Generated meshes can declare `layout=PipelinePrivate`; those bytes belong to the selected lowering that emits and consumes them, so Fensalir does not force TubeField or future procedural surfaces through a bloated public vertex ABI. Fensalir build and Aquarium.Engine.Tests passed with 23 tests.","timestamp":"2026-05-26T21:58:00+01:00","files":["src/Aquarium.Engine.Contracts/Render/AquariumFieldEvidence.cs","src/Aquarium.Engine.Contracts/Render/AquariumFieldScriptCompiler.cs","src/Aquarium.Engine/Render/D3D12FieldMesh.cs","src/Aquarium.Engine/Render/D3D12FieldResourceRegistry.cs","tests/Aquarium.Engine.Tests/FieldScriptCompilerTests.cs","state/map.yaml"],"source":"user clarified imported mesh versus generated mesh layout authority","topic":"field-mesh-layout-authority"}
{"lesson":"TubeField now uses the first explicit pipeline-private generated mesh render lane. The compute path still owns the minimal D3D12TubeFieldVertex/index/indirect argument layout, but render now binds those buffers through a named D3D12PipelinePrivateGeneratedMesh before applying TubeField material root bindings and ExecuteIndirect. This implements the chosen generated-mesh option without creating a public imported-mesh renderer or forcing splines through PositionNormalUvColor. Fensalir build, Aquarium.Engine.Tests, and headless reload passed.","timestamp":"2026-05-26T22:49:00+01:00","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","state/map.yaml"],"source":"user chose pipeline-private generated mesh draw path for spline migration","topic":"pipeline-private-generated-mesh-rendering"}
{"lesson":"The generated-mesh DrawIndexed indirect ABI is no longer TubeField-owned. D3D12Renderer now creates a generic generatedMeshDrawCommandSignature with the standard five-uint D3D12 DrawIndexedArguments stride; TubeField still owns its compute-emitted argument buffer, but the command signature is reusable for future pipeline-private generated mesh lowerings. Fensalir build, Aquarium.Engine.Tests, and headless reload passed.","timestamp":"2026-05-26T22:52:00+01:00","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","state/map.yaml"],"source":"continued pipeline-private generated mesh migration","topic":"generated-mesh-indirect-draw-abi"}
{"lesson":"TubeField generated mesh dispatch now obeys AquariumFieldLoweringPlan selection authority. D3D12Renderer builds the planned TubeField claim set from backend packets and only expands matching TubeSplineLowerings; unplanned lowerings are counted in debug status instead of rendered. This prevents explicit lowering metadata from bypassing validation/planning. Fensalir build, Aquarium.Engine.Tests, and headless reload passed.","timestamp":"2026-05-26T22:55:00+01:00","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","state/map.yaml"],"source":"continued migration after generated mesh draw ABI","topic":"tubefield-planned-packet-authority"}

View file

@ -123,7 +123,10 @@ next_actions:
supplies the shader-specific source/ramp/constants. The DrawIndexed indirect
command signature is now owned by the generated-mesh lane rather than
TubeField, so future generated page/volume/surface lowerings can share that
draw ABI while owning their own producer buffers and materials.
draw ABI while owning their own producer buffers and materials. TubeField
dispatch now obeys selected packet authority: only lowerings whose claim has
a planned TubeField backend packet are expanded, and unplanned lowerings are
counted instead of rendered.
- Move any remaining client-only Epiphany state found here back to `E:\Projects\Aquarium-Engine`.
- Keep Mimir app/adapters out of this repo; Fensalir may expose generic sensor-fusion contracts only.
- Package contracts/host deliberately before replacing sibling source references in client repos.