Shaders: lower MSAA image_load and image_get_resinfo #328

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

@⁠tarcisioads on GitHub · 2026-11-24 02:20 UTC · original
tarcisioads:shader/msaa-image-load → main · +82 −4 · 1 files · 1 commits · open

Support 2DMS (dim = 6) and 2DMSArray (dim = 7) image dimensions for image_load and image_get_resinfo in crates/victory-shader/src/emit/lower.rs:

  • Map dim = 6 => (3, 2) and dim = 7 => (8, 3) in image() for image_load and image_get_resinfo.
  • In image_get_resinfo (op 72), pass undef as the mip argument of dx.op.getDimensions for MSAA (kind 3 | 8) and treat 2DMS (kind = 3) as [true, true, false, true] (width, height, -, sample count).
  • In image_load (op 66), forward sample_index (addr_val(self, coords)) into the mipLevelOrSample parameter of dx.op.textureLoad.
  • Add unit test msaa_image_load_and_get_resinfo_lower covering image_load and image_get_resinfo for both dim = 6 and dim = 7.

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:20 UTC · [original](https://github.com/Marvisak/VIctory/pull/328) `tarcisioads:shader/msaa-image-load` → `main` · +82 −4 · 1 files · 1 commits · open Support `2DMS` (`dim = 6`) and `2DMSArray` (`dim = 7`) image dimensions for `image_load` and `image_get_resinfo` in `crates/victory-shader/src/emit/lower.rs`: - Map `dim = 6 => (3, 2)` and `dim = 7 => (8, 3)` in `image()` for `image_load` and `image_get_resinfo`. - In `image_get_resinfo` (`op 72`), pass `undef` as the `mip` argument of `dx.op.getDimensions` for MSAA (`kind` `3 | 8`) and treat `2DMS` (`kind = 3`) as `[true, true, false, true]` (width, height, -, sample count). - In `image_load` (`op 66`), forward `sample_index` (`addr_val(self, coords)`) into the `mipLevelOrSample` parameter of `dx.op.textureLoad`. - Add unit test `msaa_image_load_and_get_resinfo_lower` covering `image_load` and `image_get_resinfo` for both `dim = 6` and `dim = 7`. ### 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:27 +00:00
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-24 04:21 UTC · original

Tested PR #328 at head 6d7602daf690bd5ec6d3b7ecac653a2e3bf7b9f0 (state at test time: OPEN). Pre-comment refresh: state OPEN, head unchanged at 6d7602daf690bd5ec6d3b7ecac653a2e3bf7b9f0.

  • cargo test --locked -p victory-shader msaa_image_load_and_get_resinfo_lower — passed (ok. 1 passed; 0 failed; 0 ignored; 0 measured; 69 filtered out; finished in 0.00s ); cases: emit::lower::tests::msaa_image_load_and_get_resinfo_lower.

Behavior covered: Checks MSAA image_load and image_get_resinfo lowering in the shader emitter.
Code: crates/victory-shader/src/emit/lower.rs

**@⁠jeremygold02** on GitHub · 2026-11-24 04:21 UTC · [original](https://github.com/Marvisak/VIctory/pull/328#issuecomment-7121937850) Tested PR #328 at head `6d7602daf690bd5ec6d3b7ecac653a2e3bf7b9f0` (state at test time: OPEN). Pre-comment refresh: state OPEN, head unchanged at `6d7602daf690bd5ec6d3b7ecac653a2e3bf7b9f0`. - `cargo test --locked -p victory-shader msaa_image_load_and_get_resinfo_lower` — passed (ok. 1 passed; 0 failed; 0 ignored; 0 measured; 69 filtered out; finished in 0.00s ); cases: emit::lower::tests::msaa_image_load_and_get_resinfo_lower. Behavior covered: Checks MSAA image_load and image_get_resinfo lowering in the shader emitter. Code: [crates/victory-shader/src/emit/lower.rs](https://github.com/Marvisak/VIctory/blob/6d7602daf690bd5ec6d3b7ecac653a2e3bf7b9f0/crates/victory-shader/src/emit/lower.rs)
Author
Owner

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

Rebased onto main (ffe310e) in 91e7742 and updated msaa_image_load_and_get_resinfo_lower for the new resource::track signature. cargo test -p victory-shader (97 passed, 0 failed on macOS).

**@⁠tarcisioads** on GitHub · 2026-11-24 11:18 UTC · [original](https://github.com/Marvisak/VIctory/pull/328#issuecomment-7129937166) Rebased onto `main` (`ffe310e`) in `91e7742` and updated `msaa_image_load_and_get_resinfo_lower` for the new `resource::track` signature. `cargo test -p victory-shader` (97 passed, 0 failed on macOS).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 00:28 UTC · original · edited 2026-11-25 22:15 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: a source for channel w = 1 of MSAA image_get_resinfo, a comment that says what the code does, and a test that asserts the emitted textureLoad/getDimensions arguments.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:28 UTC · [original](https://github.com/Marvisak/VIctory/pull/328#issuecomment-7148540760) · edited 2026-11-25 22:15 UTC <!-- victory-triage v1 head=f7522095c2235c17307e4f8fa4c6deda2d6544a9 verdict=needs-rebase at=2026-11-25T22:16:35Z --> 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: a source for channel w = 1 of MSAA `image_get_resinfo`, a comment that says what the code does, and a test that asserts the emitted `textureLoad`/`getDimensions` arguments. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠tarcisioads on GitHub · 2026-11-25 00:40 UTC · original

Addressed the triage feedback:

  1. In image_get_resinfo (op 72), MSAA (kind = 3 | 8) now returns 1 in channel w (matching RDNA2 IMAGE_GET_RESINFO mip count, rather than passing through DXIL's sample count).
  2. Documented the // shortcut: on image_load MSAA (forwarding fragment index as sample index, assuming no FMASK remapping).
  3. Fixed the comments in msaa_image_load_and_get_resinfo_lower to match the encoded words and added an assertion on the emitted SFI0 RESOURCE_HEAP feature bit.
  • cargo test -p victory-shader (119 passed, 0 failed on macOS; dxil.dll validation still needs Windows).
**@⁠tarcisioads** on GitHub · 2026-11-25 00:40 UTC · [original](https://github.com/Marvisak/VIctory/pull/328#issuecomment-7148750269) Addressed the triage feedback: 1. In `image_get_resinfo` (`op 72`), MSAA (`kind = 3 | 8`) now returns `1` in channel `w` (matching RDNA2 `IMAGE_GET_RESINFO` mip count, rather than passing through DXIL's sample count). 2. Documented the `// shortcut:` on `image_load` MSAA (forwarding fragment index as sample index, assuming no FMASK remapping). 3. Fixed the comments in `msaa_image_load_and_get_resinfo_lower` to match the encoded words and added an assertion on the emitted `SFI0` `RESOURCE_HEAP` feature bit. - `cargo test -p victory-shader` (119 passed, 0 failed on macOS; `dxil.dll` validation still needs Windows).
Author
Owner

@⁠Dathinel on GitHub · 2026-11-25 05:58 UTC · original

Windows SDK validation of the four MSAA cases is complete. There is one fixture update needed when refreshing this branch onto main.

  • On 940d32f6, cargo test --frozen -p victory-shader --lib --no-run builds. Merging 62baee73 cleanly onto it produces tree 287c3390, where the test target fails to compile: E0063, missing view_marks in the new Parts initializer in msaa_image_load_and_get_resinfo_lower.
  • I added view_marks: false, locally to that initializer, matching the neighboring fixtures. The regression test then passed. I also passed a copy of each emitted DXIL container to the repo's validator wrapper with the x64 Windows SDK 10.0.26100.0 dxil.dll explicitly loaded. All four returned success: dimensions 6 and 7, each with image_load and image_get_resinfo.

This checks DXIL validation. Sample selection and returned dimensions were not measured on a GPU. AI-assisted; the fixture adjustment and validator call were local only.

**@⁠Dathinel** on GitHub · 2026-11-25 05:58 UTC · [original](https://github.com/Marvisak/VIctory/pull/328#issuecomment-7154308115) Windows SDK validation of the four MSAA cases is complete. There is one fixture update needed when refreshing this branch onto main. - On `940d32f6`, `cargo test --frozen -p victory-shader --lib --no-run` builds. Merging `62baee73` cleanly onto it produces tree `287c3390`, where the test target fails to compile: E0063, missing `view_marks` in the new `Parts` initializer in `msaa_image_load_and_get_resinfo_lower`. - I added `view_marks: false,` locally to that initializer, matching the neighboring fixtures. The regression test then passed. I also passed a copy of each emitted DXIL container to the repo's validator wrapper with the x64 Windows SDK 10.0.26100.0 `dxil.dll` explicitly loaded. All four returned success: dimensions 6 and 7, each with `image_load` and `image_get_resinfo`. This checks DXIL validation. Sample selection and returned dimensions were not measured on a GPU. AI-assisted; the fixture adjustment and validator call were local only.
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/328/head:github-bot/gh-328'
git switch 'github-bot/gh-328'

Merge

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