diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-10-04 15:26:00 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-10-06 14:47:58 -0700 |
commit | 21d7ee11e1cc0cd129f40df5bea2e07bfcc2a9e4 (patch) | |
tree | 771918967c0bdad79ba98f231d50436e633de369 | |
parent | 388fa9cf1039493f98f24005d1c7ddaa0ff95b3d (diff) | |
download | qtlocation-mapboxgl-21d7ee11e1cc0cd129f40df5bea2e07bfcc2a9e4.tar.gz |
[core] Rationalize shader names
{layer type}{subtype}Shader
-rw-r--r-- | cmake/core-files.cmake | 36 | ||||
-rw-r--r-- | src/mbgl/renderer/debug_bucket.cpp | 12 | ||||
-rw-r--r-- | src/mbgl/renderer/debug_bucket.hpp | 10 | ||||
-rw-r--r-- | src/mbgl/renderer/fill_bucket.cpp | 16 | ||||
-rw-r--r-- | src/mbgl/renderer/fill_bucket.hpp | 26 | ||||
-rw-r--r-- | src/mbgl/renderer/line_bucket.cpp | 6 | ||||
-rw-r--r-- | src/mbgl/renderer/line_bucket.hpp | 6 | ||||
-rw-r--r-- | src/mbgl/renderer/painter.cpp | 4 | ||||
-rw-r--r-- | src/mbgl/renderer/painter.hpp | 12 | ||||
-rw-r--r-- | src/mbgl/renderer/painter_background.cpp | 4 | ||||
-rw-r--r-- | src/mbgl/renderer/painter_clipping.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/renderer/painter_debug.cpp | 4 | ||||
-rw-r--r-- | src/mbgl/renderer/painter_fill.cpp | 8 | ||||
-rw-r--r-- | src/mbgl/renderer/painter_line.cpp | 4 | ||||
-rw-r--r-- | src/mbgl/renderer/painter_symbol.cpp | 10 | ||||
-rw-r--r-- | src/mbgl/renderer/symbol_bucket.cpp | 10 | ||||
-rw-r--r-- | src/mbgl/renderer/symbol_bucket.hpp | 14 | ||||
-rw-r--r-- | src/mbgl/shader/fill_outline_pattern_shader.cpp (renamed from src/mbgl/shader/outlinepattern_shader.cpp) | 6 | ||||
-rw-r--r-- | src/mbgl/shader/fill_outline_pattern_shader.hpp (renamed from src/mbgl/shader/outlinepattern_shader.hpp) | 8 | ||||
-rw-r--r-- | src/mbgl/shader/fill_outline_shader.cpp (renamed from src/mbgl/shader/outline_shader.cpp) | 6 | ||||
-rw-r--r-- | src/mbgl/shader/fill_outline_shader.hpp (renamed from src/mbgl/shader/outline_shader.hpp) | 8 | ||||
-rw-r--r-- | src/mbgl/shader/fill_pattern_shader.cpp (renamed from src/mbgl/shader/pattern_shader.cpp) | 6 | ||||
-rw-r--r-- | src/mbgl/shader/fill_pattern_shader.hpp (renamed from src/mbgl/shader/pattern_shader.hpp) | 8 | ||||
-rw-r--r-- | src/mbgl/shader/fill_shader.cpp (renamed from src/mbgl/shader/plain_shader.cpp) | 6 | ||||
-rw-r--r-- | src/mbgl/shader/fill_shader.hpp (renamed from src/mbgl/shader/plain_shader.hpp) | 8 | ||||
-rw-r--r-- | src/mbgl/shader/fill_vertex.cpp | 7 | ||||
-rw-r--r-- | src/mbgl/shader/fill_vertex.hpp (renamed from src/mbgl/shader/plain_vertex.hpp) | 8 | ||||
-rw-r--r-- | src/mbgl/shader/line_pattern_shader.cpp (renamed from src/mbgl/shader/linepattern_shader.cpp) | 4 | ||||
-rw-r--r-- | src/mbgl/shader/line_pattern_shader.hpp (renamed from src/mbgl/shader/linepattern_shader.hpp) | 4 | ||||
-rw-r--r-- | src/mbgl/shader/line_sdf_shader.cpp (renamed from src/mbgl/shader/linesdf_shader.cpp) | 2 | ||||
-rw-r--r-- | src/mbgl/shader/line_sdf_shader.hpp (renamed from src/mbgl/shader/linesdf_shader.hpp) | 0 | ||||
-rw-r--r-- | src/mbgl/shader/plain_vertex.cpp | 7 | ||||
-rw-r--r-- | src/mbgl/shader/shaders.hpp | 62 | ||||
-rw-r--r-- | src/mbgl/shader/symbol_icon_shader.cpp (renamed from src/mbgl/shader/icon_shader.cpp) | 4 | ||||
-rw-r--r-- | src/mbgl/shader/symbol_icon_shader.hpp (renamed from src/mbgl/shader/icon_shader.hpp) | 4 | ||||
-rw-r--r-- | src/mbgl/shader/symbol_sdf_shader.cpp (renamed from src/mbgl/shader/sdf_shader.cpp) | 4 | ||||
-rw-r--r-- | src/mbgl/shader/symbol_sdf_shader.hpp (renamed from src/mbgl/shader/sdf_shader.hpp) | 4 |
37 files changed, 176 insertions, 174 deletions
diff --git a/cmake/core-files.cmake b/cmake/core-files.cmake index 240571edbb..8940899c16 100644 --- a/cmake/core-files.cmake +++ b/cmake/core-files.cmake @@ -178,33 +178,33 @@ set(MBGL_CORE_FILES src/mbgl/shader/collision_box_shader.hpp src/mbgl/shader/collision_box_vertex.cpp src/mbgl/shader/collision_box_vertex.hpp - src/mbgl/shader/icon_shader.cpp - src/mbgl/shader/icon_shader.hpp + src/mbgl/shader/fill_outline_pattern_shader.cpp + src/mbgl/shader/fill_outline_pattern_shader.hpp + src/mbgl/shader/fill_outline_shader.cpp + src/mbgl/shader/fill_outline_shader.hpp + src/mbgl/shader/fill_pattern_shader.cpp + src/mbgl/shader/fill_pattern_shader.hpp + src/mbgl/shader/fill_shader.cpp + src/mbgl/shader/fill_shader.hpp + src/mbgl/shader/fill_vertex.cpp + src/mbgl/shader/fill_vertex.hpp + src/mbgl/shader/line_pattern_shader.cpp + src/mbgl/shader/line_pattern_shader.hpp + src/mbgl/shader/line_sdf_shader.cpp + src/mbgl/shader/line_sdf_shader.hpp src/mbgl/shader/line_shader.cpp src/mbgl/shader/line_shader.hpp src/mbgl/shader/line_vertex.cpp src/mbgl/shader/line_vertex.hpp - src/mbgl/shader/linepattern_shader.cpp - src/mbgl/shader/linepattern_shader.hpp - src/mbgl/shader/linesdf_shader.cpp - src/mbgl/shader/linesdf_shader.hpp - src/mbgl/shader/outline_shader.cpp - src/mbgl/shader/outline_shader.hpp - src/mbgl/shader/outlinepattern_shader.cpp - src/mbgl/shader/outlinepattern_shader.hpp - src/mbgl/shader/pattern_shader.cpp - src/mbgl/shader/pattern_shader.hpp - src/mbgl/shader/plain_shader.cpp - src/mbgl/shader/plain_shader.hpp - src/mbgl/shader/plain_vertex.cpp - src/mbgl/shader/plain_vertex.hpp src/mbgl/shader/raster_shader.cpp src/mbgl/shader/raster_shader.hpp src/mbgl/shader/raster_vertex.cpp src/mbgl/shader/raster_vertex.hpp - src/mbgl/shader/sdf_shader.cpp - src/mbgl/shader/sdf_shader.hpp src/mbgl/shader/shaders.hpp + src/mbgl/shader/symbol_icon_shader.cpp + src/mbgl/shader/symbol_icon_shader.hpp + src/mbgl/shader/symbol_sdf_shader.cpp + src/mbgl/shader/symbol_sdf_shader.hpp src/mbgl/shader/symbol_vertex.cpp src/mbgl/shader/symbol_vertex.hpp diff --git a/src/mbgl/renderer/debug_bucket.cpp b/src/mbgl/renderer/debug_bucket.cpp index 072cf3ca55..c47ae434be 100644 --- a/src/mbgl/renderer/debug_bucket.cpp +++ b/src/mbgl/renderer/debug_bucket.cpp @@ -1,7 +1,7 @@ #include <mbgl/renderer/debug_bucket.hpp> #include <mbgl/renderer/painter.hpp> -#include <mbgl/shader/plain_shader.hpp> -#include <mbgl/shader/plain_vertex.hpp> +#include <mbgl/shader/fill_shader.hpp> +#include <mbgl/shader/fill_vertex.hpp> #include <mbgl/geometry/debug_font_data.hpp> #include <mbgl/util/string.hpp> @@ -13,13 +13,13 @@ namespace mbgl { -std::vector<PlainVertex> buildTextVertices(const OverscaledTileID& id, +std::vector<FillVertex> buildTextVertices(const OverscaledTileID& id, const bool renderable, const bool complete, optional<Timestamp> modified, optional<Timestamp> expires, MapDebugOptions debugMode) { - std::vector<PlainVertex> textPoints; + std::vector<FillVertex> textPoints; auto addText = [&] (const std::string& text, double left, double baseline, double scale) { for (uint8_t c : text) { @@ -85,14 +85,14 @@ DebugBucket::DebugBucket(const OverscaledTileID& id, vertexBuffer(context.createVertexBuffer(buildTextVertices(id, renderable_, complete_, modified_, expires_, debugMode_))) { } -void DebugBucket::drawLines(PlainShader& shader, gl::Context& context) { +void DebugBucket::drawLines(FillShader& shader, gl::Context& context) { if (vertexBuffer.vertexCount != 0) { array.bind(shader, vertexBuffer, BUFFER_OFFSET_0, context); MBGL_CHECK_ERROR(glDrawArrays(GL_LINES, 0, static_cast<GLsizei>(vertexBuffer.vertexCount))); } } -void DebugBucket::drawPoints(PlainShader& shader, gl::Context& context) { +void DebugBucket::drawPoints(FillShader& shader, gl::Context& context) { if (vertexBuffer.vertexCount != 0) { array.bind(shader, vertexBuffer, BUFFER_OFFSET_0, context); MBGL_CHECK_ERROR(glDrawArrays(GL_POINTS, 0, static_cast<GLsizei>(vertexBuffer.vertexCount))); diff --git a/src/mbgl/renderer/debug_bucket.hpp b/src/mbgl/renderer/debug_bucket.hpp index 9ba2525d9c..89087f0010 100644 --- a/src/mbgl/renderer/debug_bucket.hpp +++ b/src/mbgl/renderer/debug_bucket.hpp @@ -7,12 +7,12 @@ #include <mbgl/util/noncopyable.hpp> #include <mbgl/gl/vertex_buffer.hpp> #include <mbgl/gl/vao.hpp> -#include <mbgl/shader/plain_vertex.hpp> +#include <mbgl/shader/fill_vertex.hpp> namespace mbgl { class OverscaledTileID; -class PlainShader; +class FillShader; namespace gl { class Context; @@ -28,8 +28,8 @@ public: MapDebugOptions, gl::Context&); - void drawLines(PlainShader&, gl::Context&); - void drawPoints(PlainShader&, gl::Context&); + void drawLines(FillShader&, gl::Context&); + void drawPoints(FillShader&, gl::Context&); const bool renderable; const bool complete; @@ -38,7 +38,7 @@ public: const MapDebugOptions debugMode; private: - gl::VertexBuffer<PlainVertex> vertexBuffer; + gl::VertexBuffer<FillVertex> vertexBuffer; gl::VertexArrayObject array; }; diff --git a/src/mbgl/renderer/fill_bucket.cpp b/src/mbgl/renderer/fill_bucket.cpp index f570d59743..cd4277cabc 100644 --- a/src/mbgl/renderer/fill_bucket.cpp +++ b/src/mbgl/renderer/fill_bucket.cpp @@ -1,10 +1,10 @@ #include <mbgl/renderer/fill_bucket.hpp> #include <mbgl/style/layers/fill_layer.hpp> #include <mbgl/renderer/painter.hpp> -#include <mbgl/shader/plain_shader.hpp> -#include <mbgl/shader/pattern_shader.hpp> -#include <mbgl/shader/outline_shader.hpp> -#include <mbgl/shader/outlinepattern_shader.hpp> +#include <mbgl/shader/fill_shader.hpp> +#include <mbgl/shader/fill_pattern_shader.hpp> +#include <mbgl/shader/fill_outline_shader.hpp> +#include <mbgl/shader/fill_outline_pattern_shader.hpp> #include <mbgl/gl/gl.hpp> #include <mbgl/platform/log.hpp> @@ -121,7 +121,7 @@ bool FillBucket::needsClipping() const { return true; } -void FillBucket::drawElements(PlainShader& shader, +void FillBucket::drawElements(FillShader& shader, gl::Context& context, PaintMode paintMode) { GLbyte* vertex_index = BUFFER_OFFSET(0); @@ -136,7 +136,7 @@ void FillBucket::drawElements(PlainShader& shader, } } -void FillBucket::drawElements(PatternShader& shader, +void FillBucket::drawElements(FillPatternShader& shader, gl::Context& context, PaintMode paintMode) { GLbyte* vertex_index = BUFFER_OFFSET(0); @@ -151,7 +151,7 @@ void FillBucket::drawElements(PatternShader& shader, } } -void FillBucket::drawVertices(OutlineShader& shader, +void FillBucket::drawVertices(FillOutlineShader& shader, gl::Context& context, PaintMode paintMode) { GLbyte* vertex_index = BUFFER_OFFSET(0); @@ -166,7 +166,7 @@ void FillBucket::drawVertices(OutlineShader& shader, } } -void FillBucket::drawVertices(OutlinePatternShader& shader, +void FillBucket::drawVertices(FillOutlinePatternShader& shader, gl::Context& context, PaintMode paintMode) { GLbyte* vertex_index = BUFFER_OFFSET(0); diff --git a/src/mbgl/renderer/fill_bucket.hpp b/src/mbgl/renderer/fill_bucket.hpp index 2ec9fc0e5b..34cd886687 100644 --- a/src/mbgl/renderer/fill_bucket.hpp +++ b/src/mbgl/renderer/fill_bucket.hpp @@ -5,17 +5,17 @@ #include <mbgl/tile/geometry_tile_data.hpp> #include <mbgl/gl/vertex_buffer.hpp> #include <mbgl/gl/index_buffer.hpp> -#include <mbgl/shader/plain_vertex.hpp> +#include <mbgl/shader/fill_vertex.hpp> #include <vector> #include <memory> namespace mbgl { -class OutlinePatternShader; -class PlainShader; -class PatternShader; -class OutlineShader; +class FillShader; +class FillPatternShader; +class FillOutlineShader; +class FillOutlinePatternShader; class FillBucket : public Bucket { public: @@ -29,20 +29,20 @@ public: void addGeometry(const GeometryCollection&); - void drawElements(PlainShader&, gl::Context&, PaintMode); - void drawElements(PatternShader&, gl::Context&, PaintMode); - void drawVertices(OutlineShader&, gl::Context&, PaintMode); - void drawVertices(OutlinePatternShader&, gl::Context&, PaintMode); + void drawElements(FillShader&, gl::Context&, PaintMode); + void drawElements(FillPatternShader&, gl::Context&, PaintMode); + void drawVertices(FillOutlineShader&, gl::Context&, PaintMode); + void drawVertices(FillOutlinePatternShader&, gl::Context&, PaintMode); private: - std::vector<PlainVertex> vertices; + std::vector<FillVertex> vertices; std::vector<gl::Line> lines; std::vector<gl::Triangle> triangles; - std::vector<ElementGroup<OutlineShader, OutlinePatternShader>> lineGroups; - std::vector<ElementGroup<PlainShader, PatternShader>> triangleGroups; + std::vector<ElementGroup<FillOutlineShader, FillOutlinePatternShader>> lineGroups; + std::vector<ElementGroup<FillShader, FillPatternShader>> triangleGroups; - optional<gl::VertexBuffer<PlainVertex>> vertexBuffer; + optional<gl::VertexBuffer<FillVertex>> vertexBuffer; optional<gl::IndexBuffer<gl::Line>> lineIndexBuffer; optional<gl::IndexBuffer<gl::Triangle>> triangleIndexBuffer; }; diff --git a/src/mbgl/renderer/line_bucket.cpp b/src/mbgl/renderer/line_bucket.cpp index 6ec265d727..7a5309bafc 100644 --- a/src/mbgl/renderer/line_bucket.cpp +++ b/src/mbgl/renderer/line_bucket.cpp @@ -2,8 +2,8 @@ #include <mbgl/style/layers/line_layer.hpp> #include <mbgl/renderer/painter.hpp> #include <mbgl/shader/line_shader.hpp> -#include <mbgl/shader/linesdf_shader.hpp> -#include <mbgl/shader/linepattern_shader.hpp> +#include <mbgl/shader/line_sdf_shader.hpp> +#include <mbgl/shader/line_pattern_shader.hpp> #include <mbgl/util/math.hpp> #include <mbgl/util/constants.hpp> #include <mbgl/gl/gl.hpp> @@ -493,7 +493,7 @@ void LineBucket::drawLineSDF(LineSDFShader& shader, } } -void LineBucket::drawLinePatterns(LinepatternShader& shader, +void LineBucket::drawLinePatterns(LinePatternShader& shader, gl::Context& context, PaintMode paintMode) { GLbyte* vertex_index = BUFFER_OFFSET(0); diff --git a/src/mbgl/renderer/line_bucket.hpp b/src/mbgl/renderer/line_bucket.hpp index ca07c345da..14af710877 100644 --- a/src/mbgl/renderer/line_bucket.hpp +++ b/src/mbgl/renderer/line_bucket.hpp @@ -14,7 +14,7 @@ namespace mbgl { class LineShader; class LineSDFShader; -class LinepatternShader; +class LinePatternShader; class LineBucket : public Bucket { @@ -32,7 +32,7 @@ public: void drawLines(LineShader&, gl::Context&, PaintMode); void drawLineSDF(LineSDFShader&, gl::Context&, PaintMode); - void drawLinePatterns(LinepatternShader&, gl::Context&, PaintMode); + void drawLinePatterns(LinePatternShader&, gl::Context&, PaintMode); private: struct TriangleElement { @@ -53,7 +53,7 @@ private: std::vector<LineVertex> vertices; std::vector<gl::Triangle> triangles; - std::vector<ElementGroup<LineShader, LineSDFShader, LinepatternShader>> groups; + std::vector<ElementGroup<LineShader, LineSDFShader, LinePatternShader>> groups; optional<gl::VertexBuffer<LineVertex>> vertexBuffer; optional<gl::IndexBuffer<gl::Triangle>> indexBuffer; diff --git a/src/mbgl/renderer/painter.cpp b/src/mbgl/renderer/painter.cpp index cc0724d62a..ad0e75cd92 100644 --- a/src/mbgl/renderer/painter.cpp +++ b/src/mbgl/renderer/painter.cpp @@ -40,7 +40,7 @@ using namespace style; Painter::Painter(const TransformState& state_) : state(state_), - tileTriangleVertexBuffer(context.createVertexBuffer(std::vector<PlainVertex> {{ + tileTriangleVertexBuffer(context.createVertexBuffer(std::vector<FillVertex> {{ { 0, 0 }, { util::EXTENT, 0 }, { 0, util::EXTENT }, @@ -48,7 +48,7 @@ Painter::Painter(const TransformState& state_) { 0, util::EXTENT }, { util::EXTENT, util::EXTENT } }})), - tileLineStripVertexBuffer(context.createVertexBuffer(std::vector<PlainVertex> {{ + tileLineStripVertexBuffer(context.createVertexBuffer(std::vector<FillVertex> {{ { 0, 0 }, { util::EXTENT, 0 }, { util::EXTENT, util::EXTENT }, diff --git a/src/mbgl/renderer/painter.hpp b/src/mbgl/renderer/painter.hpp index bfa893f28e..28aa5aab44 100644 --- a/src/mbgl/renderer/painter.hpp +++ b/src/mbgl/renderer/painter.hpp @@ -10,7 +10,7 @@ #include <mbgl/gl/vao.hpp> #include <mbgl/gl/context.hpp> -#include <mbgl/shader/plain_vertex.hpp> +#include <mbgl/shader/fill_vertex.hpp> #include <mbgl/shader/raster_vertex.hpp> #include <mbgl/style/style.hpp> @@ -41,7 +41,7 @@ class SymbolBucket; class RasterBucket; class Shaders; -class SDFShader; +class SymbolSDFShader; class PaintParameters; struct ClipID; @@ -121,8 +121,8 @@ private: const RenderTile&, float scaleDivisor, std::array<float, 2> texsize, - SDFShader& sdfShader, - void (SymbolBucket::*drawSDF)(SDFShader&, gl::Context&, PaintMode), + SymbolSDFShader& sdfShader, + void (SymbolBucket::*drawSDF)(SymbolSDFShader&, gl::Context&, PaintMode), // Layout style::AlignmentType rotationAlignment, @@ -188,8 +188,8 @@ private: std::unique_ptr<Shaders> overdrawShaders; #endif - gl::VertexBuffer<PlainVertex> tileTriangleVertexBuffer; - gl::VertexBuffer<PlainVertex> tileLineStripVertexBuffer; + gl::VertexBuffer<FillVertex> tileTriangleVertexBuffer; + gl::VertexBuffer<FillVertex> tileLineStripVertexBuffer; gl::VertexBuffer<RasterVertex> rasterVertexBuffer; gl::VertexArrayObject tileBorderArray; diff --git a/src/mbgl/renderer/painter_background.cpp b/src/mbgl/renderer/painter_background.cpp index 49efbef286..61ec76d1d8 100644 --- a/src/mbgl/renderer/painter_background.cpp +++ b/src/mbgl/renderer/painter_background.cpp @@ -22,8 +22,8 @@ void Painter::renderBackground(PaintParameters& parameters, const BackgroundLaye optional<SpriteAtlasPosition> imagePosA; optional<SpriteAtlasPosition> imagePosB; - auto& patternShader = parameters.shaders.pattern; - auto& plainShader = parameters.shaders.plain; + auto& patternShader = parameters.shaders.fillPattern; + auto& plainShader = parameters.shaders.fill; auto& arrayBackgroundPattern = parameters.shaders.backgroundPatternArray; auto& arrayBackground = parameters.shaders.backgroundArray; diff --git a/src/mbgl/renderer/painter_clipping.cpp b/src/mbgl/renderer/painter_clipping.cpp index b585c03b4a..68f580c280 100644 --- a/src/mbgl/renderer/painter_clipping.cpp +++ b/src/mbgl/renderer/painter_clipping.cpp @@ -14,7 +14,7 @@ namespace mbgl { void Painter::drawClippingMasks(PaintParameters& parameters, const std::map<UnwrappedTileID, ClipID>& stencils) { MBGL_DEBUG_GROUP("clipping masks"); - auto& plainShader = parameters.shaders.plain; + auto& plainShader = parameters.shaders.fill; auto& arrayCoveringPlain = parameters.shaders.coveringPlainArray; mat4 matrix; diff --git a/src/mbgl/renderer/painter_debug.cpp b/src/mbgl/renderer/painter_debug.cpp index 60300d5620..23a2a8e571 100644 --- a/src/mbgl/renderer/painter_debug.cpp +++ b/src/mbgl/renderer/painter_debug.cpp @@ -38,7 +38,7 @@ void Painter::renderDebugText(Tile& tile, const mat4 &matrix) { tile.expires, frame.debugOptions, context); } - auto& plainShader = shaders->plain; + auto& plainShader = shaders->fill; context.program = plainShader.getID(); plainShader.u_matrix = matrix; plainShader.u_opacity = 1.0f; @@ -74,7 +74,7 @@ void Painter::renderDebugFrame(const mat4 &matrix) { gl::StencilTestOperation::Replace }; context.stencilTest = true; - auto& plainShader = shaders->plain; + auto& plainShader = shaders->fill; context.program = plainShader.getID(); plainShader.u_matrix = matrix; plainShader.u_opacity = 1.0f; diff --git a/src/mbgl/renderer/painter_fill.cpp b/src/mbgl/renderer/painter_fill.cpp index 6d6ae4df61..50ead900f6 100644 --- a/src/mbgl/renderer/painter_fill.cpp +++ b/src/mbgl/renderer/painter_fill.cpp @@ -43,10 +43,10 @@ void Painter::renderFill(PaintParameters& parameters, context.depthMask = true; context.lineWidth = 2.0f; // This is always fixed and does not depend on the pixelRatio! - auto& outlineShader = parameters.shaders.outline; - auto& patternShader = parameters.shaders.pattern; - auto& outlinePatternShader = parameters.shaders.outlinePattern; - auto& plainShader = parameters.shaders.plain; + auto& outlineShader = parameters.shaders.fillOutline; + auto& patternShader = parameters.shaders.fillPattern; + auto& outlinePatternShader = parameters.shaders.fillOutlinePattern; + auto& plainShader = parameters.shaders.fill; // Because we're drawing top-to-bottom, and we update the stencil mask // befrom, we have to draw the outline first (!) diff --git a/src/mbgl/renderer/painter_line.cpp b/src/mbgl/renderer/painter_line.cpp index ee749746b9..85a5786353 100644 --- a/src/mbgl/renderer/painter_line.cpp +++ b/src/mbgl/renderer/painter_line.cpp @@ -57,8 +57,8 @@ void Painter::renderLine(PaintParameters& parameters, setDepthSublayer(0); - auto& linesdfShader = parameters.shaders.linesdf; - auto& linepatternShader = parameters.shaders.linepattern; + auto& linesdfShader = parameters.shaders.lineSDF; + auto& linepatternShader = parameters.shaders.linePattern; auto& lineShader = parameters.shaders.line; if (!properties.lineDasharray.value.from.empty()) { diff --git a/src/mbgl/renderer/painter_symbol.cpp b/src/mbgl/renderer/painter_symbol.cpp index a91329d003..ca77215618 100644 --- a/src/mbgl/renderer/painter_symbol.cpp +++ b/src/mbgl/renderer/painter_symbol.cpp @@ -19,8 +19,8 @@ void Painter::renderSDF(SymbolBucket& bucket, const RenderTile& tile, float sdfFontSize, std::array<float, 2> texsize, - SDFShader& sdfShader, - void (SymbolBucket::*drawSDF)(SDFShader&, gl::Context&, PaintMode), + SymbolSDFShader& sdfShader, + void (SymbolBucket::*drawSDF)(SymbolSDFShader&, gl::Context&, PaintMode), // Layout AlignmentType rotationAlignment, @@ -168,7 +168,7 @@ void Painter::renderSymbol(PaintParameters& parameters, tile, 1.0f, {{ float(activeSpriteAtlas->getWidth()) / 4.0f, float(activeSpriteAtlas->getHeight()) / 4.0f }}, - parameters.shaders.sdfIcon, + parameters.shaders.symbolIconSDF, &SymbolBucket::drawIcons, layout.iconRotationAlignment, // icon-pitch-alignment is not yet implemented @@ -200,7 +200,7 @@ void Painter::renderSymbol(PaintParameters& parameters, }}; } - auto& iconShader = parameters.shaders.icon; + auto& iconShader = parameters.shaders.symbolIcon; context.program = iconShader.getID(); iconShader.u_matrix = vtxMatrix; @@ -235,7 +235,7 @@ void Painter::renderSymbol(PaintParameters& parameters, tile, 24.0f, {{ float(glyphAtlas->width) / 4, float(glyphAtlas->height) / 4 }}, - parameters.shaders.sdfGlyph, + parameters.shaders.symbolGlyph, &SymbolBucket::drawGlyphs, layout.textRotationAlignment, layout.textPitchAlignment, diff --git a/src/mbgl/renderer/symbol_bucket.cpp b/src/mbgl/renderer/symbol_bucket.cpp index ba064e4cc3..565c58c7ed 100644 --- a/src/mbgl/renderer/symbol_bucket.cpp +++ b/src/mbgl/renderer/symbol_bucket.cpp @@ -1,8 +1,8 @@ #include <mbgl/renderer/symbol_bucket.hpp> #include <mbgl/renderer/painter.hpp> #include <mbgl/style/layers/symbol_layer.hpp> -#include <mbgl/shader/sdf_shader.hpp> -#include <mbgl/shader/icon_shader.hpp> +#include <mbgl/shader/symbol_sdf_shader.hpp> +#include <mbgl/shader/symbol_icon_shader.hpp> #include <mbgl/shader/collision_box_shader.hpp> #include <mbgl/gl/gl.hpp> @@ -66,7 +66,7 @@ bool SymbolBucket::needsClipping() const { return mode == MapMode::Still; } -void SymbolBucket::drawGlyphs(SDFShader& shader, +void SymbolBucket::drawGlyphs(SymbolSDFShader& shader, gl::Context& context, PaintMode paintMode) { GLbyte* vertex_index = BUFFER_OFFSET_0; @@ -81,7 +81,7 @@ void SymbolBucket::drawGlyphs(SDFShader& shader, } } -void SymbolBucket::drawIcons(SDFShader& shader, +void SymbolBucket::drawIcons(SymbolSDFShader& shader, gl::Context& context, PaintMode paintMode) { GLbyte* vertex_index = BUFFER_OFFSET_0; @@ -96,7 +96,7 @@ void SymbolBucket::drawIcons(SDFShader& shader, } } -void SymbolBucket::drawIcons(IconShader& shader, +void SymbolBucket::drawIcons(SymbolIconShader& shader, gl::Context& context, PaintMode paintMode) { GLbyte* vertex_index = BUFFER_OFFSET_0; diff --git a/src/mbgl/renderer/symbol_bucket.hpp b/src/mbgl/renderer/symbol_bucket.hpp index 33315ada37..e5180c31e2 100644 --- a/src/mbgl/renderer/symbol_bucket.hpp +++ b/src/mbgl/renderer/symbol_bucket.hpp @@ -15,8 +15,8 @@ namespace mbgl { -class SDFShader; -class IconShader; +class SymbolSDFShader; +class SymbolIconShader; class CollisionBoxShader; class SymbolBucket : public Bucket { @@ -34,9 +34,9 @@ public: bool hasCollisionBoxData() const; bool needsClipping() const override; - void drawGlyphs(SDFShader&, gl::Context&, PaintMode); - void drawIcons(SDFShader&, gl::Context&, PaintMode); - void drawIcons(IconShader&, gl::Context&, PaintMode); + void drawGlyphs(SymbolSDFShader&, gl::Context&, PaintMode); + void drawIcons(SymbolSDFShader&, gl::Context&, PaintMode); + void drawIcons(SymbolIconShader&, gl::Context&, PaintMode); void drawCollisionBoxes(CollisionBoxShader&, gl::Context&); const MapMode mode; @@ -50,7 +50,7 @@ private: struct TextBuffer { std::vector<SymbolVertex> vertices; std::vector<gl::Triangle> triangles; - std::vector<ElementGroup<SDFShader>> groups; + std::vector<ElementGroup<SymbolSDFShader>> groups; optional<gl::VertexBuffer<SymbolVertex>> vertexBuffer; optional<gl::IndexBuffer<gl::Triangle>> indexBuffer; @@ -59,7 +59,7 @@ private: struct IconBuffer { std::vector<SymbolVertex> vertices; std::vector<gl::Triangle> triangles; - std::vector<ElementGroup<SDFShader, IconShader>> groups; + std::vector<ElementGroup<SymbolSDFShader, SymbolIconShader>> groups; optional<gl::VertexBuffer<SymbolVertex>> vertexBuffer; optional<gl::IndexBuffer<gl::Triangle>> indexBuffer; diff --git a/src/mbgl/shader/outlinepattern_shader.cpp b/src/mbgl/shader/fill_outline_pattern_shader.cpp index 1b2c4ac894..c41fda27fb 100644 --- a/src/mbgl/shader/outlinepattern_shader.cpp +++ b/src/mbgl/shader/fill_outline_pattern_shader.cpp @@ -1,11 +1,11 @@ -#include <mbgl/shader/outlinepattern_shader.hpp> +#include <mbgl/shader/fill_outline_pattern_shader.hpp> #include <mbgl/shader/outlinepattern.vertex.hpp> #include <mbgl/shader/outlinepattern.fragment.hpp> -#include <mbgl/shader/plain_vertex.hpp> +#include <mbgl/shader/fill_vertex.hpp> namespace mbgl { -OutlinePatternShader::OutlinePatternShader(gl::Context& context, Defines defines) +FillOutlinePatternShader::FillOutlinePatternShader(gl::Context& context, Defines defines) : Shader(shaders::outlinepattern::name, shaders::outlinepattern::vertex, shaders::outlinepattern::fragment, diff --git a/src/mbgl/shader/outlinepattern_shader.hpp b/src/mbgl/shader/fill_outline_pattern_shader.hpp index 9e9c47e7a9..630e6a7ce8 100644 --- a/src/mbgl/shader/outlinepattern_shader.hpp +++ b/src/mbgl/shader/fill_outline_pattern_shader.hpp @@ -6,13 +6,13 @@ namespace mbgl { -class PlainVertex; +class FillVertex; -class OutlinePatternShader : public gl::Shader { +class FillOutlinePatternShader : public gl::Shader { public: - OutlinePatternShader(gl::Context&, Defines defines = None); + FillOutlinePatternShader(gl::Context&, Defines defines = None); - using VertexType = PlainVertex; + using VertexType = FillVertex; gl::Attribute<int16_t, 2> a_pos = {"a_pos", *this}; diff --git a/src/mbgl/shader/outline_shader.cpp b/src/mbgl/shader/fill_outline_shader.cpp index 5566a343e3..e14004a6bd 100644 --- a/src/mbgl/shader/outline_shader.cpp +++ b/src/mbgl/shader/fill_outline_shader.cpp @@ -1,11 +1,11 @@ -#include <mbgl/shader/outline_shader.hpp> +#include <mbgl/shader/fill_outline_shader.hpp> #include <mbgl/shader/outline.vertex.hpp> #include <mbgl/shader/outline.fragment.hpp> -#include <mbgl/shader/plain_vertex.hpp> +#include <mbgl/shader/fill_vertex.hpp> namespace mbgl { -OutlineShader::OutlineShader(gl::Context& context, Defines defines) +FillOutlineShader::FillOutlineShader(gl::Context& context, Defines defines) : Shader(shaders::outline::name, shaders::outline::vertex, shaders::outline::fragment, diff --git a/src/mbgl/shader/outline_shader.hpp b/src/mbgl/shader/fill_outline_shader.hpp index f9a3456864..c20bc187d3 100644 --- a/src/mbgl/shader/outline_shader.hpp +++ b/src/mbgl/shader/fill_outline_shader.hpp @@ -7,13 +7,13 @@ namespace mbgl { -class PlainVertex; +class FillVertex; -class OutlineShader : public gl::Shader { +class FillOutlineShader : public gl::Shader { public: - OutlineShader(gl::Context&, Defines defines = None); + FillOutlineShader(gl::Context&, Defines defines = None); - using VertexType = PlainVertex; + using VertexType = FillVertex; gl::Attribute<int16_t, 2> a_pos = {"a_pos", *this}; diff --git a/src/mbgl/shader/pattern_shader.cpp b/src/mbgl/shader/fill_pattern_shader.cpp index 89600bb54d..2cdfbc7940 100644 --- a/src/mbgl/shader/pattern_shader.cpp +++ b/src/mbgl/shader/fill_pattern_shader.cpp @@ -1,11 +1,11 @@ -#include <mbgl/shader/pattern_shader.hpp> +#include <mbgl/shader/fill_pattern_shader.hpp> #include <mbgl/shader/pattern.vertex.hpp> #include <mbgl/shader/pattern.fragment.hpp> -#include <mbgl/shader/plain_vertex.hpp> +#include <mbgl/shader/fill_vertex.hpp> namespace mbgl { -PatternShader::PatternShader(gl::Context& context, Defines defines) +FillPatternShader::FillPatternShader(gl::Context& context, Defines defines) : Shader(shaders::pattern::name, shaders::pattern::vertex, shaders::pattern::fragment, diff --git a/src/mbgl/shader/pattern_shader.hpp b/src/mbgl/shader/fill_pattern_shader.hpp index 8d06bb2962..36be538000 100644 --- a/src/mbgl/shader/pattern_shader.hpp +++ b/src/mbgl/shader/fill_pattern_shader.hpp @@ -6,13 +6,13 @@ namespace mbgl { -class PlainVertex; +class FillVertex; -class PatternShader : public gl::Shader { +class FillPatternShader : public gl::Shader { public: - PatternShader(gl::Context&, Defines defines = None); + FillPatternShader(gl::Context&, Defines defines = None); - using VertexType = PlainVertex; + using VertexType = FillVertex; gl::Attribute<int16_t, 2> a_pos = {"a_pos", *this}; diff --git a/src/mbgl/shader/plain_shader.cpp b/src/mbgl/shader/fill_shader.cpp index 03ba9a4c8f..7026bb2f1c 100644 --- a/src/mbgl/shader/plain_shader.cpp +++ b/src/mbgl/shader/fill_shader.cpp @@ -1,11 +1,11 @@ -#include <mbgl/shader/plain_shader.hpp> +#include <mbgl/shader/fill_shader.hpp> #include <mbgl/shader/fill.vertex.hpp> #include <mbgl/shader/fill.fragment.hpp> -#include <mbgl/shader/plain_vertex.hpp> +#include <mbgl/shader/fill_vertex.hpp> namespace mbgl { -PlainShader::PlainShader(gl::Context& context, Defines defines) +FillShader::FillShader(gl::Context& context, Defines defines) : Shader(shaders::fill::name, shaders::fill::vertex, shaders::fill::fragment, diff --git a/src/mbgl/shader/plain_shader.hpp b/src/mbgl/shader/fill_shader.hpp index b7173d0943..1240b73aa2 100644 --- a/src/mbgl/shader/plain_shader.hpp +++ b/src/mbgl/shader/fill_shader.hpp @@ -7,13 +7,13 @@ namespace mbgl { -class PlainVertex; +class FillVertex; -class PlainShader : public gl::Shader { +class FillShader : public gl::Shader { public: - PlainShader(gl::Context&, Defines defines = None); + FillShader(gl::Context&, Defines defines = None); - using VertexType = PlainVertex; + using VertexType = FillVertex; gl::Attribute<int16_t, 2> a_pos = {"a_pos", *this}; diff --git a/src/mbgl/shader/fill_vertex.cpp b/src/mbgl/shader/fill_vertex.cpp new file mode 100644 index 0000000000..c39a0b96b1 --- /dev/null +++ b/src/mbgl/shader/fill_vertex.cpp @@ -0,0 +1,7 @@ +#include <mbgl/shader/fill_vertex.hpp> + +namespace mbgl { + +static_assert(sizeof(FillVertex) == 4, "expected FillVertex size"); + +} // namespace mbgl diff --git a/src/mbgl/shader/plain_vertex.hpp b/src/mbgl/shader/fill_vertex.hpp index 0d164d1267..1b8130382a 100644 --- a/src/mbgl/shader/plain_vertex.hpp +++ b/src/mbgl/shader/fill_vertex.hpp @@ -7,9 +7,9 @@ namespace mbgl { -class PlainVertex { +class FillVertex { public: - PlainVertex(int16_t x, int16_t y) + FillVertex(int16_t x, int16_t y) : a_pos { x, y } {} const int16_t a_pos[2]; @@ -18,10 +18,10 @@ public: namespace gl { template <class Shader> -struct AttributeBindings<Shader, PlainVertex> { +struct AttributeBindings<Shader, FillVertex> { std::array<AttributeBinding, 1> operator()(const Shader& shader) { return {{ - MBGL_MAKE_ATTRIBUTE_BINDING(PlainVertex, shader, a_pos) + MBGL_MAKE_ATTRIBUTE_BINDING(FillVertex, shader, a_pos) }}; }; }; diff --git a/src/mbgl/shader/linepattern_shader.cpp b/src/mbgl/shader/line_pattern_shader.cpp index 0f3fb415ac..bf091a7e86 100644 --- a/src/mbgl/shader/linepattern_shader.cpp +++ b/src/mbgl/shader/line_pattern_shader.cpp @@ -1,11 +1,11 @@ -#include <mbgl/shader/linepattern_shader.hpp> +#include <mbgl/shader/line_pattern_shader.hpp> #include <mbgl/shader/linepattern.vertex.hpp> #include <mbgl/shader/linepattern.fragment.hpp> #include <mbgl/shader/line_vertex.hpp> namespace mbgl { -LinepatternShader::LinepatternShader(gl::Context& context, Defines defines) +LinePatternShader::LinePatternShader(gl::Context& context, Defines defines) : Shader(shaders::linepattern::name, shaders::linepattern::vertex, shaders::linepattern::fragment, diff --git a/src/mbgl/shader/linepattern_shader.hpp b/src/mbgl/shader/line_pattern_shader.hpp index 22ee32564f..1bd6085c8b 100644 --- a/src/mbgl/shader/linepattern_shader.hpp +++ b/src/mbgl/shader/line_pattern_shader.hpp @@ -8,9 +8,9 @@ namespace mbgl { class LineVertex; -class LinepatternShader : public gl::Shader { +class LinePatternShader : public gl::Shader { public: - LinepatternShader(gl::Context&, Defines defines = None); + LinePatternShader(gl::Context&, Defines defines = None); using VertexType = LineVertex; diff --git a/src/mbgl/shader/linesdf_shader.cpp b/src/mbgl/shader/line_sdf_shader.cpp index 507c0f9499..11583d716b 100644 --- a/src/mbgl/shader/linesdf_shader.cpp +++ b/src/mbgl/shader/line_sdf_shader.cpp @@ -1,4 +1,4 @@ -#include <mbgl/shader/linesdf_shader.hpp> +#include <mbgl/shader/line_sdf_shader.hpp> #include <mbgl/shader/linesdfpattern.vertex.hpp> #include <mbgl/shader/linesdfpattern.fragment.hpp> #include <mbgl/shader/line_vertex.hpp> diff --git a/src/mbgl/shader/linesdf_shader.hpp b/src/mbgl/shader/line_sdf_shader.hpp index d74e42e50f..d74e42e50f 100644 --- a/src/mbgl/shader/linesdf_shader.hpp +++ b/src/mbgl/shader/line_sdf_shader.hpp diff --git a/src/mbgl/shader/plain_vertex.cpp b/src/mbgl/shader/plain_vertex.cpp deleted file mode 100644 index 5f0c71497a..0000000000 --- a/src/mbgl/shader/plain_vertex.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include <mbgl/shader/plain_vertex.hpp> - -namespace mbgl { - -static_assert(sizeof(PlainVertex) == 4, "expected PlainVertex size"); - -} // namespace mbgl diff --git a/src/mbgl/shader/shaders.hpp b/src/mbgl/shader/shaders.hpp index b263ee8d0e..937ee85f44 100644 --- a/src/mbgl/shader/shaders.hpp +++ b/src/mbgl/shader/shaders.hpp @@ -1,51 +1,53 @@ #pragma once -#include <mbgl/shader/pattern_shader.hpp> -#include <mbgl/shader/plain_shader.hpp> -#include <mbgl/shader/outline_shader.hpp> -#include <mbgl/shader/outlinepattern_shader.hpp> +#include <mbgl/shader/circle_shader.hpp> +#include <mbgl/shader/fill_shader.hpp> +#include <mbgl/shader/fill_pattern_shader.hpp> +#include <mbgl/shader/fill_outline_shader.hpp> +#include <mbgl/shader/fill_outline_pattern_shader.hpp> #include <mbgl/shader/line_shader.hpp> -#include <mbgl/shader/linesdf_shader.hpp> -#include <mbgl/shader/linepattern_shader.hpp> -#include <mbgl/shader/icon_shader.hpp> +#include <mbgl/shader/line_sdf_shader.hpp> +#include <mbgl/shader/line_pattern_shader.hpp> #include <mbgl/shader/raster_shader.hpp> -#include <mbgl/shader/sdf_shader.hpp> +#include <mbgl/shader/symbol_icon_shader.hpp> +#include <mbgl/shader/symbol_sdf_shader.hpp> + #include <mbgl/shader/collision_box_shader.hpp> -#include <mbgl/shader/circle_shader.hpp> namespace mbgl { class Shaders { public: Shaders(gl::Context& context, gl::Shader::Defines defines = gl::Shader::None) - : plain(context, defines), - outline(context, defines), - outlinePattern(context, defines), + : circle(context, defines), + fill(context, defines), + fillPattern(context, defines), + fillOutline(context, defines), + fillOutlinePattern(context, defines), line(context, defines), - linesdf(context, defines), - linepattern(context, defines), - pattern(context, defines), - icon(context, defines), + lineSDF(context, defines), + linePattern(context, defines), raster(context, defines), - sdfGlyph(context, defines), - sdfIcon(context, defines), - collisionBox(context), - circle(context, defines) { + symbolIcon(context, defines), + symbolIconSDF(context, defines), + symbolGlyph(context, defines), + collisionBox(context) { } - PlainShader plain; - OutlineShader outline; - OutlinePatternShader outlinePattern; + CircleShader circle; + FillShader fill; + FillPatternShader fillPattern; + FillOutlineShader fillOutline; + FillOutlinePatternShader fillOutlinePattern; LineShader line; - LineSDFShader linesdf; - LinepatternShader linepattern; - PatternShader pattern; - IconShader icon; + LineSDFShader lineSDF; + LinePatternShader linePattern; RasterShader raster; - SDFShader sdfGlyph; - SDFShader sdfIcon; + SymbolIconShader symbolIcon; + SymbolSDFShader symbolIconSDF; + SymbolSDFShader symbolGlyph; + CollisionBoxShader collisionBox; - CircleShader circle; gl::VertexArrayObject coveringPlainArray; gl::VertexArrayObject coveringRasterArray; diff --git a/src/mbgl/shader/icon_shader.cpp b/src/mbgl/shader/symbol_icon_shader.cpp index 633e88a9de..f0ca648c2a 100644 --- a/src/mbgl/shader/icon_shader.cpp +++ b/src/mbgl/shader/symbol_icon_shader.cpp @@ -1,11 +1,11 @@ -#include <mbgl/shader/icon_shader.hpp> +#include <mbgl/shader/symbol_icon_shader.hpp> #include <mbgl/shader/icon.vertex.hpp> #include <mbgl/shader/icon.fragment.hpp> #include <mbgl/shader/symbol_vertex.hpp> namespace mbgl { -IconShader::IconShader(gl::Context& context, Defines defines) +SymbolIconShader::SymbolIconShader(gl::Context& context, Defines defines) : Shader(shaders::icon::name, shaders::icon::vertex, shaders::icon::fragment, diff --git a/src/mbgl/shader/icon_shader.hpp b/src/mbgl/shader/symbol_icon_shader.hpp index c575b62428..5281beb60c 100644 --- a/src/mbgl/shader/icon_shader.hpp +++ b/src/mbgl/shader/symbol_icon_shader.hpp @@ -8,9 +8,9 @@ namespace mbgl { class SymbolVertex; -class IconShader : public gl::Shader { +class SymbolIconShader : public gl::Shader { public: - IconShader(gl::Context&, Defines defines = None); + SymbolIconShader(gl::Context&, Defines defines = None); using VertexType = SymbolVertex; diff --git a/src/mbgl/shader/sdf_shader.cpp b/src/mbgl/shader/symbol_sdf_shader.cpp index faf6e369aa..ab50fde278 100644 --- a/src/mbgl/shader/sdf_shader.cpp +++ b/src/mbgl/shader/symbol_sdf_shader.cpp @@ -1,11 +1,11 @@ -#include <mbgl/shader/sdf_shader.hpp> +#include <mbgl/shader/symbol_sdf_shader.hpp> #include <mbgl/shader/sdf.vertex.hpp> #include <mbgl/shader/sdf.fragment.hpp> #include <mbgl/shader/symbol_vertex.hpp> namespace mbgl { -SDFShader::SDFShader(gl::Context& context, Defines defines) +SymbolSDFShader::SymbolSDFShader(gl::Context& context, Defines defines) : Shader(shaders::sdf::name, shaders::sdf::vertex, shaders::sdf::fragment, diff --git a/src/mbgl/shader/sdf_shader.hpp b/src/mbgl/shader/symbol_sdf_shader.hpp index ea69258e61..8d3b3df939 100644 --- a/src/mbgl/shader/sdf_shader.hpp +++ b/src/mbgl/shader/symbol_sdf_shader.hpp @@ -9,9 +9,9 @@ namespace mbgl { class SymbolVertex; -class SDFShader : public gl::Shader { +class SymbolSDFShader : public gl::Shader { public: - SDFShader(gl::Context&, Defines defines = None); + SymbolSDFShader(gl::Context&, Defines defines = None); using VertexType = SymbolVertex; |