Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[core] remove unused dem memory #13550

Merged
merged 4 commits into from
Mar 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mapbox-gl-js
Submodule mapbox-gl-js updated 49 files
+1 −1 CHANGELOG.md
+6 −0 bench/benchmarks/expressions.js
+2 −1 debug/hillshade.html
+1 −1 debug/video.html
+59 −0 docs/pages/example/animate-camera-around-point.html
+10 −0 docs/pages/example/animate-camera-around-point.js
+1 −1 docs/pages/example/video-on-a-map.html
+4 −0 docs/pages/plugins.js
+2 −2 docs/pages/style-spec.js
+22 −4 src/data/bucket/symbol_bucket.js
+13 −20 src/data/dem_data.js
+6 −3 src/data/segment.js
+1 −1 src/geo/transform.js
+2 −1 src/render/draw_hillshade.js
+2 −2 src/render/draw_raster.js
+83 −18 src/render/draw_symbol.js
+3 −3 src/render/painter.js
+4 −4 src/render/program/hillshade_program.js
+5 −1 src/shaders/hillshade_prepare.vertex.glsl
+4 −0 src/source/tile_id.js
+26 −5 src/style-spec/CHANGELOG.md
+1 −1 src/style-spec/feature_filter/convert.js
+1 −1 src/style-spec/package.json
+22 −2 src/style-spec/reference/v8.json
+2 −1 src/style-spec/types.js
+3 −1 src/style/style_layer/symbol_style_layer_properties.js
+14 −0 src/ui/events.js
+13 −1 src/ui/map.js
+30 −6 src/util/ajax.js
+1 −10 src/util/browser.js
+2 −1 src/util/mapbox.js
+61 −0 src/util/webp_supported.js
+ test/integration/render-tests/fill-opacity/opaque-fill-over-symbol-layer/expected.png
+78 −0 test/integration/render-tests/fill-opacity/opaque-fill-over-symbol-layer/style.json
+ test/integration/render-tests/symbol-sort-key/icon-expression/expected.png
+76 −0 test/integration/render-tests/symbol-sort-key/icon-expression/style.json
+ test/integration/render-tests/symbol-sort-key/text-expression/expected.png
+87 −0 test/integration/render-tests/symbol-sort-key/text-expression/style.json
+ test/integration/render-tests/symbol-sort-key/text-placement/expected.png
+71 −0 test/integration/render-tests/symbol-sort-key/text-placement/style.json
+2 −4 test/unit/data/dem_data.test.js
+6 −0 test/unit/source/tile_id.test.js
+39 −0 test/unit/style-spec/feature_filter.test.js
+24 −0 test/unit/ui/map.test.js
+25 −1 test/unit/util/ajax.test.js
+0 −5 test/unit/util/browser.test.js
+5 −5 test/unit/util/mapbox.test.js
+1 −1 vendor/dotcom-page-shell/page-shell-script.js
+24 −18 vendor/dotcom-page-shell/react-page-shell.js
6 changes: 5 additions & 1 deletion platform/node/test/ignores.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,9 @@
"render-tests/feature-state/composite-expression": "https://github.com/mapbox/mapbox-gl-native/issues/12613",
"render-tests/feature-state/data-expression": "https://github.com/mapbox/mapbox-gl-native/issues/12613",
"render-tests/feature-state/set-paint-property": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/6263 - needs issue",
"render-tests/feature-state/vector-source": "https://github.com/mapbox/mapbox-gl-native/issues/12613"
"render-tests/feature-state/vector-source": "https://github.com/mapbox/mapbox-gl-native/issues/12613",
"render-tests/symbol-sort-key/icon-expression": "https://github.com/mapbox/mapbox-gl-native/issues/14028",
"render-tests/symbol-sort-key/text-expression": "https://github.com/mapbox/mapbox-gl-native/issues/14028",
"render-tests/symbol-sort-key/text-placement": "https://github.com/mapbox/mapbox-gl-native/issues/14028",
"render-tests/fill-opacity/opaque-fill-over-symbol-layer": "skip - port https://github.com/mapbox/mapbox-gl-js/pull/7612"
}
3 changes: 3 additions & 0 deletions scripts/style-spec.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
var spec = module.exports = require('../mapbox-gl-js/src/style-spec/reference/v8');

