(mode)
| 155 | }); |
| 156 | |
| 157 | function threeArgumentLayerDeepFloat(mode) { |
| 158 | const gpu = new GPU({ mode }); |
| 159 | function child1Function(child1FunctionArgument1) { |
| 160 | return child1FunctionArgument1 + 1; |
| 161 | } |
| 162 | function child2Function(child2FunctionArgument1) { |
| 163 | return child2FunctionArgument1 + 1; |
| 164 | } |
| 165 | function child3Function(child3FunctionArgument1) { |
| 166 | return child3FunctionArgument1 + 1; |
| 167 | } |
| 168 | gpu |
| 169 | .addFunction(child1Function) |
| 170 | .addFunction(child2Function) |
| 171 | .addFunction(child3Function); |
| 172 | const kernel = gpu.createKernel(function(kernelArgument1) { |
| 173 | return child1Function(child2Function(child3Function(kernelArgument1))); |
| 174 | }, { output: [1] }); |
| 175 | sinon.spy(FunctionBuilder.prototype, 'lookupReturnType'); |
| 176 | try { |
| 177 | const result = kernel(1.5); |
| 178 | assert.equal(result[0], 4.5); |
| 179 | assert.equal(FunctionBuilder.prototype.lookupReturnType.callCount, 5); |
| 180 | assert.equal(FunctionBuilder.prototype.lookupReturnType.args[0][0], 'child3Function'); |
| 181 | assert.equal(FunctionBuilder.prototype.lookupReturnType.args[1][0], 'child2Function'); |
| 182 | assert.equal(FunctionBuilder.prototype.lookupReturnType.args[2][0], 'child1Function'); |
| 183 | assert.equal(FunctionBuilder.prototype.lookupReturnType.args[3][0], 'child2Function'); |
| 184 | assert.equal(FunctionBuilder.prototype.lookupReturnType.args[4][0], 'child3Function'); |
| 185 | } finally { |
| 186 | FunctionBuilder.prototype.lookupReturnType.restore(); |
| 187 | } |
| 188 | } |
| 189 | |
| 190 | (GPU.isWebGLSupported ? test : skip)('three argument layer deep float WebGL', () => { |
| 191 | threeArgumentLayerDeepFloat('webgl'); |
no test coverage detected
searching dependent graphs…