shader: lower image stores of fewer than four channels #94

Merged
Olima34 merged 4 commits from upstream-pr/94 into main 2026-11-26 17:05:02 +00:00
Olima34 commented 2026-11-26 14:29:27 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-26T14:29:27Z.


What this changes

image_store with a dmask other than 0xF was refused ("an image store of some channels"). As for typed buffer stores (#56), GFX11 and older store 0 in the channels the mask leaves out (LLVM 88421ea "[AMDGPU] Trim zero components from buffer and image stores", Mesa 4a6ee2c4833), so the store now writes the whole texel: the data holds the enabled channels in turn (two per VGPR with d16), and the others are 0. A dmask of 0, whose behaviour is undocumented, is still refused. docs/native-host.md gets the image counterpart of the "Typed buffer stores" note.

Tests: hand-assembled stores with dmask 0x1, 0x3 and 0x5 now translate (image_stores_of_some_channels_lower), and a Windows value test reads the UAV back (image_stores_of_some_channels_zero_the_others).

How it was tested

  • cargo test -p victory-shader and arm64 cargo test --workspace (value probes run only in the Windows CI)
  • cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings, also with --all-features
  • cargo xtask policy
  • Ran the game: not done, no copy of it here

Checklist

  • No game files, game code, disassembly listings or SDK files are included
  • Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md
  • New diagnostics are behind a VICTORY_* variable and documented (none added)
<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:issue:6628805477 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/94). Originally posted by [Olima34](https://github.com/Olima34) on 2026-11-26T14:29:27Z. --- ## What this changes `image_store` with a `dmask` other than `0xF` was refused ("an image store of some channels"). As for typed buffer stores (#56), GFX11 and older store 0 in the channels the mask leaves out (LLVM 88421ea "[AMDGPU] Trim zero components from buffer and image stores", Mesa 4a6ee2c4833), so the store now writes the whole texel: the data holds the enabled channels in turn (two per VGPR with `d16`), and the others are 0. A `dmask` of 0, whose behaviour is undocumented, is still refused. docs/native-host.md gets the image counterpart of the "Typed buffer stores" note. Tests: hand-assembled stores with `dmask` 0x1, 0x3 and 0x5 now translate (`image_stores_of_some_channels_lower`), and a Windows value test reads the UAV back (`image_stores_of_some_channels_zero_the_others`). ## How it was tested - [x] `cargo test -p victory-shader` and arm64 `cargo test --workspace` (value probes run only in the Windows CI) - [x] `cargo clippy --workspace --all-targets --locked --target x86_64-pc-windows-gnullvm -- -D warnings`, also with `--all-features` - [x] `cargo xtask policy` - [ ] Ran the game: not done, no copy of it here ## Checklist - [x] No game files, game code, disassembly listings or SDK files are included - [x] Guesses about undocumented console behaviour are marked in the code and in docs/native-host.md - [x] New diagnostics are behind a `VICTORY_*` variable and documented (none added)
LakshanSivakumar commented 2026-11-26 14:54:53 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T14:54:53Z.

Review: CHANGES_REQUESTED


Thanks, this is the image-store version we'll keep. One thing: docs/native-host.md says "This is not a guess", but the LLVM/Mesa evidence only shows zero-fill of missing trailing components. Please narrow that to prefix dmasks and mark gapped masks (e.g. 0x5) as a guess.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:review:6076251699 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/94#pullrequestreview-6076251699). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T14:54:53Z. **Review:** CHANGES_REQUESTED --- Thanks, this is the image-store version we'll keep. One thing: docs/native-host.md says "This is not a guess", but the LLVM/Mesa evidence only shows zero-fill of missing trailing components. Please narrow that to prefix dmasks and mark gapped masks (e.g. 0x5) as a guess.
Olima34 commented 2026-11-26 15:01:23 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by Olima34 on 2026-11-26T15:01:23Z.


Done: the docs and the code comment now call prefix dmasks (0x1, 0x3, 0x7) established, by the zero-fill of missing trailing components in LLVM 88421ea and Mesa 4a6ee2c4833, and mark gapped masks (0x5, or one without red) as a guess. No code change.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:comment:7195668387 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/94#issuecomment-7195668387). Originally posted by [Olima34](https://github.com/Olima34) on 2026-11-26T15:01:23Z. --- Done: the docs and the code comment now call prefix dmasks (0x1, 0x3, 0x7) established, by the zero-fill of missing trailing components in LLVM 88421ea and Mesa 4a6ee2c4833, and mark gapped masks (0x5, or one without red) as a guess. No code change.
LakshanSivakumar commented 2026-11-26 16:03:52 +00:00 (Migrated from github.com)

Imported from LakshanSivakumar/Native-Victory-macOS. Originally posted by LakshanSivakumar on 2026-11-26T16:03:52Z.

Review: DISMISSED


The prefix dmasks are now documented as established and gapped masks as a guess, in the docs and the code comment. CI is green. Approving.

<!-- greyfinch-sync:LakshanSivakumar/Native-Victory-macOS:review:6077224088 --> Imported from [LakshanSivakumar/Native-Victory-macOS](https://github.com/LakshanSivakumar/Native-Victory-macOS/pull/94#pullrequestreview-6077224088). Originally posted by [LakshanSivakumar](https://github.com/LakshanSivakumar) on 2026-11-26T16:03:52Z. **Review:** DISMISSED --- The prefix dmasks are now documented as established and gapped masks as a guess, in the docs and the code comment. CI is green. Approving.
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
LakshanSivakumar/Native-Victory-macOS!94
No description provided.