Tests: bind a constant where a shader has no user data #2737
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2739"
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?
Imported from Marvisak/VIctory. Originally posted by Therecalloftheonion on 2026-11-25T19:23:51Z.
What
The host root signature always declares at least one 32-bit constant (
Num32BitValues.max(1)), but four memory tests sized their constant array fromuser_data_dwords()and could pass a count of 0 toSetComputeRoot32BitConstants.Why
On the RX 6700 XT,
SetComputeRoot32BitConstants(..., 0, ...)access-violates and aborts the test process; WARP tolerates it. That made the wholevictory-shadersuite unusable on this GPU (heap_direct_texture_reads_mark_their_heap_indexdied withSTATUS_ACCESS_VIOLATION). Every other shader test already uses.max(1).Testing
cargo test -p victory-shader --lib: 268 passed; the suite no longer aborts. Two pre-existing hardware assertions remain on this GPU (stride_tests::a_heap_buffer_read_by_element...andsynthetic_tests::gathers_at_a_level_match_the_hardware), outside this change.Imported from Marvisak/VIctory. Originally posted by kotekompotek on 2026-11-25T20:05:54Z.
Correct: user_data_dwords()==0 would panic on ud[u.index] in the loop or pass an empty slice to dispatch; .max(1) keeps both paths safe without changing semantics for shaders that do have user data.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-25T20:10:47Z.
Verified
f237a3cfon Windows 11 + NVIDIA GeForce RTX 5090 (rustc 1.98.1MSVC,VICTORY_WARPunset).cargo test --locked -p victory-shader --lib --features host emit::memory_tests: 4 passed, 0 failed — this directly resolves the0xc0000005crash inheap_direct_texture_reads_mark_their_heap_indexon RTX 5090 as well (not just RX 6700 XT).cargo clippy --locked -p victory-shader --all-targets -- -D warnings(default &--features host): 0 warnings;cargo xtask policy: 184 files ok.git merge-treeagainst13f91caand#2587(complementary:#2587guards empty slices inemit/host.rs,#2739fixes the 4memory_tests.rscallers).Imported from Marvisak/VIctory. Originally posted by HAL9000RELOADED on 2026-11-25T22:53:19Z.
RDNA3 data point for
f237a3c: RX 7900 XTX, driver 32.0.32015.7029, Windows 10 22H2 (19045), Agility SDK 1.620 through #969 (VICTORY_D3D12_AGILITY). Base:3e8c00a(main13f91ca+ #969).victory-shader273 passed, 0 failed, no abort.heap_direct_texture_reads_mark_their_heap_indexpasses there too, so on this card a count of 0 toSetComputeRoot32BitConstantsis tolerated, as on WARP.a_heap_buffer_read_by_element_takes_the_views_strideandgathers_at_a_level_match_the_hardware.So the abort looks specific to RDNA2 (or its driver). The
.max(1)change is harmless here.Imported from Marvisak/VIctory. Originally posted by KainanP on 2026-11-25T22:53:53Z.
Measured in the #2571 comparison: it fixes the 4
memory_testscallers, but #2587's host-level test still crashes on an RTX 4060 with only this PR. It merges cleanly alongside the host fix as optional hygiene: https://github.com/Marvisak/VIctory/issues/2571#issuecomment-7176908308 (AI-assisted)Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T23:23:21Z.
Automated triage for the maintainers.
The change is harmless and matches how the root signature is declared (
Num32BitValues: s.user_data_dwords().max(1)inHost::root_signature_for,crates/victory-shader/src/emit/host.rs), but it fixes only four callers. On currentmainthere are still callers that size root constants fromuser_data_dwords()without.max(1): the straddling-write test incrates/victory-shader/src/emit/memory_tests.rs(around line 879, added after this PR's base) andcrates/victory-shader/src/emit/valu_tests.rs(around line 395), so the description's "every other shader test already uses.max(1)" does not hold any more. The root cause (an empty slice's dangling pointer reachingSetComputeRoot32BitConstants) is addressed for every caller at the host level by open PR #2587 (Host::dispatch/Host::draw), which needs a rebase.What would change the verdict: either rebase and cover all remaining callers, or a maintainer decides to take #2587 instead, in which case this PR is not needed. CI (
check) passes.Generated by Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.