// Make temporary modifications here when Native doesn't have all features that JS has.
delete spec.layout_symbol['symbol-sort-key'];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: maybe worth creating backporting issue for gl-native.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete spec.layout_symbol['symbol-z-order'].values['auto'];
spec.layout_symbol['symbol-z-order'].default = 'viewport-y';
26 changes: 10 additions & 16 deletions src/mbgl/geometry/dem_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ namespace mbgl {

DEMData::DEMData(const PremultipliedImage& _image, Tileset::DEMEncoding encoding):
dim(_image.size.height),
border(std::max<int32_t>(std::ceil(_image.size.height / 2), 1)),
stride(dim + 2 * border),
// extra two pixels per row for border backfilling on either edge
stride(dim + 2),
image({ static_cast<uint32_t>(stride), static_cast<uint32_t>(stride) }) {

if (_image.size.height != _image.size.width){
Expand Down Expand Up @@ -76,22 +76,16 @@ void DEMData::backfillBorder(const DEMData& borderTileData, int8_t dx, int8_t dy
// represents. For example, dx = -1, dy = -1 represents the upper left corner of the
// base tile, so we only need to backfill one pixel at coordinates (-1, -1) of the tile
// image.
int32_t _xMin = dx * dim;
int32_t _xMax = dx * dim + dim;
int32_t _yMin = dy * dim;
int32_t _yMax = dy * dim + dim;
int32_t xMin = dx * dim;
int32_t xMax = dx * dim + dim;
int32_t yMin = dy * dim;
int32_t yMax = dy * dim + dim;

if (dx == -1) _xMin = _xMax - 1;
else if (dx == 1) _xMax = _xMin + 1;
if (dx == -1) xMin = xMax - 1;
else if (dx == 1) xMax = xMin + 1;

if (dy == -1) _yMin = _yMax - 1;
else if (dy == 1) _yMax = _yMin + 1;

int32_t xMin = util::clamp(_xMin, -border, dim + border);
int32_t xMax = util::clamp(_xMax, -border, dim + border);

int32_t yMin = util::clamp(_yMin, -border, dim + border);
int32_t yMax = util::clamp(_yMax, -border, dim + border);
if (dy == -1) yMin = yMax - 1;
else if (dy == 1) yMax = yMin + 1;

int32_t ox = -dx * dim;
int32_t oy = -dy * dim;
Expand Down
11 changes: 5 additions & 6 deletions src/mbgl/geometry/dem_data.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,18 @@ class DEMData {
}

const int32_t dim;
const int32_t border;
const int32_t stride;


private:
PremultipliedImage image;

size_t idx(const int32_t x, const int32_t y) const {
assert(x >= -border);
assert(x < dim + border);
assert(y >= -border);
assert(y < dim + border);
return (y + border) * stride + (x + border);
assert(x >= -1);
assert(x < dim + 1);
assert(y >= -1);
assert(y < dim + 1);
return (y + 1) * stride + (x + 1);
}

};
Expand Down
3 changes: 2 additions & 1 deletion src/mbgl/renderer/layers/render_hillshade_layer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ void RenderHillshadeLayer::render(PaintParameters& parameters, RenderSource* src
}

if (!bucket.isPrepared() && parameters.pass == RenderPass::Pass3D) {
const uint16_t stride = bucket.getDEMData().stride;
const uint16_t tilesize = bucket.getDEMData().dim;
OffscreenTexture view(parameters.context, { tilesize, tilesize });
view.bind();
Expand All @@ -138,7 +139,7 @@ void RenderHillshadeLayer::render(PaintParameters& parameters, RenderSource* src
const auto allUniformValues = programInstance.computeAllUniformValues(
HillshadePrepareProgram::UniformValues {
uniforms::u_matrix::Value( mat ),
uniforms::u_dimension::Value( {{uint16_t(tilesize * 2), uint16_t(tilesize * 2)}} ),
uniforms::u_dimension::Value( {{stride, stride}} ),
uniforms::u_zoom::Value( float(tile.id.canonical.z) ),
uniforms::u_maxzoom::Value( float(maxzoom) ),
uniforms::u_image::Value( 0 )
Expand Down
4 changes: 2 additions & 2 deletions src/mbgl/shaders/hillshade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ namespace mbgl {
namespace shaders {

const char* hillshade::name = "hillshade";
const char* hillshade::vertexSource = source() + 29196;
const char* hillshade::fragmentSource = source() + 29367;
const char* hillshade::vertexSource = source() + 29307;
const char* hillshade::fragmentSource = source() + 29478;

// Uncompressed source of hillshade.vertex.glsl:
/*
Expand Down
8 changes: 6 additions & 2 deletions src/mbgl/shaders/hillshade_prepare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@ namespace shaders {

const char* hillshade_prepare::name = "hillshade_prepare";
const char* hillshade_prepare::vertexSource = source() + 27892;
const char* hillshade_prepare::fragmentSource = source() + 28074;
const char* hillshade_prepare::fragmentSource = source() + 28185;

// Uncompressed source of hillshade_prepare.vertex.glsl:
/*
uniform mat4 u_matrix;
uniform vec2 u_dimension;

attribute vec2 a_pos;
attribute vec2 a_texture_pos;
Expand All @@ -21,7 +22,10 @@ varying vec2 v_pos;

void main() {
gl_Position = u_matrix * vec4(a_pos, 0, 1);
v_pos = (a_texture_pos / 8192.0) / 2.0 + 0.25;

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;
}

*/
Expand Down
4 changes: 2 additions & 2 deletions src/mbgl/shaders/line.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ namespace mbgl {
namespace shaders {

const char* line::name = "line";
const char* line::vertexSource = source() + 30441;
const char* line::fragmentSource = source() + 33365;
const char* line::vertexSource = source() + 30552;
const char* line::fragmentSource = source() + 33476;

// Uncompressed source of line.vertex.glsl:
/*
Expand Down
4 changes: 2 additions & 2 deletions src/mbgl/shaders/line_gradient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ namespace mbgl {
namespace shaders {

const char* line_gradient::name = "line_gradient";
const char* line_gradient::vertexSource = source() + 34191;
const char* line_gradient::fragmentSource = source() + 36910;
const char* line_gradient::vertexSource = source() + 34302;
const char* line_gradient::fragmentSource = source() + 37021;

// Uncompressed source of line_gradient.vertex.glsl:
/*
Expand Down
4 changes: 2 additions & 2 deletions src/mbgl/shaders/line_pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ namespace mbgl {
namespace shaders {

const char* line_pattern::name = "line_pattern";
const char* line_pattern::vertexSource = source() + 37697;
const char* line_pattern::fragmentSource = source() + 41018;
const char* line_pattern::vertexSource = source() + 37808;
const char* line_pattern::fragmentSource = source() + 41129;

// Uncompressed source of line_pattern.vertex.glsl:
/*
Expand Down
4 changes: 2 additions & 2 deletions src/mbgl/shaders/line_sdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ namespace mbgl {
namespace shaders {

const char* line_sdf::name = "line_sdf";
const char* line_sdf::vertexSource = source() + 43331;
const char* line_sdf::fragmentSource = source() + 46945;
const char* line_sdf::vertexSource = source() + 43442;
const char* line_sdf::fragmentSource = source() + 47056;

// Uncompressed source of line_sdf.vertex.glsl:
/*
Expand Down
4 changes: 2 additions & 2 deletions src/mbgl/shaders/raster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ namespace mbgl {
namespace shaders {

const char* raster::name = "raster";
const char* raster::vertexSource = source() + 48448;
const char* raster::fragmentSource = source() + 48797;
const char* raster::vertexSource = source() + 48559;
const char* raster::fragmentSource = source() + 48908;

// Uncompressed source of raster.vertex.glsl:
/*
Expand Down
Loading