From ccc31ad562fea954fc59514f65eab2ced0d6dc02 Mon Sep 17 00:00:00 2001 From: chrg6 Date: Tue, 10 Nov 2026 23:26:45 -0500 Subject: [PATCH] Forget a texture's content hash when what reached its image is not its storage: zeros for storage released mid-upload, or nothing after a failed GPU ASTC decode. With the hash kept, the same bytes written there again were skipped as unchanged and the image stayed wrong. A texture whose decode failed is still not uploaded again until its storage is written; that part stays open. Co-Authored-By: Claude Fable 5.2 --- runtime/vk_texture.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runtime/vk_texture.c b/runtime/vk_texture.c index 5c0d7974..b964197b 100644 --- a/runtime/vk_texture.c +++ b/runtime/vk_texture.c @@ -2347,6 +2347,8 @@ static void upload(Tex *e) { static volatile int32_t n_gone; log_limited(&n_gone, "texture %#llx (%llu bytes): storage released during the upload; uploaded as zeros", (unsigned long long)e->pub.addr, (unsigned long long)e->t.L.size); + // the image holds zeros, not the bytes hashed above: the same bytes mapped back there upload again + e->chash_ok = 0; } if (gdsw && !sk) { if (held) memcpy(stg, t->mem, size); @@ -2416,9 +2418,11 @@ static void upload(Tex *e) { e->pub.image, e->pub.aspect, rbuf); perf_end(PERF_ASTC, a0); vk_texstat_time(VK_TS_ASTC, a0); - if (!checked) + if (!checked) { log_limited(&n_undecoded, "ASTC texture %#llx (fmt %#x %ux%u) not decoded on the GPU: left as it was", (unsigned long long)e->pub.addr, d->format, d->width, d->height); + e->chash_ok = 0; // the image does not hold the bytes hashed above: the next write uploads, equal or not + } } else { for (k = k0; k < k1; k++) rg[k].bufferOffset += soff; vkCmdCopyBufferToImage(cb, sb, e->pub.image, VK_IMAGE_LAYOUT_GENERAL, k1 - k0, rg + k0);