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

Open
RenzoWit35 wants to merge 1 commit from upstream-pr/333 into main
RenzoWit35 commented 2026-11-24 23:34:56 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by RenzoWit35 on 2026-11-24T23:34:56Z.


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

<!-- greyfinch-sync:fxceless/victory-fork:issue:5482163203 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/333). Originally posted by [RenzoWit35](https://github.com/RenzoWit35) on 2026-11-24T23:34:56Z. --- 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)
kaayzouee commented 2026-11-25 01:12:06 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by kaayzouee on 2026-11-25T01:02:00Z.


Duplicate of #276?

<!-- greyfinch-sync:fxceless/victory-fork:comment:7149136577 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/333#issuecomment-7149136577). Originally posted by [kaayzouee](https://github.com/kaayzouee) on 2026-11-25T01:02:00Z. --- Duplicate of #276?
UncommonDLL commented 2026-11-27 04:28:55 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by UncommonDLL on 2026-11-27T04:28:55Z.


I tested this PR (d31b2d01) on top of main 67429060 with an RTX 5070 Ti, driver 32.0.16.2140. The test uses the same sampler settings for a regular texture sample and a depth comparison, then runs them in both orders.

On main, the shader validator rejected the comparison first case because the regular sample needed a default sampler. With the PR applied, both orders passed validation.

All four runs reached the GPU and returned the expected values: 0.25 for the regular sample and 0.0 for the comparison. No cases were skipped.

<!-- greyfinch-sync:fxceless/victory-fork:comment:7209832575 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/333#issuecomment-7209832575). Originally posted by [UncommonDLL](https://github.com/UncommonDLL) on 2026-11-27T04:28:55Z. --- I tested this PR (`d31b2d01`) on top of main `67429060` with an RTX 5070 Ti, driver `32.0.16.2140`. The test uses the same sampler settings for a regular texture sample and a depth comparison, then runs them in both orders. On main, the shader validator rejected the comparison first case because the regular sample needed a default sampler. With the PR applied, both orders passed validation. All four runs reached the GPU and returned the expected values: `0.25` for the regular sample and `0.0` for the comparison. No cases were skipped.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/333:upstream-pr/333'
git switch 'upstream-pr/333'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/333'
git switch 'upstream-pr/333'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/333'
git switch 'upstream-pr/333'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/333'
git switch 'main'
git merge --squash 'upstream-pr/333'
git switch 'main'
git merge --ff-only 'upstream-pr/333'
git switch 'main'
git merge 'upstream-pr/333'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
fxceless/victory-fork!333
No description provided.