Skip to content

victory-shader: fix NVIDIA access violation in heap_direct_texture_reads_mark_their_heap_index - #3465

Open
kalberts0089-hash wants to merge 1 commit into
Marvisak:mainfrom
kalberts0089-hash:fix/empty-root-constants
Open

kalberts0089-hash wants to merge 1 commit into
Marvisak:mainfrom
kalberts0089-hash:fix/empty-root-constants

Conversation

@kalberts0089-hash

Copy link
Copy Markdown

Fixes the access violation reported in #3445.

The test's shader has no user data, so it built an empty Vec and passed its dangling pointer (0x4) to SetComputeRoot32BitConstants with a count of 0. NVIDIA's driver reads the pointer anyway and crashes (STATUS_ACCESS_VIOLATION in nvwgf2umx.dll); WARP doesn't.

This adds .max(1) at memory_tests.rs:731, matching the root signature (emit/host.rs:229) and emit/host.rs:610. I kept it to this one line rather than skipping the call in Host::dispatch, since that would leave a declared root parameter unset.

Tested on an RTX 4060 (driver 610.88):

Done with Claude Code's help.

…at least one root constant

The test's shader has no user data, so it passed an empty Vec to
SetComputeRoot32BitConstants: a count of 0 with Rust's dangling
placeholder pointer (0x4). NVIDIA's driver reads the pointer even with
a count of 0 and faults (STATUS_ACCESS_VIOLATION in nvwgf2umx.dll on an
RTX 4060); WARP doesn't. Size the buffer with .max(1), as the root
signature (emit/host.rs) already declares at least one constant.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@oni-swr

oni-swr commented Nov 27, 2026

Copy link
Copy Markdown

WARP test report (victory-shader, --lib --locked --no-fail-fast -- --test-threads=1)

OS: Windows 11 Pro 10.0.26200 (build 26200.9974), x64
Host adapter: WARP only (VICTORY_WARP=1 and VICTORY_D3D12_WARP=1; d3d10warp.dll 10.0.26100.9818); no physical GPU used
dxil.dll: Windows SDK 10.0.26100.0, version 1.8.2502.11 (via VICTORY_DXIL)
rustc/cargo: 1.98.1 (48a229cea 2026-09-01)
Base: main 63bcca4
Head: 4beefa7 (merged onto main, no conflicts, 1 line changed)

pass fail ignored
main 298 4 3
main + PR 298 4 3
  • emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index runs and passes under WARP on both main and the PR (not skipped, not ignored). As the description says, WARP never faulted on the empty-slice pointer, so this run confirms there is no regression on WARP; it cannot reproduce the NVIDIA access violation.
  • The 4 failures are identical on main and on the PR (the synthetic wave-lane tests: a_mask_joined_with_data_at_a_uniform_loop_is_its_number, gathers_at_a_level_match_the_hardware, permutes_mask_high_address_bits_and_divergent_branches, permutes_read_the_lane_named_and_zero_from_lanes_left_out). They are not touched by this change.

Review note: the one-line change .max(1) is consistent with the root-signature constant count the description cites; the only effect is a one-dword all-zero buffer when a shader has no user data. No concerns.

AI-assisted (Claude). Aggregate counts only; no game files used.

@upipibi

upipibi commented Nov 27, 2026

Copy link
Copy Markdown

Confirmed on an RTX 3070 8 GB (Ampere), driver 616.56, Windows 11. This is the crash we have been skipping in every VIctory run (#2571).

cargo test --locked -p victory-shader --lib emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index -- --exact --test-threads=1, each tree in its own target dir:

  • main 63bcca4: the process dies with 0xc0000005.
  • this PR 4beefa7: 1 passed, 0 failed in 3 of 3 runs, with no skip line, so both the hardware and the WARP pass ran.

Full cargo test --locked -p victory-shader --lib -- --test-threads=1 on this PR, with nothing skipped: 299 passed, 3 failed, 3 ignored. The 3 failures are the ones already on main here: a_heap_buffer_read_by_element_takes_the_views_stride and a_heap_buffer_read_where_no_buffer_view_is_reads_zeros (#1835), and gathers_at_a_level_match_the_hardware (#2323). On main the suite cannot finish without skipping this test.

I checked the cited lines: the root signature declares user_data_dwords().max(1) constants (emit/host.rs:229), and the FMad probe pads its user data the same way (:610).

AI-assisted (Claude Code, Claude Opus 5.5).

@kalberts0089-hash

Copy link
Copy Markdown
Author

Heads-up: I've since found this overlaps with #2739 (same .max(1) at line 731, plus 269/461/597) and the host-level fixes in #2587, #2596 and #3226, which cover all callers. Happy for this to be closed in favour of whichever approach you prefer. The diagnosis and the RTX 3070 confirmation above should apply to all of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants