Capture: R16G16B16A16_UNORM targets are integers, format 89 is 10:10:10:2 #372

Merged
marquezinii merged 1 commit from upstream-pr/372 into main 2026-11-24 08:06:49 +00:00
marquezinii commented 2026-11-24 02:43:05 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by marquezinii on 2026-11-24T02:43:05Z.


Two DXGI formats came out of VICTORY_CAPTURE / VICTORY_DUMP_TARGETS dumps wrong:

  • 9..=11 were all decoded as half floats, but 11 is R16G16B16A16_UNORM. A UNORM 0x8000 read as half -0 and 0xffff as -inf (then dropped as not finite), so such targets dumped mostly black. 11..=14 (UNORM, UINT, SNORM, SINT) now read as 16-bit integers, as the R16G16_* arm (35..=38) already does.
  • 87..=93 were all swapped as 8-bit BGRA, but 89 is R10G10B10_XR_BIAS_A2_UNORM. It now goes through the 10:10:10:2 arm with 23..=25.

Tested with a new unit test on to_rgba (cargo test -p victory-gpu --features diagnostics --lib capture): a UNORM16 pixel with red 0x8000 and green 0x4000 gave [0, 255, 0, 255] before and gives [255, 127, 0, 255] now; format 89 and plain BGRA8 are checked too. Clippy with diagnostics is clean. Not tried on a real capture.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6573422480 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/372). Originally posted by [marquezinii](https://github.com/marquezinii) on 2026-11-24T02:43:05Z. --- Two DXGI formats came out of `VICTORY_CAPTURE` / `VICTORY_DUMP_TARGETS` dumps wrong: - 9..=11 were all decoded as half floats, but 11 is `R16G16B16A16_UNORM`. A UNORM 0x8000 read as half -0 and 0xffff as -inf (then dropped as not finite), so such targets dumped mostly black. 11..=14 (UNORM, UINT, SNORM, SINT) now read as 16-bit integers, as the `R16G16_*` arm (35..=38) already does. - 87..=93 were all swapped as 8-bit BGRA, but 89 is `R10G10B10_XR_BIAS_A2_UNORM`. It now goes through the 10:10:10:2 arm with 23..=25. Tested with a new unit test on `to_rgba` (`cargo test -p victory-gpu --features diagnostics --lib capture`): a UNORM16 pixel with red 0x8000 and green 0x4000 gave `[0, 255, 0, 255]` before and gives `[255, 127, 0, 255]` now; format 89 and plain BGRA8 are checked too. Clippy with `diagnostics` is clean. Not tried on a real capture.
jeremygold02 commented 2026-11-24 06:55:38 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-24T04:08:19Z.


Thanks @marquezinii for correcting these capture format cases. I tested head 0f369d660c9e5ace8482f2f9cc5572c9805e9416 with:

cargo test --locked -p victory-gpu --features diagnostics --lib unorm16_and_xr_bias_targets_decode_as_their_formats -- --test-threads=1

Result: 1 passed, 0 failed (46 filtered out). The synthetic to_rgba cases check R16G16B16A16_UNORM, format 89 as 10:10:10:2, and ordinary BGRA8 output. This validates the CPU decoder; it does not exercise a live GPU capture.

<!-- greyfinch-sync:Marvisak/VIctory:comment:7121741363 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/372#issuecomment-7121741363). Originally posted by [jeremygold02](https://github.com/jeremygold02) on 2026-11-24T04:08:19Z. --- Thanks @marquezinii for correcting these capture format cases. I tested head `0f369d660c9e5ace8482f2f9cc5572c9805e9416` with: ``` cargo test --locked -p victory-gpu --features diagnostics --lib unorm16_and_xr_bias_targets_decode_as_their_formats -- --test-threads=1 ``` Result: 1 passed, 0 failed (46 filtered out). The synthetic `to_rgba` cases check R16G16B16A16_UNORM, format 89 as 10:10:10:2, and ordinary BGRA8 output. This validates the CPU decoder; it does not exercise a live GPU capture.
mercuryVM commented 2026-11-24 08:02:13 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T07:47:31Z.

Review: APPROVED


Tested 0f369d6 on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (264 passed, 0 failed), and cargo test -p victory-gpu --features diagnostics --lib capture passes (2).

  • The DXGI numbers match: 9 is R16G16B16A16_TYPELESS, 10 _FLOAT, 11 _UNORM, 12 _UINT, 13 _SNORM and 14 _SINT. Reading UNORM as half floats was wrong, as your 0x8000 → -0 example shows. 89 is R10G10B10_XR_BIAS_A2_UNORM, which is 10:10:10:2 and not BGRA8.
  • Nit: 13 and 14 are signed, so reading them as u16 turns negative values into large positive ones, and those then dominate whatever normalization to_rgba applies. Reading those two as i16 would be more faithful. It is a debug dump either way.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6035461436 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/372#pullrequestreview-6035461436). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T07:47:31Z. **Review:** APPROVED --- Tested 0f369d6 on Windows 11, RTX 5070, MSVC: `cargo test --workspace --no-fail-fast` passes (264 passed, 0 failed), and `cargo test -p victory-gpu --features diagnostics --lib capture` passes (2). - The DXGI numbers match: 9 is `R16G16B16A16_TYPELESS`, 10 `_FLOAT`, 11 `_UNORM`, 12 `_UINT`, 13 `_SNORM` and 14 `_SINT`. Reading UNORM as half floats was wrong, as your 0x8000 → -0 example shows. 89 is `R10G10B10_XR_BIAS_A2_UNORM`, which is 10:10:10:2 and not BGRA8. - Nit: 13 and 14 are signed, so reading them as `u16` turns negative values into large positive ones, and those then dominate whatever normalization `to_rgba` applies. Reading those two as `i16` would be more faithful. It is a debug dump either way. AI-assisted (Claude Code).
upstream-sync closed this pull request 2026-11-24 09:05:25 +00:00
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
Marvisak/VIctory!372
No description provided.