Shaders: the test host never passes NVIDIA an empty root-constant slice #3224
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/3226"
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 Indy2l on 2026-11-26T13:44:29Z.
What
On NVIDIA, the
victory-shaderunit tests abort the whole test process withSTATUS_ACCESS_VIOLATION. The first casualty isemit::memory_tests::heap_direct_texture_reads_mark_their_heap_index, and every test after it goes unreported.Under
cdb, the fault is inside the driver, reading address0x4:Fixes #2571.
That shader has no user data, so
user_data_dwords() == 0and the test passesRoot::Constants(vec![]).root_signature_forstill declaresuser_data_dwords().max(1)values. An emptyVec's pointer is dangling (0x4), and NVIDIA's driver dereferences it even for a count of 0. WARP doesn't, so CI never sees it.Change
The test host (
emit/host.rs) gets aconstants()helper that returns one zero for empty data, matching the declared parameter. It's used at all three root-constant call sites.The runtime is not affected:
victory-gpu'spipeline/host.rsleaves the parameter out whendwords == 0.Testing
cargo test -p victory-shader --lib --locked: no longer aborts. 299 passed, 3 ignored.cargo clippy --workspace --all-targets [--all-features] --locked -- -D warnings: clean.With the abort gone, three NVIDIA failures that were hidden behind it now show up. They're separate issues and not part of this PR:
stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros: "dispatch failed: The parameter is incorrect".View::NullBuffersasks for a 2^21-slot view heap, above NVIDIA's 1,000,000 cap (the same cap as #3122).stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride: hardware reads[101, 104, ...], then zeros, where[200, 201, ...]is expected.synthetic_tests::gathers_at_a_level_match_the_hardware: lane 0 gathers[0, 1, 0, 0]where[0, 0, 0, 0]is expected.🤖 Generated with Claude Code
Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T13:47:51Z.
Review: APPROVED
Verified on RTX 5090 against
origin/main(63bcca4):cargo test -p victory-shader --lib emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index -- --test-threads=1: PASSED on RTX 5090! (Previously crashed with0xc0000005under#2571on cleanorigin/main.)cargo clippy -p victory-shader --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Great NVIDIA driver workaround: passing
&[0]instead of an empty dangling slice avoids NVIDIA'sSet*Root32BitConstantsread at0x4.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by Jackster on 2026-11-26T22:44:11Z.
Windows 11,
63bcca4+ this PR, Radeon RX 7900 XTX:cargo test -p victory-shader --lib --features host: 302 passed / 0 failed / 3 ignored (172 s) — the same counts as unpatched63bcca4here.cargo clippy -p victory-shader --all-targets -- -D warnings: clean.The change is in the test host only, so the suite is the whole check; this host has a real SM 6.6 device, so the tests take the device path rather than a skip. Synthetic only. AI-assisted.
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T23:35:44Z.
Review: APPROVED
LGTM!
constants()(crates/victory-shader/src/emit/host.rs:69-71) cleanly promotes an empty slice to&[0], matchingroot_signature_for's.max(1)root constant slot width and avoiding NVIDIA's dangling-pointer access violation on empty root-constant slices.Verified locally with
cargo xtask policy,cargo clippy --locked -p victory-shader --all-targets -- -D warnings,cargo clippy --locked -p victory-shader --all-features -- -D warnings, andVICTORY_D3D12_DEBUG=1(emit::host::1/1 andemit::tests::17/17 passed on both RTX 5090VICTORY_WARP=0and WARPVICTORY_WARP=1).(Minor non-blocking polish:
rustfmt --edition 2024 --checkflags line length on the two editedSet*Root32BitConstantscalls athost.rs:1167andhost.rs:1928, and adding a smalldispatch/drawtest passingRoot::Constants(&[])would directly lock in the empty-slice path.)Imported from Marvisak/VIctory. Originally posted by kalberts0089-hash on 2026-11-27T05:09:42Z.
NVIDIA test report: RTX 4060 (driver 610.88), Windows 11 Pro, rustc 1.98.1. Head
828242d(base main63bcca4),cargo test -p victory-shader --no-fail-fast.emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index: passes. On main it kills the test process with0xc0000005on this card.valu_tests::normalized_buffer_formats_load_correctly_rounded_quotients, failed with "dispatch failed: The GPU device instance has been suspended". Run alone with--exactit passed 3 of 3 times on this head (about 68 s each) and once on main, so I read it as a timeout under suite load, not a regression from this change.Synthetic tests only, no game files. AI-assisted (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.