Skip to content

Backport the base instance from Metal and -fwrapv (fixes #12) - #13

Open
wagcbjr wants to merge 1 commit into
zenvyzenshiro:mainfrom
wagcbjr:fix/za-base-instance-wrapv
Open

wagcbjr wants to merge 1 commit into
zenvyzenshiro:mainfrom
wagcbjr:fix/za-base-instance-wrapv

Conversation

@wagcbjr

@wagcbjr wagcbjr commented Nov 13, 2026

Copy link
Copy Markdown

What and why

Fixes #12.

Pokémon Legends: Z-A built from this fork leaves parts of Lumiose invisible: the walkways beside the buildings' ladders are not drawn, while the ladders float and the walkways' collision still holds (#12 reports building walls with floating window frames). Two upstream fixes made after the fork's last sync (2026-10-27) are missing, and this backports both:

  • seedds/nxnative 8fa9b2d1, the base instance from Metal. GLSLC's vertex shaders read the draw's base instance from c0 + 0x644, which the host fills from the draw command. An indirect draw's base instance is in GPU memory, so it was 0 and every GPU-culled instance took the first one's transform. dmsh_build.py's vs_base_instance now reads Metal's [[base_instance]].
  • seedds/nxnative e4e5ff6, -fwrapv. Translated shaders compile with -fwrapv, because signed overflow wraps on the Switch's GPUs and Metal's front end folded around it (dmsh_build.py, ios_metal.py, vk_shaders.py, gl_shaders.py).

Chain 764aff238713 → 8a1b56655ae9 (dmsh_chain.py --header).

Checked

  • Shaders: 775 of Z-A's 28,603 translated shaders read c0 + 0x644 in the form vs_base_instance looks for. Rewritten, all 775 compile with Metal Developer Tools for Windows (metal.exe, air64-apple-ios18.0, with -fwrapv), 0 failures. The full build then made 28,603 of 28,603 iOS libraries, and all 775 read as_type<float>(gl_BaseInstance) with none left on the old form.
  • Games run, with title ID and version: Pokémon Legends: Z-A (0100F43008C44000) 2.0.2 + Mega Dimension DLC, split data build. The walkways beside the ladders in Lumiose, invisible on chain 764aff238713, are drawn on 8a1b56655ae9.
  • Devices and OS: built on Windows 11 (10.0.26300), played on an iPhone with an A18 Pro, iOS 27.2.
  • Not checked: other games, the Mac, Linux builds. The -fwrapv part was not checked on its own in Z-A.
  • A full sync with upstream would bring many more fixes made after 2026-10-27. This PR takes only these two.

Docs

  • No docs changed. The upstream commits' reference entries are not copied.
  • No game files, keys or data extracted from a game in the change or the attachments.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VDGHF5LyEKSqoK23EvYr6W

…o#12)

Pokémon Legends: Z-A built from this fork draws Lumiose's building walls
and the walkways beside its ladders invisible, while their window frames
and ladders float and the walkways' collision still holds. Two upstream
fixes made after the fork's last sync (2026-10-27) are missing:

- seedds/nxnative 8fa9b2d: GLSLC's vertex shaders read the draw's base
  instance from c0 + 0x644, which the host fills from the draw command;
  an indirect draw's base instance is in GPU memory, so it was 0 and
  every GPU-culled instance took the first one's transform.
  dmsh_build.py's vs_base_instance now reads Metal's [[base_instance]].
- seedds/nxnative e4e5ff6: translated shaders compile with -fwrapv, as
  signed overflow wraps on the Switch's GPUs and Metal's front end
  folded around it (dmsh_build.py, ios_metal.py, vk_shaders.py,
  gl_shaders.py).

Chain 764aff238713 -> 8a1b56655ae9 (dmsh_chain.py --header).

Checked: 775 of Z-A's 28,603 translated shaders read c0 + 0x644 by the
text vs_base_instance looks for; all 775, rewritten, compile with Metal
Developer Tools for Windows (metal.exe, air64-apple-ios18.0, with
-fwrapv), 0 failures. A full build made 28,603 of 28,603 iOS libraries,
all 775 with the base instance from Metal and none on the old form. On
an iPhone (A18 Pro, iOS 27.2), Z-A 2.0.2's walkways beside Lumiose's
ladders, invisible on chain 764aff238713, are drawn on 8a1b56655ae9.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VDGHF5LyEKSqoK23EvYr6W
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.

Sync with upstream nxnative (last sync 2026-10-27): Z-A world geometry invisible, #563 base-instance fix missing

1 participant