diff --git a/docs/perfect-fensalir-machine-roadmap.md b/docs/perfect-fensalir-machine-roadmap.md index c8adbda..ec71763 100644 --- a/docs/perfect-fensalir-machine-roadmap.md +++ b/docs/perfect-fensalir-machine-roadmap.md @@ -390,7 +390,9 @@ Add contributors in this order: depth dispatch metadata is now typed as `AquariumFieldStereoDepthLowering`: it must bind the Height claim to shader-readable left/right texture resources, a calibrated camera pair/profile, and a compute-writable disparity - `SurfacePage`. The D3D12 renderer now accounts for dispatch-ready stereo + `SurfacePage`, plus the SGM-shaped kernel constants: min disparity, disparity + levels, aggregation path count, census radius, and P1/P2 smoothness + penalties. The D3D12 renderer now accounts for dispatch-ready stereo lowerings only when the planned Height claim and all three resolved resources are present; it reports that readiness separately from the not-yet-installed SGM kernel. diff --git a/src/Aquarium.Engine.Contracts/Render/AquariumFieldEvidence.cs b/src/Aquarium.Engine.Contracts/Render/AquariumFieldEvidence.cs index 35c4f49..0faa4ae 100644 --- a/src/Aquarium.Engine.Contracts/Render/AquariumFieldEvidence.cs +++ b/src/Aquarium.Engine.Contracts/Render/AquariumFieldEvidence.cs @@ -397,8 +397,12 @@ public readonly record struct AquariumFieldStereoDepthLowering( string ConfidenceResourceKey, int Width, int Height, + int MinDisparity, int DisparityLevels, int AggregationPathCount, + int CensusRadius, + float SmoothnessPenaltySmall, + float SmoothnessPenaltyLarge, float MinDepthMeters, float MaxDepthMeters) { @@ -413,16 +417,24 @@ public readonly record struct AquariumFieldStereoDepthLowering( !string.IsNullOrWhiteSpace(DisparityResourceKey) && Width > 0 && Height > 0 && + MinDisparity >= 0 && DisparityLevels > 0 && AggregationPathCount > 0 && + CensusRadius > 0 && + SmoothnessPenaltySmall > 0.0f && + SmoothnessPenaltyLarge >= SmoothnessPenaltySmall && MaxDepthMeters > MinDepthMeters; public AquariumFieldStereoDepthLowering Normalized() => this with { Width = Math.Max(1, Width), Height = Math.Max(1, Height), + MinDisparity = Math.Max(0, MinDisparity), DisparityLevels = Math.Max(1, DisparityLevels), AggregationPathCount = Math.Max(1, AggregationPathCount), + CensusRadius = Math.Clamp(CensusRadius, 1, 8), + SmoothnessPenaltySmall = MathF.Max(0.0001f, SmoothnessPenaltySmall), + SmoothnessPenaltyLarge = MathF.Max(MathF.Max(0.0001f, SmoothnessPenaltySmall), SmoothnessPenaltyLarge), MaxDepthMeters = MaxDepthMeters <= MinDepthMeters ? MinDepthMeters + 0.001f : MaxDepthMeters, }; } diff --git a/state/evidence.jsonl b/state/evidence.jsonl index 8132c4f..5b1268f 100644 --- a/state/evidence.jsonl +++ b/state/evidence.jsonl @@ -308,3 +308,4 @@ {"timestamp":"2026-05-30T00:29:26+01:00","topic":"surfacepage-uav-depth-socket","lesson":"SurfacePage resources can now be GPU-resident unordered-access outputs as well as shader-readable pages. D3D12FieldTexture2D tracks UAV capability, creates UAV descriptors, and D3D12FieldResourceRegistry resolves UnorderedAccess SurfacePages while reusing empty pages across version changes when shape/format/access are unchanged. This gives Mimir stereo-depth/height outputs a real compute-writable resource socket without private output textures or CPU readback.","files":["src/Aquarium.Engine/Render/D3D12FieldTexture2D.cs","src/Aquarium.Engine/Render/D3D12FieldResourceRegistry.cs","tests/Aquarium.Engine.Tests/D3D12SharedTextureInteropTests.cs","docs/perfect-fensalir-machine-roadmap.md","state/map.yaml"],"source":"dotnet test tests/Aquarium.Engine.Tests/Aquarium.Engine.Tests.csproj --filter RegistryResolvesUnorderedAccessSurfacePageForComputeDepthOutput"} {"timestamp":"2026-05-30T00:37:29+01:00","topic":"stereo-depth-lowering-contract","lesson":"FieldEvidence now carries typed stereo-depth lowering metadata for future D3D12 SGM dispatch. AquariumFieldStereoDepthLowering binds a Height claim to shader-readable left/right texture resources, profile/calibration/camera-pair identity, depth range/disparity settings, and a compute-writable UAV disparity SurfacePage. Validation rejects claim encoding mismatches, payload/resource mismatches, non-UAV disparity outputs, and missing/non-readable inputs. This keeps Mimir libSGM-provenance depth inside Fensalir resource authority rather than a private texture, CPU readback, CUDA, or TensorRT path.","files":["src/Aquarium.Engine.Contracts/Render/AquariumFieldEvidence.cs","tests/Aquarium.Engine.Tests/FieldEvidenceContractTests.cs","docs/perfect-fensalir-machine-roadmap.md","state/map.yaml"],"source":"dotnet test tests/Aquarium.Engine.Tests/Aquarium.Engine.Tests.csproj --filter StereoDepth"} {"timestamp":"2026-05-30T00:43:53+01:00","topic":"stereo-depth-dispatch-readiness","lesson":"D3D12Renderer now evaluates stereo-depth lowerings for dispatch readiness without installing a fake depth kernel. A lowering is counted ready only when the SurfacePage Height claim is planned, left/right input Texture2D resources resolve through the field resource registry, and the disparity SurfacePage resolves with UAV capability. Capacity logs report ready/unplanned/unresolved counts and explicitly say the kernel is not installed.","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","docs/perfect-fensalir-machine-roadmap.md","state/map.yaml"],"source":"dotnet build src/Aquarium.Engine/Aquarium.Engine.csproj --no-restore"} +{"timestamp":"2026-05-30T00:45:50+01:00","topic":"stereo-depth-sgm-kernel-constants","lesson":"AquariumFieldStereoDepthLowering now carries SGM-shaped kernel constants instead of leaving the future D3D12 shader to infer policy: min disparity, disparity levels, aggregation path count, census radius, and P1/P2 smoothness penalties. Validation requires positive census/P1/P2 values and P2 \u003e= P1. This preserves libSGM-style provenance as typed dispatch data before the HLSL kernel exists.","files":["src/Aquarium.Engine.Contracts/Render/AquariumFieldEvidence.cs","tests/Aquarium.Engine.Tests/FieldEvidenceContractTests.cs","docs/perfect-fensalir-machine-roadmap.md","state/map.yaml"],"source":"dotnet test tests/Aquarium.Engine.Tests/Aquarium.Engine.Tests.csproj --filter StereoDepth"} diff --git a/state/map.yaml b/state/map.yaml index 854245b..2258fa5 100644 --- a/state/map.yaml +++ b/state/map.yaml @@ -260,7 +260,10 @@ next_actions: stereo-depth dispatch readiness without writing fake depth: a lowering is ready only when its Height claim is planned and left/right input textures plus UAV disparity SurfacePage resolve through the field resource registry; - capacity logs still state that the kernel is not installed. VolumeTexture + capacity logs still state that the kernel is not installed. The lowering + sidecar now carries the first SGM-shaped kernel constants too: min + disparity, disparity levels, aggregation paths, census radius, and P1/P2 + smoothness penalties. VolumeTexture resources now have the same first resolver shape: contracts and DSL can declare GPU-resident 3D textures with dimensions, depth, format, and version, and the D3D12 registry diff --git a/tests/Aquarium.Engine.Tests/FieldEvidenceContractTests.cs b/tests/Aquarium.Engine.Tests/FieldEvidenceContractTests.cs index f5f974e..ff171fd 100644 --- a/tests/Aquarium.Engine.Tests/FieldEvidenceContractTests.cs +++ b/tests/Aquarium.Engine.Tests/FieldEvidenceContractTests.cs @@ -1022,8 +1022,12 @@ tubeclaim id=spectrum-trail resource=spectrum domain=mimir:spectrum:asio-ch0 con "", Width: 640, Height: 480, + MinDisparity: 0, DisparityLevels: 128, AggregationPathCount: 4, + CensusRadius: 2, + SmoothnessPenaltySmall: 8.0f, + SmoothnessPenaltyLarge: 96.0f, MinDepthMeters: 0.15f, MaxDepthMeters: 4.0f) ],