Game: name rasterisers from the pack's register images #3045

Open
zed6000 wants to merge 2 commits from upstream-pr/3047 into main
zed6000 commented 2026-11-26 05:14:37 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by zed6000 on 2026-11-26T05:14:37Z.


Closes the rasteriser half of #2930.

translate --cache --pipelines skipped 852 of the pack's pipelines as rasteriser state not named: 6 of the pack's 18 rasteriser hashes have slope biases (and for 5, a DepthBiasClamp) that raster_space doesn't list. The register images do keep the rasteriser. In the fixed part registers() reads, the 7 words from +0x28 are PA_CL_CLIP_CNTL, PA_SU_SC_MODE_CNTL, two unused words, PA_SU_POLY_OFFSET_CLAMP, _FRONT_SCALE and _FRONT_OFFSET.

raster_from_registers reads cull (CULL_FRONT → 2, CULL_BACK → 3, neither → 1), winding (FACE clear → counter-clockwise), depth clip (both ZCLIP_*_DISABLE clear), the clamp as is, the slope bias as scale / 16 and the integer bias as the offset. It enumerates b13–b15, which these words don't hold. Wireframe, both-faces culling and non-integer offsets give nothing. name_from_registers tries it for every record whose rasteriser is still wanted, before the enumeration. As before, a description counts only if its CityHash64 is the record's.

Measured on shaders.rpf 1.0.2.1 (offline, RX 7900 XTX):

  • For all 24,619 records whose rasteriser main already names, the registers give the named description in every field.
  • All 18 rasteriser hashes are named (3 database, 15 registers). Records with all three states named go from 24,477 to 25,329 of 25,471. Named::find time is unchanged (~85 ms).
  • translate --cache --pipelines: rasteriser state not named goes from 852 to 0. Every pipeline was created and none refused. One of the newly named pipelines is in an earlier game run's early-pipelines.txt under the same key, which includes the whole D3D12 rasteriser description.
  • cargo test -p victory-game 17/0 (2 new tests, on synthetic registers), and cargo clippy -p victory-game -p victory --all-targets --locked -- -D warnings clean.

This doesn't conflict in purpose with #2575 / #2787: with every rasteriser named from the registers, their early stop ends raster_space immediately.

No game data: the tests use made-up register values.

