Decode packed 16-bit BGR surfaces in diagnostic captures #7

Open
Yoshi-233 wants to merge 1 commit from upstream-pr/7 into main
Yoshi-233 commented 2026-11-26 07:53:22 +00:00 (Migrated from git.gtahub.st)

Imported from codec-d/cool_fox. Originally posted by Yoshi-233 on 2026-11-26T07:53:22Z.


@⁠Yoshi-233 on GitHub · 2026-11-26 07:50 UTC · original
Yoshi-233:fix/capture-packed-bgr → main · +50 −4 · 1 files · 1 commits · open

The diagnostic target dump silently skips DXGI formats 85 (B5G6R5), 86 (B5G5R5A1), and 115 (B4G4R4A4) because capture::to_rgba returns None. Convert each packed little-endian word into the RGB channels used by the PNG writer and respect the readback row pitch. This affects captures of surfaces in these actual formats. It doesn't change the runtime's render-target substitutions.

I ported my previous fix and test and ran the comparison on this fork's f4b48ad and the patched source. A Linux CPU harness built the actual conversion and PNG writer from each revision. Base skipped all nine fixtures. The patch matched an independent RGBA reference across all 65,536 words for each format, padded rows and a one-pixel target. Reading the nine PNGs back independently with Pillow matched all 49,539 RGB pixels. All three capture-module tests passed in the harness.

Rust 1.98.1 also passed cargo check --locked --target x86_64-pc-windows-gnu -p victory-gpu --all-targets --features diagnostics. These tests used generated buffers; I did not run this fork on a Windows GPU.

<!-- greyfinch-sync:codec-d/cool_fox:issue:8088 --> Imported from [codec-d/cool_fox](https://git.gtahub.st/github/codec-d--cool_fox/pulls/7). Originally posted by [Yoshi-233](https://github.com/Yoshi-233) on 2026-11-26T07:53:22Z. --- **@⁠Yoshi-233** on GitHub · 2026-11-26 07:50 UTC · [original](https://github.com/codec-d/cool_fox/pull/7) `Yoshi-233:fix/capture-packed-bgr` → `main` · +50 −4 · 1 files · 1 commits · open The diagnostic target dump silently skips DXGI formats 85 (B5G6R5), 86 (B5G5R5A1), and 115 (B4G4R4A4) because `capture::to_rgba` returns `None`. Convert each packed little-endian word into the RGB channels used by the PNG writer and respect the readback row pitch. This affects captures of surfaces in these actual formats. It doesn't change the runtime's render-target substitutions. I ported my [previous fix and test](https://github.com/fxceless/victory-fork/pull/910) and ran the comparison on this fork's `f4b48ad` and the patched source. A Linux CPU harness built the actual conversion and PNG writer from each revision. Base skipped all nine fixtures. The patch matched an independent RGBA reference across all 65,536 words for each format, padded rows and a one-pixel target. Reading the nine PNGs back independently with Pillow matched all 49,539 RGB pixels. All three capture-module tests passed in the harness. Rust 1.98.1 also passed `cargo check --locked --target x86_64-pc-windows-gnu -p victory-gpu --all-targets --features diagnostics`. These tests used generated buffers; I did not run this fork on a Windows GPU.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/7:upstream-pr/7'
git switch 'upstream-pr/7'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/7'
git switch 'upstream-pr/7'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/7'
git switch 'upstream-pr/7'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/7'
git switch 'main'
git merge --squash 'upstream-pr/7'
git switch 'main'
git merge --ff-only 'upstream-pr/7'
git switch 'main'
git merge 'upstream-pr/7'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
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.

Reference
codec-d/cool_fox!7
No description provided.