Shaders: preserve explicit LOD in 2D-array gathers #3369

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

@⁠masteraapjes on GitHub · 2026-11-29 22:20 UTC · original
masteraapjes:codex/shader-array-gather-lod → main · +326 −3 · 4 files · 1 commits · open

What it changes

2D-array image_gather4_l and image_gather4_l_o lose explicit LOD through DXIL textureGather, which has no LOD operand. Extend four-load lowering to arrays and preserve the layer in every load. Resolve clamped layer ties explicitly to keep NVIDIA and WARP rounding consistent. Texel offsets apply at the requested mip and never to the layer.

Rebuilt independently on upstream main 5fabb46eaf6ed8771321787f8871051abde69b9b to resolve the conflict after upstream history changed. Obsolete shared CI commits have been removed from the PR diff. Current upstream changes are retained.

How it was tested

Windows, pinned Rust 1.98.1. Tested head: 4322573a3932843da9bf827b41d18f81cf2c8941.

  • Focused CPU translation/DXIL validation emit::gather_lod_tests::named_lod_gathers_translate_and_validate: 1 passed.
  • Scoped strict shader Clippy passed with default and all features:
    • cargo clippy --locked --jobs 2 -p victory-shader --all-targets -- -D warnings
    • cargo clippy --locked --jobs 2 -p victory-shader --all-targets --all-features -- -D warnings
  • cargo run --locked --package xtask -- policy: 465 files passed. git diff --check passed.

Current upstream CI blocker, independently reproduced on unmodified main 5fabb46e: both cargo clippy --workspace --all-targets --locked -- -D warnings and cargo clippy --workspace --all-targets --all-features --locked -- -D warnings exit 101 with five errors in host/font.rs:213/260, host/menu.rs:667 and host/panel.rs:602/668. Existing #4680 addresses these. No unrelated fixes or lint suppressions are carried here. This is not a claim that the latest CI check job passed.

This update runs CPU translation/DXIL validation rather than new hardware dispatches. No new wave64, title or FPS result is claimed. Existing XY clamp and whole-mip shortcuts remain; general addressing and fractional/out-of-range LOD handling are outside scope. The full workspace test suite was not rerun for this conflict-resolution update. No game data is included.

Checked for overlap

  • Rechecked current main and targeted open-PR searches alongside the earlier overlap review. Related #2522 concerns cube-array inference and #3168 explicit-LOD sample offsets; neither fixes this array-gather path.
**@⁠masteraapjes** on GitHub · 2026-11-29 22:20 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3369) `masteraapjes:codex/shader-array-gather-lod` → `main` · +326 −3 · 4 files · 1 commits · open ## What it changes 2D-array `image_gather4_l` and `image_gather4_l_o` lose explicit LOD through DXIL textureGather, which has no LOD operand. Extend four-load lowering to arrays and preserve the layer in every load. Resolve clamped layer ties explicitly to keep NVIDIA and WARP rounding consistent. Texel offsets apply at the requested mip and never to the layer. Rebuilt independently on upstream main `5fabb46eaf6ed8771321787f8871051abde69b9b` to resolve the conflict after upstream history changed. Obsolete shared CI commits have been removed from the PR diff. Current upstream changes are retained. ## How it was tested Windows, pinned Rust 1.98.1. Tested head: `4322573a3932843da9bf827b41d18f81cf2c8941`. - Focused CPU translation/DXIL validation `emit::gather_lod_tests::named_lod_gathers_translate_and_validate`: 1 passed. - Scoped strict shader Clippy passed with default and all features: - `cargo clippy --locked --jobs 2 -p victory-shader --all-targets -- -D warnings` - `cargo clippy --locked --jobs 2 -p victory-shader --all-targets --all-features -- -D warnings` - `cargo run --locked --package xtask -- policy`: 465 files passed. `git diff --check` passed. Current upstream CI blocker, independently reproduced on unmodified main `5fabb46e`: both `cargo clippy --workspace --all-targets --locked -- -D warnings` and `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings` exit 101 with five errors in `host/font.rs:213/260`, `host/menu.rs:667` and `host/panel.rs:602/668`. Existing [#4680](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/pulls/4680) addresses these. No unrelated fixes or lint suppressions are carried here. This is not a claim that the latest CI `check` job passed. This update runs CPU translation/DXIL validation rather than new hardware dispatches. No new wave64, title or FPS result is claimed. Existing XY clamp and whole-mip shortcuts remain; general addressing and fractional/out-of-range LOD handling are outside scope. The full workspace test suite was not rerun for this conflict-resolution update. No game data is included. ## Checked for overlap - [x] Rechecked current main and targeted open-PR searches alongside the earlier overlap review. Related #2522 concerns cube-array inference and #3168 explicit-LOD sample offsets; neither fixes this array-gather path.
Read the four texels from the requested mip and preserve the array layer in each load. Resolve slice ties explicitly after clamping, avoiding the NVIDIA/WARP difference observed with the Round_ne path. Add synthetic mip, layer, offset, A16 and NSA readbacks with literal and runtime layer inputs.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 22:24:14 +00:00
Author
Owner

