shader: a comparison sampler replaces the reduction instead of OR-ing into it #2810
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2812"
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?
Imported from Marvisak/VIctory. Originally posted by spy0eye-beep on 2026-11-25T21:14:37Z.
Split out of #1483 as requested in review.
D3D12 keeps the reduction in filter bits 7-8 (0 standard, 1 comparison, 2 minimum, 3 maximum). OR-ing 0x80 into a minimum sampler (0x100) produced a maximum one (0x180).
StaticSampler::make_comparisonclears the reduction and sets comparison; both call sites use it, and the existingimmediate_sampler_slots_distinguish_comparison_usesexpectation is updated rather than duplicated.Test:
comparison_replaces_the_reductioncovers standard, minimum and maximum reductions with point, linear and anisotropic filters.🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T21:19:10Z.
Review: COMMENTED
Real bug fix: filter bits 7-8 are D3D12's reduction-type field (0 standard, 1 comparison, 2 minimum, 3 maximum), and OR-ing 0x80 into a minimum sampler (0x100) produced 0x180 = maximum instead of comparison. Masking then setting (
& !0x180 | 0x80) replaces the field correctly. The test matrix covers standard/min/max reductions across point/linear/aniso bases. LGTM.Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T21:33:11Z.
Verified
333e39c3on Windows 11 (RTX 5090 + WARP + Windows SDK10.0.26100.0dxil.dll):cargo xtask policy: 184 files ok;cargo clippy -p victory-shader --all-targets --locked -- -D warnings(default &--features host): 0 warnings.emit::sampler::+immediate_sampler_slots_distinguish_comparison_uses: 6/6 passed (withdxil.dllvalidation).git merge-treeagainstorigin/main13f91caand #2811.StaticSampler::make_comparison()cleanly masks out bits 7–8 (& !0x180 | 0x80) before setting comparison mode across bothemit_withand the test, cleanly superseding the sampler portion of #1483.Imported from Marvisak/VIctory. Originally posted by AwsAli05 on 2026-11-25T23:15:42Z.
Review: COMMENTED
The focused reduction test passed at
333e39c3on Windows. A call-site improvement would make the shader-emission test exercise the original failure directly. It currently emits a comparison sampler from all-zero words and builds the expected filter by calling the same new helper. Use a word set with a nonstandard reduction (for example, bit 29 set in word 0 for MIN) and assert comparison bits0x80in the emitted static sampler. That would catch a regression back to OR-ing at the call site.AI-assisted review and test.
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T02:49:42Z.
Review: APPROVED
Tested merged onto
origin/main(63bcca4) on Windows 11 x64:cargo test -p victory-shader --lib emit::sampler::tests: 7 passed, 0 failed (including newcomparison_replaces_the_reduction).cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T02:20:03Z.
Automated triage for the maintainers.
StaticSampler::make_comparison(emit/sampler.rs) clears the reduction bits (7-8) before setting comparison. OR-ing0x80into a minimum sampler (0x100) gave a maximum one (0x180). Both call sites inemit/mod.rsuse it, and the test covers standard/min/max reductions with point, linear and anisotropic filters. It is small and correct by my reading of D3D12'sD3D12_FILTERencoding.CI: passing.
Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-27T01:58:24Z.
Review: APPROVED
Reviewed
333e39c37122d9fad2999cd7068a60c7ce9e4e64.LGTM —
StaticSampler::make_comparison(self.filter & !0x180 | 0x80) cleanly clears the two-bit D3D12 reduction field before setting comparison mode (0x80), preventing minimum-reduction samplers (0x100) from turning into maximum (0x180). Checked acrosscrates/victory-shader/src/emit/that no remaining comparison paths use|= 0x80and thatfilter_for_host/root_signature_forstay aligned.Verified locally:
cargo xtask policy(191 files ok),cargo clippy -p victory-shader --all-targets/--all-features(-D warnings), andcargo test -p victory-shader --lib sampler(10 passed, includingcomparison_replaces_the_reduction,immediate_sampler_slots_distinguish_comparison_uses, andstride_tests::a_sampler_chosen_by_a_uniform_branch_samples_as_chosen) all pass cleanly.rustfmtdiffs (sampler.rspasses cleanly;mod.rshas no PR-introduced diffs).View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.