victory-shader: support line-topology mesh shaders #1712

Open
github-bot wants to merge 1 commit from github-bot/gh-1712 into main AGit
Owner

@⁠tjthebigbearcat-hub on GitHub · 2026-11-24 21:05 UTC · original
tjthebigbearcat-hub:fix/second-pr → main · +231 −21 · 2 files · 1 commits · open

Summary

Adds support for line-output mesh shaders (topology = 1) alongside triangles (topology = 2) in victory-shader:

  • Updates emit/lower.rs with emit_primitive to unpack two vertex indices (bits 0 and 10) for lines—leaving the third DXIL emitIndices index undef—while preserving primitive culling (bit 31 and unexported primitives).
  • Keeps unsupported topologies (0, 3, etc.) cleanly refused with clearer diagnostic messages.
  • Updates emit/mod.rs module docs to reflect line and triangle mesh shader support.

Verification (Windows 11 + SDK dxil.dll 10.0.26100 + WARP)

  • Added hand-encoded synthetic GFX10 mesh shader tests in emit/mod.rs (zero game bytes; verified with xtask asset-policy check):
    • mesh_programs_draw_lines_or_triangles: validates line and triangle programs (normal and culled) against dxil.dll 10.0.26100 and verifies PSV0 topology output, while confirming topologies 0 and 3 are refused.
    • mesh_lines_light_one_texel_row: executes a line mesh pipeline on WARP (D3D12), verifying 15 lit texels along row 8 and 0 lit texels when culled (verified failure when bit-unpacking offset was mutated).
  • cargo test --workspace --locked: all crates pass, 0 failures.
  • cargo clippy --workspace --all-targets --locked -- -D warnings: 0 warnings.
