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

Open
adritoyalser wants to merge 1 commit from upstream-pr/276 into main
adritoyalser commented 2026-11-24 23:07:48 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by adritoyalser on 2026-11-24T23:07:48Z.


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)
<!-- greyfinch-sync:fxceless/victory-fork:issue:6593237014 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/276). Originally posted by [adritoyalser](https://github.com/adritoyalser) on 2026-11-24T23:07:48Z. --- 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)
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/276:upstream-pr/276'
git switch 'upstream-pr/276'

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/276'
git switch 'upstream-pr/276'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/276'
git switch 'upstream-pr/276'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/276'
git switch 'main'
git merge --squash 'upstream-pr/276'
git switch 'main'
git merge --ff-only 'upstream-pr/276'
git switch 'main'
git merge 'upstream-pr/276'
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!276
No description provided.