1 | import { PRECISION } from '@pixi/constants';
|
2 |
|
3 | function setPrecision(src, requestedPrecision, maxSupportedPrecision) {
|
4 | if (src.substring(0, 9) !== "precision") {
|
5 | let precision = requestedPrecision;
|
6 | if (requestedPrecision === PRECISION.HIGH && maxSupportedPrecision !== PRECISION.HIGH) {
|
7 | precision = PRECISION.MEDIUM;
|
8 | }
|
9 | return `precision ${precision} float;
|
10 | ${src}`;
|
11 | } else if (maxSupportedPrecision !== PRECISION.HIGH && src.substring(0, 15) === "precision highp") {
|
12 | return src.replace("precision highp", "precision mediump");
|
13 | }
|
14 | return src;
|
15 | }
|
16 |
|
17 | export { setPrecision };
|
18 |
|