diff --git a/src/mbgl/programs/hillshade_prepare_program.hpp b/src/mbgl/programs/hillshade_prepare_program.hpp index 5fc0c86a0ec..0f31a22df5f 100644 --- a/src/mbgl/programs/hillshade_prepare_program.hpp +++ b/src/mbgl/programs/hillshade_prepare_program.hpp @@ -9,7 +9,7 @@ namespace mbgl { namespace uniforms { -MBGL_DEFINE_UNIFORM_VECTOR(float, 2, u_dimension); +MBGL_DEFINE_UNIFORM_VECTOR(uint16_t, 2, u_dimension); } // namespace uniforms class HillshadePrepareProgram : public Program< diff --git a/src/mbgl/renderer/layers/render_hillshade_layer.cpp b/src/mbgl/renderer/layers/render_hillshade_layer.cpp index 11567a8ba5d..1ab152e6a61 100644 --- a/src/mbgl/renderer/layers/render_hillshade_layer.cpp +++ b/src/mbgl/renderer/layers/render_hillshade_layer.cpp @@ -97,7 +97,8 @@ void RenderHillshadeLayer::render(PaintParameters& parameters, RenderSource*) { if (!bucket.hasData()) continue; if (!bucket.isPrepared() && parameters.pass == RenderPass::Pass3D) { - OffscreenTexture view(parameters.context, { 256, 256 }); + const uint16_t tilesize = bucket.getDEMData().level.dim; + OffscreenTexture view(parameters.context, { tilesize, tilesize }); view.bind(); parameters.context.bindTexture(*bucket.dem, 0, gl::TextureFilter::Nearest, gl::TextureMipMap::No, gl::TextureWrap::Clamp, gl::TextureWrap::Clamp); @@ -115,7 +116,7 @@ void RenderHillshadeLayer::render(PaintParameters& parameters, RenderSource*) { parameters.colorModeForRenderPass(), HillshadePrepareProgram::UniformValues { uniforms::u_matrix::Value { mat }, - uniforms::u_dimension::Value { {{512, 512 }} }, + uniforms::u_dimension::Value { {{uint16_t(tilesize * 2), uint16_t(tilesize * 2) }} }, uniforms::u_zoom::Value{ float(tile.id.canonical.z) }, uniforms::u_image::Value{ 0 } }, diff --git a/src/mbgl/renderer/sources/render_raster_dem_source.cpp b/src/mbgl/renderer/sources/render_raster_dem_source.cpp index 3a004ec5951..ff394bac8e5 100644 --- a/src/mbgl/renderer/sources/render_raster_dem_source.cpp +++ b/src/mbgl/renderer/sources/render_raster_dem_source.cpp @@ -77,7 +77,7 @@ void RenderRasterDEMSource::onTileChanged(Tile& tile){ if (tile.isRenderable() && demtile.neighboringTiles != DEMTileNeighbors::Complete) { const CanonicalTileID canonical = tile.id.canonical; - const uint dim = std::pow(2, canonical.z); + const uint16_t dim = std::pow(2, canonical.z); const uint32_t px = (canonical.x - 1 + dim) % dim; const int pxw = canonical.x == 0 ? tile.id.wrap - 1 : tile.id.wrap; const uint32_t nx = (canonical.x + 1 + dim) % dim; diff --git a/src/mbgl/util/mapbox.cpp b/src/mbgl/util/mapbox.cpp index 802b527a267..cdd51a293d5 100644 --- a/src/mbgl/util/mapbox.cpp +++ b/src/mbgl/util/mapbox.cpp @@ -133,7 +133,7 @@ canonicalizeTileURL(const std::string& str, const style::SourceType type, const std::string result = "mapbox://tiles/"; result.append(str, path.directory.first + versionLen, path.directory.second - versionLen); result.append(str, path.filename.first, path.filename.second); - if (type == style::SourceType::Raster) { + if (type == style::SourceType::Raster || type == style::SourceType::RasterDEM) { result += tileSize == util::tileSize ? "@2x" : "{ratio}"; }