Make TempImage act a bit more robustly.

This commit is contained in:
Henrik Rydgård committed 2026-09-29 10:16:08 -06:00
1 parent 24017a1ba4
commit 52a16ea365
2 files changed
+7 -6

No files matched your search

-5
View File
@@ -54,11 +54,6 @@ private:
ManagedTexture::LoadState *state_;
};
TempImage::~TempImage() {
// Make sure you haven't forgotten to call Free.
_dbg_assert_(levels[0] == nullptr);
}
static Draw::DataFormat ZimToT3DFormat(int zim) {
switch (zim) {
case ZIM_RGBA8888: return Draw::DataFormat::R8G8B8A8_UNORM;
+7 -1
View File
@@ -23,7 +23,13 @@ class LimitedWaitable;
// The reason for the separation is so that the image can be loaded and decompressed on a thread,
// and then only uploaded to the GPU on the main thread.
struct TempImage {
~TempImage();
TempImage() = default;
// Owns levels[0], so no copies.
TempImage(const TempImage &) = delete;
TempImage &operator=(const TempImage &) = delete;
~TempImage() {
Free();
}
Draw::DataFormat fmt = Draw::DataFormat::UNDEFINED;
ImageFileType type = ImageFileType::UNKNOWN;
uint8_t *levels[16]{}; // only free the first pointer, they all point to the same buffer.