GPU: heap samplers keep point mips when anisotropic, as static samplers do #2029

Merged
0xkn0wh3r3 merged 2 commits from upstream-pr/2031 into main 2026-11-25 21:53:13 +00:00
0xkn0wh3r3 commented 2026-11-25 03:44:04 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-25T03:44:04Z.


The problem

An anisotropic sampler with point mips blended between mip levels on the host, where the console does not.

A sampler the title makes in a descriptor heap from the console's description (CreateSamplerX, sampler::console) became D3D12's plain anisotropic filter (0x55) whenever its magnification or minification was anisotropic, whatever its mip filter. 0x55 is anisotropic with linear mips.

Static samplers in shader code already keep point mips since #1337 (StaticSampler::filter_for_host), on hosts with anisotropic point-mip filtering (D3D12_OPTIONS19). Heap samplers did not.

The fix

  • Heap samplers now do as static samplers do: filter 0x54 (with the comparison and min/max reduction bits) where the console asks for point mips, or no mips, and the host has the feature.
  • Linear mips (0x55) otherwise, as before: when the console asks for linear mips, or the host lacks the feature.
  • The feature is asked once (sampler::aniso_point_mip). Pipeline creation uses the same answer instead of asking per pipeline.

Non-anisotropic samplers are unchanged.

Testing

  • New test anisotropic_samplers_keep_point_mips_where_the_host_can: checks the filter for point, linear and no mips, with and without the feature, and with comparison and maximum reduction. On main the point-mip case gives 0x55.
  • New test the_host_takes_its_anisotropic_samplers: makes such a sampler in a sampler heap on the host device and checks the device is not removed. An RTX 5070 Ti reports the feature, so it takes 0x54.
  • cargo test -p victory-gpu --no-fail-fast on an RTX 5070 Ti (driver 621.24): 143 passed. descriptor::host::tests::dynamic_slots_are_held_until_released and memory::tests::lists_share_a_table_and_copies_keep_their_views fail the same way on main (NVIDIA's 1,000,000-descriptor heap cap, #1835).
  • cargo clippy -p victory-gpu --all-targets, with and without --features diagnostics: clean.

Not covered

  • Not run with a title (no game data here), so the visual difference in game is not checked.
<!-- greyfinch-sync:Marvisak/VIctory:issue:6596713758 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2031). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-25T03:44:04Z. --- ## The problem An anisotropic sampler with point mips blended between mip levels on the host, where the console does not. A sampler the title makes in a descriptor heap from the console's description (`CreateSamplerX`, `sampler::console`) became D3D12's plain anisotropic filter (0x55) whenever its magnification or minification was anisotropic, whatever its mip filter. 0x55 is anisotropic with linear mips. Static samplers in shader code already keep point mips since #1337 (`StaticSampler::filter_for_host`), on hosts with anisotropic point-mip filtering (`D3D12_OPTIONS19`). Heap samplers did not. ## The fix - Heap samplers now do as static samplers do: filter 0x54 (with the comparison and min/max reduction bits) where the console asks for point mips, or no mips, and the host has the feature. - Linear mips (0x55) otherwise, as before: when the console asks for linear mips, or the host lacks the feature. - The feature is asked once (`sampler::aniso_point_mip`). Pipeline creation uses the same answer instead of asking per pipeline. Non-anisotropic samplers are unchanged. ## Testing - New test `anisotropic_samplers_keep_point_mips_where_the_host_can`: checks the filter for point, linear and no mips, with and without the feature, and with comparison and maximum reduction. On main the point-mip case gives 0x55. - New test `the_host_takes_its_anisotropic_samplers`: makes such a sampler in a sampler heap on the host device and checks the device is not removed. An RTX 5070 Ti reports the feature, so it takes 0x54. - `cargo test -p victory-gpu --no-fail-fast` on an RTX 5070 Ti (driver 621.24): 143 passed. `descriptor::host::tests::dynamic_slots_are_held_until_released` and `memory::tests::lists_share_a_table_and_copies_keep_their_views` fail the same way on `main` (NVIDIA's 1,000,000-descriptor heap cap, #1835). - `cargo clippy -p victory-gpu --all-targets`, with and without `--features diagnostics`: clean. ## Not covered - Not run with a title (no game data here), so the visual difference in game is not checked.
catminou4 commented 2026-11-25 04:06:37 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-25T03:57:00Z.

Review: COMMENTED


Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff.

Heap samplers keep point mips when anisotropic, matching static samplers — consistency fix between heap and static sampler paths.

