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

36 lines
1.4 KiB
JavaScript

shadow$provide.module$node_modules$pixi_DOT_js$lib$rendering$high_shader$compiler$utils$compileOutputs = function(global, require, module, exports) {
function extractOutputs(fragmentSource, out) {
let match;
const regex = /@out\s+([^;]+);/g;
for (; null !== (match = regex.exec(fragmentSource));) {
out.push(match[1]);
}
}
exports.compileOutputs = function(fragments, template) {
const results = [];
extractOutputs(template, results);
fragments.forEach(fragment => {
fragment.header && extractOutputs(fragment.header, results);
});
let index = 0;
fragments = results.sort().map(inValue => -1 < inValue.indexOf("builtin") ? inValue : `@location(${index++}) ${inValue}`).join(",\n");
const mainStart = results.sort().map(inValue => ` var ${inValue.replace(/@.*?\s+/g, "")};`).join("\n"), mainEnd = `return VSOutput(
${results.sort().map(inValue => {
inValue = /\b(\w+)\s*:/g.exec(inValue);
return ` ${inValue ? inValue[1] : ""}`;
}).join(",\n")});`;
template = template.replace(/@out\s+[^;]+;\s*/g, "");
template = template.replace("{{struct}}", `
${fragments}
`);
template = template.replace("{{start}}", `
${mainStart}
`);
return template = template.replace("{{return}}", `
${mainEnd}
`);
};
};
//# sourceMappingURL=module$node_modules$pixi_DOT_js$lib$rendering$high_shader$compiler$utils$compileOutputs.js.map