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

Manually merged
github merged 2 commits from gh-pr/2031/head into gh-pr/2031/base 2026-11-26 04:52:08 +00:00
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 03:44 UTC · original
0xkn0wh3r3:gpu/heap-samplers-keep-point-mips → main · +121 −31 · 3 files · 2 commits · merged 2026-11-25 21:53 UTC

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.
**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 03:44 UTC · [original](https://github.com/Marvisak/VIctory/pull/2031) `0xkn0wh3r3:gpu/heap-samplers-keep-point-mips` → `main` · +121 −31 · 3 files · 2 commits · merged 2026-11-25 21:53 UTC ## 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.
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: an anisotropic sampler with point
mips blended between mip levels on the host. Static samplers in shader
code keep point mips since #1337 (`StaticSampler::filter_for_host`), on
hosts with anisotropic point-mip filtering (`D3D12_OPTIONS19`).

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

Tests: `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); `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).
Review (#2031): the mapping test now also checks minimum reduction (0x154
with point-mip support, 0x155 without) and maximum reduction without it
(0x1d5). The device test prints whether it made its sampler (and with
which filter) or skipped for want of a device, so a green run shows
which it was.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:52:06 +00:00
github manually merged commit 4036fbe4ff into gh-pr/2031/base 2026-11-26 04:52:08 +00:00
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-25 03:56 UTC · original

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.

**@⁠jeremygold02** on GitHub · 2026-11-25 03:56 UTC · [original](https://github.com/Marvisak/VIctory/pull/2031#issuecomment-7152381158) **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.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 06:27 UTC · original

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.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 06:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/2031#issuecomment-7154811890) 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`.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 09:19 UTC · original · edited 2026-11-25 20:20 UTC

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

**@⁠Marvisak** on GitHub · 2026-11-25 09:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2031#issuecomment-7158184538) · edited 2026-11-25 20:20 UTC <!-- 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)_
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-25 17:18 UTC · original

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.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-25 17:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/2031#issuecomment-7169299853) 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.
Author
Owner

@⁠0xkn0wh3r3 on GitHub · 2026-11-25 18:37 UTC · original

@⁠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.

**@⁠0xkn0wh3r3** on GitHub · 2026-11-25 18:37 UTC · [original](https://github.com/Marvisak/VIctory/pull/2031#issuecomment-7171160400) @⁠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.
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!2031
No description provided.