BCPack: BC7 channel rotation is applied in every mode, not just 4 and 5 (wrong-coloured 4x4 blocks on textures) #411

Open
opened 2026-11-27 01:32:57 +00:00 by github-bot · 0 comments
Owner

@⁠Jesper-Andersson on GitHub · 2026-11-27 01:14 UTC · original

Environment

  • Repo: avatarmanz/VIctory-7900XTX @ 014d52d (main at the time of the runs), plus #203 (DLSS) and pr0vId3nce/VIctory-NVIDIA's own-bytes pool (67a50c6, 835d4e8) in the test build
  • Build: diagnostics; profile: Series S with DLSS; ray tracing off
  • GPU: NVIDIA GeForce RTX 2070 SUPER 8 GB, driver 621.14
  • CPU / RAM / OS: Ryzen 7 5800X / 32 GB / Windows 11 Insider 26320
  • Command: victory run <title> --execute --console series-s with scripts\play.ps1's settings plus VICTORY_CARD_BUFFERS_MIN_KB=64, VICTORY_CARD_BUFFERS_MB=1024, VICTORY_RESIDENCY=1, VICTORY_WIDE_MERGE=1, VICTORY_WINDOW_KB=1024, VICTORY_SUBMIT_FRAMES=2, VICTORY_CARD_ROOM_FOR_TARGETS_MB=1280

What happens

Indoors early in the game, the clothing of the characters is covered in a mosaic of small square blocks in the wrong colours: each block looks like a plausible piece of texture, but neighbouring blocks don't match. Reproducible on this build.

crates/victory-formats/src/bcpack.rs: bc7_precision() (line 749) and bc7_pack() (line 855) read ctrl >> 3 & 3 as a channel rotation for every BC7 mode. Only modes 4 and 5 have a rotation field. For the other modes those bits rotate channels that have no rotation: modes 0, 1 and 3 with rotation 1 panic on a shift (red's precision becomes 0), modes 0-3 with rotation 2 or 3 drop a colour channel, and modes 6 and 7 skip red's p-bit and pack the endpoints out of order. That gives wrong colours per 4x4 block.

Narrowed down

Same build and settings, one change, one run each:

main's bc7_precision rotation only in modes 4 and 5
clothing block mosaic normal
median frame in the world 121 ms 128 ms

Marvisak/VIctory#3111 (by RVZO6, open) has this fix with a regression test that panics on main without it. fxceless/victory-fork (06702fe), ExoCalibra/victory-exo (c1ce2fad) and pr0vId3nce/VIctory-NVIDIA (41791231, via Marvisak#3386) carry it. A PR porting #3111 follows.

Log

No log line names it: the decode doesn't fail, it decodes the wrong colours.

Not checked

AMD; Series X; a build without the own-bytes pool (the fix is in the format decoder, which the pool doesn't touch).

AI use

Code reading and write-up with AI assistance (Claude Code); the runs are my own.

**@⁠Jesper-Andersson** on GitHub · 2026-11-27 01:14 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/411) ## Environment - Repo: `avatarmanz/VIctory-7900XTX` @ `014d52d` (main at the time of the runs), plus #203 (DLSS) and pr0vId3nce/VIctory-NVIDIA's own-bytes pool (`67a50c6`, `835d4e8`) in the test build - Build: diagnostics; profile: Series S with DLSS; ray tracing off - GPU: NVIDIA GeForce RTX 2070 SUPER 8 GB, driver 621.14 - CPU / RAM / OS: Ryzen 7 5800X / 32 GB / Windows 11 Insider 26320 - Command: `victory run <title> --execute --console series-s` with `scripts\play.ps1`'s settings plus `VICTORY_CARD_BUFFERS_MIN_KB=64`, `VICTORY_CARD_BUFFERS_MB=1024`, `VICTORY_RESIDENCY=1`, `VICTORY_WIDE_MERGE=1`, `VICTORY_WINDOW_KB=1024`, `VICTORY_SUBMIT_FRAMES=2`, `VICTORY_CARD_ROOM_FOR_TARGETS_MB=1280` ## What happens Indoors early in the game, the clothing of the characters is covered in a mosaic of small square blocks in the wrong colours: each block looks like a plausible piece of texture, but neighbouring blocks don't match. Reproducible on this build. `crates/victory-formats/src/bcpack.rs`: `bc7_precision()` (line 749) and `bc7_pack()` (line 855) read `ctrl >> 3 & 3` as a channel rotation for every BC7 mode. Only modes 4 and 5 have a rotation field. For the other modes those bits rotate channels that have no rotation: modes 0, 1 and 3 with rotation 1 panic on a shift (red's precision becomes 0), modes 0-3 with rotation 2 or 3 drop a colour channel, and modes 6 and 7 skip red's p-bit and pack the endpoints out of order. That gives wrong colours per 4x4 block. ## Narrowed down Same build and settings, one change, one run each: | | main's `bc7_precision` | rotation only in modes 4 and 5 | |---|---|---| | clothing | block mosaic | normal | | median frame in the world | 121 ms | 128 ms | Marvisak/VIctory#3111 (by RVZO6, open) has this fix with a regression test that panics on main without it. fxceless/victory-fork (`06702fe`), ExoCalibra/victory-exo (`c1ce2fad`) and pr0vId3nce/VIctory-NVIDIA (`41791231`, via Marvisak#3386) carry it. A PR porting #3111 follows. ## Log No log line names it: the decode doesn't fail, it decodes the wrong colours. ## Not checked AMD; Series X; a build without the own-bytes pool (the fix is in the format decoder, which the pool doesn't touch). ## AI use Code reading and write-up with AI assistance (Claude Code); the runs are my own.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-27 01:32:57 +00:00
This discussion has been locked. Commenting is limited to contributors.
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/avatarmanz--VIctory-7900XTX#411
No description provided.