Shaders: support cube dimension in descriptor_data #317

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

@⁠tarcisioads on GitHub · 2026-11-24 02:15 UTC · original
tarcisioads:shader/cube-msaa-descriptor-data → main · +105 −2 · 2 files · 1 commits · open

Support cube (dim = 3) image dimensions when a shader reads a resource descriptor's metadata words as data (descriptor_data in crates/victory-shader/src/emit/lower.rs):

  • Map dim = 3 => 5 (TextureCube) in descriptor_data.
  • Hardcode cube depth = 6 before - 1 (yielding 5, matching the RDNA2 ISA descriptor table for 6 faces) and add 11 (SQ_RSRC_IMG_CUBE) to the hardware type table in word 3.
  • Drop the unreachable MSAA arms until MSAA image instructions lower.
  • Add unit test cube_descriptor_data_lowers verifying SFI0 RESOURCE_HEAP emission.

Verification

  • cargo test -p victory-shader (119 passed, 0 failed, 1 ignored benchmark on macOS; Windows dxil.dll validation not run)
  • cargo xtask policy (ok)
**@⁠tarcisioads** on GitHub · 2026-11-24 02:15 UTC · [original](https://github.com/Marvisak/VIctory/pull/317) `tarcisioads:shader/cube-msaa-descriptor-data` → `main` · +105 −2 · 2 files · 1 commits · open Support cube (`dim = 3`) image dimensions when a shader reads a resource descriptor's metadata words as data (`descriptor_data` in `crates/victory-shader/src/emit/lower.rs`): - Map `dim = 3 => 5` (`TextureCube`) in `descriptor_data`. - Hardcode cube `depth = 6` before `- 1` (yielding `5`, matching the RDNA2 ISA descriptor table for 6 faces) and add `11` (`SQ_RSRC_IMG_CUBE`) to the hardware type table in word 3. - Drop the unreachable MSAA arms until MSAA image instructions lower. - Add unit test `cube_descriptor_data_lowers` verifying `SFI0` `RESOURCE_HEAP` emission. ### Verification - `cargo test -p victory-shader` (119 passed, 0 failed, 1 ignored benchmark on macOS; Windows `dxil.dll` validation not run) - `cargo xtask policy` (ok)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:59:04 +00:00
Author
Owner

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

Review note on the MSAA case. For kinds 3 and 8 (MSAA) the level count is set to 1:

let levels = if uav || matches!(kind, 3 | 8) { one } else { field(self, 3) };

so the descriptor's last-level field comes out as 0. The RDNA 2 ISA's image resource table defines that field differently for MSAA:

last level: smallest mip level in resource view. For MSAA, holds log2(number of samples).

Code that reads the sample count from the descriptor would get 1 sample. The host view's sample count is available (getDimensions on a Texture2DMS returns it), so the field could hold its log2.

For the cube case, #109 hardcodes the depth field as 5, which matches the same table ("depth: ... last array slice for a 2D-array or 1D-array or cube-map"); here it is taken from getDimensions component 2, which a TextureCube does not expose, so the two PRs disagree and #109's value is the one the table gives.

From the document and reading the diff only; I have no copy of the title.

**@⁠r4tedx** on GitHub · 2026-11-24 03:09 UTC · [original](https://github.com/Marvisak/VIctory/pull/317#issuecomment-7120817729) Review note on the MSAA case. For kinds 3 and 8 (MSAA) the level count is set to 1: ```rust let levels = if uav || matches!(kind, 3 | 8) { one } else { field(self, 3) }; ``` so the descriptor's last-level field comes out as 0. The RDNA 2 ISA's image resource table defines that field differently for MSAA: > last level: smallest mip level in resource view. For MSAA, holds log2(number of samples). Code that reads the sample count from the descriptor would get 1 sample. The host view's sample count is available (`getDimensions` on a `Texture2DMS` returns it), so the field could hold its log2. For the cube case, #109 hardcodes the depth field as 5, which matches the same table ("depth: ... last array slice for a 2D-array or 1D-array or cube-map"); here it is taken from `getDimensions` component 2, which a `TextureCube` does not expose, so the two PRs disagree and #109's value is the one the table gives. From the document and reading the diff only; I have no copy of the title.
Author
Owner

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

Rebased onto main (ffe310e) and addressed @⁠r4tedx's review notes in 8133754:

  • Set Cube (kind = 5) depth to 5 (6 faces - 1).
  • Set MSAA (kind = 3 | 8) last_level to firstbitLo(samples) (log2(samples) from getDimensions component 3).
  • Updated cube_and_msaa_descriptor_data_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/317#issuecomment-7129936784) Rebased onto `main` (`ffe310e`) and addressed @⁠r4tedx's review notes in `8133754`: - Set Cube (`kind = 5`) `depth` to `5` (6 faces - 1). - Set MSAA (`kind = 3 | 8`) `last_level` to `firstbitLo(samples)` (`log2(samples)` from `getDimensions` component 3). - Updated `cube_and_msaa_descriptor_data_lower` for the new `resource::track` signature; `cargo test -p victory-shader` (97 passed, 0 failed on macOS).
Author
Owner

@⁠Yaekai on GitHub · 2026-11-24 16:38 UTC · original

Independent verification on Windows 11 + NVIDIA RTX 3070 (Rust 1.98.1) at head 8133754:

  • cargo test -p victory-shader --lib -- --skip valu_tests --skip waterfall_tests: 103 passed, 0 failed.
  • cargo clippy -p victory-shader -- -D warnings: 0 warnings.
  • Live GTA VI (1.0.2.1, --console series-s, 19-min world run): no regressions. Ready to merge!
**@⁠Yaekai** on GitHub · 2026-11-24 16:38 UTC · [original](https://github.com/Marvisak/VIctory/pull/317#issuecomment-7137979488) Independent verification on Windows 11 + NVIDIA RTX 3070 (Rust 1.98.1) at head `8133754`: - `cargo test -p victory-shader --lib -- --skip valu_tests --skip waterfall_tests`: 103 passed, 0 failed. - `cargo clippy -p victory-shader -- -D warnings`: 0 warnings. - Live GTA VI (`1.0.2.1`, `--console series-s`, 19-min world run): no regressions. Ready to merge!
Author
Owner

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

Automated triage for the maintainers.

Needs rebase. This PR no longer merges cleanly into main: main has moved since the last triage, and the branch now conflicts in crates/victory-shader/src/emit/bitcode.rs and crates/victory-shader/src/emit/lower.rs. It will be reviewed again once it is rebased onto current main.

Previous verdict for this head: merge candidate.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 00:30 UTC · [original](https://github.com/Marvisak/VIctory/pull/317#issuecomment-7148584480) · edited 2026-11-25 22:29 UTC <!-- victory-triage v1 head=a2dddc33b1c0314b394d947323222e738cf12726 verdict=needs-rebase at=2026-11-25T22:33:00Z --> Automated triage for the maintainers. **Needs rebase.** This PR no longer merges cleanly into `main`: `main` has moved since the last triage, and the branch now conflicts in `crates/victory-shader/src/emit/bitcode.rs` and `crates/victory-shader/src/emit/lower.rs`. It will be reviewed again once it is rebased onto current `main`. Previous verdict for this head: merge candidate. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

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

Addressed the triage feedback:

  • Scoped this PR to Cube (dim = 3, depth = 5, SQ_RSRC_IMG_CUBE = 11), dropping the unreachable MSAA arms (and the firstbitLo.i32 call) until MSAA image instructions lower.
  • Updated the unit test to cube_descriptor_data_lowers and verified SFI0 RESOURCE_HEAP emission.
  • cargo test -p victory-shader (119 passed, 0 failed on macOS).
**@⁠tarcisioads** on GitHub · 2026-11-25 00:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/317#issuecomment-7148652148) Addressed the triage feedback: - Scoped this PR to Cube (`dim = 3`, `depth = 5`, `SQ_RSRC_IMG_CUBE = 11`), dropping the unreachable MSAA arms (and the `firstbitLo.i32` call) until MSAA image instructions lower. - Updated the unit test to `cube_descriptor_data_lowers` and verified `SFI0` `RESOURCE_HEAP` emission. - `cargo test -p victory-shader` (119 passed, 0 failed on macOS).
This pull request has changes conflicting with the target branch.
  • crates/victory-shader/src/emit/bitcode.rs
  • 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/317/head:github-bot/gh-317'
git switch 'github-bot/gh-317'

Merge

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