Shaders: Read uncompressed native records for embedded text shaders #1879

Manually merged
github merged 1 commit from github-bot/gh-1879 into main 2026-11-29 08:21:19 +00:00 AGit
Owner

@⁠rastapasta on GitHub · 2026-11-29 01:23 UTC · original
rastapasta:fix/shader-uncompressed-native-records → main · +148 −6 · 1 files · 1 commits · merged 2026-11-29 08:16 UTC

Fixes three instances of the unsupported-program error reported in #154 and #517.

What it changes

One text vertex shader and two text pixel shaders in the title executable store their native programs in uncompressed FSSM records (XDAT kind 0x0c). The reader skipped those records and reported that all three containers lacked a supported shader stage. It now passes raw records directly to the existing FSSM parser. Packed 0x0d records reach the same parser after decompression.

fuzeofficial (@⁠fuzeofficlal) wrote the reader and its four synthetic regression tests. This port preserves their Git authorship. The original proposal was closed after a shader-archive scan found no examples. Original PR and closing note

How it was tested

Full victory shaders run with an empty cache Cached Refused
Parent f9dfb76 25,701 288
This branch 87d73cb 25,704 285
  • In a separate run on the three affected inputs, the parent refused all three and this branch cached all three. With victory translate --validate --pipelines, each output passed Microsoft DXIL validation. Pairing the vertex shader with each pixel shader created both D3D12 graphics pipelines on a 32-lane NVIDIA RTX PRO 6000 Blackwell (Windows 11, driver 621.14).
  • We used those three emitted shaders to render original F2 glyphs offscreen, once with the bitmap atlas and once with its signed-distance field. Both pairs drew the original placement, a moved and mirrored quad, and a blank atlas on NVIDIA and Microsoft WARP. Across 12 draws, all 46,080 pixels matched the independently computed glyph masks. The maximum absolute RGBA channel error was 1.073e-6 against a tolerance of 0.0005, including partially covered glyph edges.
  • SHA-256 comparison matched all 25,701 baseline cache payloads. The three additional payloads matched the focused run.
  • cargo test --locked -p victory-shader passed 391 tests with 8 ignored. Clippy flags a manual checked division in emit/lower.rs, and cargo xtask policy flags that file’s size. Both findings are present on the parent.

Checked for overlap

  • Reviewed the five open PRs that touch the shared native shader reader in crates/victory-shader/src/native.rs. At each PR head, the XDAT loop still selects only packed 0x0d entries. This port also accepts raw 0x0c entries, which is what lets the existing parser read the three embedded text shaders.
What the other change does Open PR
Adds scalar opcodes and reads root constants from FSPX metadata for an opt-in compute pipeline built from separate parts. #506
Adds a VPP1 path for shader programs assembled from separate pipeline parts. The reader selects it by the part’s own header. #831
Avoids a bytecode copy during IR construction when an already decoded shader needs no export patch. #1240
Also handles programs built from separate pipeline parts. It describes vertex fetches and default pixel inputs and shares resource-record parsing with the FSPX path. #1577
Logs graphics and compute pipeline parts supplied to device methods 0x1c8 and 0x218, and optionally builds a compute pipeline from those parts. #1847

The related project's broader geometry PR also carries a raw FSSM reader. Marvisak/VIctory#1315

