From 1d03d916a28b55f811fc859b01ec5c16ebb69836 Mon Sep 17 00:00:00 2001 From: Vladimir Agafonkin Date: Thu, 11 Jun 2015 14:41:02 -0400 Subject: [PATCH] only use highp in mobile browsers --- js/render/gl_util.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/js/render/gl_util.js b/js/render/gl_util.js index a2c58f278fd..207c9a05d89 100644 --- a/js/render/gl_util.js +++ b/js/render/gl_util.js @@ -18,7 +18,14 @@ exports.extend = function(context) { } var shader = this.createShader(type); - this.shaderSource(shader, shaders[name][kind]); + var shaderSource = shaders[name][kind]; + + if (typeof orientation === 'undefined') { + // only use highp precision on mobile browsers + shaderSource = shaderSource.replace(/ highp /g, ' '); + } + + this.shaderSource(shader, shaderSource); this.compileShader(shader); if (!this.getShaderParameter(shader, this.COMPILE_STATUS)) { throw new Error(this.getShaderInfoLog(shader));