[core] move draw mode and primitives to gfx namespace

This commit is contained in:
Konstantin Käfer
2019-02-28 17:41:38 +01:00
parent c53cbe5246
commit fd37d90650
49 changed files with 141 additions and 126 deletions

View File

@@ -499,6 +499,9 @@
"mbgl/geometry/feature_index.hpp": "src/mbgl/geometry/feature_index.hpp",
"mbgl/geometry/line_atlas.hpp": "src/mbgl/geometry/line_atlas.hpp",
"mbgl/gfx/attribute.hpp": "src/mbgl/gfx/attribute.hpp",
"mbgl/gfx/draw_mode.hpp": "src/mbgl/gfx/draw_mode.hpp",
"mbgl/gfx/primitives.hpp": "src/mbgl/gfx/primitives.hpp",
"mbgl/gfx/types.hpp": "src/mbgl/gfx/types.hpp",
"mbgl/gfx/uniform.hpp": "src/mbgl/gfx/uniform.hpp",
"mbgl/gl/attribute.hpp": "src/mbgl/gl/attribute.hpp",
"mbgl/gl/color_mode.hpp": "src/mbgl/gl/color_mode.hpp",
@@ -508,13 +511,11 @@
"mbgl/gl/debugging_extension.hpp": "src/mbgl/gl/debugging_extension.hpp",
"mbgl/gl/defines.hpp": "src/mbgl/gl/defines.hpp",
"mbgl/gl/depth_mode.hpp": "src/mbgl/gl/depth_mode.hpp",
"mbgl/gl/draw_mode.hpp": "src/mbgl/gl/draw_mode.hpp",
"mbgl/gl/extension.hpp": "src/mbgl/gl/extension.hpp",
"mbgl/gl/features.hpp": "src/mbgl/gl/features.hpp",
"mbgl/gl/framebuffer.hpp": "src/mbgl/gl/framebuffer.hpp",
"mbgl/gl/index_buffer.hpp": "src/mbgl/gl/index_buffer.hpp",
"mbgl/gl/object.hpp": "src/mbgl/gl/object.hpp",
"mbgl/gl/primitives.hpp": "src/mbgl/gl/primitives.hpp",
"mbgl/gl/program.hpp": "src/mbgl/gl/program.hpp",
"mbgl/gl/program_binary_extension.hpp": "src/mbgl/gl/program_binary_extension.hpp",
"mbgl/gl/renderbuffer.hpp": "src/mbgl/gl/renderbuffer.hpp",

View File

@@ -1,12 +1,12 @@
#pragma once
#include <mbgl/gl/types.hpp>
#include <mbgl/gl/primitives.hpp>
#include <mbgl/gfx/types.hpp>
#include <mbgl/gfx/primitives.hpp>
#include <cassert>
namespace mbgl {
namespace gl {
namespace gfx {
class Points {
public:
@@ -68,5 +68,5 @@ public:
static constexpr PrimitiveType primitiveType = PrimitiveType::TriangleStrip;
};
} // namespace gl
} // namespace gfx
} // namespace mbgl

View File

@@ -3,7 +3,7 @@
#include <cstddef>
namespace mbgl {
namespace gl {
namespace gfx {
class Point {
public:
@@ -20,5 +20,5 @@ public:
static constexpr std::size_t vertexCount = 3;
};
} // namespace gl
} // namespace gfx
} // namespace mbgl

19
src/mbgl/gfx/types.hpp Normal file
View File

@@ -0,0 +1,19 @@
#pragma once
#include <cstdint>
namespace mbgl {
namespace gfx {
enum class PrimitiveType : uint8_t {
Points,
Lines,
LineLoop,
LineStrip,
Triangles,
TriangleStrip,
TriangleFan
};
} // namespace gfx
} // namespace mbgl

View File

