Shaders: lower partial-channel typed buffer stores #342

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

@⁠tarcisioads on GitHub · 2026-11-24 02:24 UTC · original
tarcisioads:shader/typed-buffer-store-partial → main · +69 −4 · 1 files · 1 commits · open

Support partial-channel typed buffer_store_format_* (count < 4) in crates/victory-shader/src/emit/lower.rs:

  • Allow count 1..=4 in typed bufferStore.f32 (still rejecting *offen || *offset != 0), padding unused channels up to 4 with undef (f32) and passing (1u8 << count) - 1 as the writeMask.
  • Add unit test partial_channel_typed_buffer_store_lowers covering buffer_store_format_x, buffer_store_format_xy, buffer_store_format_xyz, and buffer_store_format_d16_xyz.

Verification

  • cargo test -p victory-shader (57/57 passed on macOS; Windows dxil.dll validation not run)
  • rustfmt --edition 2024 --check crates/victory-shader/src/emit/lower.rs (ok)
  • cargo xtask policy (ok)
**@⁠tarcisioads** on GitHub · 2026-11-24 02:24 UTC · [original](https://github.com/Marvisak/VIctory/pull/342) `tarcisioads:shader/typed-buffer-store-partial` → `main` · +69 −4 · 1 files · 1 commits · open Support partial-channel typed `buffer_store_format_*` (`count < 4`) in `crates/victory-shader/src/emit/lower.rs`: - Allow `count` 1..=4 in typed `bufferStore.f32` (still rejecting `*offen || *offset != 0`), padding unused channels up to 4 with `undef` (`f32`) and passing `(1u8 << count) - 1` as the `writeMask`. - Add unit test `partial_channel_typed_buffer_store_lowers` covering `buffer_store_format_x`, `buffer_store_format_xy`, `buffer_store_format_xyz`, and `buffer_store_format_d16_xyz`. ### Verification - `cargo test -p victory-shader` (57/57 passed on macOS; Windows `dxil.dll` validation not run) - `rustfmt --edition 2024 --check crates/victory-shader/src/emit/lower.rs` (ok) - `cargo xtask policy` (ok)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:59:57 +00:00
Author
Owner

@⁠r4tedx on GitHub · 2026-11-24 03:14 UTC · original

Review note: typed stores now pass a partial mask (i8((1u8 << count) - 1)), and the DXIL validator rejects that for a typed UAV. Adding validation to this PR's own fixture (dxil.dll from the Windows SDK) fails with

store on typed uav must write to all four components of the UAV

DXIL's bufferStore on a typed buffer has to write all four components (mask 0xF); the components the instruction does not supply need explicit values. D3D12 only checks the container hash, so a driver may still accept the module, which is why the test passes without the validator. What the hardware writes to the components a typed buffer store leaves out I could not find stated for MTBUF; for image stores the RDNA 2 ISA says the missing components get 0.

From the documents and synthetic tests only; I have no copy of the title and have not run this on console hardware.

**@⁠r4tedx** on GitHub · 2026-11-24 03:14 UTC · [original](https://github.com/Marvisak/VIctory/pull/342#issuecomment-7120904935) Review note: typed stores now pass a partial mask (`i8((1u8 << count) - 1)`), and the DXIL validator rejects that for a typed UAV. Adding validation to this PR's own fixture (dxil.dll from the Windows SDK) fails with ``` store on typed uav must write to all four components of the UAV ``` DXIL's `bufferStore` on a typed buffer has to write all four components (mask `0xF`); the components the instruction does not supply need explicit values. D3D12 only checks the container hash, so a driver may still accept the module, which is why the test passes without the validator. What the hardware writes to the components a typed buffer store leaves out I could not find stated for MTBUF; for image stores the RDNA 2 ISA says the missing components get 0. From the documents and synthetic tests only; I have no copy of the title and have not run this on console hardware.
Author
Owner

@⁠tarcisioads on GitHub · 2026-11-24 11:18 UTC · original

Rebased onto main (ffe310e) and addressed @⁠r4tedx's DXIL validator feedback in 4950d61:

  • Pad missing channels in typed bufferStore.f32 with 0.0f (self.s.m.f32(0)) and pass 0xF as the writeMask.
  • cargo test -p victory-shader (97 passed, 0 failed on macOS; dxil.dll validation still needs Windows).
**@⁠tarcisioads** on GitHub · 2026-11-24 11:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/342#issuecomment-7129937998) Rebased onto `main` (`ffe310e`) and addressed @⁠r4tedx's DXIL validator feedback in `4950d61`: - Pad missing channels in typed `bufferStore.f32` with `0.0f` (`self.s.m.f32(0)`) and pass `0xF` as the `writeMask`. - `cargo test -p victory-shader` (97 passed, 0 failed on macOS; `dxil.dll` validation still needs Windows).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:28 UTC · original · edited 2026-11-25 22:16 UTC

Automated triage for the maintainers.

Needs rebase. This PR no longer merges cleanly into main (conflict in crates/victory-shader/src/emit/lower.rs). It will be reviewed again once it is rebased.

From the earlier needs-work note, still open: evidence for zero-filling the channels a partial typed buffer store does not supply (or refuse those cases), and dxil.dll validation in partial_channel_typed_buffer_store_lowers.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/342#issuecomment-7148550902) · edited 2026-11-25 22:16 UTC <!-- victory-triage v1 head=2915587002e831727952668292dd5c948e49896a verdict=needs-rebase at=2026-11-25T22:17:30Z --> Automated triage for the maintainers. **Needs rebase.** This PR no longer merges cleanly into `main` (conflict in `crates/victory-shader/src/emit/lower.rs`). It will be reviewed again once it is rebased. From the earlier needs-work note, still open: evidence for zero-filling the channels a partial typed buffer store does not supply (or refuse those cases), and `dxil.dll` validation in `partial_channel_typed_buffer_store_lowers`. --- _Generated by [Claude Code](https://claude.ai/code)_
This pull request has changes conflicting with the target branch.
  • crates/victory-shader/src/emit/lower.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/342/head:github-bot/gh-342'
git switch 'github-bot/gh-342'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-342'
git switch 'github-bot/gh-342'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-342'
git switch 'github-bot/gh-342'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-342'
git switch 'main'
git merge --squash 'github-bot/gh-342'
git switch 'main'
git merge --ff-only 'github-bot/gh-342'
git switch 'main'
git merge 'github-bot/gh-342'
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!342
No description provided.