MCPcopy Create free account
hub / github.com/gpujs/gpu.js / replaceArtifacts

Method replaceArtifacts

src/backend/web-gl/kernel.js:1461–1468  ·  view source on GitHub ↗

* @param {String} src - Shader string * @param {Object} map - Variables/Constants associated with shader

(src, map)

Source from the content-addressed store, hash-verified

1459 * @param {Object} map - Variables/Constants associated with shader
1460 */
1461 replaceArtifacts(src, map) {
1462 return src.replace(/[ ]*__([A-Z]+[0-9]*([_]?[A-Z]*[0-9]?)*)__;\n/g, (match, artifact) => {
1463 if (map.hasOwnProperty(artifact)) {
1464 return map[artifact];
1465 }
1466 throw `unhandled artifact ${artifact}`;
1467 });
1468 }
1469
1470 /**
1471 * @desc Get the fragment shader String.

Callers 2

getFragmentShaderMethod · 0.95
getVertexShaderMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected