Skip to content

Commit a2450b3

Browse files
committed
Work on fixing issues
1 parent 4ce9d98 commit a2450b3

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/nbl/ext/TextRendering/TextRendering.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,17 @@ core::smart_refctd_ptr<ICPUImage> TextRenderer::generateShapeMSDF(msdfgen::Shape
3030

3131
msdfgen::generateMTSDF(msdfMap, glyph, msdfPixelRange, { scale.x, scale.y }, { translate.x, translate.y });
3232

33-
auto cpuBuf = core::make_smart_refctd_ptr<ICPUBuffer>(glyphW * glyphH * sizeof(int8_t) * 4);
34-
int8_t* data = reinterpret_cast<int8_t*>(cpuBuf->getPointer());
33+
34+
asset::ICPUImage::SCreationParams creationParams;
35+
creationParams.type = asset::IImage::ET_2D;
36+
creationParams.samples = asset::IImage::ESCF_1_BIT;
37+
creationParams.format = TextRenderer::MSDFTextureFormat;
38+
creationParams.extent = { msdfExtents.x, msdfExtents.y, 1 };
39+
creationParams.mipLevels = msdfMipLevels;
40+
creationParams.arrayLayers = 1;
41+
auto image = asset::ICPUImage::create(std::move(creationParams));
42+
43+
int8_t* data = reinterpret_cast<int8_t*>(image->getBuffer()->getPointer());
3544

3645
auto floatToSNORM8 = [](const float fl) -> int8_t
3746
{
@@ -51,7 +60,7 @@ core::smart_refctd_ptr<ICPUImage> TextRenderer::generateShapeMSDF(msdfgen::Shape
5160
}
5261
}
5362

54-
return std::move(cpuBuf);
63+
return std::move(image);
5564
}
5665

5766
constexpr double FreeTypeFontScaling = 1.0 / 64.0;

0 commit comments

Comments
 (0)