diff --git a/drape/shaders/font_vertex_shader.vsh b/drape/shaders/font_vertex_shader.vsh index 6d2f79fcf5..ff37d94acb 100755 --- a/drape/shaders/font_vertex_shader.vsh +++ b/drape/shaders/font_vertex_shader.vsh @@ -11,10 +11,10 @@ varying lowp vec4 v_color; varying lowp vec4 v_outline_color; void main() -{ +{ gl_Position = (vec4(a_position.zw, 0, 0) + (vec4(a_position.xy, a_texcoord.w, 1) * modelView)) * projection; v_texcoord = a_texcoord.xyz; v_color = a_color; v_outline_color = a_outline_color; -} +} diff --git a/drape/shaders/line_fragment_shader.fsh b/drape/shaders/line_fragment_shader.fsh index 498f260e40..2fc883dba5 100644 --- a/drape/shaders/line_fragment_shader.fsh +++ b/drape/shaders/line_fragment_shader.fsh @@ -1,14 +1,19 @@ -varying highp float v_dx; -varying highp vec4 v_radius; -varying highp vec4 v_centres; -varying highp vec2 v_type; +#ifdef GL_FRAGMENT_PRECISION_HIGH + #define MAXPREC highp +#else + #define MAXPREC mediump +#endif +varying MAXPREC float v_dx; +varying MAXPREC vec4 v_radius; +varying MAXPREC vec4 v_centres; +varying MAXPREC vec2 v_type; varying lowp vec4 baseColor; varying lowp vec4 outlineColor; -void sphere_join(highp float gip2) +void sphere_join(MAXPREC float gip2) { - highp float r = v_radius.y; + MAXPREC float r = v_radius.y; gl_FragColor = baseColor; if (gip2 > v_radius.w * v_radius.w) { @@ -31,12 +36,12 @@ void sphere_join(highp float gip2) void main(void) { - highp float r = v_radius.y; - highp float dist = abs(v_radius.x); + MAXPREC float r = v_radius.y; + MAXPREC float dist = abs(v_radius.x); gl_FragColor = baseColor; if (v_type.x > 0.5) { - highp float coord = (v_dx + 1.0) * v_radius.y / 2.0; + MAXPREC float coord = (v_dx + 1.0) * v_radius.y / 2.0; if (v_type.y > 0.5) { if (coord > v_radius.w) @@ -63,11 +68,11 @@ void main(void) } else if (v_type.x < -0.5) { - highp float y = (v_dx + 1.0) * v_radius.y / 2.0; + MAXPREC float y = (v_dx + 1.0) * v_radius.y / 2.0; if (v_type.y < 0.5) y = v_radius.y - (v_dx + 1.0) * v_radius.y / 2.0; - highp float sq = dist*dist + y*y; + MAXPREC float sq = dist*dist + y*y; if (sq >= v_radius.y * v_radius.y) discard; if (sq > v_radius.w * v_radius.w) @@ -83,8 +88,8 @@ void main(void) { if (v_dx >= 1.0) { - highp float y = (v_dx - 1.0) * v_radius.z / 2.0; - highp float gip2 = dist*dist + y*y; + MAXPREC float y = (v_dx - 1.0) * v_radius.z / 2.0; + MAXPREC float gip2 = dist*dist + y*y; if(gip2 > v_radius.y * v_radius.y) discard; else @@ -92,8 +97,8 @@ void main(void) } else if (v_dx <= -1.0) { - highp float y = (v_dx + 1.0) * v_radius.z / 2.0; - highp float gip2 = dist*dist + y*y; + MAXPREC float y = (v_dx + 1.0) * v_radius.z / 2.0; + MAXPREC float gip2 = dist*dist + y*y; if(gip2 > v_radius.y * v_radius.y) discard; else diff --git a/drape/shaders/texturing_fragment_shader.fsh b/drape/shaders/texturing_fragment_shader.fsh index 679dec7247..462b5fb1ee 100644 --- a/drape/shaders/texturing_fragment_shader.fsh +++ b/drape/shaders/texturing_fragment_shader.fsh @@ -1,6 +1,11 @@ +#ifdef GL_FRAGMENT_PRECISION_HIGH + #define MAXPREC highp +#else + #define MAXPREC mediump +#endif uniform sampler2D u_textures[8]; varying lowp vec2 v_texCoords; -varying highp float v_textureIndex; +varying MAXPREC float v_textureIndex; const int Index0 = 0; const int Index1 = 1;