Shaders: key static sampler slots by comparison kind (#250) #276

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

@⁠adritoyalser on GitHub · 2026-11-24 23:07 UTC · original
adritoyalser:fix/static-sampler-cmp-dedup → main · +99 −7 · 1 files · 1 commits · open

Fixes #250.

Summary

  • Include the comparison flag (props.0 & 0x8000 != 0) when deduplicating immediate static sampler slots in crates/victory-shader/src/emit/lower.rs, so a constant sampler used by both Sample and SampleCmp gets two distinct static sampler slots with matching sampler kinds.
  • Guard cmp_samplers against shifting past 64 slots.
  • Added regression test static_sampler_separates_ordinary_and_comparison_uses covering both operation orders (image_sample_lz then image_sample_c_lz, and vice versa), asserting distinct slots, cmp_samplers bits, StaticSampler::filter comparison bit (x80), and real dxil.dll validation.

Verification

  • cargo test -q -p victory-shader --lib --locked static_sampler_separates_ordinary_and_comparison_uses (pass, validated with dxil.dll 10.0.26100.0)
  • cargo clippy -q -p victory-shader --all-targets --locked -- -D warnings (0 warnings)
  • cargo clippy -q -p victory-shader --all-targets --all-features --locked -- -D warnings (0 warnings)
**@⁠adritoyalser** on GitHub · 2026-11-24 23:07 UTC · [original](https://github.com/fxceless/victory-fork/pull/276) `adritoyalser:fix/static-sampler-cmp-dedup` → `main` · +99 −7 · 1 files · 1 commits · open Fixes #250. ### Summary - Include the comparison flag (props.0 & 0x8000 != 0) when deduplicating immediate static sampler slots in crates/victory-shader/src/emit/lower.rs, so a constant sampler used by both Sample and SampleCmp gets two distinct static sampler slots with matching sampler kinds. - Guard cmp_samplers against shifting past 64 slots. - Added regression test static_sampler_separates_ordinary_and_comparison_uses covering both operation orders (image_sample_lz then image_sample_c_lz, and vice versa), asserting distinct slots, cmp_samplers bits, StaticSampler::filter comparison bit (x80), and real dxil.dll validation. ### Verification - cargo test -q -p victory-shader --lib --locked static_sampler_separates_ordinary_and_comparison_uses (pass, validated with dxil.dll 10.0.26100.0) - cargo clippy -q -p victory-shader --all-targets --locked -- -D warnings (0 warnings) - cargo clippy -q -p victory-shader --all-targets --all-features --locked -- -D warnings (0 warnings)
Static sampler deduplication previously matched only on the four sampler
words, so a constant sampler used by both an ordinary sample and a
comparison sample shared one slot whose metadata was promoted to a
comparison sampler. DXIL validation requires the sampler kind to match
the operation.

Include the comparison flag in static sampler deduplication so ordinary
and comparison uses get separate static sampler slots, and guard against
shifting past the 64-bit cmp_samplers mask.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:39:42 +00:00
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/276/head:github-bot/gh-276'
git switch 'github-bot/gh-276'

Merge

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