src/program.js
/**
   * Fixes an issue with shaders where the shader doesn't set a precision,
   * leading it to have a mismatch with its counterpart
   *
   * I.e. the vertex shader might set a precision, but the fragment shader
   * does not, leading to precision mismatch errors.
   * @static
   * @param  {String} shader The shader to check/fix
   * @return {String}        The fixed shader, or the original if it needed
   *                         no patching.
   */
Fixes an issue with shaders where the shader doesn't set a precision,
leading it to have a mismatch with its counterpart


Fixes an issue with shaders where the shader doesn ' t set a precision leading it to have a mismatch with its counterpart
static fixPrecision(shader)
  {
    if(/precision mediump float/g.test(shader))
    {
      return shader;
    }
    else
    {
      var lines = shader.split("\n");
      lines.splice(1, 0, "#ifdef GL_ES", "precision mediump float;", "#endif");
      return lines.join("\n");
    }
  }
static fixPrecision ( shader ) { if ( / precision mediump float / g . test ( shader ) ) { return shader ; } else { var lines = shader . split ( "\n" ) ; lines . splice ( 1 , 0 , "#ifdef GL_ES" , "precision mediump float;" , "#endif" ) ; return lines . join ( "\n" ) ; } }
Fixes an issue with shaders where the shader doesn't set a precision,
 leading it to have a mismatch with its counterpart
Fixes an issue with shaders where the shader doesn ' t set a precision leading it to have a mismatch with its counterpart