GPU: keep A8_UNORM out of the R8 typeless family #1390
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1390"
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 AnoHunted on 2026-11-24T17:41:15Z.
What
family()returns the typeless format at the head of a format's family (or theformat itself when it has none). Its table folded
DXGI_FORMAT65 (A8_UNORM)into the R8 typeless family (60) via the range
60..=65. DXGI's R8 typelessfamily is only
R8_UNORM/UINT/SNORM/SINT(61..=64);A8_UNORMhas notypeless family and is not a cast target of
R8_TYPELESS. This narrows therange to
60..=64, sofamily(65)now maps to itself.Why
When a view's format and its host resource's format fall in the same family,
the view is treated as a compatible typeless cast and its format is taken from
the resource. With
A8_UNORMfolded into the R8 family, anR8_*view of anA8_UNORMhost texture counted as same-family and was silently reinterpretedrather than refused. D3D12 does not allow casting
A8_UNORMto the R8 group(they are different typeless families), so such a view should be rejected.
Dropping 65 from the range restores that:
family(view) != family(own), andthe view is refused instead of quietly changing what is read.
Tested
Windows 11, NVIDIA GeForce RTX 5080, Rust 1.98.1.
cargo test -p victory-gpu -- --test-threads=1,mainvs this branch:The one extra test is
a8_unorm_is_not_in_the_r8_typeless_family, a pure tabletest (no device needed) asserting
family(60)==60,family(61..=64)==60,family(65)==65, and the 59/66 boundaries. The rest of thevictory-gpusuite,including its live D3D12 tests, ran on the RTX 5080 with no regression.
Not tested
No in-game reproduction: I do not have a title case that aliases an
A8_UNORMtexture through an
R8_*view, so this is a defensive fix pinned to the DXGItypeless-family table rather than an observed crash. Not tested on AMD.
No game files were used.
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T20:49:15Z.
Review: COMMENTED
Static review only: victory-gpu/victory-hle are Windows-only (D3D12/windows_sys/Win32) — nothing compiles or runs on macOS; this is source review plus the PR's own Windows tests.
A8_UNORM (DXGI 65) no longer folds into the R8 typeless family: family range corrected from 60..=65 to 60..=64, so an A8 texture is not treated as R8_TYPELESS-castable. The test pins the exact DXGI numbering (60-64 R8 family, 65 A8_UNORM standalone, 59/66 boundaries). Small, correct, well-tested.