Repository navigation
feat(vk): an opt-in linear filter switch to narrow down the blocky light halos (#1117) - #1366
attarwei-design wants to merge 1 commit into
Conversation
c8f750d to
7d726c5
Compare
…otRexed#1117) A few samplers filter as nearest where the picture has smooth light: a low-resolution bloom or light buffer read through them shows its texels as square blocks around Navi, the Kokiri lamps and light shafts, and as a checkerboard in the fog. NotRexed#1117 found the cause and NotRexed#1006 collects the reports, but which sampler registrations should be linear is still unknown. RX_VK_FORCE_LINEAR adds a diagnostic switch to narrow that down. Mode 1 filters every non-comparison nearest sampler linearly, 2 only magnification, 3 only minification, 4 only the ids in RX_VK_FORCE_LINEAR_IDS and 5 every nearest sampler except those ids. It is off unless set, reads the environment once into a function-local static, and its names are not among the prefixes disk_stamp() hashes, so trying a mode does not rebuild the program cache. The filter change is made to the NVN parameters before they are mixed into the sampler cache key, so an id whitelist cannot hand one sampler to another id with the same original parameters. Each nearest minification filter maps to the linear filter with the same mip mode; comparison samplers are left alone. Every changed sampler is logged once with the filters it had. This is a diagnostic switch, not the fix. Forcing all nearest samplers also smoothes the low-resolution volumetric buffers into a continuous haze on some drivers, so mode 4 with a short id list is the way to isolate them. README documents the switch beside the other test switches, and a game-free source test covers the off-by-default path, the mip modes, the cache key and the id list. Assisted-by: Tencent Hunyuan Hy (via WorkBuddy) Co-Authored-By: Tencent Hunyuan Hy <noreply@tencent.com>
7d726c5 to
e717631
Compare
|
Thanks for the heads-up, and sorry for the delay. I checked current 1. What we do on our own build (context only — nothing here is proposed for merge)We have been hitting #1117's blocky halos / checkerboard fog since v2.0.11 (also present on v2.0.10) on an RTX 4080, Windows 11, Vulkan, 2560x1440. That build carried a small local After upstream added its own
Two honest caveats: we kept the workaround as-is and did not run an A/B on v2.1.0 with it disabled, so "still reproduces" for that release rests on our earlier v2.0.11 A/B (the squares returned immediately with the switch off) and on reports in #1117 (e.g. dmajchrowski on v2.1.0 / RTX 5080). Also, #2289 landed on 2. The conflict, and how I'll resolve itState right now: this PR is one commit ( The substantive problem: So rather than force the old diff, I would propose one of these (happy to take your preference):
Mechanically: local git transport here is unreliable (proxy / schannel), so I rebase through the GitHub Git Data API — take This reply is AI-assisted and for reference only. |
Joey-Magnus
left a comment
There was a problem hiding this comment.
I'd go with your option C and close this. Main already has RX_VK_FORCE_LINEAR, an env_on boolean added in #1485 (vk_draw.cpp:2391). As you said, rebasing this mode-based version under the same name would make =4 or =5 silently force every sampler.
#2289 has also merged. It fixes the cause behind #1117: registrations made before the renderer started reached the back end as zeros, which turned sampler 258 into a nearest sampler. #1117 itself was closed today and folded into #1004. So there's no need left for a per-id bisection switch.
Option A wouldn't add much on its own, since main's switch already has a test (sampler_admission_test.cpp). If the haze still shows on a build with #2289, please report it in #1004 with a log, and that would be the case for reopening this under a separate name such as RX_VK_FORCE_LINEAR_MODE.
|
Thanks both — for the nudge, and for laying out the reasoning so clearly. I checked Yes, I can bring the branch up to date — a merge of What I verified on current
So I'm with option C and happy to close this now. If you'd still like an up-to-date branch for the record, or want one more look before I do, just say the word and I'll do the merge/rebase first — otherwise I'll close it rather than leave it hanging. One small gap I did notice while checking: On the haze: the one I saw came from forcing every nearest sampler to linear on a v2.0.x / v2.1.0 build plus a local fog-scale tweak to compensate, and that build predates #2289, so it isn't evidence against the fix. The first thing I'll try on the next release is a clean, unpatched build. If haze or overexposure is still there, I'll report it in #1004 with a log — and that would be the point to reopen a per-id switch under a separate name such as I drafted this with a little help from an AI assistant. |
What this is
An opt-in switch to help narrow down #1117 (blocky/pixelated light halos and checkerboard fog), not a fix for it. The root cause is still unknown: a handful of samplers filter as
NEARESTwhere the picture has smooth light, and a low-resolution bloom or light buffer read through them shows its texels as square blocks. #1117's reporter verified that making those few samplers linear removes both artefacts, and an independent AMD reporter confirmed it in the same thread, but both had to patch and rebuild their own copy to try it. This makes that experiment available fromhookshot_env.txt, and makes it possible to isolate which samplers are responsible.Related: #1006, #1004, #606, #1172.
What changed
RX_VK_FORCE_LINEAR=<mode>ingpu/vk/vk_draw.cpp:0/ unset1NEARESTsampler becomesLINEAR2/34RX_VK_FORCE_LINEAR_IDS=<id,id,...>5NEARESTsampler except those idsDetails that matter for the replay rules and for testing:
NEARESTminification filter maps to theLINEARfilter with the same mip mode;mipmapModeis untouched, matching Blocky light halos and checkerboard smoke go away when the few NEAREST samplers are made linear #1117's own patch. Comparison (depth-reference) samplers are skipped.disk_stamp()hashes, so switching modes does not rebuild the multi-GB program cache.readme.mddocuments both switches beside the other test switches.tests/test_sampler_force_linear.pyis a game-free source check covering the off-by-default path, the mip-mode mappings, the cache-key ordering and whole-token id matching; it is picked up bytests/run_all.pyautomatically, so no workflow change is needed.Why it is a diagnostic switch and not a fix
Forcing all
NEARESTsamplers to linear also interpolates the low-resolution volumetric buffers into a continuous haze, which on some builds shows up as a washed-out, over-exposed picture. I would rather not guess which samplers should be linear: modes 4 and 5 let anyone bisect the id list from the log and report the exact ids that remove the squares without touching the fog. #1117's reporter did not see the haze on their setup, so this is likely driver/build dependent.Testing
0x9a4a8000, v2.0.11 (also reproduced on v2.0.10), 2560x1440, Kokiri Forest and the Great Deku Tree, 60 fps with the game's own frame generation x3.NEAREST. With it off, the squares are back immediately. No other texture looked blurred in the areas played.python -I -B tests/run_all.py sampler_force_linear: 12 tests pass. The full suite needs the CI toolchain (compilers, SPIR-V/Vulkan headers), so I left it to the workflows here.One topic, no game files, dumps, generated files or build output are included. Happy to rebase onto #1330 if that lands first - it also edits
sampler_make, but a different part of it.Assisted-by: Tencent Hunyuan Hy (via WorkBuddy)