Repository navigation
Shaders: check the constant-colour container's layout and hash on every host - #262
Closed
SkippySteve wants to merge 2 commits into
Closed
SkippySteve wants to merge 2 commits into
SkippySteve wants to merge 2 commits into
Conversation
added 2 commits
November 23, 2026 20:53
…ry host constant_color() was used only by the two Windows-gated tests, so off Windows it was dead code and victory-shader's tests built with a warning. A new test parses the container it builds, checks the size field, the pixel-shader parts in order, the DXIL program header and that the digest is container::hash of the bytes after it. It needs neither D3D12 nor dxil.dll, so it runs on Linux.
Only constant_color uses them, so they live inside it (from #258). The helper itself stays on every host for the hermetic container test.
Author
|
Folded into #326 to keep the PR count down. The commits are unchanged there. |
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.
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)](Shaders: build the constant-colour test shader only on Windows, where its tests run #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 Shaders: build the constant-colour test shader only on Windows, where its tests run #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: clean