PS-INPUT-SIGNATURE: select pixel shaders by source container signature #514

Open
github-bot wants to merge 2 commits from github-bot/gh-514 into main AGit
Owner

@⁠bobcatchris on GitHub · 2026-11-24 06:42 UTC · original
bobcatchris:pixel-input-signature → main · +138 −7 · 6 files · 2 commits · open

Claimed in the coordination issue as: PS-INPUT-SIGNATURE

Depends on: #505

What and why

Two containers can hold the same pixel program while declaring SV_Position differently: one uses depth, the other reciprocal W. The first entry in the shader index can then bind a translation whose position convention does not match the source container, turning a red draw black or the reverse.

This selects pixel shader translations by the source container's input signature. It follows #505, which introduces the shared signature-aware candidate selection used here.

Carried from the source patch:
github.com/Sigtryggur-Mani-Gudmundsson/graphics-runtime-patches@33ab48d3ea/README.md (pixel-shaders-with-the-same-program-and-different-position-inputs)

No game data, keys, or decryption are included.

Tested

  • Built and ran shader_library_test with the full two-commit stack: OK
  • python -I tests/test_shader_meta.py — OK
  • python -I tests/test_docs_links.py — OK
  • python -I tests/test_docs_cli_flags.py — OK
  • python -I tests/test_ci_registration.py — OK
  • python -m compileall -q tools tests — OK
  • pixel-only diff and full stack git diff --check clean
  • security sweeps: 0 hits

The source report measured the two cases on an RTX 4070 Ti: 4096 black pixels with the original lookup and 4096 red pixels after the fix for the reciprocal-W case, and the reverse for the depth case. I did not repeat that GPU measurement locally.

GPUs tested: n/a locally; source report used NVIDIA GeForce RTX 4070 Ti

AI-assisted: yes

Checklist

  • Based on current main plus the stated dependency and merges cleanly.
  • One topic; the dependency commit is #505.
  • No game data, keys or decryption.
  • Regression tests added for source-container pixel selection and shader metadata.
**@⁠bobcatchris** on GitHub · 2026-11-24 06:42 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/514) `bobcatchris:pixel-input-signature` → `main` · +138 −7 · 6 files · 2 commits · open Claimed in the coordination issue as: PS-INPUT-SIGNATURE Depends on: #505 ### What and why Two containers can hold the same pixel program while declaring `SV_Position` differently: one uses depth, the other reciprocal W. The first entry in the shader index can then bind a translation whose position convention does not match the source container, turning a red draw black or the reverse. This selects pixel shader translations by the source container's input signature. It follows #505, which introduces the shared signature-aware candidate selection used here. Carried from the source patch: https://github.com/Sigtryggur-Mani-Gudmundsson/graphics-runtime-patches/blob/33ab48d3ea90f9925351aeee8708181a71fb9634/README.md#pixel-shaders-with-the-same-program-and-different-position-inputs No game data, keys, or decryption are included. ### Tested - Built and ran `shader_library_test` with the full two-commit stack: OK - `python -I tests/test_shader_meta.py` — OK - `python -I tests/test_docs_links.py` — OK - `python -I tests/test_docs_cli_flags.py` — OK - `python -I tests/test_ci_registration.py` — OK - `python -m compileall -q tools tests` — OK - pixel-only diff and full stack `git diff --check` clean - security sweeps: 0 hits The source report measured the two cases on an RTX 4070 Ti: 4096 black pixels with the original lookup and 4096 red pixels after the fix for the reciprocal-W case, and the reverse for the depth case. I did not repeat that GPU measurement locally. GPUs tested: n/a locally; source report used NVIDIA GeForce RTX 4070 Ti AI-assisted: yes ### Checklist - [x] Based on current `main` plus the stated dependency and merges cleanly. - [x] One topic; the dependency commit is #505. - [x] No game data, keys or decryption. - [x] Regression tests added for source-container pixel selection and shader metadata.
Two vertex shader containers can contain the same native program and the same semantic names while assigning POSITION and COLOR to different registers. The first entry in the shader index can then bind a translation whose input signature does not match the pipeline's input layout. Compare the ISG1 input signature recorded by shader_meta.py against the PSO bytecode when several candidates share a hash, and keep the existing layout-based fallback when no indexed signature matches.

Carried from the source patch by the graphics-runtime-patches collection:
33ab48d3ea/README.md (vertex-shader-selection-for-programs-with-shared-hashes)

AI-assisted.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:05:08 +00:00
Author
Owner

@⁠PierreEbele on GitHub · 2026-11-24 21:26 UTC · original

Reviewed 629abfd9: ran tests/test_shader_meta.py on the PR and main (29/28 pass; the new test fails on main with {} != {'input_signature': []}), built and ran runtime/test/shader_library_test on both trees (passes; the copied test does not compile on main as it uses the new candidates() overload), and fuzzed read_dxbc_meta with 4,008 synthetic ISG1 chunks: no exceptions, the only behavior change is the documented empty-signature recording, and a port of matches_isg1 round-trips every recorded signature except non-ASCII semantic names or component types outside 1..3, which fall back to the full candidate list as before. No findings; the Windows-only device change is a mechanical span refactor (desk-checked). AI-assisted review.

Recommendation: Merge

**@⁠PierreEbele** on GitHub · 2026-11-24 21:26 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/514#issuecomment-7144929566) Reviewed 629abfd9: ran tests/test_shader_meta.py on the PR and main (29/28 pass; the new test fails on main with {} != {'input_signature': []}), built and ran runtime/test/shader_library_test on both trees (passes; the copied test does not compile on main as it uses the new candidates() overload), and fuzzed read_dxbc_meta with 4,008 synthetic ISG1 chunks: no exceptions, the only behavior change is the documented empty-signature recording, and a port of matches_isg1 round-trips every recorded signature except non-ASCII semantic names or component types outside 1..3, which fall back to the full candidate list as before. No findings; the Windows-only device change is a mechanical span refactor (desk-checked). AI-assisted review. **Recommendation:** Merge
Author
Owner

@⁠bobcatchris on GitHub · 2026-11-24 23:42 UTC · original

Rebased onto the updated #505 branch, preserving the dependency without duplicating the VS commit. Verified: shader_library_test passes, test_shader_meta.py 29/29, no-game-data and security checks clean.

**@⁠bobcatchris** on GitHub · 2026-11-24 23:42 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/514#issuecomment-7147711275) Rebased onto the updated #505 branch, preserving the dependency without duplicating the VS commit. Verified: shader_library_test passes, test_shader_meta.py 29/29, no-game-data and security checks clean.
This pull request has changes conflicting with the target branch.
  • runtime/shims/d3d12_vulkan_device.cpp
  • runtime/src/shader_library.h
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/514/head:github-bot/gh-514'
git switch 'github-bot/gh-514'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-514'
git switch 'github-bot/gh-514'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-514'
git switch 'github-bot/gh-514'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-514'
git switch 'main'
git merge --squash 'github-bot/gh-514'
git switch 'main'
git merge --ff-only 'github-bot/gh-514'
git switch 'main'
git merge 'github-bot/gh-514'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.