From 0132e63a49fea03d22b7027787f6391e24f8440b Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Tue, 26 May 2026 20:38:26 +0100 Subject: [PATCH] Record Fensalir texture resource binding --- docs/implementation-plan.md | 17 ++++++++++------- src/Mimir.BufferSmoke/Program.cs | 9 ++++++--- state/evidence.jsonl | 1 + state/map.yaml | 15 +++++++++------ 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/docs/implementation-plan.md b/docs/implementation-plan.md index 35fdf5d..89ee47c 100644 --- a/docs/implementation-plan.md +++ b/docs/implementation-plan.md @@ -163,13 +163,16 @@ a named invariant that the native runtime cannot protect yet. - Fensalir now owns the first in-process D3D12 field resource resolver cut: shared structured/curve buffer resources import/alias GPU-resident handles, and Fensalir-owned resources allocate GPU slots only when Fensalir is the - producer. Mimir-declared rendering buffers are Fensalir GPU resources in the - same runtime and should not round-trip through CPU payloads. The TubeField DSL - can now describe a 2D rolling float buffer as Catmull-Rom XY tubes with - modulo column addressing, amplitude power/normalization, radius, ramp texture - path, and emission scale. Visible rendering still needs shader-side expansion - and binding over those GPU-resident slots; texture, mesh, surface-page, and - volume resource kinds remain future engine cuts. + producer. Texture2D local assets can now be declared as field resources and + bound automatically by DSL handles, so TubeField ramps use resource keys + rather than raw paths as live authority. Mimir-declared rendering buffers are + Fensalir GPU resources in the same runtime and should not round-trip through + CPU payloads. The TubeField DSL can now describe a 2D rolling float buffer as + Catmull-Rom XY tubes with modulo column addressing, amplitude power/ + normalization, radius, ramp texture resource, and emission scale. D3D12 now + expands and renders those tubes from GPU-resident buffers, samples material + per pixel, and binds declared local ramp textures; indirect draw packets, + mesh, surface-page, and volume resource kinds remain future engine cuts. - `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/src/Mimir.BufferSmoke/Program.cs b/src/Mimir.BufferSmoke/Program.cs index 4ecdc76..7fcf7d7 100644 --- a/src/Mimir.BufferSmoke/Program.cs +++ b/src/Mimir.BufferSmoke/Program.cs @@ -587,8 +587,9 @@ static int RunFensalirFieldDslResourceSmoke() NativeHandleKind: "native-ring"); const string source = """ resource id=spectrum key=mimir:resource:native-ring:1234 +texture2d id=blackbody key=aquarium:resource:ramp:blackbody path=D:\WIP4\Projects\Aetheria\Assets\Resources\Ramps\blackbody.png format=Rgba8Unorm domain id=mimir:domain:spectrum kind=RollingBuffer min=0,0,0 max=192,1,5 owner=Mimir.Runtime -tubeclaim id=spectrum-trail resource=spectrum domain=mimir:domain:spectrum confidence=0.94 radius=0.02 support=0.02,0.02,5 +tubespline id=spectrum-trail resource=spectrum domain=mimir:domain:spectrum confidence=0.94 radius=0.02 support=0.02,0.02,5 width=192 height=1 stride=4 columns=1 ramp=blackbody """; var frame = AquariumFieldScriptCompiler.CompileEvidence( source, @@ -600,11 +601,13 @@ tubeclaim id=spectrum-trail resource=spectrum domain=mimir:domain:spectrum confi var validation = AquariumFieldEvidenceValidator.Validate(frame); Console.WriteLine( - $"fensalir-field-dsl-resource-smoke resources={frame.Resources.Count} claims={frame.Claims.Count} requests={AquariumFieldEvidenceNormalizer.BuildLoweringRequests(frame).Count} planned={plan.Packets.Count} deferred={plan.DeferredRequests.Count} errors={validation.HasErrors}"); + $"fensalir-field-dsl-resource-smoke resources={frame.Resources.Count} claims={frame.Claims.Count} tubeLowerings={frame.TubeSplineLowerings.Count} requests={AquariumFieldEvidenceNormalizer.BuildLoweringRequests(frame).Count} planned={plan.Packets.Count} deferred={plan.DeferredRequests.Count} errors={validation.HasErrors}"); return !validation.HasErrors && - frame.Resources.Count == 1 && + frame.Resources.Count == 2 && frame.Claims.Count == 1 && + frame.TubeSplineLowerings.Count == 1 && + frame.TubeSplineLowerings[0].RampResourceKey == "aquarium:resource:ramp:blackbody" && plan.Packets.Count == 1 && plan.Packets[0].Backend == AquariumFieldBackendKind.TubeField && plan.Packets[0].PayloadHandle == resource.ResourceKey && diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 4faf490..89a9cf1 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -144,3 +144,4 @@ {"ts": "2026-05-26T18:50:34+01:00", "type": "correction", "status": "ok", "note": "Tightened the resource invariant: rendering buffers should move to GPU residency ASAP and stay there, with Fensalir passing handles/SRVs/UAVs between compute and render lowerings instead of copying samples through CPU. Fensalir's TubeField DSL now describes 2D rolling Float32 buffers as Catmull-Rom XY tubes with modulo column addressing, amplitude power/normalization, radius scaling, ramp texture path, and emission scale. D3D12 shared structured/curve resources import by GPU handle or stay unsupported; Fensalir only allocates a GPU slot when it is the producer. Visible rendering still needs shader-side TubeField expansion/binding over the GPU slot."} {"ts": "2026-05-26T20:13:00+01:00", "type": "implementation", "status": "ok", "note": "Fensalir now has the first D3D12 TubeField rendering path for Mimir-declared rolling float buffers: compute shader expansion binds the resolved GPU sample buffer read-only, emits endpoint-clamped Catmull-Rom tube envelopes into fixed-budget vertex/index UAVs, honors declared sample stride with byte-address loads, draws opaque field geometry through the spline SDF pipeline, and reports requested/dispatched/truncated segment counts. Mimir build and both Fensalir field evidence smokes pass; remaining cuts are per-pixel source-row material sampling, ramp texture binding/fallback, indirect draw packets, and non-buffer resolvers."} {"ts": "2026-05-26T20:22:00+01:00", "type": "implementation", "status": "ok", "note": "Fensalir TubeField rendering now includes the pixel-material side Mimir asked for: compute expansion records one draw batch per lowering, and the TubeField pixel shader binds the matching source buffer/constants and resamples the rolling buffer per pixel by column+spline coordinate using the cheap 5-tap path. Initial material is opaque field geometry with fallback black-to-warm ramp, squared normalized emission, and fake Fresnel center-bright/edge-dark shaping. Real blackbody ramp texture binding, indirect draw packets, and non-buffer resolvers remain future cuts. Headless Fensalir dev reload, Aquarium.Engine.Tests, Mimir build, and both field smokes passed."} +{"ts": "2026-05-26T20:40:00+01:00", "type": "implementation", "status": "ok", "note": "Fensalir now exposes Texture2D local asset resources for engine users. The field DSL accepts `texture2d id=... key=... path=...`, TubeField `ramp=...` resolves aliases to resource keys, D3D12 lazily uploads local Rgba8 assets and binds the ramp SRV with linear clamp sampling, and unresolved ramps use a Fensalir-owned 0-1 fallback texture. Mimir's DSL smoke now proves two resources, one TubeField lowering, automatic ramp handle binding, and one planned TubeField packet. Headless Fensalir reload, Aquarium.Engine.Tests, Mimir build, and both field smokes passed."} diff --git a/state/map.yaml b/state/map.yaml index f84f228..7a172e6 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -314,12 +314,15 @@ accepted_design: UAVs, honors declared float sample stride with byte-address loads, records one draw batch per lowering, then the TubeField pixel shader binds the matching source buffer and resamples material per pixel by column+spline - coordinate with the cheap 5-tap approximation. The first material is opaque - field geometry with fallback black-to-warm ramp, squared normalized - emission, fake Fresnel center-bright/edge-dark shaping, and - geometry-budget overflow reporting. Remaining visual cuts are real ramp - texture binding, indirect draw packets, then honest texture/mesh/page/ - volume resolvers. + coordinate with the cheap 5-tap approximation. Texture2D local assets are + now first-class Fensalir field resources: the DSL can declare a local PNG + ramp resource, TubeField `ramp=` aliases bind automatically by resource + key, and D3D12 uploads/binds the texture SRV with a linear-clamp sampler. + Missing ramps fall back to a Fensalir-owned 0-1 linear texture. The first + material is opaque field geometry with squared normalized emission, fake + Fresnel center-bright/edge-dark shaping, and geometry-budget overflow + reporting. Remaining visual cuts are indirect draw packets, then honest + mesh/page/volume resolvers. - `config/perfect-machine.example.json` declares live owners, sensors, reservoir views, and runtime policy. - `src/Mimir.Runtime/Synchronization` now includes the Perfect Machine module