From f536385e1abb22734357e3844d503b03f6ce8872 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 26 May 2026 23:01:05 +0100 Subject: [PATCH] Emit Mimir TubeSpline field lowerings --- docs/fensalir-rendering-rebuild-migration.md | 5 +- docs/implementation-plan.md | 5 +- notes/current-system-map.md | 2 + src/Mimir.BufferSmoke/Program.cs | 5 +- .../MimirFensalirFieldLowering.cs | 59 +++++++++++++++++++ state/evidence.jsonl | 1 + state/map.yaml | 5 +- 7 files changed, 77 insertions(+), 5 deletions(-) diff --git a/docs/fensalir-rendering-rebuild-migration.md b/docs/fensalir-rendering-rebuild-migration.md index 9002722..45c7551 100644 --- a/docs/fensalir-rendering-rebuild-migration.md +++ b/docs/fensalir-rendering-rebuild-migration.md @@ -225,8 +225,9 @@ shared ABI; TubeField only owns the argument buffer it emits. TubeField expansion is now gated by selected backend packets, so explicit lowering metadata cannot bypass validation/planning authority. Validation also rejects TubeSpline metadata whose claim is not Tube-encoded or whose resource differs -from the claim payload. That is engine ownership, not a reason for Mimir to -create a parallel renderer. +from the claim payload. Mimir's typed surface-intent lowering now emits the +matching TubeSpline metadata for audio spectrum/waveform Tube claims. That is +engine ownership, not a reason for Mimir to create a parallel renderer. ### 3. Calibration Constraint diff --git a/docs/implementation-plan.md b/docs/implementation-plan.md index be71ae0..995a08e 100644 --- a/docs/implementation-plan.md +++ b/docs/implementation-plan.md @@ -198,7 +198,10 @@ a named invariant that the native runtime cannot protect yet. backend packet plan; unplanned `TubeSplineLowering` records are counted but not expanded. Fensalir validation also rejects TubeSpline lowering metadata whose claim is not Tube-encoded or whose resource differs from the claim - payload. + payload. Mimir's typed surface-intent lowering now emits the matching + `AquariumFieldTubeSplineLowering` for audio spectrum/waveform Tube claims, so + the real Mimir producer supplies both the planned packet and the generated + mesh producer metadata. - `MimirRuntime` queues bioacoustic timeline PCM through Fensalir audio when the active timing witness is allowed. `MimirAudioSynchronizationSettings.Mode` selects `chirp-only`, `passive`, or `hybrid`; passive disables active diff --git a/notes/current-system-map.md b/notes/current-system-map.md index 86ff65a..6013650 100644 --- a/notes/current-system-map.md +++ b/notes/current-system-map.md @@ -352,6 +352,8 @@ state. The DrawIndexed indirect command signature has been lifted to the generated-mesh lane instead of being TubeField-owned. TubeField expansion now requires a planned TubeField backend packet for the lowering's claim, and validation rejects TubeSpline metadata whose claim/resource authority is split. +Mimir's typed surface-intent lowering now emits the matching TubeSpline +lowering for audio spectrum/waveform Tube claims. The current teardown/migration map is `docs/fensalir-rendering-rebuild-migration.md`, paired with Fensalir's diff --git a/src/Mimir.BufferSmoke/Program.cs b/src/Mimir.BufferSmoke/Program.cs index 7fcf7d7..c057ae5 100644 --- a/src/Mimir.BufferSmoke/Program.cs +++ b/src/Mimir.BufferSmoke/Program.cs @@ -542,7 +542,7 @@ static int RunFensalirFieldEvidenceSmoke() var plan = AquariumFieldLoweringPlanner.Plan(frame); Console.WriteLine( - $"fensalir-field-evidence-smoke domains={frame.Domains.Count} resources={frame.Resources.Count} claims={frame.Claims.Count} candidates={frame.Candidates.Count} packets={frame.BackendPackets.Count} requests={requests.Count} planned={plan.Packets.Count} deferred={plan.DeferredRequests.Count} errors={validation.HasErrors}"); + $"fensalir-field-evidence-smoke domains={frame.Domains.Count} resources={frame.Resources.Count} claims={frame.Claims.Count} candidates={frame.Candidates.Count} tubeLowerings={frame.TubeSplineLowerings.Count} packets={frame.BackendPackets.Count} requests={requests.Count} planned={plan.Packets.Count} deferred={plan.DeferredRequests.Count} errors={validation.HasErrors}"); if (validation.HasErrors) { @@ -557,6 +557,9 @@ static int RunFensalirFieldEvidenceSmoke() frame.Resources[0].ResourceKey == MimirFensalirBridgeMapper.ResourceKeyForPayload(window.Payload) && frame.BackendPackets.Count == 0 && frame.Claims.Count == 3 && + frame.TubeSplineLowerings.Count == 1 && + frame.TubeSplineLowerings[0].ClaimKey == plan.Packets[0].ClaimKey && + frame.TubeSplineLowerings[0].ResourceKey == frame.Resources[0].ResourceKey && frame.Claims.Any(claim => claim.PayloadHandle == frame.Resources[0].ResourceKey) && requests.Count == 3 && requests.All(static request => request.IsPendingBackendSelection) && diff --git a/src/Mimir.Runtime/Synchronization/MimirFensalirFieldLowering.cs b/src/Mimir.Runtime/Synchronization/MimirFensalirFieldLowering.cs index fa74bbf..563542c 100644 --- a/src/Mimir.Runtime/Synchronization/MimirFensalirFieldLowering.cs +++ b/src/Mimir.Runtime/Synchronization/MimirFensalirFieldLowering.cs @@ -25,6 +25,7 @@ public sealed class MimirFensalirFieldLowering(MimirFensalirLoweringOptions? opt var candidates = new List(); var packets = new List(); var resources = new List(); + var tubeSplineLowerings = new List(); var seenResources = new HashSet(StringComparer.Ordinal); var seenDomains = new HashSet(StringComparer.Ordinal); @@ -67,6 +68,10 @@ public sealed class MimirFensalirFieldLowering(MimirFensalirLoweringOptions? opt claim.Confidence, Math.Max(0.0f, (float)intent.SupportPolicy.MaximumAgeSeconds)); candidates.Add(CandidateForClaim(claim, guide)); + if (TryBuildTubeSplineLowering(intent, claim, resources, out var tubeSplineLowering)) + { + tubeSplineLowerings.Add(tubeSplineLowering); + } } return new AquariumFieldEvidenceFrame @@ -76,6 +81,7 @@ public sealed class MimirFensalirFieldLowering(MimirFensalirLoweringOptions? opt Candidates = candidates, BackendPackets = packets, Resources = resources, + TubeSplineLowerings = tubeSplineLowerings, AccumulationWindowSeconds = (float)options.AccumulationWindowSeconds, PresentationDelaySeconds = (float)options.PresentationDelaySeconds }; @@ -433,6 +439,59 @@ public sealed class MimirFensalirFieldLowering(MimirFensalirLoweringOptions? opt Proposal: claim.Proposal, Guide: guide); + private static bool TryBuildTubeSplineLowering( + MimirSurfaceIntent intent, + AquariumFieldClaim claim, + IReadOnlyList resources, + out AquariumFieldTubeSplineLowering lowering) + { + lowering = default; + if (claim.Encoding != AquariumFieldEncoding.Tube || + string.IsNullOrWhiteSpace(claim.PayloadHandle)) + { + return false; + } + + var resource = resources.FirstOrDefault(resource => string.Equals(resource.ResourceKey, claim.PayloadHandle, StringComparison.Ordinal)); + if (!resource.HasIdentity || + resource.Kind is not (AquariumFieldResourceKind.StructuredBuffer or AquariumFieldResourceKind.CurvePointBuffer)) + { + return false; + } + + var width = Math.Max(2, resource.Width); + var height = Math.Max(1, resource.Height); + var axisStepX = width > 1 ? 10.0f / (width - 1) : 10.0f; + lowering = new AquariumFieldTubeSplineLowering( + LoweringKey: $"tube-spline:{intent.IntentKey}", + ClaimKey: claim.ClaimKey, + ResourceKey: resource.ResourceKey, + Width: width, + Height: height, + StrideBytes: Math.Max(4, resource.StrideBytes), + FirstColumn: 0, + ColumnCount: height, + ColumnStride: 1, + RollingModulo: height, + RollingOffset: 0, + Origin: new Vector3(-5.0f, 0.0f, 0.0f), + AxisStep: new Vector3(axisStepX, 0.0f, 0.0f), + ColumnStep: new Vector3(0.0f, 0.0f, 0.1f), + AmplitudePower: 2.0f, + AmplitudeScale: 1.0f, + NormalizeMin: 0.0f, + NormalizeMax: 1.0f, + BaseRadius: 0.012f, + RadiusScale: 0.030f, + Alpha: 0.92f, + Feather: 0.20f, + RampTexturePath: "", + RampResourceKey: "", + EmissionScale: 10.0f, + CatmullRomSubdivisions: 4).Normalized(); + return true; + } + private AquariumFieldSupport SupportForTiming(long uncertaintyNs) { var radius = Math.Max(options.DefaultSupportRadius, (float)(Math.Max(0, uncertaintyNs) / 1_000_000_000.0)); diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 63811a4..7d3efae 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -155,3 +155,4 @@ {"ts": "2026-05-26T22:52:00+01:00", "type": "implementation", "status": "ok", "note": "Fensalir lifted the DrawIndexed indirect command signature from TubeField to the generated-mesh lane. TubeField still emits its own indirect argument buffer, but future pipeline-private generated mesh lowerings can share the same five-uint D3D12 DrawIndexedArguments ABI with their own producer buffers/material bindings."} {"ts": "2026-05-26T22:55:00+01:00", "type": "implementation", "status": "ok", "note": "Fensalir TubeField expansion now follows selected backend packet authority. D3D12Renderer expands only TubeSplineLowerings whose claim has a planned TubeField packet; unplanned lowerings are counted in debug status instead of rendered. This prevents explicit lowering metadata from bypassing validation/planning."} {"ts": "2026-05-26T22:58:00+01:00", "type": "implementation", "status": "ok", "note": "Fensalir validation now rejects TubeSpline lowering metadata if the referenced claim is not Tube-encoded or if the lowering resource differs from the claim payload resource. TubeField split authority is caught at validation, before renderer packet gating. Fensalir build/tests/headless reload passed."} +{"ts": "2026-05-26T23:03:00+01:00", "type": "implementation", "status": "ok", "note": "Mimir's typed Fensalir surface-intent lowering now emits AquariumFieldTubeSplineLowering metadata for audio spectrum/waveform Tube claims. The hardware-free field evidence smoke now proves one resource, three claims, one TubeSpline lowering, one planned TubeField packet, and two deferred non-backend claims; the DSL smoke still proves resource-bound TubeSpline lowering with ramp binding."} diff --git a/state/map.yaml b/state/map.yaml index 40fedf7..5123fd0 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -347,7 +347,10 @@ accepted_design: gated by the selected backend packet plan, so lowering metadata cannot bypass validation/planning authority. Validation also rejects TubeSpline lowering metadata if its claim is not Tube-encoded or if its resource does - not match the claim payload. + not match the claim payload. Mimir's typed surface-intent lowering now emits + TubeSpline lowering metadata for audio spectrum/waveform Tube claims, so the + generated mesh path is fed by real Mimir evidence rather than only the DSL + smoke. - `config/perfect-machine.example.json` declares live owners, sensors, reservoir views, and runtime policy. - `src/Mimir.Runtime/Synchronization` now includes the Perfect Machine module