Shaders: preserve mip point filtering in anisotropic static samplers #1337

Manually merged
github merged 3 commits from gh-pr/1337/head into gh-pr/1337/base 2026-11-26 04:28:05 +00:00
Owner

@⁠mgunes1311-lab on GitHub · 2026-11-24 17:33 UTC · original
mgunes1311-lab:shader-aniso-mip-point → main · +90 −3 · 3 files · 3 commits · merged 2026-11-25 00:22 UTC

Preserve the mip filter when decoding anisotropic immediate static samplers. Previously StaticSampler::from_words always emitted 0x55 | reduction << 7, forcing linear mip filtering.

Changes

  • Decode anisotropic mip-point as 0x54 | reduction << 7, and linear mip as 0x55 | reduction << 7. The existing mip == 0 MinLOD/MaxLOD lock at zero is preserved.
  • Query D3D12_OPTIONS19.AnisoFilterWithPointMipSupported in both the shader host and production GPU pipeline. If unsupported, or the query fails on an older runtime, filter_for_host retains the previous linear-mip approximation. Comparison/minimum/maximum reduction bits and LOD bounds remain unchanged.
  • Add regression tests for decoding, supported/unsupported host capabilities, all four reduction modes, and unrelated filters.

The capability check is required by the DirectX specification. This change does not make the optional feature a new device requirement.

Verification

  • Sampler tests: 4 passed.
  • cargo test -p victory-shader --target x86_64-pc-windows-msvc --all-features --locked: 123 passed, 0 failed, 1 benchmark ignored.
  • Shader and GPU Clippy with all targets, all features, and -D warnings: passed.
  • Asset policy: 154 files passed; git diff --check: clean.

No in-game result or supported-versus-unsupported hardware image comparison is claimed. Devices without the feature continue to use the previous approximation.

**@⁠mgunes1311-lab** on GitHub · 2026-11-24 17:33 UTC · [original](https://github.com/Marvisak/VIctory/pull/1337) `mgunes1311-lab:shader-aniso-mip-point` → `main` · +90 −3 · 3 files · 3 commits · merged 2026-11-25 00:22 UTC Preserve the mip filter when decoding anisotropic immediate static samplers. Previously `StaticSampler::from_words` always emitted `0x55 | reduction << 7`, forcing linear mip filtering. ### Changes - Decode anisotropic mip-point as `0x54 | reduction << 7`, and linear mip as `0x55 | reduction << 7`. The existing `mip == 0` MinLOD/MaxLOD lock at zero is preserved. - Query `D3D12_OPTIONS19.AnisoFilterWithPointMipSupported` in both the shader host and production GPU pipeline. If unsupported, or the query fails on an older runtime, `filter_for_host` retains the previous linear-mip approximation. Comparison/minimum/maximum reduction bits and LOD bounds remain unchanged. - Add regression tests for decoding, supported/unsupported host capabilities, all four reduction modes, and unrelated filters. The capability check is required by the [DirectX specification](https://microsoft.github.io/DirectX-Specs/d3d/VulkanOn12.html#anisotropic-sampler-with-mip-point). This change does not make the optional feature a new device requirement. ### Verification - Sampler tests: 4 passed. - `cargo test -p victory-shader --target x86_64-pc-windows-msvc --all-features --locked`: 123 passed, 0 failed, 1 benchmark ignored. - Shader and GPU Clippy with all targets, all features, and `-D warnings`: passed. - Asset policy: 154 files passed; `git diff --check`: clean. No in-game result or supported-versus-unsupported hardware image comparison is claimed. Devices without the feature continue to use the previous approximation.
Query OPTIONS19 in the shader host and retain the previous linear-mip approximation when anisotropic point-mip filtering is unavailable. Preserve comparison/min/max reduction and LOD bounds. Add tests for supported and unsupported capabilities, all reduction modes, and unrelated filters.

Validated with 4 sampler tests, 123 all-feature shader tests (1 benchmark ignored), shader/GPU all-target/all-feature Clippy with warnings denied, and asset policy. No in-game validation claimed.
Apply the same OPTIONS19 capability check and filter fallback in the production GPU pipeline as in the shader host. Unsupported or older runtimes retain the prior linear-mip approximation instead of receiving an unsupported static-sampler filter.

Validated together with the shader-side changes: 123 all-feature shader tests passed (1 benchmark ignored), shader/GPU all-target/all-feature Clippy with warnings denied, and asset policy.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:28:04 +00:00
github manually merged commit 7dfa86fa39 into gh-pr/1337/base 2026-11-26 04:28:05 +00:00
Author
Owner

@⁠sinan-cmyk on GitHub · 2026-11-25 01:49 UTC · original

Offline measurement on a retail dump, and the shader tests on Ada

Result: no count change against main.

Offline. I merged head 7dfa86f onto main ffe310e (clean merge) and ran victory translate --validate --list on shaders.rpf (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with main program by program (25,889 programs). Validated: 21,724 on main, 21,724 with this PR.

No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on main. The count shows that the change rejects nothing. It does not show whether the output is right.

Tests: with the same merge, cargo test --locked -p victory-shader --lib passed 123, failed 0. The bitcode benchmark is ignored, as on main, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, with VICTORY_WARP unset.

No shader names or data are included, per the asset policy. AI-assisted (Claude Code).

**@⁠sinan-cmyk** on GitHub · 2026-11-25 01:49 UTC · [original](https://github.com/Marvisak/VIctory/pull/1337#issuecomment-7149990098) ### Offline measurement on a retail dump, and the shader tests on Ada **Result: no count change against `main`.** **Offline.** I merged head 7dfa86f onto `main` ffe310e (clean merge) and ran `victory translate --validate --list` on `shaders.rpf` (1.0.2.1), with dxil.dll 1.8.2502.11. I compared the result with `main` program by program (25,889 programs). Validated: 21,724 on `main`, 21,724 with this PR. No program changes its failure reason either. That is the expected result for a fix whose instructions sit behind the earlier failures on `main`. The count shows that the change rejects nothing. It does not show whether the output is right. **Tests:** with the same merge, `cargo test --locked -p victory-shader --lib` passed 123, failed 0. The bitcode benchmark is ignored, as on `main`, where 120 pass. The run was on an RTX 4070 SUPER (Ada, 32-lane waves, driver 32.0.16.1088), the default adapter, with `VICTORY_WARP` unset. No shader names or data are included, per the asset policy. AI-assisted (Claude Code).
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!1337
No description provided.