* @desc Validate settings related to Kernel, such as dimensions size, and auto output support. * @param {IArguments} args
(args)
| 85 | * @param {IArguments} args |
| 86 | */ |
| 87 | validateSettings(args) { |
| 88 | if (!this.output || this.output.length === 0) { |
| 89 | if (args.length !== 1) { |
| 90 | throw new Error('Auto output only supported for kernels with only one input'); |
| 91 | } |
| 92 | |
| 93 | const argType = utils.getVariableType(args[0], this.strictIntegers); |
| 94 | if (argType === 'Array') { |
| 95 | this.output = utils.getDimensions(argType); |
| 96 | } else if (argType === 'NumberTexture' || argType === 'ArrayTexture(4)') { |
| 97 | this.output = args[0].output; |
| 98 | } else { |
| 99 | throw new Error('Auto output not supported for input type: ' + argType); |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | if (this.graphical) { |
| 104 | if (this.output.length !== 2) { |
| 105 | throw new Error('Output must have 2 dimensions on graphical mode'); |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | this.checkOutput(); |
| 110 | } |
| 111 | |
| 112 | translateSource() { |
| 113 | this.leadingReturnStatement = this.output.length > 1 ? 'resultX[x] = ' : 'result[x] = '; |
no test coverage detected