Descriptors: clamp view indices past a capped host heap to a null slot #1133
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1133
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1133"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@rivaldodev on GitHub · 2026-11-24 16:05 UTC · original
rivaldodev:nvidia/heap-cap-and-barriers→main· +181 −25 · 6 files · 1 commits · openDetects hosts whose shader-visible view heaps are capped below the title's view heap size (1,245,184 slots — NVIDIA caps shader-visible view heaps at 1,000,000 slots, measured on RTX 4070 Ti SUPER / RTX 5060 / RTX 5070) and clamps translated view handle indices to a reserved null slot at the end of the capped heap. Hosts without a cap (e.g. AMD) translate as before.
What is in this PR
crates/victory-gpu/src/descriptor/host.rs: probes the host view heap cap (view_heap_cap), sizes small heaps to cover the same translated index range, and keeps the last capped slot null across title slots, dynamic slots, and copy-back view pairs (including dynamic ranges ending right at the cap).crates/victory-gpu/src/host.rs: records the detected host cap viavictory_shader::emit::set_view_heap_limit.crates/victory-shader/src/emit/{mod.rs,bitcode.rs,shader.rs}: uses the smaller host cap for view handle clamps while leaving sampler and uncapped-host bounds intact.crates/victory-gpu/src/shader_cache.rs: includes the host view heap cap in the shader cache fingerprint.shader_cache::build()(and thereforeuse_shader_cache) now initializes the host device (crate::host::host()) on first call if it does not exist yet, so the host's view heap cap is known before the cache key is fixed (e.g. invictory translate --cache). This is documented inshader_cache.rs.Tests
victory-gpu:144 passed, 0 failed(includinga_capped_view_heap_keeps_its_last_slot_null,dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_views, andthe_key_covers_translator_encoding_and_settings).victory-shader: tests check emitted DXIL handle indices at and beyond both heap bounds.Split from the original combined PR per triage feedback; the narrow-wave barrier change has been moved to a separate PR.
@DeerSilver on GitHub · 2026-11-24 17:48 UTC · original
Tested head
be0fe04merged ontomainffe310e(clean merge) on NVIDIA GeForce RTX 5060 Laptop GPU (Blackwell), driver 621.24, Windows 11 26300, Rust 1.98.1. No game files: the test suite only. Pass.eprintln!ina_capped_view_heap_keeps_its_last_slot_null,view_heap_capreturnedSome(1000000). So on Blackwell the test runs past its "the host takes larger heaps" early return and passes.a_capped_view_heap_keeps_its_last_slot_nullview_heap_indices_are_clamped_only_under_a_capcargo test --workspace --locked: 344 passed, 0 failed, 6 ignored, against 342 / 6 onmain.cargo clippy --workspace --all-targets --locked -- -D warnings: clean.I can't check the in-world hang without the game.
AI-assisted (Claude Code).
@Zipettte on GitHub · 2026-11-24 18:01 UTC · original
Tested on AMD Radeon RX 7700 XT (RDNA3, gfx1101), driver 32.0.32029.2010, Windows 11, Rust 1.98.1 MSVC at be0fe04:
cargo test -p victory-gpu -p victory-shaderpasses, 172 passed / 0 failed. Workspace baseline on main (ffe310e) is green on the same machine (342 passed).Tested with AI assistance (Claude).
@Marvisak on GitHub · 2026-11-25 00:36 UTC · original · edited 2026-11-25 19:22 UTC
Automated triage for the maintainers.
Proposed close: duplicate of a more complete open PR. It now merges cleanly into
main. CI:checkpassing.This PR detects a host that caps shader-visible view heaps at 1,000,000 (
descriptor::host::view_heap_cap), records the cap in a new global (emit::set_view_heap_limit), clamps heap handles below it inShader::heap_handle, and adds the cap to the shader-cache key. The open #1777, which also merges cleanly, fixes the same NVIDIA cap more completely. It also resizes the view-stride and view-mark tables and moves the null buffer views inside the capped heap (null_buffer_view). Here,NULL_BUFFER_VIEWstays atHEAP_VIEWS - 2, outside the capped heap, andwrite_stride/set_markkeep theirHEAP_VIEWSbounds. This PR also makesshader_cache::buildcreate the host device (crate::host::host()) as a side effect, so offline paths likevictory translate --cachewould open a D3D12 device.If something here is missing from #1777, such as the DXIL handle-index test, a follow-up on top of #1777 would be welcome. This PR will be closed in 48 hours unless the author pushes a change or a maintainer removes the
triage: proposed closelabel.Generated by Claude Code
@rivaldodev on GitHub · 2026-11-25 02:28 UTC · original
Rebased onto main (
940d32f) and resolved the conflicts. Both CI Clippy configurations pass, along with the targeted regression tests. Four failures in the full test suite were also reproduced on unmodified main.Ready for review.
@welisonzika14-jpg on GitHub · 2026-11-25 03:01 UTC · original
RTX 5070 (Blackwell, driver 621.24), Ryzen 7 5700X, Windows 11, Rust 1.98.1 MSVC. No game files, unit tests only. Head
0d19c4cmerged ontomain940d32f,cargo test -p victory-gpu -p victory-shader --lib --no-fail-fast.victory-gpuvictory-shadermainThe two view heap cap tests (
dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_views) pass with it. The 3victory-shaderfailures are the onesmainalready has on NVIDIA (#1744), so nothing new here.Written with AI help (Claude/Kiro); the numbers are from runs on my machine.
@rivaldodev on GitHub · 2026-11-25 03:50 UTC · original
Split the two changes per triage feedback:
\ictory-gpu\ lib tests pass (144 passed, 0 failed). Ready for re-review.
@rivaldodev on GitHub · 2026-11-25 18:50 UTC · original
Rebased onto current
main(13f91ca) and merged themod testsblock incrates/victory-shader/src/emit/shader.rs(aeb7b10).cargo test -p victory-gpu --lib --locked: 196 passed, 0 failed, 1 ignoredcargo test -p victory-shader --lib --locked heap_handles_stay_inside_the_host_limits: passedcargo clippy -p victory-gpu -p victory-shader --no-deps --all-targets --locked: clean on changed files.Ready for re-triage.
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.