UNPKG

pixi-gl-core

Version:

A set of tidy little pixi objects that make working with WebGL simpler

19 lines (16 loc) 531 B
/** * Sets the float precision on the shader. If the precision is already present this function will do nothing * @param {string} src the shader source * @param {string} precision The float precision of the shader. Options are 'lowp', 'mediump' or 'highp'. * * @return {string} modified shader source */ var setPrecision = function(src, precision) { if(src.substring(0, 9) !== 'precision') { return 'precision ' + precision + ' float;\n' + src; } return src; }; module.exports = setPrecision;