Translate 64-bit texture atomics and follow proven shader branches #48
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!48
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/48/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?
@flapwarp78 on GitHub · 2026-11-23 23:46 UTC · original
flapwarp78:shader/typed-atomics-and-branch-threading→main· +461 −49 · 6 files · 1 commits · closed without mergingWhat changed
Verification
Microsoft's DXIL validator accepted 628 shaders from a local shader-pack scan. Texture atomics recovered 520 translations, and the control-flow change recovered another 108. The first 520 outputs were byte-for-byte identical with the control-flow change applied.
The shader, game, and format suites passed 73 tests. The asset-policy check passed. Rendering in the game still needs a Windows D3D12 run.
@DaviTostes on GitHub · 2026-11-23 23:54 UTC · original
Tested
d55ca40stacked on #39 on Arch Linux x86_64, rustc 1.98.1: pass.mainalone does not build on Linux (E0425 invictory-gpu), so the check uses #39 as the base; the merge is clean.cargo test --workspace: 158 passed, 0 failed, 3 ignored across all test binaries, with no new failure from the 64-bit atomics or the branch-specialization code.AI-assisted (DeepSeek V4.1 Flash coding agent).
@DaviTostes on GitHub · 2026-11-24 00:07 UTC · original
Re-checked the new head
56f0072stacked on #39 on Arch Linux x86_64, rustc 1.98.1: pass.cargo test --workspace: 155 passed, 0 failed, 3 ignored; merge with #39 clean, same result as atd55ca40.AI-assisted (DeepSeek V4.1 Flash coding agent).
@jeremygold02 on GitHub · 2026-11-23 23:58 UTC · original · edited 2026-11-24 00:12 UTC
I verified the texture-atomic change on a physical RTX 5070 (Windows 11, NVIDIA 621.01). On
97c78d1, four 32-bit cases produced the expected texel and the translator rejected all four 64-bit cases. Atd55ca40, all eight produced the expected texel.I used the register sequence in
heap_texture_atomic_widthswith one thread and one initialized texel. The test covered compare-exchange with a matching and mismatching comparand, addition, and subtraction at both widths. The second atomic added the first operation’s returned value back into the texel. With a 64-bit comparand that differed only in the high word, the final low/high words were00000006 / 00000012, as calculated on the CPU. The wide add and subtract cases also exercised carry and borrow across the 32-bit boundary.The device reported typed-resource and descriptor-heap 64-bit atomic support. The SDK DXIL validator accepted each emitted shader, the driver created each compute pipeline, and the queue fence reached 1 before readback. The 32-bit view used
R32_UINTand the 64-bit view usedR32G32_UINT.I also matched all nine distinct pixel shaders that had reported the 64-bit atomic error during a local mission-loading run. Offline translation on
97c78d1reproduced the same error on all nine. Withd55ca40, seven translated and passed the SDK validator. The remaining two reached the separatebarycentrics read directlylimitation. The rebased56f0072has the samecrates/victory-shaderGit tree as the tested revision. The title shaders were only translated and validated offline. Mission rendering is still unverified on this PR.@tedin7 on GitHub · 2026-11-24 00:47 UTC · original
checked:
56f0072on Linux x86_64 (Debian, kernel 6.12), Rust 1.98.1 (rust-toolchain.toml),cargo -j4. No GPU, no Windows, no game files, no DXIL validator. Others have already reported Windows hardware runs and the Linux workspace on #39; this adds a before/after on main and a few review points.What I ran (throwaway worktree of the PR head, base
35b054e):cargo test -j4 -p victory-shader -p victory-formats -p victory-game: victory-shader 54 passed, victory-formats 17 passed (3 ignored), victory-game 2 passed, 0 failed. That is 73 passed, which matches the PR text.cargo fmt --check -p victory-shader: no diff.cargo clippy -j4 -p victory-shader --tests: one new warning from this PR:very complex type used(clippy::type_complexity) atlower.rs:157, thehandlesmap key, which now contains a nested(u32, u32). The same command on current main (9aef3d9) only gives the existing dead_code warning forconstant_color. A type alias or small key struct would clear it, in case warnings are meant to be zero.atomic_tests::heap_texture_atomic_widthsfrom this PR to main (9aef3d9) and ran it: FAILED withUnsupported { offset: 36, what: "a 64-bit image atomic" }(the 64-bit cases). On the PR it passes. This test runs on Linux; only its optional validator step is Windows-only.threading.rs(WORDS) through the fullemit()with a table SRV + UAV layout. Main refuses it: "GFX10 code at 0x40: a scalar memory read as data is not supported". The PR translates it (2252-byte container);constant_edgesreturns[(0, 2, 4)]. This shows the retry path is exercised end to end by that program. I did not validate or run the resulting DXIL.git merge-treeof PR heads): clean with current main and with 17 other open PRs. It conflicts with #54 inemit/mod.rs: both changeemit(), #48 wraps it in a retry and #54 addsemit_for.victory-gpu(E0425host_resource, also on main); I did not run the full workspace here.Review notes (none blocking):
emit()retries with threading only when the first attempt returnedUnsupported. Programs that already translate never take the new path, which fits the "first 520 outputs identical" statement.subnegates at the same width, and with glc the old value is split intov[reg]andv[reg+1], while inactive lanes keep their original data. I only read this; the Windows runs reported above are the real check.handleskey looks like it also fixes a collision between 32-bit and 64-bit views at the same load site.thread_edgesends inunreachable!("threading an incoming edge")for other exit kinds. I could not find a way to reach it fromconstant_edges, but returning aShaderErrorwould keep a future change from turning into a panic in the translator.constant_edgesthreads at most one incoming edge per join (it stops after the first proven one). Fine for correctness; mentioning it in case it is intended.D3D12_FEATURE_DATA_D3D12_OPTIONS9andOPTIONS11). A device without them would fail at pipeline creation instead of being refused at translation. Reports above are from a device that has both.0x40_0000,0x1000_0000) against DXC'sDxilConstants.h; there is no DXC here. The Windows validator results from other testers cover them.emit(), like the check above, would also cover the retry itself.Not verified: Windows/D3D12 runtime, any GPU, DXIL validation, the 628-shader scan (520 + 108), behavior of translated threaded shaders, bit values against DXC.
@DaviTostes on GitHub · 2026-11-24 00:59 UTC · original
Tested
56f0072on Arch Linux x86_64, rustc 1.98.1: pass.cargo test -p victory-shader: 54 passed, 0 failed (2 test binaries), including the 2 tests this PR adds.victory-gpuE0425; the shader crate itself is green.No game data used. AI-assisted (DeepSeek V4.1 Flash coding agent).
@SpaghettiMaster545 on GitHub · 2026-11-24 03:20 UTC · original
Tested with the title
56f0072(this PR), againstmainand against #305 on the same machine.maind2a4bae, its own emptyVICTORY_CACHE_DIR, scripted keys into story mode, until the host GPU failure (#71, unrelated), compared program by program with amainrun made the same way.mainrun, 14 pixel programs stop witha 64-bit image atomic.mainwitha scalar memory read as data(7) anda descriptor read only as data(3), presumably from the branch-following part of this PR. 20 gained in all, 0 programs that ran onmainstop, and no pipeline is newly refused by the driver.Not tested
(Claude Code, Claude Opus 5.5: ran the title on each build and compared the logs program by program.)
Pull request closed