Files
il/resources/public/js/cljs-runtime/module$node_modules$pixi_DOT_js$lib$rendering$high_shader$compiler$compileHighShader.js
2026-07-01 22:38:29 -06:00

47 lines
2.8 KiB
JavaScript

shadow$provide.module$node_modules$pixi_DOT_js$lib$rendering$high_shader$compiler$compileHighShader = function(global, require, module, exports) {
function compileInputsAndOutputs(template, bits) {
const vertexFragments = bits.map(shaderBit => shaderBit.vertex).filter(v => !!v), fragmentFragments = bits.map(shaderBit => shaderBit.fragment).filter(v => !!v);
bits = compileInputs.compileInputs(vertexFragments, template.vertex, !0);
bits = compileOutputs.compileOutputs(vertexFragments, bits);
template = compileInputs.compileInputs(fragmentFragments, template.fragment, !0);
return {vertex:bits, fragment:template};
}
function generateCacheId(template, bits) {
return bits.map(highFragment => {
bitCacheMap.has(highFragment) || bitCacheMap.set(highFragment, CACHE_UID++);
return bitCacheMap.get(highFragment);
}).sort((a, b) => a - b).join("-") + template.vertex + template.fragment;
}
function compileBits(vertex, fragment, bits) {
const vertexParts = compileHooks.compileHooks(vertex), fragmentParts = compileHooks.compileHooks(fragment);
bits.forEach(shaderBit => {
addBits.addBits(shaderBit.vertex, vertexParts, shaderBit.name);
addBits.addBits(shaderBit.fragment, fragmentParts, shaderBit.name);
});
return {vertex:injectBits.injectBits(vertex, vertexParts), fragment:injectBits.injectBits(fragment, fragmentParts)};
}
var addBits = require("module$node_modules$pixi_DOT_js$lib$rendering$high_shader$compiler$utils$addBits"), compileHooks = require("module$node_modules$pixi_DOT_js$lib$rendering$high_shader$compiler$utils$compileHooks"), compileInputs = require("module$node_modules$pixi_DOT_js$lib$rendering$high_shader$compiler$utils$compileInputs"), compileOutputs = require("module$node_modules$pixi_DOT_js$lib$rendering$high_shader$compiler$utils$compileOutputs"), injectBits = require("module$node_modules$pixi_DOT_js$lib$rendering$high_shader$compiler$utils$injectBits");
"use strict";
const cacheMap = Object.create(null), bitCacheMap = new Map();
let CACHE_UID = 0;
exports.compileHighShader = function({template, bits}) {
const cacheId = generateCacheId(template, bits);
if (cacheMap[cacheId]) {
return cacheMap[cacheId];
}
const {vertex, fragment} = compileInputsAndOutputs(template, bits);
cacheMap[cacheId] = compileBits(vertex, fragment, bits);
return cacheMap[cacheId];
};
exports.compileHighShaderGl = function({template, bits}) {
const cacheId = generateCacheId(template, bits);
if (cacheMap[cacheId]) {
return cacheMap[cacheId];
}
cacheMap[cacheId] = compileBits(template.vertex, template.fragment, bits);
return cacheMap[cacheId];
};
};
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$rendering$high_shader$compiler$compileHighShader.js.map