Shaders: check the constant-colour container's layout and hash on every host #262
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/262"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by SkippySteve on 2026-11-24T01:53:34Z.
constant_color()invictory-shader's emit tests builds a pixel shader container but was only called by the two#[cfg(windows)]tests (stub_pipeline_is_created,constant_color_validates). Off Windows it was dead code, socargo test/cargo clippy --all-targets -p victory-shaderon Linux warned:This PR combines two fixes for that warning (it supersedes #258):
Keep the helper on every host and use it there. Gating
constant_color()with#[cfg(windows)](#258's approach) would have hidden the warning, but left the container untested off Windows. Instead, a new test runs on every host:constant_color_is_a_well_formed_container. It checks what D3D12 and the validator look at before they read the bitcode:dxbc::Container, and its size field equals its lengthSFI0 ISG1 OSG1 PSV0 HASH DXILDXILpart starts with the program headercontainer::hashof the bytes after itIt needs neither D3D12 nor
dxil.dll.Import hygiene from #258.
bitcode::Attrandshader::Shaderare used only byconstant_color(), so their imports move from the test module into the helper.The change is tests only: no runtime code changes.
Testing (Linux)
cargo test -p victory-shader: 57 passed (was 56)cargo clippy -p victory-shader --all-targets -- -D warnings: clean (it failed before because of the warning)cargo clippy -p victory-shader --all-targets --target x86_64-pc-windows-msvc -- -D warnings: cleancargo fmt -p victory-shader --check,cargo xtask policy: cleanImported from Marvisak/VIctory. Originally posted by SkippySteve on 2026-11-24T02:32:40Z.
Folded into #326 to keep the PR count down. The commits are unchanged there.
Pull request closed