Repository navigation
Fast travel dissolve without its noise on Mali: BC textures the GPU compresses into decoded after the draws - #210
Conversation
…ompresses into decoded after the draws BOTW makes its 32x32x32 BC4 noise volume once after a load: an R8 volume filled on the CPU, its mips drawn on the GPU from it, then every slice and mip compressed by drawing blocks into the BC4 texture through RGBA16_UINT views. On a GPU without BC (Mali) the BC texture holds decoded R8 texels, so the blocks went in as colours and the volume read zero - and the source volume was never uploaded either (first drawn into at level 1). The fast-travel dissolve lost its noise: Link turned flat dark blue and vanished at once instead of breaking up into the blue lines. - A texture first drawn into at a level past 0 gets its CPU contents uploaded first (vk_tex_upload_for_mips). - Draws through a block-sized view into a BC texture with decoded texels go to a shadow image in the view's format at the block grid; before the texture is next read (another pass, a dispatch, a copy, the present) the drawn slices come back to the CPU and are decoded into the image (one GPU wait, ~5-7 ms, once per load on BOTW). - A target drawn through a view of another output type into an image of another format is no longer bound. Mali-G925, stock 0.2.10 vs this, Native and Recompiled, first and second fast travel, menu, 3D LUT, fog and a 15-minute session of 14 fast travels: the dissolve is back, no errors, FPS and frame times as before. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Documentation only (MALI_PROGRESS.md). Co-Authored-By: Claude Opus 5.5 <[email protected]>
… replaces it begin_pass skipped decoding the dirty shadow of a texture the new pass draws into, and vk_bc_shadow_view then destroyed that shadow when the new view had another format: what the earlier pass drew (another level, slice or layer) was lost. vk_bc_shadows_resolve now keeps a shadow only for a target drawn through a view in the shadow's format; any other use of it decodes the shadow first. A texture drawn in two formats within one pass keeps its shadow and the other view draws without one. tools/test_bc_shadow.c (textures.c with Vulkan stubbed) checks it; on 050fbc2 the format change decoded nothing. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A new shadow image was only put in its layout (contents undefined), its first pass could clear it, and the whole slice drawn into is decoded afterwards: blocks a draw did not cover (a scissored draw, a zero write mask) replaced the texture's decoded contents with undefined or cleared data. bc_shadow_fill now gives a new shadow the guest's blocks (tegra layout, as upload_texture reads them), or, for a shadow replacing one in another format, that one's blocks (an image copy between same-size formats); shadow attachments always load. tools/test_bc_shadow.c checks the fills; 050fbc2 made none. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ailures checked Level 0 of a shadow was sized so that blocks << level fit at every level, one-block levels included: a 32x32x32 volume got 32x32 blocks for its 8x8, a 2048x16 texture with 12 levels 2048x2048 for 512x4. Levels of one block fit any extent (at least 1), so only larger levels count; one side still reaches 2^(levels - 1) for the image's level count (2048x4 there). The shadow's calloc and the decode's region array are checked before use (the decode, out of memory, drops what was drawn and leaves the shadow usable). tools/test_bc_shadow.c checks the extents. Co-Authored-By: Claude Opus 5.5 <[email protected]>
vk_bc_shadows_resolve compared only the view's format with the shadow's, but vk_bc_shadow_view also refuses views (levels past the texture's or 16, 3D levels LARECOMP_3D_RT leaves out, multisampled): such a pass drew into the decoded image while the shadow stayed dirty, and its later decode overwrote that draw. Both now ask bc_shadow_format. tools/test_bc_shadow.c checks a same-format view past the levels; the runner skips tests that need android/deps/out when the app was never built. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Follow-ups pushed to this branch, found while auditing the shadow path on Mali G925 (SM-X730):
How it was checked Game runs used this code plus a local env-gated counter commit that is not pushed. Baseline: this PR before the follow-ups (
In these runs the shadow path ran once per world load (1 shadow made, 1 resolved), with no format change. So in the game this shows no regression; the P1 format-change fix and the P2 uncovered-block case are covered only by the device test. Known limits
|
Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Merged, thank you! This was a great write-up, and the evidence made it easy to review. It fixes more than Mali: on my POCO F7 Ultra (Adreno 830, Turnip) Link also turned flat blue and vanished at once on a fast travel, which is what #220 reports on a Snapdragon 8 Elite. With this PR he breaks up into the lines and forms back on arrival. On Adreno the part doing it is the noise volume's CPU contents uploaded before its mips are drawn ( I've added you to the README's contributors. It'll be in the next release. |
Summary
On Mali, Link doesn't dissolve during a fast travel: he turns flat dark blue and vanishes all at once instead of
breaking up into the blue lines. The dissolve samples a 32x32x32 BC4 noise volume, and on Mali that volume reads zero.
BOTW builds the volume once after a load, and on a GPU without BC that path breaks in two places:
The change:
The resolve copies the drawn slices to the readback buffer, waits for the GPU once and decodes the blocks with the
existing BC decoder (
bc_upload_blocks, now shared with the upload path) into the texture's image. Only drawn(level, slice) pairs are decoded. The shadow's level 0 is widened so non-power-of-two levels fit. The shadow is
released through
views_forget+deferindestroy_image, so #176's dead-view check covers its views too. A rebootin place destroys every backend, which empties the dirty list, so no
RT_ON_RESEThook is needed.Evidence
Device: Samsung SM-X730, Immortalis-G925 MC12, Vulkan driver r49p1, Android 16. Scratch saves (
LARECOMP_SAVE_DIR),30 fps, the classic touch layout. Each run was compared with an unchanged v0.2.13-beta build from the same tree.
Before: in the burst captures Link is already gone and only the lines are left, on the first and the second
fast travel.
After: the body breaks up under the lines, as it should.
Log, once per load, identical in every patched run:
Regression matrix, 10 runs (stock vs this PR × Native / Recompiled). Routes: Great Plateau walk, inventory and fast
travel; Hateno walk, map, two fast travels, the Myahm Agana forest (fog) and inventory; a 15-minute session of
12 walk / menu / fast-travel cycles.
No repeat decode was seen in the 12 fast travels. Menus, the 3D LUT (4
3D target 8x8x8lines per run) and thefog look the same as stock in the captures. The same matrix on 0.2.10 gave the same picture.
Host tests (NDK 30): timing history 8, shader cache 17, Vulkan startup 33, Vulkan compat 16 checks pass, the same
as on 5403f00.
Merge Danger
Door: two-way. Runtime-only and stateless across runs; reverting the commit restores the old behaviour.
Blast Radius: render targets.
#ifdef __ANDROID__and are reached only for a BC texture the GPU lacks (Mali)drawn into through a view of the block's size. On BOTW that is the noise volume, once per load.
rt_format: a target's output type (pipeline key and blend) now follows the view's format when the view namesone. This changes pipelines only where a draw goes through a view whose format kind differs from its
texture's.
was undefined behaviour before.
LARECOMP_3D_RTkeeps 3D targets off and BC is native), other Malidrivers and multi-hour sessions are untested. The paths for non-power-of-two BC targets, 2D BC targets and a
format change of the drawing view are code-reviewed only; the game does not exercise them.
🤖 Generated with Claude Code