From 1c30b1bbf7319cbe2bcc163c7cfab61be0425931 Mon Sep 17 00:00:00 2001 From: Jorijn van der Graaf Date: Sun, 18 Oct 2026 03:28:11 +0200 Subject: [PATCH] fix(font-atlas): wait for the GPU before the image goes; DOM stubs for SetAppId and SetTextInput ~FontAtlas destroyed the image while frames that sample it could still run (HelloUI declares the atlas after the window, so it goes first); it waits on the queue now, as the descriptor heap does. The DOM build got the two new Window methods as no-ops, like the other backend-specific ones. --- implementations/Crafter.Graphics-Window.cpp | 4 ++++ interfaces/Crafter.Graphics-FontAtlas.cppm | 10 ++++++---- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/implementations/Crafter.Graphics-Window.cpp b/implementations/Crafter.Graphics-Window.cpp index 9603065..e26022c 100644 --- a/implementations/Crafter.Graphics-Window.cpp +++ b/implementations/Crafter.Graphics-Window.cpp @@ -1640,6 +1640,10 @@ void Window::SetTitle(const std::string_view title) { Crafter::DomEnv::domSetTitle(title.data(), static_cast(title.size())); } +void Window::SetAppId(const std::string_view) {} + +void Window::SetTextInput(bool, std::int32_t, std::int32_t, std::int32_t, std::int32_t, TextInputPurpose) {} + void Window::Resize(std::uint32_t newWidth, std::uint32_t newHeight) { if (newWidth == 0 || newHeight == 0) return; if (newWidth == width && newHeight == height) return; diff --git a/interfaces/Crafter.Graphics-FontAtlas.cppm b/interfaces/Crafter.Graphics-FontAtlas.cppm index 732455d..f5f2ea1 100644 --- a/interfaces/Crafter.Graphics-FontAtlas.cppm +++ b/interfaces/Crafter.Graphics-FontAtlas.cppm @@ -100,11 +100,13 @@ export namespace Crafter { FontAtlas() = default; FontAtlas(const FontAtlas&) = delete; FontAtlas& operator=(const FontAtlas&) = delete; - // The image goes with the atlas. The owner waits for the GPU first - // and, in sets mode, destroys the heap holding the image's view before - // the atlas. + // The image goes with the atlas, once the GPU is done with it; in + // sets mode the owner destroys the heap holding the image's view + // before the atlas. ~FontAtlas() { - if (image.image != VK_NULL_HANDLE) image.Destroy(); + if (image.image == VK_NULL_HANDLE) return; + if (Device::queue != VK_NULL_HANDLE) vkQueueWaitIdle(Device::queue); + image.Destroy(); } #endif