summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2019-04-02 14:11:37 +0200
committerKonstantin Käfer <mail@kkaefer.com>2019-05-28 16:11:05 +0200
commit7f9274035bad30980e03574c315904ab7a85fe83 (patch)
tree7b9cd0f2e2883d6da22611eaa68fae07bb7245b6 /src
parent33ee7e23de24bd3c076eafef819029cf45451d23 (diff)
downloadqtlocation-mapboxgl-7f9274035bad30980e03574c315904ab7a85fe83.tar.gz
[core] refactor program object creation
Diffstat (limited to 'src')
-rw-r--r--src/core-files.json2
-rw-r--r--src/mbgl/gfx/context.hpp14
-rw-r--r--src/mbgl/gfx/context_impl.hpp23
-rw-r--r--src/mbgl/gfx/types.hpp4
-rw-r--r--src/mbgl/gl/context.cpp2
-rw-r--r--src/mbgl/gl/renderer_backend.cpp32
-rw-r--r--src/mbgl/programs/background_program.cpp4
-rw-r--r--src/mbgl/programs/circle_program.cpp3
-rw-r--r--src/mbgl/programs/clipping_mask_program.cpp3
-rw-r--r--src/mbgl/programs/collision_box_program.cpp4
-rw-r--r--src/mbgl/programs/debug_program.cpp3
-rw-r--r--src/mbgl/programs/fill_extrusion_program.cpp4
-rw-r--r--src/mbgl/programs/fill_program.cpp6
-rw-r--r--src/mbgl/programs/gl/background.cpp4
-rw-r--r--src/mbgl/programs/gl/background_pattern.cpp4
-rw-r--r--src/mbgl/programs/gl/circle.cpp4
-rw-r--r--src/mbgl/programs/gl/clipping_mask.cpp4
-rw-r--r--src/mbgl/programs/gl/collision_box.cpp4
-rw-r--r--src/mbgl/programs/gl/collision_circle.cpp4
-rw-r--r--src/mbgl/programs/gl/debug.cpp4
-rw-r--r--src/mbgl/programs/gl/fill.cpp4
-rw-r--r--src/mbgl/programs/gl/fill_extrusion.cpp4
-rw-r--r--src/mbgl/programs/gl/fill_extrusion_pattern.cpp4
-rw-r--r--src/mbgl/programs/gl/fill_outline.cpp4
-rw-r--r--src/mbgl/programs/gl/fill_outline_pattern.cpp4
-rw-r--r--src/mbgl/programs/gl/fill_pattern.cpp4
-rw-r--r--src/mbgl/programs/gl/heatmap.cpp4
-rw-r--r--src/mbgl/programs/gl/heatmap_texture.cpp4
-rw-r--r--src/mbgl/programs/gl/hillshade.cpp4
-rw-r--r--src/mbgl/programs/gl/hillshade_prepare.cpp4
-rw-r--r--src/mbgl/programs/gl/line.cpp4
-rw-r--r--src/mbgl/programs/gl/line_gradient.cpp4
-rw-r--r--src/mbgl/programs/gl/line_pattern.cpp4
-rw-r--r--src/mbgl/programs/gl/line_sdf.cpp4
-rw-r--r--src/mbgl/programs/gl/raster.cpp4
-rw-r--r--src/mbgl/programs/gl/symbol_icon.cpp4
-rw-r--r--src/mbgl/programs/gl/symbol_sdf_icon.cpp4
-rw-r--r--src/mbgl/programs/gl/symbol_sdf_text.cpp4
-rw-r--r--src/mbgl/programs/heatmap_program.cpp3
-rw-r--r--src/mbgl/programs/heatmap_texture_program.cpp3
-rw-r--r--src/mbgl/programs/hillshade_prepare_program.cpp3
-rw-r--r--src/mbgl/programs/hillshade_program.cpp3
-rw-r--r--src/mbgl/programs/line_program.cpp6
-rw-r--r--src/mbgl/programs/raster_program.cpp3
-rw-r--r--src/mbgl/programs/symbol_program.cpp5
45 files changed, 72 insertions, 158 deletions
diff --git a/src/core-files.json b/src/core-files.json
index 05870661db..eb581f7959 100644
--- a/src/core-files.json
+++ b/src/core-files.json
@@ -321,6 +321,7 @@
"mbgl/actor/message.hpp": "include/mbgl/actor/message.hpp",
"mbgl/actor/scheduler.hpp": "include/mbgl/actor/scheduler.hpp",
"mbgl/annotation/annotation.hpp": "include/mbgl/annotation/annotation.hpp",
+ "mbgl/gfx/backend.hpp": "include/mbgl/gfx/backend.hpp",
"mbgl/gfx/backend_scope.hpp": "include/mbgl/gfx/backend_scope.hpp",
"mbgl/gfx/renderable.hpp": "include/mbgl/gfx/renderable.hpp",
"mbgl/gfx/renderer_backend.hpp": "include/mbgl/gfx/renderer_backend.hpp",
@@ -513,7 +514,6 @@
"mbgl/gfx/color_mode.hpp": "src/mbgl/gfx/color_mode.hpp",
"mbgl/gfx/command_encoder.hpp": "src/mbgl/gfx/command_encoder.hpp",
"mbgl/gfx/context.hpp": "src/mbgl/gfx/context.hpp",
- "mbgl/gfx/context_impl.hpp": "src/mbgl/gfx/context_impl.hpp",
"mbgl/gfx/cull_face_mode.hpp": "src/mbgl/gfx/cull_face_mode.hpp",
"mbgl/gfx/debug_group.hpp": "src/mbgl/gfx/debug_group.hpp",
"mbgl/gfx/depth_mode.hpp": "src/mbgl/gfx/depth_mode.hpp",
diff --git a/src/mbgl/gfx/context.hpp b/src/mbgl/gfx/context.hpp
index 118df30a26..53cd318642 100644
--- a/src/mbgl/gfx/context.hpp
+++ b/src/mbgl/gfx/context.hpp
@@ -1,5 +1,6 @@
#pragma once
+#include <mbgl/gfx/backend.hpp>
#include <mbgl/gfx/renderbuffer.hpp>
#include <mbgl/gfx/command_encoder.hpp>
#include <mbgl/gfx/draw_scope.hpp>
@@ -17,12 +18,11 @@ class OffscreenTexture;
class Context {
protected:
- Context(ContextType type_, uint32_t maximumVertexBindingCount_)
- : backend(type_), maximumVertexBindingCount(maximumVertexBindingCount_) {
+ Context(uint32_t maximumVertexBindingCount_)
+ : maximumVertexBindingCount(maximumVertexBindingCount_) {
}
public:
- const ContextType backend;
static constexpr const uint32_t minimumRequiredVertexBindingCount = 8;
const uint32_t maximumVertexBindingCount;
bool supportsHalfFloatTextures = false;
@@ -80,11 +80,9 @@ protected:
public:
template <typename Name>
- std::unique_ptr<Program<Name>> createProgram(const ProgramParameters&);
-
-private:
- template <typename Backend, typename Name>
- std::unique_ptr<Program<Name>> createProgram(const ProgramParameters&);
+ std::unique_ptr<Program<Name>> createProgram(const ProgramParameters& programParameters) {
+ return Backend::Create<Program<Name>, const ProgramParameters&>(programParameters);
+ }
public:
virtual std::unique_ptr<CommandEncoder> createCommandEncoder() = 0;
diff --git a/src/mbgl/gfx/context_impl.hpp b/src/mbgl/gfx/context_impl.hpp
deleted file mode 100644
index 0145535bb3..0000000000
--- a/src/mbgl/gfx/context_impl.hpp
+++ /dev/null
@@ -1,23 +0,0 @@
-#pragma once
-
-#include <mbgl/gfx/context.hpp>
-
-namespace mbgl {
-
-namespace gl {
-class Context;
-} // namespace gl
-
-namespace gfx {
-
-template <typename Name>
-std::unique_ptr<Program<Name>> Context::createProgram(const ProgramParameters& programParameters) {
- if (backend == ContextType::OpenGL) {
- return createProgram<gl::Context, Name>(programParameters);
- }
- assert(false);
- return nullptr;
-}
-
-} // namespace gfx
-} // namespace mbgl
diff --git a/src/mbgl/gfx/types.hpp b/src/mbgl/gfx/types.hpp
index 24209c5cc5..cafb2f3f84 100644
--- a/src/mbgl/gfx/types.hpp
+++ b/src/mbgl/gfx/types.hpp
@@ -5,10 +5,6 @@
namespace mbgl {
namespace gfx {
-enum class ContextType : uint8_t {
- OpenGL,
-};
-
enum class PrimitiveType : uint8_t {
Point,
Line,
diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp
index 436e1f6a61..626e1f4b66 100644
--- a/src/mbgl/gl/context.cpp
+++ b/src/mbgl/gl/context.cpp
@@ -50,7 +50,7 @@ static_assert(underlying_type(UniformDataType::Sampler2D) == GL_SAMPLER_2D, "Ope
static_assert(underlying_type(UniformDataType::SamplerCube) == GL_SAMPLER_CUBE, "OpenGL type mismatch");
Context::Context(RendererBackend& backend_)
- : gfx::Context(gfx::ContextType::OpenGL, [] {
+ : gfx::Context([] {
GLint value;
MBGL_CHECK_ERROR(glGetIntegerv(GL_MAX_VERTEX_ATTRIBS, &value));
return value;
diff --git a/src/mbgl/gl/renderer_backend.cpp b/src/mbgl/gl/renderer_backend.cpp
index 9da6ceb589..fe0ca4b5b2 100644
--- a/src/mbgl/gl/renderer_backend.cpp
+++ b/src/mbgl/gl/renderer_backend.cpp
@@ -21,50 +21,46 @@ std::unique_ptr<gfx::Context> RendererBackend::createContext() {
return std::move(result);
}
-gl::Context& RendererBackend::getGLContext() {
- return static_cast<gl::Context&>(getContext());
-}
-
PremultipliedImage RendererBackend::readFramebuffer(const Size& size) {
- return getGLContext().readFramebuffer<PremultipliedImage>(size);
+ return getContext<gl::Context>().readFramebuffer<PremultipliedImage>(size);
}
void RendererBackend::assumeFramebufferBinding(const gl::FramebufferID fbo) {
- getGLContext().bindFramebuffer.setCurrentValue(fbo);
+ getContext<gl::Context>().bindFramebuffer.setCurrentValue(fbo);
if (fbo != ImplicitFramebufferBinding) {
- assert(gl::value::BindFramebuffer::Get() == getGLContext().bindFramebuffer.getCurrentValue());
+ assert(gl::value::BindFramebuffer::Get() == getContext<gl::Context>().bindFramebuffer.getCurrentValue());
}
}
void RendererBackend::assumeViewport(int32_t x, int32_t y, const Size& size) {
- getGLContext().viewport.setCurrentValue({ x, y, size });
- assert(gl::value::Viewport::Get() == getGLContext().viewport.getCurrentValue());
+ getContext<gl::Context>().viewport.setCurrentValue({ x, y, size });
+ assert(gl::value::Viewport::Get() == getContext<gl::Context>().viewport.getCurrentValue());
}
void RendererBackend::assumeScissorTest(bool enabled) {
- getGLContext().scissorTest.setCurrentValue(enabled);
- assert(gl::value::ScissorTest::Get() == getGLContext().scissorTest.getCurrentValue());
+ getContext<gl::Context>().scissorTest.setCurrentValue(enabled);
+ assert(gl::value::ScissorTest::Get() == getContext<gl::Context>().scissorTest.getCurrentValue());
}
bool RendererBackend::implicitFramebufferBound() {
- return getGLContext().bindFramebuffer.getCurrentValue() == ImplicitFramebufferBinding;
+ return getContext<gl::Context>().bindFramebuffer.getCurrentValue() == ImplicitFramebufferBinding;
}
void RendererBackend::setFramebufferBinding(const gl::FramebufferID fbo) {
- getGLContext().bindFramebuffer = fbo;
+ getContext<gl::Context>().bindFramebuffer = fbo;
if (fbo != ImplicitFramebufferBinding) {
- assert(gl::value::BindFramebuffer::Get() == getGLContext().bindFramebuffer.getCurrentValue());
+ assert(gl::value::BindFramebuffer::Get() == getContext<gl::Context>().bindFramebuffer.getCurrentValue());
}
}
void RendererBackend::setViewport(int32_t x, int32_t y, const Size& size) {
- getGLContext().viewport = { x, y, size };
- assert(gl::value::Viewport::Get() == getGLContext().viewport.getCurrentValue());
+ getContext<gl::Context>().viewport = { x, y, size };
+ assert(gl::value::Viewport::Get() == getContext<gl::Context>().viewport.getCurrentValue());
}
void RendererBackend::setScissorTest(bool enabled) {
- getGLContext().scissorTest = enabled;
- assert(gl::value::ScissorTest::Get() == getGLContext().scissorTest.getCurrentValue());
+ getContext<gl::Context>().scissorTest = enabled;
+ assert(gl::value::ScissorTest::Get() == getContext<gl::Context>().scissorTest.getCurrentValue());
}
RendererBackend::~RendererBackend() = default;
diff --git a/src/mbgl/programs/background_program.cpp b/src/mbgl/programs/background_program.cpp
index 772d481578..edabce8ee3 100644
--- a/src/mbgl/programs/background_program.cpp
+++ b/src/mbgl/programs/background_program.cpp
@@ -1,5 +1,4 @@
#include <mbgl/programs/background_program.hpp>
-#include <mbgl/gfx/context_impl.hpp>
#include <mbgl/renderer/image_atlas.hpp>
#include <mbgl/renderer/cross_faded_property_evaluator.hpp>
#include <mbgl/tile/tile_id.hpp>
@@ -7,9 +6,6 @@
namespace mbgl {
-template std::unique_ptr<gfx::Program<BackgroundProgram>> gfx::Context::createProgram(const ProgramParameters&);
-template std::unique_ptr<gfx::Program<BackgroundPatternProgram>> gfx::Context::createProgram(const ProgramParameters&);
-
using namespace style;
static_assert(sizeof(BackgroundLayoutVertex) == 4, "expected BackgroundLayoutVertex size");
diff --git a/src/mbgl/programs/circle_program.cpp b/src/mbgl/programs/circle_program.cpp
index 577410d94e..99b47dd5c0 100644
--- a/src/mbgl/programs/circle_program.cpp
+++ b/src/mbgl/programs/circle_program.cpp
@@ -1,10 +1,7 @@
#include <mbgl/programs/circle_program.hpp>
-#include <mbgl/gfx/context_impl.hpp>
namespace mbgl {
-template std::unique_ptr<gfx::Program<CircleProgram>> gfx::Context::createProgram(const ProgramParameters&);
-
static_assert(sizeof(CircleLayoutVertex) == 4, "expected CircleLayoutVertex size");
} // namespace mbgl
diff --git a/src/mbgl/programs/clipping_mask_program.cpp b/src/mbgl/programs/clipping_mask_program.cpp
index 9b1a9ef4fc..aca7605037 100644
--- a/src/mbgl/programs/clipping_mask_program.cpp
+++ b/src/mbgl/programs/clipping_mask_program.cpp
@@ -1,8 +1,5 @@
#include <mbgl/programs/clipping_mask_program.hpp>
-#include <mbgl/gfx/context_impl.hpp>
namespace mbgl {
-template std::unique_ptr<gfx::Program<ClippingMaskProgram>> gfx::Context::createProgram(const ProgramParameters&);
-
} // namespace mbgl
diff --git a/src/mbgl/programs/collision_box_program.cpp b/src/mbgl/programs/collision_box_program.cpp
index 885894526e..584013640e 100644
--- a/src/mbgl/programs/collision_box_program.cpp
+++ b/src/mbgl/programs/collision_box_program.cpp
@@ -1,11 +1,7 @@
#include <mbgl/programs/collision_box_program.hpp>
-#include <mbgl/gfx/context_impl.hpp>
namespace mbgl {
-template std::unique_ptr<gfx::Program<CollisionBoxProgram>> gfx::Context::createProgram(const ProgramParameters&);
-template std::unique_ptr<gfx::Program<CollisionCircleProgram>> gfx::Context::createProgram(const ProgramParameters&);
-
static_assert(sizeof(CollisionBoxProgram::LayoutVertex) == 24, "expected CollisionBoxVertex size");
} // namespace mbgl
diff --git a/src/mbgl/programs/debug_program.cpp b/src/mbgl/programs/debug_program.cpp
index 9b8df789e4..3396e74872 100644
--- a/src/mbgl/programs/debug_program.cpp
+++ b/src/mbgl/programs/debug_program.cpp
@@ -1,8 +1,5 @@
#include <mbgl/programs/debug_program.hpp>
-#include <mbgl/gfx/context_impl.hpp>
namespace mbgl {
-template std::unique_ptr<gfx::Program<DebugProgram>> gfx::Context::createProgram(const ProgramParameters&);
-
} // namespace mbgl
diff --git a/src/mbgl/programs/fill_extrusion_program.cpp b/src/mbgl/programs/fill_extrusion_program.cpp
index 09da6931b6..d22e911589 100644
--- a/src/mbgl/programs/fill_extrusion_program.cpp
+++ b/src/mbgl/programs/fill_extrusion_program.cpp
@@ -1,5 +1,4 @@
#include <mbgl/programs/fill_extrusion_program.hpp>
-#include <mbgl/gfx/context_impl.hpp>
#include <mbgl/renderer/image_atlas.hpp>
#include <mbgl/renderer/cross_faded_property_evaluator.hpp>
#include <mbgl/tile/tile_id.hpp>
@@ -8,9 +7,6 @@
namespace mbgl {
-template std::unique_ptr<gfx::Program<FillExtrusionProgram>> gfx::Context::createProgram(const ProgramParameters&);
-template std::unique_ptr<gfx::Program<FillExtrusionPatternProgram>> gfx::Context::createProgram(const ProgramParameters&);
-
using namespace style;
static_assert(sizeof(FillExtrusionLayoutVertex) == 12, "expected FillExtrusionLayoutVertex size");
diff --git a/src/mbgl/programs/fill_program.cpp b/src/mbgl/programs/fill_program.cpp
index 703d61399f..f314fcc597 100644
--- a/src/mbgl/programs/fill_program.cpp
+++ b/src/mbgl/programs/fill_program.cpp
@@ -1,5 +1,4 @@
#include <mbgl/programs/fill_program.hpp>
-#include <mbgl/gfx/context_impl.hpp>
#include <mbgl/renderer/image_atlas.hpp>
#include <mbgl/renderer/cross_faded_property_evaluator.hpp>
#include <mbgl/tile/tile_id.hpp>
@@ -7,11 +6,6 @@
namespace mbgl {
-template std::unique_ptr<gfx::Program<FillProgram>> gfx::Context::createProgram(const ProgramParameters&);
-template std::unique_ptr<gfx::Program<FillPatternProgram>> gfx::Context::createProgram(const ProgramParameters&);
-template std::unique_ptr<gfx::Program<FillOutlineProgram>> gfx::Context::createProgram(const ProgramParameters&);
-template std::unique_ptr<gfx::Program<FillOutlinePatternProgram>> gfx::Context::createProgram(const ProgramParameters&);
-
using namespace style;
static_assert(sizeof(FillLayoutVertex) == 4, "expected FillLayoutVertex size");
diff --git a/src/mbgl/programs/gl/background.cpp b/src/mbgl/programs/gl/background.cpp
index 78074d670f..f3d2cdfd90 100644
--- a/src/mbgl/programs/gl/background.cpp
+++ b/src/mbgl/programs/gl/background.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<BackgroundProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<BackgroundProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<BackgroundProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<BackgroundProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/background_pattern.cpp b/src/mbgl/programs/gl/background_pattern.cpp
index 04111c7abd..482814cbda 100644
--- a/src/mbgl/programs/gl/background_pattern.cpp
+++ b/src/mbgl/programs/gl/background_pattern.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<BackgroundPatternProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<BackgroundPatternProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<BackgroundPatternProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<BackgroundPatternProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/circle.cpp b/src/mbgl/programs/gl/circle.cpp
index 5cf7eef13c..bd86c0385a 100644
--- a/src/mbgl/programs/gl/circle.cpp
+++ b/src/mbgl/programs/gl/circle.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<CircleProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<CircleProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<CircleProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<CircleProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/clipping_mask.cpp b/src/mbgl/programs/gl/clipping_mask.cpp
index 1b6c7b51c5..2c53bc6070 100644
--- a/src/mbgl/programs/gl/clipping_mask.cpp
+++ b/src/mbgl/programs/gl/clipping_mask.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<ClippingMaskProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<ClippingMaskProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<ClippingMaskProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<ClippingMaskProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/collision_box.cpp b/src/mbgl/programs/gl/collision_box.cpp
index 89c4fe81ae..a3ad030f5c 100644
--- a/src/mbgl/programs/gl/collision_box.cpp
+++ b/src/mbgl/programs/gl/collision_box.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<CollisionBoxProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<CollisionBoxProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<CollisionBoxProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<CollisionBoxProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/collision_circle.cpp b/src/mbgl/programs/gl/collision_circle.cpp
index 96f5d68ce5..3878122f4b 100644
--- a/src/mbgl/programs/gl/collision_circle.cpp
+++ b/src/mbgl/programs/gl/collision_circle.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<CollisionCircleProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<CollisionCircleProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<CollisionCircleProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<CollisionCircleProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/debug.cpp b/src/mbgl/programs/gl/debug.cpp
index 2e5db36dac..9705fc4801 100644
--- a/src/mbgl/programs/gl/debug.cpp
+++ b/src/mbgl/programs/gl/debug.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<DebugProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<DebugProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<DebugProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<DebugProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/fill.cpp b/src/mbgl/programs/gl/fill.cpp
index 7a281c24ba..77c839850b 100644
--- a/src/mbgl/programs/gl/fill.cpp
+++ b/src/mbgl/programs/gl/fill.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<FillProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<FillProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<FillProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<FillProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/fill_extrusion.cpp b/src/mbgl/programs/gl/fill_extrusion.cpp
index d90988070a..87ef4858fc 100644
--- a/src/mbgl/programs/gl/fill_extrusion.cpp
+++ b/src/mbgl/programs/gl/fill_extrusion.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<FillExtrusionProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<FillExtrusionProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<FillExtrusionProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<FillExtrusionProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/fill_extrusion_pattern.cpp b/src/mbgl/programs/gl/fill_extrusion_pattern.cpp
index a6292b9fe1..1d330220e4 100644
--- a/src/mbgl/programs/gl/fill_extrusion_pattern.cpp
+++ b/src/mbgl/programs/gl/fill_extrusion_pattern.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<FillExtrusionPatternProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<FillExtrusionPatternProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<FillExtrusionPatternProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<FillExtrusionPatternProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/fill_outline.cpp b/src/mbgl/programs/gl/fill_outline.cpp
index 82d56710a7..efef689f91 100644
--- a/src/mbgl/programs/gl/fill_outline.cpp
+++ b/src/mbgl/programs/gl/fill_outline.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<FillOutlineProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<FillOutlineProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<FillOutlineProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<FillOutlineProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/fill_outline_pattern.cpp b/src/mbgl/programs/gl/fill_outline_pattern.cpp
index 7709991353..d526d5801d 100644
--- a/src/mbgl/programs/gl/fill_outline_pattern.cpp
+++ b/src/mbgl/programs/gl/fill_outline_pattern.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<FillOutlinePatternProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<FillOutlinePatternProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<FillOutlinePatternProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<FillOutlinePatternProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/fill_pattern.cpp b/src/mbgl/programs/gl/fill_pattern.cpp
index ff4f2045ac..0f62206f99 100644
--- a/src/mbgl/programs/gl/fill_pattern.cpp
+++ b/src/mbgl/programs/gl/fill_pattern.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<FillPatternProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<FillPatternProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<FillPatternProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<FillPatternProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/heatmap.cpp b/src/mbgl/programs/gl/heatmap.cpp
index 7685b568cb..41f804a37b 100644
--- a/src/mbgl/programs/gl/heatmap.cpp
+++ b/src/mbgl/programs/gl/heatmap.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<HeatmapProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<HeatmapProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<HeatmapProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<HeatmapProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/heatmap_texture.cpp b/src/mbgl/programs/gl/heatmap_texture.cpp
index 60ef68597d..a6583bfbb7 100644
--- a/src/mbgl/programs/gl/heatmap_texture.cpp
+++ b/src/mbgl/programs/gl/heatmap_texture.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<HeatmapTextureProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<HeatmapTextureProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<HeatmapTextureProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<HeatmapTextureProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/hillshade.cpp b/src/mbgl/programs/gl/hillshade.cpp
index f0579aaf8c..b0c2c95aa8 100644
--- a/src/mbgl/programs/gl/hillshade.cpp
+++ b/src/mbgl/programs/gl/hillshade.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<HillshadeProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<HillshadeProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<HillshadeProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<HillshadeProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/hillshade_prepare.cpp b/src/mbgl/programs/gl/hillshade_prepare.cpp
index f9cd84ca73..1aef64293b 100644
--- a/src/mbgl/programs/gl/hillshade_prepare.cpp
+++ b/src/mbgl/programs/gl/hillshade_prepare.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<HillshadePrepareProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<HillshadePrepareProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<HillshadePrepareProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<HillshadePrepareProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/line.cpp b/src/mbgl/programs/gl/line.cpp
index 9eea81f69b..58f626bf19 100644
--- a/src/mbgl/programs/gl/line.cpp
+++ b/src/mbgl/programs/gl/line.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<LineProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<LineProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<LineProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<LineProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/line_gradient.cpp b/src/mbgl/programs/gl/line_gradient.cpp
index 4e7ee93b92..c555b09932 100644
--- a/src/mbgl/programs/gl/line_gradient.cpp
+++ b/src/mbgl/programs/gl/line_gradient.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<LineGradientProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<LineGradientProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<LineGradientProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<LineGradientProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/line_pattern.cpp b/src/mbgl/programs/gl/line_pattern.cpp
index 24406abf3b..17ec324c11 100644
--- a/src/mbgl/programs/gl/line_pattern.cpp
+++ b/src/mbgl/programs/gl/line_pattern.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<LinePatternProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<LinePatternProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<LinePatternProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<LinePatternProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/line_sdf.cpp b/src/mbgl/programs/gl/line_sdf.cpp
index aa72823ae7..2d0a5faacd 100644
--- a/src/mbgl/programs/gl/line_sdf.cpp
+++ b/src/mbgl/programs/gl/line_sdf.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<LineSDFProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<LineSDFProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<LineSDFProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<LineSDFProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/raster.cpp b/src/mbgl/programs/gl/raster.cpp
index 98cfade1f5..f6ae3b5bc5 100644
--- a/src/mbgl/programs/gl/raster.cpp
+++ b/src/mbgl/programs/gl/raster.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<RasterProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<RasterProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<RasterProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<RasterProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/symbol_icon.cpp b/src/mbgl/programs/gl/symbol_icon.cpp
index cb896b4160..834bfc16d2 100644
--- a/src/mbgl/programs/gl/symbol_icon.cpp
+++ b/src/mbgl/programs/gl/symbol_icon.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<SymbolIconProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<SymbolIconProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<SymbolIconProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<SymbolIconProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/symbol_sdf_icon.cpp b/src/mbgl/programs/gl/symbol_sdf_icon.cpp
index a25754ffad..2daa1e860d 100644
--- a/src/mbgl/programs/gl/symbol_sdf_icon.cpp
+++ b/src/mbgl/programs/gl/symbol_sdf_icon.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<SymbolSDFIconProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<SymbolSDFIconProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<SymbolSDFIconProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<SymbolSDFIconProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/gl/symbol_sdf_text.cpp b/src/mbgl/programs/gl/symbol_sdf_text.cpp
index 9aec77043b..5750e7730c 100644
--- a/src/mbgl/programs/gl/symbol_sdf_text.cpp
+++ b/src/mbgl/programs/gl/symbol_sdf_text.cpp
@@ -29,8 +29,8 @@ constexpr const uint8_t ShaderSource<SymbolSDFTextProgram>::hash[8];
namespace gfx {
template <>
-std::unique_ptr<Program<SymbolSDFTextProgram>>
-Context::createProgram<gl::Context>(const ProgramParameters& programParameters) {
+std::unique_ptr<gfx::Program<SymbolSDFTextProgram>>
+Backend::Create<gfx::Backend::Type::OpenGL>(const ProgramParameters& programParameters) {
return std::make_unique<gl::Program<SymbolSDFTextProgram>>(programParameters);
}
diff --git a/src/mbgl/programs/heatmap_program.cpp b/src/mbgl/programs/heatmap_program.cpp
index 32c30ea313..67f84fbd52 100644
--- a/src/mbgl/programs/heatmap_program.cpp
+++ b/src/mbgl/programs/heatmap_program.cpp
@@ -1,10 +1,7 @@
#include <mbgl/programs/heatmap_program.hpp>
-#include <mbgl/gfx/context_impl.hpp>
namespace mbgl {
-template std::unique_ptr<gfx::Program<HeatmapProgram>> gfx::Context::createProgram(const ProgramParameters&);
-
static_assert(sizeof(HeatmapLayoutVertex) == 4, "expected HeatmapLayoutVertex size");
} // namespace mbgl
diff --git a/src/mbgl/programs/heatmap_texture_program.cpp b/src/mbgl/programs/heatmap_texture_program.cpp
index 04c5ff56a7..3b0e24eab8 100644
--- a/src/mbgl/programs/heatmap_texture_program.cpp
+++ b/src/mbgl/programs/heatmap_texture_program.cpp
@@ -1,10 +1,7 @@
#include <mbgl/programs/heatmap_texture_program.hpp>
-#include <mbgl/gfx/context_impl.hpp>
namespace mbgl {
-template std::unique_ptr<gfx::Program<HeatmapTextureProgram>> gfx::Context::createProgram(const ProgramParameters&);
-
static_assert(sizeof(HeatmapTextureLayoutVertex) == 4, "expected HeatmapTextureLayoutVertex size");
} // namespace mbgl
diff --git a/src/mbgl/programs/hillshade_prepare_program.cpp b/src/mbgl/programs/hillshade_prepare_program.cpp
index 5bbac9eaec..0c0446d3f5 100644
--- a/src/mbgl/programs/hillshade_prepare_program.cpp
+++ b/src/mbgl/programs/hillshade_prepare_program.cpp
@@ -1,10 +1,7 @@
#include <mbgl/programs/hillshade_prepare_program.hpp>
-#include <mbgl/gfx/context_impl.hpp>
namespace mbgl {
-template std::unique_ptr<gfx::Program<HillshadePrepareProgram>> gfx::Context::createProgram(const ProgramParameters&);
-
static_assert(sizeof(HillshadePrepareLayoutVertex) == 8, "expected HillshadeLayoutVertex size");
} // namespace mbgl
diff --git a/src/mbgl/programs/hillshade_program.cpp b/src/mbgl/programs/hillshade_program.cpp
index 31673afcd4..f054ad4b74 100644
--- a/src/mbgl/programs/hillshade_program.cpp
+++ b/src/mbgl/programs/hillshade_program.cpp
@@ -1,10 +1,7 @@
#include <mbgl/programs/hillshade_program.hpp>
-#include <mbgl/gfx/context_impl.hpp>
namespace mbgl {
-template std::unique_ptr<gfx::Program<HillshadeProgram>> gfx::Context::createProgram(const ProgramParameters&);
-
static_assert(sizeof(HillshadeLayoutVertex) == 8, "expected HillshadeLayoutVertex size");
} // namespace mbgl
diff --git a/src/mbgl/programs/line_program.cpp b/src/mbgl/programs/line_program.cpp
index cab1e7e6fd..40b4617c77 100644
--- a/src/mbgl/programs/line_program.cpp
+++ b/src/mbgl/programs/line_program.cpp
@@ -1,5 +1,4 @@
#include <mbgl/programs/line_program.hpp>
-#include <mbgl/gfx/context_impl.hpp>
#include <mbgl/style/layers/line_layer_properties.hpp>
#include <mbgl/renderer/render_tile.hpp>
#include <mbgl/renderer/image_atlas.hpp>
@@ -9,11 +8,6 @@
namespace mbgl {
-template std::unique_ptr<gfx::Program<LineProgram>> gfx::Context::createProgram(const ProgramParameters&);
-template std::unique_ptr<gfx::Program<LinePatternProgram>> gfx::Context::createProgram(const ProgramParameters&);
-template std::unique_ptr<gfx::Program<LineGradientProgram>> gfx::Context::createProgram(const ProgramParameters&);
-template std::unique_ptr<gfx::Program<LineSDFProgram>> gfx::Context::createProgram(const ProgramParameters&);
-
using namespace style;
static_assert(sizeof(LineLayoutVertex) == 12, "expected LineLayoutVertex size");
diff --git a/src/mbgl/programs/raster_program.cpp b/src/mbgl/programs/raster_program.cpp
index f3b1052284..6906903e6b 100644
--- a/src/mbgl/programs/raster_program.cpp
+++ b/src/mbgl/programs/raster_program.cpp
@@ -1,10 +1,7 @@
#include <mbgl/programs/raster_program.hpp>
-#include <mbgl/gfx/context_impl.hpp>
namespace mbgl {
-template std::unique_ptr<gfx::Program<RasterProgram>> gfx::Context::createProgram(const ProgramParameters&);
-
static_assert(sizeof(RasterLayoutVertex) == 8, "expected RasterLayoutVertex size");
} // namespace mbgl
diff --git a/src/mbgl/programs/symbol_program.cpp b/src/mbgl/programs/symbol_program.cpp
index 8a7dccd55e..3633bd7c2a 100644
--- a/src/mbgl/programs/symbol_program.cpp
+++ b/src/mbgl/programs/symbol_program.cpp
@@ -1,5 +1,4 @@
#include <mbgl/programs/symbol_program.hpp>
-#include <mbgl/gfx/context_impl.hpp>
#include <mbgl/renderer/render_tile.hpp>
#include <mbgl/map/transform_state.hpp>
#include <mbgl/style/layers/symbol_layer_impl.hpp>
@@ -10,10 +9,6 @@
namespace mbgl {
-template std::unique_ptr<gfx::Program<SymbolIconProgram>> gfx::Context::createProgram(const ProgramParameters&);
-template std::unique_ptr<gfx::Program<SymbolSDFTextProgram>> gfx::Context::createProgram(const ProgramParameters&);
-template std::unique_ptr<gfx::Program<SymbolSDFIconProgram>> gfx::Context::createProgram(const ProgramParameters&);
-
using namespace style;
static_assert(sizeof(SymbolLayoutVertex) == 16, "expected SymbolLayoutVertex size");