**@⁠rastapasta** on GitHub · 2026-11-29 01:23 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1879) `rastapasta:fix/shader-uncompressed-native-records` → `main` · +148 −6 · 1 files · 1 commits · merged 2026-11-29 08:16 UTC Fixes three instances of the unsupported-program error reported in #154 and #517. ## What it changes One text vertex shader and two text pixel shaders in the title executable store their native programs in uncompressed `FSSM` records (XDAT kind `0x0c`). The reader skipped those records and reported that all three containers lacked a supported shader stage. It now passes raw records directly to the existing `FSSM` parser. Packed `0x0d` records reach the same parser after decompression. fuzeofficial (@⁠fuzeofficlal) wrote the reader and its four synthetic regression tests. This port preserves their Git authorship. The original proposal was closed after a shader-archive scan found no examples. [Original PR and closing note](https://github.com/Marvisak/VIctory/pull/3116#issuecomment-7197668726) ## How it was tested | Full `victory shaders` run with an empty cache | Cached | Refused | |---|---:|---:| | Parent `f9dfb76` | 25,701 | 288 | | This branch `87d73cb` | 25,704 | 285 | - In a separate run on the three affected inputs, the parent refused all three and this branch cached all three. With `victory translate --validate --pipelines`, each output passed Microsoft DXIL validation. Pairing the vertex shader with each pixel shader created both D3D12 graphics pipelines on a 32-lane NVIDIA RTX PRO 6000 Blackwell (Windows 11, driver 621.14). - We used those three emitted shaders to render original `F2` glyphs offscreen, once with the bitmap atlas and once with its signed-distance field. Both pairs drew the original placement, a moved and mirrored quad, and a blank atlas on NVIDIA and Microsoft WARP. Across 12 draws, all 46,080 pixels matched the independently computed glyph masks. The maximum absolute RGBA channel error was `1.073e-6` against a tolerance of `0.0005`, including partially covered glyph edges. - SHA-256 comparison matched all 25,701 baseline cache payloads. The three additional payloads matched the focused run. - `cargo test --locked -p victory-shader` passed 391 tests with 8 ignored. Clippy flags a manual checked division in `emit/lower.rs`, and `cargo xtask policy` flags that file’s size. Both findings are present on the parent. ## Checked for overlap - [x] Reviewed the five open PRs that touch the shared native shader reader in `crates/victory-shader/src/native.rs`. At each PR head, the `XDAT` loop still selects only packed `0x0d` entries. This port also accepts raw `0x0c` entries, which is what lets the existing parser read the three embedded text shaders. | What the other change does | Open PR | |---|---| | Adds scalar opcodes and reads root constants from `FSPX` metadata for an opt-in compute pipeline built from separate parts. | [#506](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/pulls/506) | | Adds a `VPP1` path for shader programs assembled from separate pipeline parts. The reader selects it by the part’s own header. | [#831](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/pulls/831) | | Avoids a bytecode copy during IR construction when an already decoded shader needs no export patch. | [#1240](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/pulls/1240) | | Also handles programs built from separate pipeline parts. It describes vertex fetches and default pixel inputs and shares resource-record parsing with the `FSPX` path. | [#1577](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/pulls/1577) | | Logs graphics and compute pipeline parts supplied to device methods `0x1c8` and `0x218`, and optionally builds a compute pipeline from those parts. | [#1847](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/pulls/1847) | The related project's broader geometry PR also carries a raw `FSSM` reader. [Marvisak/VIctory#1315](https://github.com/Marvisak/VIctory/pull/1315)
Ported from Marvisak/VIctory#3116 (ef15cada969aae1632fc0815f8973be486d2ee35).

Three embedded text programs use these uncompressed records. The existing native program reader can parse them directly.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 01:23:59 +00:00
Author
Owner

@⁠Melow-code on GitHub · 2026-11-29 04:59 UTC · original · reviewed

Checked the raw FSSM path on Linux, 87d73cb merged onto main 568c5e5d: no objection.

  • Raw and packed records agree. I flipped every bit of a three-stage record (11,080 bytes) and made 20,000 random dword corruptions, and parsed each as kind 0x0c and, packed, as 0x0d: 101,749 parsed to equal programs, 6,891 were refused by both with the same error, none differed.
  • No panic: 31,708 corruptions and truncations of a part holding both kinds, index included.
  • cargo test -p victory-formats -p victory-shader --lib: 57 and 280 passed (three of them mine), 0 failed.

One change of behaviour, which the triage of Marvisak/VIctory#3116 already raised there: a 0x0c entry was skipped before, and now a bad one refuses the whole part, valid 0x0d programs included. I measured it: a part with a good packed vertex program and a raw record of another version gives Err("unknown FSSM version"); with four bytes of padding after the raw record, Err("FSSM payload size disagrees"). A bad 0x0d entry is treated the same way, and the 25,701 unchanged cache payloads you report say no program the title already had is lost to it, so I would leave it.

Not run: Windows, any card, the title's shaders. The 25,704 and 285 counts are yours, not checked here.

AI-assisted review (Claude Code).

**@⁠Melow-code** on GitHub · 2026-11-29 04:59 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1879#pullrequestreview-6101501948) · **reviewed** Checked the raw `FSSM` path on Linux, 87d73cb merged onto main 568c5e5d: no objection. - Raw and packed records agree. I flipped every bit of a three-stage record (11,080 bytes) and made 20,000 random dword corruptions, and parsed each as kind 0x0c and, packed, as 0x0d: 101,749 parsed to equal programs, 6,891 were refused by both with the same error, none differed. - No panic: 31,708 corruptions and truncations of a part holding both kinds, index included. - `cargo test -p victory-formats -p victory-shader --lib`: 57 and 280 passed (three of them mine), 0 failed. One change of behaviour, which the triage of Marvisak/VIctory#3116 already raised there: a 0x0c entry was skipped before, and now a bad one refuses the whole part, valid 0x0d programs included. I measured it: a part with a good packed vertex program and a raw record of another version gives `Err("unknown FSSM version")`; with four bytes of padding after the raw record, `Err("FSSM payload size disagrees")`. A bad 0x0d entry is treated the same way, and the 25,701 unchanged cache payloads you report say no program the title already had is lost to it, so I would leave it. Not run: Windows, any card, the title's shaders. The 25,704 and 285 counts are yours, not checked here. AI-assisted review (Claude Code).
github manually merged commit ea1c1d24f0 into main 2026-11-29 08:21:19 +00:00
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!1879
No description provided.