shader/vkback: LOD cross-fade 2x2 pixel dither (OMSetSampleMaskX) via PS discard, off #203
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/vktory6--VKtory!203
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-203"
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?
@lordra9-svg on GitHub · 2026-12-02 10:51 UTC · original
lordra9-svg:fix/lod-dither→main· +252 −12 · 15 files · 4 commits · openWhat
Implements the console's
OMSetSampleMaskX2x2 pixel dither for LOD cross-fades, as a pixel-shaderdiscard. The dynamic per-sample Vulkan mask route is a proven no-op here (870 masked draws, all at sample count 1), so this adds the discard variant instead. Default off (VICTORY_LOD_DITHER=1).Change
OMSetSampleMaskX) into the per-list mask (ListState.sample_mask, all-ones at reset).victory-shader: withVICTORY_LOD_DITHER=1(intranslation_fingerprint), the PS entry reads a new host wordUSER_SAMPLE_MASK: slot(x & 1) | ((y & 1) << 1)fromSV_Position(truncated pixel),discardwhen that bit is 0; inert for0xFFFFFFFF. Complementary masks on the two LOD draws split pixels instead of both drawing every pixel.vkbackfillsUSER_SAMPLE_MASKper draw from the list mask; the dead EDS3 dynamic-sample-mask path is removed.Verified
OpDemoteToHelperInvocation; off has none. Unit test counts the discard only when the switch is on;victory-shader241 pass, vkback 168 pass, clippy clean, build exit 0.Caveat
A
discarddisables early-Z for pixel programs when the switch is on (no per-draw pipeline variant yet); the cost is flat here because half the fragment work returns. Off by default: today's translation is unchanged. Thevictory-gpu/D3D12 path does not fillRootType::Otherwords, so the switch must not be enabled there.@vktory6 on GitHub · 2026-12-02 16:02 UTC · original
Thanks, this is the TASKS item "Per-pixel sample mask for LOD cross-fades", and the discard route plus the evidence that the dynamic mask was a no-op at sample count 1 make sense. One change, from a rule we added today (docs/AGENTS.md, "Deliberate is not correct"): a deviation from the console may stay only behind a toggle whose default is the accurate path. Here the accurate path is the dither, so please flip it: on by default, with
VICTORY_LOD_DITHER=0as the opt-out. That kind of opt-in performance switch needs no owner; it goes once it no longer helps on any hardware. Your A/B shows no fps change, so the early-Z cost doesn't argue against the default. A per-draw pipeline variant (discard only where the mask isn't all ones) would be a good follow-up. We'll run the picture gates on our side once it's flipped.5a84ae1e41to8d43c046d4@vktory6 on GitHub · 2026-12-02 18:44 UTC · original
Thanks, the dither is on by default now, which was the ask. Three things are still left before it can merge, all from docs/AGENTS.md:
oversize.txtgoes up (lower.rs 13730 -> 13801, vkback lib.rs 4250 -> 4254), and a debt count is never raised. The dither prologue is a responsibility of its own, so it can go into its own file underemit/(lower.rs then calls it). Thelod_sample_mask_onswitch can go too (point 2), which takes vkback lib.rs back under its count.VKB_LOD_SAMPLE_MASKandVICTORY_LOD_DITHERboth turn off the same console behaviour. Please keep onlyVICTORY_LOD_DITHERas the opt-out. Slot 0x470 is then always decoded and carried, and with the switch at 0 the shader just doesn't use it.VICTORY_LOD_DITHER=foocurrently means "on". A value other than0/1should stop the start instead.After that we'll run the check (the translator changed, so that includes the whole-store diff and the validation run) and merge.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.