**@⁠tjthebigbearcat-hub** on GitHub · 2026-11-24 21:05 UTC · [original](https://github.com/Marvisak/VIctory/pull/1712) `tjthebigbearcat-hub:fix/second-pr` → `main` · +231 −21 · 2 files · 1 commits · open ### Summary Adds support for line-output mesh shaders (`topology = 1`) alongside triangles (`topology = 2`) in `victory-shader`: - Updates `emit/lower.rs` with `emit_primitive` to unpack two vertex indices (bits 0 and 10) for lines—leaving the third DXIL `emitIndices` index `undef`—while preserving primitive culling (bit 31 and unexported primitives). - Keeps unsupported topologies (`0`, `3`, etc.) cleanly refused with clearer diagnostic messages. - Updates `emit/mod.rs` module docs to reflect line and triangle mesh shader support. ### Verification (Windows 11 + SDK `dxil.dll` 10.0.26100 + WARP) - Added hand-encoded synthetic GFX10 mesh shader tests in `emit/mod.rs` (zero game bytes; verified with `xtask` asset-policy check): - `mesh_programs_draw_lines_or_triangles`: validates line and triangle programs (normal and culled) against `dxil.dll 10.0.26100` and verifies `PSV0` topology output, while confirming topologies `0` and `3` are refused. - `mesh_lines_light_one_texel_row`: executes a line mesh pipeline on WARP (`D3D12`), verifying 15 lit texels along row 8 and 0 lit texels when culled (verified failure when bit-unpacking offset was mutated). - `cargo test --workspace --locked`: all crates pass, 0 failures. - `cargo clippy --workspace --all-targets --locked -- -D warnings`: **0 warnings**.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:42:24 +00:00
Author
Owner

@⁠steven-seagull27 on GitHub · 2026-11-24 21:42 UTC · original

Tested PR head 57c2560 on an RTX 5080 (driver 621.24) and built-in Windows WARP. Both lit exactly the same 15 pixels on row 8, columns 0–14 inclusive, on the 16 × 16 target. With the cull bit set, both lit 0 of 256 pixels.

The full RGBA readbacks matched bit for bit between adapters on both draws. Both original mesh tests also passed on the clean PR head.

**@⁠steven-seagull27** on GitHub · 2026-11-24 21:42 UTC · [original](https://github.com/Marvisak/VIctory/pull/1712#issuecomment-7145277840) Tested PR head `57c2560` on an RTX 5080 (driver 621.24) and built-in Windows WARP. Both lit exactly the same **15 pixels on row 8, columns 0–14 inclusive**, on the 16 × 16 target. With the cull bit set, both lit **0 of 256 pixels**. The full RGBA readbacks matched bit for bit between adapters on both draws. Both original mesh tests also passed on the clean PR head.
Author
Owner

@⁠kais7654 on GitHub · 2026-11-24 22:35 UTC · original

Reviewed and verified at runtime (Windows): the six mesh tests pass,
including the draw one — the line lit exactly texel row 8 on both the
hardware device and WARP, the culled export lit nothing, and the
translated modules' PSV0 carries the right topology byte. Topologies
other than lines and triangles stay refused with the new message.

One coordination note: this and #1718 touch the same mask line in
emit_indices (10-bit here, 9-bit plus edge flags there) — whoever
merges second needs a trivial rebase of that one line.

**@⁠kais7654** on GitHub · 2026-11-24 22:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/1712#issuecomment-7146421891) Reviewed and verified at runtime (Windows): the six mesh tests pass, including the draw one — the line lit exactly texel row 8 on both the hardware device and WARP, the culled export lit nothing, and the translated modules' PSV0 carries the right topology byte. Topologies other than lines and triangles stay refused with the new message. One coordination note: this and #1718 touch the same mask line in emit_indices (10-bit here, 9-bit plus edge flags there) — whoever merges second needs a trivial rebase of that one line.
Author
Owner

@⁠DeerSilver on GitHub · 2026-11-24 23:06 UTC · original

Setup: one laptop with an NVIDIA GeForce RTX 5060 Laptop GPU (Blackwell, 10de:2d59, driver 621.24) and an Intel UHD Graphics (Raptor Lake Xe-LP, 8086:a788, driver 32.0.101.7088), Windows 11 26300, Rust 1.98.1. The PR was merged onto main 70564ae.

  • cargo test --workspace --all-features --locked --no-fail-fast -- --test-threads=1 with the D3D12 debug layer on (VICTORY_D3D12_DEBUG=1, and a local, uncommitted change that also turns the debug layer on in victory-shader's test Host): 477 passed, 5 failed, 7 ignored. The 5 failures are the ones main 70564ae has by itself on NVIDIA (the view-heap cap and the structured-view stride, already reported in #1744); this PR adds none. No new debug-layer messages compared with main.
  • cargo clippy --workspace --all-targets --locked -- -D warnings, with and without --all-features: clean
  • mesh_lines_light_one_texel_row gives the same result on both devices: hardware: the line lit 15 texels of row 8 on the RTX, and the same on WARP. mesh_programs_draw_lines_or_triangles passes.

No game data used. AI-assisted (Claude Code).

**@⁠DeerSilver** on GitHub · 2026-11-24 23:06 UTC · [original](https://github.com/Marvisak/VIctory/pull/1712#issuecomment-7147023728) **Setup:** one laptop with an NVIDIA GeForce RTX 5060 Laptop GPU (Blackwell, `10de:2d59`, driver 621.24) and an Intel UHD Graphics (Raptor Lake Xe-LP, `8086:a788`, driver 32.0.101.7088), Windows 11 26300, Rust 1.98.1. The PR was merged onto `main` `70564ae`. - `cargo test --workspace --all-features --locked --no-fail-fast -- --test-threads=1` with the D3D12 debug layer on (`VICTORY_D3D12_DEBUG=1`, and a local, uncommitted change that also turns the debug layer on in victory-shader's test `Host`): 477 passed, 5 failed, 7 ignored. The 5 failures are the ones `main` `70564ae` has by itself on NVIDIA (the view-heap cap and the structured-view stride, already reported in #1744); this PR adds none. No new debug-layer messages compared with `main`. - `cargo clippy --workspace --all-targets --locked -- -D warnings`, with and without `--all-features`: clean - `mesh_lines_light_one_texel_row` gives the same result on both devices: `hardware: the line lit 15 texels of row 8` on the RTX, and the same on WARP. `mesh_programs_draw_lines_or_triangles` passes. No game data used. AI-assisted (Claude Code).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 01:34 UTC · original · edited 2026-11-25 06:25 UTC

Automated triage for the maintainers.

Merge candidate. This lets mesh programs that draw lines translate. mesh_prologue and the primitive export in crates/victory-shader/src/emit/lower.rs go through a new emit_primitive, which passes as many 9-bit indices as corners(topology) gives and leaves the third undefined for a line. Topologies other than 1 and 2 stay refused. The topology numbering (1 lines, 2 triangles) is the one MeshIo::topology in native.rs already documents, and it matches DXIL's, which passes it through to PSV0. Upstream's 0x1FF index mask is kept. The new draw test, mesh_lines_light_one_texel_row, was reported in this thread to light only row 8 and to cull completely on an RTX 5080, an RTX 5060 Laptop, an Intel UHD and WARP.

Thanks for the rebase, which kept main's edge-flag tests. It merges cleanly now, so this is the first content review.

CI: passing (check).


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 01:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/1712#issuecomment-7149712601) · edited 2026-11-25 06:25 UTC <!-- victory-triage v1 head=ff8c44552b9d21bfa7ba8d8f65bd99c9cc00f06c verdict=merge-candidate at=2026-11-25T06:27:30Z --> Automated triage for the maintainers. **Merge candidate.** This lets mesh programs that draw lines translate. `mesh_prologue` and the primitive export in `crates/victory-shader/src/emit/lower.rs` go through a new `emit_primitive`, which passes as many 9-bit indices as `corners(topology)` gives and leaves the third undefined for a line. Topologies other than 1 and 2 stay refused. The topology numbering (1 lines, 2 triangles) is the one `MeshIo::topology` in `native.rs` already documents, and it matches DXIL's, which passes it through to PSV0. Upstream's `0x1FF` index mask is kept. The new draw test, `mesh_lines_light_one_texel_row`, was reported in this thread to light only row 8 and to cull completely on an RTX 5080, an RTX 5060 Laptop, an Intel UHD and WARP. Thanks for the rebase, which kept `main`'s edge-flag tests. It merges cleanly now, so this is the first content review. CI: passing (`check`). --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠tjthebigbearcat-hub on GitHub · 2026-11-25 03:21 UTC · original

Rebased cleanly onto current main (940d32f → ff8c445):

  • Integrated upstream's 9-bit 0x1FF vertex index edge-flag mask into the line/triangle primitive export loop and kept both upstream's edge-flag tests and our line-mesh tests.
  • Re-verified cargo test -p victory-shader --locked mesh (7 passed, 0 failed) and cargo clippy (0 warnings).
**@⁠tjthebigbearcat-hub** on GitHub · 2026-11-25 03:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/1712#issuecomment-7151830939) Rebased cleanly onto current `main` (`940d32f` → `ff8c445`): - Integrated upstream's 9-bit `0x1FF` vertex index edge-flag mask into the line/triangle primitive export loop and kept both upstream's edge-flag tests and our line-mesh tests. - Re-verified `cargo test -p victory-shader --locked mesh` (7 passed, 0 failed) and `cargo clippy` (0 warnings).
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

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

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1712'
git switch 'github-bot/gh-1712'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1712'
git switch 'github-bot/gh-1712'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1712'
git switch 'main'
git merge --squash 'github-bot/gh-1712'
git switch 'main'
git merge --ff-only 'github-bot/gh-1712'
git switch 'main'
git merge 'github-bot/gh-1712'
git push origin 'main'
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/Marvisak--VIctory!1712
No description provided.