diff options
Diffstat (limited to 'src/mbgl/programs')
80 files changed, 5184 insertions, 594 deletions
diff --git a/src/mbgl/programs/background_pattern_program.hpp b/src/mbgl/programs/background_pattern_program.hpp new file mode 100644 index 0000000000..4b66065670 --- /dev/null +++ b/src/mbgl/programs/background_pattern_program.hpp @@ -0,0 +1,4 @@ +#pragma once + +// Alias +#include <mbgl/programs/background_program.hpp> diff --git a/src/mbgl/programs/background_program.cpp b/src/mbgl/programs/background_program.cpp index 99c9c55e84..7d68f62fb1 100644 --- a/src/mbgl/programs/background_program.cpp +++ b/src/mbgl/programs/background_program.cpp @@ -1,4 +1,5 @@ #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> @@ -6,20 +7,22 @@ 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"); -BackgroundPatternProgram::UniformValues -BackgroundPatternProgram::uniformValues(mat4 matrix, - float opacity, - Size atlasSize, - const ImagePosition& a, - const ImagePosition& b, - const CrossfadeParameters& fading, - const UnwrappedTileID& tileID, - const TransformState& state) -{ +BackgroundPatternProgram::LayoutUniformValues +BackgroundPatternProgram::layoutUniformValues(mat4 matrix, + float opacity, + Size atlasSize, + const ImagePosition& a, + const ImagePosition& b, + const CrossfadeParameters& fading, + const UnwrappedTileID& tileID, + const TransformState& state) { int32_t tileSizeAtNearestZoom = util::tileSize * state.zoomScale(state.getIntegerZoom() - tileID.canonical.z); int32_t pixelX = tileSizeAtNearestZoom * (tileID.canonical.x + tileID.wrap * state.zoomScale(tileID.canonical.z)); int32_t pixelY = tileSizeAtNearestZoom * tileID.canonical.y; diff --git a/src/mbgl/programs/background_program.hpp b/src/mbgl/programs/background_program.hpp index 9899fb695a..b1ade6dc84 100644 --- a/src/mbgl/programs/background_program.hpp +++ b/src/mbgl/programs/background_program.hpp @@ -4,14 +4,9 @@ #include <mbgl/programs/attributes.hpp> #include <mbgl/programs/uniforms.hpp> #include <mbgl/programs/textures.hpp> -#include <mbgl/shaders/background.hpp> -#include <mbgl/shaders/background_pattern.hpp> #include <mbgl/util/geometry.hpp> #include <mbgl/util/mat4.hpp> #include <mbgl/util/size.hpp> -#include <mbgl/style/layers/background_layer_properties.hpp> - -#include <string> namespace mbgl { @@ -45,8 +40,8 @@ using BackgroundPatternUniforms = TypeList< uniforms::u_tile_units_to_pixels>; class BackgroundProgram : public Program< - shaders::background, - gfx::Triangle, + BackgroundProgram, + gfx::PrimitiveType::Triangle, BackgroundLayoutAttributes, BackgroundUniforms, TypeList<>, @@ -57,8 +52,8 @@ public: }; class BackgroundPatternProgram : public Program< - shaders::background_pattern, - gfx::Triangle, + BackgroundPatternProgram, + gfx::PrimitiveType::Triangle, BackgroundLayoutAttributes, BackgroundPatternUniforms, TypeList< @@ -68,22 +63,22 @@ class BackgroundPatternProgram : public Program< public: using Program::Program; - static UniformValues uniformValues(mat4 matrix, - float opacity, - Size atlasSize, - const ImagePosition&, - const ImagePosition&, - const CrossfadeParameters&, - const UnwrappedTileID&, - const TransformState&); + static LayoutUniformValues layoutUniformValues(mat4 matrix, + float opacity, + Size atlasSize, + const ImagePosition&, + const ImagePosition&, + const CrossfadeParameters&, + const UnwrappedTileID&, + const TransformState&); }; using BackgroundLayoutVertex = BackgroundProgram::LayoutVertex; -using BackgroundAttributes = BackgroundProgram::Attributes; +using BackgroundAttributes = BackgroundProgram::AttributeList; class BackgroundLayerPrograms final : public LayerTypePrograms { public: - BackgroundLayerPrograms(gl::Context& context, const ProgramParameters& programParameters) + BackgroundLayerPrograms(gfx::Context& context, const ProgramParameters& programParameters) : background(context, programParameters), backgroundPattern(context, programParameters) {} BackgroundProgram background; diff --git a/src/mbgl/programs/binary_program.cpp b/src/mbgl/programs/binary_program.cpp deleted file mode 100644 index 598a547252..0000000000 --- a/src/mbgl/programs/binary_program.cpp +++ /dev/null @@ -1,140 +0,0 @@ -#include <mbgl/programs/binary_program.hpp> - -#include <protozero/pbf_reader.hpp> -#include <protozero/pbf_writer.hpp> -#include <utility> -#include <stdexcept> - -template <class Binding> -static std::pair<const std::string, Binding> parseBinding(protozero::pbf_reader&& pbf) { - bool hasName = false, hasValue = false; - std::pair<std::string, Binding> binding; - while (pbf.next()) { - switch (pbf.tag()) { - case 1: // name - binding.first = pbf.get_string(); - hasName = true; - break; - case 2: // value - binding.second = pbf.get_uint32(); - hasValue = true; - break; - default: - pbf.skip(); - break; - } - } - if (!hasName || !hasValue) { - throw std::runtime_error("BinaryProgram binding is missing required fields"); - } - return binding; -} - -namespace mbgl { - -BinaryProgram::BinaryProgram(std::string&& data) { - bool hasFormat = false, hasCode = false; - protozero::pbf_reader pbf(data); - while (pbf.next()) { - switch (pbf.tag()) { - case 1: // format - binaryFormat = pbf.get_uint32(); - hasFormat = true; - break; - case 2: // code - binaryCode = pbf.get_bytes(); - hasCode = true; - break; - case 3: // variable - attributes.emplace_back(parseBinding<gl::AttributeLocation>(pbf.get_message())); - break; - case 4: // uniform - uniforms.emplace_back(parseBinding<gl::UniformLocation>(pbf.get_message())); - break; - case 5: // identifier - binaryIdentifier = pbf.get_string(); - break; - case 6: // uniform - textures.emplace_back(parseBinding<gl::UniformLocation>(pbf.get_message())); - break; - default: - pbf.skip(); - break; - } - } - - if (!hasFormat || !hasCode) { - throw std::runtime_error("BinaryProgram is missing required fields"); - } -} - -BinaryProgram::BinaryProgram( - gl::BinaryProgramFormat binaryFormat_, - std::string&& binaryCode_, - std::string binaryIdentifier_, - std::vector<std::pair<const std::string, gl::AttributeLocation>>&& attributes_, - std::vector<std::pair<const std::string, gl::UniformLocation>>&& uniforms_, - std::vector<std::pair<const std::string, gl::UniformLocation>>&& textures_) - : binaryFormat(binaryFormat_), - binaryCode(std::move(binaryCode_)), - binaryIdentifier(std::move(binaryIdentifier_)), - attributes(std::move(attributes_)), - uniforms(std::move(uniforms_)), - textures(std::move(textures_)) { -} - -std::string BinaryProgram::serialize() const { - std::string data; - data.reserve(32 + binaryCode.size() + uniforms.size() * 32 + attributes.size() * 32); - protozero::pbf_writer pbf(data); - pbf.add_uint32(1 /* format */, binaryFormat); - pbf.add_bytes(2 /* code */, binaryCode.data(), binaryCode.size()); - for (const auto& binding : attributes) { - protozero::pbf_writer pbf_binding(pbf, 3 /* attribute */); - pbf_binding.add_string(1 /* name */, binding.first); - pbf_binding.add_uint32(2 /* value */, binding.second); - } - for (const auto& binding : uniforms) { - protozero::pbf_writer pbf_binding(pbf, 4 /* uniform */); - pbf_binding.add_string(1 /* name */, binding.first); - pbf_binding.add_uint32(2 /* value */, binding.second); - } - for (const auto& binding : textures) { - protozero::pbf_writer pbf_binding(pbf, 6 /* texture */); - pbf_binding.add_string(1 /* name */, binding.first); - pbf_binding.add_uint32(2 /* value */, binding.second); - } - if (!binaryIdentifier.empty()) { - pbf.add_string(5 /* identifier */, binaryIdentifier); - } - return data; -} - -optional<gl::AttributeLocation> BinaryProgram::attributeLocation(const std::string& name) const { - for (const auto& pair : attributes) { - if (pair.first == name) { - return pair.second; - } - } - return {}; -} - -gl::UniformLocation BinaryProgram::uniformLocation(const std::string& name) const { - for (const auto& pair : uniforms) { - if (pair.first == name) { - return pair.second; - } - } - return -1; -} - -gl::UniformLocation BinaryProgram::textureLocation(const std::string& name) const { - for (const auto& pair : textures) { - if (pair.first == name) { - return pair.second; - } - } - return -1; -} - -} // namespace mbgl diff --git a/src/mbgl/programs/binary_program.hpp b/src/mbgl/programs/binary_program.hpp deleted file mode 100644 index 1ae874800b..0000000000 --- a/src/mbgl/programs/binary_program.hpp +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once - -#include <mbgl/gl/types.hpp> -#include <mbgl/util/optional.hpp> - -#include <string> -#include <vector> - -namespace mbgl { - -class BinaryProgram { -public: - // Initialize a BinaryProgram object from a serialized represenation. - BinaryProgram(std::string&& data); - - BinaryProgram(gl::BinaryProgramFormat, - std::string&& binaryCode, - std::string binaryIdentifier, - std::vector<std::pair<const std::string, gl::AttributeLocation>>&&, - std::vector<std::pair<const std::string, gl::UniformLocation>>&&, - std::vector<std::pair<const std::string, gl::UniformLocation>>&&); - - std::string serialize() const; - - gl::BinaryProgramFormat format() const { - return binaryFormat; - } - const std::string& code() const { - return binaryCode; - } - const std::string& identifier() const { - return binaryIdentifier; - } - - optional<gl::AttributeLocation> attributeLocation(const std::string& name) const; - gl::UniformLocation uniformLocation(const std::string& name) const; - gl::UniformLocation textureLocation(const std::string& name) const; - -private: - gl::BinaryProgramFormat binaryFormat = 0; - std::string binaryCode; - std::string binaryIdentifier; - std::vector<std::pair<const std::string, gl::AttributeLocation>> attributes; - std::vector<std::pair<const std::string, gl::UniformLocation>> uniforms; - std::vector<std::pair<const std::string, gl::UniformLocation>> textures; -}; - -} // namespace mbgl diff --git a/src/mbgl/programs/circle_program.cpp b/src/mbgl/programs/circle_program.cpp index 99b47dd5c0..577410d94e 100644 --- a/src/mbgl/programs/circle_program.cpp +++ b/src/mbgl/programs/circle_program.cpp @@ -1,7 +1,10 @@ #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/circle_program.hpp b/src/mbgl/programs/circle_program.hpp index 5a381d8fa9..0caa1b2a15 100644 --- a/src/mbgl/programs/circle_program.hpp +++ b/src/mbgl/programs/circle_program.hpp @@ -3,7 +3,6 @@ #include <mbgl/programs/program.hpp> #include <mbgl/programs/attributes.hpp> #include <mbgl/programs/uniforms.hpp> -#include <mbgl/shaders/circle.hpp> #include <mbgl/util/geometry.hpp> #include <mbgl/style/layers/circle_layer_properties.hpp> @@ -14,8 +13,8 @@ MBGL_DEFINE_UNIFORM_SCALAR(bool, u_scale_with_map); } // namespace uniforms class CircleProgram : public Program< - shaders::circle, - gfx::Triangle, + CircleProgram, + gfx::PrimitiveType::Triangle, TypeList< attributes::a_pos>, TypeList< @@ -47,11 +46,11 @@ public: }; using CircleLayoutVertex = CircleProgram::LayoutVertex; -using CircleAttributes = CircleProgram::Attributes; +using CircleAttributes = CircleProgram::AttributeList; class CircleLayerPrograms final : public LayerTypePrograms { public: - CircleLayerPrograms(gl::Context& context, const ProgramParameters& programParameters) + CircleLayerPrograms(gfx::Context& context, const ProgramParameters& programParameters) : circle(context, programParameters) {} ProgramMap<CircleProgram> circle; }; diff --git a/src/mbgl/programs/clipping_mask_program.cpp b/src/mbgl/programs/clipping_mask_program.cpp new file mode 100644 index 0000000000..9b1a9ef4fc --- /dev/null +++ b/src/mbgl/programs/clipping_mask_program.cpp @@ -0,0 +1,8 @@ +#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/clipping_mask_program.hpp b/src/mbgl/programs/clipping_mask_program.hpp index 033d466116..874708a52f 100644 --- a/src/mbgl/programs/clipping_mask_program.hpp +++ b/src/mbgl/programs/clipping_mask_program.hpp @@ -3,14 +3,13 @@ #include <mbgl/programs/program.hpp> #include <mbgl/programs/attributes.hpp> #include <mbgl/programs/uniforms.hpp> -#include <mbgl/shaders/clipping_mask.hpp> #include <mbgl/style/properties.hpp> namespace mbgl { class ClippingMaskProgram : public Program< - shaders::clipping_mask, - gfx::Triangle, + ClippingMaskProgram, + gfx::PrimitiveType::Triangle, PositionOnlyLayoutAttributes, TypeList< uniforms::u_matrix>, @@ -22,6 +21,6 @@ public: }; using ClippingMaskLayoutVertex = ClippingMaskProgram::LayoutVertex; -using ClippingMaskAttributes = ClippingMaskProgram::Attributes; +using ClippingMaskAttributes = ClippingMaskProgram::AttributeList; } // namespace mbgl diff --git a/src/mbgl/programs/collision_box_program.cpp b/src/mbgl/programs/collision_box_program.cpp index 584013640e..885894526e 100644 --- a/src/mbgl/programs/collision_box_program.cpp +++ b/src/mbgl/programs/collision_box_program.cpp @@ -1,7 +1,11 @@ #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/collision_box_program.hpp b/src/mbgl/programs/collision_box_program.hpp index cd7f0bfd68..7b81752a94 100644 --- a/src/mbgl/programs/collision_box_program.hpp +++ b/src/mbgl/programs/collision_box_program.hpp @@ -3,8 +3,6 @@ #include <mbgl/programs/program.hpp> #include <mbgl/programs/attributes.hpp> #include <mbgl/programs/uniforms.hpp> -#include <mbgl/shaders/collision_box.hpp> -#include <mbgl/shaders/collision_circle.hpp> #include <mbgl/style/properties.hpp> #include <mbgl/util/geometry.hpp> @@ -21,8 +19,8 @@ using CollisionBoxLayoutAttributes = TypeList< using CollisionBoxDynamicAttributes = TypeList<attributes::a_placed>; class CollisionBoxProgram : public Program< - shaders::collision_box, - gfx::Line, + CollisionBoxProgram, + gfx::PrimitiveType::Line, TypeListConcat<CollisionBoxLayoutAttributes, CollisionBoxDynamicAttributes>, TypeList< uniforms::u_matrix, @@ -62,48 +60,48 @@ public: } template <class DrawMode> - void draw(gl::Context& context, - DrawMode drawMode, - gfx::DepthMode depthMode, - gfx::StencilMode stencilMode, - gfx::ColorMode colorMode, - gfx::CullFaceMode cullFaceMode, - const UniformValues& uniformValues, + void draw(gfx::Context& context, + const DrawMode& drawMode, + const gfx::DepthMode& depthMode, + const gfx::StencilMode& stencilMode, + const gfx::ColorMode& colorMode, + const gfx::CullFaceMode& cullFaceMode, + const LayoutUniformValues& layoutUniformValues, const gfx::VertexBuffer<gfx::Vertex<CollisionBoxLayoutAttributes>>& layoutVertexBuffer, const gfx::VertexBuffer<gfx::Vertex<CollisionBoxDynamicAttributes>>& dynamicVertexBuffer, const gfx::IndexBuffer& indexBuffer, - const SegmentVector<Attributes>& segments, + const SegmentVector<AttributeList>& segments, const Binders& paintPropertyBinders, const typename PaintProperties::PossiblyEvaluated& currentProperties, const TextureBindings& textureBindings, float currentZoom, const std::string& layerID) { - typename AllUniforms::Values allUniformValues = uniformValues + UniformValues uniformValues = layoutUniformValues .concat(paintPropertyBinders.uniformValues(currentZoom, currentProperties)); - typename Attributes::Bindings allAttributeBindings = gl::Attributes<CollisionBoxLayoutAttributes>::bindings(layoutVertexBuffer) - .concat(gl::Attributes<CollisionBoxDynamicAttributes>::bindings(dynamicVertexBuffer)) + AttributeBindings allAttributeBindings = gfx::AttributeBindings<CollisionBoxLayoutAttributes>(layoutVertexBuffer) + .concat(gfx::AttributeBindings<CollisionBoxDynamicAttributes>(dynamicVertexBuffer)) .concat(paintPropertyBinders.attributeBindings(currentProperties)); assert(layoutVertexBuffer.elements == dynamicVertexBuffer.elements); for (auto& segment : segments) { - auto vertexArrayIt = segment.vertexArrays.find(layerID); + auto drawScopeIt = segment.drawScopes.find(layerID); - if (vertexArrayIt == segment.vertexArrays.end()) { - vertexArrayIt = segment.vertexArrays.emplace(layerID, context.createVertexArray()).first; + if (drawScopeIt == segment.drawScopes.end()) { + drawScopeIt = segment.drawScopes.emplace(layerID, context.createDrawScope()).first; } - program.draw( + program->draw( context, std::move(drawMode), std::move(depthMode), std::move(stencilMode), std::move(colorMode), std::move(cullFaceMode), - allUniformValues, - vertexArrayIt->second, - Attributes::offsetBindings(allAttributeBindings, segment.vertexOffset), + uniformValues, + drawScopeIt->second, + allAttributeBindings.offset(segment.vertexOffset), textureBindings, indexBuffer, segment.indexOffset, @@ -114,8 +112,8 @@ public: class CollisionCircleProgram : public Program< - shaders::collision_circle, - gfx::Triangle, + CollisionCircleProgram, + gfx::PrimitiveType::Triangle, TypeListConcat<CollisionBoxLayoutAttributes, CollisionBoxDynamicAttributes>, TypeList< uniforms::u_matrix, @@ -150,46 +148,46 @@ public: } template <class DrawMode> - void draw(gl::Context& context, - DrawMode drawMode, - gfx::DepthMode depthMode, - gfx::StencilMode stencilMode, - gfx::ColorMode colorMode, - gfx::CullFaceMode cullFaceMode, - const UniformValues& uniformValues, + void draw(gfx::Context& context, + const DrawMode& drawMode, + const gfx::DepthMode& depthMode, + const gfx::StencilMode& stencilMode, + const gfx::ColorMode& colorMode, + const gfx::CullFaceMode& cullFaceMode, + const LayoutUniformValues& layoutUniformValues, const gfx::VertexBuffer<gfx::Vertex<CollisionBoxLayoutAttributes>>& layoutVertexBuffer, const gfx::VertexBuffer<gfx::Vertex<CollisionBoxDynamicAttributes>>& dynamicVertexBuffer, const gfx::IndexBuffer& indexBuffer, - const SegmentVector<Attributes>& segments, + const SegmentVector<AttributeList>& segments, const Binders& paintPropertyBinders, const typename PaintProperties::PossiblyEvaluated& currentProperties, const TextureBindings& textureBindings, float currentZoom, const std::string& layerID) { - typename AllUniforms::Values allUniformValues = uniformValues + UniformValues uniformValues = layoutUniformValues .concat(paintPropertyBinders.uniformValues(currentZoom, currentProperties)); - typename Attributes::Bindings allAttributeBindings = gl::Attributes<CollisionBoxLayoutAttributes>::bindings(layoutVertexBuffer) - .concat(gl::Attributes<CollisionBoxDynamicAttributes>::bindings(dynamicVertexBuffer)) + AttributeBindings allAttributeBindings = gfx::AttributeBindings<CollisionBoxLayoutAttributes>(layoutVertexBuffer) + .concat(gfx::AttributeBindings<CollisionBoxDynamicAttributes>(dynamicVertexBuffer)) .concat(paintPropertyBinders.attributeBindings(currentProperties)); for (auto& segment : segments) { - auto vertexArrayIt = segment.vertexArrays.find(layerID); + auto drawScopeIt = segment.drawScopes.find(layerID); - if (vertexArrayIt == segment.vertexArrays.end()) { - vertexArrayIt = segment.vertexArrays.emplace(layerID, context.createVertexArray()).first; + if (drawScopeIt == segment.drawScopes.end()) { + drawScopeIt = segment.drawScopes.emplace(layerID, context.createDrawScope()).first; } - program.draw( + program->draw( context, std::move(drawMode), std::move(depthMode), std::move(stencilMode), std::move(colorMode), std::move(cullFaceMode), - allUniformValues, - vertexArrayIt->second, - Attributes::offsetBindings(allAttributeBindings, segment.vertexOffset), + uniformValues, + drawScopeIt->second, + allAttributeBindings.offset(segment.vertexOffset), textureBindings, indexBuffer, segment.indexOffset, diff --git a/src/mbgl/programs/collision_circle_program.hpp b/src/mbgl/programs/collision_circle_program.hpp new file mode 100644 index 0000000000..1fd36af360 --- /dev/null +++ b/src/mbgl/programs/collision_circle_program.hpp @@ -0,0 +1,4 @@ +#pragma once + +// Alias +#include <mbgl/programs/collision_box_program.hpp> diff --git a/src/mbgl/programs/debug_program.cpp b/src/mbgl/programs/debug_program.cpp new file mode 100644 index 0000000000..9b8df789e4 --- /dev/null +++ b/src/mbgl/programs/debug_program.cpp @@ -0,0 +1,8 @@ +#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/debug_program.hpp b/src/mbgl/programs/debug_program.hpp index 7fdfc84cc0..61125b55bf 100644 --- a/src/mbgl/programs/debug_program.hpp +++ b/src/mbgl/programs/debug_program.hpp @@ -3,14 +3,13 @@ #include <mbgl/programs/program.hpp> #include <mbgl/programs/attributes.hpp> #include <mbgl/programs/uniforms.hpp> -#include <mbgl/shaders/debug.hpp> #include <mbgl/style/properties.hpp> namespace mbgl { class DebugProgram : public Program< - shaders::debug, - gfx::Line, + DebugProgram, + gfx::PrimitiveType::Line, TypeList< attributes::a_pos>, TypeList< @@ -24,6 +23,6 @@ public: }; using DebugLayoutVertex = DebugProgram::LayoutVertex; -using DebugAttributes = DebugProgram::Attributes; +using DebugAttributes = DebugProgram::AttributeList; } // namespace mbgl diff --git a/src/mbgl/programs/extrusion_texture_program.cpp b/src/mbgl/programs/extrusion_texture_program.cpp index afda4384b7..50fcd76221 100644 --- a/src/mbgl/programs/extrusion_texture_program.cpp +++ b/src/mbgl/programs/extrusion_texture_program.cpp @@ -1,7 +1,10 @@ #include <mbgl/programs/extrusion_texture_program.hpp> +#include <mbgl/gfx/context_impl.hpp> namespace mbgl { +template std::unique_ptr<gfx::Program<ExtrusionTextureProgram>> gfx::Context::createProgram(const ProgramParameters&); + static_assert(sizeof(ExtrusionTextureLayoutVertex) == 4, "expected ExtrusionTextureLayoutVertex size"); } // namespace mbgl diff --git a/src/mbgl/programs/extrusion_texture_program.hpp b/src/mbgl/programs/extrusion_texture_program.hpp index 8281037b2a..bdeeabb8cd 100644 --- a/src/mbgl/programs/extrusion_texture_program.hpp +++ b/src/mbgl/programs/extrusion_texture_program.hpp @@ -4,15 +4,14 @@ #include <mbgl/programs/attributes.hpp> #include <mbgl/programs/uniforms.hpp> #include <mbgl/programs/textures.hpp> -#include <mbgl/shaders/extrusion_texture.hpp> #include <mbgl/style/properties.hpp> #include <mbgl/util/geometry.hpp> namespace mbgl { class ExtrusionTextureProgram : public Program< - shaders::extrusion_texture, - gfx::Triangle, + ExtrusionTextureProgram, + gfx::PrimitiveType::Triangle, TypeList<attributes::a_pos>, TypeList< uniforms::u_matrix, @@ -35,6 +34,6 @@ public: }; using ExtrusionTextureLayoutVertex = ExtrusionTextureProgram::LayoutVertex; -using ExtrusionTextureAttributes = ExtrusionTextureProgram::Attributes; +using ExtrusionTextureAttributes = ExtrusionTextureProgram::AttributeList; } // namespace mbgl diff --git a/src/mbgl/programs/fill_extrusion_pattern_program.hpp b/src/mbgl/programs/fill_extrusion_pattern_program.hpp new file mode 100644 index 0000000000..b723ce0614 --- /dev/null +++ b/src/mbgl/programs/fill_extrusion_pattern_program.hpp @@ -0,0 +1,4 @@ +#pragma once + +// Alias +#include <mbgl/programs/fill_extrusion_program.hpp> diff --git a/src/mbgl/programs/fill_extrusion_program.cpp b/src/mbgl/programs/fill_extrusion_program.cpp index fb9c9f7b4a..7688d09299 100644 --- a/src/mbgl/programs/fill_extrusion_program.cpp +++ b/src/mbgl/programs/fill_extrusion_program.cpp @@ -1,4 +1,5 @@ #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> @@ -7,6 +8,9 @@ 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"); @@ -31,10 +35,8 @@ float lightIntensity(const EvaluatedLight& light) { return light.get<LightIntensity>(); } -FillExtrusionProgram::UniformValues -FillExtrusionProgram::uniformValues(mat4 matrix, - const TransformState& state, - const EvaluatedLight& light) { +FillExtrusionProgram::LayoutUniformValues FillExtrusionProgram::layoutUniformValues( + mat4 matrix, const TransformState& state, const EvaluatedLight& light) { return { uniforms::u_matrix::Value( matrix ), uniforms::u_lightcolor::Value( lightColor(light) ), @@ -43,8 +45,8 @@ FillExtrusionProgram::uniformValues(mat4 matrix, }; } -FillExtrusionPatternProgram::UniformValues -FillExtrusionPatternProgram::uniformValues(mat4 matrix, +FillExtrusionPatternProgram::LayoutUniformValues +FillExtrusionPatternProgram::layoutUniformValues(mat4 matrix, Size atlasSize, const CrossfadeParameters& crossfade, const UnwrappedTileID& tileID, diff --git a/src/mbgl/programs/fill_extrusion_program.hpp b/src/mbgl/programs/fill_extrusion_program.hpp index 0723770143..e1c3ca7f17 100644 --- a/src/mbgl/programs/fill_extrusion_program.hpp +++ b/src/mbgl/programs/fill_extrusion_program.hpp @@ -5,8 +5,6 @@ #include <mbgl/programs/extrusion_texture_program.hpp> #include <mbgl/programs/uniforms.hpp> #include <mbgl/programs/textures.hpp> -#include <mbgl/shaders/fill_extrusion.hpp> -#include <mbgl/shaders/fill_extrusion_pattern.hpp> #include <mbgl/util/geometry.hpp> #include <mbgl/util/mat4.hpp> #include <mbgl/util/size.hpp> @@ -53,8 +51,8 @@ using FillExtrusionPatternUniforms = TypeList< uniforms::u_lightintensity>; class FillExtrusionProgram : public Program< - shaders::fill_extrusion, - gfx::Triangle, + FillExtrusionProgram, + gfx::PrimitiveType::Triangle, FillExtrusionLayoutAttributes, FillExtrusionUniforms, TypeList<>, @@ -83,15 +81,13 @@ public: }; } - static UniformValues uniformValues(mat4, - const TransformState&, - const EvaluatedLight&); - + static LayoutUniformValues + layoutUniformValues(mat4, const TransformState&, const EvaluatedLight&); }; class FillExtrusionPatternProgram : public Program< - shaders::fill_extrusion_pattern, - gfx::Triangle, + FillExtrusionPatternProgram, + gfx::PrimitiveType::Triangle, FillExtrusionLayoutAttributes, FillExtrusionPatternUniforms, TypeList< @@ -101,23 +97,23 @@ class FillExtrusionPatternProgram : public Program< public: using Program::Program; - static UniformValues uniformValues(mat4, - Size atlasSize, - const CrossfadeParameters&, - const UnwrappedTileID&, - const TransformState&, - const float heightFactor, - const float pixelRatio, - const EvaluatedLight&); + static LayoutUniformValues layoutUniformValues(mat4, + Size atlasSize, + const CrossfadeParameters&, + const UnwrappedTileID&, + const TransformState&, + const float heightFactor, + const float pixelRatio, + const EvaluatedLight&); }; using FillExtrusionLayoutVertex = FillExtrusionProgram::LayoutVertex; -using FillExtrusionAttributes = FillExtrusionProgram::Attributes; +using FillExtrusionAttributes = FillExtrusionProgram::AttributeList; class FillExtrusionLayerPrograms final : public LayerTypePrograms { public: - FillExtrusionLayerPrograms(gl::Context& context, const ProgramParameters& programParameters) + FillExtrusionLayerPrograms(gfx::Context& context, const ProgramParameters& programParameters) : fillExtrusion(context, programParameters), fillExtrusionPattern(context, programParameters), extrusionTexture(context, programParameters) {} diff --git a/src/mbgl/programs/fill_outline_pattern_program.hpp b/src/mbgl/programs/fill_outline_pattern_program.hpp new file mode 100644 index 0000000000..a2c26a168d --- /dev/null +++ b/src/mbgl/programs/fill_outline_pattern_program.hpp @@ -0,0 +1,4 @@ +#pragma once + +// Alias +#include <mbgl/programs/fill_program.hpp> diff --git a/src/mbgl/programs/fill_outline_program.hpp b/src/mbgl/programs/fill_outline_program.hpp new file mode 100644 index 0000000000..a2c26a168d --- /dev/null +++ b/src/mbgl/programs/fill_outline_program.hpp @@ -0,0 +1,4 @@ +#pragma once + +// Alias +#include <mbgl/programs/fill_program.hpp> diff --git a/src/mbgl/programs/fill_pattern_program.hpp b/src/mbgl/programs/fill_pattern_program.hpp new file mode 100644 index 0000000000..a2c26a168d --- /dev/null +++ b/src/mbgl/programs/fill_pattern_program.hpp @@ -0,0 +1,4 @@ +#pragma once + +// Alias +#include <mbgl/programs/fill_program.hpp> diff --git a/src/mbgl/programs/fill_program.cpp b/src/mbgl/programs/fill_program.cpp index 2c290dd15d..e0dfc71f81 100644 --- a/src/mbgl/programs/fill_program.cpp +++ b/src/mbgl/programs/fill_program.cpp @@ -1,4 +1,5 @@ #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> @@ -6,19 +7,23 @@ 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"); -FillPatternProgram::UniformValues -FillPatternProgram::uniformValues(mat4 matrix, - Size framebufferSize, - Size atlasSize, - const CrossfadeParameters& crossfade, - const UnwrappedTileID& tileID, - const TransformState& state, - const float pixelRatio) -{ +FillPatternProgram::LayoutUniformValues +FillPatternProgram::layoutUniformValues(mat4 matrix, + Size framebufferSize, + Size atlasSize, + const CrossfadeParameters& crossfade, + const UnwrappedTileID& tileID, + const TransformState& state, + const float pixelRatio) { const auto tileRatio = 1 / tileID.pixelsToTileUnits(1, state.getIntegerZoom()); int32_t tileSizeAtNearestZoom = util::tileSize * state.zoomScale(state.getIntegerZoom() - tileID.canonical.z); int32_t pixelX = tileSizeAtNearestZoom * (tileID.canonical.x + tileID.wrap * state.zoomScale(tileID.canonical.z)); diff --git a/src/mbgl/programs/fill_program.hpp b/src/mbgl/programs/fill_program.hpp index 5c0fbdcb62..8519e482d6 100644 --- a/src/mbgl/programs/fill_program.hpp +++ b/src/mbgl/programs/fill_program.hpp @@ -4,10 +4,6 @@ #include <mbgl/programs/attributes.hpp> #include <mbgl/programs/uniforms.hpp> #include <mbgl/programs/textures.hpp> -#include <mbgl/shaders/fill.hpp> -#include <mbgl/shaders/fill_pattern.hpp> -#include <mbgl/shaders/fill_outline.hpp> -#include <mbgl/shaders/fill_outline_pattern.hpp> #include <mbgl/util/geometry.hpp> #include <mbgl/util/mat4.hpp> #include <mbgl/util/size.hpp> @@ -38,8 +34,8 @@ using FillPatternUniforms = TypeList< uniforms::u_pixel_coord_lower>; class FillProgram : public Program< - shaders::fill, - gfx::Triangle, + FillProgram, + gfx::PrimitiveType::Triangle, FillLayoutAttributes, FillUniforms, TypeList<>, @@ -59,8 +55,8 @@ public: }; class FillPatternProgram : public Program< - shaders::fill_pattern, - gfx::Triangle, + FillPatternProgram, + gfx::PrimitiveType::Triangle, FillLayoutAttributes, FillPatternUniforms, TypeList< @@ -70,18 +66,18 @@ class FillPatternProgram : public Program< public: using Program::Program; - static UniformValues uniformValues(mat4 matrix, - Size framebufferSize, - Size atlasSize, - const CrossfadeParameters& crossfade, - const UnwrappedTileID&, - const TransformState&, - const float pixelRatio); + static LayoutUniformValues layoutUniformValues(mat4 matrix, + Size framebufferSize, + Size atlasSize, + const CrossfadeParameters& crossfade, + const UnwrappedTileID&, + const TransformState&, + const float pixelRatio); }; class FillOutlineProgram : public Program< - shaders::fill_outline, - gfx::Line, + FillOutlineProgram, + gfx::PrimitiveType::Line, FillLayoutAttributes, FillUniforms, TypeList<>, @@ -92,8 +88,8 @@ public: }; class FillOutlinePatternProgram : public Program< - shaders::fill_outline_pattern, - gfx::Line, + FillOutlinePatternProgram, + gfx::PrimitiveType::Line, FillLayoutAttributes, FillPatternUniforms, TypeList< @@ -105,11 +101,11 @@ public: }; using FillLayoutVertex = FillProgram::LayoutVertex; -using FillAttributes = FillProgram::Attributes; +using FillAttributes = FillProgram::AttributeList; class FillLayerPrograms final : public LayerTypePrograms { public: - FillLayerPrograms(gl::Context& context, const ProgramParameters& programParameters) + FillLayerPrograms(gfx::Context& context, const ProgramParameters& programParameters) : fill(context, programParameters), fillPattern(context, programParameters), fillOutline(context, programParameters), diff --git a/src/mbgl/programs/gl/background.cpp b/src/mbgl/programs/gl/background.cpp new file mode 100644 index 0000000000..da5ea25410 --- /dev/null +++ b/src/mbgl/programs/gl/background.cpp @@ -0,0 +1,47 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/background_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<BackgroundProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<BackgroundProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "background", + programs::gl::shaderSource() + 1429, programs::gl::shaderSource() + 1525); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of background.vertex.glsl: +/* +attribute vec2 a_pos; + +uniform mat4 u_matrix; + +void main() { + gl_Position = u_matrix * vec4(a_pos, 0, 1); +} + +*/ + +// Uncompressed source of background.fragment.glsl: +/* +uniform vec4 u_color; +uniform float u_opacity; + +void main() { + gl_FragColor = u_color * u_opacity; + +#ifdef OVERDRAW_INSPECTOR + gl_FragColor = vec4(1.0); +#endif +} + +*/ + diff --git a/src/mbgl/programs/gl/background_pattern.cpp b/src/mbgl/programs/gl/background_pattern.cpp new file mode 100644 index 0000000000..af5d87129e --- /dev/null +++ b/src/mbgl/programs/gl/background_pattern.cpp @@ -0,0 +1,78 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/background_pattern_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<BackgroundPatternProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<BackgroundPatternProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "background_pattern", + programs::gl::shaderSource() + 1675, programs::gl::shaderSource() + 2266); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of background_pattern.vertex.glsl: +/* +uniform mat4 u_matrix; +uniform vec2 u_pattern_size_a; +uniform vec2 u_pattern_size_b; +uniform vec2 u_pixel_coord_upper; +uniform vec2 u_pixel_coord_lower; +uniform float u_scale_a; +uniform float u_scale_b; +uniform float u_tile_units_to_pixels; + +attribute vec2 a_pos; + +varying vec2 v_pos_a; +varying vec2 v_pos_b; + +void main() { + gl_Position = u_matrix * vec4(a_pos, 0, 1); + + v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_a * u_pattern_size_a, u_tile_units_to_pixels, a_pos); + v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, u_scale_b * u_pattern_size_b, u_tile_units_to_pixels, a_pos); +} + +*/ + +// Uncompressed source of background_pattern.fragment.glsl: +/* +uniform vec2 u_pattern_tl_a; +uniform vec2 u_pattern_br_a; +uniform vec2 u_pattern_tl_b; +uniform vec2 u_pattern_br_b; +uniform vec2 u_texsize; +uniform float u_mix; +uniform float u_opacity; + +uniform sampler2D u_image; + +varying vec2 v_pos_a; +varying vec2 v_pos_b; + +void main() { + vec2 imagecoord = mod(v_pos_a, 1.0); + vec2 pos = mix(u_pattern_tl_a / u_texsize, u_pattern_br_a / u_texsize, imagecoord); + vec4 color1 = texture2D(u_image, pos); + + vec2 imagecoord_b = mod(v_pos_b, 1.0); + vec2 pos2 = mix(u_pattern_tl_b / u_texsize, u_pattern_br_b / u_texsize, imagecoord_b); + vec4 color2 = texture2D(u_image, pos2); + + gl_FragColor = mix(color1, color2, u_mix) * u_opacity; + +#ifdef OVERDRAW_INSPECTOR + gl_FragColor = vec4(1.0); +#endif +} + +*/ + diff --git a/src/mbgl/programs/gl/circle.cpp b/src/mbgl/programs/gl/circle.cpp new file mode 100644 index 0000000000..04c3f60870 --- /dev/null +++ b/src/mbgl/programs/gl/circle.cpp @@ -0,0 +1,300 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/circle_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<CircleProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<CircleProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "circle", + programs::gl::shaderSource() + 2927, programs::gl::shaderSource() + 6093); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of circle.vertex.glsl: +/* +uniform mat4 u_matrix; +uniform bool u_scale_with_map; +uniform bool u_pitch_with_map; +uniform vec2 u_extrude_scale; +uniform highp float u_camera_to_center_distance; + +attribute vec2 a_pos; + + +#ifndef HAS_UNIFORM_u_color +uniform lowp float a_color_t; +attribute highp vec4 a_color; +varying highp vec4 color; +#else +uniform highp vec4 u_color; +#endif + + +#ifndef HAS_UNIFORM_u_radius +uniform lowp float a_radius_t; +attribute mediump vec2 a_radius; +varying mediump float radius; +#else +uniform mediump float u_radius; +#endif + + +#ifndef HAS_UNIFORM_u_blur +uniform lowp float a_blur_t; +attribute lowp vec2 a_blur; +varying lowp float blur; +#else +uniform lowp float u_blur; +#endif + + +#ifndef HAS_UNIFORM_u_opacity +uniform lowp float a_opacity_t; +attribute lowp vec2 a_opacity; +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_stroke_color +uniform lowp float a_stroke_color_t; +attribute highp vec4 a_stroke_color; +varying highp vec4 stroke_color; +#else +uniform highp vec4 u_stroke_color; +#endif + + +#ifndef HAS_UNIFORM_u_stroke_width +uniform lowp float a_stroke_width_t; +attribute mediump vec2 a_stroke_width; +varying mediump float stroke_width; +#else +uniform mediump float u_stroke_width; +#endif + + +#ifndef HAS_UNIFORM_u_stroke_opacity +uniform lowp float a_stroke_opacity_t; +attribute lowp vec2 a_stroke_opacity; +varying lowp float stroke_opacity; +#else +uniform lowp float u_stroke_opacity; +#endif + + +varying vec3 v_data; + +void main(void) { + +#ifndef HAS_UNIFORM_u_color + color = unpack_mix_color(a_color, a_color_t); +#else + highp vec4 color = u_color; +#endif + + +#ifndef HAS_UNIFORM_u_radius + radius = unpack_mix_vec2(a_radius, a_radius_t); +#else + mediump float radius = u_radius; +#endif + + +#ifndef HAS_UNIFORM_u_blur + blur = unpack_mix_vec2(a_blur, a_blur_t); +#else + lowp float blur = u_blur; +#endif + + +#ifndef HAS_UNIFORM_u_opacity + opacity = unpack_mix_vec2(a_opacity, a_opacity_t); +#else + lowp float opacity = u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_stroke_color + stroke_color = unpack_mix_color(a_stroke_color, a_stroke_color_t); +#else + highp vec4 stroke_color = u_stroke_color; +#endif + + +#ifndef HAS_UNIFORM_u_stroke_width + stroke_width = unpack_mix_vec2(a_stroke_width, a_stroke_width_t); +#else + mediump float stroke_width = u_stroke_width; +#endif + + +#ifndef HAS_UNIFORM_u_stroke_opacity + stroke_opacity = unpack_mix_vec2(a_stroke_opacity, a_stroke_opacity_t); +#else + lowp float stroke_opacity = u_stroke_opacity; +#endif + + + // unencode the extrusion vector that we snuck into the a_pos vector + vec2 extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0); + + // multiply a_pos by 0.5, since we had it * 2 in order to sneak + // in extrusion data + vec2 circle_center = floor(a_pos * 0.5); + if (u_pitch_with_map) { + vec2 corner_position = circle_center; + if (u_scale_with_map) { + corner_position += extrude * (radius + stroke_width) * u_extrude_scale; + } else { + // Pitching the circle with the map effectively scales it with the map + // To counteract the effect for pitch-scale: viewport, we rescale the + // whole circle based on the pitch scaling effect at its central point + vec4 projected_center = u_matrix * vec4(circle_center, 0, 1); + corner_position += extrude * (radius + stroke_width) * u_extrude_scale * (projected_center.w / u_camera_to_center_distance); + } + + gl_Position = u_matrix * vec4(corner_position, 0, 1); + } else { + gl_Position = u_matrix * vec4(circle_center, 0, 1); + + if (u_scale_with_map) { + gl_Position.xy += extrude * (radius + stroke_width) * u_extrude_scale * u_camera_to_center_distance; + } else { + gl_Position.xy += extrude * (radius + stroke_width) * u_extrude_scale * gl_Position.w; + } + } + + // This is a minimum blur distance that serves as a faux-antialiasing for + // the circle. since blur is a ratio of the circle's size and the intent is + // to keep the blur at roughly 1px, the two are inversely related. + lowp float antialiasblur = 1.0 / DEVICE_PIXEL_RATIO / (radius + stroke_width); + + v_data = vec3(extrude.x, extrude.y, antialiasblur); +} + +*/ + +// Uncompressed source of circle.fragment.glsl: +/* + +#ifndef HAS_UNIFORM_u_color +varying highp vec4 color; +#else +uniform highp vec4 u_color; +#endif + + +#ifndef HAS_UNIFORM_u_radius +varying mediump float radius; +#else +uniform mediump float u_radius; +#endif + + +#ifndef HAS_UNIFORM_u_blur +varying lowp float blur; +#else +uniform lowp float u_blur; +#endif + + +#ifndef HAS_UNIFORM_u_opacity +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_stroke_color +varying highp vec4 stroke_color; +#else +uniform highp vec4 u_stroke_color; +#endif + + +#ifndef HAS_UNIFORM_u_stroke_width +varying mediump float stroke_width; +#else +uniform mediump float u_stroke_width; +#endif + + +#ifndef HAS_UNIFORM_u_stroke_opacity +varying lowp float stroke_opacity; +#else +uniform lowp float u_stroke_opacity; +#endif + + +varying vec3 v_data; + +void main() { + +#ifdef HAS_UNIFORM_u_color + highp vec4 color = u_color; +#endif + + +#ifdef HAS_UNIFORM_u_radius + mediump float radius = u_radius; +#endif + + +#ifdef HAS_UNIFORM_u_blur + lowp float blur = u_blur; +#endif + + +#ifdef HAS_UNIFORM_u_opacity + lowp float opacity = u_opacity; +#endif + + +#ifdef HAS_UNIFORM_u_stroke_color + highp vec4 stroke_color = u_stroke_color; +#endif + + +#ifdef HAS_UNIFORM_u_stroke_width + mediump float stroke_width = u_stroke_width; +#endif + + +#ifdef HAS_UNIFORM_u_stroke_opacity + lowp float stroke_opacity = u_stroke_opacity; +#endif + + + vec2 extrude = v_data.xy; + float extrude_length = length(extrude); + + lowp float antialiasblur = v_data.z; + float antialiased_blur = -max(blur, antialiasblur); + + float opacity_t = smoothstep(0.0, antialiased_blur, extrude_length - 1.0); + + float color_t = stroke_width < 0.01 ? 0.0 : smoothstep( + antialiased_blur, + 0.0, + extrude_length - radius / (radius + stroke_width) + ); + + gl_FragColor = opacity_t * mix(color * opacity, stroke_color * stroke_opacity, color_t); + +#ifdef OVERDRAW_INSPECTOR + gl_FragColor = vec4(1.0); +#endif +} + +*/ + diff --git a/src/mbgl/programs/gl/clipping_mask.cpp b/src/mbgl/programs/gl/clipping_mask.cpp new file mode 100644 index 0000000000..311877f065 --- /dev/null +++ b/src/mbgl/programs/gl/clipping_mask.cpp @@ -0,0 +1,40 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/clipping_mask_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<ClippingMaskProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<ClippingMaskProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "clipping_mask", + programs::gl::shaderSource() + 7848, programs::gl::shaderSource() + 7944); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of clipping_mask.vertex.glsl: +/* +attribute vec2 a_pos; + +uniform mat4 u_matrix; + +void main() { + gl_Position = u_matrix * vec4(a_pos, 0, 1); +} + +*/ + +// Uncompressed source of clipping_mask.fragment.glsl: +/* +void main() { + gl_FragColor = vec4(1.0); +} + +*/ + diff --git a/src/mbgl/programs/gl/collision_box.cpp b/src/mbgl/programs/gl/collision_box.cpp new file mode 100644 index 0000000000..9af67f7981 --- /dev/null +++ b/src/mbgl/programs/gl/collision_box.cpp @@ -0,0 +1,77 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/collision_box_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<CollisionBoxProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<CollisionBoxProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "collision_box", + programs::gl::shaderSource() + 9956, programs::gl::shaderSource() + 10635); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of collision_box.vertex.glsl: +/* +attribute vec2 a_pos; +attribute vec2 a_anchor_pos; +attribute vec2 a_extrude; +attribute vec2 a_placed; +attribute vec2 a_shift; + +uniform mat4 u_matrix; +uniform vec2 u_extrude_scale; +uniform float u_camera_to_center_distance; + +varying float v_placed; +varying float v_notUsed; + +void main() { + vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1); + highp float camera_to_anchor_distance = projectedPoint.w; + highp float collision_perspective_ratio = clamp( + 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance), + 0.0, // Prevents oversized near-field boxes in pitched/overzoomed tiles + 4.0); + + gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0); + gl_Position.xy += (a_extrude + a_shift) * u_extrude_scale * gl_Position.w * collision_perspective_ratio; + + v_placed = a_placed.x; + v_notUsed = a_placed.y; +} + +*/ + +// Uncompressed source of collision_box.fragment.glsl: +/* + +varying float v_placed; +varying float v_notUsed; + +void main() { + + float alpha = 0.5; + + // Red = collision, hide label + gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0) * alpha; + + // Blue = no collision, label is showing + if (v_placed > 0.5) { + gl_FragColor = vec4(0.0, 0.0, 1.0, 0.5) * alpha; + } + + if (v_notUsed > 0.5) { + // This box not used, fade it out + gl_FragColor *= .1; + } +} +*/ + diff --git a/src/mbgl/programs/gl/collision_circle.cpp b/src/mbgl/programs/gl/collision_circle.cpp new file mode 100644 index 0000000000..843f9161bb --- /dev/null +++ b/src/mbgl/programs/gl/collision_circle.cpp @@ -0,0 +1,100 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/collision_circle_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<CollisionCircleProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<CollisionCircleProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "collision_circle", + programs::gl::shaderSource() + 10858, programs::gl::shaderSource() + 11774); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of collision_circle.vertex.glsl: +/* +attribute vec2 a_pos; +attribute vec2 a_anchor_pos; +attribute vec2 a_extrude; +attribute vec2 a_placed; + +uniform mat4 u_matrix; +uniform vec2 u_extrude_scale; +uniform float u_camera_to_center_distance; + +varying float v_placed; +varying float v_notUsed; +varying float v_radius; + +varying vec2 v_extrude; +varying vec2 v_extrude_scale; + +void main() { + vec4 projectedPoint = u_matrix * vec4(a_anchor_pos, 0, 1); + highp float camera_to_anchor_distance = projectedPoint.w; + highp float collision_perspective_ratio = clamp( + 0.5 + 0.5 * (u_camera_to_center_distance / camera_to_anchor_distance), + 0.0, // Prevents oversized near-field circles in pitched/overzoomed tiles + 4.0); + + gl_Position = u_matrix * vec4(a_pos, 0.0, 1.0); + + highp float padding_factor = 1.2; // Pad the vertices slightly to make room for anti-alias blur + gl_Position.xy += a_extrude * u_extrude_scale * padding_factor * gl_Position.w * collision_perspective_ratio; + + v_placed = a_placed.x; + v_notUsed = a_placed.y; + v_radius = abs(a_extrude.y); // We don't pitch the circles, so both units of the extrusion vector are equal in magnitude to the radius + + v_extrude = a_extrude * padding_factor; + v_extrude_scale = u_extrude_scale * u_camera_to_center_distance * collision_perspective_ratio; +} + +*/ + +// Uncompressed source of collision_circle.fragment.glsl: +/* +uniform float u_overscale_factor; + +varying float v_placed; +varying float v_notUsed; +varying float v_radius; +varying vec2 v_extrude; +varying vec2 v_extrude_scale; + +void main() { + float alpha = 0.5; + + // Red = collision, hide label + vec4 color = vec4(1.0, 0.0, 0.0, 1.0) * alpha; + + // Blue = no collision, label is showing + if (v_placed > 0.5) { + color = vec4(0.0, 0.0, 1.0, 0.5) * alpha; + } + + if (v_notUsed > 0.5) { + // This box not used, fade it out + color *= .2; + } + + float extrude_scale_length = length(v_extrude_scale); + float extrude_length = length(v_extrude) * extrude_scale_length; + float stroke_width = 15.0 * extrude_scale_length / u_overscale_factor; + float radius = v_radius * extrude_scale_length; + + float distance_to_edge = abs(extrude_length - radius); + float opacity_t = smoothstep(-stroke_width, 0.0, -distance_to_edge); + + gl_FragColor = opacity_t * color; +} + +*/ + diff --git a/src/mbgl/programs/gl/debug.cpp b/src/mbgl/programs/gl/debug.cpp new file mode 100644 index 0000000000..8b7aee5a0b --- /dev/null +++ b/src/mbgl/programs/gl/debug.cpp @@ -0,0 +1,42 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/debug_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<DebugProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<DebugProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "debug", + programs::gl::shaderSource() + 12450, programs::gl::shaderSource() + 12546); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of debug.vertex.glsl: +/* +attribute vec2 a_pos; + +uniform mat4 u_matrix; + +void main() { + gl_Position = u_matrix * vec4(a_pos, 0, 1); +} + +*/ + +// Uncompressed source of debug.fragment.glsl: +/* +uniform highp vec4 u_color; + +void main() { + gl_FragColor = u_color; +} + +*/ + diff --git a/src/mbgl/programs/gl/extrusion_texture.cpp b/src/mbgl/programs/gl/extrusion_texture.cpp new file mode 100644 index 0000000000..bd320d52cf --- /dev/null +++ b/src/mbgl/programs/gl/extrusion_texture.cpp @@ -0,0 +1,52 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/extrusion_texture_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<ExtrusionTextureProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<ExtrusionTextureProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "extrusion_texture", + programs::gl::shaderSource() + 27554, programs::gl::shaderSource() + 27734); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of extrusion_texture.vertex.glsl: +/* +uniform mat4 u_matrix; +uniform vec2 u_world; +attribute vec2 a_pos; +varying vec2 v_pos; + +void main() { + gl_Position = u_matrix * vec4(a_pos * u_world, 0, 1); + + v_pos.x = a_pos.x; + v_pos.y = 1.0 - a_pos.y; +} + +*/ + +// Uncompressed source of extrusion_texture.fragment.glsl: +/* +uniform sampler2D u_image; +uniform float u_opacity; +varying vec2 v_pos; + +void main() { + gl_FragColor = texture2D(u_image, v_pos) * u_opacity; + +#ifdef OVERDRAW_INSPECTOR + gl_FragColor = vec4(0.0); +#endif +} + +*/ + diff --git a/src/mbgl/programs/gl/fill.cpp b/src/mbgl/programs/gl/fill.cpp new file mode 100644 index 0000000000..c15c2774ab --- /dev/null +++ b/src/mbgl/programs/gl/fill.cpp @@ -0,0 +1,104 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/fill_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<FillProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<FillProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "fill", + programs::gl::shaderSource() + 12610, programs::gl::shaderSource() + 13254); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of fill.vertex.glsl: +/* +attribute vec2 a_pos; + +uniform mat4 u_matrix; + + +#ifndef HAS_UNIFORM_u_color +uniform lowp float a_color_t; +attribute highp vec4 a_color; +varying highp vec4 color; +#else +uniform highp vec4 u_color; +#endif + + +#ifndef HAS_UNIFORM_u_opacity +uniform lowp float a_opacity_t; +attribute lowp vec2 a_opacity; +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +void main() { + +#ifndef HAS_UNIFORM_u_color + color = unpack_mix_color(a_color, a_color_t); +#else + highp vec4 color = u_color; +#endif + + +#ifndef HAS_UNIFORM_u_opacity + opacity = unpack_mix_vec2(a_opacity, a_opacity_t); +#else + lowp float opacity = u_opacity; +#endif + + + gl_Position = u_matrix * vec4(a_pos, 0, 1); +} + +*/ + +// Uncompressed source of fill.fragment.glsl: +/* + +#ifndef HAS_UNIFORM_u_color +varying highp vec4 color; +#else +uniform highp vec4 u_color; +#endif + + +#ifndef HAS_UNIFORM_u_opacity +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +void main() { + +#ifdef HAS_UNIFORM_u_color + highp vec4 color = u_color; +#endif + + +#ifdef HAS_UNIFORM_u_opacity + lowp float opacity = u_opacity; +#endif + + + gl_FragColor = color * opacity; + +#ifdef OVERDRAW_INSPECTOR + gl_FragColor = vec4(1.0); +#endif +} + +*/ + diff --git a/src/mbgl/programs/gl/fill_extrusion.cpp b/src/mbgl/programs/gl/fill_extrusion.cpp new file mode 100644 index 0000000000..45ebb68dd4 --- /dev/null +++ b/src/mbgl/programs/gl/fill_extrusion.cpp @@ -0,0 +1,142 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/fill_extrusion_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<FillExtrusionProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<FillExtrusionProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "fill_extrusion", + programs::gl::shaderSource() + 21238, programs::gl::shaderSource() + 23121); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of fill_extrusion.vertex.glsl: +/* +uniform mat4 u_matrix; +uniform vec3 u_lightcolor; +uniform lowp vec3 u_lightpos; +uniform lowp float u_lightintensity; +uniform float u_vertical_gradient; + +attribute vec2 a_pos; +attribute vec4 a_normal_ed; + +varying vec4 v_color; + + +#ifndef HAS_UNIFORM_u_base +uniform lowp float a_base_t; +attribute highp vec2 a_base; +#else +uniform highp float u_base; +#endif + + +#ifndef HAS_UNIFORM_u_height +uniform lowp float a_height_t; +attribute highp vec2 a_height; +#else +uniform highp float u_height; +#endif + + + +#ifndef HAS_UNIFORM_u_color +uniform lowp float a_color_t; +attribute highp vec4 a_color; +#else +uniform highp vec4 u_color; +#endif + + +void main() { + +#ifndef HAS_UNIFORM_u_base + highp float base = unpack_mix_vec2(a_base, a_base_t); +#else + highp float base = u_base; +#endif + + +#ifndef HAS_UNIFORM_u_height + highp float height = unpack_mix_vec2(a_height, a_height_t); +#else + highp float height = u_height; +#endif + + +#ifndef HAS_UNIFORM_u_color + highp vec4 color = unpack_mix_color(a_color, a_color_t); +#else + highp vec4 color = u_color; +#endif + + + vec3 normal = a_normal_ed.xyz; + + base = max(0.0, base); + height = max(0.0, height); + + float t = mod(normal.x, 2.0); + + gl_Position = u_matrix * vec4(a_pos, t > 0.0 ? height : base, 1); + + // Relative luminance (how dark/bright is the surface color?) + float colorvalue = color.r * 0.2126 + color.g * 0.7152 + color.b * 0.0722; + + v_color = vec4(0.0, 0.0, 0.0, 1.0); + + // Add slight ambient lighting so no extrusions are totally black + vec4 ambientlight = vec4(0.03, 0.03, 0.03, 1.0); + color += ambientlight; + + // Calculate cos(theta), where theta is the angle between surface normal and diffuse light ray + float directional = clamp(dot(normal / 16384.0, u_lightpos), 0.0, 1.0); + + // Adjust directional so that + // the range of values for highlight/shading is narrower + // with lower light intensity + // and with lighter/brighter surface colors + directional = mix((1.0 - u_lightintensity), max((1.0 - colorvalue + u_lightintensity), 1.0), directional); + + // Add gradient along z axis of side surfaces + if (normal.y != 0.0) { + // This avoids another branching statement, but multiplies by a constant of 0.84 if no vertical gradient, + // and otherwise calculates the gradient based on base + height + directional *= ( + (1.0 - u_vertical_gradient) + + (u_vertical_gradient * clamp((t + base) * pow(height / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0))); + } + + // Assign final color based on surface + ambient light color, diffuse light directional, and light color + // with lower bounds adjusted to hue of light + // so that shading is tinted with the complementary (opposite) color to the light color + v_color.r += clamp(color.r * directional * u_lightcolor.r, mix(0.0, 0.3, 1.0 - u_lightcolor.r), 1.0); + v_color.g += clamp(color.g * directional * u_lightcolor.g, mix(0.0, 0.3, 1.0 - u_lightcolor.g), 1.0); + v_color.b += clamp(color.b * directional * u_lightcolor.b, mix(0.0, 0.3, 1.0 - u_lightcolor.b), 1.0); +} + +*/ + +// Uncompressed source of fill_extrusion.fragment.glsl: +/* +varying vec4 v_color; + +void main() { + gl_FragColor = v_color; + +#ifdef OVERDRAW_INSPECTOR + gl_FragColor = vec4(1.0); +#endif +} + +*/ + diff --git a/src/mbgl/programs/gl/fill_extrusion_pattern.cpp b/src/mbgl/programs/gl/fill_extrusion_pattern.cpp new file mode 100644 index 0000000000..9c2da87b11 --- /dev/null +++ b/src/mbgl/programs/gl/fill_extrusion_pattern.cpp @@ -0,0 +1,241 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/fill_extrusion_pattern_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<FillExtrusionPatternProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<FillExtrusionPatternProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "fill_extrusion_pattern", + programs::gl::shaderSource() + 23237, programs::gl::shaderSource() + 26157); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of fill_extrusion_pattern.vertex.glsl: +/* +uniform mat4 u_matrix; +uniform vec2 u_pixel_coord_upper; +uniform vec2 u_pixel_coord_lower; +uniform float u_height_factor; +uniform vec4 u_scale; +uniform float u_vertical_gradient; + +uniform vec3 u_lightcolor; +uniform lowp vec3 u_lightpos; +uniform lowp float u_lightintensity; + +attribute vec2 a_pos; +attribute vec4 a_normal_ed; + +varying vec2 v_pos_a; +varying vec2 v_pos_b; +varying vec4 v_lighting; + + +#ifndef HAS_UNIFORM_u_base +uniform lowp float a_base_t; +attribute lowp vec2 a_base; +varying lowp float base; +#else +uniform lowp float u_base; +#endif + + +#ifndef HAS_UNIFORM_u_height +uniform lowp float a_height_t; +attribute lowp vec2 a_height; +varying lowp float height; +#else +uniform lowp float u_height; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_from +uniform lowp float a_pattern_from_t; +attribute lowp vec4 a_pattern_from; +varying lowp vec4 pattern_from; +#else +uniform lowp vec4 u_pattern_from; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_to +uniform lowp float a_pattern_to_t; +attribute lowp vec4 a_pattern_to; +varying lowp vec4 pattern_to; +#else +uniform lowp vec4 u_pattern_to; +#endif + + +void main() { + +#ifndef HAS_UNIFORM_u_base + base = unpack_mix_vec2(a_base, a_base_t); +#else + lowp float base = u_base; +#endif + + +#ifndef HAS_UNIFORM_u_height + height = unpack_mix_vec2(a_height, a_height_t); +#else + lowp float height = u_height; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_from + pattern_from = a_pattern_from; +#else + mediump vec4 pattern_from = u_pattern_from; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_to + pattern_to = a_pattern_to; +#else + mediump vec4 pattern_to = u_pattern_to; +#endif + + + vec2 pattern_tl_a = pattern_from.xy; + vec2 pattern_br_a = pattern_from.zw; + vec2 pattern_tl_b = pattern_to.xy; + vec2 pattern_br_b = pattern_to.zw; + + float pixelRatio = u_scale.x; + float tileRatio = u_scale.y; + float fromScale = u_scale.z; + float toScale = u_scale.w; + + vec3 normal = a_normal_ed.xyz; + float edgedistance = a_normal_ed.w; + + vec2 display_size_a = vec2((pattern_br_a.x - pattern_tl_a.x) / pixelRatio, (pattern_br_a.y - pattern_tl_a.y) / pixelRatio); + vec2 display_size_b = vec2((pattern_br_b.x - pattern_tl_b.x) / pixelRatio, (pattern_br_b.y - pattern_tl_b.y) / pixelRatio); + + base = max(0.0, base); + height = max(0.0, height); + + float t = mod(normal.x, 2.0); + float z = t > 0.0 ? height : base; + + gl_Position = u_matrix * vec4(a_pos, z, 1); + + vec2 pos = normal.x == 1.0 && normal.y == 0.0 && normal.z == 16384.0 + ? a_pos // extrusion top + : vec2(edgedistance, z * u_height_factor); // extrusion side + + v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, fromScale * display_size_a, tileRatio, pos); + v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, toScale * display_size_b, tileRatio, pos); + + v_lighting = vec4(0.0, 0.0, 0.0, 1.0); + float directional = clamp(dot(normal / 16383.0, u_lightpos), 0.0, 1.0); + directional = mix((1.0 - u_lightintensity), max((0.5 + u_lightintensity), 1.0), directional); + + if (normal.y != 0.0) { + // This avoids another branching statement, but multiplies by a constant of 0.84 if no vertical gradient, + // and otherwise calculates the gradient based on base + height + directional *= ( + (1.0 - u_vertical_gradient) + + (u_vertical_gradient * clamp((t + base) * pow(height / 150.0, 0.5), mix(0.7, 0.98, 1.0 - u_lightintensity), 1.0))); + } + + v_lighting.rgb += clamp(directional * u_lightcolor, mix(vec3(0.0), vec3(0.3), 1.0 - u_lightcolor), vec3(1.0)); +} + +*/ + +// Uncompressed source of fill_extrusion_pattern.fragment.glsl: +/* +uniform vec2 u_texsize; +uniform float u_fade; + +uniform sampler2D u_image; + +varying vec2 v_pos_a; +varying vec2 v_pos_b; +varying vec4 v_lighting; + + +#ifndef HAS_UNIFORM_u_base +varying lowp float base; +#else +uniform lowp float u_base; +#endif + + +#ifndef HAS_UNIFORM_u_height +varying lowp float height; +#else +uniform lowp float u_height; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_from +varying lowp vec4 pattern_from; +#else +uniform lowp vec4 u_pattern_from; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_to +varying lowp vec4 pattern_to; +#else +uniform lowp vec4 u_pattern_to; +#endif + + +void main() { + +#ifdef HAS_UNIFORM_u_base + lowp float base = u_base; +#endif + + +#ifdef HAS_UNIFORM_u_height + lowp float height = u_height; +#endif + + +#ifdef HAS_UNIFORM_u_pattern_from + mediump vec4 pattern_from = u_pattern_from; +#endif + + +#ifdef HAS_UNIFORM_u_pattern_to + mediump vec4 pattern_to = u_pattern_to; +#endif + + + vec2 pattern_tl_a = pattern_from.xy; + vec2 pattern_br_a = pattern_from.zw; + vec2 pattern_tl_b = pattern_to.xy; + vec2 pattern_br_b = pattern_to.zw; + + vec2 imagecoord = mod(v_pos_a, 1.0); + vec2 pos = mix(pattern_tl_a / u_texsize, pattern_br_a / u_texsize, imagecoord); + vec4 color1 = texture2D(u_image, pos); + + vec2 imagecoord_b = mod(v_pos_b, 1.0); + vec2 pos2 = mix(pattern_tl_b / u_texsize, pattern_br_b / u_texsize, imagecoord_b); + vec4 color2 = texture2D(u_image, pos2); + + vec4 mixedColor = mix(color1, color2, u_fade); + + gl_FragColor = mixedColor * v_lighting; + +#ifdef OVERDRAW_INSPECTOR + gl_FragColor = vec4(1.0); +#endif +} + +*/ + diff --git a/src/mbgl/programs/gl/fill_outline.cpp b/src/mbgl/programs/gl/fill_outline.cpp new file mode 100644 index 0000000000..07615b2138 --- /dev/null +++ b/src/mbgl/programs/gl/fill_outline.cpp @@ -0,0 +1,112 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/fill_outline_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<FillOutlineProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<FillOutlineProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "fill_outline", + programs::gl::shaderSource() + 13678, programs::gl::shaderSource() + 14503); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of fill_outline.vertex.glsl: +/* +attribute vec2 a_pos; + +uniform mat4 u_matrix; +uniform vec2 u_world; + +varying vec2 v_pos; + + +#ifndef HAS_UNIFORM_u_outline_color +uniform lowp float a_outline_color_t; +attribute highp vec4 a_outline_color; +varying highp vec4 outline_color; +#else +uniform highp vec4 u_outline_color; +#endif + + +#ifndef HAS_UNIFORM_u_opacity +uniform lowp float a_opacity_t; +attribute lowp vec2 a_opacity; +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +void main() { + +#ifndef HAS_UNIFORM_u_outline_color + outline_color = unpack_mix_color(a_outline_color, a_outline_color_t); +#else + highp vec4 outline_color = u_outline_color; +#endif + + +#ifndef HAS_UNIFORM_u_opacity + opacity = unpack_mix_vec2(a_opacity, a_opacity_t); +#else + lowp float opacity = u_opacity; +#endif + + + gl_Position = u_matrix * vec4(a_pos, 0, 1); + v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world; +} + +*/ + +// Uncompressed source of fill_outline.fragment.glsl: +/* + +#ifndef HAS_UNIFORM_u_outline_color +varying highp vec4 outline_color; +#else +uniform highp vec4 u_outline_color; +#endif + + +#ifndef HAS_UNIFORM_u_opacity +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +varying vec2 v_pos; + +void main() { + +#ifdef HAS_UNIFORM_u_outline_color + highp vec4 outline_color = u_outline_color; +#endif + + +#ifdef HAS_UNIFORM_u_opacity + lowp float opacity = u_opacity; +#endif + + + float dist = length(v_pos - gl_FragCoord.xy); + float alpha = 1.0 - smoothstep(0.0, 1.0, dist); + gl_FragColor = outline_color * (alpha * opacity); + +#ifdef OVERDRAW_INSPECTOR + gl_FragColor = vec4(1.0); +#endif +} + +*/ + diff --git a/src/mbgl/programs/gl/fill_outline_pattern.cpp b/src/mbgl/programs/gl/fill_outline_pattern.cpp new file mode 100644 index 0000000000..7e0bf19655 --- /dev/null +++ b/src/mbgl/programs/gl/fill_outline_pattern.cpp @@ -0,0 +1,186 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/fill_outline_pattern_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<FillOutlinePatternProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<FillOutlinePatternProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "fill_outline_pattern", + programs::gl::shaderSource() + 15092, programs::gl::shaderSource() + 16952); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of fill_outline_pattern.vertex.glsl: +/* +uniform mat4 u_matrix; +uniform vec2 u_world; +uniform vec2 u_pixel_coord_upper; +uniform vec2 u_pixel_coord_lower; +uniform vec4 u_scale; + +attribute vec2 a_pos; + +varying vec2 v_pos_a; +varying vec2 v_pos_b; +varying vec2 v_pos; + + +#ifndef HAS_UNIFORM_u_opacity +uniform lowp float a_opacity_t; +attribute lowp vec2 a_opacity; +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_from +uniform lowp float a_pattern_from_t; +attribute lowp vec4 a_pattern_from; +varying lowp vec4 pattern_from; +#else +uniform lowp vec4 u_pattern_from; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_to +uniform lowp float a_pattern_to_t; +attribute lowp vec4 a_pattern_to; +varying lowp vec4 pattern_to; +#else +uniform lowp vec4 u_pattern_to; +#endif + + +void main() { + +#ifndef HAS_UNIFORM_u_opacity + opacity = unpack_mix_vec2(a_opacity, a_opacity_t); +#else + lowp float opacity = u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_from + pattern_from = a_pattern_from; +#else + mediump vec4 pattern_from = u_pattern_from; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_to + pattern_to = a_pattern_to; +#else + mediump vec4 pattern_to = u_pattern_to; +#endif + + + vec2 pattern_tl_a = pattern_from.xy; + vec2 pattern_br_a = pattern_from.zw; + vec2 pattern_tl_b = pattern_to.xy; + vec2 pattern_br_b = pattern_to.zw; + + float pixelRatio = u_scale.x; + float tileRatio = u_scale.y; + float fromScale = u_scale.z; + float toScale = u_scale.w; + + gl_Position = u_matrix * vec4(a_pos, 0, 1); + + vec2 display_size_a = vec2((pattern_br_a.x - pattern_tl_a.x) / pixelRatio, (pattern_br_a.y - pattern_tl_a.y) / pixelRatio); + vec2 display_size_b = vec2((pattern_br_b.x - pattern_tl_b.x) / pixelRatio, (pattern_br_b.y - pattern_tl_b.y) / pixelRatio); + + v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, fromScale * display_size_a, tileRatio, a_pos); + v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, toScale * display_size_b, tileRatio, a_pos); + + v_pos = (gl_Position.xy / gl_Position.w + 1.0) / 2.0 * u_world; +} + +*/ + +// Uncompressed source of fill_outline_pattern.fragment.glsl: +/* + +uniform vec2 u_texsize; +uniform sampler2D u_image; +uniform float u_fade; + +varying vec2 v_pos_a; +varying vec2 v_pos_b; +varying vec2 v_pos; + + +#ifndef HAS_UNIFORM_u_opacity +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_from +varying lowp vec4 pattern_from; +#else +uniform lowp vec4 u_pattern_from; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_to +varying lowp vec4 pattern_to; +#else +uniform lowp vec4 u_pattern_to; +#endif + + +void main() { + +#ifdef HAS_UNIFORM_u_opacity + lowp float opacity = u_opacity; +#endif + + +#ifdef HAS_UNIFORM_u_pattern_from + mediump vec4 pattern_from = u_pattern_from; +#endif + + +#ifdef HAS_UNIFORM_u_pattern_to + mediump vec4 pattern_to = u_pattern_to; +#endif + + + vec2 pattern_tl_a = pattern_from.xy; + vec2 pattern_br_a = pattern_from.zw; + vec2 pattern_tl_b = pattern_to.xy; + vec2 pattern_br_b = pattern_to.zw; + + vec2 imagecoord = mod(v_pos_a, 1.0); + vec2 pos = mix(pattern_tl_a / u_texsize, pattern_br_a / u_texsize, imagecoord); + vec4 color1 = texture2D(u_image, pos); + + vec2 imagecoord_b = mod(v_pos_b, 1.0); + vec2 pos2 = mix(pattern_tl_b / u_texsize, pattern_br_b / u_texsize, imagecoord_b); + vec4 color2 = texture2D(u_image, pos2); + + // find distance to outline for alpha interpolation + + float dist = length(v_pos - gl_FragCoord.xy); + float alpha = 1.0 - smoothstep(0.0, 1.0, dist); + + + gl_FragColor = mix(color1, color2, u_fade) * alpha * opacity; + +#ifdef OVERDRAW_INSPECTOR + gl_FragColor = vec4(1.0); +#endif +} + +*/ + diff --git a/src/mbgl/programs/gl/fill_pattern.cpp b/src/mbgl/programs/gl/fill_pattern.cpp new file mode 100644 index 0000000000..256b1ede99 --- /dev/null +++ b/src/mbgl/programs/gl/fill_pattern.cpp @@ -0,0 +1,174 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/fill_pattern_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<FillPatternProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<FillPatternProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "fill_pattern", + programs::gl::shaderSource() + 18259, programs::gl::shaderSource() + 20038); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of fill_pattern.vertex.glsl: +/* +uniform mat4 u_matrix; +uniform vec2 u_pixel_coord_upper; +uniform vec2 u_pixel_coord_lower; +uniform vec4 u_scale; + +attribute vec2 a_pos; + +varying vec2 v_pos_a; +varying vec2 v_pos_b; + + +#ifndef HAS_UNIFORM_u_opacity +uniform lowp float a_opacity_t; +attribute lowp vec2 a_opacity; +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_from +uniform lowp float a_pattern_from_t; +attribute lowp vec4 a_pattern_from; +varying lowp vec4 pattern_from; +#else +uniform lowp vec4 u_pattern_from; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_to +uniform lowp float a_pattern_to_t; +attribute lowp vec4 a_pattern_to; +varying lowp vec4 pattern_to; +#else +uniform lowp vec4 u_pattern_to; +#endif + + +void main() { + +#ifndef HAS_UNIFORM_u_opacity + opacity = unpack_mix_vec2(a_opacity, a_opacity_t); +#else + lowp float opacity = u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_from + pattern_from = a_pattern_from; +#else + mediump vec4 pattern_from = u_pattern_from; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_to + pattern_to = a_pattern_to; +#else + mediump vec4 pattern_to = u_pattern_to; +#endif + + + vec2 pattern_tl_a = pattern_from.xy; + vec2 pattern_br_a = pattern_from.zw; + vec2 pattern_tl_b = pattern_to.xy; + vec2 pattern_br_b = pattern_to.zw; + + float pixelRatio = u_scale.x; + float tileZoomRatio = u_scale.y; + float fromScale = u_scale.z; + float toScale = u_scale.w; + + vec2 display_size_a = vec2((pattern_br_a.x - pattern_tl_a.x) / pixelRatio, (pattern_br_a.y - pattern_tl_a.y) / pixelRatio); + vec2 display_size_b = vec2((pattern_br_b.x - pattern_tl_b.x) / pixelRatio, (pattern_br_b.y - pattern_tl_b.y) / pixelRatio); + gl_Position = u_matrix * vec4(a_pos, 0, 1); + + v_pos_a = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, fromScale * display_size_a, tileZoomRatio, a_pos); + v_pos_b = get_pattern_pos(u_pixel_coord_upper, u_pixel_coord_lower, toScale * display_size_b, tileZoomRatio, a_pos); +} + +*/ + +// Uncompressed source of fill_pattern.fragment.glsl: +/* +uniform vec2 u_texsize; +uniform float u_fade; + +uniform sampler2D u_image; + +varying vec2 v_pos_a; +varying vec2 v_pos_b; + + +#ifndef HAS_UNIFORM_u_opacity +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_from +varying lowp vec4 pattern_from; +#else +uniform lowp vec4 u_pattern_from; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_to +varying lowp vec4 pattern_to; +#else +uniform lowp vec4 u_pattern_to; +#endif + + +void main() { + +#ifdef HAS_UNIFORM_u_opacity + lowp float opacity = u_opacity; +#endif + + +#ifdef HAS_UNIFORM_u_pattern_from + mediump vec4 pattern_from = u_pattern_from; +#endif + + +#ifdef HAS_UNIFORM_u_pattern_to + mediump vec4 pattern_to = u_pattern_to; +#endif + + + vec2 pattern_tl_a = pattern_from.xy; + vec2 pattern_br_a = pattern_from.zw; + vec2 pattern_tl_b = pattern_to.xy; + vec2 pattern_br_b = pattern_to.zw; + + vec2 imagecoord = mod(v_pos_a, 1.0); + vec2 pos = mix(pattern_tl_a / u_texsize, pattern_br_a / u_texsize, imagecoord); + vec4 color1 = texture2D(u_image, pos); + + vec2 imagecoord_b = mod(v_pos_b, 1.0); + vec2 pos2 = mix(pattern_tl_b / u_texsize, pattern_br_b / u_texsize, imagecoord_b); + vec4 color2 = texture2D(u_image, pos2); + + gl_FragColor = mix(color1, color2, u_fade) * opacity; + +#ifdef OVERDRAW_INSPECTOR + gl_FragColor = vec4(1.0); +#endif +} + +*/ + diff --git a/src/mbgl/programs/gl/heatmap.cpp b/src/mbgl/programs/gl/heatmap.cpp new file mode 100644 index 0000000000..59f8ad9f69 --- /dev/null +++ b/src/mbgl/programs/gl/heatmap.cpp @@ -0,0 +1,141 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/heatmap_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<HeatmapProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<HeatmapProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "heatmap", + programs::gl::shaderSource() + 7983, programs::gl::shaderSource() + 9030); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of heatmap.vertex.glsl: +/* + +#ifndef HAS_UNIFORM_u_weight +uniform lowp float a_weight_t; +attribute highp vec2 a_weight; +varying highp float weight; +#else +uniform highp float u_weight; +#endif + + +#ifndef HAS_UNIFORM_u_radius +uniform lowp float a_radius_t; +attribute mediump vec2 a_radius; +#else +uniform mediump float u_radius; +#endif + + +uniform mat4 u_matrix; +uniform float u_extrude_scale; +uniform float u_opacity; +uniform float u_intensity; + +attribute vec2 a_pos; + +varying vec2 v_extrude; + +// Effective "0" in the kernel density texture to adjust the kernel size to; +// this empirically chosen number minimizes artifacts on overlapping kernels +// for typical heatmap cases (assuming clustered source) +const highp float ZERO = 1.0 / 255.0 / 16.0; + +// Gaussian kernel coefficient: 1 / sqrt(2 * PI) +#define GAUSS_COEF 0.3989422804014327 + +void main(void) { + +#ifndef HAS_UNIFORM_u_weight + weight = unpack_mix_vec2(a_weight, a_weight_t); +#else + highp float weight = u_weight; +#endif + + +#ifndef HAS_UNIFORM_u_radius + mediump float radius = unpack_mix_vec2(a_radius, a_radius_t); +#else + mediump float radius = u_radius; +#endif + + + // unencode the extrusion vector that we snuck into the a_pos vector + vec2 unscaled_extrude = vec2(mod(a_pos, 2.0) * 2.0 - 1.0); + + // This 'extrude' comes in ranging from [-1, -1], to [1, 1]. We'll use + // it to produce the vertices of a square mesh framing the point feature + // we're adding to the kernel density texture. We'll also pass it as + // a varying, so that the fragment shader can determine the distance of + // each fragment from the point feature. + // Before we do so, we need to scale it up sufficiently so that the + // kernel falls effectively to zero at the edge of the mesh. + // That is, we want to know S such that + // weight * u_intensity * GAUSS_COEF * exp(-0.5 * 3.0^2 * S^2) == ZERO + // Which solves to: + // S = sqrt(-2.0 * log(ZERO / (weight * u_intensity * GAUSS_COEF))) / 3.0 + float S = sqrt(-2.0 * log(ZERO / weight / u_intensity / GAUSS_COEF)) / 3.0; + + // Pass the varying in units of radius + v_extrude = S * unscaled_extrude; + + // Scale by radius and the zoom-based scale factor to produce actual + // mesh position + vec2 extrude = v_extrude * radius * u_extrude_scale; + + // multiply a_pos by 0.5, since we had it * 2 in order to sneak + // in extrusion data + vec4 pos = vec4(floor(a_pos * 0.5) + extrude, 0, 1); + + gl_Position = u_matrix * pos; +} + +*/ + +// Uncompressed source of heatmap.fragment.glsl: +/* + +#ifndef HAS_UNIFORM_u_weight +varying highp float weight; +#else +uniform highp float u_weight; +#endif + + +uniform highp float u_intensity; +varying vec2 v_extrude; + +// Gaussian kernel coefficient: 1 / sqrt(2 * PI) +#define GAUSS_COEF 0.3989422804014327 + +void main() { + +#ifdef HAS_UNIFORM_u_weight + highp float weight = u_weight; +#endif + + + // Kernel density estimation with a Gaussian kernel of size 5x5 + float d = -0.5 * 3.0 * 3.0 * dot(v_extrude, v_extrude); + float val = weight * u_intensity * GAUSS_COEF * exp(d); + + gl_FragColor = vec4(val, 1.0, 1.0, 1.0); + +#ifdef OVERDRAW_INSPECTOR + gl_FragColor = vec4(1.0); +#endif +} + +*/ + diff --git a/src/mbgl/programs/gl/heatmap_texture.cpp b/src/mbgl/programs/gl/heatmap_texture.cpp new file mode 100644 index 0000000000..530e9fa18b --- /dev/null +++ b/src/mbgl/programs/gl/heatmap_texture.cpp @@ -0,0 +1,55 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/heatmap_texture_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<HeatmapTextureProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<HeatmapTextureProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "heatmap_texture", + programs::gl::shaderSource() + 9491, programs::gl::shaderSource() + 9671); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of heatmap_texture.vertex.glsl: +/* +uniform mat4 u_matrix; +uniform vec2 u_world; +attribute vec2 a_pos; +varying vec2 v_pos; + +void main() { + gl_Position = u_matrix * vec4(a_pos * u_world, 0, 1); + + v_pos.x = a_pos.x; + v_pos.y = 1.0 - a_pos.y; +} + +*/ + +// Uncompressed source of heatmap_texture.fragment.glsl: +/* +uniform sampler2D u_image; +uniform sampler2D u_color_ramp; +uniform float u_opacity; +varying vec2 v_pos; + +void main() { + float t = texture2D(u_image, v_pos).r; + vec4 color = texture2D(u_color_ramp, vec2(t, 0.5)); + gl_FragColor = color * u_opacity; + +#ifdef OVERDRAW_INSPECTOR + gl_FragColor = vec4(0.0); +#endif +} + +*/ + diff --git a/src/mbgl/programs/gl/hillshade.cpp b/src/mbgl/programs/gl/hillshade.cpp new file mode 100644 index 0000000000..dcf90f1149 --- /dev/null +++ b/src/mbgl/programs/gl/hillshade.cpp @@ -0,0 +1,93 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/hillshade_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<HillshadeProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<HillshadeProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "hillshade", + programs::gl::shaderSource() + 29340, programs::gl::shaderSource() + 29511); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of hillshade.vertex.glsl: +/* +uniform mat4 u_matrix; + +attribute vec2 a_pos; +attribute vec2 a_texture_pos; + +varying vec2 v_pos; + +void main() { + gl_Position = u_matrix * vec4(a_pos, 0, 1); + v_pos = a_texture_pos / 8192.0; +} + +*/ + +// Uncompressed source of hillshade.fragment.glsl: +/* +uniform sampler2D u_image; +varying vec2 v_pos; + +uniform vec2 u_latrange; +uniform vec2 u_light; +uniform vec4 u_shadow; +uniform vec4 u_highlight; +uniform vec4 u_accent; + +#define PI 3.141592653589793 + +void main() { + vec4 pixel = texture2D(u_image, v_pos); + + vec2 deriv = ((pixel.rg * 2.0) - 1.0); + + // We divide the slope by a scale factor based on the cosin of the pixel's approximate latitude + // to account for mercator projection distortion. see #4807 for details + float scaleFactor = cos(radians((u_latrange[0] - u_latrange[1]) * (1.0 - v_pos.y) + u_latrange[1])); + // We also multiply the slope by an arbitrary z-factor of 1.25 + float slope = atan(1.25 * length(deriv) / scaleFactor); + float aspect = deriv.x != 0.0 ? atan(deriv.y, -deriv.x) : PI / 2.0 * (deriv.y > 0.0 ? 1.0 : -1.0); + + float intensity = u_light.x; + // We add PI to make this property match the global light object, which adds PI/2 to the light's azimuthal + // position property to account for 0deg corresponding to north/the top of the viewport in the style spec + // and the original shader was written to accept (-illuminationDirection - 90) as the azimuthal. + float azimuth = u_light.y + PI; + + // We scale the slope exponentially based on intensity, using a calculation similar to + // the exponential interpolation function in the style spec: + // https://github.com/mapbox/mapbox-gl-js/blob/master/src/style-spec/expression/definitions/interpolate.js#L217-L228 + // so that higher intensity values create more opaque hillshading. + float base = 1.875 - intensity * 1.75; + float maxValue = 0.5 * PI; + float scaledSlope = intensity != 0.5 ? ((pow(base, slope) - 1.0) / (pow(base, maxValue) - 1.0)) * maxValue : slope; + + // The accent color is calculated with the cosine of the slope while the shade color is calculated with the sine + // so that the accent color's rate of change eases in while the shade color's eases out. + float accent = cos(scaledSlope); + // We multiply both the accent and shade color by a clamped intensity value + // so that intensities >= 0.5 do not additionally affect the color values + // while intensity values < 0.5 make the overall color more transparent. + vec4 accent_color = (1.0 - accent) * u_accent * clamp(intensity * 2.0, 0.0, 1.0); + float shade = abs(mod((aspect + azimuth) / PI + 0.5, 2.0) - 1.0); + vec4 shade_color = mix(u_shadow, u_highlight, shade) * sin(scaledSlope) * clamp(intensity * 2.0, 0.0, 1.0); + gl_FragColor = accent_color * (1.0 - shade_color.a) + shade_color; + +#ifdef OVERDRAW_INSPECTOR + gl_FragColor = vec4(1.0); +#endif +} + +*/ + diff --git a/src/mbgl/programs/gl/hillshade_prepare.cpp b/src/mbgl/programs/gl/hillshade_prepare.cpp new file mode 100644 index 0000000000..b445713530 --- /dev/null +++ b/src/mbgl/programs/gl/hillshade_prepare.cpp @@ -0,0 +1,117 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/hillshade_prepare_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<HillshadePrepareProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<HillshadePrepareProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "hillshade_prepare", + programs::gl::shaderSource() + 27925, programs::gl::shaderSource() + 28218); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of hillshade_prepare.vertex.glsl: +/* +uniform mat4 u_matrix; +uniform vec2 u_dimension; + +attribute vec2 a_pos; +attribute vec2 a_texture_pos; + +varying vec2 v_pos; + +void main() { + gl_Position = u_matrix * vec4(a_pos, 0, 1); + + highp vec2 epsilon = 1.0 / u_dimension; + float scale = (u_dimension.x - 2.0) / u_dimension.x; + v_pos = (a_texture_pos / 8192.0) * scale + epsilon; +} + +*/ + +// Uncompressed source of hillshade_prepare.fragment.glsl: +/* +#ifdef GL_ES +precision highp float; +#endif + +uniform sampler2D u_image; +varying vec2 v_pos; +uniform vec2 u_dimension; +uniform float u_zoom; +uniform float u_maxzoom; + +float getElevation(vec2 coord, float bias) { + // Convert encoded elevation value to meters + vec4 data = texture2D(u_image, coord) * 255.0; + return (data.r + data.g * 256.0 + data.b * 256.0 * 256.0) / 4.0; +} + +void main() { + vec2 epsilon = 1.0 / u_dimension; + + // queried pixels: + // +-----------+ + // | | | | + // | a | b | c | + // | | | | + // +-----------+ + // | | | | + // | d | e | f | + // | | | | + // +-----------+ + // | | | | + // | g | h | i | + // | | | | + // +-----------+ + + float a = getElevation(v_pos + vec2(-epsilon.x, -epsilon.y), 0.0); + float b = getElevation(v_pos + vec2(0, -epsilon.y), 0.0); + float c = getElevation(v_pos + vec2(epsilon.x, -epsilon.y), 0.0); + float d = getElevation(v_pos + vec2(-epsilon.x, 0), 0.0); + float e = getElevation(v_pos, 0.0); + float f = getElevation(v_pos + vec2(epsilon.x, 0), 0.0); + float g = getElevation(v_pos + vec2(-epsilon.x, epsilon.y), 0.0); + float h = getElevation(v_pos + vec2(0, epsilon.y), 0.0); + float i = getElevation(v_pos + vec2(epsilon.x, epsilon.y), 0.0); + + // here we divide the x and y slopes by 8 * pixel size + // where pixel size (aka meters/pixel) is: + // circumference of the world / (pixels per tile * number of tiles) + // which is equivalent to: 8 * 40075016.6855785 / (512 * pow(2, u_zoom)) + // which can be reduced to: pow(2, 19.25619978527 - u_zoom) + // we want to vertically exaggerate the hillshading though, because otherwise + // it is barely noticeable at low zooms. to do this, we multiply this by some + // scale factor pow(2, (u_zoom - u_maxzoom) * a) where a is an arbitrary value + // Here we use a=0.3 which works out to the expression below. see + // nickidlugash's awesome breakdown for more info + // https://github.com/mapbox/mapbox-gl-js/pull/5286#discussion_r148419556 + float exaggeration = u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3; + + vec2 deriv = vec2( + (c + f + f + i) - (a + d + d + g), + (g + h + h + i) - (a + b + b + c) + ) / pow(2.0, (u_zoom - u_maxzoom) * exaggeration + 19.2562 - u_zoom); + + gl_FragColor = clamp(vec4( + deriv.x / 2.0 + 0.5, + deriv.y / 2.0 + 0.5, + 1.0, + 1.0), 0.0, 1.0); + +#ifdef OVERDRAW_INSPECTOR + gl_FragColor = vec4(1.0); +#endif +} + +*/ + diff --git a/src/mbgl/programs/gl/line.cpp b/src/mbgl/programs/gl/line.cpp new file mode 100644 index 0000000000..c25679ae1f --- /dev/null +++ b/src/mbgl/programs/gl/line.cpp @@ -0,0 +1,253 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/line_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<LineProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<LineProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "line", + programs::gl::shaderSource() + 30585, programs::gl::shaderSource() + 33509); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of line.vertex.glsl: +/* + + +// the distance over which the line edge fades out. +// Retina devices need a smaller distance to avoid aliasing. +#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0 + +// floor(127 / 2) == 63.0 +// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is +// stored in a byte (-128..127). we scale regular normals up to length 63, but +// there are also "special" normals that have a bigger length (of up to 126 in +// this case). +// #define scale 63.0 +#define scale 0.015873016 + +attribute vec4 a_pos_normal; +attribute vec4 a_data; + +uniform mat4 u_matrix; +uniform mediump float u_ratio; +uniform vec2 u_gl_units_to_pixels; + +varying vec2 v_normal; +varying vec2 v_width2; +varying float v_gamma_scale; +varying highp float v_linesofar; + + +#ifndef HAS_UNIFORM_u_color +uniform lowp float a_color_t; +attribute highp vec4 a_color; +varying highp vec4 color; +#else +uniform highp vec4 u_color; +#endif + + +#ifndef HAS_UNIFORM_u_blur +uniform lowp float a_blur_t; +attribute lowp vec2 a_blur; +varying lowp float blur; +#else +uniform lowp float u_blur; +#endif + + +#ifndef HAS_UNIFORM_u_opacity +uniform lowp float a_opacity_t; +attribute lowp vec2 a_opacity; +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_gapwidth +uniform lowp float a_gapwidth_t; +attribute mediump vec2 a_gapwidth; +#else +uniform mediump float u_gapwidth; +#endif + + +#ifndef HAS_UNIFORM_u_offset +uniform lowp float a_offset_t; +attribute lowp vec2 a_offset; +#else +uniform lowp float u_offset; +#endif + + +#ifndef HAS_UNIFORM_u_width +uniform lowp float a_width_t; +attribute mediump vec2 a_width; +#else +uniform mediump float u_width; +#endif + + +void main() { + +#ifndef HAS_UNIFORM_u_color + color = unpack_mix_color(a_color, a_color_t); +#else + highp vec4 color = u_color; +#endif + + +#ifndef HAS_UNIFORM_u_blur + blur = unpack_mix_vec2(a_blur, a_blur_t); +#else + lowp float blur = u_blur; +#endif + + +#ifndef HAS_UNIFORM_u_opacity + opacity = unpack_mix_vec2(a_opacity, a_opacity_t); +#else + lowp float opacity = u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_gapwidth + mediump float gapwidth = unpack_mix_vec2(a_gapwidth, a_gapwidth_t); +#else + mediump float gapwidth = u_gapwidth; +#endif + + +#ifndef HAS_UNIFORM_u_offset + lowp float offset = unpack_mix_vec2(a_offset, a_offset_t); +#else + lowp float offset = u_offset; +#endif + + +#ifndef HAS_UNIFORM_u_width + mediump float width = unpack_mix_vec2(a_width, a_width_t); +#else + mediump float width = u_width; +#endif + + + vec2 a_extrude = a_data.xy - 128.0; + float a_direction = mod(a_data.z, 4.0) - 1.0; + + v_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * 2.0; + + vec2 pos = a_pos_normal.xy; + + // x is 1 if it's a round cap, 0 otherwise + // y is 1 if the normal points up, and -1 if it points down + mediump vec2 normal = a_pos_normal.zw; + v_normal = normal; + + // these transformations used to be applied in the JS and native code bases. + // moved them into the shader for clarity and simplicity. + gapwidth = gapwidth / 2.0; + float halfwidth = width / 2.0; + offset = -1.0 * offset; + + float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0); + float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING); + + // Scale the extrusion vector down to a normal and then up by the line width + // of this vertex. + mediump vec2 dist = outset * a_extrude * scale; + + // Calculate the offset when drawing a line that is to the side of the actual line. + // We do this by creating a vector that points towards the extrude, but rotate + // it when we're drawing round end points (a_direction = -1 or 1) since their + // extrude vector points in another direction. + mediump float u = 0.5 * a_direction; + mediump float t = 1.0 - abs(u); + mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t); + + vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0); + gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude; + + // calculate how much the perspective view squishes or stretches the extrude + float extrude_length_without_perspective = length(dist); + float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels); + v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective; + + v_width2 = vec2(outset, inset); +} + +*/ + +// Uncompressed source of line.fragment.glsl: +/* + +#ifndef HAS_UNIFORM_u_color +varying highp vec4 color; +#else +uniform highp vec4 u_color; +#endif + + +#ifndef HAS_UNIFORM_u_blur +varying lowp float blur; +#else +uniform lowp float u_blur; +#endif + + +#ifndef HAS_UNIFORM_u_opacity +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +varying vec2 v_width2; +varying vec2 v_normal; +varying float v_gamma_scale; + +void main() { + +#ifdef HAS_UNIFORM_u_color + highp vec4 color = u_color; +#endif + + +#ifdef HAS_UNIFORM_u_blur + lowp float blur = u_blur; +#endif + + +#ifdef HAS_UNIFORM_u_opacity + lowp float opacity = u_opacity; +#endif + + + // Calculate the distance of the pixel from the line in pixels. + float dist = length(v_normal) * v_width2.s; + + // Calculate the antialiasing fade factor. This is either when fading in + // the line in case of an offset line (v_width2.t) or when fading out + // (v_width2.s) + float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale; + float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0); + + gl_FragColor = color * (alpha * opacity); + +#ifdef OVERDRAW_INSPECTOR + gl_FragColor = vec4(1.0); +#endif +} + +*/ + diff --git a/src/mbgl/programs/gl/line_gradient.cpp b/src/mbgl/programs/gl/line_gradient.cpp new file mode 100644 index 0000000000..fae94b4596 --- /dev/null +++ b/src/mbgl/programs/gl/line_gradient.cpp @@ -0,0 +1,235 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/line_gradient_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<LineGradientProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<LineGradientProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "line_gradient", + programs::gl::shaderSource() + 34335, programs::gl::shaderSource() + 37054); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of line_gradient.vertex.glsl: +/* + +// the attribute conveying progress along a line is scaled to [0, 2^15) +#define MAX_LINE_DISTANCE 32767.0 + +// the distance over which the line edge fades out. +// Retina devices need a smaller distance to avoid aliasing. +#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0 + +// floor(127 / 2) == 63.0 +// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is +// stored in a byte (-128..127). we scale regular normals up to length 63, but +// there are also "special" normals that have a bigger length (of up to 126 in +// this case). +// #define scale 63.0 +#define scale 0.015873016 + +attribute vec4 a_pos_normal; +attribute vec4 a_data; + +uniform mat4 u_matrix; +uniform mediump float u_ratio; +uniform vec2 u_gl_units_to_pixels; + +varying vec2 v_normal; +varying vec2 v_width2; +varying float v_gamma_scale; +varying highp float v_lineprogress; + + +#ifndef HAS_UNIFORM_u_blur +uniform lowp float a_blur_t; +attribute lowp vec2 a_blur; +varying lowp float blur; +#else +uniform lowp float u_blur; +#endif + + +#ifndef HAS_UNIFORM_u_opacity +uniform lowp float a_opacity_t; +attribute lowp vec2 a_opacity; +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_gapwidth +uniform lowp float a_gapwidth_t; +attribute mediump vec2 a_gapwidth; +#else +uniform mediump float u_gapwidth; +#endif + + +#ifndef HAS_UNIFORM_u_offset +uniform lowp float a_offset_t; +attribute lowp vec2 a_offset; +#else +uniform lowp float u_offset; +#endif + + +#ifndef HAS_UNIFORM_u_width +uniform lowp float a_width_t; +attribute mediump vec2 a_width; +#else +uniform mediump float u_width; +#endif + + +void main() { + +#ifndef HAS_UNIFORM_u_blur + blur = unpack_mix_vec2(a_blur, a_blur_t); +#else + lowp float blur = u_blur; +#endif + + +#ifndef HAS_UNIFORM_u_opacity + opacity = unpack_mix_vec2(a_opacity, a_opacity_t); +#else + lowp float opacity = u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_gapwidth + mediump float gapwidth = unpack_mix_vec2(a_gapwidth, a_gapwidth_t); +#else + mediump float gapwidth = u_gapwidth; +#endif + + +#ifndef HAS_UNIFORM_u_offset + lowp float offset = unpack_mix_vec2(a_offset, a_offset_t); +#else + lowp float offset = u_offset; +#endif + + +#ifndef HAS_UNIFORM_u_width + mediump float width = unpack_mix_vec2(a_width, a_width_t); +#else + mediump float width = u_width; +#endif + + + vec2 a_extrude = a_data.xy - 128.0; + float a_direction = mod(a_data.z, 4.0) - 1.0; + + v_lineprogress = (floor(a_data.z / 4.0) + a_data.w * 64.0) * 2.0 / MAX_LINE_DISTANCE; + + vec2 pos = a_pos_normal.xy; + + // x is 1 if it's a round cap, 0 otherwise + // y is 1 if the normal points up, and -1 if it points down + mediump vec2 normal = a_pos_normal.zw; + v_normal = normal; + + // these transformations used to be applied in the JS and native code bases. + // moved them into the shader for clarity and simplicity. + gapwidth = gapwidth / 2.0; + float halfwidth = width / 2.0; + offset = -1.0 * offset; + + float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0); + float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING); + + // Scale the extrusion vector down to a normal and then up by the line width + // of this vertex. + mediump vec2 dist = outset * a_extrude * scale; + + // Calculate the offset when drawing a line that is to the side of the actual line. + // We do this by creating a vector that points towards the extrude, but rotate + // it when we're drawing round end points (a_direction = -1 or 1) since their + // extrude vector points in another direction. + mediump float u = 0.5 * a_direction; + mediump float t = 1.0 - abs(u); + mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t); + + vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0); + gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude; + + // calculate how much the perspective view squishes or stretches the extrude + float extrude_length_without_perspective = length(dist); + float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels); + v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective; + + v_width2 = vec2(outset, inset); +} + +*/ + +// Uncompressed source of line_gradient.fragment.glsl: +/* + + +#ifndef HAS_UNIFORM_u_blur +varying lowp float blur; +#else +uniform lowp float u_blur; +#endif + + +#ifndef HAS_UNIFORM_u_opacity +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +uniform sampler2D u_image; + +varying vec2 v_width2; +varying vec2 v_normal; +varying float v_gamma_scale; +varying highp float v_lineprogress; + +void main() { + +#ifdef HAS_UNIFORM_u_blur + lowp float blur = u_blur; +#endif + + +#ifdef HAS_UNIFORM_u_opacity + lowp float opacity = u_opacity; +#endif + + + // Calculate the distance of the pixel from the line in pixels. + float dist = length(v_normal) * v_width2.s; + + // Calculate the antialiasing fade factor. This is either when fading in + // the line in case of an offset line (v_width2.t) or when fading out + // (v_width2.s) + float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale; + float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0); + + // For gradient lines, v_lineprogress is the ratio along the entire line, + // scaled to [0, 2^15), and the gradient ramp is stored in a texture. + vec4 color = texture2D(u_image, vec2(v_lineprogress, 0.5)); + + gl_FragColor = color * (alpha * opacity); + +#ifdef OVERDRAW_INSPECTOR + gl_FragColor = vec4(1.0); +#endif +} + +*/ + diff --git a/src/mbgl/programs/gl/line_pattern.cpp b/src/mbgl/programs/gl/line_pattern.cpp new file mode 100644 index 0000000000..2e9ebaf5ea --- /dev/null +++ b/src/mbgl/programs/gl/line_pattern.cpp @@ -0,0 +1,322 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/line_pattern_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<LinePatternProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<LinePatternProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "line_pattern", + programs::gl::shaderSource() + 37841, programs::gl::shaderSource() + 41162); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of line_pattern.vertex.glsl: +/* +// floor(127 / 2) == 63.0 +// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is +// stored in a byte (-128..127). we scale regular normals up to length 63, but +// there are also "special" normals that have a bigger length (of up to 126 in +// this case). +// #define scale 63.0 +#define scale 0.015873016 + +// We scale the distance before adding it to the buffers so that we can store +// long distances for long segments. Use this value to unscale the distance. +#define LINE_DISTANCE_SCALE 2.0 + +// the distance over which the line edge fades out. +// Retina devices need a smaller distance to avoid aliasing. +#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0 + +attribute vec4 a_pos_normal; +attribute vec4 a_data; + +uniform mat4 u_matrix; +uniform vec2 u_gl_units_to_pixels; +uniform mediump float u_ratio; + +varying vec2 v_normal; +varying vec2 v_width2; +varying float v_linesofar; +varying float v_gamma_scale; + + +#ifndef HAS_UNIFORM_u_blur +uniform lowp float a_blur_t; +attribute lowp vec2 a_blur; +varying lowp float blur; +#else +uniform lowp float u_blur; +#endif + + +#ifndef HAS_UNIFORM_u_opacity +uniform lowp float a_opacity_t; +attribute lowp vec2 a_opacity; +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_offset +uniform lowp float a_offset_t; +attribute lowp vec2 a_offset; +#else +uniform lowp float u_offset; +#endif + + +#ifndef HAS_UNIFORM_u_gapwidth +uniform lowp float a_gapwidth_t; +attribute mediump vec2 a_gapwidth; +#else +uniform mediump float u_gapwidth; +#endif + + +#ifndef HAS_UNIFORM_u_width +uniform lowp float a_width_t; +attribute mediump vec2 a_width; +#else +uniform mediump float u_width; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_from +uniform lowp float a_pattern_from_t; +attribute lowp vec4 a_pattern_from; +varying lowp vec4 pattern_from; +#else +uniform lowp vec4 u_pattern_from; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_to +uniform lowp float a_pattern_to_t; +attribute lowp vec4 a_pattern_to; +varying lowp vec4 pattern_to; +#else +uniform lowp vec4 u_pattern_to; +#endif + + +void main() { + +#ifndef HAS_UNIFORM_u_blur + blur = unpack_mix_vec2(a_blur, a_blur_t); +#else + lowp float blur = u_blur; +#endif + + +#ifndef HAS_UNIFORM_u_opacity + opacity = unpack_mix_vec2(a_opacity, a_opacity_t); +#else + lowp float opacity = u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_offset + lowp float offset = unpack_mix_vec2(a_offset, a_offset_t); +#else + lowp float offset = u_offset; +#endif + + +#ifndef HAS_UNIFORM_u_gapwidth + mediump float gapwidth = unpack_mix_vec2(a_gapwidth, a_gapwidth_t); +#else + mediump float gapwidth = u_gapwidth; +#endif + + +#ifndef HAS_UNIFORM_u_width + mediump float width = unpack_mix_vec2(a_width, a_width_t); +#else + mediump float width = u_width; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_from + pattern_from = a_pattern_from; +#else + mediump vec4 pattern_from = u_pattern_from; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_to + pattern_to = a_pattern_to; +#else + mediump vec4 pattern_to = u_pattern_to; +#endif + + + vec2 a_extrude = a_data.xy - 128.0; + float a_direction = mod(a_data.z, 4.0) - 1.0; + float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE; + // float tileRatio = u_scale.y; + vec2 pos = a_pos_normal.xy; + + // x is 1 if it's a round cap, 0 otherwise + // y is 1 if the normal points up, and -1 if it points down + mediump vec2 normal = a_pos_normal.zw; + v_normal = normal; + + // these transformations used to be applied in the JS and native code bases. + // moved them into the shader for clarity and simplicity. + gapwidth = gapwidth / 2.0; + float halfwidth = width / 2.0; + offset = -1.0 * offset; + + float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0); + float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING); + + // Scale the extrusion vector down to a normal and then up by the line width + // of this vertex. + mediump vec2 dist = outset * a_extrude * scale; + + // Calculate the offset when drawing a line that is to the side of the actual line. + // We do this by creating a vector that points towards the extrude, but rotate + // it when we're drawing round end points (a_direction = -1 or 1) since their + // extrude vector points in another direction. + mediump float u = 0.5 * a_direction; + mediump float t = 1.0 - abs(u); + mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t); + + vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0); + gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude; + + // calculate how much the perspective view squishes or stretches the extrude + float extrude_length_without_perspective = length(dist); + float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels); + v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective; + + v_linesofar = a_linesofar; + v_width2 = vec2(outset, inset); +} + +*/ + +// Uncompressed source of line_pattern.fragment.glsl: +/* +uniform vec2 u_texsize; +uniform float u_fade; +uniform mediump vec4 u_scale; + +uniform sampler2D u_image; + +varying vec2 v_normal; +varying vec2 v_width2; +varying float v_linesofar; +varying float v_gamma_scale; + + +#ifndef HAS_UNIFORM_u_pattern_from +varying lowp vec4 pattern_from; +#else +uniform lowp vec4 u_pattern_from; +#endif + + +#ifndef HAS_UNIFORM_u_pattern_to +varying lowp vec4 pattern_to; +#else +uniform lowp vec4 u_pattern_to; +#endif + + +#ifndef HAS_UNIFORM_u_blur +varying lowp float blur; +#else +uniform lowp float u_blur; +#endif + + +#ifndef HAS_UNIFORM_u_opacity +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +void main() { + +#ifdef HAS_UNIFORM_u_pattern_from + mediump vec4 pattern_from = u_pattern_from; +#endif + + +#ifdef HAS_UNIFORM_u_pattern_to + mediump vec4 pattern_to = u_pattern_to; +#endif + + + +#ifdef HAS_UNIFORM_u_blur + lowp float blur = u_blur; +#endif + + +#ifdef HAS_UNIFORM_u_opacity + lowp float opacity = u_opacity; +#endif + + + vec2 pattern_tl_a = pattern_from.xy; + vec2 pattern_br_a = pattern_from.zw; + vec2 pattern_tl_b = pattern_to.xy; + vec2 pattern_br_b = pattern_to.zw; + + float pixelRatio = u_scale.x; + float tileZoomRatio = u_scale.y; + float fromScale = u_scale.z; + float toScale = u_scale.w; + + vec2 display_size_a = vec2((pattern_br_a.x - pattern_tl_a.x) / pixelRatio, (pattern_br_a.y - pattern_tl_a.y) / pixelRatio); + vec2 display_size_b = vec2((pattern_br_b.x - pattern_tl_b.x) / pixelRatio, (pattern_br_b.y - pattern_tl_b.y) / pixelRatio); + + vec2 pattern_size_a = vec2(display_size_a.x * fromScale / tileZoomRatio, display_size_a.y); + vec2 pattern_size_b = vec2(display_size_b.x * toScale / tileZoomRatio, display_size_b.y); + + // Calculate the distance of the pixel from the line in pixels. + float dist = length(v_normal) * v_width2.s; + + // Calculate the antialiasing fade factor. This is either when fading in + // the line in case of an offset line (v_width2.t) or when fading out + // (v_width2.s) + float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale; + float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0); + + float x_a = mod(v_linesofar / pattern_size_a.x, 1.0); + float x_b = mod(v_linesofar / pattern_size_b.x, 1.0); + + // v_normal.y is 0 at the midpoint of the line, -1 at the lower edge, 1 at the upper edge + // we clamp the line width outset to be between 0 and half the pattern height plus padding (2.0) + // to ensure we don't sample outside the designated symbol on the sprite sheet. + // 0.5 is added to shift the component to be bounded between 0 and 1 for interpolation of + // the texture coordinate + float y_a = 0.5 + (v_normal.y * clamp(v_width2.s, 0.0, (pattern_size_a.y + 2.0) / 2.0) / pattern_size_a.y); + float y_b = 0.5 + (v_normal.y * clamp(v_width2.s, 0.0, (pattern_size_b.y + 2.0) / 2.0) / pattern_size_b.y); + vec2 pos_a = mix(pattern_tl_a / u_texsize, pattern_br_a / u_texsize, vec2(x_a, y_a)); + vec2 pos_b = mix(pattern_tl_b / u_texsize, pattern_br_b / u_texsize, vec2(x_b, y_b)); + + vec4 color = mix(texture2D(u_image, pos_a), texture2D(u_image, pos_b), u_fade); + + gl_FragColor = color * alpha * opacity; + +#ifdef OVERDRAW_INSPECTOR + gl_FragColor = vec4(1.0); +#endif +} + +*/ + diff --git a/src/mbgl/programs/gl/line_sdf.cpp b/src/mbgl/programs/gl/line_sdf.cpp new file mode 100644 index 0000000000..0886bfcdf0 --- /dev/null +++ b/src/mbgl/programs/gl/line_sdf.cpp @@ -0,0 +1,315 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/line_sdf_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<LineSDFProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<LineSDFProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "line_sdf", + programs::gl::shaderSource() + 43475, programs::gl::shaderSource() + 47089); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of line_sdf.vertex.glsl: +/* +// floor(127 / 2) == 63.0 +// the maximum allowed miter limit is 2.0 at the moment. the extrude normal is +// stored in a byte (-128..127). we scale regular normals up to length 63, but +// there are also "special" normals that have a bigger length (of up to 126 in +// this case). +// #define scale 63.0 +#define scale 0.015873016 + +// We scale the distance before adding it to the buffers so that we can store +// long distances for long segments. Use this value to unscale the distance. +#define LINE_DISTANCE_SCALE 2.0 + +// the distance over which the line edge fades out. +// Retina devices need a smaller distance to avoid aliasing. +#define ANTIALIASING 1.0 / DEVICE_PIXEL_RATIO / 2.0 + +attribute vec4 a_pos_normal; +attribute vec4 a_data; + +uniform mat4 u_matrix; +uniform mediump float u_ratio; +uniform vec2 u_patternscale_a; +uniform float u_tex_y_a; +uniform vec2 u_patternscale_b; +uniform float u_tex_y_b; +uniform vec2 u_gl_units_to_pixels; + +varying vec2 v_normal; +varying vec2 v_width2; +varying vec2 v_tex_a; +varying vec2 v_tex_b; +varying float v_gamma_scale; + + +#ifndef HAS_UNIFORM_u_color +uniform lowp float a_color_t; +attribute highp vec4 a_color; +varying highp vec4 color; +#else +uniform highp vec4 u_color; +#endif + + +#ifndef HAS_UNIFORM_u_blur +uniform lowp float a_blur_t; +attribute lowp vec2 a_blur; +varying lowp float blur; +#else +uniform lowp float u_blur; +#endif + + +#ifndef HAS_UNIFORM_u_opacity +uniform lowp float a_opacity_t; +attribute lowp vec2 a_opacity; +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_gapwidth +uniform lowp float a_gapwidth_t; +attribute mediump vec2 a_gapwidth; +#else +uniform mediump float u_gapwidth; +#endif + + +#ifndef HAS_UNIFORM_u_offset +uniform lowp float a_offset_t; +attribute lowp vec2 a_offset; +#else +uniform lowp float u_offset; +#endif + + +#ifndef HAS_UNIFORM_u_width +uniform lowp float a_width_t; +attribute mediump vec2 a_width; +varying mediump float width; +#else +uniform mediump float u_width; +#endif + + +#ifndef HAS_UNIFORM_u_floorwidth +uniform lowp float a_floorwidth_t; +attribute lowp vec2 a_floorwidth; +varying lowp float floorwidth; +#else +uniform lowp float u_floorwidth; +#endif + + +void main() { + +#ifndef HAS_UNIFORM_u_color + color = unpack_mix_color(a_color, a_color_t); +#else + highp vec4 color = u_color; +#endif + + +#ifndef HAS_UNIFORM_u_blur + blur = unpack_mix_vec2(a_blur, a_blur_t); +#else + lowp float blur = u_blur; +#endif + + +#ifndef HAS_UNIFORM_u_opacity + opacity = unpack_mix_vec2(a_opacity, a_opacity_t); +#else + lowp float opacity = u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_gapwidth + mediump float gapwidth = unpack_mix_vec2(a_gapwidth, a_gapwidth_t); +#else + mediump float gapwidth = u_gapwidth; +#endif + + +#ifndef HAS_UNIFORM_u_offset + lowp float offset = unpack_mix_vec2(a_offset, a_offset_t); +#else + lowp float offset = u_offset; +#endif + + +#ifndef HAS_UNIFORM_u_width + width = unpack_mix_vec2(a_width, a_width_t); +#else + mediump float width = u_width; +#endif + + +#ifndef HAS_UNIFORM_u_floorwidth + floorwidth = unpack_mix_vec2(a_floorwidth, a_floorwidth_t); +#else + lowp float floorwidth = u_floorwidth; +#endif + + + vec2 a_extrude = a_data.xy - 128.0; + float a_direction = mod(a_data.z, 4.0) - 1.0; + float a_linesofar = (floor(a_data.z / 4.0) + a_data.w * 64.0) * LINE_DISTANCE_SCALE; + + vec2 pos = a_pos_normal.xy; + + // x is 1 if it's a round cap, 0 otherwise + // y is 1 if the normal points up, and -1 if it points down + mediump vec2 normal = a_pos_normal.zw; + v_normal = normal; + + // these transformations used to be applied in the JS and native code bases. + // moved them into the shader for clarity and simplicity. + gapwidth = gapwidth / 2.0; + float halfwidth = width / 2.0; + offset = -1.0 * offset; + + float inset = gapwidth + (gapwidth > 0.0 ? ANTIALIASING : 0.0); + float outset = gapwidth + halfwidth * (gapwidth > 0.0 ? 2.0 : 1.0) + (halfwidth == 0.0 ? 0.0 : ANTIALIASING); + + // Scale the extrusion vector down to a normal and then up by the line width + // of this vertex. + mediump vec2 dist =outset * a_extrude * scale; + + // Calculate the offset when drawing a line that is to the side of the actual line. + // We do this by creating a vector that points towards the extrude, but rotate + // it when we're drawing round end points (a_direction = -1 or 1) since their + // extrude vector points in another direction. + mediump float u = 0.5 * a_direction; + mediump float t = 1.0 - abs(u); + mediump vec2 offset2 = offset * a_extrude * scale * normal.y * mat2(t, -u, u, t); + + vec4 projected_extrude = u_matrix * vec4(dist / u_ratio, 0.0, 0.0); + gl_Position = u_matrix * vec4(pos + offset2 / u_ratio, 0.0, 1.0) + projected_extrude; + + // calculate how much the perspective view squishes or stretches the extrude + float extrude_length_without_perspective = length(dist); + float extrude_length_with_perspective = length(projected_extrude.xy / gl_Position.w * u_gl_units_to_pixels); + v_gamma_scale = extrude_length_without_perspective / extrude_length_with_perspective; + + v_tex_a = vec2(a_linesofar * u_patternscale_a.x / floorwidth, normal.y * u_patternscale_a.y + u_tex_y_a); + v_tex_b = vec2(a_linesofar * u_patternscale_b.x / floorwidth, normal.y * u_patternscale_b.y + u_tex_y_b); + + v_width2 = vec2(outset, inset); +} + +*/ + +// Uncompressed source of line_sdf.fragment.glsl: +/* + +uniform sampler2D u_image; +uniform float u_sdfgamma; +uniform float u_mix; + +varying vec2 v_normal; +varying vec2 v_width2; +varying vec2 v_tex_a; +varying vec2 v_tex_b; +varying float v_gamma_scale; + + +#ifndef HAS_UNIFORM_u_color +varying highp vec4 color; +#else +uniform highp vec4 u_color; +#endif + + +#ifndef HAS_UNIFORM_u_blur +varying lowp float blur; +#else +uniform lowp float u_blur; +#endif + + +#ifndef HAS_UNIFORM_u_opacity +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_width +varying mediump float width; +#else +uniform mediump float u_width; +#endif + + +#ifndef HAS_UNIFORM_u_floorwidth +varying lowp float floorwidth; +#else +uniform lowp float u_floorwidth; +#endif + + +void main() { + +#ifdef HAS_UNIFORM_u_color + highp vec4 color = u_color; +#endif + + +#ifdef HAS_UNIFORM_u_blur + lowp float blur = u_blur; +#endif + + +#ifdef HAS_UNIFORM_u_opacity + lowp float opacity = u_opacity; +#endif + + +#ifdef HAS_UNIFORM_u_width + mediump float width = u_width; +#endif + + +#ifdef HAS_UNIFORM_u_floorwidth + lowp float floorwidth = u_floorwidth; +#endif + + + // Calculate the distance of the pixel from the line in pixels. + float dist = length(v_normal) * v_width2.s; + + // Calculate the antialiasing fade factor. This is either when fading in + // the line in case of an offset line (v_width2.t) or when fading out + // (v_width2.s) + float blur2 = (blur + 1.0 / DEVICE_PIXEL_RATIO) * v_gamma_scale; + float alpha = clamp(min(dist - (v_width2.t - blur2), v_width2.s - dist) / blur2, 0.0, 1.0); + + float sdfdist_a = texture2D(u_image, v_tex_a).a; + float sdfdist_b = texture2D(u_image, v_tex_b).a; + float sdfdist = mix(sdfdist_a, sdfdist_b, u_mix); + alpha *= smoothstep(0.5 - u_sdfgamma / floorwidth, 0.5 + u_sdfgamma / floorwidth, sdfdist); + + gl_FragColor = color * (alpha * opacity); + +#ifdef OVERDRAW_INSPECTOR + gl_FragColor = vec4(1.0); +#endif +} + +*/ + diff --git a/src/mbgl/programs/gl/preludes.cpp b/src/mbgl/programs/gl/preludes.cpp new file mode 100644 index 0000000000..6c895c0d36 --- /dev/null +++ b/src/mbgl/programs/gl/preludes.cpp @@ -0,0 +1,15 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/gl/preludes.hpp> +#include <mbgl/programs/gl/shader_source.hpp> + +namespace mbgl { +namespace programs { +namespace gl { + +const char* vertexShaderPrelude = programs::gl::shaderSource() + 0; +const char* fragmentShaderPrelude = programs::gl::shaderSource() + 1252; + +} // namespace gl +} // namespace programs +} // namespace mbgl diff --git a/src/mbgl/programs/gl/preludes.hpp b/src/mbgl/programs/gl/preludes.hpp new file mode 100644 index 0000000000..6d86ee45c5 --- /dev/null +++ b/src/mbgl/programs/gl/preludes.hpp @@ -0,0 +1,14 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#pragma once + +namespace mbgl { +namespace programs { +namespace gl { + +extern const char* vertexShaderPrelude; +extern const char* fragmentShaderPrelude; + +} // namespace gl +} // namespace programs +} // namespace mbgl diff --git a/src/mbgl/programs/gl/raster.cpp b/src/mbgl/programs/gl/raster.cpp new file mode 100644 index 0000000000..512dc81a30 --- /dev/null +++ b/src/mbgl/programs/gl/raster.cpp @@ -0,0 +1,103 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/raster_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<RasterProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<RasterProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "raster", + programs::gl::shaderSource() + 48592, programs::gl::shaderSource() + 48941); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of raster.vertex.glsl: +/* +uniform mat4 u_matrix; +uniform vec2 u_tl_parent; +uniform float u_scale_parent; +uniform float u_buffer_scale; + +attribute vec2 a_pos; +attribute vec2 a_texture_pos; + +varying vec2 v_pos0; +varying vec2 v_pos1; + +void main() { + gl_Position = u_matrix * vec4(a_pos, 0, 1); + // We are using Int16 for texture position coordinates to give us enough precision for + // fractional coordinates. We use 8192 to scale the texture coordinates in the buffer + // as an arbitrarily high number to preserve adequate precision when rendering. + // This is also the same value as the EXTENT we are using for our tile buffer pos coordinates, + // so math for modifying either is consistent. + v_pos0 = (((a_texture_pos / 8192.0) - 0.5) / u_buffer_scale ) + 0.5; + v_pos1 = (v_pos0 * u_scale_parent) + u_tl_parent; +} + +*/ + +// Uncompressed source of raster.fragment.glsl: +/* +uniform float u_fade_t; +uniform float u_opacity; +uniform sampler2D u_image0; +uniform sampler2D u_image1; +varying vec2 v_pos0; +varying vec2 v_pos1; + +uniform float u_brightness_low; +uniform float u_brightness_high; + +uniform float u_saturation_factor; +uniform float u_contrast_factor; +uniform vec3 u_spin_weights; + +void main() { + + // read and cross-fade colors from the main and parent tiles + vec4 color0 = texture2D(u_image0, v_pos0); + vec4 color1 = texture2D(u_image1, v_pos1); + if (color0.a > 0.0) { + color0.rgb = color0.rgb / color0.a; + } + if (color1.a > 0.0) { + color1.rgb = color1.rgb / color1.a; + } + vec4 color = mix(color0, color1, u_fade_t); + color.a *= u_opacity; + vec3 rgb = color.rgb; + + // spin + rgb = vec3( + dot(rgb, u_spin_weights.xyz), + dot(rgb, u_spin_weights.zxy), + dot(rgb, u_spin_weights.yzx)); + + // saturation + float average = (color.r + color.g + color.b) / 3.0; + rgb += (average - rgb) * u_saturation_factor; + + // contrast + rgb = (rgb - 0.5) * u_contrast_factor + 0.5; + + // brightness + vec3 u_high_vec = vec3(u_brightness_low, u_brightness_low, u_brightness_low); + vec3 u_low_vec = vec3(u_brightness_high, u_brightness_high, u_brightness_high); + + gl_FragColor = vec4(mix(u_high_vec, u_low_vec, rgb) * color.a, color.a); + +#ifdef OVERDRAW_INSPECTOR + gl_FragColor = vec4(1.0); +#endif +} + +*/ + diff --git a/src/mbgl/programs/gl/shader_source.cpp b/src/mbgl/programs/gl/shader_source.cpp new file mode 100644 index 0000000000..4a986403f7 --- /dev/null +++ b/src/mbgl/programs/gl/shader_source.cpp @@ -0,0 +1,471 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/util/compression.hpp> + +#include <cstdint> + +namespace mbgl { +namespace programs { +namespace gl { + +constexpr const uint8_t compressedShaderSource[] = { + 0x78, 0xda, 0xed, 0x3d, 0xfd, 0x6f, 0xe3, 0x36, 0xb2, 0xf7, 0x73, 0xfe, 0x0a, 0x17, 0x05, 0x0e, + 0x92, 0x2c, 0x5b, 0xb6, 0x93, 0xec, 0x97, 0x4e, 0xaf, 0x08, 0x76, 0xb3, 0x7d, 0x01, 0xda, 0x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d1, 0xfd, 0xfd, 0xcb, 0xd9, 0xe7, 0xaf, 0xdf, 0x7e, 0xed, 0x52, 0xd9, 0x7f, 0xc0, 0x6a, 0x80, + 0xc5, 0x91, 0x56, 0x10, 0x93, 0xac, 0x6e, 0x2e, 0xa1, 0x23, 0x04, 0xe0, 0xe1, 0xa0, 0xd9, 0x9c, + 0x7b, 0xa5, 0x2c, 0x92, 0x41, 0x57, 0x62, 0x95, 0x76, 0x65, 0xa9, 0x92, 0x16, 0x56, 0x03, 0x61, + 0xf3, 0x18, 0xad, 0xbe, 0x0b, 0x33, 0x65, 0x24, 0x4f, 0x21, 0x8d, 0xa9, 0x01, 0xb4, 0xc5, 0x04, + 0x82, 0x53, 0xa7, 0x28, 0x09, 0x35, 0x9a, 0xa9, 0x51, 0xa8, 0xc2, 0x30, 0x02, 0xd6, 0x50, 0x99, + 0x8c, 0xaf, 0x2c, 0xbd, 0x07, 0x39, 0x0a, 0x85, 0x38, 0x97, 0x92, 0x07, 0x99, 0x9c, 0x38, 0xa9, + 0x18, 0x4e, 0xd7, 0xe8, 0x92, 0xb2, 0x49, 0x7d, 0x6b, 0x48, 0xa2, 0x1c, 0x6e, 0xa6, 0x8a, 0x66, + 0x5a, 0x09, 0xe3, 0xea, 0x42, 0x91, 0x36, 0x31, 0x73, 0xec, 0xe4, 0x49, 0x30, 0x25, 0x14, 0x2e, + 0xf2, 0x79, 0xf6, 0xef, 0xb4, 0x8c, 0xf5, 0x64, 0x08, 0x3b, 0x07, 0xca, 0x50, 0x26, 0x46, 0x54, + 0xf2, 0xcb, 0xf8, 0x51, 0x07, 0x5c, 0x4f, 0xfb, 0xcd, 0xa8, 0x9f, 0x0f, 0x4b, 0x69, 0xc7, 0x10, + 0x65, 0x2c, 0x2a, 0xc3, 0x59, 0x18, 0x55, 0x01, 0x59, 0xc3, 0xae, 0x3a, 0xec, 0xfa, 0x36, 0x94, + 0x32, 0x8a, 0x0a, 0x63, 0xe5, 0x17, 0x15, 0xcc, 0xc4,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, 0x25, 0x59, 0x36, 0x06, 0x21, 0xb3, 0x20, + 0x1b, 0x6d, 0x10, 0xe8, 0xb1, 0x8b, 0x89, 0x8d, 0x25, 0x49, 0xaf, 0x01, 0x5d, 0xa6, 0x31, 0x96, + 0xa5, 0x05, 0x38, 0xf5, 0x05, 0x3e, 0x0c, 0x5b, 0x96, 0x69, 0xc9, 0xea, 0xc5, 0x13, 0xc4, 0x83, + 0x60, 0xc8, 0x41, 0xd0, 0x35, 0x24, 0x99, 0xd9, 0x3b, 0x08, 0x16, 0xf8, 0xd9, 0x28, 0xef, 0x0d, + 0x75, 0x5a, 0xe7, 0x59, 0x1e, 0xe7, 0x69, 0x77, 0xb1, 0x9a, 0x24, 0xd9, 0xd8, 0x52, 0x90, 0x84, + 0x98, 0xd3, 0x76, 0x93, 0x14, 0x21, 0xde, 0x1b, 0xe2, 0x08, 0x8c, 0x2f, 0x60, 0xf7, 0x60, 0xcd, + 0x06, 0x1a, 0x49, 0x1d, 0xc7, 0x49, 0x8a, 0x16, 0xae, 0x71, 0x3c, 0x4d, 0x2d, 0x10, 0x03, 0xf6, + 0x7a, 0x83, 0x96, 0x2d, 0x38, 0x00, 0x44, 0xb0, 0x9e, 0x8c, 0x47, 0x80, 0x98, 0xcb, 0x93, 0x78, + 0x16, 0x5a, 0x8e, 0x5c, 0x15, 0x4d, 0xbb, 0x82, 0x61, 0xa7, 0xb0, 0xe8, 0x33, 0x79, 0x79, 0x5c, + 0xe8, 0x31, 0x91, 0x3c, 0x2b, 0xf9, 0x49, 0x13, 0xe6, 0x1d, 0x55, 0x73, 0xd9, 0x39, 0x15, 0xac, + 0x79, 0x08, 0x0f, 0x20, 0x4b, 0x84, 0x0e, 0x61, 0xa9, 0x08, 0x54, 0xe6, 0xcb, 0x45, 0x3a, 0x98, + 0x40, 0xb0, 0x41, 0xc4, 0x79, 0xe3, 0x34, 0x6a, 0x68, 0xf3, 0xfa, 0xaf, 0xce, 0x77, 0xa6, 0xa8, + 0x42, 0x9f, 0xc2, 0x02, 0xf6, 0x83, 0x65, 0xfa, 0xc2, 0x3b, 0x23, 0x3f, 0xd8, 0x67, 0x2d, 0xea, + 0x54, 0x4c, 0x05, 0x88, 0x41, 0x42, 0xd0, 0x5f, 0xad, 0xef, 0x3e, 0xfd, 0xd5, 0xfe, 0xee, 0xb3, + 0x09, 0xec, 0x06, 0x38, 0x6e, 0x71, 0x78, 0x57, 0x83, 0x3e, 0xab, 0x41, 0x8d, 0xf7, 0xab, 0x90, + 0x57, 0x56, 0x44, 0x5c, 0xd6, 0x94, 0xf5, 0x88, 0xa9, 0x54, 0xa1, 0xf8, 0xd4, 0x34, 0xd5, 0x57, + 0x76, 0x9e, 0x8d, 0xa6, 0xf9, 0xba, 0x10, 0xda, 0x34, 0x12, 0x32, 0x97, 0x46, 0x48, 0x04, 0x0d, + 0x33, 0x21, 0x8d, 0x22, 0x15, 0x5b, 0x53, 0x1d, 0x45, 0x06, 0x45, 0xa4, 0x4b, 0xa4, 0xcf, 0x91, + 0xda, 0x4f, 0x07, 0x56, 0xc4, 0x41, 0x89, 0x08, 0xac, 0x7d, 0x38, 0x28, 0xc9, 0x0d, 0xac, 0x38, + 0x15, 0xda, 0x24, 0x97, 0x16, 0x25, 0x8f, 0x98, 0x65, 0x60, 0xa7, 0x80, 0x0b, 0x53, 0xa5, 0x1d, + 0x9b, 0x5e, 0xe0, 0x59, 0x0e, 0xa1, 0x27, 0xbd, 0xa8, 0x50, 0x9a, 0x9d, 0x8b, 0x42, 0x8a, 0x00, + 0x3b, 0xff, 0x44, 0xe5, 0x44, 0xed, 0x27, 0xcc, 0xa5, 0x41, 0xe7, 0x08, 0x7b, 0x59, 0xf1, 0x48, + 0x28, 0xac, 0x8e, 0xa5, 0x33, 0x91, 0xd5, 0xa0, 0xc9, 0xa3, 0x9a, 0x42, 0xc2, 0x5f, 0x8a, 0xf8, + 0x66, 0xba, 0x22, 0x99, 0x5a, 0xe7, 0x6b, 0x07, 0x91, 0xc4, 0x5e, 0x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b8, 0xd8, 0x21, 0xa4, 0xae, 0x7e, 0x84, 0x3f, 0x3c, 0x79, 0x82, 0x2a, 0x6a, 0x0e, 0xf6, 0x55, + 0x4b, 0x87, 0x08, 0x81, 0xb4, 0x86, 0x8c, 0xc0, 0x87, 0x94, 0xba, 0x92, 0x52, 0xf1, 0xc4, 0xa0, + 0xa7, 0xae, 0x64, 0xf7, 0xf2, 0x65, 0xff, 0x1f, 0x03, 0x90, 0xfe, 0x1c +}; + +const char* shaderSource() { + static std::string decompressed = util::decompress(std::string(reinterpret_cast<const char*>(compressedShaderSource), sizeof(compressedShaderSource))); + return decompressed.c_str(); +}; + +} // namespace gl +} // namespace programs +} // namespace mbgl diff --git a/src/mbgl/programs/gl/shader_source.hpp b/src/mbgl/programs/gl/shader_source.hpp new file mode 100644 index 0000000000..f6de8a56cc --- /dev/null +++ b/src/mbgl/programs/gl/shader_source.hpp @@ -0,0 +1,13 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#pragma once + +namespace mbgl { +namespace programs { +namespace gl { + +const char* shaderSource(); + +} // namespace gl +} // namespace programs +} // namespace mbgl diff --git a/src/mbgl/programs/gl/shaders.cpp b/src/mbgl/programs/gl/shaders.cpp new file mode 100644 index 0000000000..3cc33992de --- /dev/null +++ b/src/mbgl/programs/gl/shaders.cpp @@ -0,0 +1,31 @@ +#include <mbgl/programs/gl/shaders.hpp> +#include <mbgl/programs/gl/preludes.hpp> +#include <mbgl/programs/program_parameters.hpp> +#include <mbgl/util/string.hpp> + +#include <cassert> + +namespace mbgl { +namespace programs { +namespace gl { + +std::string fragmentSource(const ProgramParameters& parameters, const char* fragmentSource) { + return parameters.getDefines() + fragmentShaderPrelude + fragmentSource; +} + +std::string vertexSource(const ProgramParameters& parameters, const char* vertexSource) { + return parameters.getDefines() + vertexShaderPrelude + vertexSource; +} + +std::string programIdentifier(const std::string& vertexSource, const std::string& fragmentSource) { + std::string result; + result.reserve((sizeof(size_t) * 2) * 2 + 2); // 2 size_t hex values + "v2" + result += util::toHex(std::hash<std::string>()(vertexSource)); + result += util::toHex(std::hash<std::string>()(fragmentSource)); + result += "v3"; + return result; +} + +} // namespace gl +} // namespace programs +} // namespace mbgl diff --git a/src/mbgl/programs/gl/shaders.hpp b/src/mbgl/programs/gl/shaders.hpp new file mode 100644 index 0000000000..5278ea54da --- /dev/null +++ b/src/mbgl/programs/gl/shaders.hpp @@ -0,0 +1,18 @@ +#pragma once + +#include <string> + +namespace mbgl { + +class ProgramParameters; + +namespace programs { +namespace gl { + +std::string fragmentSource(const ProgramParameters&, const char* fragmentSource); +std::string vertexSource(const ProgramParameters&, const char* vertexSource); +std::string programIdentifier(const std::string& vertexSource, const std::string& fragmentSource); + +} // namespace gl +} // namespace programs +} // namespace mbgl diff --git a/src/mbgl/programs/gl/symbol_icon.cpp b/src/mbgl/programs/gl/symbol_icon.cpp new file mode 100644 index 0000000000..733d3b7ebd --- /dev/null +++ b/src/mbgl/programs/gl/symbol_icon.cpp @@ -0,0 +1,162 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/symbol_icon_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<SymbolIconProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<SymbolIconProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "symbol_icon", + programs::gl::shaderSource() + 50000, programs::gl::shaderSource() + 52654); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of symbol_icon.vertex.glsl: +/* +const float PI = 3.141592653589793; + +attribute vec4 a_pos_offset; +attribute vec4 a_data; +attribute vec3 a_projected_pos; +attribute float a_fade_opacity; + +uniform bool u_is_size_zoom_constant; +uniform bool u_is_size_feature_constant; +uniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function +uniform highp float u_size; // used when size is both zoom and feature constant +uniform highp float u_camera_to_center_distance; +uniform highp float u_pitch; +uniform bool u_rotate_symbol; +uniform highp float u_aspect_ratio; +uniform float u_fade_change; + + +#ifndef HAS_UNIFORM_u_opacity +uniform lowp float a_opacity_t; +attribute lowp vec2 a_opacity; +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +uniform mat4 u_matrix; +uniform mat4 u_label_plane_matrix; +uniform mat4 u_gl_coord_matrix; + +uniform bool u_is_text; +uniform bool u_pitch_with_map; + +uniform vec2 u_texsize; + +varying vec2 v_tex; +varying float v_fade_opacity; + +void main() { + +#ifndef HAS_UNIFORM_u_opacity + opacity = unpack_mix_vec2(a_opacity, a_opacity_t); +#else + lowp float opacity = u_opacity; +#endif + + + vec2 a_pos = a_pos_offset.xy; + vec2 a_offset = a_pos_offset.zw; + + vec2 a_tex = a_data.xy; + vec2 a_size = a_data.zw; + + highp float segment_angle = -a_projected_pos[2]; + + float size; + if (!u_is_size_zoom_constant && !u_is_size_feature_constant) { + size = mix(a_size[0], a_size[1], u_size_t) / 256.0; + } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) { + size = a_size[0] / 256.0; + } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) { + size = u_size; + } else { + size = u_size; + } + + vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1); + highp float camera_to_anchor_distance = projectedPoint.w; + // See comments in symbol_sdf.vertex + highp float distance_ratio = u_pitch_with_map ? + camera_to_anchor_distance / u_camera_to_center_distance : + u_camera_to_center_distance / camera_to_anchor_distance; + highp float perspective_ratio = clamp( + 0.5 + 0.5 * distance_ratio, + 0.0, // Prevents oversized near-field symbols in pitched/overzoomed tiles + 4.0); + + size *= perspective_ratio; + + float fontScale = u_is_text ? size / 24.0 : size; + + highp float symbol_rotation = 0.0; + if (u_rotate_symbol) { + // See comments in symbol_sdf.vertex + vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1); + + vec2 a = projectedPoint.xy / projectedPoint.w; + vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w; + + symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x); + } + + highp float angle_sin = sin(segment_angle + symbol_rotation); + highp float angle_cos = cos(segment_angle + symbol_rotation); + mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos); + + vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0); + gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * fontScale), 0.0, 1.0); + + v_tex = a_tex / u_texsize; + vec2 fade_opacity = unpack_opacity(a_fade_opacity); + float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change; + v_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change)); +} + +*/ + +// Uncompressed source of symbol_icon.fragment.glsl: +/* +uniform sampler2D u_texture; + + +#ifndef HAS_UNIFORM_u_opacity +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +varying vec2 v_tex; +varying float v_fade_opacity; + +void main() { + +#ifdef HAS_UNIFORM_u_opacity + lowp float opacity = u_opacity; +#endif + + + lowp float alpha = opacity * v_fade_opacity; + gl_FragColor = texture2D(u_texture, v_tex) * alpha; + +#ifdef OVERDRAW_INSPECTOR + gl_FragColor = vec4(1.0); +#endif +} + +*/ + diff --git a/src/mbgl/programs/gl/symbol_sdf_icon.cpp b/src/mbgl/programs/gl/symbol_sdf_icon.cpp new file mode 100644 index 0000000000..ef3ecd138c --- /dev/null +++ b/src/mbgl/programs/gl/symbol_sdf_icon.cpp @@ -0,0 +1,317 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/symbol_sdf_icon_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<SymbolSDFIconProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<SymbolSDFIconProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "symbol_sdf_icon", + programs::gl::shaderSource() + 53059, programs::gl::shaderSource() + 57099); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of symbol_sdf_icon.vertex.glsl: +/* +const float PI = 3.141592653589793; + +attribute vec4 a_pos_offset; +attribute vec4 a_data; +attribute vec3 a_projected_pos; +attribute float a_fade_opacity; + +// contents of a_size vary based on the type of property value +// used for {text,icon}-size. +// For constants, a_size is disabled. +// For source functions, we bind only one value per vertex: the value of {text,icon}-size evaluated for the current feature. +// For composite functions: +// [ text-size(lowerZoomStop, feature), +// text-size(upperZoomStop, feature) ] +uniform bool u_is_size_zoom_constant; +uniform bool u_is_size_feature_constant; +uniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function +uniform highp float u_size; // used when size is both zoom and feature constant + + +#ifndef HAS_UNIFORM_u_fill_color +uniform lowp float a_fill_color_t; +attribute highp vec4 a_fill_color; +varying highp vec4 fill_color; +#else +uniform highp vec4 u_fill_color; +#endif + + +#ifndef HAS_UNIFORM_u_halo_color +uniform lowp float a_halo_color_t; +attribute highp vec4 a_halo_color; +varying highp vec4 halo_color; +#else +uniform highp vec4 u_halo_color; +#endif + + +#ifndef HAS_UNIFORM_u_opacity +uniform lowp float a_opacity_t; +attribute lowp vec2 a_opacity; +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_halo_width +uniform lowp float a_halo_width_t; +attribute lowp vec2 a_halo_width; +varying lowp float halo_width; +#else +uniform lowp float u_halo_width; +#endif + + +#ifndef HAS_UNIFORM_u_halo_blur +uniform lowp float a_halo_blur_t; +attribute lowp vec2 a_halo_blur; +varying lowp float halo_blur; +#else +uniform lowp float u_halo_blur; +#endif + + +uniform mat4 u_matrix; +uniform mat4 u_label_plane_matrix; +uniform mat4 u_gl_coord_matrix; + +uniform bool u_is_text; +uniform bool u_pitch_with_map; +uniform highp float u_pitch; +uniform bool u_rotate_symbol; +uniform highp float u_aspect_ratio; +uniform highp float u_camera_to_center_distance; +uniform float u_fade_change; + +uniform vec2 u_texsize; + +varying vec2 v_data0; +varying vec3 v_data1; + +void main() { + +#ifndef HAS_UNIFORM_u_fill_color + fill_color = unpack_mix_color(a_fill_color, a_fill_color_t); +#else + highp vec4 fill_color = u_fill_color; +#endif + + +#ifndef HAS_UNIFORM_u_halo_color + halo_color = unpack_mix_color(a_halo_color, a_halo_color_t); +#else + highp vec4 halo_color = u_halo_color; +#endif + + +#ifndef HAS_UNIFORM_u_opacity + opacity = unpack_mix_vec2(a_opacity, a_opacity_t); +#else + lowp float opacity = u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_halo_width + halo_width = unpack_mix_vec2(a_halo_width, a_halo_width_t); +#else + lowp float halo_width = u_halo_width; +#endif + + +#ifndef HAS_UNIFORM_u_halo_blur + halo_blur = unpack_mix_vec2(a_halo_blur, a_halo_blur_t); +#else + lowp float halo_blur = u_halo_blur; +#endif + + + vec2 a_pos = a_pos_offset.xy; + vec2 a_offset = a_pos_offset.zw; + + vec2 a_tex = a_data.xy; + vec2 a_size = a_data.zw; + + highp float segment_angle = -a_projected_pos[2]; + float size; + + if (!u_is_size_zoom_constant && !u_is_size_feature_constant) { + size = mix(a_size[0], a_size[1], u_size_t) / 256.0; + } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) { + size = a_size[0] / 256.0; + } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) { + size = u_size; + } else { + size = u_size; + } + + vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1); + highp float camera_to_anchor_distance = projectedPoint.w; + // If the label is pitched with the map, layout is done in pitched space, + // which makes labels in the distance smaller relative to viewport space. + // We counteract part of that effect by multiplying by the perspective ratio. + // If the label isn't pitched with the map, we do layout in viewport space, + // which makes labels in the distance larger relative to the features around + // them. We counteract part of that effect by dividing by the perspective ratio. + highp float distance_ratio = u_pitch_with_map ? + camera_to_anchor_distance / u_camera_to_center_distance : + u_camera_to_center_distance / camera_to_anchor_distance; + highp float perspective_ratio = clamp( + 0.5 + 0.5 * distance_ratio, + 0.0, // Prevents oversized near-field symbols in pitched/overzoomed tiles + 4.0); + + size *= perspective_ratio; + + float fontScale = u_is_text ? size / 24.0 : size; + + highp float symbol_rotation = 0.0; + if (u_rotate_symbol) { + // Point labels with 'rotation-alignment: map' are horizontal with respect to tile units + // To figure out that angle in projected space, we draw a short horizontal line in tile + // space, project it, and measure its angle in projected space. + vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1); + + vec2 a = projectedPoint.xy / projectedPoint.w; + vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w; + + symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x); + } + + highp float angle_sin = sin(segment_angle + symbol_rotation); + highp float angle_cos = cos(segment_angle + symbol_rotation); + mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos); + + vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0); + gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * fontScale), 0.0, 1.0); + float gamma_scale = gl_Position.w; + + vec2 tex = a_tex / u_texsize; + vec2 fade_opacity = unpack_opacity(a_fade_opacity); + float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change; + float interpolated_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change)); + + v_data0 = vec2(tex.x, tex.y); + v_data1 = vec3(gamma_scale, size, interpolated_fade_opacity); +} + +*/ + +// Uncompressed source of symbol_sdf_icon.fragment.glsl: +/* +#define SDF_PX 8.0 +#define EDGE_GAMMA 0.105/DEVICE_PIXEL_RATIO + +uniform bool u_is_halo; + +#ifndef HAS_UNIFORM_u_fill_color +varying highp vec4 fill_color; +#else +uniform highp vec4 u_fill_color; +#endif + + +#ifndef HAS_UNIFORM_u_halo_color +varying highp vec4 halo_color; +#else +uniform highp vec4 u_halo_color; +#endif + + +#ifndef HAS_UNIFORM_u_opacity +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_halo_width +varying lowp float halo_width; +#else +uniform lowp float u_halo_width; +#endif + + +#ifndef HAS_UNIFORM_u_halo_blur +varying lowp float halo_blur; +#else +uniform lowp float u_halo_blur; +#endif + + +uniform sampler2D u_texture; +uniform highp float u_gamma_scale; +uniform bool u_is_text; + +varying vec2 v_data0; +varying vec3 v_data1; + +void main() { + +#ifdef HAS_UNIFORM_u_fill_color + highp vec4 fill_color = u_fill_color; +#endif + + +#ifdef HAS_UNIFORM_u_halo_color + highp vec4 halo_color = u_halo_color; +#endif + + +#ifdef HAS_UNIFORM_u_opacity + lowp float opacity = u_opacity; +#endif + + +#ifdef HAS_UNIFORM_u_halo_width + lowp float halo_width = u_halo_width; +#endif + + +#ifdef HAS_UNIFORM_u_halo_blur + lowp float halo_blur = u_halo_blur; +#endif + + + vec2 tex = v_data0.xy; + float gamma_scale = v_data1.x; + float size = v_data1.y; + float fade_opacity = v_data1[2]; + + float fontScale = u_is_text ? size / 24.0 : size; + + lowp vec4 color = fill_color; + highp float gamma = EDGE_GAMMA / (fontScale * u_gamma_scale); + lowp float buff = (256.0 - 64.0) / 256.0; + if (u_is_halo) { + color = halo_color; + gamma = (halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * u_gamma_scale); + buff = (6.0 - halo_width / fontScale) / SDF_PX; + } + + lowp float dist = texture2D(u_texture, tex).a; + highp float gamma_scaled = gamma * gamma_scale; + highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist); + + gl_FragColor = color * (alpha * opacity * fade_opacity); + +#ifdef OVERDRAW_INSPECTOR + gl_FragColor = vec4(1.0); +#endif +} + +*/ + diff --git a/src/mbgl/programs/gl/symbol_sdf_text.cpp b/src/mbgl/programs/gl/symbol_sdf_text.cpp new file mode 100644 index 0000000000..a0d810d1ce --- /dev/null +++ b/src/mbgl/programs/gl/symbol_sdf_text.cpp @@ -0,0 +1,317 @@ +// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. + +#include <mbgl/programs/symbol_sdf_text_program.hpp> +#include <mbgl/programs/gl/shader_source.hpp> +#include <mbgl/gl/program.hpp> + +namespace mbgl { +namespace gfx { + +template <> +std::unique_ptr<Program<SymbolSDFTextProgram>> +Context::createProgram<gl::Context>(const ProgramParameters& programParameters) { + return gl::Program<SymbolSDFTextProgram>::createProgram( + reinterpret_cast<gl::Context&>(*this), programParameters, "symbol_sdf_text", + programs::gl::shaderSource() + 53059, programs::gl::shaderSource() + 57099); +} + +} // namespace gfx +} // namespace mbgl + +// Uncompressed source of symbol_sdf_text.vertex.glsl: +/* +const float PI = 3.141592653589793; + +attribute vec4 a_pos_offset; +attribute vec4 a_data; +attribute vec3 a_projected_pos; +attribute float a_fade_opacity; + +// contents of a_size vary based on the type of property value +// used for {text,icon}-size. +// For constants, a_size is disabled. +// For source functions, we bind only one value per vertex: the value of {text,icon}-size evaluated for the current feature. +// For composite functions: +// [ text-size(lowerZoomStop, feature), +// text-size(upperZoomStop, feature) ] +uniform bool u_is_size_zoom_constant; +uniform bool u_is_size_feature_constant; +uniform highp float u_size_t; // used to interpolate between zoom stops when size is a composite function +uniform highp float u_size; // used when size is both zoom and feature constant + + +#ifndef HAS_UNIFORM_u_fill_color +uniform lowp float a_fill_color_t; +attribute highp vec4 a_fill_color; +varying highp vec4 fill_color; +#else +uniform highp vec4 u_fill_color; +#endif + + +#ifndef HAS_UNIFORM_u_halo_color +uniform lowp float a_halo_color_t; +attribute highp vec4 a_halo_color; +varying highp vec4 halo_color; +#else +uniform highp vec4 u_halo_color; +#endif + + +#ifndef HAS_UNIFORM_u_opacity +uniform lowp float a_opacity_t; +attribute lowp vec2 a_opacity; +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_halo_width +uniform lowp float a_halo_width_t; +attribute lowp vec2 a_halo_width; +varying lowp float halo_width; +#else +uniform lowp float u_halo_width; +#endif + + +#ifndef HAS_UNIFORM_u_halo_blur +uniform lowp float a_halo_blur_t; +attribute lowp vec2 a_halo_blur; +varying lowp float halo_blur; +#else +uniform lowp float u_halo_blur; +#endif + + +uniform mat4 u_matrix; +uniform mat4 u_label_plane_matrix; +uniform mat4 u_gl_coord_matrix; + +uniform bool u_is_text; +uniform bool u_pitch_with_map; +uniform highp float u_pitch; +uniform bool u_rotate_symbol; +uniform highp float u_aspect_ratio; +uniform highp float u_camera_to_center_distance; +uniform float u_fade_change; + +uniform vec2 u_texsize; + +varying vec2 v_data0; +varying vec3 v_data1; + +void main() { + +#ifndef HAS_UNIFORM_u_fill_color + fill_color = unpack_mix_color(a_fill_color, a_fill_color_t); +#else + highp vec4 fill_color = u_fill_color; +#endif + + +#ifndef HAS_UNIFORM_u_halo_color + halo_color = unpack_mix_color(a_halo_color, a_halo_color_t); +#else + highp vec4 halo_color = u_halo_color; +#endif + + +#ifndef HAS_UNIFORM_u_opacity + opacity = unpack_mix_vec2(a_opacity, a_opacity_t); +#else + lowp float opacity = u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_halo_width + halo_width = unpack_mix_vec2(a_halo_width, a_halo_width_t); +#else + lowp float halo_width = u_halo_width; +#endif + + +#ifndef HAS_UNIFORM_u_halo_blur + halo_blur = unpack_mix_vec2(a_halo_blur, a_halo_blur_t); +#else + lowp float halo_blur = u_halo_blur; +#endif + + + vec2 a_pos = a_pos_offset.xy; + vec2 a_offset = a_pos_offset.zw; + + vec2 a_tex = a_data.xy; + vec2 a_size = a_data.zw; + + highp float segment_angle = -a_projected_pos[2]; + float size; + + if (!u_is_size_zoom_constant && !u_is_size_feature_constant) { + size = mix(a_size[0], a_size[1], u_size_t) / 256.0; + } else if (u_is_size_zoom_constant && !u_is_size_feature_constant) { + size = a_size[0] / 256.0; + } else if (!u_is_size_zoom_constant && u_is_size_feature_constant) { + size = u_size; + } else { + size = u_size; + } + + vec4 projectedPoint = u_matrix * vec4(a_pos, 0, 1); + highp float camera_to_anchor_distance = projectedPoint.w; + // If the label is pitched with the map, layout is done in pitched space, + // which makes labels in the distance smaller relative to viewport space. + // We counteract part of that effect by multiplying by the perspective ratio. + // If the label isn't pitched with the map, we do layout in viewport space, + // which makes labels in the distance larger relative to the features around + // them. We counteract part of that effect by dividing by the perspective ratio. + highp float distance_ratio = u_pitch_with_map ? + camera_to_anchor_distance / u_camera_to_center_distance : + u_camera_to_center_distance / camera_to_anchor_distance; + highp float perspective_ratio = clamp( + 0.5 + 0.5 * distance_ratio, + 0.0, // Prevents oversized near-field symbols in pitched/overzoomed tiles + 4.0); + + size *= perspective_ratio; + + float fontScale = u_is_text ? size / 24.0 : size; + + highp float symbol_rotation = 0.0; + if (u_rotate_symbol) { + // Point labels with 'rotation-alignment: map' are horizontal with respect to tile units + // To figure out that angle in projected space, we draw a short horizontal line in tile + // space, project it, and measure its angle in projected space. + vec4 offsetProjectedPoint = u_matrix * vec4(a_pos + vec2(1, 0), 0, 1); + + vec2 a = projectedPoint.xy / projectedPoint.w; + vec2 b = offsetProjectedPoint.xy / offsetProjectedPoint.w; + + symbol_rotation = atan((b.y - a.y) / u_aspect_ratio, b.x - a.x); + } + + highp float angle_sin = sin(segment_angle + symbol_rotation); + highp float angle_cos = cos(segment_angle + symbol_rotation); + mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos); + + vec4 projected_pos = u_label_plane_matrix * vec4(a_projected_pos.xy, 0.0, 1.0); + gl_Position = u_gl_coord_matrix * vec4(projected_pos.xy / projected_pos.w + rotation_matrix * (a_offset / 32.0 * fontScale), 0.0, 1.0); + float gamma_scale = gl_Position.w; + + vec2 tex = a_tex / u_texsize; + vec2 fade_opacity = unpack_opacity(a_fade_opacity); + float fade_change = fade_opacity[1] > 0.5 ? u_fade_change : -u_fade_change; + float interpolated_fade_opacity = max(0.0, min(1.0, fade_opacity[0] + fade_change)); + + v_data0 = vec2(tex.x, tex.y); + v_data1 = vec3(gamma_scale, size, interpolated_fade_opacity); +} + +*/ + +// Uncompressed source of symbol_sdf_text.fragment.glsl: +/* +#define SDF_PX 8.0 +#define EDGE_GAMMA 0.105/DEVICE_PIXEL_RATIO + +uniform bool u_is_halo; + +#ifndef HAS_UNIFORM_u_fill_color +varying highp vec4 fill_color; +#else +uniform highp vec4 u_fill_color; +#endif + + +#ifndef HAS_UNIFORM_u_halo_color +varying highp vec4 halo_color; +#else +uniform highp vec4 u_halo_color; +#endif + + +#ifndef HAS_UNIFORM_u_opacity +varying lowp float opacity; +#else +uniform lowp float u_opacity; +#endif + + +#ifndef HAS_UNIFORM_u_halo_width +varying lowp float halo_width; +#else +uniform lowp float u_halo_width; +#endif + + +#ifndef HAS_UNIFORM_u_halo_blur +varying lowp float halo_blur; +#else +uniform lowp float u_halo_blur; +#endif + + +uniform sampler2D u_texture; +uniform highp float u_gamma_scale; +uniform bool u_is_text; + +varying vec2 v_data0; +varying vec3 v_data1; + +void main() { + +#ifdef HAS_UNIFORM_u_fill_color + highp vec4 fill_color = u_fill_color; +#endif + + +#ifdef HAS_UNIFORM_u_halo_color + highp vec4 halo_color = u_halo_color; +#endif + + +#ifdef HAS_UNIFORM_u_opacity + lowp float opacity = u_opacity; +#endif + + +#ifdef HAS_UNIFORM_u_halo_width + lowp float halo_width = u_halo_width; +#endif + + +#ifdef HAS_UNIFORM_u_halo_blur + lowp float halo_blur = u_halo_blur; +#endif + + + vec2 tex = v_data0.xy; + float gamma_scale = v_data1.x; + float size = v_data1.y; + float fade_opacity = v_data1[2]; + + float fontScale = u_is_text ? size / 24.0 : size; + + lowp vec4 color = fill_color; + highp float gamma = EDGE_GAMMA / (fontScale * u_gamma_scale); + lowp float buff = (256.0 - 64.0) / 256.0; + if (u_is_halo) { + color = halo_color; + gamma = (halo_blur * 1.19 / SDF_PX + EDGE_GAMMA) / (fontScale * u_gamma_scale); + buff = (6.0 - halo_width / fontScale) / SDF_PX; + } + + lowp float dist = texture2D(u_texture, tex).a; + highp float gamma_scaled = gamma * gamma_scale; + highp float alpha = smoothstep(buff - gamma_scaled, buff + gamma_scaled, dist); + + gl_FragColor = color * (alpha * opacity * fade_opacity); + +#ifdef OVERDRAW_INSPECTOR + gl_FragColor = vec4(1.0); +#endif +} + +*/ + diff --git a/src/mbgl/programs/heatmap_program.cpp b/src/mbgl/programs/heatmap_program.cpp index 67f84fbd52..32c30ea313 100644 --- a/src/mbgl/programs/heatmap_program.cpp +++ b/src/mbgl/programs/heatmap_program.cpp @@ -1,7 +1,10 @@ #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_program.hpp b/src/mbgl/programs/heatmap_program.hpp index a90e9d4053..9563dd8d1b 100644 --- a/src/mbgl/programs/heatmap_program.hpp +++ b/src/mbgl/programs/heatmap_program.hpp @@ -4,7 +4,6 @@ #include <mbgl/programs/attributes.hpp> #include <mbgl/programs/heatmap_texture_program.hpp> #include <mbgl/programs/uniforms.hpp> -#include <mbgl/shaders/heatmap.hpp> #include <mbgl/util/geometry.hpp> #include <mbgl/style/layers/heatmap_layer_properties.hpp> @@ -15,8 +14,8 @@ MBGL_DEFINE_UNIFORM_SCALAR(float, u_intensity); } // namespace uniforms class HeatmapProgram : public Program< - shaders::heatmap, - gfx::Triangle, + HeatmapProgram, + gfx::PrimitiveType::Triangle, TypeList< attributes::a_pos>, TypeList< @@ -46,11 +45,11 @@ public: }; using HeatmapLayoutVertex = HeatmapProgram::LayoutVertex; -using HeatmapAttributes = HeatmapProgram::Attributes; +using HeatmapAttributes = HeatmapProgram::AttributeList; class HeatmapLayerPrograms final : public LayerTypePrograms { public: - HeatmapLayerPrograms(gl::Context& context, const ProgramParameters& programParameters) + HeatmapLayerPrograms(gfx::Context& context, const ProgramParameters& programParameters) : heatmap(context, programParameters), heatmapTexture(context, programParameters) {} ProgramMap<HeatmapProgram> heatmap; diff --git a/src/mbgl/programs/heatmap_texture_program.cpp b/src/mbgl/programs/heatmap_texture_program.cpp index 3b0e24eab8..04c5ff56a7 100644 --- a/src/mbgl/programs/heatmap_texture_program.cpp +++ b/src/mbgl/programs/heatmap_texture_program.cpp @@ -1,7 +1,10 @@ #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/heatmap_texture_program.hpp b/src/mbgl/programs/heatmap_texture_program.hpp index a1d3835821..954e03f9b6 100644 --- a/src/mbgl/programs/heatmap_texture_program.hpp +++ b/src/mbgl/programs/heatmap_texture_program.hpp @@ -4,15 +4,14 @@ #include <mbgl/programs/attributes.hpp> #include <mbgl/programs/uniforms.hpp> #include <mbgl/programs/textures.hpp> -#include <mbgl/shaders/heatmap_texture.hpp> #include <mbgl/style/properties.hpp> #include <mbgl/util/geometry.hpp> namespace mbgl { class HeatmapTextureProgram : public Program< - shaders::heatmap_texture, - gfx::Triangle, + HeatmapTextureProgram, + gfx::PrimitiveType::Triangle, TypeList<attributes::a_pos>, TypeList< uniforms::u_matrix, @@ -36,6 +35,6 @@ public: }; using HeatmapTextureLayoutVertex = HeatmapTextureProgram::LayoutVertex; -using HeatmapTextureAttributes = HeatmapTextureProgram::Attributes; +using HeatmapTextureAttributes = HeatmapTextureProgram::AttributeList; } // namespace mbgl diff --git a/src/mbgl/programs/hillshade_prepare_program.cpp b/src/mbgl/programs/hillshade_prepare_program.cpp index 0c0446d3f5..5bbac9eaec 100644 --- a/src/mbgl/programs/hillshade_prepare_program.cpp +++ b/src/mbgl/programs/hillshade_prepare_program.cpp @@ -1,7 +1,10 @@ #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_prepare_program.hpp b/src/mbgl/programs/hillshade_prepare_program.hpp index b58525bbfd..0243cc1879 100644 --- a/src/mbgl/programs/hillshade_prepare_program.hpp +++ b/src/mbgl/programs/hillshade_prepare_program.hpp @@ -4,7 +4,6 @@ #include <mbgl/programs/attributes.hpp> #include <mbgl/programs/uniforms.hpp> #include <mbgl/programs/textures.hpp> -#include <mbgl/shaders/hillshade_prepare.hpp> #include <mbgl/util/geometry.hpp> namespace mbgl { @@ -15,8 +14,8 @@ MBGL_DEFINE_UNIFORM_SCALAR(float, u_maxzoom); } // namespace uniforms class HillshadePrepareProgram : public Program< - shaders::hillshade_prepare, - gfx::Triangle, + HillshadePrepareProgram, + gfx::PrimitiveType::Triangle, TypeList< attributes::a_pos, attributes::a_texture_pos>, @@ -46,6 +45,6 @@ public: }; using HillshadePrepareLayoutVertex = HillshadePrepareProgram::LayoutVertex; -using HillshadePrepareAttributes = HillshadePrepareProgram::Attributes; +using HillshadePrepareAttributes = HillshadePrepareProgram::AttributeList; } // namespace mbgl diff --git a/src/mbgl/programs/hillshade_program.cpp b/src/mbgl/programs/hillshade_program.cpp index f054ad4b74..31673afcd4 100644 --- a/src/mbgl/programs/hillshade_program.cpp +++ b/src/mbgl/programs/hillshade_program.cpp @@ -1,7 +1,10 @@ #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/hillshade_program.hpp b/src/mbgl/programs/hillshade_program.hpp index 2a67338c7c..68d67917df 100644 --- a/src/mbgl/programs/hillshade_program.hpp +++ b/src/mbgl/programs/hillshade_program.hpp @@ -5,7 +5,6 @@ #include <mbgl/programs/hillshade_prepare_program.hpp> #include <mbgl/programs/uniforms.hpp> #include <mbgl/programs/textures.hpp> -#include <mbgl/shaders/hillshade.hpp> #include <mbgl/util/geometry.hpp> #include <mbgl/style/layers/hillshade_layer_properties.hpp> @@ -20,8 +19,8 @@ MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_latrange); } // namespace uniforms class HillshadeProgram : public Program< - shaders::hillshade, - gfx::Triangle, + HillshadeProgram, + gfx::PrimitiveType::Triangle, TypeList< attributes::a_pos, attributes::a_texture_pos>, @@ -53,11 +52,11 @@ public: }; using HillshadeLayoutVertex = HillshadeProgram::LayoutVertex; -using HillshadeAttributes = HillshadeProgram::Attributes; +using HillshadeAttributes = HillshadeProgram::AttributeList; class HillshadeLayerPrograms final : public LayerTypePrograms { public: - HillshadeLayerPrograms(gl::Context& context, const ProgramParameters& programParameters) + HillshadeLayerPrograms(gfx::Context& context, const ProgramParameters& programParameters) : hillshade(context, programParameters), hillshadePrepare(context, programParameters) {} HillshadeProgram hillshade; diff --git a/src/mbgl/programs/line_gradient_program.hpp b/src/mbgl/programs/line_gradient_program.hpp new file mode 100644 index 0000000000..c98cd37e98 --- /dev/null +++ b/src/mbgl/programs/line_gradient_program.hpp @@ -0,0 +1,4 @@ +#pragma once + +// Alias +#include <mbgl/programs/line_program.hpp> diff --git a/src/mbgl/programs/line_pattern_program.hpp b/src/mbgl/programs/line_pattern_program.hpp new file mode 100644 index 0000000000..c98cd37e98 --- /dev/null +++ b/src/mbgl/programs/line_pattern_program.hpp @@ -0,0 +1,4 @@ +#pragma once + +// Alias +#include <mbgl/programs/line_program.hpp> diff --git a/src/mbgl/programs/line_program.cpp b/src/mbgl/programs/line_program.cpp index e5b4cc2ad5..74a1ba3162 100644 --- a/src/mbgl/programs/line_program.cpp +++ b/src/mbgl/programs/line_program.cpp @@ -1,4 +1,5 @@ #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> @@ -8,6 +9,11 @@ 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"); @@ -31,12 +37,12 @@ Values makeValues(const RenderLinePaintProperties::PossiblyEvaluated& properties }; } -LineProgram::UniformValues -LineProgram::uniformValues(const RenderLinePaintProperties::PossiblyEvaluated& properties, - const RenderTile& tile, - const TransformState& state, - const std::array<float, 2>& pixelsToGLUnits) { - return makeValues<LineProgram::UniformValues>( +LineProgram::LayoutUniformValues +LineProgram::layoutUniformValues(const RenderLinePaintProperties::PossiblyEvaluated& properties, + const RenderTile& tile, + const TransformState& state, + const std::array<float, 2>& pixelsToGLUnits) { + return makeValues<LineProgram::LayoutUniformValues>( properties, tile, state, @@ -44,16 +50,16 @@ LineProgram::uniformValues(const RenderLinePaintProperties::PossiblyEvaluated& p ); } -LineSDFProgram::UniformValues -LineSDFProgram::uniformValues(const RenderLinePaintProperties::PossiblyEvaluated& properties, - float pixelRatio, - const RenderTile& tile, - const TransformState& state, - const std::array<float, 2>& pixelsToGLUnits, - const LinePatternPos& posA, - const LinePatternPos& posB, - const CrossfadeParameters& crossfade, - float atlasWidth) { +LineSDFProgram::LayoutUniformValues +LineSDFProgram::layoutUniformValues(const RenderLinePaintProperties::PossiblyEvaluated& properties, + float pixelRatio, + const RenderTile& tile, + const TransformState& state, + const std::array<float, 2>& pixelsToGLUnits, + const LinePatternPos& posA, + const LinePatternPos& posB, + const CrossfadeParameters& crossfade, + float atlasWidth) { const float widthA = posA.width * crossfade.fromScale; const float widthB = posB.width * crossfade.toScale; @@ -67,7 +73,7 @@ LineSDFProgram::uniformValues(const RenderLinePaintProperties::PossiblyEvaluated -posB.height / 2.0f }}; - return makeValues<LineSDFProgram::UniformValues>( + return makeValues<LineSDFProgram::LayoutUniformValues>( properties, tile, state, @@ -81,18 +87,18 @@ LineSDFProgram::uniformValues(const RenderLinePaintProperties::PossiblyEvaluated ); } -LinePatternProgram::UniformValues -LinePatternProgram::uniformValues(const RenderLinePaintProperties::PossiblyEvaluated& properties, - const RenderTile& tile, - const TransformState& state, - const std::array<float, 2>& pixelsToGLUnits, - const Size atlasSize, - const CrossfadeParameters& crossfade, - const float pixelRatio) { - +LinePatternProgram::LayoutUniformValues LinePatternProgram::layoutUniformValues( + const RenderLinePaintProperties::PossiblyEvaluated& properties, + const RenderTile& tile, + const TransformState& state, + const std::array<float, 2>& pixelsToGLUnits, + const Size atlasSize, + const CrossfadeParameters& crossfade, + const float pixelRatio) { + const auto tileRatio = 1 / tile.id.pixelsToTileUnits(1, state.getIntegerZoom()); - return makeValues<LinePatternProgram::UniformValues>( + return makeValues<LinePatternProgram::LayoutUniformValues>( properties, tile, state, @@ -103,12 +109,12 @@ LinePatternProgram::uniformValues(const RenderLinePaintProperties::PossiblyEvalu ); } -LineGradientProgram::UniformValues -LineGradientProgram::uniformValues(const RenderLinePaintProperties::PossiblyEvaluated& properties, - const RenderTile& tile, - const TransformState& state, - const std::array<float, 2>& pixelsToGLUnits) { - return makeValues<LineGradientProgram::UniformValues>( +LineGradientProgram::LayoutUniformValues LineGradientProgram::layoutUniformValues( + const RenderLinePaintProperties::PossiblyEvaluated& properties, + const RenderTile& tile, + const TransformState& state, + const std::array<float, 2>& pixelsToGLUnits) { + return makeValues<LineGradientProgram::LayoutUniformValues>( properties, tile, state, diff --git a/src/mbgl/programs/line_program.hpp b/src/mbgl/programs/line_program.hpp index 0e4055bded..05546e3cbe 100644 --- a/src/mbgl/programs/line_program.hpp +++ b/src/mbgl/programs/line_program.hpp @@ -4,10 +4,6 @@ #include <mbgl/programs/attributes.hpp> #include <mbgl/programs/uniforms.hpp> #include <mbgl/programs/textures.hpp> -#include <mbgl/shaders/line.hpp> -#include <mbgl/shaders/line_gradient.hpp> -#include <mbgl/shaders/line_pattern.hpp> -#include <mbgl/shaders/line_sdf.hpp> #include <mbgl/util/geometry.hpp> #include <mbgl/renderer/layers/render_line_layer.hpp> #include <mbgl/renderer/cross_faded_property_evaluator.hpp> @@ -35,8 +31,8 @@ using LineLayoutAttributes = TypeList< attributes::a_data<uint8_t, 4>>; class LineProgram : public Program< - shaders::line, - gfx::Triangle, + LineProgram, + gfx::PrimitiveType::Triangle, LineLayoutAttributes, TypeList< uniforms::u_matrix, @@ -93,15 +89,16 @@ public: */ static const int8_t extrudeScale = 63; - static UniformValues uniformValues(const RenderLinePaintProperties::PossiblyEvaluated&, - const RenderTile&, - const TransformState&, - const std::array<float, 2>& pixelsToGLUnits); + static LayoutUniformValues + layoutUniformValues(const RenderLinePaintProperties::PossiblyEvaluated&, + const RenderTile&, + const TransformState&, + const std::array<float, 2>& pixelsToGLUnits); }; class LinePatternProgram : public Program< - shaders::line_pattern, - gfx::Triangle, + LinePatternProgram, + gfx::PrimitiveType::Triangle, LineLayoutAttributes, TypeList< uniforms::u_matrix, @@ -117,18 +114,19 @@ class LinePatternProgram : public Program< public: using Program::Program; - static UniformValues uniformValues(const RenderLinePaintProperties::PossiblyEvaluated&, - const RenderTile&, - const TransformState&, - const std::array<float, 2>& pixelsToGLUnits, - Size atlasSize, - const CrossfadeParameters& crossfade, - const float pixelRatio); + static LayoutUniformValues + layoutUniformValues(const RenderLinePaintProperties::PossiblyEvaluated&, + const RenderTile&, + const TransformState&, + const std::array<float, 2>& pixelsToGLUnits, + Size atlasSize, + const CrossfadeParameters& crossfade, + const float pixelRatio); }; class LineSDFProgram : public Program< - shaders::line_sdf, - gfx::Triangle, + LineSDFProgram, + gfx::PrimitiveType::Triangle, LineLayoutAttributes, TypeList< uniforms::u_matrix, @@ -147,20 +145,21 @@ class LineSDFProgram : public Program< public: using Program::Program; - static UniformValues uniformValues(const RenderLinePaintProperties::PossiblyEvaluated&, - float pixelRatio, - const RenderTile&, - const TransformState&, - const std::array<float, 2>& pixelsToGLUnits, - const LinePatternPos& posA, - const LinePatternPos& posB, - const CrossfadeParameters& crossfade, - float atlasWidth); + static LayoutUniformValues + layoutUniformValues(const RenderLinePaintProperties::PossiblyEvaluated&, + float pixelRatio, + const RenderTile&, + const TransformState&, + const std::array<float, 2>& pixelsToGLUnits, + const LinePatternPos& posA, + const LinePatternPos& posB, + const CrossfadeParameters& crossfade, + float atlasWidth); }; class LineGradientProgram : public Program< - shaders::line_gradient, - gfx::Triangle, + LineGradientProgram, + gfx::PrimitiveType::Triangle, LineLayoutAttributes, TypeList< uniforms::u_matrix, @@ -173,18 +172,19 @@ class LineGradientProgram : public Program< public: using Program::Program; - static UniformValues uniformValues(const RenderLinePaintProperties::PossiblyEvaluated&, - const RenderTile&, - const TransformState&, - const std::array<float, 2>& pixelsToGLUnits); + static LayoutUniformValues + layoutUniformValues(const RenderLinePaintProperties::PossiblyEvaluated&, + const RenderTile&, + const TransformState&, + const std::array<float, 2>& pixelsToGLUnits); }; using LineLayoutVertex = LineProgram::LayoutVertex; -using LineAttributes = LineProgram::Attributes; +using LineAttributes = LineProgram::AttributeList; class LineLayerPrograms final : public LayerTypePrograms { public: - LineLayerPrograms(gl::Context& context, const ProgramParameters& programParameters) + LineLayerPrograms(gfx::Context& context, const ProgramParameters& programParameters) : line(context, programParameters), lineGradient(context, programParameters), lineSDF(context, programParameters), diff --git a/src/mbgl/programs/line_sdf_program.hpp b/src/mbgl/programs/line_sdf_program.hpp new file mode 100644 index 0000000000..c98cd37e98 --- /dev/null +++ b/src/mbgl/programs/line_sdf_program.hpp @@ -0,0 +1,4 @@ +#pragma once + +// Alias +#include <mbgl/programs/line_program.hpp> diff --git a/src/mbgl/programs/program.hpp b/src/mbgl/programs/program.hpp index 379cc6b842..240da22b4f 100644 --- a/src/mbgl/programs/program.hpp +++ b/src/mbgl/programs/program.hpp @@ -1,106 +1,106 @@ #pragma once -#include <mbgl/gl/program.hpp> -#include <mbgl/gl/features.hpp> +#include <mbgl/gfx/attribute.hpp> +#include <mbgl/gfx/uniform.hpp> #include <mbgl/programs/segment.hpp> -#include <mbgl/programs/binary_program.hpp> #include <mbgl/programs/attributes.hpp> #include <mbgl/programs/program_parameters.hpp> #include <mbgl/style/paint_property.hpp> #include <mbgl/renderer/paint_property_binder.hpp> -#include <mbgl/shaders/shaders.hpp> #include <mbgl/util/io.hpp> #include <unordered_map> namespace mbgl { -template <class Shaders, - class Primitive, +template <class Name, + gfx::PrimitiveType Primitive, class LayoutAttributeList, - class UniformList, - class TextureList, + class LayoutUniformList, + class Textures, class PaintProps> class Program { public: - using LayoutAttributes = gl::Attributes<LayoutAttributeList>; using LayoutVertex = gfx::Vertex<LayoutAttributeList>; using PaintProperties = PaintProps; using Binders = PaintPropertyBinders<typename PaintProperties::DataDrivenProperties>; + using PaintAttributeList = typename Binders::AttributeList; - using Attributes = gl::Attributes<TypeListConcat<LayoutAttributeList, PaintAttributeList>>; + using AttributeList = TypeListConcat<LayoutAttributeList, PaintAttributeList>; + using AttributeBindings = gfx::AttributeBindings<AttributeList>; - using UniformValues = gfx::UniformValues<UniformList>; using PaintUniformList = typename Binders::UniformList; - using AllUniforms = gl::Uniforms<TypeListConcat<UniformList, PaintUniformList>>; + using UniformList = TypeListConcat<LayoutUniformList, PaintUniformList>; + using LayoutUniformValues = gfx::UniformValues<LayoutUniformList>; + using UniformValues = gfx::UniformValues<UniformList>; + using TextureList = Textures; using TextureBindings = gfx::TextureBindings<TextureList>; - using ProgramType = gl::Program<Primitive, Attributes, AllUniforms, TextureList>; - - ProgramType program; + std::unique_ptr<gfx::Program<Name>> program; - Program(gl::Context& context, const ProgramParameters& programParameters) - : program(ProgramType::createProgram( - context, - programParameters, - Shaders::name, - Shaders::vertexSource, - Shaders::fragmentSource)) { + Program(gfx::Context& context, const ProgramParameters& programParameters) + : program(context.createProgram<Name>(programParameters)) { } - static typename AllUniforms::Values computeAllUniformValues( - const UniformValues& uniformValues, + static UniformValues computeAllUniformValues( + const LayoutUniformValues& layoutUniformValues, const Binders& paintPropertyBinders, const typename PaintProperties::PossiblyEvaluated& currentProperties, float currentZoom) { - return uniformValues + return layoutUniformValues .concat(paintPropertyBinders.uniformValues(currentZoom, currentProperties)); } - static typename Attributes::Bindings computeAllAttributeBindings( + static AttributeBindings computeAllAttributeBindings( const gfx::VertexBuffer<LayoutVertex>& layoutVertexBuffer, const Binders& paintPropertyBinders, const typename PaintProperties::PossiblyEvaluated& currentProperties) { - return LayoutAttributes::bindings(layoutVertexBuffer) + return gfx::AttributeBindings<LayoutAttributeList>(layoutVertexBuffer) .concat(paintPropertyBinders.attributeBindings(currentProperties)); } - static uint32_t activeBindingCount(const typename Attributes::Bindings& allAttributeBindings) { - return Attributes::activeBindingCount(allAttributeBindings); + static uint32_t activeBindingCount(const AttributeBindings& allAttributeBindings) { + return allAttributeBindings.activeCount(); } template <class DrawMode> - void draw(gl::Context& context, - DrawMode drawMode, - gfx::DepthMode depthMode, - gfx::StencilMode stencilMode, - gfx::ColorMode colorMode, - gfx::CullFaceMode cullFaceMode, + void draw(gfx::Context& context, + const DrawMode& drawMode, + const gfx::DepthMode& depthMode, + const gfx::StencilMode& stencilMode, + const gfx::ColorMode& colorMode, + const gfx::CullFaceMode& cullFaceMode, const gfx::IndexBuffer& indexBuffer, - const SegmentVector<Attributes>& segments, - const typename AllUniforms::Values& allUniformValues, - const typename Attributes::Bindings& allAttributeBindings, + const SegmentVector<AttributeList>& segments, + const UniformValues& uniformValues, + const AttributeBindings& allAttributeBindings, const TextureBindings& textureBindings, const std::string& layerID) { + static_assert(Primitive == gfx::PrimitiveTypeOf<DrawMode>::value, "incompatible draw mode"); + + if (!program) { + return; + } + for (auto& segment : segments) { - auto vertexArrayIt = segment.vertexArrays.find(layerID); + auto drawScopeIt = segment.drawScopes.find(layerID); - if (vertexArrayIt == segment.vertexArrays.end()) { - vertexArrayIt = segment.vertexArrays.emplace(layerID, context.createVertexArray()).first; + if (drawScopeIt == segment.drawScopes.end()) { + drawScopeIt = segment.drawScopes.emplace(layerID, context.createDrawScope()).first; } - program.draw( + program->draw( context, - std::move(drawMode), - std::move(depthMode), - std::move(stencilMode), - std::move(colorMode), - std::move(cullFaceMode), - allUniformValues, - vertexArrayIt->second, - Attributes::offsetBindings(allAttributeBindings, segment.vertexOffset), + drawMode, + depthMode, + stencilMode, + colorMode, + cullFaceMode, + uniformValues, + drawScopeIt->second, + allAttributeBindings.offset(segment.vertexOffset), textureBindings, indexBuffer, segment.indexOffset, @@ -116,7 +116,7 @@ public: using Binders = typename Program::Binders; using Bitset = typename Binders::Bitset; - ProgramMap(gl::Context& context_, ProgramParameters parameters_) + ProgramMap(gfx::Context& context_, ProgramParameters parameters_) : context(context_), parameters(std::move(parameters_)) { } @@ -134,7 +134,7 @@ public: } private: - gl::Context& context; + gfx::Context& context; ProgramParameters parameters; std::unordered_map<Bitset, Program> programs; }; diff --git a/src/mbgl/programs/programs.cpp b/src/mbgl/programs/programs.cpp index f3b3af8ac9..f82e46c9a2 100644 --- a/src/mbgl/programs/programs.cpp +++ b/src/mbgl/programs/programs.cpp @@ -12,7 +12,7 @@ namespace mbgl { -Programs::Programs(gl::Context& context_, const ProgramParameters& programParameters_) +Programs::Programs(gfx::Context& context_, const ProgramParameters& programParameters_) : debug(context_, programParameters_), clippingMask(context_, programParameters_), context(context_), diff --git a/src/mbgl/programs/programs.hpp b/src/mbgl/programs/programs.hpp index a12a0e8fa6..ca9359b267 100644 --- a/src/mbgl/programs/programs.hpp +++ b/src/mbgl/programs/programs.hpp @@ -20,7 +20,7 @@ class SymbolLayerPrograms; class Programs { public: - Programs(gl::Context&, const ProgramParameters&); + Programs(gfx::Context&, const ProgramParameters&); ~Programs(); BackgroundLayerPrograms& getBackgroundLayerPrograms() noexcept; @@ -47,7 +47,7 @@ private: std::unique_ptr<LayerTypePrograms> linePrograms; std::unique_ptr<LayerTypePrograms> symbolPrograms; - gl::Context& context; + gfx::Context& context; ProgramParameters programParameters; }; diff --git a/src/mbgl/programs/raster_program.cpp b/src/mbgl/programs/raster_program.cpp index 6906903e6b..f3b1052284 100644 --- a/src/mbgl/programs/raster_program.cpp +++ b/src/mbgl/programs/raster_program.cpp @@ -1,7 +1,10 @@ #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/raster_program.hpp b/src/mbgl/programs/raster_program.hpp index a5b4ee36ba..55f1fb0a2e 100644 --- a/src/mbgl/programs/raster_program.hpp +++ b/src/mbgl/programs/raster_program.hpp @@ -4,7 +4,6 @@ #include <mbgl/programs/attributes.hpp> #include <mbgl/programs/uniforms.hpp> #include <mbgl/programs/textures.hpp> -#include <mbgl/shaders/raster.hpp> #include <mbgl/util/geometry.hpp> #include <mbgl/style/layers/raster_layer_properties.hpp> @@ -23,8 +22,8 @@ MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_tl_parent); } // namespace uniforms class RasterProgram : public Program< - shaders::raster, - gfx::Triangle, + RasterProgram, + gfx::PrimitiveType::Triangle, TypeList< attributes::a_pos, attributes::a_texture_pos>, @@ -63,11 +62,11 @@ public: }; using RasterLayoutVertex = RasterProgram::LayoutVertex; -using RasterAttributes = RasterProgram::Attributes; +using RasterAttributes = RasterProgram::AttributeList; class RasterLayerPrograms final : public LayerTypePrograms { public: - RasterLayerPrograms(gl::Context& context, const ProgramParameters& programParameters) + RasterLayerPrograms(gfx::Context& context, const ProgramParameters& programParameters) : raster(context, programParameters) {} RasterProgram raster; }; diff --git a/src/mbgl/programs/segment.hpp b/src/mbgl/programs/segment.hpp index 5158ce7dbf..5976550d2c 100644 --- a/src/mbgl/programs/segment.hpp +++ b/src/mbgl/programs/segment.hpp @@ -1,6 +1,6 @@ #pragma once -#include <mbgl/gl/vertex_array.hpp> +#include <mbgl/gfx/draw_scope.hpp> #include <cstddef> #include <vector> @@ -8,7 +8,7 @@ namespace mbgl { -template <class Attributes> +template <class AttributeList> class Segment { public: Segment(std::size_t vertexOffset_, @@ -28,17 +28,17 @@ public: std::size_t vertexLength; std::size_t indexLength; - // One VertexArray per layer ID. This minimizes rebinding in cases where + // One DrawScope per layer ID. This minimizes rebinding in cases where // several layers share buckets but have different sets of active attributes. // This can happen: // * when two layers have the same layout properties, but differing // data-driven paint properties // * when two fill layers have the same layout properties, but one // uses fill-color and the other uses fill-pattern - mutable std::map<std::string, gl::VertexArray> vertexArrays; + mutable std::map<std::string, gfx::DrawScope> drawScopes; }; -template <class Attributes> -using SegmentVector = std::vector<Segment<Attributes>>; +template <class AttributeList> +using SegmentVector = std::vector<Segment<AttributeList>>; } // namespace mbgl diff --git a/src/mbgl/programs/symbol_icon_program.hpp b/src/mbgl/programs/symbol_icon_program.hpp new file mode 100644 index 0000000000..57f27518d1 --- /dev/null +++ b/src/mbgl/programs/symbol_icon_program.hpp @@ -0,0 +1,4 @@ +#pragma once + +// Alias +#include <mbgl/programs/symbol_program.hpp> diff --git a/src/mbgl/programs/symbol_program.cpp b/src/mbgl/programs/symbol_program.cpp index 03643d6422..2300dedff3 100644 --- a/src/mbgl/programs/symbol_program.cpp +++ b/src/mbgl/programs/symbol_program.cpp @@ -1,4 +1,5 @@ #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> @@ -9,6 +10,10 @@ 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"); @@ -99,17 +104,16 @@ Values makeValues(const bool isText, }; } -SymbolIconProgram::UniformValues -SymbolIconProgram::uniformValues(const bool isText, - const style::SymbolPropertyValues& values, - const Size& texsize, - const std::array<float, 2>& pixelsToGLUnits, - const bool alongLine, - const RenderTile& tile, - const TransformState& state, - const float symbolFadeChange) -{ - return makeValues<SymbolIconProgram::UniformValues>( +SymbolIconProgram::LayoutUniformValues +SymbolIconProgram::layoutUniformValues(const bool isText, + const style::SymbolPropertyValues& values, + const Size& texsize, + const std::array<float, 2>& pixelsToGLUnits, + const bool alongLine, + const RenderTile& tile, + const TransformState& state, + const float symbolFadeChange) { + return makeValues<SymbolIconProgram::LayoutUniformValues>( isText, values, texsize, @@ -121,23 +125,22 @@ SymbolIconProgram::uniformValues(const bool isText, ); } -template <class PaintProperties> -typename SymbolSDFProgram<PaintProperties>::UniformValues SymbolSDFProgram<PaintProperties>::uniformValues( - const bool isText, - const style::SymbolPropertyValues& values, - const Size& texsize, - const std::array<float, 2>& pixelsToGLUnits, - const bool alongLine, - const RenderTile& tile, - const TransformState& state, - const float symbolFadeChange, - const SymbolSDFPart part) -{ +template <class Name, class PaintProperties> +typename SymbolSDFProgram<Name, PaintProperties>::LayoutUniformValues +SymbolSDFProgram<Name, PaintProperties>::layoutUniformValues(const bool isText, + const style::SymbolPropertyValues& values, + const Size& texsize, + const std::array<float, 2>& pixelsToGLUnits, + const bool alongLine, + const RenderTile& tile, + const TransformState& state, + const float symbolFadeChange, + const SymbolSDFPart part) { const float gammaScale = (values.pitchAlignment == AlignmentType::Map ? std::cos(state.getPitch()) * state.getCameraToCenterDistance() : 1.0); - return makeValues<SymbolSDFProgram<PaintProperties>::UniformValues>( + return makeValues<SymbolSDFProgram<Name, PaintProperties>::LayoutUniformValues>( isText, values, texsize, @@ -151,7 +154,7 @@ typename SymbolSDFProgram<PaintProperties>::UniformValues SymbolSDFProgram<Paint ); } -template class SymbolSDFProgram<style::IconPaintProperties>; -template class SymbolSDFProgram<style::TextPaintProperties>; +template class SymbolSDFProgram<SymbolSDFIconProgram, style::IconPaintProperties>; +template class SymbolSDFProgram<SymbolSDFTextProgram, style::TextPaintProperties>; } // namespace mbgl diff --git a/src/mbgl/programs/symbol_program.hpp b/src/mbgl/programs/symbol_program.hpp index 7b8a2c1330..383f5162d8 100644 --- a/src/mbgl/programs/symbol_program.hpp +++ b/src/mbgl/programs/symbol_program.hpp @@ -1,6 +1,5 @@ #pragma once -#include <mbgl/gl/context.hpp> #include <mbgl/gl/program.hpp> #include <mbgl/math/clamp.hpp> #include <mbgl/util/interpolate.hpp> @@ -10,8 +9,6 @@ #include <mbgl/programs/uniforms.hpp> #include <mbgl/programs/textures.hpp> #include <mbgl/programs/segment.hpp> -#include <mbgl/shaders/symbol_icon.hpp> -#include <mbgl/shaders/symbol_sdf.hpp> #include <mbgl/util/geometry.hpp> #include <mbgl/util/size.hpp> #include <mbgl/style/layers/symbol_layer_properties.hpp> @@ -240,55 +237,51 @@ public: } }; -template <class Shaders, - class Primitive, +template <class Name, + gfx::PrimitiveType Primitive, class LayoutAttributeList, - class UniformList, - class TextureList, + class LayoutUniformList, + class Textures, class PaintProps> class SymbolProgram : public SymbolProgramBase { public: - using LayoutAttributes = gl::Attributes<LayoutAttributeList>; using LayoutVertex = gfx::Vertex<LayoutAttributeList>; using LayoutAndSizeAttributeList = TypeListConcat<LayoutAttributeList, SymbolDynamicLayoutAttributes, SymbolOpacityAttributes>; using PaintProperties = PaintProps; using Binders = PaintPropertyBinders<typename PaintProperties::DataDrivenProperties>; + using PaintAttributeList = typename Binders::AttributeList; - using Attributes = gl::Attributes<TypeListConcat<LayoutAndSizeAttributeList, PaintAttributeList>>; + using AttributeList = TypeListConcat<LayoutAndSizeAttributeList, PaintAttributeList>; + using AttributeBindings = gfx::AttributeBindings<AttributeList>; - using UniformValues = gfx::UniformValues<UniformList>; + using LayoutUniformValues = gfx::UniformValues<LayoutUniformList>; using SizeUniformList = typename SymbolSizeBinder::UniformList; using PaintUniformList = typename Binders::UniformList; - using AllUniforms = gl::Uniforms<TypeListConcat<UniformList, SizeUniformList, PaintUniformList>>; + using UniformList = TypeListConcat<LayoutUniformList, SizeUniformList, PaintUniformList>; + using UniformValues = gfx::UniformValues<UniformList>; + using TextureList = Textures; using TextureBindings = gfx::TextureBindings<TextureList>; - using ProgramType = gl::Program<Primitive, Attributes, AllUniforms, TextureList>; + std::unique_ptr<gfx::Program<Name>> program; - ProgramType program; - - SymbolProgram(gl::Context& context, const ProgramParameters& programParameters) - : program(ProgramType::createProgram( - context, - programParameters, - Shaders::name, - Shaders::vertexSource, - Shaders::fragmentSource)) { + SymbolProgram(gfx::Context& context, const ProgramParameters& programParameters) + : program(context.createProgram<Name>(programParameters)) { } - static typename AllUniforms::Values computeAllUniformValues( - const UniformValues& uniformValues, + static UniformValues computeAllUniformValues( + const LayoutUniformValues& layoutUniformValues, const SymbolSizeBinder& symbolSizeBinder, const Binders& paintPropertyBinders, const typename PaintProperties::PossiblyEvaluated& currentProperties, float currentZoom) { - return uniformValues.concat(symbolSizeBinder.uniformValues(currentZoom)) + return layoutUniformValues.concat(symbolSizeBinder.uniformValues(currentZoom)) .concat(paintPropertyBinders.uniformValues(currentZoom, currentProperties)); } - static typename Attributes::Bindings computeAllAttributeBindings( + static AttributeBindings computeAllAttributeBindings( const gfx::VertexBuffer<LayoutVertex>& layoutVertexBuffer, const gfx::VertexBuffer<gfx::Vertex<SymbolDynamicLayoutAttributes>>& dynamicLayoutVertexBuffer, const gfx::VertexBuffer<gfx::Vertex<SymbolOpacityAttributes>>& opacityVertexBuffer, @@ -296,46 +289,52 @@ public: const typename PaintProperties::PossiblyEvaluated& currentProperties) { assert(layoutVertexBuffer.elements == dynamicLayoutVertexBuffer.elements && layoutVertexBuffer.elements == opacityVertexBuffer.elements); - return gl::Attributes<LayoutAttributeList>::bindings(layoutVertexBuffer) - .concat(gl::Attributes<SymbolDynamicLayoutAttributes>::bindings(dynamicLayoutVertexBuffer)) - .concat(gl::Attributes<SymbolOpacityAttributes>::bindings(opacityVertexBuffer)) + return gfx::AttributeBindings<LayoutAttributeList>(layoutVertexBuffer) + .concat(gfx::AttributeBindings<SymbolDynamicLayoutAttributes>(dynamicLayoutVertexBuffer)) + .concat(gfx::AttributeBindings<SymbolOpacityAttributes>(opacityVertexBuffer)) .concat(paintPropertyBinders.attributeBindings(currentProperties)); } - static uint32_t activeBindingCount(const typename Attributes::Bindings& allAttributeBindings) { - return Attributes::activeBindingCount(allAttributeBindings); + static uint32_t activeBindingCount(const AttributeBindings& allAttributeBindings) { + return allAttributeBindings.activeCount(); } template <class DrawMode> - void draw(gl::Context& context, - DrawMode drawMode, - gfx::DepthMode depthMode, - gfx::StencilMode stencilMode, - gfx::ColorMode colorMode, - gfx::CullFaceMode cullFaceMode, + void draw(gfx::Context& context, + const DrawMode& drawMode, + const gfx::DepthMode& depthMode, + const gfx::StencilMode& stencilMode, + const gfx::ColorMode& colorMode, + const gfx::CullFaceMode& cullFaceMode, const gfx::IndexBuffer& indexBuffer, - const SegmentVector<Attributes>& segments, - const typename AllUniforms::Values& allUniformValues, - const typename Attributes::Bindings& allAttributeBindings, + const SegmentVector<AttributeList>& segments, + const UniformValues& uniformValues, + const AttributeBindings& allAttributeBindings, const TextureBindings& textureBindings, const std::string& layerID) { + static_assert(Primitive == gfx::PrimitiveTypeOf<DrawMode>::value, "incompatible draw mode"); + + if (!program) { + return; + } + for (auto& segment : segments) { - auto vertexArrayIt = segment.vertexArrays.find(layerID); + auto drawScopeIt = segment.drawScopes.find(layerID); - if (vertexArrayIt == segment.vertexArrays.end()) { - vertexArrayIt = segment.vertexArrays.emplace(layerID, context.createVertexArray()).first; + if (drawScopeIt == segment.drawScopes.end()) { + drawScopeIt = segment.drawScopes.emplace(layerID, context.createDrawScope()).first; } - program.draw( + program->draw( context, - std::move(drawMode), - std::move(depthMode), - std::move(stencilMode), - std::move(colorMode), - std::move(cullFaceMode), - allUniformValues, - vertexArrayIt->second, - Attributes::offsetBindings(allAttributeBindings, segment.vertexOffset), + drawMode, + depthMode, + stencilMode, + colorMode, + cullFaceMode, + uniformValues, + drawScopeIt->second, + allAttributeBindings.offset(segment.vertexOffset), textureBindings, indexBuffer, segment.indexOffset, @@ -345,8 +344,8 @@ public: }; class SymbolIconProgram : public SymbolProgram< - shaders::symbol_icon, - gfx::Triangle, + SymbolIconProgram, + gfx::PrimitiveType::Triangle, SymbolLayoutAttributes, TypeList< uniforms::u_matrix, @@ -368,14 +367,14 @@ class SymbolIconProgram : public SymbolProgram< public: using SymbolProgram::SymbolProgram; - static UniformValues uniformValues(const bool isText, - const style::SymbolPropertyValues&, - const Size& texsize, - const std::array<float, 2>& pixelsToGLUnits, - const bool alongLine, - const RenderTile&, - const TransformState&, - const float symbolFadeChange); + static LayoutUniformValues layoutUniformValues(const bool isText, + const style::SymbolPropertyValues&, + const Size& texsize, + const std::array<float, 2>& pixelsToGLUnits, + const bool alongLine, + const RenderTile&, + const TransformState&, + const float symbolFadeChange); }; enum class SymbolSDFPart { @@ -383,10 +382,10 @@ enum class SymbolSDFPart { Halo = 0 }; -template <class PaintProperties> +template <class Name, class PaintProperties> class SymbolSDFProgram : public SymbolProgram< - shaders::symbol_sdf, - gfx::Triangle, + Name, + gfx::PrimitiveType::Triangle, SymbolLayoutAttributes, TypeList< uniforms::u_matrix, @@ -408,8 +407,9 @@ class SymbolSDFProgram : public SymbolProgram< PaintProperties> { public: - using BaseProgram = SymbolProgram<shaders::symbol_sdf, - gfx::Triangle, + using BaseProgram = SymbolProgram< + Name, + gfx::PrimitiveType::Triangle, SymbolLayoutAttributes, TypeList< uniforms::u_matrix, @@ -430,33 +430,40 @@ public: textures::u_texture>, PaintProperties>; - using UniformValues = typename BaseProgram::UniformValues; + using LayoutUniformValues = typename BaseProgram::LayoutUniformValues; using BaseProgram::BaseProgram; - static UniformValues uniformValues(const bool isText, - const style::SymbolPropertyValues&, - const Size& texsize, - const std::array<float, 2>& pixelsToGLUnits, - const bool alongLine, - const RenderTile&, - const TransformState&, - const float SymbolFadeChange, - const SymbolSDFPart); + static LayoutUniformValues layoutUniformValues(const bool isText, + const style::SymbolPropertyValues&, + const Size& texsize, + const std::array<float, 2>& pixelsToGLUnits, + const bool alongLine, + const RenderTile&, + const TransformState&, + const float SymbolFadeChange, + const SymbolSDFPart); +}; + +class SymbolSDFIconProgram : public SymbolSDFProgram<SymbolSDFIconProgram, style::IconPaintProperties> { +public: + using SymbolSDFProgram::SymbolSDFProgram; }; -using SymbolSDFIconProgram = SymbolSDFProgram<style::IconPaintProperties>; -using SymbolSDFTextProgram = SymbolSDFProgram<style::TextPaintProperties>; +class SymbolSDFTextProgram : public SymbolSDFProgram<SymbolSDFTextProgram, style::TextPaintProperties> { +public: + using SymbolSDFProgram::SymbolSDFProgram; +}; using SymbolLayoutVertex = gfx::Vertex<SymbolLayoutAttributes>; -using SymbolIconAttributes = SymbolIconProgram::Attributes; -using SymbolTextAttributes = SymbolSDFTextProgram::Attributes; +using SymbolIconAttributes = SymbolIconProgram::AttributeList; +using SymbolTextAttributes = SymbolSDFTextProgram::AttributeList; class SymbolLayerPrograms final : public LayerTypePrograms { public: - SymbolLayerPrograms(gl::Context& context, const ProgramParameters& programParameters) + SymbolLayerPrograms(gfx::Context& context, const ProgramParameters& programParameters) : symbolIcon(context, programParameters), symbolIconSDF(context, programParameters), symbolGlyph(context, programParameters), diff --git a/src/mbgl/programs/symbol_sdf_icon_program.hpp b/src/mbgl/programs/symbol_sdf_icon_program.hpp new file mode 100644 index 0000000000..57f27518d1 --- /dev/null +++ b/src/mbgl/programs/symbol_sdf_icon_program.hpp @@ -0,0 +1,4 @@ +#pragma once + +// Alias +#include <mbgl/programs/symbol_program.hpp> diff --git a/src/mbgl/programs/symbol_sdf_text_program.hpp b/src/mbgl/programs/symbol_sdf_text_program.hpp new file mode 100644 index 0000000000..57f27518d1 --- /dev/null +++ b/src/mbgl/programs/symbol_sdf_text_program.hpp @@ -0,0 +1,4 @@ +#pragma once + +// Alias +#include <mbgl/programs/symbol_program.hpp> |