From 2ccda4e6bd63c9e05fe61cf7d8a090d75d4af2e4 Mon Sep 17 00:00:00 2001 From: devsh Date: Wed, 16 Oct 2024 00:52:28 +0200 Subject: [PATCH] I've made a few boo boos --- src/nbl/ext/ImGui/ImGui.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/nbl/ext/ImGui/ImGui.cpp b/src/nbl/ext/ImGui/ImGui.cpp index e4924841d..35822895c 100644 --- a/src/nbl/ext/ImGui/ImGui.cpp +++ b/src/nbl/ext/ImGui/ImGui.cpp @@ -390,17 +390,23 @@ smart_refctd_ptr UI::createFontAtlasTexture(const SCreationParame } constexpr auto NBL_FORMAT_FONT = EF_R8G8B8A8_UNORM; + + // CCustomAllocatorCPUBuffer is kinda crap and doesn't support stateful allocators + uint8_t* pixels = nullptr; + auto freeMemory = core::makeRAIIExiter([&pixels]()->void + { + if (pixels) + IM_FREE(pixels); + } + ); // make buffer with image contents core::smart_refctd_ptr cpuImage; { - uint8_t* pixels = nullptr; int32_t width, height; fontAtlas->GetTexDataAsRGBA32(&pixels, &width, &height); if (!pixels) return nullptr; - // CCustomAllocatorCPUBuffer is kinda crap and doesn't support stateful allocators - auto freeMemory = core::makeRAIIExiter([&pixels]()->void{IM_FREE(pixels);}); if (width<=0 || height<=0) return nullptr; const asset::VkExtent3D extent = {static_cast(width),static_cast(height),1u}; @@ -447,6 +453,7 @@ smart_refctd_ptr UI::createFontAtlasTexture(const SCreationParame logger.log("Could not set font ICPUImage contents!",ILogger::ELL_ERROR); return nullptr; } + cpuImage->setContentHash(cpuImage->computeContentHash()); } // note its by default but you can still change it at runtime, both the texture & sampler id @@ -513,7 +520,9 @@ smart_refctd_ptr UI::createFontAtlasTexture(const SCreationParame CAssetConverter::SConvertParams params = {}; params.transfer = &transfer; params.utilities = creationParams.utilities.get(); + queue->startCapture(); auto result = reservation.convert(params); + queue->endCapture(); // block immediately if (result.copy()!=IQueue::RESULT::SUCCESS) {