summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--platform/node/test/ignores.json3
-rw-r--r--src/mbgl/renderer/buckets/raster_bucket.cpp13
-rw-r--r--src/mbgl/renderer/render_static_data.cpp6
-rw-r--r--src/mbgl/renderer/sources/render_image_source.cpp7
-rw-r--r--src/mbgl/shaders/debug.cpp7
-rw-r--r--src/mbgl/shaders/raster.cpp7
-rw-r--r--test/gl/bucket.test.cpp62
7 files changed, 57 insertions, 48 deletions
diff --git a/platform/node/test/ignores.json b/platform/node/test/ignores.json
index 470e84bedb..8866e13742 100644
--- a/platform/node/test/ignores.json
+++ b/platform/node/test/ignores.json
@@ -42,6 +42,9 @@
"render-tests/icon-text-fit/height": "https://github.com/mapbox/mapbox-gl-native/issues/5602",
"render-tests/icon-text-fit/width-padding": "https://github.com/mapbox/mapbox-gl-native/issues/5602",
"render-tests/icon-text-fit/width": "https://github.com/mapbox/mapbox-gl-native/issues/5602",
+ "render-tests/line-width/property-function": "https://github.com/mapbox/mapbox-gl-js/issues/3682#issuecomment-264348200",
+ "render-tests/line-join/property-function": "https://github.com/mapbox/mapbox-gl-js/pull/5020",
+ "render-tests/line-join/property-function-dasharray": "https://github.com/mapbox/mapbox-gl-js/pull/5020",
"render-tests/regressions/mapbox-gl-js#2305": "https://github.com/mapbox/mapbox-gl-native/issues/6927",
"render-tests/regressions/mapbox-gl-js#3010": "skip - needs issue",
"render-tests/regressions/mapbox-gl-js#3548": "skip - needs issue",
diff --git a/src/mbgl/renderer/buckets/raster_bucket.cpp b/src/mbgl/renderer/buckets/raster_bucket.cpp
index 1a0409f456..a66dd42d74 100644
--- a/src/mbgl/renderer/buckets/raster_bucket.cpp
+++ b/src/mbgl/renderer/buckets/raster_bucket.cpp
@@ -69,16 +69,11 @@ void RasterBucket::setMask(TileMask&& mask_) {
for (const auto& id : mask) {
// Create a quad for every masked tile.
const int32_t vertexExtent = util::EXTENT >> id.z;
- const int32_t textureExtent = 32768 >> id.z;
const Point<int16_t> tlVertex = { static_cast<int16_t>(id.x * vertexExtent),
static_cast<int16_t>(id.y * vertexExtent) };
const Point<int16_t> brVertex = { static_cast<int16_t>(tlVertex.x + vertexExtent),
static_cast<int16_t>(tlVertex.y + vertexExtent) };
- const Point<uint16_t> tlTexture = { static_cast<uint16_t>(id.x * textureExtent),
- static_cast<uint16_t>(id.y * textureExtent) };
- const Point<uint16_t> brTexture = { static_cast<uint16_t>(tlTexture.x + textureExtent),
- static_cast<uint16_t>(tlTexture.y + textureExtent) };
if (segments.back().vertexLength + vertexLength > std::numeric_limits<uint16_t>::max()) {
// Move to a new segments because the old one can't hold the geometry.
@@ -86,13 +81,13 @@ void RasterBucket::setMask(TileMask&& mask_) {
}
vertices.emplace_back(
- RasterProgram::layoutVertex({ tlVertex.x, tlVertex.y }, { tlTexture.x, tlTexture.y }));
+ RasterProgram::layoutVertex({ tlVertex.x, tlVertex.y }, { static_cast<uint16_t>(tlVertex.x), static_cast<uint16_t>(tlVertex.y) }));
vertices.emplace_back(
- RasterProgram::layoutVertex({ brVertex.x, tlVertex.y }, { brTexture.x, tlTexture.y }));
+ RasterProgram::layoutVertex({ brVertex.x, tlVertex.y }, { static_cast<uint16_t>(brVertex.x), static_cast<uint16_t>(tlVertex.y) }));
vertices.emplace_back(
- RasterProgram::layoutVertex({ tlVertex.x, brVertex.y }, { tlTexture.x, brTexture.y }));
+ RasterProgram::layoutVertex({ tlVertex.x, brVertex.y }, { static_cast<uint16_t>(tlVertex.x), static_cast<uint16_t>(brVertex.y) }));
vertices.emplace_back(
- RasterProgram::layoutVertex({ brVertex.x, brVertex.y }, { brTexture.x, brTexture.y }));
+ RasterProgram::layoutVertex({ brVertex.x, brVertex.y }, { static_cast<uint16_t>(brVertex.x), static_cast<uint16_t>(brVertex.y) }));
auto& segment = segments.back();
assert(segment.vertexLength <= std::numeric_limits<uint16_t>::max());
diff --git a/src/mbgl/renderer/render_static_data.cpp b/src/mbgl/renderer/render_static_data.cpp
index 4c6028d7b6..ccf239e643 100644
--- a/src/mbgl/renderer/render_static_data.cpp
+++ b/src/mbgl/renderer/render_static_data.cpp
@@ -32,9 +32,9 @@ static gl::IndexVector<gl::LineStrip> tileLineStripIndices() {
static gl::VertexVector<RasterLayoutVertex> rasterVertices() {
gl::VertexVector<RasterLayoutVertex> result;
result.emplace_back(RasterProgram::layoutVertex({ 0, 0 }, { 0, 0 }));
- result.emplace_back(RasterProgram::layoutVertex({ util::EXTENT, 0 }, { 32767, 0 }));
- result.emplace_back(RasterProgram::layoutVertex({ 0, util::EXTENT }, { 0, 32767 }));
- result.emplace_back(RasterProgram::layoutVertex({ util::EXTENT, util::EXTENT }, { 32767, 32767 }));
+ result.emplace_back(RasterProgram::layoutVertex({ util::EXTENT, 0 }, { util::EXTENT, 0 }));
+ result.emplace_back(RasterProgram::layoutVertex({ 0, util::EXTENT }, { 0, util::EXTENT }));
+ result.emplace_back(RasterProgram::layoutVertex({ util::EXTENT, util::EXTENT }, { util::EXTENT, util::EXTENT }));
return result;
}
diff --git a/src/mbgl/renderer/sources/render_image_source.cpp b/src/mbgl/renderer/sources/render_image_source.cpp
index 11ff8c26b1..50d5b17ec2 100644
--- a/src/mbgl/renderer/sources/render_image_source.cpp
+++ b/src/mbgl/renderer/sources/render_image_source.cpp
@@ -10,6 +10,7 @@
#include <mbgl/util/tile_coordinate.hpp>
#include <mbgl/util/tile_cover.hpp>
#include <mbgl/util/logging.hpp>
+#include <mbgl/util/constants.hpp>
namespace mbgl {
@@ -193,11 +194,11 @@ void RenderImageSource::update(Immutable<style::Source::Impl> baseImpl_,
bucket->vertices.emplace_back(
RasterProgram::layoutVertex({ geomCoords[0].x, geomCoords[0].y }, { 0, 0 }));
bucket->vertices.emplace_back(
- RasterProgram::layoutVertex({ geomCoords[1].x, geomCoords[1].y }, { 32767, 0 }));
+ RasterProgram::layoutVertex({ geomCoords[1].x, geomCoords[1].y }, { util::EXTENT, 0 }));
bucket->vertices.emplace_back(
- RasterProgram::layoutVertex({ geomCoords[3].x, geomCoords[3].y }, { 0, 32767 }));
+ RasterProgram::layoutVertex({ geomCoords[3].x, geomCoords[3].y }, { 0, util::EXTENT }));
bucket->vertices.emplace_back(
- RasterProgram::layoutVertex({ geomCoords[2].x, geomCoords[2].y }, { 32767, 32767 }));
+ RasterProgram::layoutVertex({ geomCoords[2].x, geomCoords[2].y }, { util::EXTENT, util::EXTENT }));
bucket->indices.emplace_back(0, 1, 2);
bucket->indices.emplace_back(1, 2, 3);
diff --git a/src/mbgl/shaders/debug.cpp b/src/mbgl/shaders/debug.cpp
index d39dcf25be..d18f3be5d1 100644
--- a/src/mbgl/shaders/debug.cpp
+++ b/src/mbgl/shaders/debug.cpp
@@ -12,7 +12,12 @@ attribute vec2 a_pos;
uniform mat4 u_matrix;
void main() {
- gl_Position = u_matrix * vec4(a_pos, step(32767.0, a_pos.x), 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.
+ gl_Position = u_matrix * vec4(a_pos, step(8192.0, a_pos.x), 1);
}
)MBGL_SHADER";
diff --git a/src/mbgl/shaders/raster.cpp b/src/mbgl/shaders/raster.cpp
index f454078310..98291bfec6 100644
--- a/src/mbgl/shaders/raster.cpp
+++ b/src/mbgl/shaders/raster.cpp
@@ -20,7 +20,12 @@ varying vec2 v_pos1;
void main() {
gl_Position = u_matrix * vec4(a_pos, 0, 1);
- v_pos0 = (((a_texture_pos / 32767.0) - 0.5) / u_buffer_scale ) + 0.5;
+ // 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;
}
diff --git a/test/gl/bucket.test.cpp b/test/gl/bucket.test.cpp
index afdbd2a29b..5f9626bc99 100644
--- a/test/gl/bucket.test.cpp
+++ b/test/gl/bucket.test.cpp
@@ -164,15 +164,15 @@ TEST(Buckets, RasterBucketMaskNoChildren) {
(std::vector<RasterLayoutVertex>{
// 1/0/1
RasterProgram::layoutVertex({ 0, 0 }, { 0, 0 }),
- RasterProgram::layoutVertex({ 4096, 0 }, { 16384, 0 }),
- RasterProgram::layoutVertex({ 0, 4096 }, { 0, 16384 }),
- RasterProgram::layoutVertex({ 4096, 4096 }, { 16384, 16384 }),
+ RasterProgram::layoutVertex({ 4096, 0 }, { 4096, 0 }),
+ RasterProgram::layoutVertex({ 0, 4096 }, { 0, 4096 }),
+ RasterProgram::layoutVertex({ 4096, 4096 }, { 4096, 4096 }),
// 1/1/1
- RasterProgram::layoutVertex({ 4096, 4096 }, { 16384, 16384 }),
- RasterProgram::layoutVertex({ 8192, 4096 }, { 32768, 16384 }),
- RasterProgram::layoutVertex({ 4096, 8192 }, { 16384, 32768 }),
- RasterProgram::layoutVertex({ 8192, 8192 }, { 32768, 32768 }),
+ RasterProgram::layoutVertex({ 4096, 4096 }, { 4096, 4096 }),
+ RasterProgram::layoutVertex({ 8192, 4096 }, { 8192, 4096 }),
+ RasterProgram::layoutVertex({ 4096, 8192 }, { 4096, 8192 }),
+ RasterProgram::layoutVertex({ 8192, 8192 }, { 8192, 8192 }),
}),
bucket.vertices.vector());
@@ -203,40 +203,40 @@ TEST(Buckets, RasterBucketMaskNoChildren) {
EXPECT_EQ(
(std::vector<RasterLayoutVertex>{
// 1/0/1
- RasterProgram::layoutVertex({ 0, 4096 }, { 0, 16384 }),
- RasterProgram::layoutVertex({ 4096, 4096 }, { 16384, 16384 }),
- RasterProgram::layoutVertex({ 0, 8192 }, { 0, 32768 }),
- RasterProgram::layoutVertex({ 4096, 8192 }, { 16384, 32768 }),
+ RasterProgram::layoutVertex({ 0, 4096 }, { 0, 4096 }),
+ RasterProgram::layoutVertex({ 4096, 4096 }, { 4096, 4096 }),
+ RasterProgram::layoutVertex({ 0, 8192 }, { 0, 8192 }),
+ RasterProgram::layoutVertex({ 4096, 8192 }, { 4096, 8192 }),
// 1/1/0
- RasterProgram::layoutVertex({ 4096, 0 }, { 16384, 0 }),
- RasterProgram::layoutVertex({ 8192, 0 }, { 32768, 0 }),
- RasterProgram::layoutVertex({ 4096, 4096 }, { 16384, 16384 }),
- RasterProgram::layoutVertex({ 8192, 4096 }, { 32768, 16384 }),
+ RasterProgram::layoutVertex({ 4096, 0 }, { 4096, 0 }),
+ RasterProgram::layoutVertex({ 8192, 0 }, { 8192, 0 }),
+ RasterProgram::layoutVertex({ 4096, 4096 }, { 4096, 4096 }),
+ RasterProgram::layoutVertex({ 8192, 4096 }, { 8192, 4096 }),
// 2/2/3
- RasterProgram::layoutVertex({ 4096, 6144 }, { 16384, 24576 }),
- RasterProgram::layoutVertex({ 6144, 6144 }, { 24576, 24576 }),
- RasterProgram::layoutVertex({ 4096, 8192 }, { 16384, 32768 }),
- RasterProgram::layoutVertex({ 6144, 8192 }, { 24576, 32768 }),
+ RasterProgram::layoutVertex({ 4096, 6144 }, { 4096, 6144 }),
+ RasterProgram::layoutVertex({ 6144, 6144 }, { 6144, 6144 }),
+ RasterProgram::layoutVertex({ 4096, 8192 }, { 4096, 8192 }),
+ RasterProgram::layoutVertex({ 6144, 8192 }, { 6144, 8192 }),
// 2/3/2
- RasterProgram::layoutVertex({ 6144, 4096 }, { 24576, 16384 }),
- RasterProgram::layoutVertex({ 8192, 4096 }, { 32768, 16384 }),
- RasterProgram::layoutVertex({ 6144, 6144 }, { 24576, 24576 }),
- RasterProgram::layoutVertex({ 8192, 6144 }, { 32768, 24576 }),
+ RasterProgram::layoutVertex({ 6144, 4096 }, { 6144, 4096 }),
+ RasterProgram::layoutVertex({ 8192, 4096 }, { 8192, 4096 }),
+ RasterProgram::layoutVertex({ 6144, 6144 }, { 6144, 6144 }),
+ RasterProgram::layoutVertex({ 8192, 6144 }, { 8192, 6144 }),
// 3/6/7
- RasterProgram::layoutVertex({ 6144, 7168 }, { 24576, 28672 }),
- RasterProgram::layoutVertex({ 7168, 7168 }, { 28672, 28672 }),
- RasterProgram::layoutVertex({ 6144, 8192 }, { 24576, 32768 }),
- RasterProgram::layoutVertex({ 7168, 8192 }, { 28672, 32768 }),
+ RasterProgram::layoutVertex({ 6144, 7168 }, { 6144, 7168 }),
+ RasterProgram::layoutVertex({ 7168, 7168 }, { 7168, 7168 }),
+ RasterProgram::layoutVertex({ 6144, 8192 }, { 6144, 8192 }),
+ RasterProgram::layoutVertex({ 7168, 8192 }, { 7168, 8192 }),
// 3/7/6
- RasterProgram::layoutVertex({ 7168, 6144 }, { 28672, 24576 }),
- RasterProgram::layoutVertex({ 8192, 6144 }, { 32768, 24576 }),
- RasterProgram::layoutVertex({ 7168, 7168 }, { 28672, 28672 }),
- RasterProgram::layoutVertex({ 8192, 7168 }, { 32768, 28672 }),
+ RasterProgram::layoutVertex({ 7168, 6144 }, { 7168, 6144 }),
+ RasterProgram::layoutVertex({ 8192, 6144 }, { 8192, 6144 }),
+ RasterProgram::layoutVertex({ 7168, 7168 }, { 7168, 7168 }),
+ RasterProgram::layoutVertex({ 8192, 7168 }, { 8192, 7168 }),
}),
bucket.vertices.vector());