Shaders: lower MSAA image_load and image_get_resinfo #328

Open
tarcisioads wants to merge 1 commit from upstream-pr/328 into main
tarcisioads commented 2026-11-24 02:20:00 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by tarcisioads on 2026-11-24T02:20:00Z.


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)
<!-- greyfinch-sync:Marvisak/VIctory:issue:5464847665 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/328). Originally posted by [tarcisioads](https://github.com/tarcisioads) on 2026-11-24T02:20:00Z. --- 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)
jeremygold02 commented 2026-11-24 06:55:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-24T04:21:05Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7121937850 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/328#issuecomment-7121937850). Originally posted by [jeremygold02](https://github.com/jeremygold02) on 2026-11-24T04:21:05Z. --- 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)
tarcisioads commented 2026-11-24 12:04:29 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by tarcisioads on 2026-11-24T11:18:53Z.


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).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7129937166 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/328#issuecomment-7129937166). Originally posted by [tarcisioads](https://github.com/tarcisioads) on 2026-11-24T11:18:53Z. --- 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).
Marvisak commented 2026-11-25 01:07:51 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T00:28:08Z.


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

<!-- greyfinch-sync:Marvisak/VIctory:comment:7148540760 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/328#issuecomment-7148540760). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T00:28:08Z. --- <!-- 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)_
tarcisioads commented 2026-11-25 01:08:12 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by tarcisioads on 2026-11-25T00:40:03Z.


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).
<!-- greyfinch-sync:Marvisak/VIctory:comment:7148750269 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/328#issuecomment-7148750269). Originally posted by [tarcisioads](https://github.com/tarcisioads) on 2026-11-25T00:40:03Z. --- 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).
Dathinel commented 2026-11-25 06:02:52 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dathinel on 2026-11-25T05:58:01Z.


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.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7154308115 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/328#issuecomment-7154308115). Originally posted by [Dathinel](https://github.com/Dathinel) on 2026-11-25T05:58:01Z. --- 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 cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/328:upstream-pr/328'
git switch 'upstream-pr/328'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/328'
git switch 'upstream-pr/328'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/328'
git switch 'upstream-pr/328'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/328'
git switch 'main'
git merge --squash 'upstream-pr/328'
git switch 'main'
git merge --ff-only 'upstream-pr/328'
git switch 'main'
git merge 'upstream-pr/328'
git push origin 'main'
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
Marvisak/VIctory!328
No description provided.