Shaders: one sampler's words used for both Sample and SampleCmp get two static slots #333

Open
github-bot wants to merge 1 commit from github-bot/gh-333 into main AGit
Owner

@⁠RenzoWit35 on GitHub · 2026-11-24 23:34 UTC · original
RenzoWit35:fix/250-static-sampler-kind-in-key → main · +124 −7 · 2 files · 1 commits · open

Fixes #250.

Immediate samplers were deduplicated by their four words alone, and a comparison use marked the
shared slot as a comparison sampler (a shortcut: in the code). Comparison first, the ordinary
sample got a comparison handle (the DXIL validator rejects it). Ordinary first, its default
handle pointed at a comparison static sampler (the validator accepts that, but it is wrong).
The slot key is now the words plus the comparison flag, and a slot's kind is set once at
creation. Lowering more than 64 immediate samplers now fails cleanly instead of overflowing the
u64 kind mask.

Test one_samplers_words_with_and_without_comparison_get_two_slots: a synthetic GFX10 compute
program samples with and without comparison through the same words, in both orders, and checks
two slots with the right kinds; it also runs dxil.dll's validator when present (no GPU needed).
Fails on main.

Note: affected shaders get one more static sampler in their root signature.

Testing

On Windows 11, MSVC Rust 1.98.1, branch alone on top of main (2119b0e): cargo clippy --workspace --all-targets --locked -- -D warnings, the same with --all-features, and cargo test --workspace --locked all pass. The new regression test fails on main and passes here. All nine fix branches for #242-#250 also pass together when merged.

🤖 Generated with Claude Code

**@⁠RenzoWit35** on GitHub · 2026-11-24 23:34 UTC · [original](https://github.com/fxceless/victory-fork/pull/333) `RenzoWit35:fix/250-static-sampler-kind-in-key` → `main` · +124 −7 · 2 files · 1 commits · open Fixes #250. Immediate samplers were deduplicated by their four words alone, and a comparison use marked the shared slot as a comparison sampler (a `shortcut:` in the code). Comparison first, the ordinary sample got a comparison handle (the DXIL validator rejects it). Ordinary first, its default handle pointed at a comparison static sampler (the validator accepts that, but it is wrong). The slot key is now the words plus the comparison flag, and a slot's kind is set once at creation. Lowering more than 64 immediate samplers now fails cleanly instead of overflowing the u64 kind mask. Test `one_samplers_words_with_and_without_comparison_get_two_slots`: a synthetic GFX10 compute program samples with and without comparison through the same words, in both orders, and checks two slots with the right kinds; it also runs dxil.dll's validator when present (no GPU needed). Fails on `main`. Note: affected shaders get one more static sampler in their root signature. ## Testing On Windows 11, MSVC Rust 1.98.1, branch alone on top of `main` (2119b0e): `cargo clippy --workspace --all-targets --locked -- -D warnings`, the same with `--all-features`, and `cargo test --workspace --locked` all pass. The new regression test fails on `main` and passes here. All nine fix branches for #242-#250 also pass together when merged. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Immediate samplers were deduplicated by their four words alone, so a
sampler used with and without comparison shared one slot that became a
comparison sampler: an ordinary sample after a comparison one got a
comparison handle (the validator refuses it), and one before it read a
comparison static sampler. The comparison now is part of the key; more
than 64 immediate samplers (the bit mask's width) are refused.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:40:57 +00:00
Author
Owner

@⁠kaayzouee on GitHub · 2026-11-25 01:02 UTC · original

Duplicate of #276?

**@⁠kaayzouee** on GitHub · 2026-11-25 01:02 UTC · [original](https://github.com/fxceless/victory-fork/pull/333#issuecomment-7149136577) Duplicate of #276?
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/333/head:github-bot/gh-333'
git switch 'github-bot/gh-333'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-333'
git switch 'github-bot/gh-333'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-333'
git switch 'github-bot/gh-333'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-333'
git switch 'main'
git merge --squash 'github-bot/gh-333'
git switch 'main'
git merge --ff-only 'github-bot/gh-333'
git switch 'main'
git merge 'github-bot/gh-333'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.