@@ -40,15 +40,6 @@ static_assert(underlying_type(RenderbufferType::DepthComponent) == GL_DEPTH_COMP
static_assert(underlying_type(RenderbufferType::DepthComponent) == GL_DEPTH_COMPONENT16, "OpenGL type mismatch");
#endif // MBGL_USE_GLES2
static_assert(underlying_type(PrimitiveType::Points) == GL_POINTS, "OpenGL type mismatch");
static_assert(underlying_type(PrimitiveType::Lines) == GL_LINES, "OpenGL type mismatch");
static_assert(underlying_type(PrimitiveType::LineLoop) == GL_LINE_LOOP, "OpenGL type mismatch");
static_assert(underlying_type(PrimitiveType::LineStrip) == GL_LINE_STRIP, "OpenGL type mismatch");
static_assert(underlying_type(PrimitiveType::Triangles) == GL_TRIANGLES, "OpenGL type mismatch");
static_assert(underlying_type(PrimitiveType::TriangleStrip) == GL_TRIANGLE_STRIP, "OpenGL type mismatch");
static_assert(underlying_type(PrimitiveType::TriangleFan) == GL_TRIANGLE_FAN, "OpenGL type mismatch");
static_assert(std::is_same<ProgramID, GLuint>::value, "OpenGL type mismatch");
static_assert(std::is_same<ShaderID, GLuint>::value, "OpenGL type mismatch");
static_assert(std::is_same<BufferID, GLuint>::value, "OpenGL type mismatch");
@@ -684,26 +675,26 @@ void Context::setCullFaceMode(const CullFaceMode& mode) {
}
#if not MBGL_USE_GLES2
void Context::setDrawMode(const Points& points) {
void Context::setDrawMode(const gfx::Points& points) {
pointSize = points.pointSize;
}
#else
void Context::setDrawMode(const Points&) {
void Context::setDrawMode(const gfx::Points&) {
}
#endif // MBGL_USE_GLES2
void Context::setDrawMode(const Lines& lines) {
void Context::setDrawMode(const gfx::Lines& lines) {
lineWidth = lines.lineWidth;
}
void Context::setDrawMode(const LineStrip& lineStrip) {
void Context::setDrawMode(const gfx::LineStrip& lineStrip) {
lineWidth = lineStrip.lineWidth;
}
void Context::setDrawMode(const Triangles&) {
void Context::setDrawMode(const gfx::Triangles&) {
}
void Context::setDrawMode(const TriangleStrip&) {
void Context::setDrawMode(const gfx::TriangleStrip&) {
}
void Context::setDepthMode(const DepthMode& depth) {
@@ -752,11 +743,24 @@ void Context::setColorMode(const ColorMode& color) {
colorMask = color.mask;
}
void Context::draw(PrimitiveType primitiveType,
GLenum toGLenum(const gfx::PrimitiveType primitiveType) {
switch (primitiveType) {
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;
}
return GL_INVALID_ENUM;
}
void Context::draw(gfx::PrimitiveType primitiveType,
std::size_t indexOffset,
std::size_t indexLength) {
MBGL_CHECK_ERROR(glDrawElements(
static_cast<GLenum>(primitiveType),
toGLenum(primitiveType),
static_cast<GLsizei>(indexLength),
GL_UNSIGNED_SHORT,
reinterpret_cast<GLvoid*>(sizeof(uint16_t) * indexOffset)));

View File

@@ -11,7 +11,7 @@
#include <mbgl/gl/index_buffer.hpp>
#include <mbgl/gl/vertex_array.hpp>
#include <mbgl/gl/types.hpp>
#include <mbgl/gl/draw_mode.hpp>
#include <mbgl/gfx/draw_mode.hpp>
#include <mbgl/gl/depth_mode.hpp>
#include <mbgl/gl/stencil_mode.hpp>
#include <mbgl/gl/color_mode.hpp>
@@ -164,18 +164,18 @@ public:
optional<float> depth,
optional<int32_t> stencil);
void setDrawMode(const Points&);
void setDrawMode(const Lines&);
void setDrawMode(const LineStrip&);
void setDrawMode(const Triangles&);
void setDrawMode(const TriangleStrip&);
void setDrawMode(const gfx::Points&);
void setDrawMode(const gfx::Lines&);
void setDrawMode(const gfx::LineStrip&);
void setDrawMode(const gfx::Triangles&);
void setDrawMode(const gfx::TriangleStrip&);
void setDepthMode(const DepthMode&);
void setStencilMode(const StencilMode&);
void setColorMode(const ColorMode&);
void setCullFaceMode(const CullFaceMode&);
void draw(PrimitiveType,
void draw(gfx::PrimitiveType,
std::size_t indexOffset,
std::size_t indexLength);

View File

@@ -1,7 +1,7 @@
#pragma once
#include <mbgl/gl/object.hpp>
#include <mbgl/gl/draw_mode.hpp>
#include <mbgl/gfx/draw_mode.hpp>
#include <mbgl/util/ignore.hpp>
#include <vector>

View File

@@ -73,16 +73,6 @@ enum class TextureType : uint32_t {
#endif // MBGL_USE_GLES2
};
enum class PrimitiveType {
Points = 0x0000,
Lines = 0x0001,
LineLoop = 0x0002,
LineStrip = 0x0003,
Triangles = 0x0004,
TriangleStrip = 0x0005,
TriangleFan = 0x0006
};
struct PixelStorageType {
int32_t alignment;
};

View File

@@ -1,8 +1,8 @@
#pragma once
#include <mbgl/gl/object.hpp>
#include <mbgl/gl/primitives.hpp>
#include <mbgl/gl/draw_mode.hpp>
#include <mbgl/gfx/primitives.hpp>
#include <mbgl/gfx/draw_mode.hpp>
#include <mbgl/util/ignore.hpp>
#include <vector>

View File

@@ -46,7 +46,7 @@ using BackgroundPatternUniforms = TypeList<
class BackgroundProgram : public Program<
shaders::background,
gl::Triangle,
gfx::Triangle,
BackgroundLayoutAttributes,
BackgroundUniforms,
style::Properties<>>
@@ -57,7 +57,7 @@ public:
class BackgroundPatternProgram : public Program<
shaders::background_pattern,
gl::Triangle,
gfx::Triangle,
BackgroundLayoutAttributes,
BackgroundPatternUniforms,
style::Properties<>>

View File

@@ -15,7 +15,7 @@ MBGL_DEFINE_UNIFORM_SCALAR(bool, u_scale_with_map);
class CircleProgram : public Program<
shaders::circle,
gl::Triangle,
gfx::Triangle,
TypeList<
attributes::a_pos>,
TypeList<

View File

@@ -10,7 +10,7 @@ namespace mbgl {
class ClippingMaskProgram : public Program<
shaders::clipping_mask,
gl::Triangle,
gfx::Triangle,
PositionOnlyLayoutAttributes,
TypeList<
uniforms::u_matrix>,

View File

@@ -21,7 +21,7 @@ using CollisionBoxDynamicAttributes = TypeList<attributes::a_placed>;
class CollisionBoxProgram : public Program<
shaders::collision_box,
gl::Line,
gfx::Line,
TypeListConcat<CollisionBoxLayoutAttributes, CollisionBoxDynamicAttributes>,
TypeList<
uniforms::u_matrix,
@@ -107,7 +107,7 @@ public:
class CollisionCircleProgram : public Program<
shaders::collision_circle,
gl::Triangle,
gfx::Triangle,
TypeListConcat<CollisionBoxLayoutAttributes, CollisionBoxDynamicAttributes>,
TypeList<
uniforms::u_matrix,

View File

@@ -10,7 +10,7 @@ namespace mbgl {
class DebugProgram : public Program<
shaders::debug,
gl::Line,
gfx::Line,
TypeList<
attributes::a_pos>,
TypeList<

View File

@@ -11,7 +11,7 @@ namespace mbgl {
class ExtrusionTextureProgram : public Program<
shaders::extrusion_texture,
gl::Triangle,
gfx::Triangle,
TypeList<attributes::a_pos>,
TypeList<
uniforms::u_matrix,

View File

@@ -54,7 +54,7 @@ using FillExtrusionPatternUniforms = TypeList<
class FillExtrusionProgram : public Program<
shaders::fill_extrusion,
gl::Triangle,
gfx::Triangle,
FillExtrusionLayoutAttributes,
FillExtrusionUniforms,
style::FillExtrusionPaintProperties>
@@ -90,7 +90,7 @@ public:
class FillExtrusionPatternProgram : public Program<
shaders::fill_extrusion_pattern,
gl::Triangle,
gfx::Triangle,
FillExtrusionLayoutAttributes,
FillExtrusionPatternUniforms,
style::FillExtrusionPaintProperties>

View File

@@ -39,7 +39,7 @@ using FillPatternUniforms = TypeList<
class FillProgram : public Program<
shaders::fill,
gl::Triangle,
gfx::Triangle,
FillLayoutAttributes,
FillUniforms,
style::FillPaintProperties>
@@ -59,7 +59,7 @@ public:
class FillPatternProgram : public Program<
shaders::fill_pattern,
gl::Triangle,
gfx::Triangle,
FillLayoutAttributes,
FillPatternUniforms,
style::FillPaintProperties>
@@ -78,7 +78,7 @@ public:
class FillOutlineProgram : public Program<
shaders::fill_outline,
gl::Line,
gfx::Line,
FillLayoutAttributes,
FillUniforms,
style::FillPaintProperties>
@@ -89,7 +89,7 @@ public:
class FillOutlinePatternProgram : public Program<
shaders::fill_outline_pattern,
gl::Line,
gfx::Line,
FillLayoutAttributes,
FillPatternUniforms,
style::FillPaintProperties>

View File

@@ -16,7 +16,7 @@ MBGL_DEFINE_UNIFORM_SCALAR(float, u_intensity);
class HeatmapProgram : public Program<
shaders::heatmap,
gl::Triangle,
gfx::Triangle,
TypeList<
attributes::a_pos>,
TypeList<

View File

@@ -15,7 +15,7 @@ MBGL_DEFINE_UNIFORM_SCALAR(uint32_t, u_color_ramp);
class HeatmapTextureProgram : public Program<
shaders::heatmap_texture,
gl::Triangle,
gfx::Triangle,
TypeList<attributes::a_pos>,
TypeList<
uniforms::u_matrix,

View File

@@ -15,7 +15,7 @@ MBGL_DEFINE_UNIFORM_SCALAR(float, u_maxzoom);
class HillshadePrepareProgram : public Program<
shaders::hillshade_prepare,
gl::Triangle,
gfx::Triangle,
TypeList<
attributes::a_pos,
attributes::a_texture_pos>,

View File

@@ -20,7 +20,7 @@ MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_latrange);
class HillshadeProgram : public Program<
shaders::hillshade,
gl::Triangle,
gfx::Triangle,
TypeList<
attributes::a_pos,
attributes::a_texture_pos>,

View File

@@ -35,7 +35,7 @@ using LineLayoutAttributes = TypeList<
class LineProgram : public Program<
shaders::line,
gl::Triangle,
gfx::Triangle,
LineLayoutAttributes,
TypeList<
uniforms::u_matrix,
@@ -99,7 +99,7 @@ public:
class LinePatternProgram : public Program<
shaders::line_pattern,
gl::Triangle,
gfx::Triangle,
LineLayoutAttributes,
TypeList<
uniforms::u_matrix,
@@ -125,7 +125,7 @@ public:
class LineSDFProgram : public Program<
shaders::line_sdf,
gl::Triangle,
gfx::Triangle,
LineLayoutAttributes,
TypeList<
uniforms::u_matrix,
@@ -156,7 +156,7 @@ public:
class LineGradientProgram : public Program<
shaders::line_gradient,
gl::Triangle,
gfx::Triangle,
LineLayoutAttributes,
TypeList<
uniforms::u_matrix,

View File

@@ -25,7 +25,7 @@ MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_tl_parent);
class RasterProgram : public Program<
shaders::raster,
gl::Triangle,
gfx::Triangle,
TypeList<
attributes::a_pos,
attributes::a_texture_pos>,

View File

@@ -341,7 +341,7 @@ public:
class SymbolIconProgram : public SymbolProgram<
shaders::symbol_icon,
gl::Triangle,
gfx::Triangle,
SymbolLayoutAttributes,
TypeList<
uniforms::u_matrix,
@@ -380,7 +380,7 @@ enum class SymbolSDFPart {
template <class PaintProperties>
class SymbolSDFProgram : public SymbolProgram<
shaders::symbol_sdf,
gl::Triangle,
gfx::Triangle,
SymbolLayoutAttributes,
TypeList<
uniforms::u_matrix,
@@ -402,7 +402,7 @@ class SymbolSDFProgram : public SymbolProgram<
{
public:
using BaseProgram = SymbolProgram<shaders::symbol_sdf,
gl::Triangle,
gfx::Triangle,
SymbolLayoutAttributes,
TypeList<
uniforms::u_matrix,

View File

@@ -31,11 +31,11 @@ public:
bool supportsLayer(const style::Layer::Impl&) const override;
gl::VertexVector<CircleLayoutVertex> vertices;
gl::IndexVector<gl::Triangles> triangles;
gl::IndexVector<gfx::Triangles> triangles;
SegmentVector<CircleAttributes> segments;
optional<gl::VertexBuffer<CircleLayoutVertex>> vertexBuffer;
optional<gl::IndexBuffer<gl::Triangles>> indexBuffer;
optional<gl::IndexBuffer<gfx::Triangles>> indexBuffer;
std::map<std::string, CircleProgram::Binders> paintPropertyBinders;

View File

@@ -24,7 +24,7 @@ DebugBucket::DebugBucket(const OverscaledTileID& id,
debugMode(debugMode_) {
gl::VertexVector<FillLayoutVertex> vertices;
gl::IndexVector<gl::Lines> indices;
gl::IndexVector<gfx::Lines> indices;
auto addText = [&] (const std::string& text, double left, double baseline, double scale) {
for (uint8_t c : text) {

View File

@@ -35,7 +35,7 @@ public:
SegmentVector<DebugAttributes> segments;
optional<gl::VertexBuffer<DebugLayoutVertex>> vertexBuffer;
optional<gl::IndexBuffer<gl::Lines>> indexBuffer;
optional<gl::IndexBuffer<gfx::Lines>> indexBuffer;
};
} // namespace mbgl

View File

@@ -41,14 +41,14 @@ public:
bool supportsLayer(const style::Layer::Impl&) const override;
gl::VertexVector<FillLayoutVertex> vertices;
gl::IndexVector<gl::Lines> lines;
gl::IndexVector<gl::Triangles> triangles;
gl::IndexVector<gfx::Lines> lines;
gl::IndexVector<gfx::Triangles> triangles;
SegmentVector<FillAttributes> lineSegments;
SegmentVector<FillAttributes> triangleSegments;
optional<gl::VertexBuffer<FillLayoutVertex>> vertexBuffer;
optional<gl::IndexBuffer<gl::Lines>> lineIndexBuffer;
optional<gl::IndexBuffer<gl::Triangles>> triangleIndexBuffer;
optional<gl::IndexBuffer<gfx::Lines>> lineIndexBuffer;
optional<gl::IndexBuffer<gfx::Triangles>> triangleIndexBuffer;
std::map<std::string, FillProgram::Binders> paintPropertyBinders;
};

View File

@@ -40,11 +40,11 @@ public:
float getQueryRadius(const RenderLayer&) const override;
gl::VertexVector<FillExtrusionLayoutVertex> vertices;
gl::IndexVector<gl::Triangles> triangles;
gl::IndexVector<gfx::Triangles> triangles;
SegmentVector<FillExtrusionAttributes> triangleSegments;
optional<gl::VertexBuffer<FillExtrusionLayoutVertex>> vertexBuffer;
optional<gl::IndexBuffer<gl::Triangles>> indexBuffer;
optional<gl::IndexBuffer<gfx::Triangles>> indexBuffer;
std::unordered_map<std::string, FillExtrusionProgram::Binders> paintPropertyBinders;
};

View File

@@ -30,11 +30,11 @@ public:
bool supportsLayer(const style::Layer::Impl&) const override;
gl::VertexVector<HeatmapLayoutVertex> vertices;
gl::IndexVector<gl::Triangles> triangles;
gl::IndexVector<gfx::Triangles> triangles;
SegmentVector<HeatmapAttributes> segments;
optional<gl::VertexBuffer<HeatmapLayoutVertex>> vertexBuffer;
optional<gl::IndexBuffer<gl::Triangles>> indexBuffer;
optional<gl::IndexBuffer<gfx::Triangles>> indexBuffer;
std::map<std::string, HeatmapProgram::Binders> paintPropertyBinders;

View File

@@ -47,11 +47,11 @@ public:
// Raster-DEM Tile Sources use the default buffers from Painter
gl::VertexVector<HillshadeLayoutVertex> vertices;
gl::IndexVector<gl::Triangles> indices;
gl::IndexVector<gfx::Triangles> indices;
SegmentVector<HillshadeAttributes> segments;
optional<gl::VertexBuffer<HillshadeLayoutVertex>> vertexBuffer;
optional<gl::IndexBuffer<gl::Triangles>> indexBuffer;
optional<gl::IndexBuffer<gfx::Triangles>> indexBuffer;
private:
DEMData demdata;
bool prepared = false;

View File

@@ -44,11 +44,11 @@ public:
PossiblyEvaluatedLayoutProperties layout;
gl::VertexVector<LineLayoutVertex> vertices;
gl::IndexVector<gl::Triangles> triangles;
gl::IndexVector<gfx::Triangles> triangles;
SegmentVector<LineAttributes> segments;
optional<gl::VertexBuffer<LineLayoutVertex>> vertexBuffer;
optional<gl::IndexBuffer<gl::Triangles>> indexBuffer;
optional<gl::IndexBuffer<gfx::Triangles>> indexBuffer;
std::map<std::string, LineProgram::Binders> paintPropertyBinders;

View File

@@ -33,11 +33,11 @@ public:
// Bucket specific vertices are used for Image Sources only
// Raster Tile Sources use the default buffers from Painter
gl::VertexVector<RasterLayoutVertex> vertices;
gl::IndexVector<gl::Triangles> indices;
gl::IndexVector<gfx::Triangles> indices;
SegmentVector<RasterAttributes> segments;
optional<gl::VertexBuffer<RasterLayoutVertex>> vertexBuffer;
optional<gl::IndexBuffer<gl::Triangles>> indexBuffer;
optional<gl::IndexBuffer<gfx::Triangles>> indexBuffer;
};
} // namespace mbgl

View File

@@ -152,7 +152,7 @@ void SymbolBucket::updateOpacity() {
uploaded = false;
}
void addPlacedSymbol(gl::IndexVector<gl::Triangles>& triangles, const PlacedSymbol& placedSymbol) {
void addPlacedSymbol(gl::IndexVector<gfx::Triangles>& triangles, const PlacedSymbol& placedSymbol) {
auto endIndex = placedSymbol.vertexStartIndex + placedSymbol.glyphOffsets.size() * 4;
for (auto vertexIndex = placedSymbol.vertexStartIndex; vertexIndex < endIndex; vertexIndex += 4) {
triangles.emplace_back(vertexIndex + 0, vertexIndex + 1, vertexIndex + 2);

View File

@@ -91,14 +91,14 @@ public:
gl::VertexVector<SymbolLayoutVertex> vertices;
gl::VertexVector<gfx::Vertex<SymbolDynamicLayoutAttributes>> dynamicVertices;
gl::VertexVector<gfx::Vertex<SymbolOpacityAttributes>> opacityVertices;
gl::IndexVector<gl::Triangles> triangles;
gl::IndexVector<gfx::Triangles> triangles;
SegmentVector<SymbolTextAttributes> segments;
std::vector<PlacedSymbol> placedSymbols;
optional<gl::VertexBuffer<SymbolLayoutVertex>> vertexBuffer;
optional<gl::VertexBuffer<gfx::Vertex<SymbolDynamicLayoutAttributes>>> dynamicVertexBuffer;
optional<gl::VertexBuffer<gfx::Vertex<SymbolOpacityAttributes>>> opacityVertexBuffer;
optional<gl::IndexBuffer<gl::Triangles>> indexBuffer;
optional<gl::IndexBuffer<gfx::Triangles>> indexBuffer;
} text;
std::unique_ptr<SymbolSizeBinder> iconSizeBinder;
@@ -107,7 +107,7 @@ public:
gl::VertexVector<SymbolLayoutVertex> vertices;
gl::VertexVector<gfx::Vertex<SymbolDynamicLayoutAttributes>> dynamicVertices;
gl::VertexVector<gfx::Vertex<SymbolOpacityAttributes>> opacityVertices;
gl::IndexVector<gl::Triangles> triangles;
gl::IndexVector<gfx::Triangles> triangles;
SegmentVector<SymbolIconAttributes> segments;
std::vector<PlacedSymbol> placedSymbols;
PremultipliedImage atlasImage;
@@ -115,7 +115,7 @@ public:
optional<gl::VertexBuffer<SymbolLayoutVertex>> vertexBuffer;
optional<gl::VertexBuffer<gfx::Vertex<SymbolDynamicLayoutAttributes>>> dynamicVertexBuffer;
optional<gl::VertexBuffer<gfx::Vertex<SymbolOpacityAttributes>>> opacityVertexBuffer;
optional<gl::IndexBuffer<gl::Triangles>> indexBuffer;
optional<gl::IndexBuffer<gfx::Triangles>> indexBuffer;
} icon;
struct CollisionBuffer {
@@ -128,13 +128,13 @@ public:
};
struct CollisionBoxBuffer : public CollisionBuffer {
gl::IndexVector<gl::Lines> lines;
optional<gl::IndexBuffer<gl::Lines>> indexBuffer;
gl::IndexVector<gfx::Lines> lines;
optional<gl::IndexBuffer<gfx::Lines>> indexBuffer;
} collisionBox;
struct CollisionCircleBuffer : public CollisionBuffer {
gl::IndexVector<gl::Triangles> triangles;
optional<gl::IndexBuffer<gl::Triangles>> indexBuffer;
gl::IndexVector<gfx::Triangles> triangles;
optional<gl::IndexBuffer<gfx::Triangles>> indexBuffer;
} collisionCircle;
uint32_t bucketInstanceId = 0;

View File

@@ -67,7 +67,7 @@ void RenderBackgroundLayer::render(PaintParameters& parameters, RenderSource*) {
program.draw(
parameters.context,
gl::Triangles(),
gfx::Triangles(),
parameters.depthModeForSublayer(0, gl::DepthMode::ReadOnly),
gl::StencilMode::disabled(),
parameters.colorModeForRenderPass(),

View File

@@ -96,7 +96,7 @@ void RenderCircleLayer::render(PaintParameters& parameters, RenderSource*) {
programInstance.draw(
parameters.context,
gl::Triangles(),
gfx::Triangles(),
parameters.depthModeForSublayer(0, gl::DepthMode::ReadOnly),
parameters.mapMode != MapMode::Continuous
? parameters.stencilModeForClipping(tile.clip)

View File

@@ -92,7 +92,7 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource*
programInstance.draw(
parameters.context,
gl::Triangles(),
gfx::Triangles(),
parameters.depthModeFor3D(gl::DepthMode::ReadWrite),
gl::StencilMode::disabled(),
parameters.colorModeForRenderPass(),
@@ -193,7 +193,7 @@ void RenderFillExtrusionLayer::render(PaintParameters& parameters, RenderSource*
programInstance.draw(
parameters.context,
gl::Triangles(),
gfx::Triangles(),
gl::DepthMode::disabled(),
gl::StencilMode::disabled(),
parameters.colorModeForRenderPass(),

View File

@@ -119,7 +119,7 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) {
if ((evaluated.get<FillColor>().constantOr(Color()).a >= 1.0f
&& evaluated.get<FillOpacity>().constantOr(0) >= 1.0f) == (parameters.pass == RenderPass::Opaque)) {
draw(parameters.programs.getFillLayerPrograms().fill,
gl::Triangles(),
gfx::Triangles(),
parameters.depthModeForSublayer(1, parameters.pass == RenderPass::Opaque
? gl::DepthMode::ReadWrite
: gl::DepthMode::ReadOnly),
@@ -129,7 +129,7 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) {
if (evaluated.get<FillAntialias>() && parameters.pass == RenderPass::Translucent) {
draw(parameters.programs.getFillLayerPrograms().fillOutline,
gl::Lines{ 2.0f },
gfx::Lines{ 2.0f },
parameters.depthModeForSublayer(
unevaluated.get<FillOutlineColor>().isUndefined() ? 2 : 0,
gl::DepthMode::ReadOnly),
@@ -205,14 +205,14 @@ void RenderFillLayer::render(PaintParameters& parameters, RenderSource*) {
};
draw(parameters.programs.getFillLayerPrograms().fillPattern,
gl::Triangles(),
gfx::Triangles(),
parameters.depthModeForSublayer(1, gl::DepthMode::ReadWrite),
*bucket.triangleIndexBuffer,
bucket.triangleSegments);
if (evaluated.get<FillAntialias>() && unevaluated.get<FillOutlineColor>().isUndefined()) {
draw(parameters.programs.getFillLayerPrograms().fillOutlinePattern,
gl::Lines { 2.0f },
gfx::Lines { 2.0f },
parameters.depthModeForSublayer(2, gl::DepthMode::ReadOnly),
*bucket.lineIndexBuffer,
bucket.lineSegments);

View File

@@ -119,7 +119,7 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) {
programInstance.draw(
parameters.context,
gl::Triangles(),
gfx::Triangles(),
parameters.depthModeForSublayer(0, gl::DepthMode::ReadOnly),
stencilMode,
gl::ColorMode::additive(),
@@ -167,7 +167,7 @@ void RenderHeatmapLayer::render(PaintParameters& parameters, RenderSource*) {
programInstance.draw(
parameters.context,
gl::Triangles(),
gfx::Triangles(),
gl::DepthMode::disabled(),
gl::StencilMode::disabled(),
parameters.colorModeForRenderPass(),

View File

@@ -96,7 +96,7 @@ void RenderHillshadeLayer::render(PaintParameters& parameters, RenderSource* src
programInstance.draw(
parameters.context,
gl::Triangles(),
gfx::Triangles(),
parameters.depthModeForSublayer(0, gl::DepthMode::ReadOnly),
gl::StencilMode::disabled(),
parameters.colorModeForRenderPass(),
@@ -157,7 +157,7 @@ void RenderHillshadeLayer::render(PaintParameters& parameters, RenderSource* src
programInstance.draw(
parameters.context,
gl::Triangles(),
gfx::Triangles(),
parameters.depthModeForSublayer(0, gl::DepthMode::ReadOnly),
gl::StencilMode::disabled(),
parameters.colorModeForRenderPass(),

View File

@@ -1,4 +1,5 @@
#include <mbgl/renderer/layers/render_line_layer.hpp>
#include <mbgl/renderer/buckets/line_bucket.hpp>
#include <mbgl/renderer/render_tile.hpp>
#include <mbgl/renderer/paint_parameters.hpp>
#include <mbgl/renderer/image_manager.hpp>
@@ -86,7 +87,7 @@ void RenderLineLayer::render(PaintParameters& parameters, RenderSource*) {
programInstance.draw(
parameters.context,
gl::Triangles(),
gfx::Triangles(),
parameters.depthModeForSublayer(0, gl::DepthMode::ReadOnly),
parameters.stencilModeForClipping(tile.clip),
parameters.colorModeForRenderPass(),

View File

@@ -110,7 +110,7 @@ void RenderRasterLayer::render(PaintParameters& parameters, RenderSource* source
programInstance.draw(
parameters.context,
gl::Triangles(),
gfx::Triangles(),
parameters.depthModeForSublayer(0, gl::DepthMode::ReadOnly),
gl::StencilMode::disabled(),
parameters.colorModeForRenderPass(),

View File

@@ -116,7 +116,7 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) {
programInstance.draw(
parameters.context,
gl::Triangles(),
gfx::Triangles(),
values_.pitchAlignment == AlignmentType::Map
? parameters.depthModeForSublayer(0, gl::DepthMode::ReadOnly)
: gl::DepthMode::disabled(),
@@ -251,7 +251,7 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) {
}};
parameters.programs.getSymbolLayerPrograms().collisionBox.draw(
parameters.context,
gl::Lines { 1.0f },
gfx::Lines { 1.0f },
gl::DepthMode::disabled(),
gl::StencilMode::disabled(),
parameters.colorModeForRenderPass(),
@@ -286,7 +286,7 @@ void RenderSymbolLayer::render(PaintParameters& parameters, RenderSource*) {
parameters.programs.getSymbolLayerPrograms().collisionCircle.draw(
parameters.context,
gl::Triangles(),
gfx::Triangles(),
gl::DepthMode::disabled(),
gl::StencilMode::disabled(),
parameters.colorModeForRenderPass(),

View File

@@ -12,15 +12,15 @@ static gl::VertexVector<gfx::Vertex<PositionOnlyLayoutAttributes>> tileVertices(
return result;
}
static gl::IndexVector<gl::Triangles> quadTriangleIndices() {
gl::IndexVector<gl::Triangles> result;
static gl::IndexVector<gfx::Triangles> quadTriangleIndices() {
gl::IndexVector<gfx::Triangles> result;
result.emplace_back(0, 1, 2);
result.emplace_back(1, 2, 3);
return result;
}
static gl::IndexVector<gl::LineStrip> tileLineStripIndices() {
gl::IndexVector<gl::LineStrip> result;
static gl::IndexVector<gfx::LineStrip> tileLineStripIndices() {
gl::IndexVector<gfx::LineStrip> result;
result.emplace_back(0);
result.emplace_back(1);
result.emplace_back(3);

View File

@@ -20,8 +20,8 @@ public:
gl::VertexBuffer<RasterLayoutVertex> rasterVertexBuffer;
gl::VertexBuffer<ExtrusionTextureLayoutVertex> extrusionTextureVertexBuffer;
gl::IndexBuffer<gl::Triangles> quadTriangleIndexBuffer;
gl::IndexBuffer<gl::LineStrip> tileBorderIndexBuffer;
gl::IndexBuffer<gfx::Triangles> quadTriangleIndexBuffer;
gl::IndexBuffer<gfx::LineStrip> tileBorderIndexBuffer;
SegmentVector<BackgroundAttributes> tileTriangleSegments;
SegmentVector<DebugAttributes> tileBorderSegments;

View File

@@ -95,7 +95,7 @@ void RenderTile::finishRender(PaintParameters& parameters) {
program.draw(
parameters.context,
gl::Lines { 4.0f * parameters.pixelRatio },
gfx::Lines { 4.0f * parameters.pixelRatio },
gl::DepthMode::disabled(),
parameters.stencilModeForClipping(clip),
gl::ColorMode::unblended(),
@@ -117,7 +117,7 @@ void RenderTile::finishRender(PaintParameters& parameters) {
program.draw(
parameters.context,
gl::Lines { 2.0f * parameters.pixelRatio },
gfx::Lines { 2.0f * parameters.pixelRatio },
gl::DepthMode::disabled(),
parameters.stencilModeForClipping(clip),
gl::ColorMode::unblended(),
@@ -141,7 +141,7 @@ void RenderTile::finishRender(PaintParameters& parameters) {
if (parameters.debugOptions & MapDebugOptions::TileBorders) {
parameters.programs.debug.draw(
parameters.context,
gl::LineStrip { 4.0f * parameters.pixelRatio },
gfx::LineStrip { 4.0f * parameters.pixelRatio },
gl::DepthMode::disabled(),
parameters.stencilModeForClipping(clip),
gl::ColorMode::unblended(),

View File

@@ -442,7 +442,7 @@ void Renderer::Impl::render(const UpdateParameters& updateParameters) {
program.draw(
parameters.context,
gl::Triangles(),
gfx::Triangles(),
gl::DepthMode::disabled(),
gl::StencilMode {
gl::StencilMode::Always(),

View File

@@ -63,7 +63,7 @@ void RenderImageSource::finishRender(PaintParameters& parameters) {
for (auto matrix : matrices) {
programInstance.draw(
parameters.context,
gl::LineStrip { 4.0f * parameters.pixelRatio },
gfx::LineStrip { 4.0f * parameters.pixelRatio },
gl::DepthMode::disabled(),
gl::StencilMode::disabled(),
gl::ColorMode::unblended(),