vkback: A8_UNORM as A8_UNORM_KHR without view swizzle, as vkd3d-proton #29

Manually merged
github merged 2 commits from github-bot/gh-29 into gh-pr/29/base 2026-12-01 07:49:23 +00:00 AGit
Owner

@⁠Flezzonkeys on GitHub · 2026-11-30 22:31 UTC · original
Flezzonkeys:a8-unorm → main · +58 −25 · 10 files · 2 commits · merged 2026-12-01 07:49 UTC

What

DXGI 65 (A8_UNORM) is made as VK_FORMAT_A8_UNORM_KHR and its views take no swizzle, as vkd3d-proton does.

Why

vkback made A8 as R8_UNORM with the (0,0,0,R) view swizzle of vkd3d-proton's R8 emulation. As a render target, R8 keeps red and drops the alpha the pixel shader exports. The UI draws its text through full-screen A8 masks (3840x2160) that are render targets, so those masks stayed empty and the text was masked out: the controls menu's left list and the tab names between LB/RB, and the notoriety HUD. Other text was fine.

Reference (rule 12): vkd3d-proton libs/vkd3d/utils.c:106 maps DXGI_FORMAT_A8_UNORM to VK_FORMAT_A8_UNORM_KHR. resource.c vkd3d_set_view_swizzle_for_format applies (0,0,0,R) only when vk_format != VK_FORMAT_A8_UNORM_KHR. Carried over: the format and the dropped swizzle. Left out: vkd3d-proton's R8 fallback for devices without VK_KHR_maintenance5 (see below).

Changes

  • fmt.rs: 65 -> A8_UNORM_KHR.
  • viewdesc.rs components: no A8 swizzle (test updated).
  • frame/vkformat.rs: the 65 row names A8_UNORM_KHR (one fact, rule 3).
  • vk-texdiff: both sides compare A8 as A8_UNORM_KHR (the R8 fold is gone).
  • clear.rs, pixprobe.rs, present/shot.rs: the new format in clear values, probe decode and texel size.
  • docs/learnings/a8-unorm.md (with two corrections: the stencil suspect, and format without dropping the swizzle made all text vanish), index row, parity.md glyphs line.

Verification

  • cargo test -p vkback (148 lib + policy 6), cargo test in greenfield/frame, cargo xtask policy: pass.
  • In game (RX 9070 XT, RADV, CachyOS, Proton GE): an earlier version of this fix (same format change, but keeping the R8 swizzle and composing an A8->R8 remap on sampled views) brought the missing text back in the controls menu, the tab names and the notoriety HUD, with the rest of the text unchanged. This branch replaces that remap with vkd3d-proton's form (no swizzle), which reads the same values; this exact branch has not been run in game yet.
  • Not done: the Vulkan validation run (rule 30) and before/after screenshots (rule 27). I could not do them this time; happy to add them if needed, or leave them to a maintainer run before merging.
  • No storage views of A8 images were seen in ~70 minutes of play (RADV has no storage support for A8_UNORM_KHR); the earlier version of this fix logged them and counted 0.

Found outside this change (rule 29)

  • dev.rs:80-94: VK_KHR_maintenance5 is enabled only when the device has it, and nothing fails when it is missing. A8_UNORM_KHR now depends on it, so a device without it would create invalid images without a log line.
