fix(formats): reject unsupported MSAA swizzles #3385

Open
oddmaniv wants to merge 1 commit from upstream-pr/3385 into main
oddmaniv commented 2026-11-26 21:16:44 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by oddmaniv on 2026-11-26T21:16:44Z.


Summary

Reject multisampled texture descriptors using GFX10 standard, display, and 256-byte swizzles. Preserve valid multisampled Z-order/render swizzles and single-sample controls.

Verification

Added a synthetic regression for 2/4/8 samples across the restricted modes and valid Z/render controls. Native Windows RED failed on the regression before the validation change; GREEN passed 1 test. Package tests, both workspace Clippy configurations, and asset policy passed. The changed-file rustfmt gate reported pre-existing formatting differences elsewhere in this file; no broad formatting churn was applied.

Defensive descriptor validation only. No game files or GPU runtime.

<!-- greyfinch-sync:Marvisak/VIctory:issue:5517252134 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3385). Originally posted by [oddmaniv](https://github.com/oddmaniv) on 2026-11-26T21:16:44Z. --- ## Summary Reject multisampled texture descriptors using GFX10 standard, display, and 256-byte swizzles. Preserve valid multisampled Z-order/render swizzles and single-sample controls. ## Verification Added a synthetic regression for 2/4/8 samples across the restricted modes and valid Z/render controls. Native Windows RED failed on the regression before the validation change; GREEN passed 1 test. Package tests, both workspace Clippy configurations, and asset policy passed. The changed-file rustfmt gate reported pre-existing formatting differences elsewhere in this file; no broad formatting churn was applied. Defensive descriptor validation only. No game files or GPU runtime.
Dukestar69 commented 2026-11-26 21:28:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Dukestar69 on 2026-11-26T21:28:42Z.

Review: APPROVED


LGTM — verified on Windows against origin/main (63bcca4).

  • Rejecting multisampling on Standard (_S), Display (_D), and 256B swizzle modes while keeping _Z_X and _R_X MSAA valid matches GFX10 tiling constraints cleanly.
  • cargo test -p victory-formats --lib texture:: -- --test-threads=1: 17 passed, 0 failed (including standard_and_display_swizzles_reject_multisampling).
  • cargo clippy -p victory-formats --all-targets -- -D warnings: clean.
  • cargo xtask policy: 191 files ok.

Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).

<!-- greyfinch-sync:Marvisak/VIctory:review:6080643604 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3385#pullrequestreview-6080643604). Originally posted by [Dukestar69](https://github.com/Dukestar69) on 2026-11-26T21:28:42Z. **Review:** APPROVED --- LGTM — verified on Windows against `origin/main` (`63bcca4`). - Rejecting multisampling on Standard (`_S`), Display (`_D`), and 256B swizzle modes while keeping `_Z_X` and `_R_X` MSAA valid matches GFX10 tiling constraints cleanly. - `cargo test -p victory-formats --lib texture:: -- --test-threads=1`: 17 passed, 0 failed (including `standard_and_display_swizzles_reject_multisampling`). - `cargo clippy -p victory-formats --all-targets -- -D warnings`: clean. - `cargo xtask policy`: 191 files ok. Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
fuzeofficlal commented 2026-11-26 21:30:42 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T21:30:42Z.

Review: APPROVED


LGTM — verified against origin/main (63bcca43) on Windows x64.

  • Rejecting samples > 1 on standard(), display(), and 256B (block_log2 == 8) swizzle modes in Layout::new (crates/victory-formats/src/texture.rs:294-300) aligns multisampled layout validation with GFX10 AddrLib while keeping SW_64KB_Z_X and SW_64KB_R_X MSAA layouts accepted and breaking no supported pixel-access paths.
  • Minor non-blocking notes (P3): SW_4KB_R_X (mode 23) is still accepted for samples > 1 by the negative checks, and the new test covers the six base S/D modes (not the _S_T/_D_T/_S_X/_D_X variants directly).
  • Checks:
    • cargo test --locked -p victory-formats -- --test-threads=1: 47 passed, 0 failed, 5 ignored (including standard_and_display_swizzles_reject_multisampling).
    • cargo test --locked -p victory-hle --lib -- --test-threads=1 modules::xg::: 4 passed, 0 failed.
    • cargo clippy -p victory-formats -p victory-hle --all-targets --locked -- -D warnings (default and --all-features): clean.
    • cargo xtask policy: 191 files ok; rustfmt --edition 2024: clean on changed hunks.

Synthetic tests only; no game data used.

<!-- greyfinch-sync:Marvisak/VIctory:review:6080662660 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3385#pullrequestreview-6080662660). Originally posted by [fuzeofficlal](https://github.com/fuzeofficlal) on 2026-11-26T21:30:42Z. **Review:** APPROVED --- LGTM — verified against `origin/main` (`63bcca43`) on Windows x64. - Rejecting `samples > 1` on `standard()`, `display()`, and 256B (`block_log2 == 8`) swizzle modes in `Layout::new` (`crates/victory-formats/src/texture.rs:294-300`) aligns multisampled layout validation with GFX10 AddrLib while keeping `SW_64KB_Z_X` and `SW_64KB_R_X` MSAA layouts accepted and breaking no supported pixel-access paths. - **Minor non-blocking notes (P3)**: `SW_4KB_R_X` (mode 23) is still accepted for `samples > 1` by the negative checks, and the new test covers the six base `S`/`D` modes (not the `_S_T`/`_D_T`/`_S_X`/`_D_X` variants directly). - **Checks**: - `cargo test --locked -p victory-formats -- --test-threads=1`: 47 passed, 0 failed, 5 ignored (including `standard_and_display_swizzles_reject_multisampling`). - `cargo test --locked -p victory-hle --lib -- --test-threads=1 modules::xg::`: 4 passed, 0 failed. - `cargo clippy -p victory-formats -p victory-hle --all-targets --locked -- -D warnings` (default and `--all-features`): clean. - `cargo xtask policy`: 191 files ok; `rustfmt --edition 2024`: clean on changed hunks. Synthetic tests only; no game data used.
Jackster commented 2026-11-26 22:29:02 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by Jackster on 2026-11-26T22:29:02Z.


