GPU: drop commands when the fallback sampler heap is unavailable #3554

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

@⁠pablogonz12 on GitHub · 2026-11-27 17:24 UTC · original
pablogonz12:fix/sampler-fallback-failure → main · +40 −4 · 1 files · 1 commits · open

Summary

When the title binds no sampler heap and the fallback heap cannot be created, bind_heaps currently warns but still calls SetDescriptorHeaps and caches the incomplete binding. Draws and dispatches can then use a root signature that directly indexes a missing sampler heap.

I stop the binding before the D3D12 call, leave the cached heaps unchanged, and drop the draw, dispatch or unordered clear instead of recording it. I added a thread-local test injection for the allocation failure.

Evidence

  • Before: missing_fallback_sampler_does_not_record_heap_binding fails on 63bcca43 with one incomplete heap bind; after: it passes and checks that no bind was recorded and the cache was not updated.
  • Windows victory-gpu tests under Proton: 229 passed, 3 failed, 1 ignored. The same three failures reproduce on 63bcca43 with the same setup: a_texture_written_in_one_format_reads_in_another_through_a_placed_view, a_rejected_blob_gives_an_empty_library, and pipelines_load_on_many_threads_at_once.
  • Windows-target cargo xwin clippy -p victory-gpu --all-targets --target x86_64-pc-windows-msvc -- -D warnings: passed.

Tested on RX 9070 XT / RADV under Proton; not tested on NVIDIA hardware. No game run.

Merge Danger

Door: Two-way. Blast radius: Draws, dispatches and unordered clears when fallback sampler creation fails; those operations are dropped instead of being recorded with an invalid heap binding.

**@⁠pablogonz12** on GitHub · 2026-11-27 17:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/3554) `pablogonz12:fix/sampler-fallback-failure` → `main` · +40 −4 · 1 files · 1 commits · open ## Summary When the title binds no sampler heap and the fallback heap cannot be created, `bind_heaps` currently warns but still calls `SetDescriptorHeaps` and caches the incomplete binding. Draws and dispatches can then use a root signature that directly indexes a missing sampler heap. I stop the binding before the D3D12 call, leave the cached heaps unchanged, and drop the draw, dispatch or unordered clear instead of recording it. I added a thread-local test injection for the allocation failure. ## Evidence - Before: `missing_fallback_sampler_does_not_record_heap_binding` fails on `63bcca43` with one incomplete heap bind; after: it passes and checks that no bind was recorded and the cache was not updated. - Windows `victory-gpu` tests under Proton: 229 passed, 3 failed, 1 ignored. The same three failures reproduce on `63bcca43` with the same setup: `a_texture_written_in_one_format_reads_in_another_through_a_placed_view`, `a_rejected_blob_gives_an_empty_library`, and `pipelines_load_on_many_threads_at_once`. - Windows-target `cargo xwin clippy -p victory-gpu --all-targets --target x86_64-pc-windows-msvc -- -D warnings`: passed. Tested on RX 9070 XT / RADV under Proton; not tested on NVIDIA hardware. No game run. ## Merge Danger **Door:** Two-way. **Blast radius:** Draws, dispatches and unordered clears when fallback sampler creation fails; those operations are dropped instead of being recorded with an invalid heap binding.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 17:38:12 +00:00
Author
Owner

@⁠oni-swr on GitHub · 2026-11-27 18:11 UTC · original

Independent verification of 532ddb1c (base main 63bcca43; the PR is a single branch off that base). AI-assisted (Claude Sonnet 5.5); claim: #1633.

  • Host: Windows 11 build 26200, WARP 10.0.26100.9818 (VICTORY_WARP=1, VICTORY_D3D12_WARP=1, --features diagnostics), dxil.dll from Windows SDK 10.0.26100.0. No physical GPU used.
  • cargo test -p victory-gpu --lib: main 63bcca43 = 246 passed, 0 failed, 1 ignored. PR head = 247 passed, 0 failed, 1 ignored. The new draw::tests::missing_fallback_sampler_does_not_record_heap_binding passes on WARP.
  • cargo clippy -p victory-gpu --all-targets --features diagnostics -- -D warnings: clean.

Review notes (no blockers found):

  • Both bind_heaps callers now stop on failure, so host_heaps is not recorded as bound after a failed fallback. The early return in bind happens after take_rebind() has already zeroed the cached pipeline/root, which is the safe direction.
  • fallback_samplers() is a OnceLock, so a creation failure is permanent for the process: every draw that needs it will be dropped from then on, with one once! log line. That seems the intended behaviour, but the PR does not show how often it can happen on real hardware. Unproven.
**@⁠oni-swr** on GitHub · 2026-11-27 18:11 UTC · [original](https://github.com/Marvisak/VIctory/pull/3554#issuecomment-7225224152) Independent verification of `532ddb1c` (base `main` 63bcca43; the PR is a single branch off that base). AI-assisted (Claude Sonnet 5.5); claim: #1633. - Host: Windows 11 build 26200, WARP 10.0.26100.9818 (`VICTORY_WARP=1`, `VICTORY_D3D12_WARP=1`, `--features diagnostics`), dxil.dll from Windows SDK 10.0.26100.0. No physical GPU used. - `cargo test -p victory-gpu --lib`: main 63bcca43 = 246 passed, 0 failed, 1 ignored. PR head = 247 passed, 0 failed, 1 ignored. The new `draw::tests::missing_fallback_sampler_does_not_record_heap_binding` passes on WARP. - `cargo clippy -p victory-gpu --all-targets --features diagnostics -- -D warnings`: clean. Review notes (no blockers found): - Both `bind_heaps` callers now stop on failure, so `host_heaps` is not recorded as bound after a failed fallback. The early return in `bind` happens after `take_rebind()` has already zeroed the cached pipeline/root, which is the safe direction. - `fallback_samplers()` is a `OnceLock`, so a creation failure is permanent for the process: every draw that needs it will be dropped from then on, with one `once!` log line. That seems the intended behaviour, but the PR does not show how often it can happen on real hardware. Unproven.
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-27 21:35 UTC · original

NVIDIA full-suite run, to go with the reports above by oni-swr, since none of them names a GPU run. Tested exact head 532ddb1 (on its base 63bcca4).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 867 passed, 0 failed, 10 ignored.
  • The new tests ran and passed: missing_fallback_sampler_does_not_record_heap_binding.
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#2571), so without the skip the rest of that crate never reports; dynamic_slots_are_held_until_released, lists_share_a_table_and_copies_keep_their_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-27 21:35 UTC · [original](https://github.com/Marvisak/VIctory/pull/3554#issuecomment-7228588355) NVIDIA full-suite run, to go with the reports above by oni-swr, since none of them names a GPU run. Tested exact head `532ddb1` (on its base `63bcca4`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware`: **867 passed, 0 failed, 10 ignored**. - The new tests ran and passed: `missing_fallback_sampler_does_not_record_heap_binding`. - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#2571), so without the skip the rest of that crate never reports; `dynamic_slots_are_held_until_released`, `lists_share_a_table_and_copies_keep_their_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
This pull request can be merged automatically.
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/3554/head:github-bot/gh-3554'
git switch 'github-bot/gh-3554'

Merge

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