VulkanSceneGraph icon indicating copy to clipboard operation
VulkanSceneGraph copied to clipboard

Unused tile geometry isn't deleted which leads to VRAM issues

Open levndev opened this issue 1 month ago • 3 comments

In the tile reader there is a map that keeps tiles alive to reuse their geometry, saving VRAM, but because of the ref_ptr those tiles are never deleted which overtime leads to VRAM filling completely in certain conditions, for example when an elevation layer is used.

So far changing

mutable std::map<dvec4, ref_ptr<VertexIndexDraw>> _geometryMap;

to

mutable std::map<dvec4, observer_ptr<VertexIndexDraw>> _geometryMap;

and adding a check for null in tile::createECEFTile:

    // check if reusable geometry exists already
    {
        std::scoped_lock<std::mutex> lock(_geometryMapMutex);
        if (auto itr = _geometryMap.find(geometryKey); itr != _geometryMap.end())
        {
            if (itr->second)
                vid = itr->second;
        }
    };

seemingly solves the problem with no observable side effects.

levndev avatar Nov 25 '25 09:11 levndev