diff options
author | Molly Lloyd <mollymerp@users.noreply.github.com> | 2017-07-27 14:54:03 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-27 14:54:03 -0700 |
commit | ba7574ec51e2cfd4a55565d5a8337c47f1784bc2 (patch) | |
tree | c9f36f4b0a0ec24228b5ff39aac082252e9d8e21 /src/mbgl/shaders | |
parent | 175e7e26e2008d1e55664bd1064536c23b6de86a (diff) | |
download | qtlocation-mapboxgl-ba7574ec51e2cfd4a55565d5a8337c47f1784bc2.tar.gz |
[core] modify texture coordinate scaling (#9153)
ignore unsupported dds property tests
fix tests
remove unneeded texture extent variable
bump gl-js to master
Diffstat (limited to 'src/mbgl/shaders')
-rw-r--r-- | src/mbgl/shaders/debug.cpp | 7 | ||||
-rw-r--r-- | src/mbgl/shaders/raster.cpp | 7 |
2 files changed, 12 insertions, 2 deletions
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; } |