HLE: XGSuggestSwizzleMode TEXTURE_1D branch never reached by any test #868
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from Marvisak/VIctory. Originally posted by kss306 on 2026-11-24T13:00:01Z.
suggestions_follow_the_useincrates/victory-hle/src/modules/xg.rstests three of the four branches ofXGSuggestSwizzleModebut never exercises theTEXTURE_1Dbranch, which is the first check in the helper.Implementation evidence
xg.rs,fn suggested(), line 58:XGSuggestSwizzleModereturnsSWIZZLED | suggested(desc).0. For a 1D texture this is0x100 | 0 = 0x100.Missing test
fn suggestions_follow_the_use()(line 657) constructs its descriptor withdesc(256, 256, 1, 98, 0)which always setsdimension: 3(TEXTURE_2D). The test then variesflagsto reach the depth-stencil and render-target branches and the else-branch, but never changesdimensiontoTEXTURE_1D (= 2).The three covered branches produce
0x118,0x11b, and0x105. TheTEXTURE_1Dbranch producing0x100is never asserted.Why it matters
According to the D3D12 / Xbox GDK specification, 1D textures must use row-major (linear) layout — there is no tiled 1D swizzle mode. If the branch were accidentally removed or its condition changed to something else (e.g.,
TEXTURE_3D), no test would catch the regression, and titles that queryXGSuggestSwizzleModefor a 1D texture would receive a wrong swizzle mode.Suggested fix
Add a single assertion to
suggestions_follow_the_use:cargo test -p victory-hle— the new assertion passes, all existing assertions still pass. No GPU or game data needed.AI-assisted: found with Kiro (Claude) and independently confirmed by five separate analysis passes without cross-contamination; no hardware run, no game data.
Imported from Marvisak/VIctory. Originally posted by MichaelSmithAI on 2026-11-24T13:06:34Z.
Melissa added a regression on
ffe310ethat passes the output of XGSuggestSwizzleMode into XGCreateTextureComputer. For a 256-texel 1D R16_FLOAT texture, the selector returned 0x100 both with and without ALLOW_RENDER_TARGET. In each case the resulting address computer placed texels 3 and 255 at byte offsets 6 and 510, as expected for two bytes per texel.All five XG tests passed under Wine. This verifies that VIctory's selector and address computer agree; an independent console layout measurement remains open. Test-only commit
Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T13:30:42Z.
Claiming this issue.
Technical Analysis
In crates/victory-hle/src/modules/xg.rs:
suggested(desc: &ResourceDesc) -> Swizzle checks:
ust if desc.dimension == TEXTURE_1D { Swizzle::LINEAR } else if desc.flags & ALLOW_DEPTH_STENCIL != 0 { ...XGSuggestSwizzleMode returns SWIZZLED | suggested(desc).0. For 1D textures (desc.dimension == TEXTURE_1D == 2), the specification mandates row-major linear swizzle (
Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T13:31:56Z.
Verified Implementation Ready on Fork
The regression test coverage for XGSuggestSwizzleMode TEXTURE_1D is implemented and available on my fork:
ffe310e)Compare: https://github.com/Marvisak/VIctory/compare/main...pushkarreddyy:VIctory:test/hle-swizzle-1d-coverage
Verification
Imported from Marvisak/VIctory. Originally posted by pushkarreddyy on 2026-11-24T14:37:38Z.
Pull request is now open for review: #975.