Shaders: return zero for unused image query extents #1313

Open
EatCodeSleep2 wants to merge 1 commit from upstream-pr/1313 into main
EatCodeSleep2 commented 2026-11-24 17:21:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by EatCodeSleep2 on 2026-11-24T17:21:03Z.


Summary

Return zero for unused extents in the 1D, 2D and 1D-array image_get_resinfo cases. UAVs continue to report one mip level. Cube queries retain their existing behavior.

Refs #1249, finding VIC-BT-038. The reported RDNA2 behavior is also documented in the published hardware measurements.

Verification

  • A synthetic 2D query with all four result channels enabled reads back [3, 2, 1, 1] on main. After the fix it validates and returns [3, 2, 0, 1] on native Direct3D 12 and WARP.
  • The shader library suite passed 120 tests, with one ignored and the known NaN median test filtered out (#726, #745).
  • All-targets shader Clippy with warnings denied passed.

GPU readback covered 2D. This run used no RDNA2 hardware or game files. AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6587479245 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1313). Originally posted by [EatCodeSleep2](https://github.com/EatCodeSleep2) on 2026-11-24T17:21:03Z. --- ## Summary Return zero for unused extents in the 1D, 2D and 1D-array `image_get_resinfo` cases. UAVs continue to report one mip level. Cube queries retain their existing behavior. Refs #1249, finding VIC-BT-038. The reported RDNA2 behavior is also documented in the [published hardware measurements](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/debt/shader.md). ## Verification - A synthetic 2D query with all four result channels enabled reads back `[3, 2, 1, 1]` on main. After the fix it validates and returns `[3, 2, 0, 1]` on native Direct3D 12 and WARP. - The shader library suite passed 120 tests, with one ignored and the known NaN median test filtered out (#726, #745). - All-targets shader Clippy with warnings denied passed. GPU readback covered 2D. This run used no RDNA2 hardware or game files. AI-assisted.
DenRakEiw commented 2026-11-24 18:04:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T17:26:48Z.

Review: APPROVED


Tested merged cleanly onto main (ffe310e) on Windows 11 x64 (Rust 1.98.1 MSVC):

  • cargo test -p victory-shader emit::lower: 11 passed, 0 failed
  • cargo clippy -p victory-shader --all-targets: 0 warnings
  • cargo xtask policy: ok

Clean fix returning zero for unused image query extents. Approving.

AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6044160859 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1313#pullrequestreview-6044160859). Originally posted by [DenRakEiw](https://github.com/DenRakEiw) on 2026-11-24T17:26:48Z. **Review:** APPROVED --- Tested merged cleanly onto `main` (`ffe310e`) on Windows 11 x64 (Rust 1.98.1 MSVC): - `cargo test -p victory-shader emit::lower`: **11 passed, 0 failed** - `cargo clippy -p victory-shader --all-targets`: **0 warnings** - `cargo xtask policy`: ok Clean fix returning zero for unused image query extents. Approving. AI-assisted (Gemini 4 Neon).
crosettiremi commented 2026-11-24 18:05:51 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by crosettiremi on 2026-11-24T17:28:04Z.


Independent XCL cross-check on a Windows RX 7900 XT, using XCL's native D3D12 compute fixture. A 4×4, single-mip 2D texture queried with all four result channels returned [4, 4, 1, 1] before changing the emitter. Changing the unused extent to zero returned [4, 4, 0, 1] across the tested lanes. XCL’s existing native cube-array fixture also passed with 12 layers for two cubes. This reproduces the 2D discrepancy in a second translator. The game impact and 1D cases are unmeasured here.

Game follow-up on the same RX 7900 XT: the XCL test build accepted the account selection and continued world streaming. The last captured frame was dark, and the process ended with a second-chance guest breakpoint at RVA 0xf2cc4b after 204 s with no logged device removal. The 2D query correction alone did not produce a visible world on this run.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7139238483 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1313#issuecomment-7139238483). Originally posted by [crosettiremi](https://github.com/crosettiremi) on 2026-11-24T17:28:04Z. --- Independent XCL cross-check on a Windows RX 7900 XT, using XCL's native D3D12 compute fixture. A 4×4, single-mip 2D texture queried with all four result channels returned `[4, 4, 1, 1]` before changing the emitter. Changing the unused extent to zero returned `[4, 4, 0, 1]` across the tested lanes. XCL’s existing native cube-array fixture also passed with 12 layers for two cubes. This reproduces the 2D discrepancy in a second translator. The game impact and 1D cases are unmeasured here. Game follow-up on the same RX 7900 XT: the XCL test build accepted the account selection and continued world streaming. The last captured frame was dark, and the process ended with a second-chance guest breakpoint at RVA 0xf2cc4b after 204 s with no logged device removal. The 2D query correction alone did not produce a visible world on this run.
catminou4 commented 2026-11-24 21:02:03 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T20:09:45Z.

Review: APPROVED


Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (ffe310e), cargo test -p victory-shader --locked → 96 passed, 0 failed. Execution/valu tests are #[cfg(all(test, windows))] and only run on Windows; macOS covers lowering/structure/IR unit tests.

image_resinfo returns zero depth for 2D views when the extent is unused — avoids a bogus depth value reaching shaders. Small, tested.

<!-- greyfinch-sync:Marvisak/VIctory:review:6046556532 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1313#pullrequestreview-6046556532). Originally posted by [catminou4](https://github.com/catminou4) on 2026-11-24T20:09:45Z. **Review:** APPROVED --- Tested locally on macOS arm64 (rustc 1.98.1): PR head merged cleanly into current main (ffe310e), cargo test -p victory-shader --locked → 96 passed, 0 failed. Execution/valu tests are #[cfg(all(test, windows))] and only run on Windows; macOS covers lowering/structure/IR unit tests. image_resinfo returns zero depth for 2D views when the extent is unused — avoids a bogus depth value reaching shaders. Small, tested.
Marvisak commented 2026-11-25 02:05:55 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T01:21:59Z.


Automated triage for the maintainers.

Needs rebase. This pull request conflicts with main (conflicting: crates/victory-shader/src/emit/waterfall_tests.rs). It will be reviewed once it is rebased onto the current main.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7149471999 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/1313#issuecomment-7149471999). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T01:21:59Z. --- <!-- victory-triage v1 head=7295d7e85ceca285b82637dd1c3f84a20e553830 verdict=needs-rebase at=2026-11-25T01:21:58Z --> Automated triage for the maintainers. **Needs rebase.** This pull request conflicts with `main` (conflicting: `crates/victory-shader/src/emit/waterfall_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 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/1313:upstream-pr/1313'
git switch 'upstream-pr/1313'

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