GPU: a null SRV has no alias source #2851
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!2851
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/2851/head"
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?
@Ingenioeren on GitHub · 2026-11-25 22:20 UTC · original
Ingenioeren:fix/2847-null-srv-alias-source→main· +10 −0 · 1 files · 1 commits · closed without mergingWhat
Return
Nonefromresource::alias_sourcewhen the resource pointer is null. Add a Windows regression test that callsalias_sourcedirectly with a null pointer.Why
Since #1273,
draw::readablelooks for a texture alias for every SRV, includingView::Shader(0, _). Passing that zero pointer toresource()causes a null dereference. The guard protects every caller ofalias_source.host_resourcealready returnsNonefor null, which skipstexture::uploadand the diagnosticsGetDesccall.list::ensure_stateexits throughHostList::transitionwhenhost_copyreturnsNone.Thanks to frenziedcoder for diagnosing the crash.
How tested
cargo test --locked --offline -p victory-gpu resource::tests::a_null_shader_view_has_no_alias_source -- --exact— with the guard stashed and the test staged, the test binary reported a null pointer dereference inresource()and aborted with0xc0000409(STATUS_STACK_BUFFER_OVERRUN). With the guard restored, the same command passed (1 passed, 0 failed).cargo test --locked --offline -p victory-gpu— 229 passed, 0 failed, 1 ignored (the existing synthetic benchmark). The doc-test harness ran 0 tests and passed.cargo clippy --locked --offline -p victory-gpu --all-targets— passed with no warnings.cargo run --locked --offline -p xtask -- policy --staged— passed aftergit add. The asset policy accepted the one staged file.What was not tested
No game run and no hardware run of the game.
Fixes #2847
AI assistance: prepared with OpenAI Codex under Claude Code's direction, reviewed by Ingenioeren.
🤖 Generated with Claude Code
@Machad3x on GitHub · 2026-11-25 22:30 UTC · original
Confirms the crash on a second host (RTX 3080 Ti, driver 621.24, Windows 11), in a fork that had cherry-picked #1273: access violation (read 0x60) at world load, symbolised to
Resource::dataunderalias_sourcefromdraw::readable. The same null guard inalias_sourcefixed it: one 7-minute run in play afterwards, no crash and no device removal. Tested with an equivalent local change, not this head.Ran with AI assistance (Claude Code).
@fuzeofficlal on GitHub · 2026-11-25 22:34 UTC · original
Verified
6cb83cdaon Windows 11 (RTX 5090 + WARP) againstmain(f3578e3):cargo xtask policy(190 files ok),cargo clippy --locked -p victory-gpu --all-targets(default &--features diagnostics, 0 warnings).--features diagnostics):resource::tests18/18,draw::tests20/20 passed.--features diagnostics):resource::tests18/18,draw::tests20/20 passed.draw::readableand sibling entry points onf3578e3: bothSRVandUAVpaths already null-guardhost_resource,made_copy,buffer_bytes, andcapture::note_target, leavingalias_sourceas the missing null guard. (Optional nit: a test callingdraw::readablewithView::Shader(0, ...)would also cover the full caller path.)Looks clean and ready to merge.
@kotekompotek on GitHub · 2026-11-25 22:49 UTC · original
This just landed on main as
219878a('GPU: a null shader view has no alias source') — same guard, same test name. This PR is now a no-op; suggest closing.@moe-miau on GitHub · 2026-11-25 23:04 UTC · original
Tested on an RTX 4070 SUPER (driver 32.0.16.1742, Windows 11 26300), title 1.0.2.1, Series X profile, diag build, scripted Enter presses. Tree:
mainf3578e3+ #2464 + #2098 + #2626 + #2628 + #2711.0xc0000005reading0x30inresource::alias_source(resource.rs:1883, called fromdraw.rs:1910), the crash of #28476cb83cd)Two runs in all, one each. AI-assisted (Claude Code). Runs done on my machine.
@davesousa on GitHub · 2026-11-25 23:22 UTC · original
Game run of this head on current
main: RTX 3070 Ti 8 GB (Ampere), driver 621.40, Windows 11 26200.diagbuild,VICTORY_D3D12_DRED=1. Tree:mainf3578e3+ #2319 (boot on NVIDIA) + #2178 (W from #1968); cache and pipelines rebuilt for it.f3578e3+ #2319 + #21780xc0000005atvictory.exe+0x224443(read 0x30) about 100 s in, as world compute binds (frame about 1,660). Symbolised with the build's PDB:resource::alias_source::closure$1(resource.rs:1817),resource::alias_source,draw::readable(draw.rs:1897),draw::State::bind,draw::State::dispatch,list::state::dispatch. Same as #2847.6cb83cd, merges cleanly; its test passes)One run each, so the counts are small, but the stop is the one #2847 describes and the guard removes it on a third card.
AI-assisted (Claude Code); the runs are on my machine.
@Ingenioeren on GitHub · 2026-11-25 23:59 UTC · original
Closing: main already has this guard as
219878a("GPU: a null shader view has no alias source"), so this PR is a no-op now. Thanks to everyone who tested it.Pull request closed