<!-- greyfinch-sync:Marvisak/VIctory:review:6051646593 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2031#pullrequestreview-6051646593). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-25T03:57:00Z. **Review:** COMMENTED --- Static review only: victory-gpu is Windows-only (D3D12/windows_sys) — nothing compiles or runs on macOS; source review of the diff. Heap samplers keep point mips when anisotropic, matching static samplers — consistency fix between heap and static sampler paths.
DenRakEiw commented 2026-11-25 04:06:37 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-25T03:57:15Z.

Review: APPROVED


Verified locally merged onto origin/main (940d32f, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC):

  • cargo test -p victory-gpu --lib sampler:: — 5 passed, 0 failed on both RTX 5090 hardware and VICTORY_D3D12_WARP=1 (including anisotropic_samplers_keep_point_mips_where_the_host_can and the_host_takes_its_anisotropic_samplers)
  • cargo clippy -p victory-gpu --all-targets — 0 warnings
  • cargo xtask policy — ok (183 files ok)

Clean alignment of heap sampler anisotropic point-mip filtering with static samplers, gated on host capability. Looks good.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6051648319 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2031#pullrequestreview-6051648319). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-25T03:57:15Z. **Review:** APPROVED --- Verified locally merged onto `origin/main` (`940d32f`, Windows 11 x64, NVIDIA GeForce RTX 5090 + WARP, Rust 1.98.1 MSVC): - `cargo test -p victory-gpu --lib sampler::` — 5 passed, 0 failed on both RTX 5090 hardware and `VICTORY_D3D12_WARP=1` (including `anisotropic_samplers_keep_point_mips_where_the_host_can` and `the_host_takes_its_anisotropic_samplers`) - `cargo clippy -p victory-gpu --all-targets` — 0 warnings - `cargo xtask policy` — ok (`183 files ok`) Clean alignment of heap sampler anisotropic point-mip filtering with static samplers, gated on host capability. Looks good. AI-assisted (Gemini 4 Neon).
jeremygold02 commented 2026-11-25 04:07:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-25T03:56:27Z.


Triage verdict — Keep as the heap-sampler follow-up (f2e8623)

Evidence

  • @mgunes1311-lab's merged #1337 fixes static samplers. @0xkn0wh3r3's change reaches heap-backed console samplers, where main still chooses linear mips for anisotropic filters. The guarded point-mip encoding matches the DirectX specification, and adapters without the feature keep the existing linear fallback. Sampler mapping · DirectX capability and encodings

Checks and limits

  • Two focused Windows tests passed on this head. The filter-mapping test verifies the feature gate, point/linear/no-mip choices, and comparison and maximum reduction. The host test also reported success, but it can return early if device initialization fails. That result alone cannot establish descriptor creation or rendered filtering. Mapping test · Host test
  • The Actions run currently requires action, so the local results are the independent evidence here. Actions run

Next step

  • Keep this change alongside #1337. For the optional coverage follow-up, add minimum-reduction point and fallback assertions (0x154 and 0x155) and make the device test report whether it reached sampler creation.

This verification was AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7152381158 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2031#issuecomment-7152381158). Originally posted by [jeremygold02](https://github.com/jeremygold02) on 2026-11-25T03:56:27Z. --- **Triage verdict — Keep as the heap-sampler follow-up** (`f2e8623`) **Evidence** - @mgunes1311-lab's merged #1337 fixes static samplers. @0xkn0wh3r3's change reaches heap-backed console samplers, where `main` still chooses linear mips for anisotropic filters. The guarded point-mip encoding matches the DirectX specification, and adapters without the feature keep the existing linear fallback. [Sampler mapping](https://github.com/Marvisak/VIctory/blob/f2e8623a4e029f19c04c02aefc2fc69294ae3bd7/crates/victory-gpu/src/sampler.rs#L31-L58) · [DirectX capability and encodings](https://microsoft.github.io/DirectX-Specs/d3d/VulkanOn12.html#anisotropic-sampler-with-mip-point) **Checks and limits** - Two focused Windows tests passed on this head. The filter-mapping test verifies the feature gate, point/linear/no-mip choices, and comparison and maximum reduction. The host test also reported success, but it can return early if device initialization fails. That result alone cannot establish descriptor creation or rendered filtering. [Mapping test](https://github.com/Marvisak/VIctory/blob/f2e8623a4e029f19c04c02aefc2fc69294ae3bd7/crates/victory-gpu/src/sampler.rs#L182-L211) · [Host test](https://github.com/Marvisak/VIctory/blob/f2e8623a4e029f19c04c02aefc2fc69294ae3bd7/crates/victory-gpu/src/sampler.rs#L215-L241) - The Actions run currently requires action, so the local results are the independent evidence here. [Actions run](https://github.com/Marvisak/VIctory/actions/runs/45542004452) **Next step** - Keep this change alongside #1337. For the optional coverage follow-up, add minimum-reduction point and fallback assertions (`0x154` and `0x155`) and make the device test report whether it reached sampler creation. This verification was AI-assisted.
0xkn0wh3r3 commented 2026-11-25 07:03:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-25T06:27:35Z.


Thanks @jeremygold02, done in 4036fbe. The mapping test now also covers minimum reduction, 0x154 with point-mip support and 0x155 without, plus maximum reduction without support (0x1d5). The device test now prints that it made its sampler and which filter it used, or that it skipped because there was no device, so a green run shows which happened. On an RTX 5070 Ti it reports made an anisotropic sampler, filter 0x54.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7154811890 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2031#issuecomment-7154811890). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-25T06:27:35Z. --- Thanks @jeremygold02, done in `4036fbe`. The mapping test now also covers minimum reduction, `0x154` with point-mip support and `0x155` without, plus maximum reduction without support (`0x1d5`). The device test now prints that it made its sampler and which filter it used, or that it skipped because there was no device, so a green run shows which happened. On an RTX 5070 Ti it reports `made an anisotropic sampler, filter 0x54`.
Marvisak commented 2026-11-25 10:07:39 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T09:19:48Z.


Automated triage for the maintainers.

Merge candidate (unchanged; same head as the last triage). crates/victory-gpu/src/sampler.rs, Fields::host: anisotropic heap samplers now use filter 0x54 (anisotropic, point mips, with comparison/reduction bits kept) when the console asks for point or no mips and the host reports anisotropic point-mip support, and 0x55 otherwise, matching what main already does for static samplers (#1337). The OPTIONS19 query is cached in sampler::aniso_point_mip and shared with pipeline/host.rs. Nothing on current main changes this mapping.

Since the last triage, a contributor sampled real mips through CreateSamplerX on WARP: point mips return the exact levels on this head ([0.25, 0.75]) and blend on main ([0.375, 0.625]), with the linear-mip control unchanged. That is good end-to-end support for the change.

Reply to the author: understood that the WARP sampling test stays as the contributor's own commit; the maintainers can take it separately. No new code to review, so the verdict stands.

CI: not run on this head (the workflow appears to be waiting for approval). Run it before merging.

Recommending a look, not approving.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7158184538 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2031#issuecomment-7158184538). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T09:19:48Z. --- <!-- victory-triage v1 head=4036fbe4ff4742379f5ea0f91e531865c2507021 verdict=merge-candidate at=2026-11-25T09:19:03Z --> Automated triage for the maintainers. **Merge candidate (unchanged; same head as the last triage).** `crates/victory-gpu/src/sampler.rs`, `Fields::host`: anisotropic heap samplers now use filter 0x54 (anisotropic, point mips, with comparison/reduction bits kept) when the console asks for point or no mips and the host reports anisotropic point-mip support, and 0x55 otherwise, matching what `main` already does for static samplers (#1337). The OPTIONS19 query is cached in `sampler::aniso_point_mip` and shared with `pipeline/host.rs`. Nothing on current `main` changes this mapping. Since the last triage, a contributor sampled real mips through `CreateSamplerX` on WARP: point mips return the exact levels on this head ([0.25, 0.75]) and blend on `main` ([0.375, 0.625]), with the linear-mip control unchanged. That is good end-to-end support for the change. Reply to the author: understood that the WARP sampling test stays as the contributor's own commit; the maintainers can take it separately. No new code to review, so the verdict stands. CI: not run on this head (the workflow appears to be waiting for approval). Run it before merging. Recommending a look, not approving. --- _Generated by [Claude Code](https://claude.ai/code)_
Xvania7 commented 2026-11-25 12:02:53 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Xvania7 on 2026-11-25T11:42:17Z.

Review: APPROVED


Verified 4036fbe on Windows 10 + NVIDIA GeForce RTX 5060:

  • sampler::tests:: (5 passed, including anisotropic_samplers_keep_point_mips_where_the_host_can and the_host_takes_its_anisotropic_samplers)
  • cargo clippy -p victory-gpu --all-targets -- -D warnings: 0 warnings
  • cargo xtask policy: 182 files ok

Approving.

<!-- greyfinch-sync:Marvisak/VIctory:review:6056963106 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2031#pullrequestreview-6056963106). Originally posted by [Xvania7](https://github.com/Xvania7) on 2026-11-25T11:42:17Z. **Review:** APPROVED --- Verified `4036fbe` on Windows 10 + NVIDIA GeForce RTX 5060: - `sampler::tests::` (5 passed, including `anisotropic_samplers_keep_point_mips_where_the_host_can` and `the_host_takes_its_anisotropic_samplers`) - `cargo clippy -p victory-gpu --all-targets -- -D warnings`: 0 warnings - `cargo xtask policy`: 182 files ok Approving.
andrewpozdnakov7-jpg commented 2026-11-25 18:02:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by andrewpozdnakov7-jpg on 2026-11-25T17:18:01Z.


I checked actual sampling on Windows/WARP with OPTIONS19 reporting anisotropic point-mip support. The fixture creates console heap samplers through CreateSamplerX and samples two constant R32_FLOAT mip levels at LOD 0.25 and 0.75.

  • 940d32f and current main 13f91ca return [0.375, 0.625] for both point and linear mips.
  • 4036fbe returns [0.25, 0.75] for point mips and [0.375, 0.625] for the linear control. The same test passed six runs across both D3D12 debug flag settings.
  • Serial victory-gpu passed with 149 passed and 2 ignored on the exact PR head plus the test, and 201 passed and 1 ignored in each setting after a clean local merge with 13f91ca. Strict GPU Clippy in both modes and repository policy passed on the exact PR branch plus the test.

The test-only commit is directly on 4036fbe4ff. If you cherry-pick it, please preserve its Git author. If you fold it into another commit, please add the trailer below. Test commit

Co-authored-by: andrewpozdnakov7-jpg [email protected]

AI-assisted. Synthetic texture data only.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7169299853 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2031#issuecomment-7169299853). Originally posted by [andrewpozdnakov7-jpg](https://github.com/andrewpozdnakov7-jpg) on 2026-11-25T17:18:01Z. --- I checked actual sampling on Windows/WARP with OPTIONS19 reporting anisotropic point-mip support. The fixture creates console heap samplers through CreateSamplerX and samples two constant R32_FLOAT mip levels at LOD 0.25 and 0.75. - 940d32f and current main 13f91ca return [0.375, 0.625] for both point and linear mips. - 4036fbe returns [0.25, 0.75] for point mips and [0.375, 0.625] for the linear control. The same test passed six runs across both D3D12 debug flag settings. - Serial victory-gpu passed with 149 passed and 2 ignored on the exact PR head plus the test, and 201 passed and 1 ignored in each setting after a clean local merge with 13f91ca. Strict GPU Clippy in both modes and repository policy passed on the exact PR branch plus the test. The test-only commit is directly on 4036fbe4ff4742379f5ea0f91e531865c2507021. If you cherry-pick it, please preserve its Git author. If you fold it into another commit, please add the trailer below. [Test commit](https://github.com/andrewpozdnakov7-jpg/VIctory/commit/726e5dca5cd2609421ffa010ebed490cbc9144a2) Co-authored-by: andrewpozdnakov7-jpg <[email protected]> AI-assisted. Synthetic texture data only.
0xkn0wh3r3 commented 2026-11-25 19:06:25 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by 0xkn0wh3r3 on 2026-11-25T18:37:14Z.


@Xvania7 thanks. @andrewpozdnakov7-jpg, thanks for sampling it end to end on WARP. [0.25, 0.75] for point mips against [0.375, 0.625] for the linear control is exactly the behaviour the unit tests only check at the descriptor level. I'd rather keep your test as your own commit than fold it into mine. If the maintainer wants it in, it can go in as it is, with your authorship.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7171160400 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/2031#issuecomment-7171160400). Originally posted by [0xkn0wh3r3](https://github.com/0xkn0wh3r3) on 2026-11-25T18:37:14Z. --- @Xvania7 thanks. @andrewpozdnakov7-jpg, thanks for sampling it end to end on WARP. [0.25, 0.75] for point mips against [0.375, 0.625] for the linear control is exactly the behaviour the unit tests only check at the descriptor level. I'd rather keep your test as your own commit than fold it into mine. If the maintainer wants it in, it can go in as it is, with your authorship.
upstream-sync closed this pull request 2026-11-25 22:03:20 +00:00
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
Marvisak/VIctory!2029
No description provided.