HLE: XGSuggestSwizzleMode TEXTURE_1D branch never reached by any test #868
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory#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?
@kss306 on GitHub · 2026-11-24 13:00 UTC · original
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.
@MichaelSmithAI on GitHub · 2026-11-24 13:06 UTC · original
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
@pushkarreddyy on GitHub · 2026-11-24 13:30 UTC · original
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 (
@pushkarreddyy on GitHub · 2026-11-24 13:31 UTC · original · edited 2026-11-24 14:22 UTC
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
@pushkarreddyy on GitHub · 2026-11-24 14:37 UTC · original
Pull request is now open for review: #975.