* * @param {KernelFunction|string|IGPUFunction} source * @param {IFunctionSettings} [settings] * @return {Kernel}
(source, settings = {})
| 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 | * |
no test coverage detected