fix(shader): satisfy DX12/FXC X3507 in hatch fs_main (#31)

Both hatch fragment shaders ended their `fs_main` with a bare
`discard;` after the pattern-match for-loop falls through without
matching. WGSL accepts this — discard kills the fragment, so there is
nothing left to return — and naga (the Linux/Vulkan path wgpu defaults
to) lowers it without complaint. DX12's FXC (the default Windows
compiler) is stricter and rejects it with `X3507: 'fs_main': Not all
control paths return a value`, taking the entire pipeline create-down
on every drawing open.

Append an unreachable `return vec4<f32>(0.0);` after each terminal
`discard;` so every control path syntactically ends in a return. The
return never executes at runtime; it only exists to make FXC's
all-paths-return analysis succeed. Naga still accepts the shader
unchanged, so the Vulkan / Metal / WebGPU paths are unaffected.

Reported by @Ward-Vandepitte (Windows 11, DX12, wgpu 27.0.1).

Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Opus 4.7 committed 2026-05-29 21:16:21 +03:00
1 parent 7d9ac435cb
commit 6994837d0e
2 files changed
+8

No files matched your search

+4
View File
@@ -242,4 +242,8 @@ fn check_family(
}
}
discard;
// Unreachable: `discard` kills the fragment before this runs, but
// DX12/FXC reports E_FAIL X3507 ("not all control paths return a
// value") without an explicit return after every terminal discard.
return vec4<f32>(0.0);
}
+4
View File
@@ -253,4 +253,8 @@ fn check_family(
}
}
discard;
// Unreachable: `discard` kills the fragment before this runs, but
// DX12/FXC reports E_FAIL X3507 ("not all control paths return a
// value") without an explicit return after every terminal discard.
return vec4<f32>(0.0);
}