**@⁠Flezzonkeys** on GitHub · 2026-11-30 22:31 UTC · [original](https://github.com/vktory6/VKtory/pull/29) `Flezzonkeys:a8-unorm` → `main` · +58 −25 · 10 files · 2 commits · merged 2026-12-01 07:49 UTC ## What DXGI 65 (A8_UNORM) is made as `VK_FORMAT_A8_UNORM_KHR` and its views take no swizzle, as vkd3d-proton does. ## Why vkback made A8 as R8_UNORM with the (0,0,0,R) view swizzle of vkd3d-proton's R8 emulation. As a render target, R8 keeps red and drops the alpha the pixel shader exports. The UI draws its text through full-screen A8 masks (3840x2160) that are render targets, so those masks stayed empty and the text was masked out: the controls menu's left list and the tab names between LB/RB, and the notoriety HUD. Other text was fine. Reference (rule 12): vkd3d-proton `libs/vkd3d/utils.c:106` maps `DXGI_FORMAT_A8_UNORM` to `VK_FORMAT_A8_UNORM_KHR`. `resource.c` `vkd3d_set_view_swizzle_for_format` applies (0,0,0,R) only when `vk_format != VK_FORMAT_A8_UNORM_KHR`. Carried over: the format and the dropped swizzle. Left out: vkd3d-proton's R8 fallback for devices without VK_KHR_maintenance5 (see below). ## Changes - `fmt.rs`: 65 -> `A8_UNORM_KHR`. - `viewdesc.rs` `components`: no A8 swizzle (test updated). - `frame/vkformat.rs`: the 65 row names A8_UNORM_KHR (one fact, rule 3). - `vk-texdiff`: both sides compare A8 as A8_UNORM_KHR (the R8 fold is gone). - `clear.rs`, `pixprobe.rs`, `present/shot.rs`: the new format in clear values, probe decode and texel size. - `docs/learnings/a8-unorm.md` (with two corrections: the stencil suspect, and format without dropping the swizzle made all text vanish), index row, `parity.md` glyphs line. ## Verification - `cargo test -p vkback` (148 lib + policy 6), `cargo test` in `greenfield/frame`, `cargo xtask policy`: pass. - In game (RX 9070 XT, RADV, CachyOS, Proton GE): an earlier version of this fix (same format change, but keeping the R8 swizzle and composing an A8->R8 remap on sampled views) brought the missing text back in the controls menu, the tab names and the notoriety HUD, with the rest of the text unchanged. This branch replaces that remap with vkd3d-proton's form (no swizzle), which reads the same values; this exact branch has not been run in game yet. - **Not done:** the Vulkan validation run (rule 30) and before/after screenshots (rule 27). I could not do them this time; happy to add them if needed, or leave them to a maintainer run before merging. - No storage views of A8 images were seen in ~70 minutes of play (RADV has no storage support for A8_UNORM_KHR); the earlier version of this fix logged them and counted 0. ## Found outside this change (rule 29) - `dev.rs:80-94`: VK_KHR_maintenance5 is enabled only when the device has it, and nothing fails when it is missing. A8_UNORM_KHR now depends on it, so a device without it would create invalid images without a log line.
DXGI 65 (A8_UNORM) was made as R8_UNORM with the (0,0,0,R) view swizzle
of vkd3d-proton's R8 emulation. As a render target, R8 keeps red and
drops the alpha a pixel shader exports: the UI's full-screen A8 masks
stayed empty and the text drawn through them vanished (controls menu
lists and tab names, the notoriety HUD).

Now A8 is VK_FORMAT_A8_UNORM_KHR (VK_KHR_maintenance5, enabled by
dev.rs when present) and its views take no swizzle, as vkd3d-proton
(utils.c:106; resource.c vkd3d_set_view_swizzle_for_format applies
(0,0,0,R) only when vk_format != VK_FORMAT_A8_UNORM_KHR). Left out: the
R8 fallback vkd3d-proton keeps for devices without maintenance5.

frame's vkformat row and vk-texdiff follow; clear values, pixprobe and
shot texel sizes know the format. Learning: docs/learnings/a8-unorm.md.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 22:33:19 +00:00
The view-format comparison excused A8 as R8 vs A8_KHR; both sides are A8_UNORM_KHR now, so the exception can only
hide a real difference (AGENTS.md rule 33). The learning said RADV has no A8 storage; vulkaninfo lists it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot changed target branch from main to gh-pr/29/base 2026-12-01 07:49:20 +00:00
github manually merged commit db6fa45a73 into gh-pr/29/base 2026-12-01 07:49:23 +00:00
Author
Owner

@⁠vktory6 on GitHub · 2026-12-01 07:49 UTC · original

Merged, thanks! One small commit of mine on top (db6fa45):

  • vk-texdiff: no longer has the 65 && R8_UNORM exception. With this change the format is A8 on both sides, so the exception would only hide a real mismatch.
  • docs/learnings/a8-unorm.md: corrected. RADV lists A8_UNORM_KHR with storage support in both tilings on the reference card.

Check on the reference system (RX 9070 XT): tests and policy pass, and the house-scene validation run shows no new error.

**@⁠vktory6** on GitHub · 2026-12-01 07:49 UTC · [original](https://github.com/vktory6/VKtory/pull/29#issuecomment-7304516838) Merged, thanks! One small commit of mine on top (db6fa45): - **vk-texdiff:** no longer has the `65 && R8_UNORM` exception. With this change the format is A8 on both sides, so the exception would only hide a real mismatch. - **docs/learnings/a8-unorm.md:** corrected. RADV lists A8_UNORM_KHR with storage support in both tilings on the reference card. Check on the reference system (RX 9070 XT): tests and policy pass, and the house-scene validation run shows no new error.
This discussion has been locked. Commenting is limited to contributors.
No description provided.