From 888a516f1fec172081c06f4d2a98c08ae13a4d93 Mon Sep 17 00:00:00 2001 From: John Firebaugh Date: Tue, 24 Jul 2018 15:40:33 -0700 Subject: [core] Compress shader source code --- src/mbgl/shaders/background_pattern.cpp | 135 +++++++++++++++++++------------- 1 file changed, 81 insertions(+), 54 deletions(-) (limited to 'src/mbgl/shaders/background_pattern.cpp') diff --git a/src/mbgl/shaders/background_pattern.cpp b/src/mbgl/shaders/background_pattern.cpp index 6fd0a53d19..83f4307bea 100644 --- a/src/mbgl/shaders/background_pattern.cpp +++ b/src/mbgl/shaders/background_pattern.cpp @@ -1,65 +1,92 @@ // NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED. #include +#include + +#include namespace mbgl { namespace shaders { const char* background_pattern::name = "background_pattern"; -const char* background_pattern::vertexSource = R"MBGL_SHADER( -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); -} - -)MBGL_SHADER"; -const char* background_pattern::fragmentSource = R"MBGL_SHADER( -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 -} - -)MBGL_SHADER"; +const char* background_pattern::vertexSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0xad, 0x91, 0x4d, 0x6e, 0xc3, 0x20, + 0x10, 0x85, 0xf7, 0x9c, 0x82, 0xa5, 0x5d, 0xb1, + 0x48, 0xa2, 0xec, 0xa2, 0xde, 0x21, 0x37, 0x40, + 0xe0, 0x60, 0x6b, 0x24, 0xc2, 0x58, 0x30, 0x38, + 0x7f, 0xca, 0xdd, 0x33, 0xd4, 0x51, 0xd2, 0xd4, + 0x6e, 0xba, 0x29, 0x1b, 0xa4, 0x6f, 0xde, 0xe8, + 0x3d, 0x1e, 0x39, 0x40, 0x8b, 0x71, 0x2f, 0xf7, + 0x86, 0xd6, 0x32, 0x6b, 0xbe, 0x22, 0x1c, 0x37, + 0x22, 0xdf, 0xf1, 0xe0, 0x9a, 0x15, 0xe3, 0xde, + 0x10, 0xb9, 0x18, 0x74, 0x82, 0xb3, 0xd3, 0xe6, + 0xfd, 0xd8, 0x4e, 0xc7, 0x70, 0x74, 0x5e, 0x37, + 0x88, 0x71, 0xa7, 0x73, 0xdf, 0xbb, 0xf8, 0x56, + 0xe1, 0xf1, 0xf0, 0x5d, 0xd1, 0x7a, 0x34, 0xc4, + 0x92, 0xd4, 0x18, 0xff, 0xe2, 0xfd, 0x3a, 0xb0, + 0xd3, 0x01, 0x01, 0x73, 0x86, 0x94, 0x34, 0xe1, + 0x68, 0x91, 0x36, 0x42, 0x70, 0xd6, 0x08, 0x36, + 0x93, 0x1b, 0xcd, 0x8d, 0xee, 0xb1, 0xe0, 0xc1, + 0xc4, 0x13, 0x84, 0x6e, 0x84, 0x43, 0x81, 0xc5, + 0x6c, 0x86, 0xda, 0x22, 0x46, 0xd8, 0x71, 0x65, + 0x10, 0xaa, 0x5a, 0x5e, 0x84, 0xe4, 0xd3, 0x79, + 0xbd, 0xc5, 0x04, 0x04, 0x18, 0xe4, 0xe7, 0xa3, + 0x48, 0xf9, 0x51, 0x36, 0xd7, 0xd5, 0x97, 0x89, + 0x92, 0x0b, 0x25, 0x97, 0x35, 0xaf, 0x97, 0x85, + 0xbb, 0x05, 0x8b, 0x3b, 0x47, 0x8f, 0x06, 0x99, + 0x55, 0x33, 0x85, 0xa9, 0xb9, 0x8e, 0xd4, 0xb3, + 0x15, 0xf6, 0xf9, 0xf9, 0x49, 0xea, 0x97, 0x06, + 0xd4, 0xf8, 0x62, 0x8e, 0xf1, 0x4c, 0x61, 0xff, + 0x25, 0x85, 0x9d, 0xa6, 0xb0, 0x7f, 0xa7, 0xb8, + 0x8a, 0x1b, 0x2c, 0x40, 0xe9, 0xd0 + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); +const char* background_pattern::fragmentSource = [] () { + static const uint8_t compressed[] = { + 0x78, 0xda, 0x7d, 0x91, 0x41, 0x4f, 0x84, 0x30, + 0x10, 0x85, 0xef, 0xfd, 0x15, 0x93, 0xec, 0x05, + 0x0c, 0x51, 0xb7, 0xf1, 0x46, 0x3c, 0x98, 0x65, + 0x4d, 0xbc, 0xb8, 0x06, 0x8d, 0x1e, 0x9b, 0x16, + 0x0a, 0x69, 0x42, 0x29, 0x29, 0x65, 0xc3, 0x6a, + 0xfc, 0xef, 0xb6, 0x0b, 0x4a, 0x90, 0x2e, 0x3d, + 0xce, 0x7b, 0x7d, 0xf3, 0xcd, 0x4c, 0x57, 0x8b, + 0x42, 0x69, 0x09, 0x47, 0x9e, 0x61, 0xe8, 0x48, + 0x43, 0x8d, 0xe1, 0xba, 0x26, 0xa6, 0x22, 0x34, + 0x46, 0x9d, 0x5f, 0x64, 0x7a, 0x45, 0xb4, 0x3f, + 0xd9, 0xda, 0xcf, 0xa5, 0x68, 0x78, 0xdf, 0x8a, + 0x4f, 0x3e, 0xd5, 0x8b, 0x4a, 0x51, 0x63, 0x05, + 0x29, 0xfa, 0x65, 0x51, 0x35, 0x34, 0x13, 0xe6, + 0x14, 0xa3, 0x3f, 0xa5, 0xa5, 0xb2, 0xa9, 0xb8, + 0xc6, 0x89, 0x55, 0x85, 0xa4, 0xa5, 0x4d, 0x42, + 0x47, 0xaa, 0x4f, 0xa2, 0x2e, 0x87, 0x16, 0x47, + 0xd2, 0xa8, 0xd6, 0x21, 0x7b, 0xaa, 0xcc, 0x99, + 0x95, 0xc8, 0x41, 0x52, 0x51, 0x07, 0x21, 0x7c, + 0x21, 0xb0, 0xef, 0x6c, 0x38, 0x67, 0x65, 0x4a, + 0xe9, 0x1c, 0xee, 0x41, 0xaa, 0x3c, 0x18, 0x73, + 0x22, 0xd8, 0x5e, 0xdf, 0x86, 0xf1, 0x64, 0xb4, + 0x55, 0xe7, 0x10, 0x7d, 0x30, 0x5f, 0x20, 0xdc, + 0x4c, 0xd3, 0x45, 0xff, 0xf6, 0x37, 0xd7, 0xa6, + 0x56, 0x53, 0xee, 0x1d, 0x64, 0xaa, 0x52, 0x7a, + 0x6b, 0xa3, 0xad, 0xcf, 0x74, 0x9a, 0xe3, 0x24, + 0x18, 0x27, 0x8c, 0x5c, 0x4f, 0x6b, 0xf5, 0xc1, + 0x12, 0x36, 0xc3, 0x65, 0x3e, 0x5c, 0xec, 0xe3, + 0x65, 0x2b, 0xbc, 0xec, 0x12, 0x2f, 0x61, 0x0b, + 0x62, 0x7c, 0x91, 0x18, 0xff, 0x22, 0x97, 0x15, + 0x79, 0xd4, 0xb4, 0xdc, 0x39, 0xfb, 0x88, 0x32, + 0x0c, 0x1b, 0x8d, 0x11, 0xd1, 0x70, 0xfe, 0x10, + 0xae, 0x66, 0x27, 0xdf, 0x88, 0x22, 0xe7, 0x05, + 0x1c, 0xde, 0xf7, 0x69, 0x92, 0x3e, 0x7c, 0x90, + 0xa7, 0xe7, 0xd7, 0x97, 0xfd, 0xee, 0xed, 0x90, + 0xfa, 0x52, 0x1d, 0x51, 0x30, 0xcc, 0xbe, 0xe1, + 0x75, 0x2e, 0x0a, 0xf4, 0x8d, 0x7e, 0x00, 0x79, + 0xe0, 0xfb, 0xaf + }; + static std::string decompressed = util::decompress(std::string(reinterpret_cast(compressed), sizeof(compressed))); + return decompressed.c_str(); +}(); } // namespace shaders } // namespace mbgl -- cgit v1.2.1