Compare commits

...

3 Commits

Author SHA1 Message Date
Green Sky
9e9a270550 more error checking around images, should prevent vram leaks
Some checks failed
ContinuousDelivery / linux-ubuntu (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousDelivery / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousDelivery / windows (windows-2022, ) (push) Has been cancelled
ContinuousDelivery / windows (windows-2022, asan) (push) Has been cancelled
ContinuousIntegration / on ubuntu-24.04-arm (push) Has been cancelled
ContinuousIntegration / asan on ubuntu-24.04-arm (push) Has been cancelled
ContinuousIntegration / on ubuntu-latest (push) Has been cancelled
ContinuousIntegration / asan on ubuntu-latest (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:arm64-v8a vcpkg_toolkit:arm64-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:armeabi-v7a vcpkg_toolkit:arm-neon-android-23]) (push) Has been cancelled
ContinuousIntegration / android (map[ndk_abi:x86_64 vcpkg_toolkit:x64-android-23]) (push) Has been cancelled
ContinuousIntegration / macos (push) Has been cancelled
ContinuousIntegration / windows (push) Has been cancelled
ContinuousDelivery / dumpsyms (push) Has been cancelled
ContinuousDelivery / release (push) Has been cancelled
2025-10-09 18:11:06 +02:00
Green Sky
f9667430b9 update imgui in nix flake 2025-10-09 16:16:46 +02:00
Green Sky
9d7800bb4f correctly handle partically correct webp 2025-10-09 16:16:25 +02:00
5 changed files with 19 additions and 6 deletions

8
flake.lock generated
View File

@@ -21,17 +21,17 @@
"imgui": { "imgui": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1752080038, "lastModified": 1758128722,
"narHash": "sha256-m5h/H8k/CZ5Qwr3L9+Elt8XT/Tgwr3s4HuhVtI4wkwE=", "narHash": "sha256-J+h7jJ+4wqr6RivtzyTDMXKxFoGs7dQbzqdu51XgEbc=",
"owner": "ocornut", "owner": "ocornut",
"repo": "imgui", "repo": "imgui",
"rev": "5d4126876bc10396d4c6511853ff10964414c776", "rev": "bf75bfec48fc00f532af8926130b70c0e26eb099",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "ocornut", "owner": "ocornut",
"repo": "imgui", "repo": "imgui",
"rev": "5d4126876bc10396d4c6511853ff10964414c776", "rev": "bf75bfec48fc00f532af8926130b70c0e26eb099",
"type": "github" "type": "github"
} }
}, },

View File

@@ -21,7 +21,7 @@
flake = false; flake = false;
}; };
imgui = { imgui = {
url = "github:ocornut/imgui/5d4126876bc10396d4c6511853ff10964414c776"; url = "github:ocornut/imgui/bf75bfec48fc00f532af8926130b70c0e26eb099";
flake = false; flake = false;
}; };
plutosvg = { plutosvg = {

View File

@@ -70,7 +70,10 @@ ImageLoaderWebP::ImageResult ImageLoaderWebP::loadFromMemoryRGBA(const uint8_t*
while (WebPAnimDecoderHasMoreFrames(dec.get())) { while (WebPAnimDecoderHasMoreFrames(dec.get())) {
uint8_t* buf; uint8_t* buf;
int timestamp; int timestamp;
WebPAnimDecoderGetNext(dec.get(), &buf, &timestamp); if (WebPAnimDecoderGetNext(dec.get(), &buf, &timestamp) == 0 || buf == nullptr) {
// error out with empty res
return {};
}
// ... (Render 'buf' based on 'timestamp'). // ... (Render 'buf' based on 'timestamp').
// ... (Do NOT free 'buf', as it is owned by 'dec'). // ... (Do NOT free 'buf', as it is owned by 'dec').

View File

@@ -103,10 +103,17 @@ TextureLoaderResult MessageImageLoader::load(TextureUploaderI& tu, Message3Handl
new_entry.current_texture = 0; new_entry.current_texture = 0;
for (const auto& [ms, data] : res.frames) { for (const auto& [ms, data] : res.frames) {
const auto n_t = tu.upload(data.data(), res.width, res.height); const auto n_t = tu.upload(data.data(), res.width, res.height);
if (n_t == 0) {
continue;
}
new_entry.textures.push_back(n_t); new_entry.textures.push_back(n_t);
new_entry.frame_duration.push_back(ms); new_entry.frame_duration.push_back(ms);
} }
if (new_entry.textures.empty()) {
continue;
}
new_entry.width = res.width; new_entry.width = res.width;
new_entry.height = res.height; new_entry.height = res.height;

View File

@@ -116,6 +116,9 @@ struct TextureCache {
_tu.destroy(tex_id); _tu.destroy(tex_id);
} }
} }
for (const auto& tex_id : _default_texture.textures) {
_tu.destroy(tex_id);
}
} }
struct GetInfo { struct GetInfo {