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

Method addFunction

src/backend/kernel.js:320–331  ·  view source on GitHub ↗

* * @param {KernelFunction|string|IGPUFunction} source * @param {IFunctionSettings} [settings] * @return {Kernel}

(source, settings = {})

Source from the content-addressed store, hash-verified

318 * @return {Kernel}
319 */
320 addFunction(source, settings = {}) {
321 if (source.name && source.source && source.argumentTypes && 'returnType' in source) {
322 this.functions.push(source);
323 } else if ('settings' in source && 'source' in source) {
324 this.functions.push(this.functionToIGPUFunction(source.source, source.settings));
325 } else if (typeof source === 'string' || typeof source === 'function') {
326 this.functions.push(this.functionToIGPUFunction(source, settings));
327 } else {
328 throw new Error(`function not properly defined`);
329 }
330 return this;
331 }
332
333 /**
334 *

Callers 2

mergeSettingsMethod · 0.95
setFunctionsMethod · 0.95

Calls 1

Tested by

no test coverage detected