summaryrefslogtreecommitdiff
path: root/src/mbgl/programs/background_program.hpp
diff options
context:
space:
mode:
authorMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2018-12-13 20:29:14 +0200
committerMikhail Pozdnyakov <mikhail.pozdnyakov@mapbox.com>2019-01-11 16:43:52 +0200
commitd37918c169b2f688c96fb766fc671066c88fc1a2 (patch)
tree20cdfe0a824bf128053aab7c8ad4f69676f66f49 /src/mbgl/programs/background_program.hpp
parent2bdab82dedf545b4272c534b067c68614d0355b7 (diff)
downloadqtlocation-mapboxgl-d37918c169b2f688c96fb766fc671066c88fc1a2.tar.gz
[core] Split layer type specific code in mbgl::Programs
Progams code for a certain layer type is encapsulted within a dedicated `<layer type>Programs` class, inherited from the generic base `LayerTypePrograms` class. `mbgl::Programs::get<layer type>Programs()` lazily initializes the layer type-specific programs code using pointer to the base class, which allows LTO to remove this code from binaries (if the corresponding `get<layer type>Programs()` method can never be invoked).
Diffstat (limited to 'src/mbgl/programs/background_program.hpp')
-rw-r--r--src/mbgl/programs/background_program.hpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mbgl/programs/background_program.hpp b/src/mbgl/programs/background_program.hpp
index 667db7792b..6f9ab2a200 100644
--- a/src/mbgl/programs/background_program.hpp
+++ b/src/mbgl/programs/background_program.hpp
@@ -80,4 +80,13 @@ public:
using BackgroundLayoutVertex = BackgroundProgram::LayoutVertex;
using BackgroundAttributes = BackgroundProgram::Attributes;
+class BackgroundLayerPrograms final : public LayerTypePrograms {
+public:
+ BackgroundLayerPrograms(gl::Context& context, const ProgramParameters& programParameters)
+ : background(context, programParameters),
+ backgroundPattern(context, programParameters) {}
+ BackgroundProgram background;
+ BackgroundPatternProgram backgroundPattern;
+};
+
} // namespace mbgl