Upload a texture again when its ASTC decode had no memory, instead of leaving its image unfilled.

When the decoder's scratch buffer could not be allocated, the upload logged it and still counted the texture as
uploaded. The image of a new texture then held nothing, and nothing uploaded it again until the game next wrote its
storage, which for most textures is never.

vk_astc_record now tells that failure (-1) from the ones that cannot change, and the upload leaves such a texture as
not uploaded: the lookups try it again every 30 frames until a decode succeeds. A WriteTexels whose decode has no
memory is still only logged.

The memory probe forces one failed scratch request and checks that the texture is left alone during its wait, is
uploaded by the first lookup after it and then holds its blocks.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-11 04:48:36 -05:00
parent 147e8a02e3
commit 29eb7cf0a7
5 changed files with 90 additions and 11 deletions

View File

@@ -150,7 +150,7 @@ static int gpu_decode_ar(VkCtx *c, const uint8_t *src, size_t src_bytes, const V
vmaDestroyBuffer(c->vma, rb, ra), vmaDestroyBuffer(c->vma, ib, ia);
vk_defer_image(im.img, im.alloc);
vk_upload_flush(1);
return ok;
return ok > 0;
}
// The two regions as tight blocks: n0 blocks of level 0, then n1 of level 1.
@@ -240,7 +240,7 @@ static int gpu_bc(VkCtx *c, const uint8_t *blk, const size_t *n, const uint32_t
vmaDestroyBuffer(c->vma, ib, ia);
vk_defer_image(im.img, im.alloc);
vk_upload_flush(1);
return ok;
return ok > 0;
}
// One BC3 block to 16 RGBA8 texels, as the format defines it (565 endpoints widened by bit replication; the colour