Reject multisampled linear texture layouts #629

Manually merged
github merged 1 commit from gh-pr/629/head into gh-pr/629/base 2026-11-26 04:10:39 +00:00
Owner

@⁠AlanQiang0418 on GitHub · 2026-11-24 05:55 UTC · original
AlanQiang0418:codex/reject-linear-msaa-layouts → main · +22 −1 · 1 files · 1 commits · merged 2026-11-25 00:20 UTC

Layout::new accepted a 256 × 256 linear RGBA8 surface at 2× MSAA and returned an addressable 262,144-byte layout, the same size as at 1×. The linear path calculates row sizes and offsets for a single sample. AMD’s GFX10 address library rejects this combination during swizzle validation. AMD reference implementation

This change rejects the descriptor with Error::Invalid before constructing the layout. The regression test covers 2×, 4× and 8×, checks that the 1× linear texture stays addressable, and checks the allocation size for each sample count with SW_64KB_R_X.

The regression test failed on d2a4bae and passed with the fix. cargo test --locked -p victory-formats on Windows passed 21 tests. The three tests that require external data were skipped. The staged asset-policy check passed. Testing used synthetic descriptors.

**@⁠AlanQiang0418** on GitHub · 2026-11-24 05:55 UTC · [original](https://github.com/Marvisak/VIctory/pull/629) `AlanQiang0418:codex/reject-linear-msaa-layouts` → `main` · +22 −1 · 1 files · 1 commits · merged 2026-11-25 00:20 UTC `Layout::new` accepted a 256 × 256 linear RGBA8 surface at 2× MSAA and returned an addressable 262,144-byte layout, the same size as at 1×. The linear path calculates row sizes and offsets for a single sample. AMD’s GFX10 address library rejects this combination during swizzle validation. [AMD reference implementation](https://github.com/GPUOpen-Drivers/pal/blob/dev/src/core/imported/addrlib/src/gfx10/gfx10addrlib.cpp#L2593-L2601) This change rejects the descriptor with `Error::Invalid` before constructing the layout. The regression test covers 2×, 4× and 8×, checks that the 1× linear texture stays addressable, and checks the allocation size for each sample count with `SW_64KB_R_X`. The regression test failed on `d2a4bae` and passed with the fix. `cargo test --locked -p victory-formats` on Windows passed 21 tests. The three tests that require external data were skipped. The staged asset-policy check passed. Testing used synthetic descriptors.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:10:37 +00:00
github manually merged commit 350f91c23a into gh-pr/629/base 2026-11-26 04:10:39 +00:00
Author
Owner

@⁠geiyiliyabumo on GitHub · 2026-11-24 10:52 UTC · original

Independent verification & code review on Windows 11 Pro (build 26100, Rust 1.98.1), cleanly merged onto main (ffe310e):

  • cargo xtask policy: PASS (154 files ok)
  • cargo clippy -p victory-formats --all-targets --locked -- -D warnings: PASS
  • cargo test -p victory-formats --locked: 24 passed, 0 failed, 4 ignored (including new texture::tests::linear_layouts_require_one_sample)

Diff review (crates/victory-formats/src/texture.rs): minimal, exact, and well-tested — rejecting d.samples > 1 for Swizzle::LINEAR prevents under-sized linear layouts while preserving tiled MSAA (SW_64KB_R_X etc.).

AI-assisted; synthetic tests only, no game files.

**@⁠geiyiliyabumo** on GitHub · 2026-11-24 10:52 UTC · [original](https://github.com/Marvisak/VIctory/pull/629#issuecomment-7129369699) Independent verification & code review on Windows 11 Pro (build 26100, Rust `1.98.1`), cleanly merged onto `main` (`ffe310e`): - `cargo xtask policy`: PASS (`154 files ok`) - `cargo clippy -p victory-formats --all-targets --locked -- -D warnings`: PASS - `cargo test -p victory-formats --locked`: **24 passed, 0 failed, 4 ignored** (including new `texture::tests::linear_layouts_require_one_sample`) Diff review (`crates/victory-formats/src/texture.rs`): minimal, exact, and well-tested — rejecting `d.samples > 1` for `Swizzle::LINEAR` prevents under-sized linear layouts while preserving tiled MSAA (`SW_64KB_R_X` etc.). *AI-assisted; synthetic tests only, no game files.*
Author
Owner

@⁠molodayamama on GitHub · 2026-11-24 14:08 UTC · original

Independent Windows check of 350f91c23a9402b2a556a84c208a80030910ae3f (Windows 10 22H2 19045, Rust 1.98.1, MSVC x64).

  • cargo test --locked -p victory-formats --lib linear_layouts_require_one_sample -- --nocapture: 1 passed.

The new fixture passed for rejecting multisampled linear layouts. This checks the texture descriptor validation before allocation or GPU work.

Only source-built synthetic fixtures were used. AI-assisted verification.

**@⁠molodayamama** on GitHub · 2026-11-24 14:08 UTC · [original](https://github.com/Marvisak/VIctory/pull/629#issuecomment-7133907433) Independent Windows check of `350f91c23a9402b2a556a84c208a80030910ae3f` (Windows 10 22H2 19045, Rust 1.98.1, MSVC x64). - `cargo test --locked -p victory-formats --lib linear_layouts_require_one_sample -- --nocapture`: 1 passed. The new fixture passed for rejecting multisampled linear layouts. This checks the texture descriptor validation before allocation or GPU work. Only source-built synthetic fixtures were used. AI-assisted verification.
Author
Owner

@⁠Yoshi-233 on GitHub · 2026-11-25 02:47 UTC · original

I checked the backport on native x86-64 Linux (Ubuntu 24.04.5, Rust 1.98.1). On Zettrox/ztrx@90b529f, the new test failed before the fix: a 256×256 RGBA8 linear descriptor returned 262,144 bytes at 1×, 2×, 4× and 8×. Your patch applied unchanged. Afterwards only 1× succeeded for linear; the tiled SW_64KB_R_X control still returned 262,144 / 524,288 / 1,048,576 / 2,097,152 bytes. All eight outcomes matched upstream 940d32f.

The downstream victory-formats library suite passed 25 tests after the backport, with four repository-marked tests ignored. This was a CPU-only descriptor check with synthetic inputs.

**@⁠Yoshi-233** on GitHub · 2026-11-25 02:47 UTC · [original](https://github.com/Marvisak/VIctory/pull/629#issuecomment-7151189202) I checked the backport on native x86-64 Linux (Ubuntu 24.04.5, Rust 1.98.1). On `Zettrox/ztrx@90b529f`, the new test failed before the fix: a 256×256 RGBA8 linear descriptor returned 262,144 bytes at 1×, 2×, 4× and 8×. Your patch applied unchanged. Afterwards only 1× succeeded for linear; the tiled `SW_64KB_R_X` control still returned 262,144 / 524,288 / 1,048,576 / 2,097,152 bytes. All eight outcomes matched upstream `940d32f`. The downstream `victory-formats` library suite passed 25 tests after the backport, with four repository-marked tests ignored. This was a CPU-only descriptor check with synthetic inputs.
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!629
No description provided.