diff --git a/src/mbgl/geometry/line_atlas.cpp b/src/mbgl/geometry/line_atlas.cpp index 02c2b311c..8a0b1f605 100644 --- a/src/mbgl/geometry/line_atlas.cpp +++ b/src/mbgl/geometry/line_atlas.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include #include #include @@ -206,15 +207,19 @@ DashPatternTexture::DashPatternTexture(const std::vector& from_, } void DashPatternTexture::upload(gfx::UploadPass& uploadPass) { - if (texture.is()) { - texture = uploadPass.createTexture(texture.get()); + if (std::holds_alternative(texture)) { + auto tempTexture = uploadPass.getContext().createTexture2D(); + tempTexture->upload(std::get(texture)); + tempTexture->setSamplerConfiguration( + {gfx::TextureFilterType::Linear, gfx::TextureWrapType::Repeat, gfx::TextureWrapType::Clamp}); + texture = std::move(tempTexture); } } gfx::TextureBinding DashPatternTexture::textureBinding() const { // The texture needs to have been uploaded already. - assert(texture.is()); - return {texture.get().getResource(), + assert(std::holds_alternative(texture)); + return {std::get(texture)->getResource(), gfx::TextureFilterType::Linear, gfx::TextureMipMapType::No, gfx::TextureWrapType::Repeat, @@ -222,7 +227,10 @@ gfx::TextureBinding DashPatternTexture::textureBinding() const { } Size DashPatternTexture::getSize() const { - return texture.match([](const auto& obj) { return obj.size; }); + if (std::holds_alternative(texture)) { + return std::get(texture).size; + } + return std::get(texture)->getSize(); } LineAtlas::LineAtlas() = default; diff --git a/src/mbgl/geometry/line_atlas.hpp b/src/mbgl/geometry/line_atlas.hpp index c65a94662..298c14bfd 100644 --- a/src/mbgl/geometry/line_atlas.hpp +++ b/src/mbgl/geometry/line_atlas.hpp @@ -1,13 +1,14 @@ #pragma once #include +#include +#include #include -#include #include #include #include -#include +#include namespace mbgl { @@ -54,7 +55,7 @@ public: private: LinePatternPos from, to; - variant texture; + std::variant texture; }; class LineAtlas { @@ -75,7 +76,7 @@ public: private: std::map textures; - // Stores a list of hashes of texture objcts that need uploading. + // Stores a list of hashes of texture objects that need uploading. std::vector needsUpload; };