Files
il/resources/public/js/cljs-runtime/module$node_modules$pixi_DOT_js$lib$rendering$batcher$gl$utils$checkMaxIfStatementsInShader.js
2026-07-01 22:38:29 -06:00

31 lines
1.3 KiB
JavaScript

shadow$provide.module$node_modules$pixi_DOT_js$lib$rendering$batcher$gl$utils$checkMaxIfStatementsInShader = function(global, require, module, exports) {
exports.checkMaxIfStatementsInShader = function(maxIfs, gl) {
if (0 === maxIfs) {
throw Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");
}
const shader = gl.createShader(gl.FRAGMENT_SHADER);
try {
for (;;) {
var JSCompiler_temp_const = "precision mediump float;\nvoid main(void){\nfloat test \x3d 0.1;\n%forloop%\ngl_FragColor \x3d vec4(0.0);\n}".replace;
let src = "";
for (let i = 0; i < maxIfs; ++i) {
0 < i && (src += "\nelse "), i < maxIfs - 1 && (src += `if(test == ${i}.0){}`);
}
const fragmentSrc = JSCompiler_temp_const.call("precision mediump float;\nvoid main(void){\nfloat test \x3d 0.1;\n%forloop%\ngl_FragColor \x3d vec4(0.0);\n}", /%forloop%/gi, src);
gl.shaderSource(shader, fragmentSrc);
gl.compileShader(shader);
if (gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
break;
} else {
maxIfs = maxIfs / 2 | 0;
}
}
} finally {
gl.deleteShader(shader);
}
return maxIfs;
};
};
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$rendering$batcher$gl$utils$checkMaxIfStatementsInShader.js.map