Skip to content

Fix Pyright inference in the logic-op shader generator - #1019

Closed
thehobbit85 wants to merge 2 commits into
seedds:mainfrom
thehobbit85:codex/logic-variant-source-types
Closed

thehobbit85 wants to merge 2 commits into
seedds:mainfrom
thehobbit85:codex/logic-variant-source-types

Conversation

@thehobbit85

@thehobbit85 thehobbit85 commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Upstream commit f714e138 fixes the generator’s Pyright inference on main. Compared with this PR, the generator syntax trees match after renaming two locals. Eight CPU tests passed on main and all 128 successful shader variants matched exactly in source and entry names. The generated header must follow main’s current inputs. The separate geometry-fixture teardown and its ownership assertions remain tracked in #959.

Original proposal and validation

Cause and fix

Main at b1dee89c introduced a Pyright error in dmsh_logic.variant. The generator used apply for a list of shader assignments, then reassigned it to the joined Metal source string. Pyright retained the list possibility when it checked the regular-expression callback. The generator now accumulates the list in assignments so the callback captures a string. The Python lint job on main and the same check on #684 and #896 reproduced this error.

The generated header changes the shader-chain version from be66496d6205 to b669b3d7a206 because the chain hashes the generator source. Rebuild shader libraries for the new cache namespace. The first commit carries the geometry-test fixture repair from #959, which the C lint job also needs on this base. The generator fix and its header are together in the second commit.

Validation

  • The pinned Python lint tools reproduced 392 findings on main against a baseline of 391. The candidate reports 391, with zero new or stale findings. Both lint baselines are unchanged.
  • All 22 focused logic-op and chain tests passed, including synthetic compilation for macOS and iOS. The Mac host built and the full native graphics suite passed on an M2 Max, including 929 logic-operation checks. Six optional Wonder reflection samples were unavailable.
  • The old and new generators returned identical output for 128 synthetic cases covering eight color slots, integer and normalized output widths, dual outputs and multiple returns. They also agreed on all 28,603 cached Pokémon Legends Z-A shader sources, including 16,818 that produced a logic-op variant.
  • Clang-tidy 23.1.4 checked all 217 translation units. Its 271 findings exactly matched the existing baseline.

Game coverage

The regression selection covers Xenoblade Chronicles 2 for integer OR, Skyward Sword HD for normalized OR, Breath of the Wild and Super Mario Bros. Wonder for NVN coverage, and Pokémon Legends Z-A for its available shader corpus. The usage manifests also identify Pokémon Scarlet and Tears of the Kingdom as logic-op users.

The five-game regression command stopped before comparison because only Z-A had a local Mac build. The compiler preflight found Metal 32023.921.6 on this machine. Full shader rebuilds require the pinned 32023.922.4. Validation on game data therefore covers the cached Z-A source comparison above. Full library rebuilds, gameplay and device testing remain unverified.

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