Shaders: lower 64-bit texture atomics to DXIL i64 atomics #1899

Open
github-bot wants to merge 1 commit from github-bot/gh-1899 into main AGit
Owner

@⁠TansuoTro on GitHub · 2026-11-25 00:21 UTC · original
TansuoTro:feat/shader-64bit-image-atomics → main · +254 −50 · 6 files · 1 commits · open

Summary

Implements 64-bit image atomics (image_atomic_* with dmask=3, or xF for cmpswap), which previously stopped shader translation at emit/lower.rs.

  • Lowers to DXIL SM 6.6 dx.op.atomicBinOp.i64 / dx.op.atomicCompareExchange.i64 (opcodes 78/79) on the heap texture handle; supports add/sub/and/or/xor/smin/smax/umin/umax/swap/cmpswap, with glc returning the old 64-bit value via split registers.
  • Sets the required Int64, AtomicInt64OnTypedResource and AtomicInt64OnHeapResource shader flags / SFI0 feature bits (verified against DXC's DxilShaderFlags.h).
  • Documents the R32G32_UINT host-view contract; adds a Uint64TextureUav test view.
  • Adds a synthetic MIMG test covering all 11 operations plus 32-bit regressions, validated with dxil.dll when available (skips cleanly otherwise).

Verification

  • cargo test --workspace -q: pass
  • cargo clippy --workspace --all-targets --locked -- -D warnings: pass
  • cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: pass
  • dxil.dll validation of all generated 64-bit/32-bit atomic shaders: pass

Tested on Game

**@⁠TansuoTro** on GitHub · 2026-11-25 00:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/1899) `TansuoTro:feat/shader-64bit-image-atomics` → `main` · +254 −50 · 6 files · 1 commits · open ## Summary Implements 64-bit image atomics (image_atomic_* with dmask=3, or xF for cmpswap), which previously stopped shader translation at `emit/lower.rs`. - Lowers to DXIL SM 6.6 `dx.op.atomicBinOp.i64` / `dx.op.atomicCompareExchange.i64` (opcodes 78/79) on the heap texture handle; supports add/sub/and/or/xor/smin/smax/umin/umax/swap/cmpswap, with glc returning the old 64-bit value via split registers. - Sets the required Int64, AtomicInt64OnTypedResource and AtomicInt64OnHeapResource shader flags / SFI0 feature bits (verified against DXC's DxilShaderFlags.h). - Documents the R32G32_UINT host-view contract; adds a `Uint64TextureUav` test view. - Adds a synthetic MIMG test covering all 11 operations plus 32-bit regressions, validated with `dxil.dll` when available (skips cleanly otherwise). ## Verification - `cargo test --workspace -q`: pass - `cargo clippy --workspace --all-targets --locked -- -D warnings`: pass - `cargo clippy --workspace --all-targets --all-features --locked -- -D warnings`: pass - `dxil.dll` validation of all generated 64-bit/32-bit atomic shaders: pass Tested on Game
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:48:04 +00:00
Author
Owner

@⁠upipibi on GitHub · 2026-11-25 00:26 UTC · original

Heads-up from reading, not a run: this PR's base (ffe310e) predates 0b35b7f on main, which already lowers 64-bit image atomics. The R32G32_UINT view uses the low dword in R and the data as an i64. sub is done as add of the negation. It sets flags::INT64 | ATOMIC64_TYPED | ATOMIC64_HEAP (emit/lower.rs around line 7718), and valu_tests.rs has image_atomics_of_64_bits. GitHub reports this PR as conflicting with main now.

If something here isn't in main (the Uint64TextureUav test view, or an op main refuses), rebasing it down to that part would keep it reviewable.

AI-assisted (Claude Code).

**@⁠upipibi** on GitHub · 2026-11-25 00:26 UTC · [original](https://github.com/Marvisak/VIctory/pull/1899#issuecomment-7148518902) Heads-up from reading, not a run: this PR's base (`ffe310e`) predates 0b35b7f on `main`, which already lowers 64-bit image atomics. The `R32G32_UINT` view uses the low dword in R and the data as an i64. `sub` is done as add of the negation. It sets `flags::INT64 | ATOMIC64_TYPED | ATOMIC64_HEAP` (`emit/lower.rs` around line 7718), and `valu_tests.rs` has `image_atomics_of_64_bits`. GitHub reports this PR as conflicting with `main` now. If something here isn't in `main` (the `Uint64TextureUav` test view, or an op `main` refuses), rebasing it down to that part would keep it reviewable. AI-assisted (Claude Code).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 02:17 UTC · original

Automated triage for the maintainers.

This pull request does not merge cleanly into main. Conflicting files: crates/victory-gpu/src/descriptor/host.rs, crates/victory-shader/src/emit/host.rs, crates/victory-shader/src/emit/lower.rs, crates/victory-shader/src/emit/mod.rs, crates/victory-shader/src/emit/shader.rs, crates/victory-shader/src/emit/valu_tests.rs.

It will be reviewed once it is rebased onto the current main.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 02:17 UTC · [original](https://github.com/Marvisak/VIctory/pull/1899#issuecomment-7150546921) <!-- victory-triage v1 head=de9ca0c3842aae4b40f6917acae01cb67573467b verdict=needs-rebase at=2026-11-25T02:15:48Z --> Automated triage for the maintainers. This pull request does not merge cleanly into `main`. Conflicting files: `crates/victory-gpu/src/descriptor/host.rs`, `crates/victory-shader/src/emit/host.rs`, `crates/victory-shader/src/emit/lower.rs`, `crates/victory-shader/src/emit/mod.rs`, `crates/victory-shader/src/emit/shader.rs`, `crates/victory-shader/src/emit/valu_tests.rs`. It will be reviewed once it is rebased onto the current `main`. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request has changes conflicting with the target branch.
  • crates/victory-gpu/src/descriptor/host.rs
  • crates/victory-shader/src/emit/host.rs
  • crates/victory-shader/src/emit/lower.rs
  • crates/victory-shader/src/emit/mod.rs
  • crates/victory-shader/src/emit/shader.rs
  • crates/victory-shader/src/emit/valu_tests.rs
View command line instructions

Manual merge helper

Use this merge commit message when completing the merge manually.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/1899/head:github-bot/gh-1899'
git switch 'github-bot/gh-1899'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-1899'
git switch 'github-bot/gh-1899'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-1899'
git switch 'github-bot/gh-1899'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-1899'
git switch 'main'
git merge --squash 'github-bot/gh-1899'
git switch 'main'
git merge --ff-only 'github-bot/gh-1899'
git switch 'main'
git merge 'github-bot/gh-1899'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!1899
No description provided.