Native HDR flickers between correct colours and grey: one of the three window images stays RGBA8 (one-line workaround included) #2038
Labels
No labels
accessibility
autorelease: pending
autorelease: tagged
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
testing wanted
wontfix
No milestone
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Hookshot#2038
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Hookshot version
hookshot v2.0.11-867-gfc375e9
What kind of problem
Graphics (missing, black or wrong-coloured things, lighting, flicker)
What happened
Problem
With HDR set to Native, the picture alternates quickly between correct colours and a washed-out grey, several times a second. Expanded does not flicker. FSR 4 is not the cause:
history resetappears once in the log, at start-up.Version
Before:
hookshot v2.0.11-867-gfc375e9 (source 806f912f)After the change below:
hookshot v2.0.11-867-gfc375e9-dirty (source e45dfd4b)(-dirtybecause I built from the working tree before committing the one-line change).Built from source on Linux (
mainatfc375e9,make_game.py --fsr). I haven't tried the newest release because it has no FSR 4.Hardware and settings
SDL_VIDEODRIVER=waylandnative3) was run without Mesa's anti-lag layer. The "after" log (native4) hadENABLE_LAYER_MESA_ANTI_LAG=1; I also ran the fixed build without it (native5) and it is just as steady.Where
Kakariko Village, Hyrule Fields and Hyrule Castle Town. The attached logs cover only the start of a session (intro and early gameplay).
What the log shows
At start-up the game's window is created as
0x25(RGBA8) and then recreated as0x3d(RGB10A2):Afterwards two of the three window images are RGB10A2 (
vk 64), but one stays RGBA8 (vk 37) for the whole run:and it is created before the switch:
All
present texturelines sayformat 0x3d, so the game presents all three as RGB10A2.Cause (from reading the source)
format_class()ingpu/vk/vk_texture.cppreturns the same class for RGBA8 and RGB10A2 (both 4 bytes per texel), andKeyhas no format field. The comment at the top of the file says images are shared by class on purpose (MUTABLE_FORMAT).0x1004137000was first made as RGBA8 before the game switched to HDR10. After the switch,texture_getfinds the same image by key, so novk 64image is made for that address. The other two addresses were first created after the switch.vk_replay.cppthe native-HDR check is... && tex->format == VK_FORMAT_A2B10G10R10_UNORM_PACK32, which uses the image's creation format. For the stale image it is false, so that frame goes through the SDR-to-HDR pass (framegen_hdr), which treats the PQ-coded picture as SDR. One frame in three is grey.I have not stepped through this in a debugger; it is my reading of the code and the logs.
Workaround that fixes it for me
Give RGB10A2 its own class in
format_class():Commit:
github.com/moosky73/Hookshot@b04f99aWith it, the log shows a new image for that address (
texture #4 at 0x1004137000 ... class 0x40204 NVN 0x3d, instead ofclass 0x40004for the old one), and all three window images areNVN 0x3d -> vk 64. The flicker is gone on Native.Logs attached:
hookshot-native3.log(before the change) andhookshot-native4.log(after; this run was at 3440x1440 output).Caveats
Happy to test patches.
Where in the game
Kakariko Village, Hyrule Fields & Hyrule Castle Town
How often
Every time
Graphics card and driver version
AMD RX 7900 GRE, RADV, Mesa 26.2.6-arch3.1
CPU, RAM and operating system
Ryzen 5 5600, 16 GB, CachyOS, KDE Plasma 6.8.2 (Wayland)
Changes from the defaults
HDR: Native (paper white 200 nits, peak 1000 nits)
Upscaler: AMD FSR 4, Render resolution Quality (67%)
Frame cap 165
Launched with SDL_VIDEODRIVER=wayland
"After" log only: ENABLE_LAYER_MESA_ANTI_LAG=1 (Mesa's anti-lag layer, AMD Anti-Lag 2 on); the fixed build is also steady without it
Other software hooked into the game
No, nothing hooked in
hookshot_log.txt
hookshot-native3.log
hookshot-native4.log
Screenshots or video
No response
Before you send it
with the latest ver, I still getting same Purple or Blue screen
4K HDR10 TV, 4090
I'm on the latest build 2.1.0, and I'm getting a black screen with both implementations of HDR. I can only see something unless I turn it off. One of the other recomps uses RenoDX for HDR; maybe we can mimic that, as this recomp is (imo) the gold standard at the moment
Yeah HDR is just a black screen for me, have to switch back to SDR to get picture. 2.1.0
Your fix (RGB10A2 as its own image class) is merged to main in #2147, credited to you as co-author. The same PR fixes the black, grey or purple HDR picture whenever an upscaler or Sharpness above 0 is on: the scaled picture the HDR pass reads wasn't marked as sampleable. Both ship in the next release; this stays open until then.
Confirming the #2147 fix on real HDR hardware, since the PR notes it couldn't be checked in game.
Fixed on nightly
v2.1.0-rc.3-112-g6c8c1bfb(sourceb2925bb1). Broken on v2.1.0 (source633eb435).Setup
On v2.1.0
0x1004137000was presented first as0x25, then as0x3dat the same address.On the nightly (each: ~20 s of walking outdoors, then the pause menu)
Switching HDR Off → Expanded → Native with the Insert menu open also showed the menu correctly.
One thing worth noting for ultrawide: on v2.1.0
framegen_scalealso ran for ultrawide menu sides (!opts.upscale && !opts.sharpness && !wide.side), so ultrawide users could reach the unsampleable scaled image with the upscaler off and Sharpness at 0. The PR text only lists an upscaler or Sharpness as triggers. The same fix covers it; the Expanded / Sharpness 0 row above is that case.Log from the nightly session attached.
hookshot_log_nightly_hdr.txt
github-sync referenced this issue2026-11-12 06:22:54 +00:00