From 1e30fdac36233c0fd0662e2b285b0424907bc81d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20K=C3=A4fer?= Date: Tue, 19 Mar 2019 14:02:10 +0100 Subject: [core] move ProgramMap to within the gl::Program object --- src/mbgl/programs/gl/background.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/background_pattern.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/circle.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/clipping_mask.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/collision_box.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/collision_circle.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/debug.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/extrusion_texture.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/fill.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/fill_extrusion.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/fill_extrusion_pattern.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/fill_outline.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/fill_outline_pattern.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/fill_pattern.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/heatmap.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/heatmap_texture.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/hillshade.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/hillshade_prepare.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/line.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/line_gradient.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/line_pattern.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/line_sdf.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/preludes.cpp | 15 --------------- src/mbgl/programs/gl/preludes.hpp | 7 +++++-- src/mbgl/programs/gl/raster.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/shader_source.hpp | 3 +++ src/mbgl/programs/gl/shaders.cpp | 24 +++++++++++------------- src/mbgl/programs/gl/shaders.hpp | 7 ++++--- src/mbgl/programs/gl/symbol_icon.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/symbol_sdf_icon.cpp | 25 ++++++++++++++++++++++--- src/mbgl/programs/gl/symbol_sdf_text.cpp | 25 ++++++++++++++++++++++--- 31 files changed, 595 insertions(+), 111 deletions(-) delete mode 100644 src/mbgl/programs/gl/preludes.cpp (limited to 'src/mbgl/programs/gl') diff --git a/src/mbgl/programs/gl/background.cpp b/src/mbgl/programs/gl/background.cpp index da5ea25410..78074d670f 100644 --- a/src/mbgl/programs/gl/background.cpp +++ b/src/mbgl/programs/gl/background.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "background"; + static constexpr const uint8_t hash[8] = { 0x2d, 0xef, 0x97, 0xa2, 0xec, 0xb5, 0x67, 0xef }; + static constexpr const auto vertexOffset = 1429; + static constexpr const auto fragmentOffset = 1525; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "background", - programs::gl::shaderSource() + 1429, programs::gl::shaderSource() + 1525); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/background_pattern.cpp b/src/mbgl/programs/gl/background_pattern.cpp index af5d87129e..04111c7abd 100644 --- a/src/mbgl/programs/gl/background_pattern.cpp +++ b/src/mbgl/programs/gl/background_pattern.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "background_pattern"; + static constexpr const uint8_t hash[8] = { 0x70, 0x13, 0xc8, 0x7e, 0xba, 0x18, 0xf5, 0x19 }; + static constexpr const auto vertexOffset = 1675; + static constexpr const auto fragmentOffset = 2266; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "background_pattern", - programs::gl::shaderSource() + 1675, programs::gl::shaderSource() + 2266); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/circle.cpp b/src/mbgl/programs/gl/circle.cpp index ae2b65c20f..d1f1e29d33 100644 --- a/src/mbgl/programs/gl/circle.cpp +++ b/src/mbgl/programs/gl/circle.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "circle"; + static constexpr const uint8_t hash[8] = { 0xf0, 0x3e, 0x18, 0xb7, 0x75, 0xb2, 0xde, 0xa9 }; + static constexpr const auto vertexOffset = 2927; + static constexpr const auto fragmentOffset = 6093; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "circle", - programs::gl::shaderSource() + 2927, programs::gl::shaderSource() + 6093); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/clipping_mask.cpp b/src/mbgl/programs/gl/clipping_mask.cpp index 311877f065..3179ab0c13 100644 --- a/src/mbgl/programs/gl/clipping_mask.cpp +++ b/src/mbgl/programs/gl/clipping_mask.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "clipping_mask"; + static constexpr const uint8_t hash[8] = { 0x3e, 0x17, 0xc2, 0x3a, 0x1f, 0xf0, 0xa8, 0xa3 }; + static constexpr const auto vertexOffset = 7848; + static constexpr const auto fragmentOffset = 7944; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "clipping_mask", - programs::gl::shaderSource() + 7848, programs::gl::shaderSource() + 7944); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/collision_box.cpp b/src/mbgl/programs/gl/collision_box.cpp index 9af67f7981..f7ac4d4d67 100644 --- a/src/mbgl/programs/gl/collision_box.cpp +++ b/src/mbgl/programs/gl/collision_box.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "collision_box"; + static constexpr const uint8_t hash[8] = { 0xcb, 0x6a, 0x9b, 0xd1, 0x1f, 0x31, 0xf8, 0x5b }; + static constexpr const auto vertexOffset = 9956; + static constexpr const auto fragmentOffset = 10635; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "collision_box", - programs::gl::shaderSource() + 9956, programs::gl::shaderSource() + 10635); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/collision_circle.cpp b/src/mbgl/programs/gl/collision_circle.cpp index 843f9161bb..8f1b5726fe 100644 --- a/src/mbgl/programs/gl/collision_circle.cpp +++ b/src/mbgl/programs/gl/collision_circle.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "collision_circle"; + static constexpr const uint8_t hash[8] = { 0x99, 0x2e, 0xad, 0x8c, 0xd3, 0x88, 0xae, 0x82 }; + static constexpr const auto vertexOffset = 10858; + static constexpr const auto fragmentOffset = 11774; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "collision_circle", - programs::gl::shaderSource() + 10858, programs::gl::shaderSource() + 11774); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/debug.cpp b/src/mbgl/programs/gl/debug.cpp index 8b7aee5a0b..ad23f420ab 100644 --- a/src/mbgl/programs/gl/debug.cpp +++ b/src/mbgl/programs/gl/debug.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "debug"; + static constexpr const uint8_t hash[8] = { 0xa8, 0x7d, 0x87, 0x6e, 0x36, 0xa8, 0x81, 0xe3 }; + static constexpr const auto vertexOffset = 12450; + static constexpr const auto fragmentOffset = 12546; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "debug", - programs::gl::shaderSource() + 12450, programs::gl::shaderSource() + 12546); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/extrusion_texture.cpp b/src/mbgl/programs/gl/extrusion_texture.cpp index bd320d52cf..bca533a788 100644 --- a/src/mbgl/programs/gl/extrusion_texture.cpp +++ b/src/mbgl/programs/gl/extrusion_texture.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "extrusion_texture"; + static constexpr const uint8_t hash[8] = { 0xd9, 0x77, 0x11, 0xd2, 0x03, 0xc7, 0x27, 0xcb }; + static constexpr const auto vertexOffset = 27554; + static constexpr const auto fragmentOffset = 27734; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "extrusion_texture", - programs::gl::shaderSource() + 27554, programs::gl::shaderSource() + 27734); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/fill.cpp b/src/mbgl/programs/gl/fill.cpp index 44ab40949c..a699f82609 100644 --- a/src/mbgl/programs/gl/fill.cpp +++ b/src/mbgl/programs/gl/fill.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "fill"; + static constexpr const uint8_t hash[8] = { 0x87, 0xea, 0x65, 0x7f, 0x0c, 0x9b, 0x97, 0x5d }; + static constexpr const auto vertexOffset = 12610; + static constexpr const auto fragmentOffset = 13254; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "fill", - programs::gl::shaderSource() + 12610, programs::gl::shaderSource() + 13254); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/fill_extrusion.cpp b/src/mbgl/programs/gl/fill_extrusion.cpp index bd26d7afde..83a8eadee6 100644 --- a/src/mbgl/programs/gl/fill_extrusion.cpp +++ b/src/mbgl/programs/gl/fill_extrusion.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "fill_extrusion"; + static constexpr const uint8_t hash[8] = { 0x49, 0x8a, 0xa2, 0x8b, 0x21, 0x74, 0x27, 0x93 }; + static constexpr const auto vertexOffset = 21238; + static constexpr const auto fragmentOffset = 23121; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "fill_extrusion", - programs::gl::shaderSource() + 21238, programs::gl::shaderSource() + 23121); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/fill_extrusion_pattern.cpp b/src/mbgl/programs/gl/fill_extrusion_pattern.cpp index 94a663947a..45068d84b8 100644 --- a/src/mbgl/programs/gl/fill_extrusion_pattern.cpp +++ b/src/mbgl/programs/gl/fill_extrusion_pattern.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "fill_extrusion_pattern"; + static constexpr const uint8_t hash[8] = { 0x93, 0x2b, 0xd1, 0xab, 0xa3, 0xf2, 0x24, 0x63 }; + static constexpr const auto vertexOffset = 23237; + static constexpr const auto fragmentOffset = 26157; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "fill_extrusion_pattern", - programs::gl::shaderSource() + 23237, programs::gl::shaderSource() + 26157); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/fill_outline.cpp b/src/mbgl/programs/gl/fill_outline.cpp index 6186db4c9a..e7644468a5 100644 --- a/src/mbgl/programs/gl/fill_outline.cpp +++ b/src/mbgl/programs/gl/fill_outline.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "fill_outline"; + static constexpr const uint8_t hash[8] = { 0x56, 0x65, 0x69, 0x4b, 0x70, 0x2d, 0x3d, 0xc4 }; + static constexpr const auto vertexOffset = 13678; + static constexpr const auto fragmentOffset = 14503; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "fill_outline", - programs::gl::shaderSource() + 13678, programs::gl::shaderSource() + 14503); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/fill_outline_pattern.cpp b/src/mbgl/programs/gl/fill_outline_pattern.cpp index 9989c4076a..40aa5ea2de 100644 --- a/src/mbgl/programs/gl/fill_outline_pattern.cpp +++ b/src/mbgl/programs/gl/fill_outline_pattern.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "fill_outline_pattern"; + static constexpr const uint8_t hash[8] = { 0x56, 0x9c, 0x2f, 0x58, 0x6b, 0x31, 0xff, 0x84 }; + static constexpr const auto vertexOffset = 15092; + static constexpr const auto fragmentOffset = 16952; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "fill_outline_pattern", - programs::gl::shaderSource() + 15092, programs::gl::shaderSource() + 16952); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/fill_pattern.cpp b/src/mbgl/programs/gl/fill_pattern.cpp index 10d6c6ab85..fd16d8bfc9 100644 --- a/src/mbgl/programs/gl/fill_pattern.cpp +++ b/src/mbgl/programs/gl/fill_pattern.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "fill_pattern"; + static constexpr const uint8_t hash[8] = { 0x74, 0xa9, 0x97, 0x01, 0x96, 0xbd, 0x87, 0x36 }; + static constexpr const auto vertexOffset = 18259; + static constexpr const auto fragmentOffset = 20038; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "fill_pattern", - programs::gl::shaderSource() + 18259, programs::gl::shaderSource() + 20038); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/heatmap.cpp b/src/mbgl/programs/gl/heatmap.cpp index 836fd52b07..3b960f1bda 100644 --- a/src/mbgl/programs/gl/heatmap.cpp +++ b/src/mbgl/programs/gl/heatmap.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "heatmap"; + static constexpr const uint8_t hash[8] = { 0xab, 0x97, 0x81, 0x5c, 0xa2, 0x88, 0xaa, 0x7e }; + static constexpr const auto vertexOffset = 7983; + static constexpr const auto fragmentOffset = 9030; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "heatmap", - programs::gl::shaderSource() + 7983, programs::gl::shaderSource() + 9030); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/heatmap_texture.cpp b/src/mbgl/programs/gl/heatmap_texture.cpp index 530e9fa18b..57b033d55c 100644 --- a/src/mbgl/programs/gl/heatmap_texture.cpp +++ b/src/mbgl/programs/gl/heatmap_texture.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "heatmap_texture"; + static constexpr const uint8_t hash[8] = { 0x9f, 0xc7, 0x56, 0xb2, 0x9e, 0x8f, 0x15, 0xff }; + static constexpr const auto vertexOffset = 9491; + static constexpr const auto fragmentOffset = 9671; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "heatmap_texture", - programs::gl::shaderSource() + 9491, programs::gl::shaderSource() + 9671); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/hillshade.cpp b/src/mbgl/programs/gl/hillshade.cpp index dcf90f1149..a33ddb4326 100644 --- a/src/mbgl/programs/gl/hillshade.cpp +++ b/src/mbgl/programs/gl/hillshade.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "hillshade"; + static constexpr const uint8_t hash[8] = { 0x8a, 0x11, 0x29, 0x18, 0x52, 0x7f, 0x3b, 0xbb }; + static constexpr const auto vertexOffset = 29340; + static constexpr const auto fragmentOffset = 29511; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "hillshade", - programs::gl::shaderSource() + 29340, programs::gl::shaderSource() + 29511); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/hillshade_prepare.cpp b/src/mbgl/programs/gl/hillshade_prepare.cpp index b445713530..a302db5feb 100644 --- a/src/mbgl/programs/gl/hillshade_prepare.cpp +++ b/src/mbgl/programs/gl/hillshade_prepare.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "hillshade_prepare"; + static constexpr const uint8_t hash[8] = { 0xe6, 0x01, 0xf2, 0xbb, 0xa0, 0x77, 0x1d, 0xeb }; + static constexpr const auto vertexOffset = 27925; + static constexpr const auto fragmentOffset = 28218; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "hillshade_prepare", - programs::gl::shaderSource() + 27925, programs::gl::shaderSource() + 28218); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/line.cpp b/src/mbgl/programs/gl/line.cpp index 1f96b74a9c..e59cb07cb9 100644 --- a/src/mbgl/programs/gl/line.cpp +++ b/src/mbgl/programs/gl/line.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "line"; + static constexpr const uint8_t hash[8] = { 0x44, 0x46, 0x9e, 0x59, 0x02, 0xbb, 0xaa, 0xae }; + static constexpr const auto vertexOffset = 30585; + static constexpr const auto fragmentOffset = 33509; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "line", - programs::gl::shaderSource() + 30585, programs::gl::shaderSource() + 33509); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/line_gradient.cpp b/src/mbgl/programs/gl/line_gradient.cpp index 493fc850d1..f5325f84ba 100644 --- a/src/mbgl/programs/gl/line_gradient.cpp +++ b/src/mbgl/programs/gl/line_gradient.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "line_gradient"; + static constexpr const uint8_t hash[8] = { 0xee, 0xdd, 0x10, 0x3d, 0x1a, 0x21, 0x26, 0x25 }; + static constexpr const auto vertexOffset = 34335; + static constexpr const auto fragmentOffset = 37054; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "line_gradient", - programs::gl::shaderSource() + 34335, programs::gl::shaderSource() + 37054); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/line_pattern.cpp b/src/mbgl/programs/gl/line_pattern.cpp index 747b2bd197..e323b16785 100644 --- a/src/mbgl/programs/gl/line_pattern.cpp +++ b/src/mbgl/programs/gl/line_pattern.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "line_pattern"; + static constexpr const uint8_t hash[8] = { 0x73, 0xa0, 0x59, 0x46, 0x57, 0xa5, 0x60, 0x25 }; + static constexpr const auto vertexOffset = 37841; + static constexpr const auto fragmentOffset = 41162; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "line_pattern", - programs::gl::shaderSource() + 37841, programs::gl::shaderSource() + 41162); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/line_sdf.cpp b/src/mbgl/programs/gl/line_sdf.cpp index 12fb5b61fd..a7b4e7e3b7 100644 --- a/src/mbgl/programs/gl/line_sdf.cpp +++ b/src/mbgl/programs/gl/line_sdf.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "line_sdf"; + static constexpr const uint8_t hash[8] = { 0x66, 0x20, 0x75, 0x4e, 0xbe, 0x02, 0x9e, 0x67 }; + static constexpr const auto vertexOffset = 43475; + static constexpr const auto fragmentOffset = 47089; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "line_sdf", - programs::gl::shaderSource() + 43475, programs::gl::shaderSource() + 47089); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/preludes.cpp b/src/mbgl/programs/gl/preludes.cpp deleted file mode 100644 index 6c895c0d36..0000000000 --- a/src/mbgl/programs/gl/preludes.cpp +++ /dev/null @@ -1,15 +0,0 @@ -// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. - -#include -#include - -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 index 6d86ee45c5..e796f1655b 100644 --- a/src/mbgl/programs/gl/preludes.hpp +++ b/src/mbgl/programs/gl/preludes.hpp @@ -2,12 +2,15 @@ #pragma once +#include + namespace mbgl { namespace programs { namespace gl { -extern const char* vertexShaderPrelude; -extern const char* fragmentShaderPrelude; +constexpr const uint8_t preludeHash[8] = { 0x24, 0x91, 0x82, 0x37, 0x02, 0xad, 0x98, 0x0a }; +constexpr const auto vertexPreludeOffset = 0; +constexpr const auto fragmentPreludeOffset = 1252; } // namespace gl } // namespace programs diff --git a/src/mbgl/programs/gl/raster.cpp b/src/mbgl/programs/gl/raster.cpp index 512dc81a30..1867a48f1c 100644 --- a/src/mbgl/programs/gl/raster.cpp +++ b/src/mbgl/programs/gl/raster.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "raster"; + static constexpr const uint8_t hash[8] = { 0x40, 0x3d, 0x6c, 0xf4, 0xd0, 0x41, 0x51, 0x0e }; + static constexpr const auto vertexOffset = 48592; + static constexpr const auto fragmentOffset = 48941; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "raster", - programs::gl::shaderSource() + 48592, programs::gl::shaderSource() + 48941); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/shader_source.hpp b/src/mbgl/programs/gl/shader_source.hpp index f6de8a56cc..1a5fbddae3 100644 --- a/src/mbgl/programs/gl/shader_source.hpp +++ b/src/mbgl/programs/gl/shader_source.hpp @@ -8,6 +8,9 @@ namespace gl { const char* shaderSource(); +template +struct ShaderSource; + } // namespace gl } // namespace programs } // namespace mbgl diff --git a/src/mbgl/programs/gl/shaders.cpp b/src/mbgl/programs/gl/shaders.cpp index 3cc33992de..6fb4d70db9 100644 --- a/src/mbgl/programs/gl/shaders.cpp +++ b/src/mbgl/programs/gl/shaders.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -9,20 +10,17 @@ 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 programIdentifier(const std::string& defines1, + const std::string& defines2, + const uint8_t hash1[8], + const uint8_t hash2[8]) { std::string result; - result.reserve((sizeof(size_t) * 2) * 2 + 2); // 2 size_t hex values + "v2" - result += util::toHex(std::hash()(vertexSource)); - result += util::toHex(std::hash()(fragmentSource)); - result += "v3"; + result.reserve(8 + 8 + (sizeof(size_t) * 2) * 2 + 2); + result.append(util::toHex(std::hash()(defines1))); + result.append(util::toHex(std::hash()(defines2))); + result.append(hash1, hash2 + 8); + result.append(hash2, hash2 + 8); + result.append("v3"); return result; } diff --git a/src/mbgl/programs/gl/shaders.hpp b/src/mbgl/programs/gl/shaders.hpp index 5278ea54da..46a87f4af8 100644 --- a/src/mbgl/programs/gl/shaders.hpp +++ b/src/mbgl/programs/gl/shaders.hpp @@ -9,9 +9,10 @@ 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); +std::string programIdentifier(const std::string& defines1, + const std::string& defines2, + const uint8_t hash1[8], + const uint8_t hash2[8]); } // namespace gl } // namespace programs diff --git a/src/mbgl/programs/gl/symbol_icon.cpp b/src/mbgl/programs/gl/symbol_icon.cpp index 1cf2090ba3..6cb2b88543 100644 --- a/src/mbgl/programs/gl/symbol_icon.cpp +++ b/src/mbgl/programs/gl/symbol_icon.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "symbol_icon"; + static constexpr const uint8_t hash[8] = { 0x96, 0x0c, 0xef, 0xec, 0x37, 0x23, 0xf9, 0xb1 }; + static constexpr const auto vertexOffset = 50000; + static constexpr const auto fragmentOffset = 52654; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "symbol_icon", - programs::gl::shaderSource() + 50000, programs::gl::shaderSource() + 52654); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/symbol_sdf_icon.cpp b/src/mbgl/programs/gl/symbol_sdf_icon.cpp index ccb213bcfd..d98554099f 100644 --- a/src/mbgl/programs/gl/symbol_sdf_icon.cpp +++ b/src/mbgl/programs/gl/symbol_sdf_icon.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "symbol_sdf_icon"; + static constexpr const uint8_t hash[8] = { 0x13, 0xfc, 0x05, 0x2a, 0xd1, 0x93, 0xfb, 0x7d }; + static constexpr const auto vertexOffset = 53059; + static constexpr const auto fragmentOffset = 57099; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "symbol_sdf_icon", - programs::gl::shaderSource() + 53059, programs::gl::shaderSource() + 57099); + return std::make_unique>(programParameters); } } // namespace gfx diff --git a/src/mbgl/programs/gl/symbol_sdf_text.cpp b/src/mbgl/programs/gl/symbol_sdf_text.cpp index 0d08a64dee..81f3729d92 100644 --- a/src/mbgl/programs/gl/symbol_sdf_text.cpp +++ b/src/mbgl/programs/gl/symbol_sdf_text.cpp @@ -1,18 +1,37 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include #include #include namespace mbgl { +namespace programs { +namespace gl { + +template +struct ShaderSource; + +template <> +struct ShaderSource { + static constexpr const char* name = "symbol_sdf_text"; + static constexpr const uint8_t hash[8] = { 0x13, 0xfc, 0x05, 0x2a, 0xd1, 0x93, 0xfb, 0x7d }; + static constexpr const auto vertexOffset = 53059; + static constexpr const auto fragmentOffset = 57099; +}; + +constexpr const char* ShaderSource::name; +constexpr const uint8_t ShaderSource::hash[8]; + +} // namespace gl +} // namespace programs + namespace gfx { template <> std::unique_ptr> Context::createProgram(const ProgramParameters& programParameters) { - return gl::Program::createProgram( - reinterpret_cast(*this), programParameters, "symbol_sdf_text", - programs::gl::shaderSource() + 53059, programs::gl::shaderSource() + 57099); + return std::make_unique>(programParameters); } } // namespace gfx -- cgit v1.2.1