(mode)
| 36 | }); |
| 37 | |
| 38 | function twoLayerDeepFloat(mode) { |
| 39 | const gpu = new GPU({ mode }); |
| 40 | function child1Function(child1FunctionArgument1) { |
| 41 | return child2Function(child1FunctionArgument1); |
| 42 | } |
| 43 | function child2Function(child2FunctionArgument1) { |
| 44 | return child2FunctionArgument1 + 1; |
| 45 | } |
| 46 | gpu |
| 47 | .addFunction(child1Function) |
| 48 | .addFunction(child2Function); |
| 49 | const kernel = gpu.createKernel(function(kernelArgument1) { |
| 50 | return child1Function(kernelArgument1); |
| 51 | }, { output: [1] }); |
| 52 | sinon.spy(FunctionBuilder.prototype, 'lookupReturnType'); |
| 53 | try { |
| 54 | const result = kernel(1.5); |
| 55 | assert.equal(result[0], 2.5); |
| 56 | assert.equal(FunctionBuilder.prototype.lookupReturnType.callCount, 3); |
| 57 | assert.equal(FunctionBuilder.prototype.lookupReturnType.args[0][0], 'child1Function'); |
| 58 | assert.equal(FunctionBuilder.prototype.lookupReturnType.args[1][0], 'child2Function'); |
| 59 | assert.equal(FunctionBuilder.prototype.lookupReturnType.args[2][0], 'child2Function'); |
| 60 | } finally { |
| 61 | FunctionBuilder.prototype.lookupReturnType.restore(); |
| 62 | } |
| 63 | } |
| 64 | |
| 65 | (GPU.isWebGLSupported ? test : skip)('two layer deep float WebGL', () => { |
| 66 | twoLayerDeepFloat('webgl'); |
no test coverage detected
searching dependent graphs…