* @desc Kernel Implementation for CPU. * Instantiates properties to the CPU Kernel.
| 9 | * <p>Instantiates properties to the CPU Kernel.</p> |
| 10 | */ |
| 11 | class CPUKernel extends Kernel { |
| 12 | static getFeatures() { |
| 13 | return this.features; |
| 14 | } |
| 15 | static get features() { |
| 16 | return Object.freeze({ |
| 17 | kernelMap: true, |
| 18 | isIntegerDivisionAccurate: true |
| 19 | }); |
| 20 | } |
| 21 | static get isSupported() { |
| 22 | return true; |
| 23 | } |
| 24 | static isContextMatch(context) { |
| 25 | return false; |
| 26 | } |
| 27 | /** |
| 28 | * @desc The current mode in which gpu.js is executing. |
| 29 | */ |
| 30 | static get mode() { |
| 31 | return 'cpu'; |
| 32 | } |
| 33 | |
| 34 | static nativeFunctionArguments() { |
| 35 | return null; |
| 36 | } |
| 37 | |
| 38 | static nativeFunctionReturnType() { |
| 39 | throw new Error(`Looking up native function return type not supported on ${this.name}`); |
| 40 | } |
| 41 | |
| 42 | static combineKernels(combinedKernel) { |
| 43 | return combinedKernel; |
| 44 | } |
| 45 | |
| 46 | static getSignature(kernel, argumentTypes) { |
| 47 | return 'cpu' + (argumentTypes.length > 0 ? ':' + argumentTypes.join(',') : ''); |
| 48 | } |
| 49 | |
| 50 | constructor(source, settings) { |
| 51 | super(source, settings); |
| 52 | this.mergeSettings(source.settings || settings); |
| 53 | |
| 54 | this._imageData = null; |
| 55 | this._colorData = null; |
| 56 | this._kernelString = null; |
| 57 | this._prependedString = []; |
| 58 | this.thread = { |
| 59 | x: 0, |
| 60 | y: 0, |
| 61 | z: 0 |
| 62 | }; |
| 63 | this.translatedSources = null; |
| 64 | } |
| 65 | |
| 66 | initCanvas() { |
| 67 | if (typeof document !== 'undefined') { |
| 68 | return document.createElement('canvas'); |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…