Source: dependencies/pixi-gl-core/shader/setPrecision.js

dependencies/pixi-gl-core/shader/setPrecision.js

  1. /**
  2. * Sets the float precision on the shader. If the precision is already present this function will do nothing
  3. * @param {string} src the shader source
  4. * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'.
  5. *
  6. * @return {string} modified shader source
  7. */
  8. var setPrecision = function(src, precision)
  9. {
  10. if(src.substring(0, 9) !== 'precision')
  11. {
  12. return 'precision ' + precision + ' float;\n' + src;
  13. }
  14. return src;
  15. };
  16. module.exports = setPrecision;