summaryrefslogtreecommitdiff
path: root/src/mbgl/programs/fill_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/fill_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/fill_program.hpp')
-rw-r--r--src/mbgl/programs/fill_program.hpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/mbgl/programs/fill_program.hpp b/src/mbgl/programs/fill_program.hpp
index 9c623fee22..12544ec073 100644
--- a/src/mbgl/programs/fill_program.hpp
+++ b/src/mbgl/programs/fill_program.hpp
@@ -103,4 +103,17 @@ public:
using FillLayoutVertex = FillProgram::LayoutVertex;
using FillAttributes = FillProgram::Attributes;
+class FillLayerPrograms final : public LayerTypePrograms {
+public:
+ FillLayerPrograms(gl::Context& context, const ProgramParameters& programParameters)
+ : fill(context, programParameters),
+ fillPattern(context, programParameters),
+ fillOutline(context, programParameters),
+ fillOutlinePattern(context, programParameters) {}
+ ProgramMap<FillProgram> fill;
+ ProgramMap<FillPatternProgram> fillPattern;
+ ProgramMap<FillOutlineProgram> fillOutline;
+ ProgramMap<FillOutlinePatternProgram> fillOutlinePattern;
+};
+
} // namespace mbgl