🤖 Generated with Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:issue:5504426155 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3047). Originally posted by [zed6000](https://github.com/zed6000) on 2026-11-26T05:14:37Z. --- Closes the rasteriser half of #2930. `translate --cache --pipelines` skipped 852 of the pack's pipelines as `rasteriser state not named`: 6 of the pack's 18 rasteriser hashes have slope biases (and for 5, a `DepthBiasClamp`) that `raster_space` doesn't list. The register images do keep the rasteriser. In the fixed part `registers()` reads, the 7 words from `+0x28` are `PA_CL_CLIP_CNTL`, `PA_SU_SC_MODE_CNTL`, two unused words, `PA_SU_POLY_OFFSET_CLAMP`, `_FRONT_SCALE` and `_FRONT_OFFSET`. `raster_from_registers` reads cull (`CULL_FRONT` → 2, `CULL_BACK` → 3, neither → 1), winding (`FACE` clear → counter-clockwise), depth clip (both `ZCLIP_*_DISABLE` clear), the clamp as is, the slope bias as scale / 16 and the integer bias as the offset. It enumerates b13–b15, which these words don't hold. Wireframe, both-faces culling and non-integer offsets give nothing. `name_from_registers` tries it for every record whose rasteriser is still wanted, before the enumeration. As before, a description counts only if its CityHash64 is the record's. Measured on `shaders.rpf` 1.0.2.1 (offline, RX 7900 XTX): - For all 24,619 records whose rasteriser `main` already names, the registers give the named description in every field. - All 18 rasteriser hashes are named (3 database, 15 registers). Records with all three states named go from 24,477 to 25,329 of 25,471. `Named::find` time is unchanged (~85 ms). - `translate --cache --pipelines`: `rasteriser state not named` goes from 852 to 0. Every pipeline was created and none refused. One of the newly named pipelines is in an earlier game run's `early-pipelines.txt` under the same key, which includes the whole D3D12 rasteriser description. - `cargo test -p victory-game` 17/0 (2 new tests, on synthetic registers), and `cargo clippy -p victory-game -p victory --all-targets --locked -- -D warnings` clean. This doesn't conflict in purpose with #2575 / #2787: with every rasteriser named from the registers, their early stop ends `raster_space` immediately. No game data: the tests use made-up register values. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
fuzeofficlal commented 2026-11-26 05:20:36 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T05:20:36Z.

Review: APPROVED


Static review of 3c4c7d85 (crates/victory-game/src/pipelines.rs).

Verified the AMD GFX10 rasteriser register decoding against rasterizer_desc and raster_space:

  • PA_CL_CLIP_CNTL bits 26–27 (ZCLIP_NEAR_DISABLE | ZCLIP_FAR_DISABLE) -> b[12] (depth_clip).
  • PA_SU_SC_MODE_CNTL bits 0–1 (CULL_FRONT | CULL_BACK) -> 1/2/3, bit 2 (FACE) -> ccw, bits 3–4 (POLY_MODE) -> solid-only filter.
  • PA_SU_POLY_OFFSET_CLAMP, _FRONT_SCALE / 16.0, and _FRONT_OFFSET (with fract() == 0.0 and (-128.0..=127.0) range check that also rejects NaN/infinities).
  • Tail enumeration (0..16) covers the exact [b[13], b[14], b[15]] space that raster_space uses, deduplicated by (rasterizer_hash, regs) so Named::find stays fast and exact via CityHash64.

Clean, focused, and well tested.

<!-- greyfinch-sync:Marvisak/VIctory:review:6068932569 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3047#pullrequestreview-6068932569). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T05:20:36Z. **Review:** APPROVED --- Static review of `3c4c7d85` (`crates/victory-game/src/pipelines.rs`). Verified the AMD GFX10 rasteriser register decoding against `rasterizer_desc` and `raster_space`: - `PA_CL_CLIP_CNTL` bits 26–27 (`ZCLIP_NEAR_DISABLE | ZCLIP_FAR_DISABLE`) -> `b[12]` (`depth_clip`). - `PA_SU_SC_MODE_CNTL` bits 0–1 (`CULL_FRONT | CULL_BACK`) -> `1/2/3`, bit 2 (`FACE`) -> `ccw`, bits 3–4 (`POLY_MODE`) -> solid-only filter. - `PA_SU_POLY_OFFSET_CLAMP`, `_FRONT_SCALE / 16.0`, and `_FRONT_OFFSET` (with `fract() == 0.0` and `(-128.0..=127.0)` range check that also rejects NaN/infinities). - Tail enumeration (`0..16`) covers the exact `[b[13], b[14], b[15]]` space that `raster_space` uses, deduplicated by `(rasterizer_hash, regs)` so `Named::find` stays fast and exact via CityHash64. Clean, focused, and well tested.
kotekompotek commented 2026-11-26 05:27:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-26T05:27:04Z.

Review: APPROVED


Verified: raster_registers locates the rasteriser image at base+0x28 (0x74/0xc8 by shader stage, matching registers), raster_from_registers rejects wireframe/both-culled/fractional-bias cases that D3D12 can't express, decodes cull, winding, depth-clip, clamp verbatim and slope bias as scale/16, then enumerates only the three unkept tail bytes. tried_raster dedups repeated images. The test asserts the exact 16-byte block for a decoded case plus every rejection path.

<!-- greyfinch-sync:Marvisak/VIctory:review:6068976358 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3047#pullrequestreview-6068976358). Originally posted by [kotekompotek](https://github.com/kotekompotek) on 2026-11-26T05:27:04Z. **Review:** APPROVED --- Verified: `raster_registers` locates the rasteriser image at base+0x28 (0x74/0xc8 by shader stage, matching `registers`), `raster_from_registers` rejects wireframe/both-culled/fractional-bias cases that D3D12 can't express, decodes cull, winding, depth-clip, clamp verbatim and slope bias as scale/16, then enumerates only the three unkept tail bytes. `tried_raster` dedups repeated images. The test asserts the exact 16-byte block for a decoded case plus every rejection path.
Marvisak commented 2026-11-26 07:01:45 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-26T06:16:58Z.


Automated triage for the maintainers.

Verdict: merge candidate. crates/victory-game/src/pipelines.rs: raster_registers reads the 7 words from 0x28 into the fixed part of the register image, which ends exactly where registers() starts (0x44). raster_from_registers decodes cull from PA_SU_SC_MODE_CNTL bits 0-1 (none/front/back as D3D12 1/2/3, both culled skipped), winding from FACE (bit 2), wireframe from POLY_MODE (bits 3-4), and depth clip from the two ZCLIP_*_DISABLE bits (26-27) of PA_CL_CLIP_CNTL. These bit positions match the public RDNA2 register reference. The slope scale over 16 is how AMD hardware stores the slope bias. A candidate still counts only when its CityHash64 equals the record's hash, so a wrong decode would name nothing rather than name the wrong state. Named::find tries it before the enumeration, and the tests use synthetic register values.

CI: check passing. #3048 is stacked on this PR.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7184274850 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3047#issuecomment-7184274850). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-26T06:16:58Z. --- <!-- victory-triage v1 head=3c4c7d85cbdd674b338e3e5bcd56410ecac4e401 verdict=merge-candidate at=2026-11-26T06:16:51Z --> Automated triage for the maintainers. **Verdict: merge candidate.** `crates/victory-game/src/pipelines.rs`: `raster_registers` reads the 7 words from 0x28 into the fixed part of the register image, which ends exactly where `registers()` starts (0x44). `raster_from_registers` decodes cull from `PA_SU_SC_MODE_CNTL` bits 0-1 (none/front/back as D3D12 1/2/3, both culled skipped), winding from `FACE` (bit 2), wireframe from `POLY_MODE` (bits 3-4), and depth clip from the two `ZCLIP_*_DISABLE` bits (26-27) of `PA_CL_CLIP_CNTL`. These bit positions match the public RDNA2 register reference. The slope scale over 16 is how AMD hardware stores the slope bias. A candidate still counts only when its CityHash64 equals the record's hash, so a wrong decode would name nothing rather than name the wrong state. `Named::find` tries it before the enumeration, and the tests use synthetic register values. CI: `check` passing. #3048 is stacked on this PR. --- _Generated by [Claude Code](https://claude.ai/code)_
andrewpozdnakov7-jpg commented 2026-11-26 15:02:32 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-26T14:36:34Z.


I checked the full Pack::parse → Named::find path on main 63bcca4 and exact head 3c4c7d8 with the same synthetic fixture. Main found 0/2 rasteriser descriptions. The PR found 2/2 directly from the registers, with the expected bytes for both the vertex and mesh layouts. Both builds left two controls with a different nonzero clamp hash unresolved. The PR plus the fixture passed 18/18 victory-game lib tests, strict Clippy, and policy.

I put the optional test directly on your head. If folded into your commit, please retain Co-authored-by: andrewpozdnakov7-jpg <[email protected]>. Test commit

AI-assisted with Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7195065554 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3047#issuecomment-7195065554). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-26T14:36:34Z. --- I checked the full `Pack::parse` → `Named::find` path on main `63bcca4` and exact head `3c4c7d8` with the same synthetic fixture. Main found **0/2** rasteriser descriptions. The PR found **2/2** directly from the registers, with the expected bytes for both the vertex and mesh layouts. Both builds left two controls with a different nonzero clamp hash unresolved. The PR plus the fixture passed **18/18** `victory-game` lib tests, strict Clippy, and policy. I put the optional test directly on your head. If folded into your commit, please retain `Co-authored-by: andrewpozdnakov7-jpg <[email protected]>`. [Test commit](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/3e24d1621cc132cc0fad984a8d89d31e24e82ba4) AI-assisted with Codex.
Dukestar69 commented 2026-11-26 17:51:11 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T17:51:11Z.

Review: APPROVED


Reviewed and verified locally on Windows 11 x64:

  • cargo test -p victory-game -- --test-threads=1: 17 passed, 0 failed (including a_rasteriser_reads_from_its_registers and a_record_names_its_rasteriser_from_the_register_image).
  • cargo clippy -p victory-game --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6078629494 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3047#pullrequestreview-6078629494). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T17:51:11Z. **Review:** APPROVED --- Reviewed and verified locally on Windows 11 x64: - `cargo test -p victory-game -- --test-threads=1`: 17 passed, 0 failed (including `a_rasteriser_reads_from_its_registers` and `a_record_names_its_rasteriser_from_the_register_image`). - `cargo clippy -p victory-game --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
futurepro62 commented 2026-11-26 19:12:53 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by futurepro62 on 2026-11-26T19:12:53Z.


NVIDIA full-suite run, to go with the reports above by Dukestar69, andrewpozdnakov7-jpg, since none of them names a GPU run. Tested exact head 3c4c7d8 (on its base 63bcca4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 868 passed, 0 failed, 10 ignored.
  • The new tests ran and passed: a_rasteriser_reads_from_its_registers, a_record_names_its_rasteriser_from_the_register_image.
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
<!-- greyfinch-sync:Marvisak/VIctory:comment:7201320898 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3047#issuecomment-7201320898). Originally posted by [futurepro62](https://github.com/futurepro62) on 2026-11-26T19:12:53Z. --- NVIDIA full-suite run, to go with the reports above by Dukestar69, andrewpozdnakov7-jpg, since none of them names a GPU run. Tested exact head `3c4c7d8` (on its base `63bcca4`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **868 passed, 0 failed, 10 ignored**. - The new tests ran and passed: `a_rasteriser_reads_from_its_registers`, `a_record_names_its_rasteriser_from_the_register_image`. - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
zed6000 commented 2026-11-28 09:14:35 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by zed6000 on 2026-11-28T09:14:35Z.


Thanks @andrewpozdnakov7-jpg. Your test is now on this branch as your own commit, 3e24d16, with your authorship unchanged. On an RX 7900 XTX, victory-game --lib passes (18 tests), strict clippy passes with and without --all-features, and so does the asset-policy check.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7237110900 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3047#issuecomment-7237110900). Originally posted by [zed6000](https://github.com/zed6000) on 2026-11-28T09:14:35Z. --- Thanks @andrewpozdnakov7-jpg. Your test is now on this branch as your own commit, `3e24d16`, with your authorship unchanged. On an RX 7900 XTX, `victory-game --lib` passes (18 tests), strict clippy passes with and without `--all-features`, and so does the asset-policy check.
andrewpozdnakov7-jpg commented 2026-11-28 09:19:49 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-28T09:19:49Z.


I verified 3e24d16 and the retained Git author. All 18 victory-game tests passed on the exact head, including both pack layouts, along with strict Clippy and the asset policy.

The Windows CI failure happens after the same 18 game tests pass. Both Clippy steps pass too. The failing workspace test is frame::tests::waits_end_on_ticks_and_count_frames at frame.rs:231, where the zero-timeout poll returned S_OK instead of S_FALSE. The existing comparison in #2877 recorded the same failure on main. Could a maintainer rerun the failed check?

AI-assisted with OpenAI Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7237168375 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3047#issuecomment-7237168375). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-28T09:19:49Z. --- I verified `3e24d16` and the retained Git author. All 18 `victory-game` tests passed on the exact head, including both pack layouts, along with strict Clippy and the asset policy. The [Windows CI failure](https://github.com/Marvisak/VIctory/actions/runs/46129520686/job/140931409627) happens after the same 18 game tests pass. Both Clippy steps pass too. The failing workspace test is `frame::tests::waits_end_on_ticks_and_count_frames` at `frame.rs:231`, where the zero-timeout poll returned `S_OK` instead of `S_FALSE`. [The existing comparison in #2877](https://github.com/Marvisak/VIctory/pull/2877#issuecomment-7223291370) recorded the same failure on main. Could a maintainer rerun the failed check? AI-assisted with OpenAI Codex.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/3047:upstream-pr/3047'
git switch 'upstream-pr/3047'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/3047'
git switch 'upstream-pr/3047'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/3047'
git switch 'upstream-pr/3047'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/3047'
git switch 'main'
git merge --squash 'upstream-pr/3047'
git switch 'main'
git merge --ff-only 'upstream-pr/3047'
git switch 'main'
git merge 'upstream-pr/3047'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
Marvisak/VIctory!3045
No description provided.