Fix headless shader pipeline hang

This commit is contained in:
Meta Vens 2026-05-30 22:13:06 +01:00
commit cf23cef5cd
4 changed files with 10 additions and 0 deletions

View file

@ -4346,6 +4346,7 @@ public sealed class D3D12Renderer : IAquariumRenderer
else
{
Console.Error.WriteLine($"D3D12 initial shader pipeline build failed; retrying after source change. {error}");
throw new InvalidOperationException("D3D12 initial shader pipeline build failed.", error);
}
shaderReloadFailureReported = true;

View file

@ -17,6 +17,9 @@
<ItemGroup>
<Content Include="Shaders\**\*.hlsl" CopyToOutputDirectory="PreserveNewest" TargetPath="Render\Shaders\%(RecursiveDir)%(Filename)%(Extension)" />
<Content Include="Shaders\**\*.hlsli" CopyToOutputDirectory="PreserveNewest" TargetPath="Render\Shaders\%(RecursiveDir)%(Filename)%(Extension)" />
<Content Include="..\Aquarium.Engine\Render\Shaders\D3D12SdfCommon.hlsli" CopyToOutputDirectory="PreserveNewest" TargetPath="Render\Shaders\D3D12SdfCommon.hlsli" />
<Content Include="..\Aquarium.Engine\Render\Shaders\D3D12SdfMath.hlsli" CopyToOutputDirectory="PreserveNewest" TargetPath="Render\Shaders\D3D12SdfMath.hlsli" />
<Content Include="..\Aquarium.Engine\Render\Shaders\D3D12SdfProxy.hlsli" CopyToOutputDirectory="PreserveNewest" TargetPath="Render\Shaders\D3D12SdfProxy.hlsli" />
<Content Include="Worlds\**\*.aquageo" CopyToOutputDirectory="PreserveNewest" TargetPath="Worlds\%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>

View file

@ -311,3 +311,4 @@
{"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"}
{"timestamp":"2026-05-30T21:59:00+01:00","topic":"packed-leap-stereo-depth-kernel","lesson":"D3D12Renderer now installs and dispatches the first stereo-depth compute lane for the live Mimir Leap shape. D3D12StereoDepth.hlsl samples a packed R8G8 Texture2D as left/right IR lanes, performs a small local SAD/block match over the lowering's disparity/radius constants, and writes R16F disparity to the planned UAV SurfacePage. The dispatch only runs for planned Height claims whose left/right keys are the same packed texture and whose input/output resources resolve. This is a live depth proof and provenance-bearing socket for the later libSGM-style SGM rebuild, not calibrated metric depth or full SGM.","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","src/Aquarium.Engine/Render/Shaders/D3D12StereoDepth.hlsl","docs/perfect-fensalir-machine-roadmap.md","state/map.yaml"],"source":"dotnet build src/Aquarium.Engine/Aquarium.Engine.csproj --no-restore; temp Vortice.D3DCompiler probe compiled D3D12PackedStereoDepthCS bytes=2168; full headless host compile attempted but hung before capture"}
{"timestamp":"2026-05-30T22:33:00+01:00","topic":"headless-pipeline-hang-root-cause","lesson":"The apparent Fensalir headless hang was an initial shader pipeline failure hidden behind the loading-frame loop. dotnet-stack showed the main thread sleeping in D3D12Renderer.RenderPipelineLoadingFrame; a dump of the background pipeline task revealed FileNotFoundException for Render/Shaders/D3D12SdfCommon.hlsli beside the Aquarium.Fensalir client shader output. D3D12FensalirSpine.hlsl includes engine SDF shared files by relative path, but Aquarium.Fensalir.csproj only copied client shaders. The fix copies D3D12SdfCommon.hlsli, D3D12SdfMath.hlsli, and D3D12SdfProxy.hlsli into the client shader output and makes initial pipeline failure throw instead of spinning silently. Verification: Fensalir and Engine builds passed, then headless Engine run compiled pipelines, captured artifacts/runtime/fensalir-stereo-depth-pipeline-smoke.png, and exited.","files":["src/Aquarium.Fensalir/Aquarium.Fensalir.csproj","src/Aquarium.Engine/Render/D3D12Renderer.cs","state/evidence.jsonl","state/map.yaml"],"source":"dotnet-stack report plus dotnet-dump analyze on stuck headless process; dotnet run --project src/Aquarium.Engine/Aquarium.Engine.csproj --no-build -- --headless --capture-frame artifacts/runtime/fensalir-stereo-depth-pipeline-smoke.png"}

View file

@ -50,6 +50,11 @@ invariants:
- Fensalir may own reusable built-in field resources, such as the blackbody
ramp, when the resource is generic engine utility. Clients should reference
those through contracts instead of hardcoded project-local asset paths.
- Client shaders that include engine shared HLSL files must receive those
includes in their output shader directory or use explicit engine include
paths. Missing shared includes are shader-pipeline failures, not loading
states. Initial pipeline build failure now throws instead of spinning behind
the startup/loading frame.
- Epiphany Aquarium depends on Fensalir; Fensalir must not depend on Epiphany.
- Demo projects inside this repo are allowed to exercise engine features but must not become hidden engine policy.
- Public `Aquarium.*` assembly names remain for continuity until a deliberate namespace/package migration.