Repository navigation
feat(cli,render): Milestone 2 Phase 0 + Phase 2 offline Slang shader cook and cooked-shader validator - #11
Merged
Merged
Conversation
brasga-a
force-pushed
the
feat/m2-p2-shader-cook
branch
from
November 18, 2026 17:03
359c9fc to
c3bc712
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Milestone 2 — Phase 0 (
slangcpin) and Phase 2 (spawn-clioffline shader cook &spawn-renderheadless cooked-shader validation) stacked onfeat/m2-p1-math(#10), following ADR-0014, ADR-0004, and ADR-0009.slangctoolchain pin): Installed official Linux x86_64 Slang2026.22(v2026.22,Apache-2.0 WITH LLVM-exception) in user-space (~/.local/opt/slang-2026.22+~/.local/bin/slangc) on the reference host and pinnedspawn_cli::SLANGC_VERSION = "2026.22".crates/spawn-render):src/shader.rs(default-features = false,#![forbid(unsafe_code)],#![deny(clippy::indexing_slicing)], zero normal third-party dependencies, zeroash/unsafe): versionedSPNSHDR\0(v1) binary codec (CookedShader), pre-allocation size/alignment/overflow bounds checking (SPN-INV-034), SPIR-V 1.0–1.6 framing +OpEntryPointuniqueness verification, and Vulkan 1.3 compatible-superset pipeline-layout validation (CookedShader::validate_against,validate_graphics_pipeline_shaders).RenderErrorKind::InvalidShaderArtifact(REND-0010) andRenderErrorKind::ShaderLayoutMismatch(REND-0011) preservingREND-0001..0009.cargo-fuzzpackagecrates/spawn-render/fuzz(decode_cooked_shader, excluded from root[workspace]).tools/spawn-cli):[[bin]] name = "spawn"(#![forbid(unsafe_code)]) withspawn shaders buildover injectableSlangCompiler/ProcessSlangCompiler(slangc -target spirv -profile spirv_1_6 -matrix-layout-column-major -fvk-use-entrypoint-name, never-fvk-invert-y)..slangentry-point scanner (slang_scan.rs),rspirv0.13 SPIR-V reflection extraction (reflect.rs, includingMemberMatrixLayoutpropagation throughOpTypeArray, signed constant checks, and descriptor/push-constant/vertex-input extraction), RAII.spvintermediate cleanup, uncommitted.spnshdremission (target/shaders/), and pointer-sized locatedCliError(CLI-0001..0006)..slangshaders:shaders/triangle.slang(SV_VulkanVertexID, CCW positive Vulkan signed area, reversed-Zz = 0.5) andshaders/mesh_3d.slang(camera-relativef32Mat4+normal_col0..2+base_color128 B push constants, vertex locations0..=2)..gitignore(*.spv,*.spnshdr, fuzz artifacts),Cargo.toml,AGENTS.md(root,crates/spawn-render/AGENTS.md,tools/spawn-cli/AGENTS.md),docs/DEPENDENCIES.md(In use), anddocs/first-3d/{PLAN,VERIFICATION}.md.Requirements Covered
F3D-FR-04(offline Slang → Vulkan 1.3 SPIR-V + reflection cooking viaspawn-cli)F3D-FR-05(headless cooked-shader binary parser & pipeline-layout compatibility validator inspawn-render)F3D-FR-12(locatedCLI-0001..0006andREND-0010..0011diagnostics perADR-0009)F3D-NFR-01..05, 07(genre-free infrastructure, downward acyclic headless crate graph, approved dependencies only, zero runtime orbuild.rsshader compilation,#![forbid(unsafe_code)]/#![deny(clippy::indexing_slicing)])Tests Run
PATH="$HOME/.local/bin:$PATH" ./scripts/check.sh→ exit 0 (cargo fmt --all --check,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspaceincludingFND-T01..T10,F3D-T01..T04,F3D-T06mock + liveslangc 2026.22,F3D-T07corrupt/truncated/unaligned/overflow/layout-mismatch +proptestfuzzing +instasnapshots, Phases 1–2 ofF3D-T13,cargo doc --workspace --no-depswithRUSTDOCFLAGS="-D warnings", Linuxwayland+vulkanfeature tests/docs, andcargo deny check).PATH=/usr/bin:/usr/local/bin:/bin ./scripts/check.sh→ exit 0 (verifies 100% headless CI execution whenslangcis absent fromPATH).PATH="$HOME/.local/bin:$PATH" cargo test -p spawn-cli -- --ignored→ exit 0 (f3d_t06_opt_in_pinned_slangc_required: liveslangc 2026.22cook ofshaders/{triangle,mesh_3d}.slang, compiler diagnostic forwarding, anddescriptors_and_mat_array.slangwithfloat3x3[2]push constants + all 6 descriptor kinds).cargo run -p spawn-cli -- shaders build→ exit 0 (4 uncommitted.spnshdrbundles emitted intarget/shaders/; missing-compiler probePATH=/usr/bin target/debug/spawn shaders buildprintserror[CLI-0002]and exits1).cargo check --manifest-path crates/spawn-render/fuzz/Cargo.toml --bins→ exit 0 (Gate G2cargo-fuzztarget compiles cleanly).Platforms Tested
1.99.1, pinned official Slang2026.22(~/.local/opt/slang-2026.22), AMD Ryzen 5 1600 / AMD Radeon RX 460.Invariants & Gate G2 Coverage
SPN-INV-001,003,004,009,011):spawn-render(default = []) has 0 normal third-party deps;spawn-clidepends only onclap,rspirv, and headlessspawn-render(default-features = false, zero Vulkan/Wayland backends); zero third-party types or genre terms in public APIs.SPN-INV-020..023, Gate G2): Added only owner-approved crates (arbitrary,clap,insta,proptest,rspirvin[workspace.dependencies]withdefault-features = false) and externalslangc 2026.22(Apache-2.0 WITH LLVM-exception);cargo deny checkclean;docs/DEPENDENCIES.mdIn usesynchronized.SPN-INV-030,032,034,053,080,081,083,084,100,101, Gate G2):#![forbid(unsafe_code)]onspawn-cliandspawn-render::shader;#![deny(clippy::indexing_slicing)]onshader.rs,slang_scan.rs, andreflect.rs; pre-allocation header/count/alignment validation +proptest+cargo-fuzztarget; single-site Y-flip preserved (no-fvk-invert-y); zerobuild.rsslangcinvocations and zero git-tracked.spv/.spnshdrartifacts.Known Limitations
vkCreateShaderModule/ Vulkan 1.3dynamicRenderingexecution of cooked.spnshdrartifacts isPLANNEDfor Milestone 2 Phases 3–4 (F3D-T11,F3D-T12).slangc.exeexecution is not verified on this Linux host (CI headless tests use the injectedSlangCompilermock).cargo fuzz runwas not executed on this stable-only toolchain host; the standalonespawn-render-fuzztarget was verified viacargo check --binsand itsarbitrary::Unstructuredharness runs deterministically underproptestinF3D-T07.