MCPcopy Index your code
hub / github.com/gpujs/gpu.js / getVariablePrecisionString

Method getVariablePrecisionString

src/backend/gl/kernel.js:967–994  ·  view source on GitHub ↗
(textureSize = this.texSize, tactic = this.tactic, isInt = false)

Source from the content-addressed store, hash-verified

965 }
966 }
967 getVariablePrecisionString(textureSize = this.texSize, tactic = this.tactic, isInt = false) {
968 if (!tactic) {
969 if (!this.constructor.features.isSpeedTacticSupported) return 'highp';
970 const low = this.constructor.features[isInt ? 'lowIntPrecision' : 'lowFloatPrecision'];
971 const medium = this.constructor.features[isInt ? 'mediumIntPrecision' : 'mediumFloatPrecision'];
972 const high = this.constructor.features[isInt ? 'highIntPrecision' : 'highFloatPrecision'];
973 const requiredSize = Math.log2(textureSize[0] * textureSize[1]);
974 if (requiredSize <= low.rangeMax) {
975 return 'lowp';
976 } else if (requiredSize <= medium.rangeMax) {
977 return 'mediump';
978 } else if (requiredSize <= high.rangeMax) {
979 return 'highp';
980 } else {
981 throw new Error(`The required size exceeds that of the ability of your system`);
982 }
983 }
984 switch (tactic) {
985 case 'speed':
986 return 'lowp';
987 case 'balanced':
988 return 'mediump';
989 case 'precision':
990 return 'highp';
991 default:
992 throw new Error(`Unknown tactic "${tactic}" use "speed", "balanced", "precision", or empty for auto`);
993 }
994 }
995
996 /**
997 *

Callers 6

setOutputMethod · 0.95
getSignatureMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected