Skip to content

Commit 2ccda4e

Browse files
author
devsh
committed
I've made a few boo boos
1 parent c5f9d77 commit 2ccda4e

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/nbl/ext/ImGui/ImGui.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,17 +390,23 @@ smart_refctd_ptr<IGPUImageView> UI::createFontAtlasTexture(const SCreationParame
390390
}
391391

392392
constexpr auto NBL_FORMAT_FONT = EF_R8G8B8A8_UNORM;
393+
394+
// CCustomAllocatorCPUBuffer is kinda crap and doesn't support stateful allocators
395+
uint8_t* pixels = nullptr;
396+
auto freeMemory = core::makeRAIIExiter([&pixels]()->void
397+
{
398+
if (pixels)
399+
IM_FREE(pixels);
400+
}
401+
);
393402

394403
// make buffer with image contents
395404
core::smart_refctd_ptr<ICPUImage> cpuImage;
396405
{
397-
uint8_t* pixels = nullptr;
398406
int32_t width, height;
399407
fontAtlas->GetTexDataAsRGBA32(&pixels, &width, &height);
400408
if (!pixels)
401409
return nullptr;
402-
// CCustomAllocatorCPUBuffer is kinda crap and doesn't support stateful allocators
403-
auto freeMemory = core::makeRAIIExiter([&pixels]()->void{IM_FREE(pixels);});
404410
if (width<=0 || height<=0)
405411
return nullptr;
406412
const asset::VkExtent3D extent = {static_cast<uint32_t>(width),static_cast<uint32_t>(height),1u};
@@ -447,6 +453,7 @@ smart_refctd_ptr<IGPUImageView> UI::createFontAtlasTexture(const SCreationParame
447453
logger.log("Could not set font ICPUImage contents!",ILogger::ELL_ERROR);
448454
return nullptr;
449455
}
456+
cpuImage->setContentHash(cpuImage->computeContentHash());
450457
}
451458

452459
// note its by default but you can still change it at runtime, both the texture & sampler id
@@ -513,7 +520,9 @@ smart_refctd_ptr<IGPUImageView> UI::createFontAtlasTexture(const SCreationParame
513520
CAssetConverter::SConvertParams params = {};
514521
params.transfer = &transfer;
515522
params.utilities = creationParams.utilities.get();
523+
queue->startCapture();
516524
auto result = reservation.convert(params);
525+
queue->endCapture();
517526
// block immediately
518527
if (result.copy()!=IQueue::RESULT::SUCCESS)
519528
{

0 commit comments

Comments
 (0)