Windows 11, 63bcca4 + this PR:

  • cargo test -p victory-formats: 47 passed / 0 failed / 5 ignored.
  • texture::tests::standard_and_display_swizzles_reject_multisampling by name: 1 passed.
  • cargo clippy -p victory-formats --all-targets -- -D warnings: clean.

The test covers the six standard/display swizzles at 2, 4 and 8 samples and the two render controls (SW_64KB_Z_X, SW_64KB_R_X stay valid at 4 samples, and SW_64KB_R_X at one sample). No main-side control was run: unpatched main has no standard()/display() or block_log2 != 8 rejection, so those assertions cannot hold there by construction. Synthetic only. AI-assisted.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7204718433 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3385#issuecomment-7204718433). Originally posted by [Jackster](https://github.com/Jackster) on 2026-11-26T22:29:02Z. --- Windows 11, `63bcca4` + this PR: - `cargo test -p victory-formats`: 47 passed / 0 failed / 5 ignored. - `texture::tests::standard_and_display_swizzles_reject_multisampling` by name: 1 passed. - `cargo clippy -p victory-formats --all-targets -- -D warnings`: clean. The test covers the six standard/display swizzles at 2, 4 and 8 samples and the two render controls (`SW_64KB_Z_X`, `SW_64KB_R_X` stay valid at 4 samples, and `SW_64KB_R_X` at one sample). No main-side control was run: unpatched `main` has no `standard()`/`display()` or `block_log2 != 8` rejection, so those assertions cannot hold there by construction. Synthetic only. AI-assisted.
cloph-dsp commented 2026-11-27 01:07:56 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by cloph-dsp on 2026-11-27T01:07:56Z.


Independent Windows verification of PR #3385 (fix(formats): reject unsupported MSAA swizzles), head 58295957, merge base 940d32f.

  • cargo test --locked -p victory-formats --lib -- texture::tests::standard_and_display_swizzles_reject_multisampling --exact --test-threads=1 --quiet → test result: ok. 1 passed; 0 failed; 43 filtered out, exit 0.
  • git diff --check 940d32f HEAD → clean, exit 0.
  • Negative control: the test name is absent from origin/main at 940d32f (git grep exit 1). Only the named synthetic test was run; full crate suite not run here.

Windows, Rust 1.100.0/MSVC, worktree-local CARGO_TARGET_DIR, CARGO_BUILD_JOBS=2. AI-assisted (Hy4 flash). GPU/driver N/A (CPU parser test). No game data, assets, extracted shaders or DRM used.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7207037435 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3385#issuecomment-7207037435). Originally posted by [cloph-dsp](https://github.com/cloph-dsp) on 2026-11-27T01:07:56Z. --- Independent Windows verification of PR #3385 (`fix(formats): reject unsupported MSAA swizzles`), head `58295957`, merge base `940d32f`. - `cargo test --locked -p victory-formats --lib -- texture::tests::standard_and_display_swizzles_reject_multisampling --exact --test-threads=1 --quiet` → `test result: ok. 1 passed; 0 failed; 43 filtered out`, exit 0. - `git diff --check 940d32f HEAD` → clean, exit 0. - Negative control: the test name is absent from `origin/main` at `940d32f` (`git grep` exit 1). Only the named synthetic test was run; full crate suite not run here. Windows, Rust 1.100.0/MSVC, worktree-local `CARGO_TARGET_DIR`, `CARGO_BUILD_JOBS=2`. AI-assisted (Hy4 flash). GPU/driver N/A (CPU parser test). No game data, assets, extracted shaders or DRM used.
rezioliver-collab commented 2026-11-27 02:59:27 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by rezioliver-collab on 2026-11-27T02:59:27Z.


I checked the extended swizzles mentioned in review through the public constructor on an Apple M1. The fixture called Texture::new for all 32 swizzle codes at 0, 1, 2, 4 and 8 samples, using three formats (two with a separate stencil plane), two dimensions and three mip settings. That gave 2,880 synthetic descriptors per revision.

Compared with merge base 940d32f6, PR 58295957 newly rejected 324 descriptors, all in the 12 standard/display modes including the T and X variants. For all 657 descriptors accepted by both, total size, alignment, plane count and stencil offset matched exactly. Both rejected the remaining 1,899. Mode 23 still accepted a valid single-mip MSAA descriptor, consistent with the review observation.

AI-assisted with Codex.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7208605208 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/3385#issuecomment-7208605208). Originally posted by [rezioliver-collab](https://github.com/rezioliver-collab) on 2026-11-27T02:59:27Z. --- I checked the extended swizzles mentioned in review through the public constructor on an Apple M1. The fixture called `Texture::new` for all 32 swizzle codes at 0, 1, 2, 4 and 8 samples, using three formats (two with a separate stencil plane), two dimensions and three mip settings. That gave 2,880 synthetic descriptors per revision. Compared with merge base `940d32f6`, PR `58295957` newly rejected 324 descriptors, all in the 12 standard/display modes including the T and X variants. For all 657 descriptors accepted by both, total size, alignment, plane count and stencil offset matched exactly. Both rejected the remaining 1,899. Mode 23 still accepted a valid single-mip MSAA descriptor, consistent with the review observation. AI-assisted with Codex.
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/3385:upstream-pr/3385'
git switch 'upstream-pr/3385'

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