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

Merged
73N1X merged 1 commit from upstream-pr/1904 into main 2026-11-29 08:16:52 +00:00
73N1X commented 2026-11-29 02:09:05 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by 73N1X on 2026-11-29T02:09:05Z.


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

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5546692318 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1904). Originally posted by [73N1X](https://github.com/73N1X) on 2026-11-29T02:09:05Z. --- ## 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
Dukestar69 commented 2026-11-29 03:36:46 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by Dukestar69 on 2026-11-29T03:36:46Z.

Review: APPROVED


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).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:review:6101262011 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1904#pullrequestreview-6101262011). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-29T03:36:46Z. **Review:** APPROVED --- 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).
upipibi commented 2026-11-29 04:10:09 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by upipibi on 2026-11-29T04:10:09Z.


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).

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7250489602 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/1904#issuecomment-7250489602). Originally posted by [upipibi](https://github.com/upipibi) on 2026-11-29T04:10:09Z. --- 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).*
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
trustno1-coder/VIctory-NVIDIA!1904
No description provided.