GPU: preserve pixel masks when linking oversized mesh shaders #1904

Manually merged
github merged 1 commit from github-bot/gh-1904 into gh-pr/1904/base 2026-11-29 08:21:21 +00:00 AGit
Owner

@⁠73N1X on GitHub · 2026-11-29 02:09 UTC · original
skAInet-labs:nv06/mesh-link-pixel-mask → main · +199 −18 · 3 files · 1 commits · merged 2026-11-29 08:16 UTC

Problem

Oversized mesh shader output linking reconstructs the paired
pixel shader. The existing implementation loses the pixel
shader's masked translation state during that reconstruction.

Consequently, mesh linking and console sample-mask emulation
do not compose correctly.

Changes

  • Preserve the pixel shader's mask state through mesh linking.
  • Compose linked and masked translation variants.
  • Keep cache identities distinct for all supported variants.
  • Preserve the existing unmasked variant key derivation.
  • Add synthetic translation and cache regression tests.

Validation

Windows x64, synthetic shaders and DXIL validation.

Suite Baseline Candidate
Shader tests passed 386 387
Shader tests failed 1 1
Shader tests ignored 8 8
Shader cache tests passed 4 5
  • All 399 common test outcomes matched.
  • Both additional regression tests passed.
  • Seven distinct cache variant identities verified.
  • Four synthetic shader variants passed DXIL validation.
  • Synthetic root-data ABI preservation verified.
  • Release and diagnostics builds passed.
  • Changed-file asset policy passed.

The existing failure in both shader suites is
emit::tests::a_pixel_mask_draws_only_its_pixels_of_each_quad.

Scope

This change addresses the interaction between mesh signature
linking and pixel-mask emulation.

It does not implement mesh shader fallback, change dispatch
dimensions or modify the console wave translation.

Native mesh rendering on NVIDIA hardware and gameplay have
not been tested. No FPS improvements are claimed.

No game assets are included.

Validated base:
0338ec6ceb

**@⁠73N1X** on GitHub · 2026-11-29 02:09 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1904) `skAInet-labs:nv06/mesh-link-pixel-mask` → `main` · +199 −18 · 3 files · 1 commits · merged 2026-11-29 08:16 UTC ## Problem Oversized mesh shader output linking reconstructs the paired pixel shader. The existing implementation loses the pixel shader's masked translation state during that reconstruction. Consequently, mesh linking and console sample-mask emulation do not compose correctly. ## Changes - Preserve the pixel shader's mask state through mesh linking. - Compose linked and masked translation variants. - Keep cache identities distinct for all supported variants. - Preserve the existing unmasked variant key derivation. - Add synthetic translation and cache regression tests. ## Validation Windows x64, synthetic shaders and DXIL validation. | Suite | Baseline | Candidate | |---|---:|---:| | Shader tests passed | 386 | 387 | | Shader tests failed | 1 | 1 | | Shader tests ignored | 8 | 8 | | Shader cache tests passed | 4 | 5 | - All 399 common test outcomes matched. - Both additional regression tests passed. - Seven distinct cache variant identities verified. - Four synthetic shader variants passed DXIL validation. - Synthetic root-data ABI preservation verified. - Release and diagnostics builds passed. - Changed-file asset policy passed. The existing failure in both shader suites is `emit::tests::a_pixel_mask_draws_only_its_pixels_of_each_quad`. ## Scope This change addresses the interaction between mesh signature linking and pixel-mask emulation. It does not implement mesh shader fallback, change dispatch dimensions or modify the console wave translation. Native mesh rendering on NVIDIA hardware and gameplay have not been tested. No FPS improvements are claimed. No game assets are included. Validated base: 0338ec6ceb80640109d58db83c4b0bde2ab54223
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 02:12:05 +00:00
Author
Owner

@⁠Dukestar69 on GitHub · 2026-11-29 03:36 UTC · original · approved these changes

Tested locally merged onto main (568c5e5).

  • Merge: Clean merge across pipeline/host.rs, shader_cache.rs, and victory-shader/src/native.rs.
  • Tests (RTX 5090):
    • cargo test -p victory-gpu --lib pipeline:: passed (32 passed; 0 failed).
    • cargo test -p victory-gpu --lib shader_cache:: passed.
    • cargo test -p victory-shader --lib native:: passed.
  • 0 warnings in touched files.

Clean preservation of pixel masks when linking oversized mesh shaders. LGTM.

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

**@⁠Dukestar69** on GitHub · 2026-11-29 03:36 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1904#pullrequestreview-6101262011) · **approved these changes** Tested locally merged onto `main` (`568c5e5`). - **Merge**: Clean merge across `pipeline/host.rs`, `shader_cache.rs`, and `victory-shader/src/native.rs`. - **Tests (RTX 5090)**: - `cargo test -p victory-gpu --lib pipeline::` passed (`32 passed; 0 failed`). - `cargo test -p victory-gpu --lib shader_cache::` passed. - `cargo test -p victory-shader --lib native::` passed. - 0 warnings in touched files. Clean preservation of pixel masks when linking oversized mesh shaders. LGTM. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Author
Owner

@⁠upipibi on GitHub · 2026-11-29 04:10 UTC · original

Test report for #1904 (head 64c07418), merged --no-ff onto main 568c5e5d, on RTX 30. Synthetic tests only: no
title run, no game files.

Setup: RTX 3070, driver 616.56, Windows 11 (10.0.26100), rustc 1.98.1. Every run logged the GPU and driver from
nvidia-smi before it started.

Both new tests pass, 3/3 runs:

  • shader_cache::tests::nv06_linked_pixel_mask_cache_identity (victory-gpu). I also ran it three times with
    VICTORY_D3D12_WARP=1 --features diagnostics, with the same result.
  • native::tests::nv06_linked_pixel_preserves_mask_metadata (victory-shader). The DXIL validator loaded and passed
    all four variants in every run (NV06_DXIL_VALIDATOR_PASS).

Neither test makes a D3D12 device. They check translation output and cache keys only, so they don't depend on the
GPU.

Negative controls

  • A, main's code for both crates with only the native.rs test added: it passes. native.rs gains only the
    test, so it pins down shader-side behaviour main already has (linking keeps the mask metadata). It is not a check
    of this PR's fix.
  • B, variant_masked ignoring the linked pixel shader's mask flag: the cache-identity test fails at
    shader_cache.rs:527 (variant_masked(Some(&linked_masked), false)). So it catches a masked linked pixel shader
    losing its mask in the cache key.
  • C, the change in pipeline/host.rs undone (MeshLink::Pixel { masked: false }): both tests still pass.
    Neither test goes through HostPipeline, so the line that hands the pixel shader's mask flag to the link isn't
    covered. A test that builds a mesh pipeline with a masked pixel shader and checks the linked shader's
    USER_PIXEL_MASK would cover it.

cargo test --lib --locked

Run PR Main 568c5e5d
victory-gpu, default 590 passed, 0 failed, 44 ignored 589 passed, 0 failed, 44 ignored
victory-gpu, --features diagnostics 644 passed, 0 failed, 44 ignored 643 passed, 0 failed, 44 ignored
victory-shader 396 passed, 0 failed, 8 ignored 395 passed, 0 failed, 8 ignored

The extra test in each crate is the PR's own.

emit::tests::a_pixel_mask_draws_only_its_pixels_of_each_quad fails in both suites in the description, but it
passed here on both the PR and main.

Not tested: native mesh rendering, and the effect in a title.

Tested with the help of Claude Code (Claude Opus 5.5).

**@⁠upipibi** on GitHub · 2026-11-29 04:10 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1904#issuecomment-7250489602) Test report for #1904 (head 64c07418), merged `--no-ff` onto main 568c5e5d, on RTX 30. Synthetic tests only: no title run, no game files. **Setup:** RTX 3070, driver 616.56, Windows 11 (10.0.26100), rustc 1.98.1. Every run logged the GPU and driver from `nvidia-smi` before it started. **Both new tests pass, 3/3 runs:** - `shader_cache::tests::nv06_linked_pixel_mask_cache_identity` (victory-gpu). I also ran it three times with `VICTORY_D3D12_WARP=1 --features diagnostics`, with the same result. - `native::tests::nv06_linked_pixel_preserves_mask_metadata` (victory-shader). The DXIL validator loaded and passed all four variants in every run (`NV06_DXIL_VALIDATOR_PASS`). Neither test makes a D3D12 device. They check translation output and cache keys only, so they don't depend on the GPU. **Negative controls** - A, main's code for both crates with only the `native.rs` test added: it **passes**. `native.rs` gains only the test, so it pins down shader-side behaviour main already has (linking keeps the mask metadata). It is not a check of this PR's fix. - B, `variant_masked` ignoring the linked pixel shader's mask flag: the cache-identity test **fails** at `shader_cache.rs:527` (`variant_masked(Some(&linked_masked), false)`). So it catches a masked linked pixel shader losing its mask in the cache key. - C, the change in `pipeline/host.rs` undone (`MeshLink::Pixel { masked: false }`): both tests still **pass**. Neither test goes through `HostPipeline`, so the line that hands the pixel shader's mask flag to the link isn't covered. A test that builds a mesh pipeline with a masked pixel shader and checks the linked shader's `USER_PIXEL_MASK` would cover it. **`cargo test --lib --locked`** | Run | PR | Main 568c5e5d | |---|---|---| | `victory-gpu`, default | 590 passed, 0 failed, 44 ignored | 589 passed, 0 failed, 44 ignored | | `victory-gpu`, `--features diagnostics` | 644 passed, 0 failed, 44 ignored | 643 passed, 0 failed, 44 ignored | | `victory-shader` | 396 passed, 0 failed, 8 ignored | 395 passed, 0 failed, 8 ignored | The extra test in each crate is the PR's own. `emit::tests::a_pixel_mask_draws_only_its_pixels_of_each_quad` fails in both suites in the description, but it **passed** here on both the PR and main. Not tested: native mesh rendering, and the effect in a title. *Tested with the help of Claude Code (Claude Opus 5.5).*
github-bot changed target branch from main to gh-pr/1904/base 2026-11-29 08:21:18 +00:00
github manually merged commit 64c074186e into gh-pr/1904/base 2026-11-29 08:21:20 +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!1904
No description provided.