feat(vk): the CPU texture decoders are ported ones (texdecode), and suyu's two texture sources leave the build #2307

Merged
HumanBean merged 3 commits from TrashPanda/Longshot:feat/texdecode-ported-cpu into main 2026-11-23 15:58:05 +00:00
Contributor

Summary

When the renderer decodes a texture on the CPU (the block-linear unswizzle and swizzle, and ASTC), it called suyu's decoders from gpu/third_party/suyu/video_core/textures/. suyu's ASTC decoder is wrong on some legal blocks. This swaps it for a decoder and a block-linear swizzle ported from ocarina-recomp (MIT), in gpu/vk/texdecode/, and drops suyu's decoders.cpp and astc.cpp from the build. There is no switch: the port is the CPU path.

The fault, and how to see it on main. In a legal multi-partition ASTC block, the colour endpoints are a sequence of values in groups of 5 (trits) or 3 (quints) whose high code bits are missing when the last group is not full, and the specification reads the missing bits as zero. suyu copies the spare bits after the sequence into the buffer it decodes and reads them as those code bits, so a partial last group can unquantise to other values and one partition's endpoints move. Only blocks with a partial last group, nonzero spare bits and more than 8 colour values are affected (about 6% of such random blocks go wrong); an encoder that zeroes the spare bits hides it. tests/test_texdecode_astc_partitions.py holds 8 such blocks and 3 controls with ARM's astcenc 6.0.0 answers and passes with the port. python -I -B tests/test_texdecode_astc_partitions.py --decoder suyu (not run by run_all.py) builds suyu's astc.cpp alone and shows the fault on main's decoder: 8 of the 11 blocks more than one step from astcenc, the largest difference 117 of 255 in a channel; the 3 controls are one step off (suyu's rounding). Two lines in suyu's file would fix it, and gpu/third_party is not edited.

What changed, in four commits:

  1. gpu/vk/texdecode/: the library (ASTC LDR 4x4 to 12x12, linear and sRGB modes; block-linear swizzle and deswizzle), its PROVENANCE.md and LICENSE-MIT, the vector generator and the two library tests. The ASTC decode takes an error colour (default: the specification's opaque magenta, which astcenc and the ported original write). The ASTC test harnesses receive their inputs through standard input, so input paths work with Unicode.
  2. The fault test above.
  3. vk_texture.cpp calls the library at the four CPU sites; nx2/build.py builds it and no longer builds suyu's two sources; every check that assumed suyu's decoder is updated, none weakened; two stale doc lines that said suyu's texture decoders were compiled are corrected.

The ASTC decode runs on the calling thread, as before; the unswizzle keeps its strip threads.

What does not change. The default route for 2D ASTC is still the GPU decoder (Eden's compute shader), and big block-linear textures still use the GPU unswizzle. The CPU decoder runs when the GPU path declines (3D ASTC, no VK_KHR_push_descriptor, layout or stride limits, out of staging memory) and with RX_VK_ASTC_CPU=1 (its switch row now says so). The GPU decoder stays because CPU-only decode measured 3 to 8 times worse hitches and 4 times the VRAM (earlier branch, below). No shader is changed.

An illegal ASTC block stays transparent black, as main's decoder and the GPU shader write it: vk_texture.cpp passes Rgba8{0, 0, 0, 0} to the library's error colour. This matters because an all-zero block is an illegal one (texdecode's default, magenta, gives ff00ffff for it), upload_all_zero skips ASTC, and storage the game has not written yet, or a zero-padded tail, is decoded: magenta there would be a visible change. tests/test_astc_cpu_call.py compiles the renderer's own call as cut from vk_texture.cpp and checks that an all-zero block gives 00000000 and that the count of illegal blocks comes back. The count is logged once per texture (the first 16), never a texel value. HDR endpoint modes keep magenta for their partition (astcenc's behaviour; whether the game has any was not measured).

What a player can see. Only where the CPU decoder runs, texels are slightly different, towards the specification: ASTC is truncated to 8 bits as astcenc does where suyu rounded (about a fifth of texels one step apart); blocks suyu decoded wrongly are right; sRGB ASTC formats (NVN 0x87 to 0x94, viewed as R8G8B8A8_SRGB) decode in the specification's sRGB mode. The CPU and GPU routes now differ by one step on about 18% of texels, where before both rounded (Eden's GPU decoder rounds, and so did suyu's CPU decoder; the port truncates, as astcenc's 8-bit decode does).

Refusals. The library refuses bad arguments and short spans, which no caller can trigger today. The unswizzle's and ASTC's output is then zeroed (never what staging memory held) and one line says so (5 at most). A refused swizzle is not written back: that part is skipped and the flush reports not ok (zeroing it would overwrite the game's bytes).

Not in this pull request. The GPU decoder's own inaccuracies are a separate, later piece. Main's decoder (astc_decoder.comp, which #2194 rewrote for speed and which also starts color_endpoint_data at zero) read back from the GPU in the game and compared with this port's decoder over 1,119,311,811 texels (22 formats; Link's house, Kokiri Forest and Hyrule Field, route twice; scratch harness, Longshot/work/texshaders2/timing/runs/chk_hm1/log.txt): linear formats 82.24% equal, 17.57% one step, 0.193% more than one step, largest difference 113; sRGB formats (against the specification's sRGB mode) 81.13% / 18.82% / 0.051%, largest 113. That is what the decoder before #2194 gave (906,813,582 texels: 81.95% / 17.86% / 0.187%, largest 113): #2194 did not remove the larger differences, the first-seen largest (113) is still there, and it still rounds where astcenc truncates. Earlier, on the pre-#2194 shader, astcenc sided with this port on all 222,925 blocks that held a texel more than one step off (at most 4,096 blocks a level-layer).

Licence chain (gpu/vk/texdecode/PROVENANCE.md has it in full). astc.cpp is ported from ocarina-recomp's runtime/tex_astc.c (itself from LAS Recomp, MIT, Copyright (c) 2026 Peiikai) and block_linear.cpp from its runtime/tex_deswizzle.c (from MacNativeGames, MIT, Copyright (c) 2026 jhaizhou), at the commits and file hashes PROVENANCE.md gives; the code around the ported core (checks, size functions, the error-block count, the error-colour parameter) and the tests are written here. ocarina-recomp's own additions on top of the MIT originals (at most the copy-loop split and the Switch 2 bit order) are GPL-3.0-or-later: its author told the project owner so on 2026-11-21 (its README's own wording is "GPL-3.0"; this is the owner's report, not a file in this repository). Not settled: whether the files came through TotK Recomp (ocarina-recomp's base, MIT, Copyright (c) 2026 Valiantsin Dzerakh), so that notice is carried in LICENSE-MIT in case it is owed. Not checked: the upstream LICENSE texts of LAS Recomp and MacNativeGames at the cited commits, and the upstream files themselves.

Other pull requests. #2143 (the switch table) adds SW(RX_ASTC_THREADS, ...) described as "suyu's decoder, built into the game" and puts gpu/third_party/suyu/video_core/textures in THIRD_PARTY_IN_GAME; after this series that is false (it was already dead: only suyu's Decompress, which nothing calls, reads the switch). Whichever lands second drops the folder from the list and makes the row GONE(...), or never adds it. #2040 (Direct3D 12) is not broken: its gpu/d3d12/build.py compiles suyu's two files itself; only its docstring goes stale. #1281 does not interact. #2194 (merged: Eden's GPU ASTC decoder rewritten) and #2227 (gpu_arch.h) do not touch a file this series changes; the GPU decoder's output is unchanged by this series either way.

Read first: gpu/vk/texdecode/texdecode.h and PROVENANCE.md, then the four call sites in gpu/vk/vk_texture.cpp (unswizzle_upload, the tex.astc branch of upload_inner, and the swizzle in flush_finish), then tests/test_texdecode_astc_partitions.py and tests/test_astc_cpu_call.py. AI-assisted (Claude Code, under the owner's direction); the commits carry Co-Authored-By:. No issue is closed.

Testing

Tested: Linux, RTX 4070 Ti, NVIDIA 595.99.02, Vulkan 1.4; a runtime made over base 3e4b1faf (the measured head was 8d0e56c11 on main 9e10f6f7, whose changes since the base did not touch the texture decoders; the series is now rebased onto main 67ba729d2 with all three patches unchanged, git range-diff shows = for each, and main's changes since touch none of vk_texture.cpp, gpu/vk/texdecode/ or nx2/build.py, so these runs are not repeated; the GPU decoder #2194 rewrote is on neither side's CPU route and unchanged by the series on the default route) with this branch's pack, against the same base alone, through the job queue, from the kokiri-start save. Default settings: Link's house, Kokiri Forest and Hyrule Field's tunnel, 30 s each, a shot each, and the same three with RX_VK_ASTC_CPU=1, so the port decodes every ASTC texture: all twelve runs (branch and base) stopped cleanly with no warning or error line, logdiff.py against the base's logs shows no new, gone or much-changed warning or error kind in any pair, and neither the illegal-block line nor a refusal line appears in any of them or in the 24 timing runs below. The shots show the scenes as on the base, no magenta, no corrupted textures. These runs are at the previous head; the code since changed in the error colour (transparent black, as main), the swizzle refusal, comments and tests. The timing runs below predate the change to pass ASTC test inputs through standard input. Scene shots (scripts/scene_shots.py, Link's house, 5 runs a side, both under RX_VK_ASTC_CPU=1, at the previous head): PASS (B's worst shot 6.30 against a bound of 8.44); this coarse check cannot see a one-step difference on a fifth of the texels, it says only that nothing broke.
Checks before the ASTC test input change: the library tests and the fault test pass with clang++ 21 and g++ 15, and the library tests under -fsanitize=address,undefined. suite.py compare (run_all.py, this PC) at ac04b9572 (rebased on main 67ba729d2): head 911 passed / 23 failed / 26 skipped, base 905 / 23 / 26; 6 new checks, all passing; no check fails only on the branch, none only on the base, the same skips, and the failing sets are the same (the environment's: missing glslang, PIL, stale fixtures on main; log Longshot/work/texshaders2/logs/suite-A.txt).
Measured on the earlier branch (feat/first-party-texture-decode, with its temporary check switches, since removed), in the game, from longshot-renderer-log.md: swizzle and deswizzle byte-identical to suyu over 2,046,052,525 blocks and 5.6 GB; ASTC against suyu over 905 M texels: 81.8% equal, 18.2% one step, 10,634 larger (0.0012%), astcenc agreeing with the port on 479 of 479 such blocks and with suyu on none; the new ASTC decode 5.1 s against suyu's 29.3 s per load (5.7 times; 3 interleaved rounds). Those runs saw 0 illegal ASTC blocks in the game's data, and so do the runs above; what was covered is Link's house, Kokiri Forest and the Hyrule Field tunnel mouth, not the whole game.

Still to test:

  • Windows (llvm-mingw), any GPU: build and start the game once, with and without RX_VK_ASTC_CPU=1, expecting a clean start and no new warning (@Beanstalk build and start with RX_VK_ASTC_CPU=1)
  • A Tier 1 AMD GPU (RADV): one run with RX_VK_ASTC_CPU=1 in Kokiri Forest, expecting the scene as on main and no new warning (@Beanstalk)
  • A release build with the shipped play profile, timed on the CPU route (by hand): see Risks
  • Illegal ASTC blocks in real data (none in the areas above): the count line and the transparent black have only the game-free tests (by hand, if any is found)

Measurements

Verdict: On the CPU route the port is about 5.6 times better on the worst frame (13.3 s to 2.4 s) and about 5.6 times on slow-upload time (22 s to 3.9 s a run), with no change in time to map. On the default route, where the GPU decoder runs, there is no difference: the worst frames (about 200 to 260 ms in both) and the time to map overlap.

Setup: Linux, RTX 4070 Ti, NVIDIA 595.99.02; the two teleports (Kokiri Forest, Hyrule Field's tunnel), 30 s each through gamerun.py --mode timing (alone on the GPU), three interleaved rounds a side (base, branch in each round), base = the runtime of 3e4b1faf alone, branch = this PR's head at the time, 8d0e56c11, which is ac04b9572 before the rebase onto main 67ba729d2 (same three patches). Time to map is the run's load_seconds; worst frame is the largest slowest of the run's vk: status windows (the whole run); slow uploads is the sum of the run's vk: slow upload lines. Every run's log has the same texture budget (7164 MB; the driver allows 10228 to 10306 MB in all of them, so no other program was holding VRAM): no run was discarded.

With RX_VK_ASTC_CPU=1 (the port against suyu's decoder, which decodes serially):

Median (the three rounds) Before: main @ 3e4b1faf (the base) After: this PR @ 8d0e56c11
Kokiri Forest, time to map (s) 10.3 (10.3, 10.3, 10.3) 9.5 (10.0, 9.5, 9.5)
Kokiri Forest, worst frame (ms) 13,285 (13,285, 13,314, 13,282) 2,374 (2,374, 2,375, 2,360)
Kokiri Forest, slow uploads (ms) 22,014 (22,041, 22,014, 21,950) 3,902 (3,902, 3,918, 3,896)
Hyrule Field tunnel, time to map (s) 10.2 (10.4, 9.6, 10.2) 10.2 (10.2, 9.7, 10.2)
Hyrule Field tunnel, worst frame (ms) 13,266 (13,266, 13,291, 13,242) 2,382 (2,376, 2,383, 2,382)
Hyrule Field tunnel, slow uploads (ms) 21,928 (22,002, 21,928, 21,907) 3,909 (3,935, 3,906, 3,909)

Default settings (the GPU decoder; expected no difference):

Median (the three rounds) Before: main @ 3e4b1faf (the base) After: this PR @ 8d0e56c11
Kokiri Forest, time to map (s) 10.0 (10.2, 10.0, 9.9) 10.1 (10.1, 10.4, 10.1)
Kokiri Forest, worst frame (ms) 235 (251, 235, 203) 220 (228, 220, 213)
Kokiri Forest, slow uploads (ms) 153 (173, 153, 77) 79 (155, 79, 77)
Hyrule Field tunnel, time to map (s) 10.0 (9.8, 10.1, 10.0) 10.1 (10.1, 9.6, 10.1)
Hyrule Field tunnel, worst frame (ms) 220 (258, 220, 210) 230 (223, 234, 230)
Hyrule Field tunnel, slow uploads (ms) 110 (197, 110, 96) 176 (190, 95, 176)

The default-route differences are inside the runs' own spread. An earlier two-round default-route run had one 402 ms worst frame on the branch in Kokiri Forest; that run did 3.6 MB of CPU unswizzle in 0.4 ms in total and no CPU ASTC decode, so the decoders did not cause it, and it did not come back in the six branch runs here. From a scratch benchmark of the review (unprofiled, not part of this pull request): the port's deswizzle is 1.7 to 7.3 times faster than suyu's on 11 layouts with identical output, and its ASTC decode 3.4 to 4.4 times faster.

Risks

A CPU-decoded ASTC texture is slightly different from before, towards the specification (above); a revert is enough, there is no switch and no cache or option changes. The shader stamp and every cache stay as they are (the translator stamp is made of gpu/vk/eden, sirit, compat, vk_shader.cpp, vk_bank.cpp and vk_state.h: computed for main and for this branch it is 2200067913ddd7e1 both times). suyu's two sources stay in gpu/third_party/suyu (not edited) and are no longer compiled for the Vulkan back end. The CPU and GPU routes round differently now (above). A release build compiles texdecode without a play profile: the shipped assets/profiles/longshot_vk.profdata.xz has records for suyu's DecompressBlock and SwizzleImpl, none for texdecode, so a release's CPU-route time may differ from the unprofiled figures above; it was not measured (listed in Still to test).

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes on the current head (any failure that also fails on main is named); the earlier comparison is in Testing.
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • A switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def.
  • A check under tests/ that reads changed source is updated, not weakened.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths: Linux only so far; the Windows build is in Still to test.
  • Screenshots of the same spot on main and here, for a change that shows on screen: the shots of the six runs are on the author's PC, none attached; the difference is a one-step change in a fifth of the CPU-decoded texels, not visible in a shot.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.
## Summary When the renderer decodes a texture on the CPU (the block-linear unswizzle and swizzle, and ASTC), it called suyu's decoders from `gpu/third_party/suyu/video_core/textures/`. suyu's ASTC decoder is wrong on some legal blocks. This swaps it for a decoder and a block-linear swizzle ported from ocarina-recomp (MIT), in `gpu/vk/texdecode/`, and drops suyu's `decoders.cpp` and `astc.cpp` from the build. There is no switch: the port is the CPU path. **The fault, and how to see it on main.** In a legal multi-partition ASTC block, the colour endpoints are a sequence of values in groups of 5 (trits) or 3 (quints) whose high code bits are missing when the last group is not full, and the specification reads the missing bits as zero. suyu copies the spare bits after the sequence into the buffer it decodes and reads them as those code bits, so a partial last group can unquantise to other values and one partition's endpoints move. Only blocks with a partial last group, nonzero spare bits and more than 8 colour values are affected (about 6% of such random blocks go wrong); an encoder that zeroes the spare bits hides it. `tests/test_texdecode_astc_partitions.py` holds 8 such blocks and 3 controls with ARM's astcenc 6.0.0 answers and passes with the port. `python -I -B tests/test_texdecode_astc_partitions.py --decoder suyu` (not run by `run_all.py`) builds suyu's `astc.cpp` alone and shows the fault on main's decoder: 8 of the 11 blocks more than one step from astcenc, the largest difference 117 of 255 in a channel; the 3 controls are one step off (suyu's rounding). Two lines in suyu's file would fix it, and `gpu/third_party` is not edited. What changed, in four commits: 1. `gpu/vk/texdecode/`: the library (ASTC LDR 4x4 to 12x12, linear and sRGB modes; block-linear swizzle and deswizzle), its `PROVENANCE.md` and `LICENSE-MIT`, the vector generator and the two library tests. The ASTC decode takes an error colour (default: the specification's opaque magenta, which astcenc and the ported original write). The ASTC test harnesses receive their inputs through standard input, so input paths work with Unicode. 2. The fault test above. 3. `vk_texture.cpp` calls the library at the four CPU sites; `nx2/build.py` builds it and no longer builds suyu's two sources; every check that assumed suyu's decoder is updated, none weakened; two stale doc lines that said suyu's texture decoders were compiled are corrected. The ASTC decode runs on the calling thread, as before; the unswizzle keeps its strip threads. **What does not change.** The default route for 2D ASTC is still the GPU decoder (Eden's compute shader), and big block-linear textures still use the GPU unswizzle. The CPU decoder runs when the GPU path declines (3D ASTC, no `VK_KHR_push_descriptor`, layout or stride limits, out of staging memory) and with `RX_VK_ASTC_CPU=1` (its switch row now says so). The GPU decoder stays because CPU-only decode measured 3 to 8 times worse hitches and 4 times the VRAM (earlier branch, below). No shader is changed. **An illegal ASTC block stays transparent black**, as main's decoder and the GPU shader write it: `vk_texture.cpp` passes `Rgba8{0, 0, 0, 0}` to the library's error colour. This matters because an all-zero block is an illegal one (texdecode's default, magenta, gives `ff00ffff` for it), `upload_all_zero` skips ASTC, and storage the game has not written yet, or a zero-padded tail, is decoded: magenta there would be a visible change. `tests/test_astc_cpu_call.py` compiles the renderer's own call as cut from `vk_texture.cpp` and checks that an all-zero block gives `00000000` and that the count of illegal blocks comes back. The count is logged once per texture (the first 16), never a texel value. HDR endpoint modes keep magenta for their partition (astcenc's behaviour; whether the game has any was not measured). **What a player can see.** Only where the CPU decoder runs, texels are slightly different, towards the specification: ASTC is truncated to 8 bits as astcenc does where suyu rounded (about a fifth of texels one step apart); blocks suyu decoded wrongly are right; sRGB ASTC formats (NVN 0x87 to 0x94, viewed as R8G8B8A8_SRGB) decode in the specification's sRGB mode. The CPU and GPU routes now differ by one step on about 18% of texels, where before both rounded (Eden's GPU decoder rounds, and so did suyu's CPU decoder; the port truncates, as astcenc's 8-bit decode does). **Refusals.** The library refuses bad arguments and short spans, which no caller can trigger today. The unswizzle's and ASTC's output is then zeroed (never what staging memory held) and one line says so (5 at most). A refused swizzle is not written back: that part is skipped and the flush reports not ok (zeroing it would overwrite the game's bytes). **Not in this pull request.** The GPU decoder's own inaccuracies are a separate, later piece. Main's decoder (`astc_decoder.comp`, which #2194 rewrote for speed and which also starts `color_endpoint_data` at zero) read back from the GPU in the game and compared with this port's decoder over 1,119,311,811 texels (22 formats; Link's house, Kokiri Forest and Hyrule Field, route twice; scratch harness, `Longshot/work/texshaders2/timing/runs/chk_hm1/log.txt`): linear formats 82.24% equal, 17.57% one step, 0.193% more than one step, largest difference 113; sRGB formats (against the specification's sRGB mode) 81.13% / 18.82% / 0.051%, largest 113. That is what the decoder before #2194 gave (906,813,582 texels: 81.95% / 17.86% / 0.187%, largest 113): #2194 did not remove the larger differences, the first-seen largest (113) is still there, and it still rounds where astcenc truncates. Earlier, on the pre-#2194 shader, astcenc sided with this port on all 222,925 blocks that held a texel more than one step off (at most 4,096 blocks a level-layer). **Licence chain** (`gpu/vk/texdecode/PROVENANCE.md` has it in full). `astc.cpp` is ported from ocarina-recomp's `runtime/tex_astc.c` (itself from LAS Recomp, MIT, Copyright (c) 2026 Peiikai) and `block_linear.cpp` from its `runtime/tex_deswizzle.c` (from MacNativeGames, MIT, Copyright (c) 2026 jhaizhou), at the commits and file hashes PROVENANCE.md gives; the code around the ported core (checks, size functions, the error-block count, the error-colour parameter) and the tests are written here. ocarina-recomp's own additions on top of the MIT originals (at most the copy-loop split and the Switch 2 bit order) are GPL-3.0-or-later: its author told the project owner so on 2026-11-21 (its README's own wording is "GPL-3.0"; this is the owner's report, not a file in this repository). Not settled: whether the files came through TotK Recomp (ocarina-recomp's base, MIT, Copyright (c) 2026 Valiantsin Dzerakh), so that notice is carried in `LICENSE-MIT` in case it is owed. Not checked: the upstream `LICENSE` texts of LAS Recomp and MacNativeGames at the cited commits, and the upstream files themselves. **Other pull requests.** #2143 (the switch table) adds `SW(RX_ASTC_THREADS, ...)` described as "suyu's decoder, built into the game" and puts `gpu/third_party/suyu/video_core/textures` in `THIRD_PARTY_IN_GAME`; after this series that is false (it was already dead: only suyu's `Decompress`, which nothing calls, reads the switch). Whichever lands second drops the folder from the list and makes the row `GONE(...)`, or never adds it. #2040 (Direct3D 12) is not broken: its `gpu/d3d12/build.py` compiles suyu's two files itself; only its docstring goes stale. #1281 does not interact. #2194 (merged: Eden's GPU ASTC decoder rewritten) and #2227 (`gpu_arch.h`) do not touch a file this series changes; the GPU decoder's output is unchanged by this series either way. Read first: `gpu/vk/texdecode/texdecode.h` and `PROVENANCE.md`, then the four call sites in `gpu/vk/vk_texture.cpp` (`unswizzle_upload`, the `tex.astc` branch of `upload_inner`, and the swizzle in `flush_finish`), then `tests/test_texdecode_astc_partitions.py` and `tests/test_astc_cpu_call.py`. AI-assisted (Claude Code, under the owner's direction); the commits carry `Co-Authored-By:`. No issue is closed. ## Testing **Tested:** Linux, RTX 4070 Ti, NVIDIA 595.99.02, Vulkan 1.4; a runtime made over base `3e4b1faf` (the measured head was `8d0e56c11` on main `9e10f6f7`, whose changes since the base did not touch the texture decoders; the series is now rebased onto main `67ba729d2` with all three patches unchanged, `git range-diff` shows `=` for each, and main's changes since touch none of `vk_texture.cpp`, `gpu/vk/texdecode/` or `nx2/build.py`, so these runs are not repeated; the GPU decoder #2194 rewrote is on neither side's CPU route and unchanged by the series on the default route) with this branch's pack, against the same base alone, through the job queue, from the `kokiri-start` save. Default settings: Link's house, Kokiri Forest and Hyrule Field's tunnel, 30 s each, a shot each, and the same three with `RX_VK_ASTC_CPU=1`, so the port decodes every ASTC texture: all twelve runs (branch and base) stopped cleanly with no warning or error line, `logdiff.py` against the base's logs shows no new, gone or much-changed warning or error kind in any pair, and neither the illegal-block line nor a refusal line appears in any of them or in the 24 timing runs below. The shots show the scenes as on the base, no magenta, no corrupted textures. These runs are at the previous head; the code since changed in the error colour (transparent black, as main), the swizzle refusal, comments and tests. The timing runs below predate the change to pass ASTC test inputs through standard input. Scene shots (`scripts/scene_shots.py`, Link's house, 5 runs a side, both under `RX_VK_ASTC_CPU=1`, at the previous head): PASS (B's worst shot 6.30 against a bound of 8.44); this coarse check cannot see a one-step difference on a fifth of the texels, it says only that nothing broke. Checks before the ASTC test input change: the library tests and the fault test pass with clang++ 21 and g++ 15, and the library tests under `-fsanitize=address,undefined`. `suite.py compare` (`run_all.py`, this PC) at `ac04b9572` (rebased on main `67ba729d2`): head 911 passed / 23 failed / 26 skipped, base 905 / 23 / 26; 6 new checks, all passing; no check fails only on the branch, none only on the base, the same skips, and the failing sets are the same (the environment's: missing glslang, PIL, stale fixtures on main; log `Longshot/work/texshaders2/logs/suite-A.txt`). Measured on the earlier branch (`feat/first-party-texture-decode`, with its temporary check switches, since removed), in the game, from `longshot-renderer-log.md`: swizzle and deswizzle byte-identical to suyu over 2,046,052,525 blocks and 5.6 GB; ASTC against suyu over 905 M texels: 81.8% equal, 18.2% one step, 10,634 larger (0.0012%), astcenc agreeing with the port on 479 of 479 such blocks and with suyu on none; the new ASTC decode 5.1 s against suyu's 29.3 s per load (5.7 times; 3 interleaved rounds). Those runs saw 0 illegal ASTC blocks in the game's data, and so do the runs above; what was covered is Link's house, Kokiri Forest and the Hyrule Field tunnel mouth, not the whole game. **Still to test:** - Windows (llvm-mingw), any GPU: build and start the game once, with and without `RX_VK_ASTC_CPU=1`, expecting a clean start and no new warning (@Beanstalk build and start with `RX_VK_ASTC_CPU=1`) - A Tier 1 AMD GPU (RADV): one run with `RX_VK_ASTC_CPU=1` in Kokiri Forest, expecting the scene as on main and no new warning (@Beanstalk) - A release build with the shipped play profile, timed on the CPU route (by hand): see Risks - Illegal ASTC blocks in real data (none in the areas above): the count line and the transparent black have only the game-free tests (by hand, if any is found) ## Measurements **Verdict:** On the CPU route the port is about 5.6 times better on the worst frame (13.3 s to 2.4 s) and about 5.6 times on slow-upload time (22 s to 3.9 s a run), with no change in time to map. On the default route, where the GPU decoder runs, there is no difference: the worst frames (about 200 to 260 ms in both) and the time to map overlap. Setup: Linux, RTX 4070 Ti, NVIDIA 595.99.02; the two teleports (Kokiri Forest, Hyrule Field's tunnel), 30 s each through `gamerun.py --mode timing` (alone on the GPU), three interleaved rounds a side (base, branch in each round), base = the runtime of `3e4b1faf` alone, branch = this PR's head at the time, `8d0e56c11`, which is `ac04b9572` before the rebase onto main `67ba729d2` (same three patches). Time to map is the run's `load_seconds`; worst frame is the largest `slowest` of the run's `vk: status` windows (the whole run); slow uploads is the sum of the run's `vk: slow upload` lines. Every run's log has the same texture budget (7164 MB; the driver allows 10228 to 10306 MB in all of them, so no other program was holding VRAM): no run was discarded. With `RX_VK_ASTC_CPU=1` (the port against suyu's decoder, which decodes serially): | Median (the three rounds) | Before: main @ 3e4b1faf (the base) | After: this PR @ 8d0e56c11 | |---|---|---| | Kokiri Forest, time to map (s) | 10.3 (10.3, 10.3, 10.3) | 9.5 (10.0, 9.5, 9.5) | | Kokiri Forest, worst frame (ms) | 13,285 (13,285, 13,314, 13,282) | 2,374 (2,374, 2,375, 2,360) | | Kokiri Forest, slow uploads (ms) | 22,014 (22,041, 22,014, 21,950) | 3,902 (3,902, 3,918, 3,896) | | Hyrule Field tunnel, time to map (s) | 10.2 (10.4, 9.6, 10.2) | 10.2 (10.2, 9.7, 10.2) | | Hyrule Field tunnel, worst frame (ms) | 13,266 (13,266, 13,291, 13,242) | 2,382 (2,376, 2,383, 2,382) | | Hyrule Field tunnel, slow uploads (ms) | 21,928 (22,002, 21,928, 21,907) | 3,909 (3,935, 3,906, 3,909) | Default settings (the GPU decoder; expected no difference): | Median (the three rounds) | Before: main @ 3e4b1faf (the base) | After: this PR @ 8d0e56c11 | |---|---|---| | Kokiri Forest, time to map (s) | 10.0 (10.2, 10.0, 9.9) | 10.1 (10.1, 10.4, 10.1) | | Kokiri Forest, worst frame (ms) | 235 (251, 235, 203) | 220 (228, 220, 213) | | Kokiri Forest, slow uploads (ms) | 153 (173, 153, 77) | 79 (155, 79, 77) | | Hyrule Field tunnel, time to map (s) | 10.0 (9.8, 10.1, 10.0) | 10.1 (10.1, 9.6, 10.1) | | Hyrule Field tunnel, worst frame (ms) | 220 (258, 220, 210) | 230 (223, 234, 230) | | Hyrule Field tunnel, slow uploads (ms) | 110 (197, 110, 96) | 176 (190, 95, 176) | The default-route differences are inside the runs' own spread. An earlier two-round default-route run had one 402 ms worst frame on the branch in Kokiri Forest; that run did 3.6 MB of CPU unswizzle in 0.4 ms in total and no CPU ASTC decode, so the decoders did not cause it, and it did not come back in the six branch runs here. From a scratch benchmark of the review (unprofiled, not part of this pull request): the port's deswizzle is 1.7 to 7.3 times faster than suyu's on 11 layouts with identical output, and its ASTC decode 3.4 to 4.4 times faster. ## Risks A CPU-decoded ASTC texture is slightly different from before, towards the specification (above); a revert is enough, there is no switch and no cache or option changes. The shader stamp and every cache stay as they are (the translator stamp is made of `gpu/vk/eden`, `sirit`, `compat`, `vk_shader.cpp`, `vk_bank.cpp` and `vk_state.h`: computed for main and for this branch it is `2200067913ddd7e1` both times). suyu's two sources stay in `gpu/third_party/suyu` (not edited) and are no longer compiled for the Vulkan back end. The CPU and GPU routes round differently now (above). A release build compiles texdecode without a play profile: the shipped `assets/profiles/longshot_vk.profdata.xz` has records for suyu's `DecompressBlock` and `SwizzleImpl`, none for texdecode, so a release's CPU-route time may differ from the unprofiled figures above; it was not measured (listed in Still to test). ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [ ] `mise run test` passes on the current head (any failure that also fails on `main` is named); the earlier comparison is in Testing. - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] A switch added or changed: it ships at the default the measurements chose, with its row in `gpu/vk/switches.def`. - [x] A check under `tests/` that reads changed source is updated, not weakened. - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths: Linux only so far; the Windows build is in Still to test. - [ ] Screenshots of the same spot on `main` and here, for a change that shows on screen: the shots of the six runs are on the author's PC, none attached; the difference is a one-step change in a fifth of the CPU-decoded texels, not visible in a shot. - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold.
gpu/vk/texdecode/ holds a block-linear (GOB) deswizzle and swizzle and an ASTC LDR decoder (4x4 to 12x12, linear and sRGB
modes, depth slices) whose decoding core is ported from ocarina-recomp's runtime/tex_astc.c and tex_deswizzle.c (MIT, by way of
LAS Recomp and MacNativeGames). PROVENANCE.md says what was taken, what was changed, and what is not settled (a possible
TotK Recomp link) and what is (ocarina-recomp's own additions are GPL-3.0-or-later, as its author told the project owner
on 2026-11-21). LICENSE-MIT carries the notices of every holder named.

The code around the ported core is written here: argument, span and 64-bit overflow checks that refuse instead of wrapping,
size functions and the count of error blocks. The error colour of an illegal block is a parameter (Rgba8 error_color) whose
default is the specification's opaque magenta, which the ported original already wrote; the renderer's call passes its own. The tests compare the
decoder with ARM's astcenc 6.0.0 on 4,694 blocks (3,976 random, 718 built by hand) in both modes (0 differences; the vectors are random numbers, never
game data; scripts/gen_texdecode_astc_vectors.py regenerates them with an astcenc of your own) and round-trip 4,325 swizzle
layouts against offsets worked out by hand, including the cases mutation testing found missing: 3D GOB order with tile height
different from tile depth, void extents with equal coordinates, reserved void-extent bits, the 6x10 and 10x6 grids, and weight
bits 97 to 100.

Nothing calls it yet and the build does not list it: the next commits do.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The ASTC decoder the renderer decodes CPU textures with today (suyu's, gpu/third_party/suyu/video_core/textures/astc.cpp)
decodes some legal multi-partition blocks far from ARM's astcenc: up to 117 of 255 in one channel, 8 of the 8 blocks of the
class here (the 3 controls are one step off, its rounding). Cause: the colour endpoints are an integer sequence in groups of 5
(trits) or 3 (quints) whose high code bits are missing when the last group is not full, and the specification reads the missing
bits as zero; suyu copies the spare bits after the sequence into the buffer it decodes, and its group decoders read them. It
needs nonzero spare bits and more than 8 colour values, so random blocks hit it (about 6% of the blocks with both go wrong)
and an encoder that zeroes the spare bits hides it. Two lines in suyu's file would fix it, and gpu/third_party is not edited.

The test holds 8 such blocks and 3 controls, each with astcenc 6.0.0's answer, and asserts every texel within one step of it and
exact. It calls the decoder texdecode's astc_decode, with the error colour the swap in the next commit passes, and passes with clang++
and g++; --decoder suyu (not in run_all.py) builds suyu's astc.cpp alone and shows the fault. With --decoder suyu it fails on 8 of the 11 blocks (largest difference 117), which is how the fault was shown.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
feat(vk): the renderer's CPU texture decode is texdecode, and suyu's two texture sources leave the build
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 10s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
37af5747ff
The four CPU call sites in vk_texture.cpp now call gpu/vk/texdecode directly: the block-linear unswizzle (unswizzle_upload,
after texture_tiles has declined a level), the ASTC decoder (sRGB formats, NVN 0x87 to 0x94, in the specification's sRGB mode,
which is what their R8G8B8A8_SRGB view samples; the others in linear mode), the one-thread reference of RX_VK_UNSWIZZLE_CHECK,
and the swizzle of a flushed texture. nx2/build.py's vk_sources() lists gpu/vk/texdecode/*.cpp and no longer suyu's
video_core/textures/decoders.cpp and astc.cpp, and the headers' dependency folders no longer include suyu's textures. Nothing
under gpu/third_party is edited or deleted; what is no longer compiled there is those two sources (and workers.h with its
RX_ASTC_THREADS, which only astc.cpp included). The ASTC decode runs on the calling thread, as suyu's DecompressSerial did,
and the unswizzle keeps its strip threads.

No switch: the CPU path is texdecode's, with no way back to suyu's. The GPU ASTC decoder stays the default route for 2D ASTC;
this decoder runs when it declines (3D ASTC, no push descriptors, layout or stride limits, out of staging
memory) and with RX_VK_ASTC_CPU=1, whose switch row now says so (a multisample image never reaches either decoder).

What changes in a texel: ASTC is truncated to 8 bits, as ARM's astcenc does, where suyu rounded (about a fifth of texels one
step apart, towards the specification); blocks suyu decoded wrongly (the previous commit's test) are right. Eden's GPU decoder
rounds, so the CPU and GPU routes now differ by one step on about 18% of texels, where before both rounded. An illegal block
stays transparent black, as suyu's decoder and the GPU shader write it: an all-zero block is an illegal one (texdecode's default,
magenta, gave ff00ffff for it), upload_all_zero skips ASTC, and storage the game has not written yet is decoded. The call passes
that colour to the library's error-colour parameter; the count of illegal blocks is still logged.

Refusals (an argument out of range or a span too short, which no caller can trigger): the unswizzle's and the ASTC decoder's
output is zeroed, never what the staging memory held, and one line says so (at most 5). A refused swizzle is not written back
(that part is skipped and the flush reports not ok; zero would overwrite the game's bytes). An ASTC texture with illegal
blocks logs its count once (the first 16 textures), never a texel value.

Tests that assumed suyu's decoder updated, none weakened: test_texture_tile_upload.py compares unswizzle_upload with texdecode's
deswizzle (which tests/test_texdecode_swizzle.py checks against offsets worked out by hand) and now also checks the refusal;
test_shader_stamp_cache.py's back-end file list names texdecode's files and asserts no gpu/third_party source is built;
test_third_party_objects.py's example moves with them; test_texdecode_build.py asserts the source list, and test_astc_error_blocks_log.py checks the two
log lines above (once per texture, 16 at most, no texel value; a refusal 5 times at most), and test_astc_cpu_call.py compiles
the renderer's astc_decode statement and astc_nvn_srgb as cut from vk_texture.cpp: an all-zero block gives 00000000 with its
count, the format picks the sRGB or linear mode, and the sRGB rule is vk_format()'s. The stale lines in gpu/PROVENANCE.md and
docs/dev/setup.md that named suyu's texture decoders as compiled are corrected.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Author
Contributor

Tested in game: Linux, RTX 4070 Ti, NVIDIA 595.99.02: Link's house, Kokiri Forest and Hyrule Field, default settings and with RX_VK_ASTC_CPU=1 so the ported decoder handles every ASTC texture; clean stops, no new warning or error kinds against main, shots look right. With RX_VK_ASTC_CPU=1 the worst frame entering Kokiri Forest went from 13.3 s to 2.4 s (three interleaved rounds); default route unchanged. Measured at 8d0e56c1; this head is the same three commits rebased onto main 753fb5af with the game-free tests rerun.

Tested in game: Linux, RTX 4070 Ti, NVIDIA 595.99.02: Link's house, Kokiri Forest and Hyrule Field, default settings and with RX_VK_ASTC_CPU=1 so the ported decoder handles every ASTC texture; clean stops, no new warning or error kinds against main, shots look right. With RX_VK_ASTC_CPU=1 the worst frame entering Kokiri Forest went from 13.3 s to 2.4 s (three interleaved rounds); default route unchanged. Measured at 8d0e56c1; this head is the same three commits rebased onto main 753fb5af with the game-free tests rerun.
Owner
@review
BeanBot left a comment

Recommendation: Approve. The CPU decoder fixes the demonstrated ASTC blocks and substantially reduces the measured CPU-route hitch, but its new tests cannot read their input files from some Windows paths. Windows, AMD, Steam Deck and release-profile runs are also still needed. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.

The Vulkan CPU texture path replaces suyu's decoders with a ported ASTC decoder and block-linear swizzler. It corrects the demonstrated partial endpoint-group error and speeds up the tested CPU route, at the cost of changed rounding and sRGB output and a larger body of maintained decoding code.

Should fix (1): not blocking, but worth doing before merging.

  • L1 tests/texdecode_astc_test.cpp:19: The new ASTC tests open Windows paths through narrow C or C++ file APIs, which do not reliably accept the Unicode paths supplied by Python. (more on the line) Do: Pass the input through a Unicode-safe Windows file API, or have the Python harness supply the bytes over standard input; cover both the vector and partition harnesses.

Testing before merging (3) (runs on the systems it can change; it doesn't hold the recommendation)

  • L2: The changed CPU decode and write-back paths need a Windows game run. When: Windows players can take the CPU ASTC fallback and block-linear paths, but the reported game runs and decoder timings are Linux-only. Do: Build with llvm-mingw and start the game on Windows with default settings and with RX_VK_ASTC_CPU=1; check the scene and logs against the base.
  • L3: The changed renderer path has not been exercised on Tier 1 AMD hardware or Steam Deck. When: These systems can use the CPU fallback or the changed block-linear path, while the reported visual and timing evidence comes from one NVIDIA GPU. Do: Run the affected scenes on RADV and Steam Deck, including RX_VK_ASTC_CPU=1, and compare the image and logs with the base.
  • L4: The reported CPU-route timing does not measure the shipped release profile. When: The shipped profile contains records for the old decoder but none for texdecode, so the unprofiled 13.3 s to 2.4 s result does not establish the release-build gain. Do: Repeat the interleaved CPU-route comparison with release builds and the shipped play profile.

@fix can do L1.

Questions (1) (not confirmed from the code; they don't hold the recommendation)

  • Can the upstream licence texts and file history be checked before merge to confirm the carried notices and the rights for both ported cores?

Checks: Still running: 10 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes, on the tested CPU route: the author's three interleaved Linux RTX 4070 Ti runs report median worst frames falling from 13.3 s to 2.4 s and slow-upload time from about 22 s to 3.9 s. The game-free fault test reports eight formerly incorrect blocks corrected; release-profile performance and other supported systems remain untested.

Other systems: The CPU decoder also runs on GPU-decode fallback paths, including 3D ASTC and devices without push descriptors; the block-linear code also affects texture write-back. Windows, RADV and Steam Deck have no reported runs. The default NVIDIA GPU path was measured within run-to-run spread, and Direct3D 12 retains its own suyu build according to the description.

Switches: RX_VK_ASTC_CPU is unchanged and defaults off; its table description now identifies the new CPU decoder. RX_VK_UNSWIZZLE_CHECK remains off by default and now compares against the new decoder. No switch is added or removed.

Reviewed: 37af5747ff against 753fb5af68: Read the repository rules, available template and standards, commit messages, changed decoder and integration code, provenance, relevant build and test changes, and surrounding upload and flush paths. Skimmed the vector generator and generated binary vectors; did not independently verify upstream licence texts or provenance, which are unavailable in the checkout. docs/review-checklist.md and the sibling Tooling AGENTS.md were absent.; nothing run (a code review).

Checked and fine:

  • The decoder checks level sizes before writing, and the block-linear worker state is local to each call.
  • The renderer passes transparent black for whole illegal ASTC blocks and counts them with synchronized logging.
  • The reported vector inputs are generated random or constructed blocks, and all three commits carry AI-assistance trailers.
  • The renderer API and shader sources are unchanged; the switch table row is updated.

Testing: No code, tests or project scripts were run during this read-only review. The author reports Linux game runs, decoder tests with Clang and GCC, and sanitizer runs; CI is still running.

Overlaps and merge order: #2143 changes the switch table and third-party list; whichever lands second must reconcile RX_ASTC_THREADS and the suyu texture folder. The description reports no conflicting changes from #2194, #2227 or #1281; #2040 builds its own suyu sources.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The CPU decoder fixes the demonstrated ASTC blocks and substantially reduces the measured CPU-route hitch, but its new tests cannot read their input files from some Windows paths. Windows, AMD, Steam Deck and release-profile runs are also still needed. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge. The Vulkan CPU texture path replaces suyu's decoders with a ported ASTC decoder and block-linear swizzler. It corrects the demonstrated partial endpoint-group error and speeds up the tested CPU route, at the cost of changed rounding and sRGB output and a larger body of maintained decoding code. **Should fix (1)**: not blocking, but worth doing before merging. - **L1** `tests/texdecode_astc_test.cpp:19`: The new ASTC tests open Windows paths through narrow C or C++ file APIs, which do not reliably accept the Unicode paths supplied by Python. (more on the line) **Do:** Pass the input through a Unicode-safe Windows file API, or have the Python harness supply the bytes over standard input; cover both the vector and partition harnesses. **Testing before merging (3)** (runs on the systems it can change; it doesn't hold the recommendation) - **L2**: The changed CPU decode and write-back paths need a Windows game run. *When:* Windows players can take the CPU ASTC fallback and block-linear paths, but the reported game runs and decoder timings are Linux-only. **Do:** Build with llvm-mingw and start the game on Windows with default settings and with RX_VK_ASTC_CPU=1; check the scene and logs against the base. - **L3**: The changed renderer path has not been exercised on Tier 1 AMD hardware or Steam Deck. *When:* These systems can use the CPU fallback or the changed block-linear path, while the reported visual and timing evidence comes from one NVIDIA GPU. **Do:** Run the affected scenes on RADV and Steam Deck, including RX_VK_ASTC_CPU=1, and compare the image and logs with the base. - **L4**: The reported CPU-route timing does not measure the shipped release profile. *When:* The shipped profile contains records for the old decoder but none for texdecode, so the unprofiled 13.3 s to 2.4 s result does not establish the release-build gain. **Do:** Repeat the interleaved CPU-route comparison with release builds and the shipped play profile. `@fix` can do L1. **Questions (1)** (not confirmed from the code; they don't hold the recommendation) - Can the upstream licence texts and file history be checked before merge to confirm the carried notices and the rights for both ported cores? **Checks:** Still running: 10 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes, on the tested CPU route: the author's three interleaved Linux RTX 4070 Ti runs report median worst frames falling from 13.3 s to 2.4 s and slow-upload time from about 22 s to 3.9 s. The game-free fault test reports eight formerly incorrect blocks corrected; release-profile performance and other supported systems remain untested. **Other systems:** The CPU decoder also runs on GPU-decode fallback paths, including 3D ASTC and devices without push descriptors; the block-linear code also affects texture write-back. Windows, RADV and Steam Deck have no reported runs. The default NVIDIA GPU path was measured within run-to-run spread, and Direct3D 12 retains its own suyu build according to the description. **Switches:** RX_VK_ASTC_CPU is unchanged and defaults off; its table description now identifies the new CPU decoder. RX_VK_UNSWIZZLE_CHECK remains off by default and now compares against the new decoder. No switch is added or removed. **Reviewed:** 37af5747ff1f against 753fb5af6860: Read the repository rules, available template and standards, commit messages, changed decoder and integration code, provenance, relevant build and test changes, and surrounding upload and flush paths. Skimmed the vector generator and generated binary vectors; did not independently verify upstream licence texts or provenance, which are unavailable in the checkout. docs/review-checklist.md and the sibling Tooling AGENTS.md were absent.; nothing run (a code review). **Checked and fine:** - The decoder checks level sizes before writing, and the block-linear worker state is local to each call. - The renderer passes transparent black for whole illegal ASTC blocks and counts them with synchronized logging. - The reported vector inputs are generated random or constructed blocks, and all three commits carry AI-assistance trailers. - The renderer API and shader sources are unchanged; the switch table row is updated. **Testing:** No code, tests or project scripts were run during this read-only review. The author reports Linux game runs, decoder tests with Clang and GCC, and sanitizer runs; CI is still running. **Overlaps and merge order:** #2143 changes the switch table and third-party list; whichever lands second must reconcile RX_ASTC_THREADS and the suyu texture folder. The description reports no conflicting changes from #2194, #2227 or #1281; #2040 builds its own suyu sources. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -0,0 +16,4 @@
static uint64_t le64(const uint8_t* p) { uint64_t v = 0; for (int i = 7; i >= 0; i--) v = v << 8 | p[i]; return v; }
int main(int argc, char** argv) {
if (argc != 2) { fprintf(stderr, "usage: test vectors.bin\n"); return 2; }
Member

L1 (should fix): The new ASTC tests open Windows paths through narrow C or C++ file APIs, which do not reliably accept the Unicode paths supplied by Python.

When: On Windows, a checkout path containing characters outside the active ANSI code page makes the vector test fail to open its committed input. The partition test similarly opens its temporary input with std::ifstream and fails when the user's temporary directory contains such characters.

Do: Pass the input through a Unicode-safe Windows file API, or have the Python harness supply the bytes over standard input; cover both the vector and partition harnesses.

**L1** (should fix): The new ASTC tests open Windows paths through narrow C or C++ file APIs, which do not reliably accept the Unicode paths supplied by Python. *When:* On Windows, a checkout path containing characters outside the active ANSI code page makes the vector test fail to open its committed input. The partition test similarly opens its temporary input with std::ifstream and fails when the user's temporary directory contains such characters. **Do:** Pass the input through a Unicode-safe Windows file API, or have the Python harness supply the bytes over standard input; cover both the vector and partition harnesses.
Owner
@fix
BeanBot force-pushed feat/texdecode-ported-cpu from 37af5747ff
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 10s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to 6e6cecd466
All checks were successful
PR description / Description follows the template (pull_request_target) Successful in 14s
2026-11-23 00:34:34 +00:00
Compare
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The CPU decoder shows a substantial improvement in the reported Linux runs, but Windows, Tier 1 AMD or Steam Deck, and release-profile measurements remain outstanding. Recommend approval; not approved on the forge.

What @fix changed
I changed this pull request: the new head is 6e6cecd466. I rebased it onto main (21d5bdf9bc). I edited its description to match the change.

Changed

  • Unicode paths in ASTC test inputs: Both Python harnesses now supply input through standard input; the vector reader uses binary mode on Windows and both readers report input errors (tests/test_texdecode_astc.py:30, tests/test_texdecode_astc_partitions.py:158, tests/texdecode_astc_test.cpp:22, tests/texdecode_astc_partitions_test.cpp:53). Tests were not run, as requested.

Nothing was built or run: the checks run again on the new head.

The change replaces the CPU ASTC and block-linear decoders, correcting the documented ASTC fault and reducing CPU-route stalls. It adds a maintained decoder port and changes CPU-decoded texels toward the specification.

Testing before merging (3) (runs on the systems it can change; it doesn't hold the recommendation)

  • L2: The changed CPU decode and write-back paths need a Windows game run. When: Windows players can take the CPU ASTC fallback and block-linear paths, but the reported game runs and decoder timings are Linux-only. Do: Build with llvm-mingw and start the game on Windows with default settings and with RX_VK_ASTC_CPU=1; check the scene and logs against the base.
  • L3: The changed renderer path has not been exercised on Tier 1 AMD hardware or Steam Deck. When: These systems can use the CPU fallback or the changed block-linear path, while the reported visual and timing evidence comes from one NVIDIA GPU. Do: Run the affected scenes on RADV and Steam Deck, including RX_VK_ASTC_CPU=1, and compare the image and logs with the base.
  • L4: The reported CPU-route timing does not measure the shipped release profile. When: The shipped profile contains records for the old decoder but none for texdecode, so the unprofiled 13.3 s to 2.4 s result does not establish the release-build gain. Do: Repeat the interleaved CPU-route comparison with release builds and the shipped play profile.

Checks: they run again on this head; a failure shows on the pull request.

Also noticed (1; not asked for, not blocking)
  • The updated description says there are four commits but enumerates only three.
More: does it help, other systems, switches, what was read

Does it help: Yes. The reported three interleaved Linux runs show median worst frames falling from about 13.3 s to 2.4 s on the forced CPU route; default-route results overlap. Release-profile timing remains unmeasured.

Other systems: Linux NVIDIA game runs and game-free decoder comparisons are reported. Windows CPU decode and write-back, Tier 1 AMD or Steam Deck, and the shipped release profile still need the runs in the ledger.

Switches: RX_VK_ASTC_CPU remains off by default; its description now names the CPU fallback cases. The reported default-route measurements support retaining the default.

Reviewed: 6e6cecd466 against 21d5bdf9bc: Read the four ASTC test files changed by the fix, the fix diff, the texture decoder interface and provenance, and the renderer and build integration diff. Skimmed the wider pull request diff; the other changed code and generated vectors were not read in full.; nothing run (a code review).

Checked and fine:

  • Both ASTC test harnesses receive their input through standard input; the binary vector reader sets Windows binary mode and checks read errors.
  • The fix leaves the renderer's decoder integration intact.

Testing: No commands that build or run project code were executed. The supplied report records Linux game and decoder tests before the test-input change; CI has not yet run on this head.

Overlaps and merge order: The description identifies #2143 as needing a switch-table and third-party-list adjustment whichever lands second; #2040 retains its own suyu sources.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left. The CPU decoder shows a substantial improvement in the reported Linux runs, but Windows, Tier 1 AMD or Steam Deck, and release-profile measurements remain outstanding. Recommend approval; not approved on the forge. **What `@fix` changed** I changed this pull request: the new head is 6e6cecd466a2. I rebased it onto `main` (21d5bdf9bc64). I edited its description to match the change. **Changed** - **Unicode paths in ASTC test inputs**: Both Python harnesses now supply input through standard input; the vector reader uses binary mode on Windows and both readers report input errors (tests/test_texdecode_astc.py:30, tests/test_texdecode_astc_partitions.py:158, tests/texdecode_astc_test.cpp:22, tests/texdecode_astc_partitions_test.cpp:53). Tests were not run, as requested. Nothing was built or run: the checks run again on the new head. The change replaces the CPU ASTC and block-linear decoders, correcting the documented ASTC fault and reducing CPU-route stalls. It adds a maintained decoder port and changes CPU-decoded texels toward the specification. **Testing before merging (3)** (runs on the systems it can change; it doesn't hold the recommendation) - **L2**: The changed CPU decode and write-back paths need a Windows game run. *When:* Windows players can take the CPU ASTC fallback and block-linear paths, but the reported game runs and decoder timings are Linux-only. **Do:** Build with llvm-mingw and start the game on Windows with default settings and with RX_VK_ASTC_CPU=1; check the scene and logs against the base. - **L3**: The changed renderer path has not been exercised on Tier 1 AMD hardware or Steam Deck. *When:* These systems can use the CPU fallback or the changed block-linear path, while the reported visual and timing evidence comes from one NVIDIA GPU. **Do:** Run the affected scenes on RADV and Steam Deck, including RX_VK_ASTC_CPU=1, and compare the image and logs with the base. - **L4**: The reported CPU-route timing does not measure the shipped release profile. *When:* The shipped profile contains records for the old decoder but none for texdecode, so the unprofiled 13.3 s to 2.4 s result does not establish the release-build gain. **Do:** Repeat the interleaved CPU-route comparison with release builds and the shipped play profile. **Checks:** they run again on this head; a failure shows on the pull request. <details> <summary>Also noticed (1; not asked for, not blocking)</summary> - The updated description says there are four commits but enumerates only three. </details> <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes. The reported three interleaved Linux runs show median worst frames falling from about 13.3 s to 2.4 s on the forced CPU route; default-route results overlap. Release-profile timing remains unmeasured. **Other systems:** Linux NVIDIA game runs and game-free decoder comparisons are reported. Windows CPU decode and write-back, Tier 1 AMD or Steam Deck, and the shipped release profile still need the runs in the ledger. **Switches:** RX_VK_ASTC_CPU remains off by default; its description now names the CPU fallback cases. The reported default-route measurements support retaining the default. **Reviewed:** 6e6cecd466a2 against 21d5bdf9bc64: Read the four ASTC test files changed by the fix, the fix diff, the texture decoder interface and provenance, and the renderer and build integration diff. Skimmed the wider pull request diff; the other changed code and generated vectors were not read in full.; nothing run (a code review). **Checked and fine:** - Both ASTC test harnesses receive their input through standard input; the binary vector reader sets Windows binary mode and checks read errors. - The fix leaves the renderer's decoder integration intact. **Testing:** No commands that build or run project code were executed. The supplied report records Linux game and decoder tests before the test-input change; CI has not yet run on this head. **Overlaps and merge order:** The description identifies #2143 as needing a switch-table and third-party-list adjustment whichever lands second; #2040 retains its own suyu sources. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.</sub>
TrashPanda force-pushed feat/texdecode-ported-cpu from 6e6cecd466
All checks were successful
PR description / Description follows the template (pull_request_target) Successful in 14s
to 0db7f2f119
Some checks failed
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Failing after 9s
2026-11-23 15:10:02 +00:00
Compare
HumanBean changed title from WIP: feat(vk): the CPU texture decoders are ported ones (texdecode), and suyu's two texture sources leave the build to feat(vk): the CPU texture decoders are ported ones (texdecode), and suyu's two texture sources leave the build 2026-11-23 15:57:55 +00:00
HumanBean deleted branch feat/texdecode-ported-cpu 2026-11-23 15:58:06 +00:00
Some checks failed
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Failing after 9s
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
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
MagicBeanDev/Longshot!2307
No description provided.