Skip to content

修复《旷野之息》精力条发黑和系统菜单黑背景 - #6

Merged
seedds merged 1 commit into
seedds:mainfrom
huahuahuahuahuahuahuahua:fix/botw-capture-texture-compare
Oct 18, 2026
Merged

seedds merged 1 commit into
seedds:mainfrom
huahuahuahuahuahuahuahua:fix/botw-capture-texture-compare

Conversation

@huahuahuahuahuahuahuahua

Copy link
Copy Markdown
Contributor

问题与修复结果

在 BOTW 1.9.0 中,冲刺时精力条的填充呈黑色,System(系统)菜单背景也会完全变黑。修复后,精力条恢复绿色,系统菜单恢复游戏自身的模糊场景背景,声音计的紫色也恢复正常。

这两个问题已在未修改的上游 90d2992 上重新复现。对照使用同一份存档快照、相同的原始游戏重写模块和相同的新版着色器缓存,输出为标准 1920×1080,未使用本地 4K、内存扩展或草的修复。

根因

nvnTextureCompare 只比较贴图描述和内存地址,遗漏了通道映射(swizzle)。游戏会在同一块存储上重建布局捕获贴图、改变通道选择;旧实现把新旧贴图误判为相同,导致引擎丢弃新的描述符。

  • A8 捕获需要 (1,1,1,R):保留材质的 RGB 颜色,使用红通道中的遮罩作为透明度。
  • CaptureOutputAlpha=255 的 RGB10A2 捕获需要 (R,G,B,1),使菜单背景正常参与合成。

这些更新丢失后,旧的 alpha_from_red 补偿只能掩盖部分阴影问题;其 (R,0,0,R) 映射还会丢掉绿色、蓝色通道,造成黑色精力条。

改动

  • 将有效通道映射纳入 nvnTextureCompare,并将未显式设置的映射与显式恒等映射视为相同。
  • 移除 BOTW 档案中不再需要的 alpha_from_red 着色器白名单。
  • 增加 5 项公开 NVN API 回归断言,覆盖恒等映射、A8 捕获、比较对称性和 RGB10A2 透明度映射。
  • 为 t_nvn 链接现有的 hle_bigstack.c 入口,并更新图形排查文档。

修复前后截图

左侧:未修改的上游版本;右侧:仅应用本 PR 的修复。 上方为精力条局部,下方为系统菜单。

精力条与系统菜单背景的修复前后对照

查看原始 1920×1080 截图
场景 上游原版 修复后
冲刺时的精力条 修复前 修复后
系统菜单背景 修复前 修复后

截图存放在个人 fork 的独立证据提交中,通过固定提交链接引用,不进入本 PR 的源码差异。

验证

  • 环境:Apple M4 Pro、macOS、BOTW 1.9.0。
  • 根据新版着色器链 428aef474fa8 构建并校验 19,592 个主着色器;修复前后使用相同的库文件,没有修改着色器翻译或编译产物。
  • 未修改的上游版本复现两个黑色 UI 问题;应用本 PR 后,同一存档路线下精力条与菜单背景均恢复。
  • 以下 NVN 回归测试 68 项通过、0 失败:
make -C dm/gfx/tests GAME=01007EF00011E000 t_nvn
(cd dm/gfx/tests && ./t_nvn)

范围

本 PR 仅包含颜色根因修复、旧补偿配置移除、测试和文档,共 5 个文件,新增 44 行、删除 9 行。不包含分辨率、内存布局、手柄、FPS、草渲染改动,也不包含游戏文件、密钥、着色器缓存或二进制产物。

目前完成的是 macOS 上的 BOTW 实机验证;尚未对 iOS 或其他游戏进行运行验证。

Compare effective channel selection when textures share the same backing
storage. This preserves BOTW layout capture descriptor replacements and
lets the profile drop the obsolete alpha-from-red shader workaround.

Add public API coverage for default/explicit identity and A8/RGB10A2
capture channel changes, with the host stack entry linked into t_nvn.

Co-authored-by: Codex <[email protected]>
@seedds
seedds merged commit 7d3f884 into seedds:main Oct 18, 2026
seedds pushed a commit that referenced this pull request Oct 18, 2026
…ure fix

nvnTextureCompare and nvnTextureGetSwizzle share tex_swz. The BotW docs
keep the capture investigation, now told from the cause (#6). Odyssey's
layouts go through the same compare-and-replace code (main+0x982320):
with the fix its alpha_from_red list converts no texture on the Mac
smoke route to frame 20,100 (main's host did from frame 4129) and the
HUD is pixel-identical; the list stays until an iPhone run.
@seedds

seedds commented Oct 18, 2026

Copy link
Copy Markdown
Owner

感谢这个 PR!问题已修复,已合并到 main(合并提交 7d3f884)。

根因分析很准确:我对照反汇编核对了你给出的地址(main+0xec33f0、0xecacf0、0xecabe8、0xf58e98、0xf597dc),结论一致——nvnTextureCompare 报告相同时,游戏不会替换已注册的描述符,捕获贴图的新通道映射因此丢失。

合并时我补了几处(5e18a4c):

  • 解决了与 main 的冲突:BotW 档案保留了 main 新增的 gpu_timestamps,文档保留了 main 改过的 BC 条目。
  • nvnTextureCompare 和 nvnTextureGetSwizzle 共用一个通道映射辅助函数 tex_swz。
  • 按根因重写了文档里 BotW 布局捕获的条目,同时保留了之前的排查记录。
  • 《超级马力欧 奥德赛》的布局也走同一段“比较后替换”的代码(main+0x982320)。修复后,它的 alpha_from_red 在 Mac 上不再触发,HUD 与之前逐像素一致。这份列表先保留,等在 iPhone 上跑过再删。

t_nvn 在 main 上原本链接失败,你加的 hle_bigstack.c 也一并修好了它,现在 68 项全部通过。再次感谢!

seedds added a commit that referenced this pull request Oct 21, 2026
…texture-compare

Breath of the Wild: black stamina bar and black System menu background.
nvnTextureCompare now compares the channel mapping, so the game's
capture textures rebuilt on the same storage with a new mapping replace
the registered descriptor. Conflicts with main resolved in the BotW
profile (gpu_timestamps kept) and docs/agents/04-graphics.md (main's
BC entry kept).
seedds added a commit that referenced this pull request Oct 21, 2026
…ure fix

nvnTextureCompare and nvnTextureGetSwizzle share tex_swz. The BotW docs
keep the capture investigation, now told from the cause (#6). Odyssey's
layouts go through the same compare-and-replace code (main+0x982320):
with the fix its alpha_from_red list converts no texture on the Mac
smoke route to frame 20,100 (main's host did from frame 4129) and the
HUD is pixel-identical; the list stays until an iPhone run.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants