Image atomic after a size query reuses an f32 handle: invalid SPIR-V, NVIDIA driver crash (fix ready on fork) #852
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#852
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
@NicolaiVdS on GitHub · 2026-11-24 12:28 UTC · original
Bug
The cache in
Lower::handle(crates/victory-shader/src/emit/lower.rs) keys a heap handle by its first resource-property word only (kind and UAV flag). Suppose a block does a size query on an image UAV (image_get_resinfo, f32 x4,0x409) and then an atomic on the same image (image_atomic_*, u32 x1,0x105). The atomic reuses the query's f32 handle. dxil-spirv then declares a float image and emits:spirv-valrejects this:AtomicUMax: expected Result Type to be integer scalar type. NVIDIA's compiler crashes on it under vkd3d-proton (vkCreateGraphicsPipelines Exception 0xc0000005 in Unix call), which ends the title while it loads into the world. AMD's D3D12 driver seems to tolerate it, but the DXIL is wrong on every GPU.Fix (ready on my fork)
Branch: https://github.com/NicolaiVdS/VIctory/tree/shader/atomic-handle-type
Commit:
github.com/NicolaiVdS/VIctory@ae7e0bef6aDiff against main: https://github.com/Marvisak/VIctory/compare/main...NicolaiVdS:VIctory:shader/atomic-handle-type
an_image_atomic_after_a_size_query_gets_an_integer_handle. It sees one handle ([0x409]) before the fix and two ([0x409, 0x105]) after.cargo test -p victory-shaderpasses. Clippy on the Windows target, with and without--all-features, is clean with-D warnings.30b0eb9:translate --pipelinesovershaders.rpfbuilds 21,566 pipelines with no driver crashes.spirv-val.Request
@Marvisak, PR creation here is limited to collaborators, so I couldn't open a PR. Could you give me collaborator access so I can send this and later fixes as PRs? Or a collaborator could cherry-pick
ae7e0bedirectly, whichever you prefer.Side note for Linux/NVIDIA
This one isn't a VIctory bug. vkd3d-proton 3.1's dxil-spirv produces invalid SPIR-V for 40 of the title's shaders (structured-exit and empty-merge-block errors), and NVIDIA crashes on one of them (
0xc000001d). vkd3d-proton master fixes all 40, so Linux users need a version newer than 3.1.@Sunkiller-qc on GitHub · 2026-11-24 13:09 UTC · original
This is the bug #177 fixes (Ortomanic, open since 01:08 UTC).
handle()keys the cache byprops.0only, so an atomic on a UAV that was also read as float gets the float handle. dxil-spirv then emits an atomic on a float pointer, and you get the samespirv-valerror ("expected Result Type to be integer scalar type") and the same NVIDIA driver crash under vkd3d-proton as the title enters the world. #177 addsprops.1to the key, which is what your branch does.#177 was tested against #144 (the NVIDIA + vkd3d-proton crash in
vkCreateComputePipelines). MichaelSmithAI also found the size-query + atomic case on #728 and stacked it on #177's key. Your regression test (an_image_atomic_after_a_size_query_gets_an_integer_handle) would be a good addition to #177.@LAKSHYA-cmd-tech on GitHub · 2026-11-24 13:37 UTC · original
Verified and merged downstream in PR #23. Keying handles by both property words eliminates OpAtomicUMax %float and driver crashes in kCreateGraphicsPipelines on NVIDIA hardware during cutscene and world streaming transitions.
@MamaLeVrai on GitHub · 2026-11-24 19:45 UTC · original
@NicolaiVdS your fix for this issue is now in a pull request, #1610, with seven other fixes from contributors' forks: the branch is merged as it is, with your commit(s) and your name unchanged, onto
mainffe310e. Clippy (both runs) andcargo test --workspacepass on the result. If you would rather open your own pull request for this one, say so and I will take it out of #1610. AI-assisted (Claude Code); no game data.@Marvisak on GitHub · 2026-11-25 06:49 UTC · original
Automated triage for the maintainers.
Confirmed on current
main: incrates/victory-shader/src/emit/lower.rs,Lower::handlecaches heap handles under a key that holds only the first property word (props.0), so an image atomic after a size query on the same descriptor in the same block reuses the query's float handle. Open PR #177 adds the second word to the key, the same change as the fork branch; the bundle #1610 that carried this branch was closed without merging. Pull requests are open to everyone now, so the regression testan_image_atomic_after_a_size_query_gets_an_integer_handlewould be welcome as a PR or added to #177.Generated by Claude Code