Selectable renderer implementation (#1247)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
mwilsnd
2023-06-26 15:49:48 -05:00
committed by Bart Louwers
parent fe165c8924
commit 1963697687
64 changed files with 1189 additions and 316 deletions

View File

@@ -87,24 +87,39 @@ void GeometryTileRenderData::upload(gfx::UploadPass& uploadPass) {
assert(atlasTextures);
if (layoutResult->glyphAtlasImage && layoutResult->glyphAtlasImage->valid()) {
#if MLN_DRAWABLE_RENDERER
atlasTextures->glyph = uploadPass.getContext().createTexture2D();
atlasTextures->glyph->setSamplerConfiguration(
{gfx::TextureFilterType::Linear, gfx::TextureWrapType::Clamp, gfx::TextureWrapType::Clamp});
atlasTextures->glyph->upload(*layoutResult->glyphAtlasImage);
#else
atlasTextures->glyph = uploadPass.createTexture(*layoutResult->glyphAtlasImage);
#endif
layoutResult->glyphAtlasImage = {};
}
if (layoutResult->iconAtlas.image.valid()) {
#if MLN_DRAWABLE_RENDERER
atlasTextures->icon = uploadPass.getContext().createTexture2D();
atlasTextures->icon->upload(layoutResult->iconAtlas.image);
#else
atlasTextures->icon = uploadPass.createTexture(layoutResult->iconAtlas.image);
#endif
layoutResult->iconAtlas.image = {};
}
if (atlasTextures->icon && !imagePatches.empty()) {
for (const auto& imagePatch : imagePatches) { // patch updated images.
#if MLN_DRAWABLE_RENDERER
atlasTextures->icon->uploadSubRegion(imagePatch.image->image,
imagePatch.paddedRect.x + ImagePosition::padding,
imagePatch.paddedRect.y + ImagePosition::padding);
#else
uploadPass.updateTextureSub(*atlasTextures->icon,
imagePatch.image->image,
imagePatch.paddedRect.x + ImagePosition::padding,
imagePatch.paddedRect.y + ImagePosition::padding);
#endif
}
imagePatches.clear();
}