Shaders: split comparison and non-comparison immediate static samplers #1108
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1108
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1108/head"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@mgunes1311-lab on GitHub · 2026-11-24 15:47 UTC · original
mgunes1311-lab:shader-split-cmp-samplers→main· +273 −55 · 3 files · 3 commits · closed without mergingSummary
Split immediate/constant samplers by
(words, comparison)so a single GPU sampler descriptor used for both standard and comparison sampling gets separate D3D12 static sampler slots rather than forcing a shared sampler into comparison mode.Fixes
Lower::samplersby([u32; 4], bool)instead of[u32; 4]alone, and passcomparisondirectly toShader::sampler_handle. This prevents non-comparisonimage_sample_*operations from being bound to aSamplerComparisonStatestatic sampler.cmp_samplers: u64inLoweredandShaderwithVec<bool>(Shader::samplers: Vec<bool>), avoiding bit-shift overflow when a shader uses more than 64 immediate samplers.build_static_samplersinemit/mod.rsand sets.filter = (s.filter & !0x180) | 0x80for comparison samplers instead of|= 0x80, soMINIMUM(0x100) becomesCOMPARISON(0x80) rather thanMAXIMUM(0x180).Files Changed
crates/victory-shader/src/emit/lower.rscrates/victory-shader/src/emit/shader.rscrates/victory-shader/src/emit/mod.rsTests Added
emit::tests::constant_sampler_used_with_and_without_comparison_splits_into_two_static_samplers(covers bothcmp_first = false/true, DXIL validation + WARP dispatch on Windows, andMINIMUMreduction override)emit::tests::more_than_64_immediate_samplers_do_not_overflow(66 immediate samplers)@MichaelSmithAI on GitHub · 2026-11-24 15:50 UTC · original
We extended the 66-sampler test on
a0206d1through compute dispatch and readback on an RTX 4090 under Wine/GE 3.2. With one R32_FLOAT texel set to 0.5, every ordinary sample returned 0.5 and every comparison sample returned 1.0. We checked all 66 output words, including slots 64 and 65 beyond the old mask.The mixed-use shader also validated and returned [0.5, 1.0, 0.0] in both declaration orders. These are test-only fixture changes. The MINIMUM-to-COMPARISON filter conversion was checked in the emitted sampler metadata. Title use remains unmeasured.
@Zipettte on GitHub · 2026-11-24 18:01 UTC · original
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at
a0206d1:cargo test -p victory-shaderpasses, 122 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).Tested with AI assistance (Claude).
@Marvisak on GitHub · 2026-11-25 00:32 UTC · original
Automated triage for the maintainers. Closing because another open pull request covers the same change.
See #1477. One immediate sampler used with and without comparison gets two static samplers: the same fix as #1477 (clean, 104 lines; also #1493), here with a Vec refactor and unrelated reformatting.
If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed