[vulkan] Don't lose other sky cube faces

Because LoadImage uses Hunk_TempAlloc, the face images need to be copied
individually. Really, what's neeeded is to be able to load the image
data into a pre-allocated buffer (ideally, the staging buffer for
vulkan, but that's for later).
This commit is contained in:
Bill Currie 2021-04-25 08:38:48 +09:00
parent 40aa629ef8
commit 52168da93e

View file

@ -1630,12 +1630,18 @@ Vulkan_LoadSkys (const char *sky, vulkan_ctx_t *ctx)
continue;
}
}
sides[i] = tex;
//FIXME find a better way (also, assumes data and struct together)
sides[i] = malloc (ImageSize (tex, 1));
memcpy (sides[i], tex, ImageSize (tex, 1));
sides[i]->data = (byte *)(sides[i] + 1);
Sys_MaskPrintf (SYS_vulkan, "Loaded %s\n", name);
}
if (!failed) {
bctx->skybox_tex = Vulkan_LoadEnvSides (ctx, sides, sky);
}
for (i = 0; i < 6; i++) {
free (sides[i]);
}
}
if (bctx->skybox_tex) {
Sys_MaskPrintf (SYS_vulkan, "Skybox %s loaded\n", sky);