summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2019-03-21 15:30:13 +0100
committerKonstantin Käfer <mail@kkaefer.com>2019-03-21 16:23:44 +0100
commitf0f65a3331713873b2c54900c7ee3f9e8a76f745 (patch)
treeb96b04c640df9af19e821297677432748e7f0520
parent58a5aa0141915f4501d58d68bdba1b0adba37ccf (diff)
downloadqtlocation-mapboxgl-f0f65a3331713873b2c54900c7ee3f9e8a76f745.tar.gz
[xxx] remove Primitive classes
-rw-r--r--src/core-files.json1
-rw-r--r--src/mbgl/gfx/draw_mode.hpp66
-rw-r--r--src/mbgl/gfx/primitives.hpp24
-rw-r--r--src/mbgl/gfx/types.hpp6
-rw-r--r--src/mbgl/gl/context.cpp4
-rw-r--r--src/mbgl/gl/context.hpp2
-rw-r--r--src/mbgl/gl/enum.cpp16
-rw-r--r--src/mbgl/gl/program.hpp9
-rw-r--r--src/mbgl/programs/background_program.hpp4
-rw-r--r--src/mbgl/programs/circle_program.hpp2
-rw-r--r--src/mbgl/programs/clipping_mask_program.hpp2
-rw-r--r--src/mbgl/programs/collision_box_program.hpp4
-rw-r--r--src/mbgl/programs/debug_program.hpp2
-rw-r--r--src/mbgl/programs/extrusion_texture_program.hpp2
-rw-r--r--src/mbgl/programs/fill_extrusion_program.hpp4
-rw-r--r--src/mbgl/programs/fill_program.hpp8
-rw-r--r--src/mbgl/programs/heatmap_program.hpp2
-rw-r--r--src/mbgl/programs/heatmap_texture_program.hpp2
-rw-r--r--src/mbgl/programs/hillshade_prepare_program.hpp2
-rw-r--r--src/mbgl/programs/hillshade_program.hpp2
-rw-r--r--src/mbgl/programs/line_program.hpp8
-rw-r--r--src/mbgl/programs/program.hpp5
-rw-r--r--src/mbgl/programs/raster_program.hpp2
-rw-r--r--src/mbgl/programs/symbol_program.hpp11
24 files changed, 87 insertions, 103 deletions
diff --git a/src/core-files.json b/src/core-files.json
index 9b7dfa8e2e..4c2e4b07a7 100644
--- a/src/core-files.json
+++ b/src/core-files.json
@@ -512,7 +512,6 @@
"mbgl/gfx/draw_scope.hpp": "src/mbgl/gfx/draw_scope.hpp",
"mbgl/gfx/index_buffer.hpp": "src/mbgl/gfx/index_buffer.hpp",
"mbgl/gfx/index_vector.hpp": "src/mbgl/gfx/index_vector.hpp",
- "mbgl/gfx/primitives.hpp": "src/mbgl/gfx/primitives.hpp",
"mbgl/gfx/stencil_mode.hpp": "src/mbgl/gfx/stencil_mode.hpp",
"mbgl/gfx/texture.hpp": "src/mbgl/gfx/texture.hpp",
"mbgl/gfx/types.hpp": "src/mbgl/gfx/types.hpp",
diff --git a/src/mbgl/gfx/draw_mode.hpp b/src/mbgl/gfx/draw_mode.hpp
index a0a9b6c575..586f41cb13 100644
--- a/src/mbgl/gfx/draw_mode.hpp
+++ b/src/mbgl/gfx/draw_mode.hpp
@@ -1,71 +1,75 @@
#pragma once
#include <mbgl/gfx/types.hpp>
-#include <mbgl/gfx/primitives.hpp>
#include <cassert>
namespace mbgl {
namespace gfx {
-class Points {
-public:
- using Primitive = Point;
+class DrawMode {
+protected:
+ DrawMode(DrawModeType type_, float)
+ : type(type_) {
+ }
- static constexpr std::size_t bufferGroupSize = 1;
- static constexpr PrimitiveType primitiveType = PrimitiveType::Points;
+public:
+ const DrawModeType type;
+};
- explicit Points(float pointSize_) : pointSize(pointSize_) {}
+class Points : public DrawMode {
+public:
+ explicit Points(float pointSize_) : DrawMode(DrawModeType::Points, pointSize_), pointSize(pointSize_) {
+ assert(size > 0);
+ }
+ static constexpr PrimitiveType primitive = PrimitiveType::Point;
+ static constexpr std::size_t bufferGroupSize = 1;
float pointSize;
};
-class Lines {
+class Lines : public DrawMode {
public:
- using Primitive = Line;
-
- static constexpr std::size_t bufferGroupSize = 2;
- static constexpr PrimitiveType primitiveType = PrimitiveType::Lines;
-
- explicit Lines(float lineWidth_) : lineWidth(lineWidth_) {
- assert(lineWidth > 0);
+ explicit Lines(float lineWidth_) : DrawMode(DrawModeType::Lines, lineWidth_), lineWidth(lineWidth_) {
+ assert(size > 0);
}
+ static constexpr PrimitiveType primitive = PrimitiveType::Line;
+ static constexpr std::size_t bufferGroupSize = 2;
float lineWidth;
};
-class LineStrip {
+class LineStrip : public DrawMode {
public:
+ explicit LineStrip(float lineWidth_) : DrawMode(DrawModeType::LineStrip, lineWidth_), lineWidth(lineWidth_) {
+ assert(size > 0);
+ }
+
// LineStrip is a form of "Line" rendering, but the element buffer
// cannot be grouped into logical elements beyond a single Point.
- using Primitive = Line;
-
+ static constexpr PrimitiveType primitive = PrimitiveType::Line;
static constexpr std::size_t bufferGroupSize = 1;
- static constexpr PrimitiveType primitiveType = PrimitiveType::LineStrip;
-
- explicit LineStrip(float lineWidth_) : lineWidth(lineWidth_) {
- assert(lineWidth > 0);
- }
-
float lineWidth;
};
-class Triangles {
+class Triangles : public DrawMode {
public:
- using Primitive = Triangle;
+ explicit Triangles() : DrawMode(DrawModeType::Triangles, 0) {
+ }
+ static constexpr PrimitiveType primitive = PrimitiveType::Triangle;
static constexpr std::size_t bufferGroupSize = 3;
- static constexpr PrimitiveType primitiveType = PrimitiveType::Triangles;
};
-class TriangleStrip {
+class TriangleStrip : public DrawMode {
public:
+ explicit TriangleStrip() : DrawMode(DrawModeType::TriangleStrip, 0) {
+ }
+
// TriangleStrip is a form of "Triangle" rendering, but the element buffer
// cannot be grouped into logical elements beyond a single Point.
- using Primitive = Triangle;
-
+ static constexpr PrimitiveType primitive = PrimitiveType::Triangle;
static constexpr std::size_t bufferGroupSize = 1;
- static constexpr PrimitiveType primitiveType = PrimitiveType::TriangleStrip;
};
} // namespace gfx
diff --git a/src/mbgl/gfx/primitives.hpp b/src/mbgl/gfx/primitives.hpp
deleted file mode 100644
index f92b1ec525..0000000000
--- a/src/mbgl/gfx/primitives.hpp
+++ /dev/null
@@ -1,24 +0,0 @@
-#pragma once
-
-#include <cstddef>
-
-namespace mbgl {
-namespace gfx {
-
-class Point {
-public:
- static constexpr std::size_t vertexCount = 1;
-};
-
-class Line {
-public:
- static constexpr std::size_t vertexCount = 2;
-};
-
-class Triangle {
-public:
- static constexpr std::size_t vertexCount = 3;
-};
-
-} // namespace gfx
-} // namespace mbgl
diff --git a/src/mbgl/gfx/types.hpp b/src/mbgl/gfx/types.hpp
index 4c6a040b1f..42647eb9a8 100644
--- a/src/mbgl/gfx/types.hpp
+++ b/src/mbgl/gfx/types.hpp
@@ -6,6 +6,12 @@ namespace mbgl {
namespace gfx {
enum class PrimitiveType : uint8_t {
+ Point,
+ Line,
+ Triangle,
+};
+
+enum class DrawModeType : uint8_t {
Points,
Lines,
LineLoop,
diff --git a/src/mbgl/gl/context.cpp b/src/mbgl/gl/context.cpp
index bb93db3e35..c467794984 100644
--- a/src/mbgl/gl/context.cpp
+++ b/src/mbgl/gl/context.cpp
@@ -704,11 +704,11 @@ void Context::setColorMode(const gfx::ColorMode& color) {
colorMask = color.mask;
}
-void Context::draw(gfx::PrimitiveType primitiveType,
+void Context::draw(gfx::DrawModeType drawMode,
std::size_t indexOffset,
std::size_t indexLength) {
MBGL_CHECK_ERROR(glDrawElements(
- Enum<gfx::PrimitiveType>::to(primitiveType),
+ Enum<gfx::DrawModeType>::to(drawMode),
static_cast<GLsizei>(indexLength),
GL_UNSIGNED_SHORT,
reinterpret_cast<GLvoid*>(sizeof(uint16_t) * indexOffset)));
diff --git a/src/mbgl/gl/context.hpp b/src/mbgl/gl/context.hpp
index c99d6d6367..6330a05d55 100644
--- a/src/mbgl/gl/context.hpp
+++ b/src/mbgl/gl/context.hpp
@@ -110,7 +110,7 @@ public:
void setColorMode(const gfx::ColorMode&);
void setCullFaceMode(const gfx::CullFaceMode&);
- void draw(gfx::PrimitiveType,
+ void draw(gfx::DrawModeType,
std::size_t indexOffset,
std::size_t indexLength);
diff --git a/src/mbgl/gl/enum.cpp b/src/mbgl/gl/enum.cpp
index c1a51944de..673d43b5d6 100644
--- a/src/mbgl/gl/enum.cpp
+++ b/src/mbgl/gl/enum.cpp
@@ -6,15 +6,15 @@ namespace mbgl {
namespace gl {
template <>
-platform::GLenum Enum<gfx::PrimitiveType>::to(const gfx::PrimitiveType value) {
+platform::GLenum Enum<gfx::DrawModeType>::to(const gfx::DrawModeType value) {
switch (value) {
- case gfx::PrimitiveType::Points: return GL_POINTS;
- case gfx::PrimitiveType::Lines: return GL_LINES;
- case gfx::PrimitiveType::LineLoop: return GL_LINE_LOOP;
- case gfx::PrimitiveType::LineStrip: return GL_LINE_STRIP;
- case gfx::PrimitiveType::Triangles: return GL_TRIANGLES;
- case gfx::PrimitiveType::TriangleStrip: return GL_TRIANGLE_STRIP;
- case gfx::PrimitiveType::TriangleFan: return GL_TRIANGLE_FAN;
+ case gfx::DrawModeType::Points: return GL_POINTS;
+ case gfx::DrawModeType::Lines: return GL_LINES;
+ case gfx::DrawModeType::LineLoop: return GL_LINE_LOOP;
+ case gfx::DrawModeType::LineStrip: return GL_LINE_STRIP;
+ case gfx::DrawModeType::Triangles: return GL_TRIANGLES;
+ case gfx::DrawModeType::TriangleStrip: return GL_TRIANGLE_STRIP;
+ case gfx::DrawModeType::TriangleFan: return GL_TRIANGLE_FAN;
}
return GL_INVALID_ENUM;
}
diff --git a/src/mbgl/gl/program.hpp b/src/mbgl/gl/program.hpp
index 623a7149c5..bd17ecdd47 100644
--- a/src/mbgl/gl/program.hpp
+++ b/src/mbgl/gl/program.hpp
@@ -24,11 +24,9 @@
namespace mbgl {
namespace gl {
-template <class P, class AttributeList, class UniformList, class TextureList>
+template <class AttributeList, class UniformList, class TextureList>
class Program {
public:
- using Primitive = P;
-
Program(Context& context, const std::string& vertexSource, const std::string& fragmentSource)
: program(
context.createProgram(context.createShader(ShaderType::Vertex, vertexSource),
@@ -118,7 +116,7 @@ public:
template <class DrawMode>
void draw(gfx::Context& genericContext,
- DrawMode drawMode,
+ const DrawMode& drawMode,
const gfx::DepthMode& depthMode,
const gfx::StencilMode& stencilMode,
const gfx::ColorMode& colorMode,
@@ -130,7 +128,6 @@ public:
const gfx::IndexBuffer& indexBuffer,
std::size_t indexOffset,
std::size_t indexLength) {
- static_assert(std::is_same<Primitive, typename DrawMode::Primitive>::value, "incompatible draw mode");
auto& context = reinterpret_cast<gl::Context&>(genericContext);
context.setDrawMode(drawMode);
@@ -150,7 +147,7 @@ public:
indexBuffer,
attributeLocations.toBindingArray(attributeBindings));
- context.draw(drawMode.primitiveType,
+ context.draw(drawMode.type,
indexOffset,
indexLength);
}
diff --git a/src/mbgl/programs/background_program.hpp b/src/mbgl/programs/background_program.hpp
index 779005d218..6bcdde1ef3 100644
--- a/src/mbgl/programs/background_program.hpp
+++ b/src/mbgl/programs/background_program.hpp
@@ -46,7 +46,7 @@ using BackgroundPatternUniforms = TypeList<
class BackgroundProgram : public Program<
shaders::background,
- gfx::Triangle,
+ gfx::PrimitiveType::Triangle,
BackgroundLayoutAttributes,
BackgroundUniforms,
TypeList<>,
@@ -58,7 +58,7 @@ public:
class BackgroundPatternProgram : public Program<
shaders::background_pattern,
- gfx::Triangle,
+ gfx::PrimitiveType::Triangle,
BackgroundLayoutAttributes,
BackgroundPatternUniforms,
TypeList<
diff --git a/src/mbgl/programs/circle_program.hpp b/src/mbgl/programs/circle_program.hpp
index 5357f5742a..96f630188c 100644
--- a/src/mbgl/programs/circle_program.hpp
+++ b/src/mbgl/programs/circle_program.hpp
@@ -15,7 +15,7 @@ MBGL_DEFINE_UNIFORM_SCALAR(bool, u_scale_with_map);
class CircleProgram : public Program<
shaders::circle,
- gfx::Triangle,
+ gfx::PrimitiveType::Triangle,
TypeList<
attributes::a_pos>,
TypeList<
diff --git a/src/mbgl/programs/clipping_mask_program.hpp b/src/mbgl/programs/clipping_mask_program.hpp
index e51a3258ba..fe82ea66df 100644
--- a/src/mbgl/programs/clipping_mask_program.hpp
+++ b/src/mbgl/programs/clipping_mask_program.hpp
@@ -10,7 +10,7 @@ namespace mbgl {
class ClippingMaskProgram : public Program<
shaders::clipping_mask,
- gfx::Triangle,
+ gfx::PrimitiveType::Triangle,
PositionOnlyLayoutAttributes,
TypeList<
uniforms::u_matrix>,
diff --git a/src/mbgl/programs/collision_box_program.hpp b/src/mbgl/programs/collision_box_program.hpp
index 40c0d82ee2..94c6963909 100644
--- a/src/mbgl/programs/collision_box_program.hpp
+++ b/src/mbgl/programs/collision_box_program.hpp
@@ -22,7 +22,7 @@ using CollisionBoxDynamicAttributes = TypeList<attributes::a_placed>;
class CollisionBoxProgram : public Program<
shaders::collision_box,
- gfx::Line,
+ gfx::PrimitiveType::Line,
TypeListConcat<CollisionBoxLayoutAttributes, CollisionBoxDynamicAttributes>,
TypeList<
uniforms::u_matrix,
@@ -115,7 +115,7 @@ public:
class CollisionCircleProgram : public Program<
shaders::collision_circle,
- gfx::Triangle,
+ gfx::PrimitiveType::Triangle,
TypeListConcat<CollisionBoxLayoutAttributes, CollisionBoxDynamicAttributes>,
TypeList<
uniforms::u_matrix,
diff --git a/src/mbgl/programs/debug_program.hpp b/src/mbgl/programs/debug_program.hpp
index 3b07e5b424..e42fa565b2 100644
--- a/src/mbgl/programs/debug_program.hpp
+++ b/src/mbgl/programs/debug_program.hpp
@@ -10,7 +10,7 @@ namespace mbgl {
class DebugProgram : public Program<
shaders::debug,
- gfx::Line,
+ gfx::PrimitiveType::Line,
TypeList<
attributes::a_pos>,
TypeList<
diff --git a/src/mbgl/programs/extrusion_texture_program.hpp b/src/mbgl/programs/extrusion_texture_program.hpp
index 24c98ec536..e2977a36cb 100644
--- a/src/mbgl/programs/extrusion_texture_program.hpp
+++ b/src/mbgl/programs/extrusion_texture_program.hpp
@@ -12,7 +12,7 @@ namespace mbgl {
class ExtrusionTextureProgram : public Program<
shaders::extrusion_texture,
- gfx::Triangle,
+ gfx::PrimitiveType::Triangle,
TypeList<attributes::a_pos>,
TypeList<
uniforms::u_matrix,
diff --git a/src/mbgl/programs/fill_extrusion_program.hpp b/src/mbgl/programs/fill_extrusion_program.hpp
index a59161e3e3..28ce2ec691 100644
--- a/src/mbgl/programs/fill_extrusion_program.hpp
+++ b/src/mbgl/programs/fill_extrusion_program.hpp
@@ -54,7 +54,7 @@ using FillExtrusionPatternUniforms = TypeList<
class FillExtrusionProgram : public Program<
shaders::fill_extrusion,
- gfx::Triangle,
+ gfx::PrimitiveType::Triangle,
FillExtrusionLayoutAttributes,
FillExtrusionUniforms,
TypeList<>,
@@ -89,7 +89,7 @@ public:
class FillExtrusionPatternProgram : public Program<
shaders::fill_extrusion_pattern,
- gfx::Triangle,
+ gfx::PrimitiveType::Triangle,
FillExtrusionLayoutAttributes,
FillExtrusionPatternUniforms,
TypeList<
diff --git a/src/mbgl/programs/fill_program.hpp b/src/mbgl/programs/fill_program.hpp
index c684a3d361..e469e416ef 100644
--- a/src/mbgl/programs/fill_program.hpp
+++ b/src/mbgl/programs/fill_program.hpp
@@ -39,7 +39,7 @@ using FillPatternUniforms = TypeList<
class FillProgram : public Program<
shaders::fill,
- gfx::Triangle,
+ gfx::PrimitiveType::Triangle,
FillLayoutAttributes,
FillUniforms,
TypeList<>,
@@ -60,7 +60,7 @@ public:
class FillPatternProgram : public Program<
shaders::fill_pattern,
- gfx::Triangle,
+ gfx::PrimitiveType::Triangle,
FillLayoutAttributes,
FillPatternUniforms,
TypeList<
@@ -81,7 +81,7 @@ public:
class FillOutlineProgram : public Program<
shaders::fill_outline,
- gfx::Line,
+ gfx::PrimitiveType::Line,
FillLayoutAttributes,
FillUniforms,
TypeList<>,
@@ -93,7 +93,7 @@ public:
class FillOutlinePatternProgram : public Program<
shaders::fill_outline_pattern,
- gfx::Line,
+ gfx::PrimitiveType::Line,
FillLayoutAttributes,
FillPatternUniforms,
TypeList<
diff --git a/src/mbgl/programs/heatmap_program.hpp b/src/mbgl/programs/heatmap_program.hpp
index 7ed42c9099..6c83862e28 100644
--- a/src/mbgl/programs/heatmap_program.hpp
+++ b/src/mbgl/programs/heatmap_program.hpp
@@ -16,7 +16,7 @@ MBGL_DEFINE_UNIFORM_SCALAR(float, u_intensity);
class HeatmapProgram : public Program<
shaders::heatmap,
- gfx::Triangle,
+ gfx::PrimitiveType::Triangle,
TypeList<
attributes::a_pos>,
TypeList<
diff --git a/src/mbgl/programs/heatmap_texture_program.hpp b/src/mbgl/programs/heatmap_texture_program.hpp
index dacb9eea16..46f9fc1b89 100644
--- a/src/mbgl/programs/heatmap_texture_program.hpp
+++ b/src/mbgl/programs/heatmap_texture_program.hpp
@@ -12,7 +12,7 @@ namespace mbgl {
class HeatmapTextureProgram : public Program<
shaders::heatmap_texture,
- gfx::Triangle,
+ gfx::PrimitiveType::Triangle,
TypeList<attributes::a_pos>,
TypeList<
uniforms::u_matrix,
diff --git a/src/mbgl/programs/hillshade_prepare_program.hpp b/src/mbgl/programs/hillshade_prepare_program.hpp
index 0cdcc5d9f9..fb2b8daebb 100644
--- a/src/mbgl/programs/hillshade_prepare_program.hpp
+++ b/src/mbgl/programs/hillshade_prepare_program.hpp
@@ -16,7 +16,7 @@ MBGL_DEFINE_UNIFORM_SCALAR(float, u_maxzoom);
class HillshadePrepareProgram : public Program<
shaders::hillshade_prepare,
- gfx::Triangle,
+ gfx::PrimitiveType::Triangle,
TypeList<
attributes::a_pos,
attributes::a_texture_pos>,
diff --git a/src/mbgl/programs/hillshade_program.hpp b/src/mbgl/programs/hillshade_program.hpp
index 997cf51c30..8def03505b 100644
--- a/src/mbgl/programs/hillshade_program.hpp
+++ b/src/mbgl/programs/hillshade_program.hpp
@@ -21,7 +21,7 @@ MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_latrange);
class HillshadeProgram : public Program<
shaders::hillshade,
- gfx::Triangle,
+ gfx::PrimitiveType::Triangle,
TypeList<
attributes::a_pos,
attributes::a_texture_pos>,
diff --git a/src/mbgl/programs/line_program.hpp b/src/mbgl/programs/line_program.hpp
index f7dffd20e7..f98eb0b0d3 100644
--- a/src/mbgl/programs/line_program.hpp
+++ b/src/mbgl/programs/line_program.hpp
@@ -36,7 +36,7 @@ using LineLayoutAttributes = TypeList<
class LineProgram : public Program<
shaders::line,
- gfx::Triangle,
+ gfx::PrimitiveType::Triangle,
LineLayoutAttributes,
TypeList<
uniforms::u_matrix,
@@ -102,7 +102,7 @@ public:
class LinePatternProgram : public Program<
shaders::line_pattern,
- gfx::Triangle,
+ gfx::PrimitiveType::Triangle,
LineLayoutAttributes,
TypeList<
uniforms::u_matrix,
@@ -130,7 +130,7 @@ public:
class LineSDFProgram : public Program<
shaders::line_sdf,
- gfx::Triangle,
+ gfx::PrimitiveType::Triangle,
LineLayoutAttributes,
TypeList<
uniforms::u_matrix,
@@ -163,7 +163,7 @@ public:
class LineGradientProgram : public Program<
shaders::line_gradient,
- gfx::Triangle,
+ gfx::PrimitiveType::Triangle,
LineLayoutAttributes,
TypeList<
uniforms::u_matrix,
diff --git a/src/mbgl/programs/program.hpp b/src/mbgl/programs/program.hpp
index 836c5a60fd..d04937666e 100644
--- a/src/mbgl/programs/program.hpp
+++ b/src/mbgl/programs/program.hpp
@@ -16,7 +16,7 @@
namespace mbgl {
template <class Shaders,
- class Primitive,
+ gfx::PrimitiveType Primitive,
class LayoutAttributeList,
class LayoutUniformList,
class TextureList,
@@ -39,7 +39,7 @@ public:
using TextureBindings = gfx::TextureBindings<TextureList>;
- using ProgramType = gl::Program<Primitive, AttributeList, UniformList, TextureList>;
+ using ProgramType = gl::Program<AttributeList, UniformList, TextureList>;
ProgramType program;
@@ -86,6 +86,7 @@ public:
const AttributeBindings& allAttributeBindings,
const TextureBindings& textureBindings,
const std::string& layerID) {
+ static_assert(Primitive == DrawMode::primitive, "incompatible draw mode");
for (auto& segment : segments) {
auto drawScopeIt = segment.drawScopes.find(layerID);
diff --git a/src/mbgl/programs/raster_program.hpp b/src/mbgl/programs/raster_program.hpp
index eaa296fee3..48115de6fe 100644
--- a/src/mbgl/programs/raster_program.hpp
+++ b/src/mbgl/programs/raster_program.hpp
@@ -24,7 +24,7 @@ MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_tl_parent);
class RasterProgram : public Program<
shaders::raster,
- gfx::Triangle,
+ gfx::PrimitiveType::Triangle,
TypeList<
attributes::a_pos,
attributes::a_texture_pos>,
diff --git a/src/mbgl/programs/symbol_program.hpp b/src/mbgl/programs/symbol_program.hpp
index 305adf727f..61bfd657eb 100644
--- a/src/mbgl/programs/symbol_program.hpp
+++ b/src/mbgl/programs/symbol_program.hpp
@@ -240,7 +240,7 @@ public:
};
template <class Shaders,
- class Primitive,
+ gfx::PrimitiveType Primitive,
class LayoutAttributeList,
class LayoutUniformList,
class TextureList,
@@ -266,7 +266,7 @@ public:
using TextureBindings = gfx::TextureBindings<TextureList>;
- using ProgramType = gl::Program<Primitive, AttributeList, UniformList, TextureList>;
+ using ProgramType = gl::Program<AttributeList, UniformList, TextureList>;
ProgramType program;
@@ -320,6 +320,7 @@ public:
const AttributeBindings& allAttributeBindings,
const TextureBindings& textureBindings,
const std::string& layerID) {
+ static_assert(Primitive == DrawMode::primitive, "incompatible draw mode");
for (auto& segment : segments) {
auto drawScopeIt = segment.drawScopes.find(layerID);
@@ -347,7 +348,7 @@ public:
class SymbolIconProgram : public SymbolProgram<
shaders::symbol_icon,
- gfx::Triangle,
+ gfx::PrimitiveType::Triangle,
SymbolLayoutAttributes,
TypeList<
uniforms::u_matrix,
@@ -387,7 +388,7 @@ enum class SymbolSDFPart {
template <class PaintProperties>
class SymbolSDFProgram : public SymbolProgram<
shaders::symbol_sdf,
- gfx::Triangle,
+ gfx::PrimitiveType::Triangle,
SymbolLayoutAttributes,
TypeList<
uniforms::u_matrix,
@@ -410,7 +411,7 @@ class SymbolSDFProgram : public SymbolProgram<
{
public:
using BaseProgram = SymbolProgram<shaders::symbol_sdf,
- gfx::Triangle,
+ gfx::PrimitiveType::Triangle,
SymbolLayoutAttributes,
TypeList<
uniforms::u_matrix,