Files
MapLibreParticleLab/src/mbgl/renderer/render_static_data.hpp
Konstantin Käfer a876c965a5 [core] Store SegmentVectors in ephemeral render objects
We used some shared SegmentVectors, e.g. for drawing raster or background tiles.
In longer running maps, this lead to resource accumulation. By storing the SegmentVectors
and the contained gfx::DrawScope objects, we ensure that resources get released
when the associated render objects vanish.
2020-02-14 17:34:00 +02:00

53 lines
1.5 KiB
C++

#pragma once
#include <mbgl/gfx/vertex_buffer.hpp>
#include <mbgl/gfx/index_buffer.hpp>
#include <mbgl/gfx/renderbuffer.hpp>
#include <mbgl/programs/background_program.hpp>
#include <mbgl/programs/heatmap_texture_program.hpp>
#include <mbgl/programs/programs.hpp>
#include <mbgl/programs/raster_program.hpp>
#include <mbgl/util/optional.hpp>
#include <string>
namespace mbgl {
namespace gfx {
class Context;
class UploadPass;
} // namespace gfx
class RenderStaticData {
public:
RenderStaticData(gfx::Context&, float pixelRatio);
void upload(gfx::UploadPass&);
optional<gfx::VertexBuffer<gfx::Vertex<PositionOnlyLayoutAttributes>>> tileVertexBuffer;
optional<gfx::VertexBuffer<RasterLayoutVertex>> rasterVertexBuffer;
optional<gfx::VertexBuffer<HeatmapTextureLayoutVertex>> heatmapTextureVertexBuffer;
optional<gfx::IndexBuffer> quadTriangleIndexBuffer;
optional<gfx::IndexBuffer> tileBorderIndexBuffer;
static SegmentVector<BackgroundAttributes> tileTriangleSegments();
static SegmentVector<DebugAttributes> tileBorderSegments();
static SegmentVector<RasterAttributes> rasterSegments();
static SegmentVector<HeatmapTextureAttributes> heatmapTextureSegments();
optional<gfx::Renderbuffer<gfx::RenderbufferPixelType::Depth>> depthRenderbuffer;
bool has3D = false;
bool uploaded = false;
Size backendSize;
Programs programs;
const SegmentVector<BackgroundAttributes> clippingMaskSegments;
#ifndef NDEBUG
Programs overdrawPrograms;
#endif
};
} // namespace mbgl