@⁠madvillain91 on GitHub · 2026-11-29 22:47 UTC · original

System Information:

  • GPU: NVIDIA GeForce RTX 3070 Ti 8GB
  • Windows 11 Pro, Build 26300.9711
  • Executable: PR #3369 test build
  • Test method: Played 1–5 minutes focusing on vehicles, on-foot scenes, and areas with previous LOD/artefact problems.

Findings:

  • Average performance: 12 FPS (significantly lower than previous builds).
  • Visual/Gameplay Experience: Despite low FPS, overall experience was "pretty good" while driving vehicles and on foot—textures, faces, roads, and skins appeared sharper and detail was noticeably improved versus earlier artefacted/blurry sessions.
  • No crash, major log errors, or new artefacts were observed.

Log evidence:
victory-nvidia-play-20261129-223854-29408.log

Conclusions/Notes:

  • PR #3369 appears to have a dramatic positive effect on LOD/texture quality and gameplay feel, even when performance drops.
  • The improvement in sharpness and correct detail balance is clear.
  • Performance Impact: Unusually low FPS (12 FPS) should be investigated—possibly caused by the new LOD/shader code raising GPU load.
  • Recommend upstream reviews both the strong quality improvement and the performance tradeoff.
**@⁠madvillain91** on GitHub · 2026-11-29 22:47 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3369#issuecomment-7263957353) System Information: - GPU: NVIDIA GeForce RTX 3070 Ti 8GB - Windows 11 Pro, Build 26300.9711 - Executable: PR #3369 test build - Test method: Played 1–5 minutes focusing on vehicles, on-foot scenes, and areas with previous LOD/artefact problems. Findings: - Average performance: 12 FPS (significantly lower than previous builds). - Visual/Gameplay Experience: Despite low FPS, overall experience was "pretty good" while driving vehicles and on foot—textures, faces, roads, and skins appeared sharper and detail was noticeably improved versus earlier artefacted/blurry sessions. - No crash, major log errors, or new artefacts were observed. Log evidence: [victory-nvidia-play-20261129-223854-29408.log](https://github.com/user-attachments/files/35585283/victory-nvidia-play-20261129-223854-29408.log) Conclusions/Notes: - PR #3369 appears to have a dramatic positive effect on LOD/texture quality and gameplay feel, even when performance drops. - The improvement in sharpness and correct detail balance is clear. - Performance Impact: Unusually low FPS (12 FPS) should be investigated—possibly caused by the new LOD/shader code raising GPU load. - Recommend upstream reviews both the strong quality improvement and the performance tradeoff.
Author
Owner

@⁠dyshay on GitHub · 2026-11-30 03:12 UTC · original

Merged into our fork's integration branch for testing (dyshay/VIctory-NVIDIA, branch janus-prs). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with --profile diag --features diagnostics. A run on an RTX 4090 is queued (Series S with ray tracing, DLSS Quality). Frame times will follow here.

**@⁠dyshay** on GitHub · 2026-11-30 03:12 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3369#issuecomment-7267677787) Merged into our fork's integration branch for testing ([dyshay/VIctory-NVIDIA](https://github.com/dyshay/VIctory-NVIDIA/tree/janus-prs), branch `janus-prs`). I read the full diff first: no network access, process spawning, binaries, build or dependency changes, or game data. It builds with `--profile diag --features diagnostics`. A run on an RTX 4090 is queued (Series S with ray tracing, DLSS Quality). Frame times will follow here.
(cherry picked from commit d0597eba19)
card_pass took the compare's capture (7addcfc7, VICTORY_LAND_CAPTURE) and
its two test callers still passed five arguments, so the library's tests
did not build. They pass [0; 3], no capture, as the other callers outside
the capture's mode do.

The thin recorder's bindings_record_no_work names every call by what it
records; begin_query and end_query (471d05c4, #3715) record into the query
heap and were in no list. They join the calls that record work.

The shader key's test lists four VICTORY_ORACLE_* names the translator no
longer reads since the differential fuzzer left (a1fe8350); it failed on
the first of them.

(cherry picked from commit d8e409cd45)
github-bot force-pushed github-bot/gh-3369 from 3b182f69bd to 4322573a39 2026-12-01 13:38:25 +00:00 Compare
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/3369/head:github-bot/gh-3369'
git switch 'github-bot/gh-3369'

Merge

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