Skip to content

Reserve the viewport index in geometry compute output - #1018

Open
psdevhh wants to merge 1 commit into
seedds:mainfrom
psdevhh:codex/geometry-viewport-reservation
Open

psdevhh wants to merge 1 commit into
seedds:mainfrom
psdevhh:codex/geometry-viewport-reservation

Conversation

@psdevhh

@psdevhh psdevhh commented Nov 3, 2026 •

Copy link
Copy Markdown

What and why

ResourceReservations.FillIoOffsetMap reserved VertexIndex for geometry shaders that set UsesViewportIndex. Without a viewport-index slot, the geometry-to-compute transform left a raster output on a Metal kernel, and the reader used the wrong builtin.

Reserve ViewportIndex so the compute pass stores the value in the emitted vertex record and the raster pass reads that field. Include the reservation source in the chain fingerprint and refresh the translator artifacts, lock and generated header.

Checked

  • Documentation, chain and tool-lock checks passed after rebasing onto dac4a433. The upstream SARC reader change leaves the tested translation inputs identical.

  • Standalone branch on main at b1dee89c. Geometry, shader-chain and documentation tests passed (44 tests, one optional skip). The new dynamic viewport-index regression compiled the compute kernel and raster reader for all five input topologies with both the macOS and iOS Metal compilers.

  • Prior integration run on Apple M4, macOS 27.2. Both real Alien: Isolation 010075D00E8BA000 geometry shaders failed with the old translator and compiled with the fix for macOS and iOS. All 12 Metroid Prime Remastered geometry shaders compiled and their 105 generated Metal sources matched the old baseline.

  • Rebased checks on Apple M4, macOS 27.2 and Xcode 27.2. The synthetic regression failed on all five topologies with the current upstream translator. Both real Alien: Isolation geometry shaders compiled for macOS and iOS with this branch. All 12 Metroid Prime Remastered 1.0.0 geometry shaders compiled on both revisions, and all 105 generated Metal sources matched.

  • Metroid Prime Remastered covers real geometry shaders. Dark Souls Remastered 1.0.3 covers an NVN shader set without geometry. The rebased regression comparison built 3,099 of 3,099 Dark Souls shaders on each revision with zero changed Metal sources or new interface failures. These are shader comparisons. Gameplay on other titles and iOS was outside this check.

  • Python lint reports the same upstream finding in dmsh_logic.py:83 as on main. GitHub clang-tidy reports two findings in the unchanged t_geometry_hazards.m, covered by upstream PR C lint: t_geometry_hazards checks its readback buffer, and notes who owns its program #979.

Rebased regression report

regress.py check (full): PASS

Baseline origin/main b1dee89, candidate HEAD 44eabf6; Apple M4, macOS 27.2, Xcode 27.2; 1.5 s

game status shaders (base → cand) newly failing newly building changed MSL interface (new / known) boot fps p50 frame p99 ms peak MB prepare s new RED
01004AB00A260000 01004AB00A260000 PASS 3099/3099 → 3099/3099 0 0 0 0 / 0 – – – – – –

01004AB00A260000 01004AB00A260000: PASS

  • time: chain 0.9 s
Prior integration regression report

regress.py check (full): PASS

Baseline origin/main 65501fb, candidate worktree 65501fb (+ uncommitted changes); Apple M4, macOS 27.2, Xcode 27.2; 126 s

game status shaders (base → cand) newly failing newly building changed MSL interface (new / known) boot fps p50 frame p99 ms peak MB prepare s new RED
01004AB00A260000 01004AB00A260000 PASS 3099/3099 → 3099/3099 0 0 0 0 / 0 – – – – – –

01004AB00A260000 01004AB00A260000: PASS

  • time: chain 125.7 s

Docs

  • Added docs/reference/shaders.md#viewport-indices-in-geometry-compute-records and regenerated the symptom index.
  • Ran dmsh_chain.py --header and committed the generated header. tool_lock.py --check-tools passed.
  • The change contains source, built translator tools and synthetic tests.

@psdevhh
psdevhh force-pushed the codex/geometry-viewport-reservation branch from 44eabf6 to 9e7e06f Compare November 3, 2026 01:08
@github-actions github-actions Bot added nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests) tools Tools and scripts (dm/tools, scripts) docs Documentation shader chain The shader translation chain (DMSH_CHAIN): a change rebuilds every game's shaders labels Nov 3, 2026
The reservation for UsesViewportIndex used VertexIndex. The missing slot left a raster output on the compute kernel and gave the reader the wrong builtin. Reserve ViewportIndex and refresh the translator and chain. The synthetic regression compiles the kernel and raster reader for five input topologies on Mac and iOS.
@psdevhh
psdevhh force-pushed the codex/geometry-viewport-reservation branch from 9e7e06f to 583b81c Compare November 3, 2026 08:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Documentation nvn NVN on Metal and its tests (dm/gfx/nvn, dm/gfx/tests) shader chain The shader translation chain (DMSH_CHAIN): a change rebuilds every game's shaders tools Tools and scripts (dm/tools, scripts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant