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.
53 lines
1.5 KiB
C++
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
|